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: 1097 $
7 //LIC//
8 //LIC// $LastChangedDate: 2015-12-17 11:53:17 +0000 (Thu, 17 Dec 2015) $
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 
73 
74  /// \short Return the boundary id of the i-th face in the e-th element:
75  /// This is zero-based as in tetgen. Zero means the face is not
76  /// on a boundary. Postive numbers identify the boundary.
77  /// Will be reduced by one to identify the oomph-lib boundary.
78  unsigned face_boundary(const unsigned& e, const unsigned& i) const
79  {return Face_boundary[e][i];}
80 
81  /// \short Return the number of internal edges
82  unsigned nglobal_edge()
83  {return Nglobal_edge;}
84 
85  /// \short Return a boolean indicating whether the i-th global
86  /// edge is on a boundary
87  bool edge_boundary(const unsigned &i)
88  {return Edge_boundary[i];}
89 
90  /// \short Return the global index of the i-th edge in the e-th element:
91  /// The global index starts from zero
92  unsigned edge_index(const unsigned& e, const unsigned& i) const
93  {return Edge_index[e][i];}
94 
95  /// \short Return the number of internal face
96  unsigned nglobal_face()
97  {return Nglobal_face;}
98 
99  /// \short Return the global index of the i-th face in the e-th element:
100  /// The global index starts from zero
101  unsigned face_index(const unsigned& e, const unsigned& i) const
102  {return Face_index[e][i];}
103 
104  /// \short Return the attribute of the element e
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
138 
139 };
140 
141 }
142 
143 #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 Nglobal_face
Storage for the number of global faces.
Vector< Vector< unsigned > > Face_boundary
Vector of vectors containing the boundary ids of the elements' 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.
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...
Vector< double > Element_attribute
Vector of double attributes for each element.
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...
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...
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't been defined.
double element_attribute(const unsigned &e) const
Return the attribute of the element e.
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