27#ifndef OOMPH_TETGEN_MESH_HEADER
28#define OOMPH_TETGEN_MESH_HEADER
32#include <oomph-lib-config.h>
49 template<
class ELEMENT>
57 MeshChecker::assert_geometric_element<TElementGeometricBase, ELEMENT>(3);
69 MeshChecker::assert_geometric_element<TElementGeometricBase, ELEMENT>(3);
90 for (
unsigned b = 0; b <
nb; b++)
105 MeshChecker::assert_geometric_element<TElementGeometricBase, ELEMENT>(3);
129 for (
unsigned b = 0; b <
nb; b++)
155 MeshChecker::assert_geometric_element<TElementGeometricBase, ELEMENT>(3);
186 for (
unsigned b = 0; b <
nb; b++)
209 MeshChecker::assert_geometric_element<TElementGeometricBase, ELEMENT>(3);
239 for (
unsigned b = 0; b <
nb; b++)
255 const double& element_volume,
262 MeshChecker::assert_geometric_element<TElementGeometricBase, ELEMENT>(3);
276 for (
unsigned f = 0; f <
n_facet; f++)
286 std::ostringstream error_message;
287 error_message <<
"Boundary IDs have to be one-based. Yours is " << b
302 for (
unsigned i = 0;
i <
n;
i++)
305 for (
unsigned f = 0; f <
n_facet; f++)
315 std::ostringstream error_message;
316 error_message <<
"Boundary IDs have to be one-based. Yours is "
359 internal_surface_pt[
i]->boundaries_can_be_split_in_tetgen();
397 srf_pt->internal_point_identifies_region_for_tetgen(
j);
424 for (
unsigned b = 0; b <
nb; b++)
445 tetgenio::polygon*
p;
475 for (
unsigned i = 0;
i < 3; ++
i)
487 for (
unsigned i = 0;
i < 3; ++
i)
490 internal_surface_pt[h]->vertex_coordinate(
n,
i);
510 internal_surface_pt[h]->one_based_vertex_boundary_id(
n);
533 f->numberofpolygons = 1;
534 f->polygonlist =
new tetgenio::polygon[f->numberofpolygons];
535 f->numberofholes = 0;
537 p = &f->polygonlist[0];
542 p->vertexlist =
new int[
p->numberofvertices];
543 for (
int i = 0;
i <
p->numberofvertices; ++
i)
568 f->numberofpolygons = 1;
569 f->polygonlist =
new tetgenio::polygon[f->numberofpolygons];
570 f->numberofholes = 0;
572 p = &f->polygonlist[0];
575 internal_surface_pt[h]->vertex_index_in_tetgen(
n);
578 p->vertexlist =
new int[
p->numberofvertices];
579 for (
int i = 0;
i <
p->numberofvertices; ++
i)
586 internal_surface_pt[h]->one_based_facet_boundary_id(
n);
598 if (
srf_pt->internal_point_identifies_hole_for_tetgen(
j))
605 if (
srf_pt->internal_point_identifies_region_for_tetgen(
j))
628 if (
srf_pt->internal_point_identifies_hole_for_tetgen(
j))
630 for (
unsigned i = 0;
i < 3; ++
i)
633 srf_pt->internal_point_for_tetgen(
j,
i);
655 if (
srf_pt->internal_point_identifies_region_for_tetgen(
j))
657 for (
unsigned i = 0;
i < 3; ++
i)
660 srf_pt->internal_point_for_tetgen(
j,
i);
664 static_cast<double>(
srf_pt->region_id_for_tetgen(
j));
769 template<
class ELEMENT>
816 for (
unsigned b = 0; b <
nb; b++)
double size() const
Calculate the size of the element (length, area, volume,...) in Eulerian computational coordinates....
static Steady< 0 > Default_TimeStepper
Default Steady Timestepper, to be used in default arguments to Mesh constructors.
unsigned nboundary() const
Return number of boundaries.
An OomphLibError object which should be thrown when an run-time error is encountered....
void set_lagrangian_nodal_coordinates()
Make the current configuration the undeformed one by setting the nodal Lagrangian coordinates to thei...
Tetgen-based mesh upgraded to become a solid mesh. Automatically enumerates all boundaries.
SolidTetgenMesh(const std::string &node_file_name, const std::string &element_file_name, const std::string &face_file_name, const bool &split_corner_elements, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper, const bool &use_attributes=false)
Constructor. Boundary coordinates are setup automatically.
SolidTetgenMesh(const std::string &node_file_name, const std::string &element_file_name, const std::string &face_file_name, const bool &split_corner_elements, const bool &switch_normal, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper, const bool &use_attributes=false)
Constructor. Boundary coordinates are re-setup automatically, with the orientation of the outer unit ...
virtual ~SolidTetgenMesh()
Empty Destructor.
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
Base class for tet meshes (meshes made of 3D tet elements).
void snap_nodes_onto_geometric_objects()
Move the nodes on boundaries with associated GeomObjects so that they exactly coincide with the geome...
TimeStepper * Time_stepper_pt
Timestepper used to build nodes.
std::map< unsigned, TetMeshFacetedSurface * > Tet_mesh_faceted_surface_pt
Reverse lookup scheme: Pointer to faceted surface (if any!) associated with boundary b.
Vector< TetMeshFacetedSurface * > Internal_surface_pt
Vector to faceted surfaces that define internal boundaries.
std::map< unsigned, TetMeshFacet * > Tet_mesh_facet_pt
Reverse lookup scheme: Pointer to facet (if any!) associated with boundary b.
TetMeshFacetedClosedSurface * Outer_boundary_pt
Faceted surface that defines outer boundaries.
Base class for closed tet mesh boundary bounded by polygonal planar facets.
Base class for tet mesh boundary defined by polygonal planar facets.
TetMeshFacet * facet_pt(const unsigned &j) const
Pointer to j-th facet.
unsigned nfacet() const
Number of facets.
Vector< unsigned > vertex_index_in_tetgen(const unsigned &f)
Facet connectivity: vertex_index[j] is the index of the j-th vertex (in the Vertex_pt vector) in face...
bool boundaries_can_be_split_in_tetgen()
Test whether boundary can be split in tetgen.
unsigned one_based_facet_boundary_id(const unsigned &j) const
One-based boundary id of j-th facet.
double vertex_coordinate(const unsigned &j, const unsigned &i) const
i-th coordinate of j-th vertex
unsigned nvertex() const
Number of vertices.
unsigned one_based_vertex_boundary_id(const unsigned &j) const
First (of possibly multiple) one-based boundary id of j-th vertex.
Unstructured tet mesh based on output from Tetgen: http://wias-berlin.de/software/tetgen/.
TetgenMesh(tetgenio &tetgen_data, const bool &split_corner_elements, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper, const bool &use_attributes=false)
Constructor with tetgen data structure Setting the boolean flag to true splits "corner" elements,...
TetgenMesh(const std::string &node_file_name, const std::string &element_file_name, const std::string &face_file_name, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper, const bool &use_attributes=false)
Constructor with the input files.
TetgenMesh()
Empty constructor.
void build_from_scaffold(TimeStepper *time_stepper_pt, const bool &use_attributes)
Build mesh from scaffold.
tetgenio *& tetgenio_pt()
Access to the triangulateio representation of the mesh.
tetgenio * Tetgenio_pt
Tetgen representation of mesh.
TetgenMesh(TetMeshFacetedClosedSurface *const &outer_boundary_pt, Vector< TetMeshFacetedSurface * > &internal_surface_pt, const double &element_volume, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper, const bool &use_attributes=false, const bool &split_corner_elements=false, Vector< double > *const &target_element_volume_in_region_pt=nullptr)
Build mesh, based on a TetgenMeshFactedClosedSurface that specifies the outer boundary of the domain ...
void setup_reverse_lookup_schemes_for_faceted_surface(TetMeshFacetedSurface *const &faceted_surface_pt)
Function to setup the reverse look-up schemes.
TetgenMesh(const std::string &node_file_name, const std::string &element_file_name, const std::string &face_file_name, const bool &split_corner_elements, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper, const bool &use_attributes=false)
Constructor with the input files. Setting the boolean flag to true splits "corner" elements,...
void set_deep_copy_tetgenio_pt(tetgenio *const &tetgenio_pt)
Set the tetgen pointer by a deep copy.
void deep_copy_of_tetgenio(tetgenio *const &input_pt, tetgenio *&output_pt)
Transfer tetgenio data from the input to the output The output is assumed to have been constructed an...
bool Use_attributes
Boolean flag to indicate whether to use attributes or not (required for multidomain meshes)
~TetgenMesh()
Empty destructor.
void set_mesh_level_time_stepper(TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data)
Overload set_mesh_level_time_stepper so that the stored time stepper now corresponds to the new times...
void build_tetgenio(TetMeshFacetedSurface *const &outer_boundary_pt, Vector< TetMeshFacetedSurface * > &internal_surface_pt, Vector< double > *const &target_element_volume_in_region_pt, tetgenio &tetgen_io)
Build tetgenio object from the TetMeshFacetedSurfaces.
bool Tetgenio_exists
Boolean to indicate whether a tetgenio representation of the mesh exists.
TetgenScaffoldMesh * Tmp_mesh_pt
Temporary scaffold mesh.
TetgenMesh(tetgenio &tetgen_data, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper, const bool &use_attributes=false)
Constructor with tetgenio data structure.
bool tetgenio_exists() const
Boolen defining whether tetgenio object has been built or not.
Mesh that is based on input files generated by the tetrahedra mesh generator tetgen.
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).