Toggle navigation
Documentation
Big picture
The finite element method
The data structure
Not-so-quick guide
Optimisation
Order of action functions
Example codes and tutorials
List of example codes and tutorials
Meshing
Solvers
MPI parallel processing
Post-processing/visualisation
Other
Change log
Creating documentation
Coding conventions
Index
FAQ
About
People
Contact/Get involved
Publications
Acknowledgements
Copyright
Picture show
Go
src
generic
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
40
namespace
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
50
TetgenScaffoldMesh
() {}
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
58
TetgenScaffoldMesh
(
tetgenio
&
tetgen_data
);
59
60
/// Empty destructor
61
~TetgenScaffoldMesh
() {}
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
130
Vector<unsigned>
Global_node
;
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
138
Vector<Vector<unsigned>
>
Face_boundary
;
139
140
/// Vector of vectors containing the global edge index of
141
// the elements' edges
142
Vector<Vector<unsigned>
>
Edge_index
;
143
144
/// Vector of vectors containing the global edge index of
145
// the elements' edges
146
Vector<Vector<unsigned>
>
Face_index
;
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
151
Vector<double>
Element_attribute
;
152
};
153
154
}
// namespace oomph
155
156
#endif
Telements.h
e
e
Definition
cfortran.h:571
i
cstr elem_len * i
Definition
cfortran.h:603
oomph::Mesh
A general mesh class.
Definition
mesh.h:67
oomph::TAdvectionDiffusionReactionElement
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
Definition
Tadvection_diffusion_reaction_elements.h:66
oomph::TetgenScaffoldMesh
Mesh that is based on input files generated by the tetrahedra mesh generator tetgen.
Definition
tetgen_scaffold_mesh.h:47
oomph::TetgenScaffoldMesh::Edge_boundary
std::vector< bool > Edge_boundary
Vector of booleans to indicate whether a global edge lies on a boundary.
Definition
tetgen_scaffold_mesh.h:134
oomph::TetgenScaffoldMesh::Nglobal_face
unsigned Nglobal_face
Storage for the number of global faces.
Definition
tetgen_scaffold_mesh.h:124
oomph::TetgenScaffoldMesh::TetgenScaffoldMesh
TetgenScaffoldMesh()
Empty constructor.
Definition
tetgen_scaffold_mesh.h:50
oomph::TetgenScaffoldMesh::face_boundary
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....
Definition
tetgen_scaffold_mesh.h:75
oomph::TetgenScaffoldMesh::Element_attribute
Vector< double > Element_attribute
Vector of double attributes for each element. NOTE: This stores doubles because tetgen forces us to!...
Definition
tetgen_scaffold_mesh.h:151
oomph::TetgenScaffoldMesh::nglobal_edge
unsigned nglobal_edge()
Return the number of internal edges.
Definition
tetgen_scaffold_mesh.h:81
oomph::TetgenScaffoldMesh::edge_boundary
bool edge_boundary(const unsigned &i)
Return a boolean indicating whether the i-th global edge is on a boundary.
Definition
tetgen_scaffold_mesh.h:88
oomph::TetgenScaffoldMesh::~TetgenScaffoldMesh
~TetgenScaffoldMesh()
Empty destructor.
Definition
tetgen_scaffold_mesh.h:61
oomph::TetgenScaffoldMesh::Face_index
Vector< Vector< unsigned > > Face_index
Vector of vectors containing the global edge index of.
Definition
tetgen_scaffold_mesh.h:146
oomph::TetgenScaffoldMesh::element_attribute
double element_attribute(const unsigned &e) const
Return the attribute of the element e. NOTE: Attributes are doubles because tetgen forces us to!...
Definition
tetgen_scaffold_mesh.h:116
oomph::TetgenScaffoldMesh::edge_index
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.
Definition
tetgen_scaffold_mesh.h:95
oomph::TetgenScaffoldMesh::global_node_number
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...
Definition
tetgen_scaffold_mesh.h:66
oomph::TetgenScaffoldMesh::Nglobal_edge
unsigned Nglobal_edge
Storage for the number of global edges.
Definition
tetgen_scaffold_mesh.h:127
oomph::TetgenScaffoldMesh::Edge_index
Vector< Vector< unsigned > > Edge_index
Vector of vectors containing the global edge index of.
Definition
tetgen_scaffold_mesh.h:142
oomph::TetgenScaffoldMesh::Global_node
Vector< unsigned > Global_node
Storage for global node numbers listed element-by-element.
Definition
tetgen_scaffold_mesh.h:130
oomph::TetgenScaffoldMesh::Face_boundary
Vector< Vector< unsigned > > Face_boundary
Vector of vectors containing the boundary ids of the elements' faces.
Definition
tetgen_scaffold_mesh.h:138
oomph::TetgenScaffoldMesh::nglobal_face
unsigned nglobal_face()
Return the number of internal face.
Definition
tetgen_scaffold_mesh.h:101
oomph::TetgenScaffoldMesh::face_index
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.
Definition
tetgen_scaffold_mesh.h:108
mesh.h
oomph
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition
advection_diffusion_elements.cc:30