LifeV
VectorBlockMonolithicEpetraView.hpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 *******************************************************************************
4 
5  Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6  Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University
7 
8  This file is part of LifeV.
9 
10  LifeV is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  LifeV is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with LifeV. If not, see <http://www.gnu.org/licenses/>.
22 
23 *******************************************************************************
24 */
25 //@HEADER
26 
27 /*!
28  @file
29  @brief A short description of the file content
30 
31  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
32  @date 07 Jun 2011
33 
34  This file contains the the VectorBlockMonolithicEpetraView implementation.
35  */
36 
37 #ifndef VECTOR_BLOCK_MONOLITHIC_EPETRA_VIEW_H
38 #define VECTOR_BLOCK_MONOLITHIC_EPETRA_VIEW_H 1
39 
40 #include <lifev/core/array/VectorEpetra.hpp>
41 
42 #include <lifev/core/LifeV.hpp>
43 
44 #include <boost/shared_ptr.hpp>
45 
46 namespace LifeV
47 {
48 
49 //! VectorBlockMonolithicEpetraView - class representing a block in a VectorBlockMonolithicEpetra
50 /*!
51  @author Samuel Quinodoz
52 
53  The VectorBlockMonolithicEpetraView class contains data related
54  to block of a vector. It is useful to setup a clean and easy-to-use blocks management.
55 
56  For more information about the block structures in LifeV, see \ref BlockAlgebraPage "this page".
57  */
58 class VectorBlockMonolithicEpetraView
59 {
60 public:
61 
62  //! @name Public Types
63  //@{
64 
65  //! Typedef for the underlying vector type
66  typedef VectorEpetra vector_Type;
67 
68  //@}
69 
70 
71  //! @name Constructor & Destructor
72  //@{
73 
74  //! Default constructor.
75  VectorBlockMonolithicEpetraView();
76 
77  //! Copy constructor
78  /*!
79  Beware that using the copy constructor, the view is copied
80  but not the underlying vector (both views still look at the
81  same vector, not at different copies).
82  */
83  VectorBlockMonolithicEpetraView ( const VectorBlockMonolithicEpetraView& otherView );
84 
85  //! Default destructor
86  ~VectorBlockMonolithicEpetraView();
87 
88  //@}
89 
90 
91  //! @name Methods
92  //@{
93 
94  //! Print the informations about the VectorBlockMonolithicEpetraView
95  /*!
96  @param output Stream where to print the informations
97  */
98  void showMe (std::ostream& output = std::cout) const;
99 
100  //! Assembly procedure
101  /*!
102  This procedure should always have the same behaviour and the same
103  syntax than the corresponding method in MatrixEpetra.
104 
105  @param GID the global index of the element within the block viewed.
106  @param value the value to be added
107  */
108  Int sumIntoGlobalValues ( const Int GID, const Real value ) const;
109 
110  //@}
111 
112 
113  //! @name Set Methods
114  //@{
115 
116  /*! Set all the informations relative to the block
117  * @param firstIndex First index in the block
118  * @param blockSize Number of indices in the block
119  * @param vector Vector from which the view has to be extracted
120  */
121  void setup ( const UInt& firstIndex,
122  const UInt& blockSize,
123  vector_Type* vector );
124 
125  //@}
126 
127 
128  //! @name Get Methods
129  //@{
130 
131  //! Returns the size of the block
132  UInt blockSize() const
133  {
134  return M_blockSize;
135  }
136 
137  //! Returns the index in the block
138  UInt firstIndex() const
139  {
140  return M_firstIndex;
141  }
142 
143  //! Returns the last index in the block
144  UInt lastValidIndex() const
145  {
146  return M_lastValidIndex;
147  }
148 
149  //! Return the shared_pointer of the Epetra_FEVector
150  vector_Type* vectorPtr() const
151  {
152  return M_vector;
153  }
154 
155  //@}
156 
157 
158 private:
159 
160  //! @name Private Methods
161  //@{
162 
163  //! No assignement operator
164  /*!
165  The assignement operator is disabled in order to avoid confusing notation
166  like vector.block(0) = vector.block(1), that would only copy the views
167  and not the blocks.
168  */
169  VectorBlockMonolithicEpetraView operator= (const VectorBlockMonolithicEpetraView& otherView);
170 
171  //@}
172 
173  UInt M_blockSize;
174  UInt M_firstIndex;
175  UInt M_lastValidIndex;
176  vector_Type* M_vector;
177 };
178 
179 } // Namespace LifeV
180 
181 #endif /* VECTORBLOCKVIEWEPETRA_H */
void assignFunction(bcBase_Type &base)
Assign the function to the base of the BCHandler.
int32_type Int
Generic integer data.
Definition: LifeV.hpp:188
double Real
Generic real data.
Definition: LifeV.hpp:175
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191