tetgen_scaffold_mesh.h
Go to the documentation of this file.
1// LIC// ====================================================================
2// LIC// This file forms part of oomph-lib, the object-oriented,
3// LIC// multi-physics finite-element library, available
4// LIC// at http://www.oomph-lib.org.
5// LIC//
6// LIC// Copyright (C) 2006-2025 Matthias Heil and Andrew Hazel
7// LIC//
8// LIC// This library is free software; you can redistribute it and/or
9// LIC// modify it under the terms of the GNU Lesser General Public
10// LIC// License as published by the Free Software Foundation; either
11// LIC// version 2.1 of the License, or (at your option) any later version.
12// LIC//
13// LIC// This library is distributed in the hope that it will be useful,
14// LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16// LIC// Lesser General Public License for more details.
17// LIC//
18// LIC// You should have received a copy of the GNU Lesser General Public
19// LIC// License along with this library; if not, write to the Free Software
20// LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21// LIC// 02110-1301 USA.
22// LIC//
23// LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
24// LIC//
25// LIC//====================================================================
26#ifndef OOMPH_TETGEN_SCAFFOLD_MESH_HEADER
27#define OOMPH_TETGEN_SCAFFOLD_MESH_HEADER
28
29#include "mesh.h"
30#include "Telements.h"
31
32// Include the data structure from tetgen
33
34#ifdef OOMPH_HAS_NEW_TETGEN
35#include "oomph_tetgen_1.6/tetgen.h"
36#else
37#include "oomph_tetgen/tetgen.h"
38#endif
39
40namespace oomph
41{
42 //======================================================================
43 /// Mesh that is based on input files generated by the tetrahedra
44 /// mesh generator tetgen.
45 //======================================================================
46 class TetgenScaffoldMesh : public virtual Mesh
47 {
48 public:
49 /// Empty constructor
51
52 /// Constructor: Pass the filename of the tetrahedra file
53 TetgenScaffoldMesh(const std::string& node_file_name,
54 const std::string& element_file_name,
55 const std::string& face_file_name);
56
57 /// Constructor using direct tetgenio object
59
60 /// Empty destructor
62
63 /// Return the global node of each local node
64 /// listed element-by-element e*n_local_node + n_local
65 /// Note that the node numbers are indexed from 1
66 unsigned global_node_number(const unsigned& i)
67 {
68 return Global_node[i];
69 }
70
71 /// Return the boundary id of the i-th face in the e-th element:
72 /// This is zero-based as in tetgen. Zero means the face is not
73 /// on a boundary. Postive numbers identify the boundary.
74 /// Will be reduced by one to identify the oomph-lib boundary.
75 unsigned face_boundary(const unsigned& e, const unsigned& i) const
76 {
77 return Face_boundary[e][i];
78 }
79
80 /// Return the number of internal edges
81 unsigned nglobal_edge()
82 {
83 return Nglobal_edge;
84 }
85
86 /// Return a boolean indicating whether the i-th global
87 /// edge is on a boundary
88 bool edge_boundary(const unsigned& i)
89 {
90 return Edge_boundary[i];
91 }
92
93 /// Return the global index of the i-th edge in the e-th element:
94 /// The global index starts from zero
95 unsigned edge_index(const unsigned& e, const unsigned& i) const
96 {
97 return Edge_index[e][i];
98 }
99
100 /// Return the number of internal face
101 unsigned nglobal_face()
102 {
103 return Nglobal_face;
104 }
105
106 /// Return the global index of the i-th face in the e-th element:
107 /// The global index starts from zero
108 unsigned face_index(const unsigned& e, const unsigned& i) const
109 {
110 return Face_index[e][i];
111 }
112
113 /// Return the attribute of the element e.
114 /// NOTE: Attributes are doubles because tetgen forces us to! We only
115 /// use them for region IDs
116 double element_attribute(const unsigned& e) const
117 {
118 return Element_attribute[e];
119 }
120
121
122 protected:
123 /// Storage for the number of global faces
124 unsigned Nglobal_face;
125
126 /// Storage for the number of global edges
127 unsigned Nglobal_edge;
128
129 /// Storage for global node numbers listed element-by-element
131
132 /// Vector of booleans to indicate whether a global edge lies
133 /// on a boundary
134 std::vector<bool> Edge_boundary;
135
136 /// Vector of vectors containing the boundary ids of the
137 /// elements' faces
139
140 /// Vector of vectors containing the global edge index of
141 // the elements' edges
143
144 /// Vector of vectors containing the global edge index of
145 // the elements' edges
147
148 /// Vector of double attributes for each element.
149 /// NOTE: This stores doubles because tetgen forces us to! We only
150 /// use it for region IDs
152 };
153
154} // namespace oomph
155
156#endif
e
Definition cfortran.h:571
cstr elem_len * i
Definition cfortran.h:603
A general mesh class.
Definition mesh.h:67
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
Mesh that is based on input files generated by the tetrahedra mesh generator tetgen.
std::vector< bool > Edge_boundary
Vector of booleans to indicate whether a global edge lies on a boundary.
unsigned Nglobal_face
Storage for the number of global faces.
TetgenScaffoldMesh()
Empty constructor.
unsigned face_boundary(const unsigned &e, const unsigned &i) const
Return the boundary id of the i-th face in the e-th element: This is zero-based as in tetgen....
Vector< double > Element_attribute
Vector of double attributes for each element. NOTE: This stores doubles because tetgen forces us to!...
unsigned nglobal_edge()
Return the number of internal edges.
bool edge_boundary(const unsigned &i)
Return a boolean indicating whether the i-th global edge is on a boundary.
~TetgenScaffoldMesh()
Empty destructor.
Vector< Vector< unsigned > > Face_index
Vector of vectors containing the global edge index of.
double element_attribute(const unsigned &e) const
Return the attribute of the element e. NOTE: Attributes are doubles because tetgen forces us to!...
unsigned edge_index(const unsigned &e, const unsigned &i) const
Return the global index of the i-th edge in the e-th element: The global index starts from zero.
unsigned global_node_number(const unsigned &i)
Return the global node of each local node listed element-by-element e*n_local_node + n_local Note tha...
unsigned Nglobal_edge
Storage for the number of global edges.
Vector< Vector< unsigned > > Edge_index
Vector of vectors containing the global edge index of.
Vector< unsigned > Global_node
Storage for global node numbers listed element-by-element.
Vector< Vector< unsigned > > Face_boundary
Vector of vectors containing the boundary ids of the elements' faces.
unsigned nglobal_face()
Return the number of internal face.
unsigned face_index(const unsigned &e, const unsigned &i) const
Return the global index of the i-th face in the e-th element: The global index starts from zero.
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).