Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Mesh.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // File: Mesh.h
4 //
5 // For more information, please see: http://www.nektar.info/
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Mesh manipulation objects.
33 //
34 ////////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKMESHUTILS_MESHELEMENTS_MESH
37 #define NEKMESHUTILS_MESHELEMENTS_MESH
38 
42 
43 namespace Nektar
44 {
45 namespace NekMeshUtils
46 {
47 /**
48  * Enumeration of condition types (Dirichlet, Neumann, etc).
49  */
51 {
58 };
59 
60 /**
61  * @brief Defines a boundary condition.
62  *
63  * A boundary condition is defined by its type (e.g. Dirichlet), the
64  * field it applies to, the value imposed on this field and the
65  * composite which the boundary condition is applied to.
66  */
67 struct Condition
68 {
70  {
71  }
72  std::vector<ConditionType> type;
73  std::vector<std::string> field;
74  std::vector<std::string> value;
75  std::vector<int> m_composite;
76 };
77 
78 typedef boost::shared_ptr<Condition> ConditionSharedPtr;
79 typedef std::map<int, ConditionSharedPtr> ConditionMap;
80 
81 NEKMESHUTILS_EXPORT bool operator==(ConditionSharedPtr const &c1,
82  ConditionSharedPtr const &c2);
83 
84 class Mesh
85 {
86 public:
88  {
89  }
90 
91  /// Verbose flag
92  bool m_verbose;
93  /// Dimension of the expansion.
94  unsigned int m_expDim;
95  /// Dimension of the space in which the mesh is defined.
96  unsigned int m_spaceDim;
97  /// a order tag to aid output, a bit of a hack
98  unsigned int m_nummode;
99  ///
100  unsigned int m_numcomp;
101  /// List of mesh nodes.
102  std::vector<NodeSharedPtr> m_node;
103  /// Set of element vertices.
105  /// used for meshing purposes to keep trac of ids
107  /// Set of element edges.
109  /// Set of element faces.
111  /// Map for elements.
113  /// Map for composites.
115  /// Boundary conditions maps tag to condition.
116  ConditionMap m_condition;
117  /// List of fields names.
118  std::vector<std::string> m_fields;
119  /// Map of vertex normals.
120  boost::unordered_map<int, Node> m_vertexNormals;
121  /// Set of all pairs of element ID and edge/face number on which to
122  /// apply spherigon surface smoothing.
123  std::set<std::pair<int, int> > m_spherigonSurfs;
124  /// List of face labels for composite annotation
125  std::map<int, std::string> m_faceLabels;
126 
127  /// Returns the total number of elements in the mesh with
128  /// dimension expDim.
129  NEKMESHUTILS_EXPORT unsigned int GetNumElements();
130  /// Returns the total number of elements in the mesh with
131  /// dimension < expDim.
133  /// Returns the total number of entities in the mesh.
134  NEKMESHUTILS_EXPORT unsigned int GetNumEntities();
135 };
136 /// Shared pointer to a mesh.
137 typedef boost::shared_ptr<Mesh> MeshSharedPtr;
138 }
139 }
140 
141 #endif
Defines a boundary condition.
Definition: Mesh.h:67
FaceSet m_faceSet
Set of element faces.
Definition: Mesh.h:110
CompositeMap m_composite
Map for composites.
Definition: Mesh.h:114
std::vector< ConditionType > type
Definition: Mesh.h:72
std::map< unsigned int, CompositeSharedPtr > CompositeMap
Container of composites; key is the composite id, value is the composite.
Definition: Composite.h:124
int m_numNodes
used for meshing purposes to keep trac of ids
Definition: Mesh.h:106
std::vector< std::string > value
Definition: Mesh.h:74
std::vector< std::string > field
Definition: Mesh.h:73
unsigned int m_numcomp
Definition: Mesh.h:100
unsigned int m_nummode
a order tag to aid output, a bit of a hack
Definition: Mesh.h:98
unsigned int m_spaceDim
Dimension of the space in which the mesh is defined.
Definition: Mesh.h:96
unsigned int m_expDim
Dimension of the expansion.
Definition: Mesh.h:94
NEKMESHUTILS_EXPORT Mesh()
Definition: Mesh.h:87
ConditionMap m_condition
Boundary conditions maps tag to condition.
Definition: Mesh.h:116
boost::unordered_set< NodeSharedPtr, NodeHash > NodeSet
Definition: Node.h:357
bool operator==(ElmtConfig const &c1, ElmtConfig const &c2)
std::vector< std::string > m_fields
List of fields names.
Definition: Mesh.h:118
ElementMap m_element
Map for elements.
Definition: Mesh.h:112
boost::unordered_set< FaceSharedPtr, FaceHash > FaceSet
Definition: Face.h:404
std::map< int, ConditionSharedPtr > ConditionMap
Definition: Mesh.h:79
NodeSet m_vertexSet
Set of element vertices.
Definition: Mesh.h:104
EdgeSet m_edgeSet
Set of element edges.
Definition: Mesh.h:108
std::map< int, std::string > m_faceLabels
List of face labels for composite annotation.
Definition: Mesh.h:125
NEKMESHUTILS_EXPORT unsigned int GetNumEntities()
Returns the total number of entities in the mesh.
Definition: Mesh.cpp:71
boost::shared_ptr< Condition > ConditionSharedPtr
Definition: Mesh.h:78
std::vector< int > m_composite
Definition: Mesh.h:75
bool m_verbose
Verbose flag.
Definition: Mesh.h:92
NEKMESHUTILS_EXPORT unsigned int GetNumBndryElements()
Returns the total number of elements in the mesh with dimension < expDim.
Definition: Mesh.cpp:57
boost::shared_ptr< Mesh > MeshSharedPtr
Shared pointer to a mesh.
Definition: Mesh.h:137
NEKMESHUTILS_EXPORT unsigned int GetNumElements()
Returns the total number of elements in the mesh with dimension expDim.
Definition: Mesh.cpp:48
#define NEKMESHUTILS_EXPORT
std::map< unsigned int, std::vector< ElementSharedPtr > > ElementMap
Container for elements; key is expansion dimension, value is vector of elements of that dimension...
Definition: Element.h:525
std::set< std::pair< int, int > > m_spherigonSurfs
Set of all pairs of element ID and edge/face number on which to apply spherigon surface smoothing...
Definition: Mesh.h:123
boost::unordered_set< EdgeSharedPtr, EdgeHash > EdgeSet
Definition: Edge.h:222
std::vector< NodeSharedPtr > m_node
List of mesh nodes.
Definition: Mesh.h:102
boost::unordered_map< int, Node > m_vertexNormals
Map of vertex normals.
Definition: Mesh.h:120