triangle_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_TRIANGLE_SCAFFOLD_MESH_HEADER
27 #define OOMPH_TRIANGLE_SCAFFOLD_MESH_HEADER
28 
29 // Config header generated by autoconfig
30 #ifdef HAVE_CONFIG_H
31 #include <oomph-lib-config.h>
32 #endif
33 
34 #ifdef OOMPH_HAS_MPI
35 // mpi headers
36 #include "mpi.h"
37 #endif
38 
39 
40 #include "triangle_mesh.h"
41 #include "Telements.h"
42 
43 
44 namespace oomph
45 {
46  //=====================================================================
47  /// Triangle Mesh that is based on input files generated by the
48  /// triangle mesh generator Triangle.
49  //=====================================================================
50  class TriangleScaffoldMesh : public virtual Mesh
51  {
52  public:
53  /// Empty constructor
55 
56  /// Constructor: Pass the filenames of the triangle files
57  TriangleScaffoldMesh(const std::string& node_file_name,
58  const std::string& element_file_name,
59  const std::string& poly_file_name);
60 
61 #ifdef OOMPH_HAS_TRIANGLE_LIB
62 
63  /// Constructor: Pass the TriangulateIO object
64  TriangleScaffoldMesh(TriangulateIO& triangle_data);
65 
66 #endif
67 
68  /// Broken copy constructor
70 
71  /// Broken assignment operator
72  void operator=(const TriangleScaffoldMesh&) = delete;
73 
74  /// Empty destructor
76 
77  /// Return the global node of each local node
78  /// listed element-by-element e*n_local_node + n_local
79  /// Note that the node numbers are indexed from 1
80  unsigned global_node_number(const unsigned& i)
81  {
82  return Global_node[i];
83  }
84 
85  /// Return the boundary id of the i-th edge in the e-th element:
86  /// This is zero-based as in triangle. Zero means the edge is not
87  /// on a boundary. Postive numbers identify the boundary.
88  /// Will be reduced by one to identify the oomph-lib boundary.
89  unsigned edge_boundary(const unsigned& e, const unsigned& i) const
90  {
91  return Edge_boundary[e][i];
92  }
93 
94  /// Return the number of internal edges
95  unsigned nglobal_edge()
96  {
97  return Nglobal_edge;
98  }
99 
100  /// Return the global index of the i-th edge in the e-th element:
101  /// The global index starts from zero
102  unsigned edge_index(const unsigned& e, const unsigned& i) const
103  {
104  return Edge_index[e][i];
105  }
106 
107  /// Return the attribute of the element e
108  double element_attribute(const unsigned& e) const
109  {
110  return Element_attribute[e];
111  }
112 
113  /// Vectors of hole centre coordinates
115  {
116  return Hole_centre;
117  }
118 
119  protected:
120  /// Check mesh integrity -- performs some internal consistency checks
121  /// and throws error if violated.
122  void check_mesh_integrity();
123 
124  /// Number of internal edges
125  unsigned Nglobal_edge;
126 
127  /// Storage for global node numbers listed element-by-element
129 
130  /// Vector of vectors containing the boundary ids of the
131  /// elements' edges
133 
134  /// Vector of vectors containing the global edge index of
135  // the elements' edges
137 
138  /// Vector of double attributes for each element
140 
141  /// Vectors of hole centre coordinates
143  };
144 
145 } // namespace oomph
146 
147 #endif
e
Definition: cfortran.h:571
cstr elem_len * i
Definition: cfortran.h:603
A general mesh class.
Definition: mesh.h:67
Triangle Mesh that is based on input files generated by the triangle mesh generator Triangle.
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...
TriangleScaffoldMesh(const TriangleScaffoldMesh &)=delete
Broken copy constructor.
Vector< unsigned > Global_node
Storage for global node numbers listed element-by-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.
void operator=(const TriangleScaffoldMesh &)=delete
Broken assignment operator.
void check_mesh_integrity()
Check mesh integrity – performs some internal consistency checks and throws error if violated.
unsigned Nglobal_edge
Number of internal edges.
Vector< double > Element_attribute
Vector of double attributes for each element.
Vector< Vector< double > > & internal_point()
Vectors of hole centre coordinates.
TriangleScaffoldMesh()
Empty constructor.
double element_attribute(const unsigned &e) const
Return the attribute of the element e.
Vector< Vector< unsigned > > Edge_boundary
Vector of vectors containing the boundary ids of the elements' edges.
unsigned edge_boundary(const unsigned &e, const unsigned &i) const
Return the boundary id of the i-th edge in the e-th element: This is zero-based as in triangle....
unsigned nglobal_edge()
Return the number of internal edges.
~TriangleScaffoldMesh()
Empty destructor.
Vector< Vector< double > > Hole_centre
Vectors of hole centre coordinates.
Vector< Vector< unsigned > > Edge_index
Vector of vectors containing the global edge index of.
A slight extension to the standard template vector class so that we can include "graceful" array rang...
Definition: Vector.h:58
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
The Triangle data structure, modified from the triangle.h header supplied with triangle 1....