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