27#ifndef OOMPH_REFINEABLE_TETGEN_MESH_TEMPLATE_CC
28#define OOMPH_REFINEABLE_TETGEN_MESH_TEMPLATE_CC
32#include <oomph-lib-config.h>
37#include "../generic/sample_point_parameters.h"
38#include "../generic/mesh_as_geometric_object.h"
39#include "../generic/projection.h"
40#include "../generic/face_element_as_geometric_object.h"
48 template<
class ELEMENT>
89 el_pt->set_boundary_number_in_bulk_mesh(
bound);
185 for (
unsigned f = 0; f <
n_facet; f++)
187 for (
unsigned i = 0;
i < 3;
i++)
207 for (
unsigned i = 0;
i < 3;
i++)
213 for (
unsigned i = 0;
i < 3;
i++)
226 template<
class ELEMENT>
230 unsigned n_hole = this->Internal_surface_pt.
size();
238 this->update_faceted_surface_using_face_mesh(
239 this->Internal_surface_pt[
ihole]);
245 template<
class ELEMENT>
250 if (!Boundary_coordinate_exists[b])
252 oomph_info <<
"Not snapping nodes on boundary " << b
253 <<
" because no boundary coordinate has been set up.\n";
286 el_pt->set_boundary_number_in_bulk_mesh(b);
297 filestring <<
"old_mesh_boundary" << b <<
".dat";
300 filestring <<
"new_mesh_boundary" << b <<
".dat";
304 std::cout <<
"OLD---\n";
306 unsigned n_tmp_node = this->nboundary_node(b);
312 <<
" " <<
b_coo[0] <<
" " <<
b_coo[1] <<
"\n";
315 std::cout <<
"NEW-----------\n";
323 <<
" " <<
b_coo[0] <<
" " <<
b_coo[1] <<
"\n";
344 for (
unsigned i = 0;
i < 3;
i++)
366 for (
unsigned n = 0;
n < 4;
n++)
370 for (
unsigned n = 0;
n < 10;
n++)
378 dynamic_cast<ELEMENT*
>(
new_mesh_pt->boundary_element_pt(b,
e));
386 for (
unsigned n = 0;
n < 4;
n++)
388 for (
unsigned i = 0;
i < 3;
i++)
396 for (
unsigned n = 4;
n < 10;
n++)
404 for (
unsigned i = 0;
i < 3;
i++)
416 for (
unsigned n = 0;
n < 10;
n++)
418 for (
unsigned i = 0;
i < 3;
i++)
434 for (
unsigned i = 0;
i < 3;
i++)
449 template<
class ELEMENT>
465 for (
unsigned e = 0;
e <
n;
e++)
473 oomph_info <<
"Number of elements to be refined " << this->Nrefined
475 oomph_info <<
"Number of elements to be unrefined " << this->Nunrefined
486 <<
"adapt: Time for getting volume targets : "
499 if ((Nrefined > 0) || (Nunrefined > this->max_keep_unrefined()) ||
502 if (!((Nrefined > 0) || (Nunrefined > max_keep_unrefined())))
504 oomph_info <<
"Mesh regeneration triggered by edge ratio criterion\n";
510 this->surface_remesh_for_inner_hole_boundaries();
516 const unsigned n_boundary = this->nboundary();
545 this->Outer_boundary_pt,
546 this->Internal_surface_pt,
548 this->Time_stepper_pt,
549 this->Use_attributes,
550 this->Corner_elements_must_be_split);
555 this->Outer_boundary_pt,
556 this->Internal_surface_pt,
558 this->Time_stepper_pt,
559 this->Use_attributes,
560 this->Corner_elements_must_be_split);
566 <<
"adapt: Time for building temp mesh : "
606 cgal_params.enable_use_eulerian_coordinates_during_setup();
612 std::ostringstream error_message;
613 error_message <<
"Non-CGAL-based target size transfer not implemented.\n";
636 unsigned nelem = this->nelement();
637 for (
unsigned e = 0;
e <
nelem;
e++)
660 for (
unsigned e = 0;
e <
nelem;
e++)
669 for (
unsigned i = 0;
i < 3;
i++)
689 std::stringstream error_message;
690 error_message <<
"Limited locate zeta failed for zeta = [ "
691 << x[0] <<
" " << x[1] <<
" " << x[2]
692 <<
" ]. Makes no sense!\n";
704 std::stringstream error_message;
705 error_message <<
"Cast to FE for GeomObject returned by "
706 "limited locate zeta failed for zeta = [ "
707 << x[0] <<
" " << x[1] <<
" " << x[2]
708 <<
" ]. Makes no sense!\n";
742 std::ostringstream error_message;
744 <<
"Non-CGAL-based target size transfer not implemented.\n";
800 for (
unsigned u = 0; u <
length; u++)
842 <<
"This shouldn't happen! Element whose centroid is at "
855 <<
" has no target size assigned\n";
883 for (
unsigned j = 0;
j < 4;
j++)
929 <<
"All size adjustments accommodated by max. permitted size"
930 <<
" reduction during iter " <<
iter <<
"\n";
934 oomph_info <<
"NOT all size adjustments accommodated by max. "
935 <<
"permitted size reduction during iter " <<
iter
941 <<
"\n\n\n==================================================\n"
942 <<
"==================================================\n"
943 <<
"==================================================\n"
944 <<
"==================================================\n"
949 <<
"adapt: Time for new_target_size[.] : "
977 this->Outer_boundary_pt,
978 this->Internal_surface_pt,
979 this->Time_stepper_pt,
980 this->Use_attributes);
988 this->Outer_boundary_pt,
989 this->Internal_surface_pt,
990 this->Time_stepper_pt,
991 this->Use_attributes);
996 <<
"adapt: Time for new_mesh_pt : "
1016 for (
unsigned j = 0;
j <
nnod;
j++)
1019 for (
unsigned i = 0;
i < 3;
i++)
1067 if (!Projection_is_disabled)
1083 <<
"adapt: Time for project soln onto new mesh : "
1097 for (
unsigned j =
nnod;
j > 0;
j--)
1102 unsigned nel = nelement();
1103 for (
unsigned e =
nel;
e > 0;
e--)
1105 delete Element_pt[
e - 1];
1106 Element_pt[
e - 1] = 0;
1114 Element_pt.resize(
nel);
1115 for (
unsigned j = 0;
j <
nnod;
j++)
1119 for (
unsigned e = 0;
e <
nel;
e++)
1126 Boundary_element_pt.resize(
nbound);
1127 Face_index_at_boundary.resize(
nbound);
1128 Boundary_node_pt.resize(
nbound);
1129 for (
unsigned b = 0; b <
nbound; b++)
1132 Boundary_element_pt[b].resize(
nel);
1133 Face_index_at_boundary[b].resize(
nel);
1134 for (
unsigned e = 0;
e <
nel;
e++)
1136 Boundary_element_pt[b][
e] =
new_mesh_pt->boundary_element_pt(b,
e);
1137 Face_index_at_boundary[b][
e] =
1141 Boundary_node_pt[b].resize(
nnod);
1142 for (
unsigned j = 0;
j <
nnod;
j++)
1144 Boundary_node_pt[b][
j] =
new_mesh_pt->boundary_node_pt(b,
j);
1155 this->Region_element_pt.resize(
n_region);
1156 this->Region_attribute.resize(
n_region);
1160 this->Region_attribute[
i] =
new_mesh_pt->region_attribute(
i);
1163 unsigned r = this->Region_attribute[
i];
1168 this->Region_element_pt[
i][
e] =
1174 this->Boundary_region_element_pt.resize(
nbound);
1175 this->Face_index_region_at_boundary.resize(
nbound);
1178 for (
unsigned b = 0; b <
nbound; ++b)
1183 unsigned r = this->Region_attribute[
i];
1190 this->Boundary_region_element_pt[b][
r].resize(
1192 this->Face_index_region_at_boundary[b][
r].resize(
1198 this->Boundary_region_element_pt[b][
r][
e] =
1200 this->Face_index_region_at_boundary[b][
r][
e] =
1210 this->set_deep_copy_tetgenio_pt(
new_mesh_pt->tetgenio_pt());
1221 <<
"adapt: Time for moving nodes etc. to actual mesh : "
1229 std::stringstream error_message;
1231 <<
"Lagrangian coordinates are currently not projected but are\n"
1232 <<
"are re-set during adaptation. This is not appropriate for\n"
1233 <<
"real solid mechanics problems!\n";
1239 dynamic_cast<SolidMesh*
>(
this)->set_lagrangian_nodal_coordinates();
1250 oomph_info <<
"Not enough benefit in adaptation.\n";
///////////////////////////////////////////////////////////////////// ///////////////////////////////...
/////////////////////////////////////////////////////////////////////////// /////////////////////////...
A general Finite Element class.
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
void position(const Vector< double > &zeta, Vector< double > &r) const
Return the parametrised position of the FiniteElement in its incarnation as a GeomObject,...
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 nnode() const
Return the number of nodes.
Node ** Node_pt
Storage for pointers to the nodes in the element.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
/////////////////////////////////////////////////////////////////////
virtual double knot(const unsigned &i, const unsigned &j) const =0
Return local coordinate s[j] of i-th integration point.
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
///////////////////////////////////////////////////////////////////// ///////////////////////////////...
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
virtual bool is_on_boundary() const
Test whether the Node lies on a boundary. The "bulk" Node cannot lie on a boundary,...
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....
An OomphLibWarning object which should be created as a temporary object to issue a warning....
void surface_remesh_for_inner_hole_boundaries()
Generate a new faceted representation of the inner hole boundaries.
void update_faceted_surface_using_face_mesh(TetMeshFacetedSurface *&faceted_surface_pt)
Helper function that updates the input faceted surface by using the flattened elements from FaceMesh(...
void snap_nodes_onto_boundary(RefineableTetgenMesh< ELEMENT > *&new_mesh_pt, const unsigned &b)
Snap the boundary nodes onto any curvilinear boundaries.
void adapt(const Vector< double > &elem_error)
Adapt mesh, based on elemental error provided.
//////////////////////////////////////////////////////////////////////
void output(std::ostream &outfile)
Output function: x,y,u or x,y,z,u.
TAdvectionDiffusionReactionElement()
Constructor: Call constructors for TElement and AdvectionDiffusionReaction equations.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
///////////////////////////////////////////////////////////////////// ///////////////////////////////...
///////////////////////////////////////////////////////////////////// ///////////////////////////////...
double timer()
returns the time in seconds after some point in past
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
OomphInfo oomph_info
Single (global) instantiation of the OomphInfo object – this is used throughout the library as a "rep...