26#ifndef OOMPH_TETGEN_MESH_TEMPLATE_HEADER
27#define OOMPH_TETGEN_MESH_TEMPLATE_HEADER
29#ifndef OOMPH_TETGEN_MESH_HEADER
30#error __FILE__ should only be included from tetgen_mesh.h.
47 template<
class ELEMENT>
52 MeshChecker::assert_geometric_element<TElementGeometricBase, ELEMENT>(3);
55 unsigned nelem = Tmp_mesh_pt->nelement();
56 Element_pt.resize(
nelem);
63 unsigned nbound = Tmp_mesh_pt->nboundary();
65 Boundary_element_pt.resize(
nbound);
66 Face_index_at_boundary.resize(
nbound);
72 Boundary_region_element_pt.resize(
nbound);
73 Face_index_region_at_boundary.resize(
nbound);
79 Element_pt[
e] =
new ELEMENT;
83 unsigned nnod_el = Tmp_mesh_pt->finite_element_pt(0)->
nnode();
171 finite_element_pt(
e));
190 Region_attribute[
count] =
it->first;
191 Region_element_pt[
count] =
it->second;
199 unsigned boundary_id;
208 std::ostringstream error_message;
209 error_message <<
"Mesh generation from tetgen currently only works\n";
210 error_message <<
"for nnode_1d = 2 or 3. You're trying to use it\n";
211 error_message <<
"for nnode_1d=" <<
n_node_1d << std::endl;
218 unsigned dim = finite_element_pt(0)->
dim();
246 unsigned face_map[4] = {1, 0, 2, 3};
250 {0, 1}, {0, 2}, {1, 2}, {0, 3}, {2, 3}, {1, 3}};
253 for (
unsigned e = 0;
e <
nelem;
e++)
275 for (
unsigned j = 0;
j < 6; ++
j)
278 unsigned edge_index = Tmp_mesh_pt->edge_index(
e,
j);
283 for (
unsigned i = 0;
i < 2; ++
i)
307 if (Tmp_mesh_pt->edge_boundary(edge_index) ==
true)
332 for (
unsigned i = 0;
i <
dim; ++
i)
370 for (
unsigned j = 0;
j < 4; ++
j)
374 boundary_id = Tmp_mesh_pt->face_boundary(
e,
face_map[
j]);
378 unsigned face_index = Tmp_mesh_pt->face_index(
e,
face_map[
j]);
392 this->add_boundary_node(boundary_id - 1,
new_node_pt);
405 for (
unsigned i = 0;
i <
dim; ++
i)
436 for (
unsigned i = 0;
i <
dim;
i++)
447 for (
unsigned j = 0;
j < 4; ++
j)
450 boundary_id = Tmp_mesh_pt->face_boundary(
e,
j);
454 Boundary_element_pt[boundary_id - 1].push_back(
elem_pt);
461 Face_index_at_boundary[boundary_id - 1].push_back(3 -
j);
467 Boundary_region_element_pt[boundary_id - 1]
468 [
static_cast<unsigned>(
469 Tmp_mesh_pt->element_attribute(
e))]
473 Face_index_region_at_boundary[boundary_id - 1]
474 [
static_cast<unsigned>(
475 Tmp_mesh_pt->element_attribute(
e))]
482 Lookup_for_elements_next_boundary_is_setup =
true;
817 template<
class ELEMENT>
824 for (
unsigned f = 0; f <
n_facet; f++)
834 std::ostringstream error_message;
835 error_message <<
"Boundary IDs have to be one-based. Yours is " << b
853 template<
class ELEMENT>
912 output_pt->numberoftetrahedronattributes =
913 input_pt->numberoftetrahedronattributes;
1058 input_pt->numberofsegmentconstraints;
A general Finite Element class.
virtual void local_coordinate_of_node(const unsigned &j, Vector< double > &s) const
Get local coordinates of node j in the element; vector sets its own size (broken virtual)
double size() const
Calculate the size of the element (length, area, volume,...) in Eulerian computational coordinates....
virtual Node * construct_node(const unsigned &n)
Construct the local node n and return a pointer to the newly created node object.
virtual double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s.
unsigned dim() const
Return the spatial dimension of the element, i.e. the number of local coordinates required to paramet...
unsigned nnode() const
Return the number of nodes.
Node ** Node_pt
Storage for pointers to the nodes in the element.
virtual Node * construct_boundary_node(const unsigned &n)
Construct the local node n as a boundary node; that is a node that MAY be placed on a mesh boundary a...
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
virtual unsigned nnode_1d() const
Return the number of nodes along one edge of the element Default is to return zero — must be overload...
TimeStepper *& time_stepper_pt()
Access function for pointer to time stepper: Null if object is not time-dependent.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
double & x(const unsigned &i)
Return the i-th nodal coordinate.
void resize(const unsigned &n_value)
Resize the number of equations.
An OomphLibError object which should be thrown when an run-time error is encountered....
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
TAdvectionDiffusionReactionElement()
Constructor: Call constructors for TElement and AdvectionDiffusionReaction equations.
Base class for tet mesh boundary defined by polygonal planar facets.
void build_from_scaffold(TimeStepper *time_stepper_pt, const bool &use_attributes)
Build mesh from scaffold.
void setup_reverse_lookup_schemes_for_faceted_surface(TetMeshFacetedSurface *const &faceted_surface_pt)
Function to setup the reverse look-up schemes.
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...
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).