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
Installation
Installation guide
Copyright
About
People
Contact/Get involved
Publications
Acknowledgements
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-2023 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
36
namespace
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
46
TetgenScaffoldMesh
() {}
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
54
TetgenScaffoldMesh
(tetgenio& tetgen_data);
55
56
/// Empty destructor
57
~TetgenScaffoldMesh
() {}
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
126
Vector<unsigned>
Global_node
;
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
134
Vector<Vector<unsigned>
>
Face_boundary
;
135
136
/// Vector of vectors containing the global edge index of
137
// the elements' edges
138
Vector<Vector<unsigned>
>
Edge_index
;
139
140
/// Vector of vectors containing the global edge index of
141
// the elements' edges
142
Vector<Vector<unsigned>
>
Face_index
;
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
147
Vector<double>
Element_attribute
;
148
};
149
150
}
// namespace oomph
151
152
#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::TetgenScaffoldMesh
Mesh that is based on input files generated by the tetrahedra mesh generator tetgen.
Definition:
tetgen_scaffold_mesh.h:43
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:130
oomph::TetgenScaffoldMesh::Nglobal_face
unsigned Nglobal_face
Storage for the number of global faces.
Definition:
tetgen_scaffold_mesh.h:120
oomph::TetgenScaffoldMesh::TetgenScaffoldMesh
TetgenScaffoldMesh()
Empty constructor.
Definition:
tetgen_scaffold_mesh.h:46
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:71
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:147
oomph::TetgenScaffoldMesh::nglobal_edge
unsigned nglobal_edge()
Return the number of internal edges.
Definition:
tetgen_scaffold_mesh.h:77
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:84
oomph::TetgenScaffoldMesh::~TetgenScaffoldMesh
~TetgenScaffoldMesh()
Empty destructor.
Definition:
tetgen_scaffold_mesh.h:57
oomph::TetgenScaffoldMesh::Face_index
Vector< Vector< unsigned > > Face_index
Vector of vectors containing the global edge index of.
Definition:
tetgen_scaffold_mesh.h:142
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:112
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:91
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:62
oomph::TetgenScaffoldMesh::Nglobal_edge
unsigned Nglobal_edge
Storage for the number of global edges.
Definition:
tetgen_scaffold_mesh.h:123
oomph::TetgenScaffoldMesh::Edge_index
Vector< Vector< unsigned > > Edge_index
Vector of vectors containing the global edge index of.
Definition:
tetgen_scaffold_mesh.h:138
oomph::TetgenScaffoldMesh::Global_node
Vector< unsigned > Global_node
Storage for global node numbers listed element-by-element.
Definition:
tetgen_scaffold_mesh.h:126
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:134
oomph::TetgenScaffoldMesh::nglobal_face
unsigned nglobal_face()
Return the number of internal face.
Definition:
tetgen_scaffold_mesh.h:97
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:104
oomph::Vector< unsigned >
mesh.h
oomph::Global_string_for_annotation::string
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
Definition:
oomph_definitions.cc:286
oomph
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
Definition:
advection_diffusion_elements.cc:30