Nektar++
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 // Permission is hereby granted, free of charge, to any person obtaining a
14 // copy of this software and associated documentation files (the "Software"),
15 // to deal in the Software without restriction, including without limitation
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 // and/or sell copies of the Software, and to permit persons to whom the
18 // Software is furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included
21 // in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 // DEALINGS IN THE SOFTWARE.
30 //
31 // Description: Mesh object.
32 //
33 ////////////////////////////////////////////////////////////////////////////////
34 
35 #ifndef NEKMESHUTILS_MESHELEMENTS_MESH
36 #define NEKMESHUTILS_MESHELEMENTS_MESH
37 
38 #include <set>
39 
41 
45 
46 namespace Nektar
47 {
48 namespace NekMeshUtils
49 {
50 
51 class Octree;
52 typedef std::shared_ptr<Octree> OctreeSharedPtr;
53 
54 /**
55  * Enumeration of condition types (Dirichlet, Neumann, etc).
56  */
58 {
65 };
66 
67 /**
68  * @brief Defines a boundary condition.
69  *
70  * A boundary condition is defined by its type (e.g. Dirichlet), the
71  * field it applies to, the value imposed on this field and the
72  * composite which the boundary condition is applied to.
73  */
74 struct Condition
75 {
77  {
78  }
79  std::vector<ConditionType> type;
80  std::vector<std::string> field;
81  std::vector<std::string> value;
82  std::vector<int> m_composite;
83 };
84 
85 typedef std::shared_ptr<Condition> ConditionSharedPtr;
86 typedef std::map<int, ConditionSharedPtr> ConditionMap;
87 
88 NEKMESHUTILS_EXPORT bool operator==(ConditionSharedPtr const &c1,
89  ConditionSharedPtr const &c2);
90 
91 class Mesh
92 {
93 public:
94  NEKMESHUTILS_EXPORT Mesh() : m_verbose(false), m_nummode(0)
95  {
96  }
97 
98  /// Verbose flag
99  bool m_verbose;
100  /// Dimension of the expansion.
101  unsigned int m_expDim;
102  /// Dimension of the space in which the mesh is defined.
103  unsigned int m_spaceDim;
104  /// a order tag to aid output, a bit of a hack
105  unsigned int m_nummode;
106  /// List of mesh nodes.
107  std::vector<NodeSharedPtr> m_node;
108  /// Set of element vertices.
110  /// used for meshing purposes to keep trac of ids
112  /// Set of element edges.
114  /// Set of element faces.
116  /// Map for elements.
118  /// Map for composites.
120  /// Boundary conditions maps tag to condition.
121  ConditionMap m_condition;
122  /// List of fields names.
123  std::vector<std::string> m_fields;
124  /// Map of vertex normals.
125  std::unordered_map<int, Node> m_vertexNormals;
126  /// Set of all pairs of element ID and edge/face number on which to
127  /// apply spherigon surface smoothing.
128  std::set<std::pair<int, int> > m_spherigonSurfs;
129  /// List of face labels for composite annotation
130  std::map<int, std::string> m_faceLabels;
131  /// CAD system pointer, if there is no cad its empty
133  /// Octree system pointer, if there is no octree its empty
134  OctreeSharedPtr m_octree;
135  /// Metadata map for storing any mesh generation parameters
137  /// MPI communicator in case we end up using MPI multiple times from
138  /// Nektar++ SessionReader object.
140 
141  /// Returns the total number of elements in the mesh with
142  /// dimension expDim.
143  NEKMESHUTILS_EXPORT unsigned int GetNumElements();
144  /// Returns the total number of elements in the mesh with
145  /// dimension < expDim.
146  NEKMESHUTILS_EXPORT unsigned int GetNumBndryElements();
147  /// Returns the total number of entities in the mesh.
148  NEKMESHUTILS_EXPORT unsigned int GetNumEntities();
149 
150  NEKMESHUTILS_EXPORT void MakeOrder(int order,
151  LibUtilities::PointsType distType);
152 
153  NEKMESHUTILS_EXPORT void PrintStats(std::ostream &out);
154 };
155 /// Shared pointer to a mesh.
156 typedef std::shared_ptr<Mesh> MeshSharedPtr;
157 }
158 }
159 
160 #endif
Defines a boundary condition.
Definition: Mesh.h:74
FaceSet m_faceSet
Set of element faces.
Definition: Mesh.h:115
LibUtilities::FieldMetaDataMap m_metadata
Metadata map for storing any mesh generation parameters.
Definition: Mesh.h:136
CompositeMap m_composite
Map for composites.
Definition: Mesh.h:119
std::unordered_map< int, Node > m_vertexNormals
Map of vertex normals.
Definition: Mesh.h:125
std::unordered_set< EdgeSharedPtr, EdgeHash > EdgeSet
Definition: Edge.h:159
std::vector< ConditionType > type
Definition: Mesh.h:79
std::map< unsigned int, CompositeSharedPtr > CompositeMap
Container of composites; key is the composite id, value is the composite.
Definition: Composite.h:73
int m_numNodes
used for meshing purposes to keep trac of ids
Definition: Mesh.h:111
std::vector< std::string > value
Definition: Mesh.h:81
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:53
std::vector< std::string > field
Definition: Mesh.h:80
std::shared_ptr< CADSystem > CADSystemSharedPtr
Definition: CADSystem.h:240
unsigned int m_nummode
a order tag to aid output, a bit of a hack
Definition: Mesh.h:105
unsigned int m_spaceDim
Dimension of the space in which the mesh is defined.
Definition: Mesh.h:103
OctreeSharedPtr m_octree
Octree system pointer, if there is no octree its empty.
Definition: Mesh.h:134
std::shared_ptr< Octree > OctreeSharedPtr
Definition: Mesh.h:51
std::shared_ptr< Mesh > MeshSharedPtr
Shared pointer to a mesh.
Definition: Mesh.h:156
unsigned int m_expDim
Dimension of the expansion.
Definition: Mesh.h:101
NEKMESHUTILS_EXPORT Mesh()
Definition: Mesh.h:94
ConditionMap m_condition
Boundary conditions maps tag to condition.
Definition: Mesh.h:121
std::map< std::string, std::string > FieldMetaDataMap
Definition: FieldIO.h:52
std::unordered_set< NodeSharedPtr, NodeHash > NodeSet
Definition: Node.h:447
bool operator==(ElmtConfig const &c1, ElmtConfig const &c2)
Compares two element config structs.
std::unordered_set< FaceSharedPtr, FaceHash > FaceSet
Definition: Face.h:181
std::vector< std::string > m_fields
List of fields names.
Definition: Mesh.h:123
ElementMap m_element
Map for elements.
Definition: Mesh.h:117
LibUtilities::CommSharedPtr m_comm
MPI communicator in case we end up using MPI multiple times from Nektar++ SessionReader object...
Definition: Mesh.h:139
std::map< int, ConditionSharedPtr > ConditionMap
Definition: Mesh.h:86
NodeSet m_vertexSet
Set of element vertices.
Definition: Mesh.h:109
CADSystemSharedPtr m_cad
CAD system pointer, if there is no cad its empty.
Definition: Mesh.h:132
class for octree
Definition: Octree.h:106
EdgeSet m_edgeSet
Set of element edges.
Definition: Mesh.h:113
std::map< int, std::string > m_faceLabels
List of face labels for composite annotation.
Definition: Mesh.h:130
std::vector< int > m_composite
Definition: Mesh.h:82
bool m_verbose
Verbose flag.
Definition: Mesh.h:99
#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:491
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:128
std::vector< NodeSharedPtr > m_node
List of mesh nodes.
Definition: Mesh.h:107
std::shared_ptr< Condition > ConditionSharedPtr
Definition: Mesh.h:85