Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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 object.
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 class Octree;
49 typedef boost::shared_ptr<Octree> OctreeSharedPtr;
50 
51 /**
52  * Enumeration of condition types (Dirichlet, Neumann, etc).
53  */
55 {
62 };
63 
64 /**
65  * @brief Defines a boundary condition.
66  *
67  * A boundary condition is defined by its type (e.g. Dirichlet), the
68  * field it applies to, the value imposed on this field and the
69  * composite which the boundary condition is applied to.
70  */
71 struct Condition
72 {
74  {
75  }
76  std::vector<ConditionType> type;
77  std::vector<std::string> field;
78  std::vector<std::string> value;
79  std::vector<int> m_composite;
80 };
81 
82 typedef boost::shared_ptr<Condition> ConditionSharedPtr;
83 typedef std::map<int, ConditionSharedPtr> ConditionMap;
84 
85 NEKMESHUTILS_EXPORT bool operator==(ConditionSharedPtr const &c1,
86  ConditionSharedPtr const &c2);
87 
88 class Mesh
89 {
90 public:
92  {
93  }
94 
95  /// Verbose flag
96  bool m_verbose;
97  /// Dimension of the expansion.
98  unsigned int m_expDim;
99  /// Dimension of the space in which the mesh is defined.
100  unsigned int m_spaceDim;
101  /// a order tag to aid output, a bit of a hack
102  unsigned int m_nummode;
103  /// List of mesh nodes.
104  std::vector<NodeSharedPtr> m_node;
105  /// Set of element vertices.
107  /// used for meshing purposes to keep trac of ids
109  /// Set of element edges.
111  /// Set of element faces.
113  /// Map for elements.
115  /// Map for composites.
117  /// Boundary conditions maps tag to condition.
118  ConditionMap m_condition;
119  /// List of fields names.
120  std::vector<std::string> m_fields;
121  /// Map of vertex normals.
122  boost::unordered_map<int, Node> m_vertexNormals;
123  /// Set of all pairs of element ID and edge/face number on which to
124  /// apply spherigon surface smoothing.
125  std::set<std::pair<int, int> > m_spherigonSurfs;
126  /// List of face labels for composite annotation
127  std::map<int, std::string> m_faceLabels;
128  /// CAD system pointer, if there is no cad its empty
130  /// Octree system pointer, if there is no octree its empty
131  OctreeSharedPtr m_octree;
132 
133 
134  /// Returns the total number of elements in the mesh with
135  /// dimension expDim.
136  NEKMESHUTILS_EXPORT unsigned int GetNumElements();
137  /// Returns the total number of elements in the mesh with
138  /// dimension < expDim.
140  /// Returns the total number of entities in the mesh.
141  NEKMESHUTILS_EXPORT unsigned int GetNumEntities();
142 
143  NEKMESHUTILS_EXPORT void MakeOrder(int order,
144  LibUtilities::PointsType distType);
145 };
146 /// Shared pointer to a mesh.
147 typedef boost::shared_ptr<Mesh> MeshSharedPtr;
148 }
149 }
150 
151 #endif
Defines a boundary condition.
Definition: Mesh.h:71
FaceSet m_faceSet
Set of element faces.
Definition: Mesh.h:112
CompositeMap m_composite
Map for composites.
Definition: Mesh.h:116
boost::shared_ptr< Octree > OctreeSharedPtr
Definition: Mesh.h:48
std::vector< ConditionType > type
Definition: Mesh.h:76
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:108
std::vector< std::string > value
Definition: Mesh.h:78
std::vector< std::string > field
Definition: Mesh.h:77
unsigned int m_nummode
a order tag to aid output, a bit of a hack
Definition: Mesh.h:102
unsigned int m_spaceDim
Dimension of the space in which the mesh is defined.
Definition: Mesh.h:100
OctreeSharedPtr m_octree
Octree system pointer, if there is no octree its empty.
Definition: Mesh.h:131
unsigned int m_expDim
Dimension of the expansion.
Definition: Mesh.h:98
NEKMESHUTILS_EXPORT Mesh()
Definition: Mesh.h:91
ConditionMap m_condition
Boundary conditions maps tag to condition.
Definition: Mesh.h:118
boost::unordered_set< NodeSharedPtr, NodeHash > NodeSet
Definition: Node.h:441
NEKMESHUTILS_EXPORT void MakeOrder(int order, LibUtilities::PointsType distType)
Convert this mesh into a mesh of uniform polynomial order order with a curve point distribution distT...
Definition: Mesh.cpp:99
bool operator==(ElmtConfig const &c1, ElmtConfig const &c2)
Compares two element config structs.
std::vector< std::string > m_fields
List of fields names.
Definition: Mesh.h:120
ElementMap m_element
Map for elements.
Definition: Mesh.h:114
boost::unordered_set< FaceSharedPtr, FaceHash > FaceSet
Definition: Face.h:179
std::map< int, ConditionSharedPtr > ConditionMap
Definition: Mesh.h:83
NodeSet m_vertexSet
Set of element vertices.
Definition: Mesh.h:106
CADSystemSharedPtr m_cad
CAD system pointer, if there is no cad its empty.
Definition: Mesh.h:129
class for octree
Definition: Octree.h:107
EdgeSet m_edgeSet
Set of element edges.
Definition: Mesh.h:110
std::map< int, std::string > m_faceLabels
List of face labels for composite annotation.
Definition: Mesh.h:127
NEKMESHUTILS_EXPORT unsigned int GetNumEntities()
Returns the total number of entities in the mesh.
Definition: Mesh.cpp:73
boost::shared_ptr< Condition > ConditionSharedPtr
Definition: Mesh.h:82
std::vector< int > m_composite
Definition: Mesh.h:79
bool m_verbose
Verbose flag.
Definition: Mesh.h:96
NEKMESHUTILS_EXPORT unsigned int GetNumBndryElements()
Returns the total number of elements in the mesh with dimension < expDim.
Definition: Mesh.cpp:59
boost::shared_ptr< Mesh > MeshSharedPtr
Shared pointer to a mesh.
Definition: Mesh.h:147
NEKMESHUTILS_EXPORT unsigned int GetNumElements()
Returns the total number of elements in the mesh with dimension expDim.
Definition: Mesh.cpp:50
boost::shared_ptr< CADSystem > CADSystemSharedPtr
Definition: CADSystem.h:218
#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:409
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:125
boost::unordered_set< EdgeSharedPtr, EdgeHash > EdgeSet
Definition: Edge.h:162
std::vector< NodeSharedPtr > m_node
List of mesh nodes.
Definition: Mesh.h:104
boost::unordered_map< int, Node > m_vertexNormals
Map of vertex normals.
Definition: Mesh.h:122