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-2024 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//#include "../../external_src/oomph_tetgen/tetgen.h"
34#include "oomph_tetgen/tetgen.h"
35
36namespace oomph
37{
38 //======================================================================
39 /// Mesh that is based on input files generated by the tetrahedra
40 /// mesh generator tetgen.
41 //======================================================================
42 class TetgenScaffoldMesh : public virtual Mesh
43 {
44 public:
45 /// Empty constructor
47
48 /// Constructor: Pass the filename of the tetrahedra file
49 TetgenScaffoldMesh(const std::string& node_file_name,
50 const std::string& element_file_name,
51 const std::string& face_file_name);
52
53 /// Constructor using direct tetgenio object
55
56 /// Empty destructor
58
59 /// Return the global node of each local node
60 /// listed element-by-element e*n_local_node + n_local
61 /// Note that the node numbers are indexed from 1
62 unsigned global_node_number(const unsigned& i)
63 {
64 return Global_node[i];
65 }
66
67 /// Return the boundary id of the i-th face in the e-th element:
68 /// This is zero-based as in tetgen. Zero means the face is not
69 /// on a boundary. Postive numbers identify the boundary.
70 /// Will be reduced by one to identify the oomph-lib boundary.
71 unsigned face_boundary(const unsigned& e, const unsigned& i) const
72 {
73 return Face_boundary[e][i];
74 }
75
76 /// Return the number of internal edges
77 unsigned nglobal_edge()
78 {
79 return Nglobal_edge;
80 }
81
82 /// Return a boolean indicating whether the i-th global
83 /// edge is on a boundary
84 bool edge_boundary(const unsigned& i)
85 {
86 return Edge_boundary[i];
87 }
88
89 /// Return the global index of the i-th edge in the e-th element:
90 /// The global index starts from zero
91 unsigned edge_index(const unsigned& e, const unsigned& i) const
92 {
93 return Edge_index[e][i];
94 }
95
96 /// Return the number of internal face
97 unsigned nglobal_face()
98 {
99 return Nglobal_face;
100 }
101
102 /// Return the global index of the i-th face in the e-th element:
103 /// The global index starts from zero
104 unsigned face_index(const unsigned& e, const unsigned& i) const
105 {
106 return Face_index[e][i];
107 }
108
109 /// Return the attribute of the element e.
110 /// NOTE: Attributes are doubles because tetgen forces us to! We only
111 /// use them for region IDs
112 double element_attribute(const unsigned& e) const
113 {
114 return Element_attribute[e];
115 }
116
117
118 protected:
119 /// Storage for the number of global faces
120 unsigned Nglobal_face;
121
122 /// Storage for the number of global edges
123 unsigned Nglobal_edge;
124
125 /// Storage for global node numbers listed element-by-element
127
128 /// Vector of booleans to indicate whether a global edge lies
129 /// on a boundary
130 std::vector<bool> Edge_boundary;
131
132 /// Vector of vectors containing the boundary ids of the
133 /// elements' faces
135
136 /// Vector of vectors containing the global edge index of
137 // the elements' edges
139
140 /// Vector of vectors containing the global edge index of
141 // the elements' edges
143
144 /// Vector of double attributes for each element.
145 /// NOTE: This stores doubles because tetgen forces us to! We only
146 /// use it for region IDs
148 };
149
150} // namespace oomph
151
152#endif
e
Definition cfortran.h:571
cstr elem_len * i
Definition cfortran.h:603
A general mesh class.
Definition mesh.h:67
//////////////////////////////////////////////////////////////////////
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.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...