LifeV
MeshVertex.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 Zero dimensional entity
30 
31  @author Luca Formaggia <luca.formaggia@polimi.it>
32  @contributor Marta D'Elia <mdelia2@mathcs.emory.edu>
33  @maintainer Marta D'Elia <mdelia2@mathcs.emory.edu>
34 
35  @date 00-00-0000
36 
37 */
38 
39 
40 #ifndef MESHVERTEX_H
41 #define MESHVERTEX_H
42 
43 #include <lifev/core/array/VectorSmall.hpp>
44 #include <lifev/core/mesh/MeshEntity.hpp>
45 #include <lifev/core/mesh/ElementShapes.hpp>
46 
47 namespace LifeV
48 {
49 //! MeshVertex - Zero dimensional entity.
50 /*!
51  @author
52  Intermediate class used to build the actual Geometry classes; it stores boundary information.
53 
54  @warning MeshVertex is a template class; in fact, information might not be known a priori.
55  All vector dimensions are determined at compile time to enhance memory access time.
56  A coherent GeoShape has to be provided by the user.
57 
58  */
59 class MeshVertex : public MeshEntity
60 {
61 public:
62 
63  //! @name Public Types
64  //@{
65 
67 
68  //@}
69 
70  //! @name Constructor & Destructor
71  //@{
72 
73  //! Empty Constructor
74  MeshVertex();
75 
76  //! Declares item identity and states if it is on boundary
77  /*!
78  Local and global id are set equal. To change global id
79  use setId() method (inherited from MeshEntity)
80  @param identity Element identity (local and global)
81  @param boundary True if the element is on boundary
82  */
83  explicit MeshVertex ( ID identity, bool boundary = false );
84 
85  //! Declares item identity, provides coordinate and states if it is on boundary
86  /*!
87  @param identity Element identity
88  @param x Element x coordinate
89  @param y Element y coordinate
90  @param z Element z coordinate
91  @param boundary True if the element is on boundary
92  */
93  MeshVertex ( ID identity, Real x, Real y, Real z, bool boundary = false );
94 
95  //! Destructor
96  virtual ~MeshVertex()
97  {
98  // nothing to be done
99  }
100 
101  //@}
102 
103  //! @name Operators
104  //@{
105  //@}
106 
107  //! @name Methods
108  //@{
109 
110  //! Display general information about the content of the class
111  /*!
112  List of things displayed in the class
113  @param output specify the output format (std::cout by default)
114  */
115  std::ostream& showMe ( bool Verbose = false, std::ostream& coordinateVector = std::cout ) const;
116 
117  //! Returns the pointer to the coordinates vector
118  /*!
119  @return Pointer to coordinate vector
120  */
121  Real const* coordinatesArray() const
122  {
123  return &M_coordinates[0];
124  };
125 
126  //! Returns the reference to the x-coordinate
127  /*!
128  Used to provide coordinates to object created using a constructor with no coordinates given, or to modify existing coordinates
129  @return Reference to element x-coordinate
130  */
131  Real& x()
132  {
133  return M_coordinates[ 0 ];
134  }
135  //! Returns the reference to the y-coordinate
136  /*!
137  Used to provide coordinates to object created using a constructor with no coordinates given, or to modify existing coordinates
138  @return Reference to element y-coordinate
139  */
140  Real& y()
141  {
142  return M_coordinates[ 1 ];
143  }
144  //! Returns the reference to the z-coordinate and checks if working in two dimensions
145  /*!
146  Used to provide coordinates to object created using a constructor with no coordinates given, or to modify existing coordinates
147  @return Reference to element z-coordinate
148  */
149  Real& z()
150  {
151  return M_coordinates[ 2 ];
152  }
153  //! Returns the x-coordinate
154  /*!
155  @return Element x-coordinate
156  */
157  Real x() const
158  {
159  return M_coordinates[ 0 ];
160  }
161  //! Returns the y-coordinate
162  /*!
163  @return Element y-coordinate
164  */
165  Real y() const
166  {
167  return M_coordinates[ 1 ];
168  };
169  //! Returns the z-coordinate and checks if working in two dimensions
170  /*!
171  @return Element z-coordinate
172  */
173  Real z() const
174  {
175  return M_coordinates[ 2 ];
176  }
177 
178  //! Returns the coordinate specified in the argument
179  /*!
180  The method allows to access the coordinate specified in the argument
181  @param coordinate x, y, or z coordinate to be returned
182  @return Coordinate specified in the argument
183  */
184  Real coordinate ( ID const coordinate ) const
185  {
186  ASSERT_BD ( coordinate < NDIM ) ;
187  return M_coordinates[ coordinate ];
188  }
189  //! Returns the reference to the coordinate specified in the argument
190  /*!
191  The method allows to modify the coordinate specified in the argument
192  @param coordinate x, y, or z coordinate to be returned
193  @return Reference to the coordinate specified in the argument
194  */
195  Real& coordinate ( ID const coordinate )
196  {
197  ASSERT_BD ( coordinate < NDIM ) ;
198  return M_coordinates[ coordinate ];
199  }
200 
201  //@}
202 
203  //! @name Get Methods
204  //@{
205 
206  //! Returns the coordinates vector
207  /*!
208  The method allows to access coordinates and modify them
209  @return Coordinates array
210  */
211  Vector3D const& coordinates () const
212  {
213  return M_coordinates;
214  }
215 
216  //@}
217 
218 private:
220 };
221 
222 }
223 #endif
This is the base class to store basic properties of any mesh entity.
Definition: MeshEntity.hpp:97
virtual ~MeshVertex()
Destructor.
Definition: MeshVertex.hpp:96
Real y() const
Returns the y-coordinate.
Definition: MeshVertex.hpp:165
#define ASSERT_BD(X)
Definition: LifeAssert.hpp:114
Real coordinate(ID const coordinate) const
Returns the coordinate specified in the argument.
Definition: MeshVertex.hpp:184
Real & coordinate(ID const coordinate)
Returns the reference to the coordinate specified in the argument.
Definition: MeshVertex.hpp:195
Real const & operator[](UInt const &i) const
Operator [].
Vector3D const & coordinates() const
Returns the coordinates vector.
Definition: MeshVertex.hpp:211
Real const * coordinatesArray() const
Returns the pointer to the coordinates vector.
Definition: MeshVertex.hpp:121
MeshVertex - Zero dimensional entity.
Definition: MeshVertex.hpp:59
MeshVertex(ID identity, bool boundary=false)
Declares item identity and states if it is on boundary.
Definition: MeshVertex.cpp:53
void updateInverseJacobian(const UInt &iQuadPt)
Real & z()
Returns the reference to the z-coordinate and checks if working in two dimensions.
Definition: MeshVertex.hpp:149
Real z() const
Returns the z-coordinate and checks if working in two dimensions.
Definition: MeshVertex.hpp:173
std::ostream & showMe(bool Verbose=false, std::ostream &coordinateVector=std::cout) const
Display general information about the content of the class.
Definition: MeshVertex.cpp:72
Real & operator[](UInt const &i)
Operator [].
Real & x()
Returns the reference to the x-coordinate.
Definition: MeshVertex.hpp:131
uint32_type ID
IDs.
Definition: LifeV.hpp:194
MeshVertex()
Empty Constructor.
Definition: MeshVertex.cpp:49
A Geometric Shape.
double Real
Generic real data.
Definition: LifeV.hpp:175
Vector3D M_coordinates
Definition: MeshVertex.hpp:219
MeshVertex(ID identity, Real x, Real y, Real z, bool boundary=false)
Declares item identity, provides coordinate and states if it is on boundary.
Definition: MeshVertex.cpp:58
VectorSmall< 3 > Vector3D
Real & y()
Returns the reference to the y-coordinate.
Definition: MeshVertex.hpp:140
Real x() const
Returns the x-coordinate.
Definition: MeshVertex.hpp:157
GeoPoint geoShape_Type
Definition: MeshVertex.hpp:66