LifeV
VectorEpetraStructuredView.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 This file contains the the VectorEpetraStructuredView implementation.
30 
31  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
32  @date 07 Jun 2011
33  */
34 
35 #ifndef _VECTOREPETRASTRUCTUREDVIEW_HPP_
36 #define _VECTOREPETRASTRUCTUREDVIEW_HPP_ 1
37 
38 #include <lifev/core/LifeV.hpp>
39 
40 #include <lifev/core/array/VectorEpetra.hpp>
41 
42 namespace LifeV
43 {
44 
45 //! VectorEpetraStructuredView - class representing a block in a VectorEpetraStructuredView
46 /*!
47  @author Samuel Quinodoz
48 
49  The VectorEpetraStructuredView class contains data related
50  to block of a vector. It is useful to setup a clean and easy-to-use blocks management.
51 
52  For more information about the block structures in LifeV, see \ref BlockAlgebraPage "this page".
53  */
54 class VectorEpetraStructuredView
55 {
56 public:
57 
58  //! @name Public Types
59  //@{
60 
61  //! Typedef for the underlying vector type
62  typedef VectorEpetra vector_Type;
63 
64  //@}
65 
66 
67  //! @name Constructor & Destructor
68  //@{
69 
70  //! Default constructor.
71  VectorEpetraStructuredView();
72 
73  //! Copy constructor
74  /*!
75  Beware that using the copy constructor, the view is copied
76  but not the underlying vector (both views still look at the
77  same vector, not at different copies).
78  */
79  VectorEpetraStructuredView ( const VectorEpetraStructuredView& otherView );
80 
81  //! Default destructor
82  ~VectorEpetraStructuredView();
83 
84  //@}
85 
86 
87  //! @name Methods
88  //@{
89 
90  //! Print the informations about the VectorEpetraStructuredView
91  /*!
92  @param output Stream where to print the informations
93  */
94  void showMe (std::ostream& output = std::cout) const;
95 
96  //! Assembly procedure
97  /*!
98  This procedure should always have the same behaviour and the same
99  syntax than the corresponding method in MatrixEpetra.
100 
101  @param GID the global index of the element within the block viewed.
102  @param value the value to be added
103  */
104  Int sumIntoGlobalValues ( const Int GID, const Real value ) const;
105 
106  //@}
107 
108 
109  //! @name Set Methods
110  //@{
111 
112  /*! Set all the informations relative to the block
113  * @param firstIndex First index in the block
114  * @param blockSize Number of indices in the block
115  * @param vector Vector from which the view has to be extracted
116  */
117  void setup ( const UInt& firstIndex,
118  const UInt& blockSize,
119  vector_Type* vector );
120 
121  //@}
122 
123 
124  //! @name Get Methods
125  //@{
126 
127  //! Returns the size of the block
128  UInt blockSize() const
129  {
130  return M_blockSize;
131  }
132 
133  //! Returns the index in the block
134  UInt firstIndex() const
135  {
136  return M_firstIndex;
137  }
138 
139  //! Returns the last index in the block
140  UInt lastValidIndex() const
141  {
142  return M_lastValidIndex;
143  }
144 
145  //! Return the shared_pointer of the Epetra_FEVector
146  vector_Type* vectorPtr() const
147  {
148  return M_vector;
149  }
150 
151  //@}
152 
153 
154 private:
155 
156  //! @name Private Methods
157  //@{
158 
159  //! No assignement operator
160  /*!
161  The assignement operator is disabled in order to avoid confusing notation
162  like vector.block(0) = vector.block(1), that would only copy the views
163  and not the blocks.
164  */
165  VectorEpetraStructuredView operator= (const VectorEpetraStructuredView& otherView);
166 
167  //@}
168 
169  UInt M_blockSize;
170  UInt M_firstIndex;
171  UInt M_lastValidIndex;
172  vector_Type* M_vector;
173 };
174 
175 } // Namespace LifeV
176 
177 #endif /* _VECTOREPETRASTRUCTUREDVIEW_HPP_ */
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