oomph::RefineableTetgenMesh< ELEMENT > Class Template Reference

#include <refineable_tetgen_mesh.template.h>

+ Inheritance diagram for oomph::RefineableTetgenMesh< ELEMENT >:

Public Member Functions

 RefineableTetgenMesh (TetMeshFacetedClosedSurface *const &outer_boundary_pt, Vector< TetMeshFacetedSurface * > &internal_closed_surface_pt, const double &element_volume, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper, const bool &use_attributes=false)
 
 RefineableTetgenMesh (const Vector< double > &target_volume, tetgenio *const &tetgen_io_pt, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper, const bool &use_attributes=false)
 
virtual ~RefineableTetgenMesh ()
 Empty Destructor. More...
 
Problem *& problem_pt ()
 
doublemax_element_size ()
 Max element size allowed during adaptation. More...
 
doublemin_element_size ()
 Min element size allowed during adaptation. More...
 
doublemax_permitted_edge_ratio ()
 Min angle before remesh gets triggered. More...
 
void doc_adaptivity_targets (std::ostream &outfile)
 Doc the targets for mesh adaptation. More...
 
void refine_uniformly (DocInfo &doc_info)
 Refine mesh uniformly and doc process. More...
 
unsigned unrefine_uniformly ()
 
void adapt (const Vector< double > &elem_error)
 Adapt mesh, based on elemental error provided. More...
 
void setup_boundary_coordinates_generic (const unsigned &b, const bool &switch_normal, std::ofstream &outfile)
 
void update_faceted_surface_using_face_mesh (TetMeshFacetedClosedSurface *faceted_surface_pt)
 
virtual void surface_remesh_for_inner_hole_boundaries ()
 
void snap_nodes_onto_boundary (RefineableTetgenMesh< ELEMENT > *&new_mesh_pt, const unsigned &b)
 Generate a new PSLG representation of the outer boundary. More...
 
void initialise_adaptation_data ()
 Helper function to initialise data associated with adaptation. More...
 
double compute_volume_target (const Vector< double > &elem_error, Vector< double > &target_volume)
 
 RefineableTetgenMesh (TetMeshFacetedClosedSurface *const &outer_boundary_pt, Vector< TetMeshFacetedSurface * > &internal_closed_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)
 
virtual ~RefineableTetgenMesh ()
 Empty Destructor. More...
 
void refine_uniformly (DocInfo &doc_info)
 Refine mesh uniformly and doc process. More...
 
unsigned unrefine_uniformly ()
 
void adapt (const Vector< double > &elem_error)
 Adapt mesh, based on elemental error provided. More...
 
bool projection_is_disabled ()
 Is projection of old solution onto new mesh disabled? More...
 
void disable_projection ()
 Disable projection of old solution onto new mesh. More...
 
void enable_projection ()
 Disable projection of old solution onto new mesh. More...
 
- Public Member Functions inherited from oomph::TetgenMesh< ELEMENT >
 TetgenMesh ()
 Empty constructor. More...
 
 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. More...
 
 TetgenMesh (tetgenio &tetgen_data, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper, const bool &use_attributes=false)
 Constructor with tetgenio data structure. More...
 
 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)
 
 TetgenMesh (tetgenio &tetgen_data, const bool &split_corner_elements, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper, const bool &use_attributes=false)
 
 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)
 
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. More...
 
 ~TetgenMesh ()
 Empty destructor. More...
 
void set_mesh_level_time_stepper (TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data)
 
bool tetgenio_exists () const
 Boolen defining whether tetgenio object has been built or not. More...
 
tetgenio *& tetgenio_pt ()
 Access to the triangulateio representation of the mesh. More...
 
void set_deep_copy_tetgenio_pt (tetgenio *const &tetgenio_pt)
 Set the tetgen pointer by a deep copy. More...
 
void deep_copy_of_tetgenio (tetgenio *const &input_pt, tetgenio *&output_pt)
 
- Public Member Functions inherited from oomph::TetMeshBase
 TetMeshBase ()
 Constructor. More...
 
 TetMeshBase (const TetMeshBase &node)=delete
 Broken copy constructor. More...
 
void operator= (const TetMeshBase &)=delete
 Broken assignment operator. More...
 
virtual ~TetMeshBase ()
 Destructor (empty) More...
 
void assess_mesh_quality (std::ofstream &some_file)
 
template<class ELEMENT >
void setup_boundary_coordinates (const unsigned &b)
 
template<class ELEMENT >
void setup_boundary_coordinates (const unsigned &b, const bool &switch_normal)
 
template<class ELEMENT >
void setup_boundary_coordinates (const unsigned &b, const bool &switch_normal, std::ofstream &outfile)
 
template<class ELEMENT >
void setup_boundary_coordinates (const unsigned &b, std::ofstream &outfile)
 
unsigned nboundary_element_in_region (const unsigned &b, const unsigned &r) const
 Return the number of elements adjacent to boundary b in region r. More...
 
FiniteElementboundary_element_in_region_pt (const unsigned &b, const unsigned &r, const unsigned &e) const
 Return pointer to the e-th element adjacent to boundary b in region r. More...
 
int face_index_at_boundary_in_region (const unsigned &b, const unsigned &r, const unsigned &e) const
 Return face index of the e-th element adjacent to boundary b in region r. More...
 
unsigned nregion ()
 Return the number of regions specified by attributes. More...
 
unsigned nregion_element (const unsigned &r)
 Return the number of elements in region r. More...
 
double region_attribute (const unsigned &i)
 
FiniteElementregion_element_pt (const unsigned &r, const unsigned &e)
 Return the e-th element in the r-th region. More...
 
template<class ELEMENT >
void snap_to_quadratic_surface (const Vector< unsigned > &boundary_id, const std::string &quadratic_surface_file_name, const bool &switch_normal, DocInfo &doc_info)
 
template<class ELEMENT >
void snap_to_quadratic_surface (const Vector< unsigned > &boundary_id, const std::string &quadratic_surface_file_name, const bool &switch_normal)
 
void snap_nodes_onto_geometric_objects ()
 
template<class ELEMENT >
void split_elements_in_corners (TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
 
void setup_boundary_element_info ()
 
void setup_boundary_element_info (std::ostream &outfile)
 
- Public Member Functions inherited from oomph::Mesh
 Mesh ()
 Default constructor. More...
 
 Mesh (const Vector< Mesh * > &sub_mesh_pt)
 
void merge_meshes (const Vector< Mesh * > &sub_mesh_pt)
 
virtual void reset_boundary_element_info (Vector< unsigned > &ntmp_boundary_elements, Vector< Vector< unsigned >> &ntmp_boundary_elements_in_region, Vector< FiniteElement * > &deleted_elements)
 Virtual function to perform the reset boundary elements info rutines. More...
 
template<class BULK_ELEMENT >
void doc_boundary_coordinates (const unsigned &b, std::ofstream &the_file)
 
virtual void scale_mesh (const double &factor)
 
 Mesh (const Mesh &dummy)=delete
 Broken copy constructor. More...
 
void operator= (const Mesh &)=delete
 Broken assignment operator. More...
 
virtual ~Mesh ()
 Virtual Destructor to clean up all memory. More...
 
void flush_element_and_node_storage ()
 
void flush_element_storage ()
 
void flush_node_storage ()
 
Node *& node_pt (const unsigned long &n)
 Return pointer to global node n. More...
 
Nodenode_pt (const unsigned long &n) const
 Return pointer to global node n (const version) More...
 
GeneralisedElement *& element_pt (const unsigned long &e)
 Return pointer to element e. More...
 
GeneralisedElementelement_pt (const unsigned long &e) const
 Return pointer to element e (const version) More...
 
const Vector< GeneralisedElement * > & element_pt () const
 Return reference to the Vector of elements. More...
 
Vector< GeneralisedElement * > & element_pt ()
 Return reference to the Vector of elements. More...
 
FiniteElementfinite_element_pt (const unsigned &e) const
 
Node *& boundary_node_pt (const unsigned &b, const unsigned &n)
 Return pointer to node n on boundary b. More...
 
Nodeboundary_node_pt (const unsigned &b, const unsigned &n) const
 Return pointer to node n on boundary b. More...
 
void set_nboundary (const unsigned &nbound)
 Set the number of boundaries in the mesh. More...
 
void remove_boundary_nodes ()
 Clear all pointers to boundary nodes. More...
 
void remove_boundary_nodes (const unsigned &b)
 
void remove_boundary_node (const unsigned &b, Node *const &node_pt)
 Remove a node from the boundary b. More...
 
void add_boundary_node (const unsigned &b, Node *const &node_pt)
 Add a (pointer to) a node to the b-th boundary. More...
 
void copy_boundary_node_data_from_nodes ()
 
bool boundary_coordinate_exists (const unsigned &i) const
 Indicate whether the i-th boundary has an intrinsic coordinate. More...
 
unsigned long nelement () const
 Return number of elements in the mesh. More...
 
unsigned long nnode () const
 Return number of nodes in the mesh. More...
 
unsigned ndof_types () const
 Return number of dof types in mesh. More...
 
unsigned elemental_dimension () const
 Return number of elemental dimension in mesh. More...
 
unsigned nodal_dimension () const
 Return number of nodal dimension in mesh. More...
 
void add_node_pt (Node *const &node_pt)
 Add a (pointer to a) node to the mesh. More...
 
void add_element_pt (GeneralisedElement *const &element_pt)
 Add a (pointer to) an element to the mesh. More...
 
virtual void node_update (const bool &update_all_solid_nodes=false)
 
virtual void reorder_nodes (const bool &use_old_ordering=true)
 
virtual void get_node_reordering (Vector< Node * > &reordering, const bool &use_old_ordering=true) const
 
template<class BULK_ELEMENT , template< class > class FACE_ELEMENT>
void build_face_mesh (const unsigned &b, Mesh *const &face_mesh_pt)
 
unsigned self_test ()
 Self-test: Check elements and nodes. Return 0 for OK. More...
 
void max_and_min_element_size (double &max_size, double &min_size)
 
double total_size ()
 
void check_inverted_elements (bool &mesh_has_inverted_elements, std::ofstream &inverted_element_file)
 
void check_inverted_elements (bool &mesh_has_inverted_elements)
 
unsigned check_for_repeated_nodes (const double &epsilon=1.0e-12)
 
Vector< Node * > prune_dead_nodes ()
 
unsigned nboundary () const
 Return number of boundaries. More...
 
unsigned long nboundary_node (const unsigned &ibound) const
 Return number of nodes on a particular boundary. More...
 
FiniteElementboundary_element_pt (const unsigned &b, const unsigned &e) const
 Return pointer to e-th finite element on boundary b. More...
 
Nodeget_some_non_boundary_node () const
 
unsigned nboundary_element (const unsigned &b) const
 Return number of finite elements that are adjacent to boundary b. More...
 
int face_index_at_boundary (const unsigned &b, const unsigned &e) const
 
virtual void dump (std::ofstream &dump_file, const bool &use_old_ordering=true) const
 Dump the data in the mesh into a file for restart. More...
 
void dump (const std::string &dump_file_name, const bool &use_old_ordering=true) const
 Dump the data in the mesh into a file for restart. More...
 
virtual void read (std::ifstream &restart_file)
 Read solution from restart file. More...
 
void output_paraview (std::ofstream &file_out, const unsigned &nplot) const
 
void output_fct_paraview (std::ofstream &file_out, const unsigned &nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt) const
 
void output_fct_paraview (std::ofstream &file_out, const unsigned &nplot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt) const
 
void output (std::ostream &outfile)
 Output for all elements. More...
 
void output (std::ostream &outfile, const unsigned &n_plot)
 Output at f(n_plot) points in each element. More...
 
void output (FILE *file_pt)
 Output for all elements (C-style output) More...
 
void output (FILE *file_pt, const unsigned &nplot)
 Output at f(n_plot) points in each element (C-style output) More...
 
void output (const std::string &output_filename)
 Output for all elements. More...
 
void output (const std::string &output_filename, const unsigned &n_plot)
 Output at f(n_plot) points in each element. More...
 
void output_fct (std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt)
 Output a given Vector function at f(n_plot) points in each element. More...
 
void output_fct (std::ostream &outfile, const unsigned &n_plot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt)
 
void output_boundaries (std::ostream &outfile)
 Output the nodes on the boundaries (into separate tecplot zones) More...
 
void output_boundaries (const std::string &output_filename)
 
void assign_initial_values_impulsive ()
 Assign initial values for an impulsive start. More...
 
void shift_time_values ()
 
void calculate_predictions ()
 
void set_nodal_and_elemental_time_stepper (TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data)
 
void set_consistent_pinned_values_for_continuation (ContinuationStorageScheme *const &continuation_stepper_pt)
 Set consistent values for pinned data in continuation. More...
 
bool does_pointer_correspond_to_mesh_data (double *const &parameter_pt)
 Does the double pointer correspond to any mesh data. More...
 
void set_nodal_time_stepper (TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data)
 Set the timestepper associated with the nodal data in the mesh. More...
 
void set_elemental_internal_time_stepper (TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data)
 
virtual void compute_norm (double &norm)
 
virtual void compute_norm (Vector< double > &norm)
 
virtual void compute_error (std::ostream &outfile, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, double &error, double &norm)
 
virtual void compute_error (std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
 
virtual void compute_error (FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
 
virtual void compute_error (FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, Vector< double > &error, Vector< double > &norm)
 
virtual void compute_error (std::ostream &outfile, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, Vector< double > &error, Vector< double > &norm)
 
virtual void compute_error (std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, Vector< double > &error, Vector< double > &norm)
 
virtual void compute_error (FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, double &error, double &norm)
 Returns the norm of the error and that of the exact solution. More...
 
virtual void compute_error (FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, Vector< double > &error, Vector< double > &norm)
 
bool is_mesh_distributed () const
 Boolean to indicate if Mesh has been distributed. More...
 
OomphCommunicatorcommunicator_pt () const
 
void delete_all_external_storage ()
 Wipe the storage for all externally-based elements. More...
 
- Public Member Functions inherited from oomph::RefineableMeshBase
bool adapt_flag ()
 
 RefineableMeshBase ()
 
 RefineableMeshBase (const RefineableMeshBase &dummy)=delete
 Broken copy constructor. More...
 
void operator= (const RefineableMeshBase &)=delete
 Broken assignment operator. More...
 
virtual ~RefineableMeshBase ()
 Empty Destructor: More...
 
unsigned nrefined ()
 Access fct for number of elements that were refined. More...
 
unsigned nunrefined ()
 Access fct for number of elements that were unrefined. More...
 
unsignednrefinement_overruled ()
 
unsignedmax_keep_unrefined ()
 
ErrorEstimator *& spatial_error_estimator_pt ()
 Access to spatial error estimator. More...
 
ErrorEstimatorspatial_error_estimator_pt () const
 Access to spatial error estimator (const version. More...
 
doublemin_permitted_error ()
 
doublemax_permitted_error ()
 
doublemin_error ()
 
doublemax_error ()
 
DocInfo *& doc_info_pt ()
 Access fct for pointer to DocInfo. More...
 
void enable_adaptation ()
 Enable adaptation. More...
 
void disable_adaptation ()
 Disable adaptation. More...
 
void enable_p_adaptation ()
 Enable adaptation. More...
 
void disable_p_adaptation ()
 Disable adaptation. More...
 
void enable_additional_synchronisation_of_hanging_nodes ()
 Enable additional synchronisation of hanging nodes. More...
 
void disable_additional_synchronisation_of_hanging_nodes ()
 Disable additional synchronisation of hanging nodes. More...
 
bool is_adaptation_enabled () const
 Return whether the mesh is to be adapted. More...
 
bool is_p_adaptation_enabled () const
 Return whether the mesh is to be adapted. More...
 
bool is_additional_synchronisation_of_hanging_nodes_disabled () const
 Return whether additional synchronisation is enabled. More...
 
DocInfo doc_info ()
 Access fct for DocInfo. More...
 
virtual void p_adapt (const Vector< double > &elemental_error)
 
virtual void refine_uniformly ()
 Refine mesh uniformly. More...
 
virtual void p_refine_uniformly (DocInfo &doc_info)
 p-refine mesh uniformly and doc process More...
 
virtual void p_refine_uniformly ()
 p-refine mesh uniformly More...
 
void p_unrefine_uniformly (DocInfo &doc_info)
 p-unrefine mesh uniformly More...
 
- Public Member Functions inherited from oomph::RefineableTetMeshBase
doublemax_element_size ()
 Max element size allowed during adaptation. More...
 
doublemin_element_size ()
 Min element size allowed during adaptation. More...
 
doublemax_permitted_edge_ratio ()
 Min edge ratio before remesh gets triggered. More...
 
void doc_adaptivity_targets (std::ostream &outfile)
 Doc the targets for mesh adaptation. More...
 
double compute_volume_target (const Vector< double > &elem_error, Vector< double > &target_volume)
 

Public Attributes

ProblemProblem_pt
 
double Max_element_size
 Max permitted element size. More...
 
double Min_element_size
 Min permitted element size. More...
 
double Max_permitted_edge_ratio
 Max edge ratio before remesh gets triggered. More...
 
- Public Attributes inherited from oomph::RefineableTetMeshBase
double Max_element_size
 Max permitted element size. More...
 
double Min_element_size
 Min permitted element size. More...
 
double Max_permitted_edge_ratio
 Max edge ratio before remesh gets triggered. More...
 

Protected Member Functions

 RefineableTetgenMesh (const Vector< double > &target_volume, tetgenio *const &tetgen_io_pt, TetMeshFacetedClosedSurface *const &outer_boundary_pt, Vector< TetMeshFacetedSurface * > &internal_surface_pt, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper, const bool &use_attributes=false)
 
void initialise_adaptation_data ()
 Helper function to initialise data associated with adaptation. More...
 
void update_faceted_surface_using_face_mesh (TetMeshFacetedSurface *&faceted_surface_pt)
 
void surface_remesh_for_inner_hole_boundaries ()
 
void snap_nodes_onto_boundary (RefineableTetgenMesh< ELEMENT > *&new_mesh_pt, const unsigned &b)
 Snap the boundary nodes onto any curvilinear boundaries. More...
 
- Protected Member Functions inherited from oomph::TetgenMesh< ELEMENT >
void build_from_scaffold (TimeStepper *time_stepper_pt, const bool &use_attributes)
 Build mesh from scaffold. More...
 
void setup_reverse_lookup_schemes_for_faceted_surface (TetMeshFacetedSurface *const &faceted_surface_pt)
 Function to setup the reverse look-up schemes. More...
 
- Protected Member Functions inherited from oomph::Mesh
unsigned long assign_global_eqn_numbers (Vector< double * > &Dof_pt)
 Assign (global) equation numbers to the nodes. More...
 
void describe_dofs (std::ostream &out, const std::string &current_string) const
 
void describe_local_dofs (std::ostream &out, const std::string &current_string) const
 
void assign_local_eqn_numbers (const bool &store_local_dof_pt)
 Assign local equation numbers in all elements. More...
 
void convert_to_boundary_node (Node *&node_pt, const Vector< FiniteElement * > &finite_element_pt)
 
void convert_to_boundary_node (Node *&node_pt)
 

Protected Attributes

bool Projection_is_disabled
 Disable projection of solution onto new mesh during adaptation. More...
 
bool Corner_elements_must_be_split
 
- Protected Attributes inherited from oomph::TetgenMesh< ELEMENT >
TetgenScaffoldMeshTmp_mesh_pt
 Temporary scaffold mesh. More...
 
bool Tetgenio_exists
 
tetgenioTetgenio_pt
 Tetgen representation of mesh. More...
 
bool Use_attributes
 
- Protected Attributes inherited from oomph::TetMeshBase
Vector< Vector< FiniteElement * > > Region_element_pt
 
Vector< doubleRegion_attribute
 
Vector< std::map< unsigned, Vector< FiniteElement * > > > Boundary_region_element_pt
 Storage for elements adjacent to a boundary in a particular region. More...
 
Vector< std::map< unsigned, Vector< int > > > Face_index_region_at_boundary
 
TetMeshFacetedClosedSurfaceOuter_boundary_pt
 Faceted surface that defines outer boundaries. More...
 
Vector< TetMeshFacetedSurface * > Internal_surface_pt
 Vector to faceted surfaces that define internal boundaries. More...
 
std::map< unsigned, TetMeshFacetedSurface * > Tet_mesh_faceted_surface_pt
 
std::map< unsigned, TetMeshFacet * > Tet_mesh_facet_pt
 
std::map< unsigned, Vector< Vector< double > > > Triangular_facet_vertex_boundary_coordinate
 
TimeStepperTime_stepper_pt
 Timestepper used to build nodes. More...
 
- Protected Attributes inherited from oomph::Mesh
Vector< Vector< Node * > > Boundary_node_pt
 
bool Lookup_for_elements_next_boundary_is_setup
 
Vector< Vector< FiniteElement * > > Boundary_element_pt
 
Vector< Vector< int > > Face_index_at_boundary
 
Vector< Node * > Node_pt
 Vector of pointers to nodes. More...
 
Vector< GeneralisedElement * > Element_pt
 Vector of pointers to generalised elements. More...
 
std::vector< boolBoundary_coordinate_exists
 
- Protected Attributes inherited from oomph::RefineableMeshBase
ErrorEstimatorSpatial_error_estimator_pt
 Pointer to spatial error estimator. More...
 
double Max_permitted_error
 Max. error (i.e. split elements if their error is larger) More...
 
double Min_permitted_error
 Min. error (i.e. (try to) merge elements if their error is smaller) More...
 
double Min_error
 Min.actual error. More...
 
double Max_error
 Max. actual error. More...
 
unsigned Nrefined
 Stats: Number of elements that were refined. More...
 
unsigned Nunrefined
 Stats: Number of elements that were unrefined. More...
 
bool Adapt_flag
 Flag that requests adaptation. More...
 
bool P_adapt_flag
 Flag that requests p-adaptation. More...
 
bool Additional_synchronisation_of_hanging_nodes_not_required
 Flag that disables additional synchronisation of hanging nodes. More...
 
DocInfoDoc_info_pt
 Pointer to DocInfo. More...
 
unsigned Max_keep_unrefined
 
unsigned Nrefinement_overruled
 

Additional Inherited Members

- Public Types inherited from oomph::Mesh
typedef void(FiniteElement::* SteadyExactSolutionFctPt) (const Vector< double > &x, Vector< double > &soln)
 
typedef void(FiniteElement::* UnsteadyExactSolutionFctPt) (const double &time, const Vector< double > &x, Vector< double > &soln)
 
- Static Public Attributes inherited from oomph::TetMeshBase
static double Tolerance_for_boundary_finding = 1.0e-5
 
- Static Public Attributes inherited from oomph::Mesh
static Steady< 0 > Default_TimeStepper
 The Steady Timestepper. More...
 
static bool Suppress_warning_about_empty_mesh_level_time_stepper_function
 Static boolean flag to control warning about mesh level timesteppers. More...
 

Constructor & Destructor Documentation

◆ RefineableTetgenMesh() [1/4]

template<class ELEMENT >
oomph::RefineableTetgenMesh< ELEMENT >::RefineableTetgenMesh ( TetMeshFacetedClosedSurface *const &  outer_boundary_pt,
Vector< TetMeshFacetedSurface * > &  internal_closed_surface_pt,
const double element_volume,
TimeStepper time_stepper_pt = &Mesh::Default_TimeStepper,
const bool use_attributes = false 
)
inline

Build mesh, based on a TetgenMeshClosedSurface that specifies the outer boundary of the domain and any number of internal closed curves, also specified by TriangleMeshClosedSurfaces. Also specify target area for uniform element size.

99  :
100  TetgenMesh<ELEMENT>(outer_boundary_pt,
101  internal_closed_surface_pt,
102  element_volume,
103  time_stepper_pt,
104  use_attributes)
105  {
106  // Initialise the data associated with adaptation
108  }
void initialise_adaptation_data()
Helper function to initialise data associated with adaptation.
Definition: uns_adapt_3d_fs.cc:589
Definition: tetgen_mesh.template.h:52

◆ RefineableTetgenMesh() [2/4]

template<class ELEMENT >
oomph::RefineableTetgenMesh< ELEMENT >::RefineableTetgenMesh ( const Vector< double > &  target_volume,
tetgenio *const &  tetgen_io_pt,
TimeStepper time_stepper_pt = &Mesh::Default_TimeStepper,
const bool use_attributes = false 
)
inline

Build mesh from specified triangulation and associated target volumes for elements in it

117  {
118  // Initialise the data associated with adaptation
120 
121  // Store Timestepper used to build elements
122  this->Time_stepper_pt=time_stepper_pt;
123 
124  // Triangulation has been created -- remember to wipe it!
125  this->Tetgenio_exists =true;
126  this->Tetgenio_pt = new tetgenio;
127 
128  // Add the volume constraints to the tetgenio data object
129  // which may be bad because it's actually modifying things in the base
130  //mesh
131  //Create a local copy
132  tetgenio *tetgen_input_pt = new tetgenio;;
133  this->deep_copy_of_tetgenio(tetgen_io_pt,tetgen_input_pt);
134  //Add volume constraints
135  tetgen_input_pt->tetrahedronvolumelist =
136  new double[tetgen_input_pt->numberoftetrahedra];
137  for(int e=0;e<tetgen_input_pt->numberoftetrahedra;++e)
138  {
139  tetgen_input_pt->tetrahedronvolumelist[e] = target_volume[e];
140  }
141 
142  // Input string for triangle
143  std::stringstream input_string_stream;
144  input_string_stream<< "Vqra";
145 
146  // Convert to a *char required by the triangulate function
147  char tetswitches[100];
148  sprintf(tetswitches,"%s",input_string_stream.str().c_str());
149 
150  // Build triangulateio refined object
151  tetrahedralize(tetswitches, tetgen_input_pt, this->Tetgenio_pt);
152  // Build scaffold
153  this->Tmp_mesh_pt=new TetgenScaffoldMesh(*this->Tetgenio_pt);
154 
155  // Convert mesh from scaffold to actual mesh
156  this->build_from_scaffold(time_stepper_pt,use_attributes);
157 
158  // Kill the scaffold
159  delete this->Tmp_mesh_pt;
160  this->Tmp_mesh_pt=0;
161 
162  //delete the input
163  delete tetgen_input_pt;
164 
165  // Setup boundary coordinates for boundaries
166  //unsigned nb=nboundary();
167  //for (unsigned b=0;b<nb;b++)
168  // {
169  // this->setup_boundary_coordinates(b);
170  // }
171  }
Array< double, 1, 3 > e(1./3., 0.5, 2.)
TimeStepper * Time_stepper_pt
Timestepper used to build nodes.
Definition: tet_mesh.h:1057
tetgenio * Tetgenio_pt
Tetgen representation of mesh.
Definition: tetgen_mesh.template.h:720
void deep_copy_of_tetgenio(tetgenio *const &input_pt, tetgenio *&output_pt)
Definition: tetgen_mesh.template.cc:865
bool Tetgenio_exists
Definition: tetgen_mesh.template.h:717
TetgenScaffoldMesh * Tmp_mesh_pt
Temporary scaffold mesh.
Definition: tetgen_mesh.template.h:713
void build_from_scaffold(TimeStepper *time_stepper_pt, const bool &use_attributes)
Build mesh from scaffold.
Definition: tetgen_mesh.template.cc:48
Definition: tetgen_scaffold_mesh.h:43
Definition: tetgen.h:201
REAL * tetrahedronvolumelist
Definition: tetgen.h:323
int numberoftetrahedra
Definition: tetgen.h:325
void tetrahedralize(tetgenbehavior *b, tetgenio *in, tetgenio *out, tetgenio *addin=NULL, tetgenio *bgmin=NULL)

References e(), tetgenio::numberoftetrahedra, tetrahedralize(), and tetgenio::tetrahedronvolumelist.

◆ ~RefineableTetgenMesh() [1/2]

template<class ELEMENT >
virtual oomph::RefineableTetgenMesh< ELEMENT >::~RefineableTetgenMesh ( )
inlinevirtual

Empty Destructor.

174 {}

◆ RefineableTetgenMesh() [3/4]

template<class ELEMENT >
oomph::RefineableTetgenMesh< ELEMENT >::RefineableTetgenMesh ( TetMeshFacetedClosedSurface *const &  outer_boundary_pt,
Vector< TetMeshFacetedSurface * > &  internal_closed_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 
)
inline

Build mesh, based on a TetMeshFacetedClosedSurface that specifies the outer boundary of the domain and any number of internal closed curves, specified by TetMeshFacetedSurfaces. Also specify target volume for uniform element size.

63  : TetgenMesh<ELEMENT>(outer_boundary_pt,
64  internal_closed_surface_pt,
65  element_volume,
66  time_stepper_pt,
67  use_attributes,
68  split_corner_elements,
69  target_element_volume_in_region_pt),
70  Corner_elements_must_be_split(split_corner_elements)
71  {
72  // Initialise the data associated with adaptation
74  }
bool Corner_elements_must_be_split
Definition: refineable_tetgen_mesh.template.h:260

References oomph::RefineableTetgenMesh< ELEMENT >::initialise_adaptation_data().

◆ RefineableTetgenMesh() [4/4]

template<class ELEMENT >
oomph::RefineableTetgenMesh< ELEMENT >::RefineableTetgenMesh ( const Vector< double > &  target_volume,
tetgenio *const &  tetgen_io_pt,
TetMeshFacetedClosedSurface *const &  outer_boundary_pt,
Vector< TetMeshFacetedSurface * > &  internal_surface_pt,
TimeStepper time_stepper_pt = &Mesh::Default_TimeStepper,
const bool use_attributes = false 
)
inlineprotected

Specialised constructor used during adaptation only. Element sizes are specified by vector tetgen_io is passed in from previous mesh (is then modified to build new mesh) Ditto with use_attributes, which comes from the previous mesh

89  {
90  // NOTE THERE IS A CERTAIN AMOUNT OF DUPLICATION BETWEEN THE
91  // CODE IN HERE AND THE ONE IN THE CONSTRUCTOR OF THE TetgenMesh
92  // BUT THE FACT THAT WE HAVE TO MODIFY THE TETGENIO STRUCTURE
93  // MEANS WE CAN'T QUITE RECYCLE THIS.
94 
95  // Mesh can only be built with 3D Telements.
96  MeshChecker::assert_geometric_element<TElementGeometricBase, ELEMENT>(3);
97 
98  // Initialise the data associated with adaptation
100 
101  // Store Timestepper used to build elements
102  this->Time_stepper_pt = time_stepper_pt;
103 
104  // Triangulation has been created -- remember to wipe it!
105  this->Tetgenio_exists = true;
106  this->Tetgenio_pt = new tetgenio;
107 
108  // Add the volume constraints to the tetgenio data object.
109  // Note that since the tetgenio structure is referred to by pointer
110  // we're also modifying the one associated with the (still existing)
111  // original mesh. Bit naughty but shouldn't cause any problems
112  // since that mesh is already built and about to go out of scope
113  // anyway.
114 
115  // Create a local copy
116  tetgenio* tetgen_input_pt = new tetgenio;
117  ;
118  this->deep_copy_of_tetgenio(tetgen_io_pt, tetgen_input_pt);
119 
120  // Add volume constraints
121  tetgen_input_pt->tetrahedronvolumelist =
122  new double[tetgen_input_pt->numberoftetrahedra];
123  for (int e = 0; e < tetgen_input_pt->numberoftetrahedra; ++e)
124  {
125  tetgen_input_pt->tetrahedronvolumelist[e] = target_volume[e];
126  }
127 
128  // Input string
129  std::stringstream input_string_stream;
130  input_string_stream << "Vqra";
131 
132  // Convert to a *char
133  char tetswitches[100];
134  sprintf(tetswitches, "%s", input_string_stream.str().c_str());
135 
136  // Build triangulateio refined object
137  tetrahedralize(tetswitches, tetgen_input_pt, this->Tetgenio_pt);
138  // Build scaffold
139  this->Tmp_mesh_pt = new TetgenScaffoldMesh(*this->Tetgenio_pt);
140 
141  // Convert mesh from scaffold to actual mesh
142  this->build_from_scaffold(time_stepper_pt, use_attributes);
143 
144  // Kill the scaffold
145  delete this->Tmp_mesh_pt;
146  this->Tmp_mesh_pt = 0;
147 
148  // delete the input
149  delete tetgen_input_pt;
150 
151  // Store the boundary
152  this->Outer_boundary_pt = outer_boundary_pt;
153  // Setup the reverse lookup scheme
155  this->Outer_boundary_pt);
156  // Store the internal boundary
157  this->Internal_surface_pt = internal_surface_pt;
158  // Setup the reverse lookup schemes
159  {
160  unsigned n = this->Internal_surface_pt.size();
161  for (unsigned i = 0; i < n; i++)
162  {
164  this->Internal_surface_pt[i]);
165  }
166  }
167 
168  // Setup boundary coordinates for boundaries
169  unsigned nb = nboundary();
170  for (unsigned b = 0; b < nb; b++)
171  {
172  this->template setup_boundary_coordinates<ELEMENT>(b);
173  }
174 
175  // Now snap onto geometric objects associated with triangular facets
176  // (if any!)
178  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
Scalar * b
Definition: benchVecAdd.cpp:17
unsigned nboundary() const
Return number of boundaries.
Definition: mesh.h:827
void snap_nodes_onto_geometric_objects()
Definition: tet_mesh.cc:483
Vector< TetMeshFacetedSurface * > Internal_surface_pt
Vector to faceted surfaces that define internal boundaries.
Definition: tet_mesh.h:1041
TetMeshFacetedClosedSurface * Outer_boundary_pt
Faceted surface that defines outer boundaries.
Definition: tet_mesh.h:1038
void setup_reverse_lookup_schemes_for_faceted_surface(TetMeshFacetedSurface *const &faceted_surface_pt)
Function to setup the reverse look-up schemes.
Definition: tetgen_mesh.template.cc:828
int nb
Definition: level2_impl.h:286

References b, oomph::TetgenMesh< ELEMENT >::build_from_scaffold(), oomph::TetgenMesh< ELEMENT >::deep_copy_of_tetgenio(), e(), i, oomph::RefineableTetgenMesh< ELEMENT >::initialise_adaptation_data(), oomph::TetMeshBase::Internal_surface_pt, n, nb, oomph::Mesh::nboundary(), tetgenio::numberoftetrahedra, oomph::TetMeshBase::Outer_boundary_pt, oomph::TetgenMesh< ELEMENT >::setup_reverse_lookup_schemes_for_faceted_surface(), oomph::TetMeshBase::snap_nodes_onto_geometric_objects(), oomph::TetgenMesh< ELEMENT >::Tetgenio_exists, oomph::TetgenMesh< ELEMENT >::Tetgenio_pt, tetrahedralize(), tetgenio::tetrahedronvolumelist, oomph::TetMeshBase::Time_stepper_pt, and oomph::TetgenMesh< ELEMENT >::Tmp_mesh_pt.

◆ ~RefineableTetgenMesh() [2/2]

template<class ELEMENT >
virtual oomph::RefineableTetgenMesh< ELEMENT >::~RefineableTetgenMesh ( )
inlinevirtual

Empty Destructor.

183 {}

Member Function Documentation

◆ adapt() [1/2]

template<class ELEMENT >
void oomph::RefineableTetgenMesh< ELEMENT >::adapt ( const Vector< double > &  elem_error)
virtual

Adapt mesh, based on elemental error provided.

Adapt problem based on specified elemental error estimates.

////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////

Implements oomph::RefineableMeshBase.

753  {
754  // Get refinement targets
755  Vector<double> target_size(elem_error.size());
756  double max_edge_ratio=compute_volume_target(elem_error,
757  target_size);
758  // Get maximum target volume
759  unsigned n=target_size.size();
760  double max_size=0.0;
761  double min_size=DBL_MAX;
762  for (unsigned e=0;e<n;e++)
763  {
764  if (target_size[e]>max_size) max_size=target_size[e];
765  if (target_size[e]<min_size) min_size=target_size[e];
766  }
767 
768  oomph_info << "Maximum target size: " << max_size << std::endl;
769  oomph_info << "Minimum target size: " << min_size << std::endl;
770  oomph_info << "Number of elements to be refined "
771  << this->Nrefined << std::endl;
772  oomph_info << "Number of elements to be unrefined "
773  << this->Nunrefined << std::endl;
774  oomph_info << "Max edge ratio "<< max_edge_ratio << std::endl;
775 
776  double orig_max_size, orig_min_size;
777  this->max_and_min_element_size(orig_max_size, orig_min_size);
778  oomph_info << "Max/min element size in original mesh: "
779  << orig_max_size << " "
780  << orig_min_size << std::endl;
781 
782  // Should we bother to adapt?
783  if ( (Nrefined > 0) || (Nunrefined > this->max_keep_unrefined()) ||
784  (max_edge_ratio > this->max_permitted_edge_ratio()) )
785  {
786 
787  if (! ( (Nrefined > 0) || (Nunrefined > max_keep_unrefined()) ) )
788  {
789  oomph_info
790  << "Mesh regeneration triggered by edge ratio criterion\n";
791  }
792 
793  //Generate a new 1D mesh representation of the inner hole boundaries
795 
796  //Update the representation of the outer boundary
797  //this->surface_remesh_for_outer_boundary();
798 
799  //If there is not a geometric object associated with the boundary
800  //the reset the boundary coordinates so that the lengths are consistent
801  //in the new mesh and the old mesh.
802  const unsigned n_boundary = this->nboundary();
803  for(unsigned b=0;b<n_boundary;++b)
804  {
805  //if(this->boundary_geom_object_pt(b)==0)
806  {
808  }
809  }
810 
811  // Are we dealing with a solid mesh?
812  SolidMesh* solid_mesh_pt=dynamic_cast<SolidMesh*>(this);
813 
814  // Build temporary uniform background mesh
815  //----------------------------------------
816  // with volume set by maximum required volume
817  //---------------------------------------
818  RefineableTetgenMesh<ELEMENT>* tmp_new_mesh_pt=0;
819  /* if (solid_mesh_pt!=0)
820  {
821  tmp_new_mesh_pt=new RefineableSolidTriangleMesh<ELEMENT>
822  (closed_curve_pt,
823  hole_pt,
824  max_size,
825  this->Time_stepper_pt,
826  this->Use_attributes);
827  }
828  else*/
829  {
830  tmp_new_mesh_pt=new RefineableTetgenMesh<ELEMENT>
831  (this->Outer_boundary_pt,
832  this->Internal_surface_pt,
833  max_size,
834  this->Time_stepper_pt,
835  this->Use_attributes);
836  }
837 
838 
839 
840  // Snap to curvilinear boundaries (some code duplication as this
841  // is repeated below but helper function would take so many
842  // arguments that it's nearly as messy...
843 
844  //Pass the boundary geometric objects to the new mesh
845  //tmp_new_mesh_pt->boundary_geom_object_pt() =
846  // this->boundary_geom_object_pt();
847 
848  //Reset the boundary coordinates if there is
849  //a geometric object associated with the boundary
850  //tmp_new_mesh_pt->boundary_coordinate_limits() =
851  // this->boundary_coordinate_limits();
852  //for (unsigned b=0;b<n_boundary;b++)
853  // {
854  // if(tmp_new_mesh_pt->boundary_geom_object_pt(b)!=0)
855  // {
856  // tmp_new_mesh_pt->setup_boundary_coordinates(b);
857  // }
858  // }
859 
860  //Output the mesh before any snapping takes place
861  tmp_new_mesh_pt->output("pre_mesh_nodes_snapped_0.dat");
862 
863  //Move the nodes on the new boundary onto the
864  //old curvilinear boundary
865  //If the boundary is straight this will do precisely nothing
866  //but will be somewhat inefficient
867  for(unsigned b=0;b<n_boundary;b++)
868  {
869  this->snap_nodes_onto_boundary(tmp_new_mesh_pt,b);
870  }
871 
872  //Output the mesh after the snapping has taken place
873  tmp_new_mesh_pt->output("mesh_nodes_snapped_0.dat");
874 
875  // Get the tetgenio object associated with that mesh
876  tetgenio *tmp_new_tetgenio_pt = tmp_new_mesh_pt->tetgenio_pt();
877 
878 
879 #ifdef PARANOID
880  if (this->Problem_pt==0)
881  {
882  throw OomphLibError("Problem pointer must be set with problem_pt()",
885  }
886 #endif
887 
888  RefineableTetgenMesh<ELEMENT>* new_mesh_pt=0;
889 
890  // Map storing target sizes for elements in temporary
891  // tetgenio mesh
892  std::map<GeneralisedElement*,double> target_size_map;
893 
894 
896  // NOTE: Repeated setup of multidomain interaction could
897  // be avoided by setting up a sufficiently fine bin
898  // for the original mesh and reading out the target
899  // area information from there
901 
902  // Now start iterating to refine mesh recursively
903  //-----------------------------------------------
904  bool done=false;
905  unsigned iter=0;
906  while (!done)
907  {
908 
909  // "Project" target volumes from current mesh onto uniform
910  //------------------------------------------------------
911  // background mesh
912  //----------------
913 
914  // Temporarily switch on projection capabilities to allow
915  // storage of pointer to external element.
916  // Need to do this for both meshes to ensure that
917  // matching is done based on Eulerian coordinates for both
918  // (in case we're dealing with solid meshes where the
919  // locate_zeta would otherwise use the Lagrangian coordintes).
920  unsigned nelem=this->nelement();
921  for (unsigned e=0;e<nelem;e++)
922  {
923  dynamic_cast<ELEMENT*>(this->element_pt(e))->enable_projection();
924  }
925  unsigned nelem2=tmp_new_mesh_pt->nelement();
926  for (unsigned e=0;e<nelem2;e++)
927  {
928  dynamic_cast<ELEMENT*>(tmp_new_mesh_pt->element_pt(e))->
930  }
931 
932  // Set up multi domain interactions so we can figure out
933  // which element in the intermediate uniform mesh is co-located
934  // with given element in current mesh (which is to be refined)
936  <ELEMENT>(this->Problem_pt,this,tmp_new_mesh_pt);
937 
938  target_size_map.clear();
939  for (unsigned e=0;e<nelem;e++)
940  {
941  ELEMENT* el_pt=dynamic_cast<ELEMENT*>(this->element_pt(e));
942  unsigned nint=el_pt->integral_pt()->nweight();
943  for (unsigned ipt=0;ipt<nint;ipt++)
944  {
945  GeneralisedElement* ext_el_pt=el_pt->external_element_pt(0,ipt);
946 
947  // Use max. rather than min area of any element overlapping the
948  // the current element, otherwise we get a rapid outward diffusion
949  // of small elements
950  target_size_map[ext_el_pt]=std::max(target_size_map[ext_el_pt],
951  target_size[e]);
952  }
953 
954  // Switch off projection capability
955  dynamic_cast<ELEMENT*>(this->element_pt(e))->disable_projection();
956  }
957  for (unsigned e=0;e<nelem2;e++)
958  {
959  dynamic_cast<ELEMENT*>(tmp_new_mesh_pt->element_pt(e))->
961  }
962 
963  // Now copy into target area for temporary mesh but limit to
964  // the equivalent of one sub-division per iteration
965  done=true;
966  unsigned nel_new=tmp_new_mesh_pt->nelement();
967  Vector<double> new_target_size(nel_new);
968  for (unsigned e=0;e<nel_new;e++)
969  {
970  // No target area found for this element -- keep its size
971  // by setting target area to -1 for tetrahedron
972  double new_size=target_size_map[tmp_new_mesh_pt->element_pt(e)];
973  if (new_size<=0.0)
974  {
975  new_target_size[e]=-1.0;
976  }
977  else
978  {
979  // Limit target area to the equivalent of uniform
980  // refinement during this stage of the iteration
981  new_target_size[e]=new_size;
982  if (new_target_size[e]<
983  tmp_new_mesh_pt->finite_element_pt(e)->size()/4.0)
984  {
985  //ALH: It seems that tetgen "enlarges" the volume constraint
986  //so this criterion can never be meet unless dividing by 1.2
987  //as well.
988  new_target_size[e]=
989  tmp_new_mesh_pt->finite_element_pt(e)->size()/4.0;
990  //This is the tetgen adjustment
991  new_target_size[e] /= 1.2;
992 
993  // We'll need to give it another go later
994  done=false;
995  }
996  }
997  }
998 
999 
1000 
1001  // Now create the new mesh from TriangulateIO structure
1002  //-----------------------------------------------------
1003  // associated with uniform background mesh and the
1004  //------------------------------------------------
1005  // associated target element sizes.
1006  //---------------------------------
1007 
1008  // Solid mesh?
1009  /*if (solid_mesh_pt!=0)
1010  {
1011  new_mesh_pt=new RefineableSolidTriangleMesh<ELEMENT>
1012  (new_target_area,
1013  tmp_new_triangulateio,
1014  this->Time_stepper_pt,
1015  this->Use_attributes);
1016  }
1017  // No solid mesh
1018  else */
1019  {
1020  new_mesh_pt=new RefineableTetgenMesh<ELEMENT>
1021  (new_target_size,
1022  tmp_new_tetgenio_pt,
1023  this->Time_stepper_pt,
1024  this->Use_attributes);
1025  }
1026 
1027 
1028  // Snap to curvilinear boundaries (some code duplication as this
1029  // is repeated below but helper function would take so many
1030  // arguments that it's nearly as messy...
1031 
1032  //Pass the boundary geometric objects to the new mesh
1033  //new_mesh_pt->boundary_geom_object_pt() =
1034  // this->boundary_geom_object_pt();
1035 
1036 
1037  // Reset the boundary coordinates if there is
1038  // a geometric object associated with the boundary
1039  //new_mesh_pt->boundary_coordinate_limits() =
1040  // this->boundary_coordinate_limits();
1041  //for (unsigned b=0;b<n_boundary;b++)
1042  // {
1043  // if(new_mesh_pt->boundary_geom_object_pt(b)!=0)
1044  // {
1045  // new_mesh_pt->setup_boundary_coordinates(b);
1046  // }
1047  // }
1048 
1049  //Output the mesh before any snapping takes place
1050  new_mesh_pt->output("pre_mesh_nodes_snapped_1.dat");
1051 
1052  //Move the nodes on the new boundary onto the
1053  //old curvilinear boundary
1054  //If the boundary is straight this will do precisely nothing
1055  //but will be somewhat inefficient
1056  for(unsigned b=0;b<n_boundary;b++)
1057  {
1058  this->snap_nodes_onto_boundary(new_mesh_pt,b);
1059  }
1060 
1061  //Output the mesh after the snapping has taken place
1062  new_mesh_pt->output("mesh_nodes_snapped_1.dat");
1063 
1064 
1065  // Not done: get ready for another iteration
1066  iter++;
1067  //Delete the temporary mesh
1068  delete tmp_new_mesh_pt;
1069  //Now transfer over the pointers
1070  if (!done)
1071  {
1072  tmp_new_mesh_pt=new_mesh_pt;
1073  tmp_new_tetgenio_pt=new_mesh_pt->tetgenio_pt();
1074  }
1075 
1076  } // end of iteration
1077 
1078 
1079  // Project current solution onto new mesh
1080  //---------------------------------------
1081  ProjectionProblem<ELEMENT>* project_problem_pt=
1083  project_problem_pt->mesh_pt()=new_mesh_pt;
1084  project_problem_pt->project(this);
1085 
1086  //this->output("pre_proj",5);
1087  //new_mesh_pt->output("post_proj.dat",5);
1088 
1089  //Flush the old mesh
1090  unsigned nnod=nnode();
1091  for(unsigned j=nnod;j>0;j--)
1092  {
1093  delete Node_pt[j-1];
1094  Node_pt[j-1] = 0;
1095  }
1096  unsigned nel=nelement();
1097  for(unsigned e=nel;e>0;e--)
1098  {
1099  delete Element_pt[e-1];
1100  Element_pt[e-1] = 0;
1101  }
1102 
1103  // Now copy back to current mesh
1104  //------------------------------
1105  nnod=new_mesh_pt->nnode();
1106  Node_pt.resize(nnod);
1107  nel=new_mesh_pt->nelement();
1108  Element_pt.resize(nel);
1109  for(unsigned j=0;j<nnod;j++)
1110  {
1111  Node_pt[j] = new_mesh_pt->node_pt(j);
1112  }
1113  for(unsigned e=0;e<nel;e++)
1114  {
1115  Element_pt[e] = new_mesh_pt->element_pt(e);
1116  }
1117 
1118  //Copy the boundary schemes
1119  unsigned nbound=new_mesh_pt->nboundary();
1120  Boundary_element_pt.resize(nbound);
1121  Face_index_at_boundary.resize(nbound);
1122  Boundary_node_pt.resize(nbound);
1123  for (unsigned b=0;b<nbound;b++)
1124  {
1125  unsigned nel=new_mesh_pt->nboundary_element(b);
1126  Boundary_element_pt[b].resize(nel);
1127  Face_index_at_boundary[b].resize(nel);
1128  for (unsigned e=0;e<nel;e++)
1129  {
1130  Boundary_element_pt[b][e]=new_mesh_pt->boundary_element_pt(b,e);
1132  }
1133  unsigned nnod=new_mesh_pt->nboundary_node(b);
1134  Boundary_node_pt[b].resize(nnod);
1135  for (unsigned j=0;j<nnod;j++)
1136  {
1137  Boundary_node_pt[b][j]=new_mesh_pt->boundary_node_pt(b,j);
1138  }
1139  }
1140 
1141  //Also copy over the new boundary and region information
1142  unsigned n_region = new_mesh_pt->nregion();
1143  //Only bother if we have regions
1144  if(n_region > 1)
1145  {
1146  //Deal with the region information first
1147  this->Region_element_pt.resize(n_region);
1148  this->Region_attribute.resize(n_region);
1149  for(unsigned r=0;r<n_region;r++)
1150  {
1151  this->Region_attribute[r] = new_mesh_pt->region_attribute(r);
1152  //Find the number of elements in the region
1153  unsigned n_region_element = new_mesh_pt->nregion_element(r);
1154  this->Region_element_pt[r].resize(n_region_element);
1155  for(unsigned e=0;e<n_region_element;e++)
1156  {
1157  this->Region_element_pt[r][e] = new_mesh_pt->region_element_pt(r,e);
1158  }
1159  }
1160 
1161  //Now the boundary region information
1162  this->Boundary_region_element_pt.resize(nbound);
1163  this->Face_index_region_at_boundary.resize(nbound);
1164 
1165  //Now loop over the boundaries
1166  for(unsigned b=0;b<nbound;++b)
1167  {
1168  //Loop over the regions
1169  for(unsigned r=0;r<n_region;++r)
1170  {
1171  unsigned n_boundary_el_in_region =
1172  new_mesh_pt->nboundary_element_in_region(b,r);
1173 
1174  if(n_boundary_el_in_region > 0)
1175  {
1176  //Allocate storage in the map
1177  this->Boundary_region_element_pt[b][r].
1178  resize(n_boundary_el_in_region);
1180  resize(n_boundary_el_in_region);
1181 
1182  //Copy over the information
1183  for(unsigned e=0;e<n_boundary_el_in_region;++e)
1184  {
1185  this->Boundary_region_element_pt[b][r][e]
1186  = new_mesh_pt->boundary_element_in_region_pt(b,r,e);
1188  = new_mesh_pt->face_index_at_boundary_in_region(b,r,e);
1189  }
1190  }
1191  }
1192  } //End of loop over boundaries
1193 
1194  } //End of case when more than one region
1195 
1196  //Snap the newly created nodes onto any geometric objects
1197  //this->snap_nodes_onto_geometric_objects();
1198 
1199  // Copy the IDs of the vertex nodes
1200  //this->Oomph_vertex_nodes_id=new_mesh_pt->oomph_vertex_nodes_id();
1201 
1202  // Copy TriangulateIO representation
1203  //TriangleHelper::clear_triangulateio(this->Triangulateio);
1204  //bool quiet=true;
1205  //this->Triangulateio=
1206  // TriangleHelper::deep_copy_of_triangulateio_representation(
1207  // new_mesh_pt->triangulateio_representation(),quiet);
1208 
1209  this->set_deep_copy_tetgenio_pt(new_mesh_pt->tetgenio_pt());
1210  //this->Tetgenio_pt = new_mesh_pt->tetgenio_pt();
1211 
1212  // Flush the mesh
1213  new_mesh_pt->flush_element_and_node_storage();
1214 
1215  // Delete the mesh and the problem
1216  delete new_mesh_pt;
1217  delete project_problem_pt;
1218 
1219  // Solid mesh?
1220  if (solid_mesh_pt!=0)
1221  {
1222  // Warning
1223  std::stringstream error_message;
1224  error_message
1225  << "Lagrangian coordinates are currently not projected but are\n"
1226  << "are re-set during adaptation. This is not appropriate for\n"
1227  << "real solid mechanics problems!\n";
1228  OomphLibWarning(error_message.str(),
1229  "RefineableTriangleMesh::adapt()",
1231 
1232  // Reset Lagrangian coordinates
1233  dynamic_cast<SolidMesh*>(this)->set_lagrangian_nodal_coordinates();
1234  }
1235 
1236  double max_area;
1237  double min_area;
1238  this->max_and_min_element_size(max_area, min_area);
1239  oomph_info << "Max/min element size in adapted mesh: "
1240  << max_area << " "
1241  << min_area << std::endl;
1242  }
1243  else
1244  {
1245  oomph_info << "Not enough benefit in adaptation.\n";
1246  Nrefined=0;
1247  Nunrefined=0;
1248  }
1249  }
v resize(3)
double size() const
Definition: elements.cc:4290
Definition: elements.h:73
unsigned long nboundary_node(const unsigned &ibound) const
Return number of nodes on a particular boundary.
Definition: mesh.h:833
Vector< Node * > Node_pt
Vector of pointers to nodes.
Definition: mesh.h:183
void max_and_min_element_size(double &max_size, double &min_size)
Definition: mesh.h:692
Vector< Vector< FiniteElement * > > Boundary_element_pt
Definition: mesh.h:91
void flush_element_and_node_storage()
Definition: mesh.h:407
FiniteElement * finite_element_pt(const unsigned &e) const
Definition: mesh.h:473
int face_index_at_boundary(const unsigned &b, const unsigned &e) const
Definition: mesh.h:896
Vector< Vector< int > > Face_index_at_boundary
Definition: mesh.h:95
unsigned nboundary_element(const unsigned &b) const
Return number of finite elements that are adjacent to boundary b.
Definition: mesh.h:878
FiniteElement * boundary_element_pt(const unsigned &b, const unsigned &e) const
Return pointer to e-th finite element on boundary b.
Definition: mesh.h:840
GeneralisedElement *& element_pt(const unsigned long &e)
Return pointer to element e.
Definition: mesh.h:448
unsigned long nnode() const
Return number of nodes in the mesh.
Definition: mesh.h:596
void output(std::ostream &outfile)
Output for all elements.
Definition: mesh.cc:2027
const Vector< GeneralisedElement * > & element_pt() const
Return reference to the Vector of elements.
Definition: mesh.h:460
Node *& node_pt(const unsigned long &n)
Return pointer to global node n.
Definition: mesh.h:436
Vector< Vector< Node * > > Boundary_node_pt
Definition: mesh.h:83
Node *& boundary_node_pt(const unsigned &b, const unsigned &n)
Return pointer to node n on boundary b.
Definition: mesh.h:493
Vector< GeneralisedElement * > Element_pt
Vector of pointers to generalised elements.
Definition: mesh.h:186
unsigned long nelement() const
Return number of elements in the mesh.
Definition: mesh.h:590
Definition: oomph_definitions.h:222
Definition: oomph_definitions.h:267
Mesh *& mesh_pt()
Return a pointer to the global mesh.
Definition: problem.h:1280
Definition: projection.h:695
void project(Mesh *base_mesh_pt, const bool &dont_project_positions=false)
Project from base into the problem's own mesh.
Definition: projection.h:748
unsigned Nrefined
Stats: Number of elements that were refined.
Definition: refineable_mesh.h:338
unsigned & max_keep_unrefined()
Definition: refineable_mesh.h:123
unsigned Nunrefined
Stats: Number of elements that were unrefined.
Definition: refineable_mesh.h:341
Definition: uns_adapt_3d_fs.cc:86
virtual void surface_remesh_for_inner_hole_boundaries()
Definition: uns_adapt_3d_fs.cc:412
double & max_permitted_edge_ratio()
Min angle before remesh gets triggered.
Definition: uns_adapt_3d_fs.cc:187
Problem * Problem_pt
Definition: uns_adapt_3d_fs.cc:731
void enable_projection()
Disable projection of old solution onto new mesh.
Definition: refineable_tetgen_mesh.template.h:224
double compute_volume_target(const Vector< double > &elem_error, Vector< double > &target_volume)
Definition: uns_adapt_3d_fs.cc:609
void snap_nodes_onto_boundary(RefineableTetgenMesh< ELEMENT > *&new_mesh_pt, const unsigned &b)
Generate a new PSLG representation of the outer boundary.
Definition: uns_adapt_3d_fs.cc:440
void disable_projection()
Disable projection of old solution onto new mesh.
Definition: refineable_tetgen_mesh.template.h:218
Definition: mesh.h:2562
int face_index_at_boundary_in_region(const unsigned &b, const unsigned &r, const unsigned &e) const
Return face index of the e-th element adjacent to boundary b in region r.
Definition: tet_mesh.h:834
Vector< double > Region_attribute
Definition: tet_mesh.h:1027
double region_attribute(const unsigned &i)
Definition: tet_mesh.h:906
unsigned nregion()
Return the number of regions specified by attributes.
Definition: tet_mesh.h:860
unsigned nboundary_element_in_region(const unsigned &b, const unsigned &r) const
Return the number of elements adjacent to boundary b in region r.
Definition: tet_mesh.h:797
Vector< std::map< unsigned, Vector< FiniteElement * > > > Boundary_region_element_pt
Storage for elements adjacent to a boundary in a particular region.
Definition: tet_mesh.h:1031
void setup_boundary_coordinates(const unsigned &b)
Definition: tet_mesh.h:702
FiniteElement * boundary_element_in_region_pt(const unsigned &b, const unsigned &r, const unsigned &e) const
Return pointer to the e-th element adjacent to boundary b in region r.
Definition: tet_mesh.h:816
FiniteElement * region_element_pt(const unsigned &r, const unsigned &e)
Return the e-th element in the r-th region.
Definition: tet_mesh.h:912
Vector< std::map< unsigned, Vector< int > > > Face_index_region_at_boundary
Definition: tet_mesh.h:1035
Vector< Vector< FiniteElement * > > Region_element_pt
Definition: tet_mesh.h:1022
unsigned nregion_element(const unsigned &r)
Return the number of elements in region r.
Definition: tet_mesh.h:866
tetgenio *& tetgenio_pt()
Access to the triangulateio representation of the mesh.
Definition: tetgen_mesh.template.h:679
void set_deep_copy_tetgenio_pt(tetgenio *const &tetgenio_pt)
Set the tetgen pointer by a deep copy.
Definition: tetgen_mesh.template.h:685
bool Use_attributes
Definition: tetgen_mesh.template.h:724
#define max(a, b)
Definition: datatypes.h:23
r
Definition: UniformPSDSelfTest.py:20
void setup_multi_domain_interaction(Problem *problem_pt, Mesh *const &mesh_pt, Mesh *const &external_mesh_pt, const unsigned &interaction_index=0)
Definition: multi_domain.template.cc:280
OomphInfo oomph_info
Definition: oomph_definitions.cc:319
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References b, oomph::TetMeshBase::boundary_element_in_region_pt(), oomph::Mesh::boundary_element_pt(), oomph::Mesh::boundary_node_pt(), e(), oomph::Mesh::element_pt(), oomph::Mesh::face_index_at_boundary(), oomph::TetMeshBase::face_index_at_boundary_in_region(), oomph::Mesh::finite_element_pt(), oomph::Mesh::flush_element_and_node_storage(), j, max, oomph::Problem::mesh_pt(), n, oomph::Mesh::nboundary(), oomph::Mesh::nboundary_element(), oomph::TetMeshBase::nboundary_element_in_region(), oomph::Mesh::nboundary_node(), oomph::Mesh::nelement(), oomph::Mesh::nnode(), oomph::Mesh::node_pt(), oomph::TetMeshBase::nregion(), oomph::TetMeshBase::nregion_element(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, oomph::Mesh::output(), oomph::ProjectionProblem< PROJECTABLE_ELEMENT >::project(), UniformPSDSelfTest::r, oomph::TetMeshBase::region_attribute(), oomph::TetMeshBase::region_element_pt(), resize(), oomph::Multi_domain_functions::setup_multi_domain_interaction(), oomph::FiniteElement::size(), and oomph::TetgenMesh< ELEMENT >::tetgenio_pt().

◆ adapt() [2/2]

template<class ELEMENT >
void oomph::RefineableTetgenMesh< ELEMENT >::adapt ( const Vector< double > &  elem_error)
virtual

Adapt mesh, based on elemental error provided.

Implements oomph::RefineableMeshBase.

◆ compute_volume_target()

template<class ELEMENT >
double oomph::RefineableTetgenMesh< ELEMENT >::compute_volume_target ( const Vector< double > &  elem_error,
Vector< double > &  target_volume 
)
inline

Build a new tetgenio object from previous TriangulateIO based on target area for each element Compute target volume based on the element's error and the error target; return max edge ratio

611  {
612  double max_edge_ratio=0.0;
613  unsigned count_unrefined=0;
614  unsigned count_refined=0;
615  this->Nrefinement_overruled=0;
616 
617  unsigned nel=this->nelement();
618  for (unsigned e=0;e<nel;e++)
619  {
620  // Get element
621  FiniteElement* el_pt=this->finite_element_pt(e);
622 
623  // Calculate the volume of the element
624  double volume=el_pt->size();
625 
626  //Find the vertex coordinates
627  // (vertices are enumerated first)
628  double vertex[4][3];
629  for(unsigned n=0;n<4;++n)
630  {
631  for(unsigned i=0;i<3;++i)
632  {
633  vertex[n][i] = el_pt->node_pt(n)->x(i);
634  }
635  }
636 
637  //Compute the radius of the circumsphere of the tetrahedron
638  //Algorithm stolen from tetgen for consistency
639  DenseDoubleMatrix A(3);
640  for(unsigned i=0;i<3;++i)
641  {
642  A(0,i) = vertex[1][i] - vertex[0][i];
643  A(1,i) = vertex[2][i] - vertex[0][i];
644  A(2,i) = vertex[3][i] - vertex[0][i];
645  }
646 
647  Vector<double> rhs(3);
648  // Compute the right hand side vector b (3x1).
649  for(unsigned i=0;i<3;++i)
650  {
651  rhs[i] = 0.0;
652  for(unsigned k=0;k<3;++k)
653  {
654  rhs[i] += A(i,k)*A(i,k);
655  }
656  rhs[i] *= 0.5;
657  }
658 
659  //Solve the linear system, in which the rhs is over-written with
660  //the solution
661  A.solve(rhs);
662  //Calculate the circum-radius
663  double circum_radius =
664  sqrt(rhs[0]*rhs[0] + rhs[1]*rhs[1] + rhs[2]*rhs[2]);
665 
666  //Now find the shortest edge length
667  Vector<double> edge(3);
668  double min_length = DBL_MAX;
669  for(unsigned start=0;start<4;++start)
670  {
671  for(unsigned end=start+1;end<4;++end)
672  {
673  for(unsigned i=0;i<3;++i)
674  {
675  edge[i] = vertex[start][i] - vertex[end][i];
676  }
677  double length =
678  sqrt(edge[0]*edge[0] + edge[1]*edge[1] + edge[2]*edge[2]);
679  if(length < min_length) {min_length = length;}
680  }
681  }
682 
683  //Now calculate the minimum edge ratio for this element
684  double local_max_edge_ratio = circum_radius/min_length;
685  if(local_max_edge_ratio > max_edge_ratio)
686  {
687  max_edge_ratio = local_max_edge_ratio;
688  }
689 
690  // Mimick refinement in tree-based procedure: Target volumes
691  // for elements that exceed permitted error is 1/4 of their
692  // current volume, corresponding to a uniform sub-division.
693  if (elem_error[e] > this->max_permitted_error())
694  {
695  target_volume[e]=std::max(volume/4.0,Min_element_size);
696  if (target_volume[e]!=Min_element_size)
697  {
698  count_refined++;
699  }
700  else
701  {
702  this->Nrefinement_overruled++;
703  }
704  }
705  else if (elem_error[e] < this->min_permitted_error())
706  {
707  target_volume[e]=std::min(4.0*volume,Max_element_size);
708  if (target_volume[e]!=Max_element_size)
709  {
710  count_unrefined++;
711  }
712  }
713  else
714  {
715  // Leave it alone
716  target_volume[e] = std::max(volume,Min_element_size);
717  }
718 
719  } //End of loop over elements
720 
721  // Tell everybody
722  this->Nrefined=count_refined;
723  this->Nunrefined=count_unrefined;
724 
725  return max_edge_ratio;
726  }
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
Definition: bench_gemm.cpp:47
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
Definition: matrices.h:1271
Definition: elements.h:1313
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Definition: elements.h:2175
double & x(const unsigned &i)
Return the i-th nodal coordinate.
Definition: nodes.h:1060
double & min_permitted_error()
Definition: refineable_mesh.h:156
unsigned Nrefinement_overruled
Definition: refineable_mesh.h:363
double & max_permitted_error()
Definition: refineable_mesh.h:163
double Max_element_size
Max permitted element size.
Definition: uns_adapt_3d_fs.cc:734
double Min_element_size
Min permitted element size.
Definition: uns_adapt_3d_fs.cc:737
#define min(a, b)
Definition: datatypes.h:22
static constexpr lastp1_t end
Definition: IndexedViewHelper.h:79
char char char int int * k
Definition: level2_impl.h:374
void start(const unsigned &i)
(Re-)start i-th timer
Definition: oomph_utilities.cc:243

References e(), Eigen::placeholders::end, i, k, max, TestArguments::Max_element_size, min, TestArguments::Min_element_size, n, oomph::FiniteElement::node_pt(), oomph::FiniteElement::size(), sqrt(), oomph::CumulativeTimings::start(), and oomph::Node::x().

◆ disable_projection()

template<class ELEMENT >
void oomph::RefineableTetgenMesh< ELEMENT >::disable_projection ( )
inline

Disable projection of old solution onto new mesh.

219  {
220  Projection_is_disabled = true;
221  }
bool Projection_is_disabled
Disable projection of solution onto new mesh during adaptation.
Definition: refineable_tetgen_mesh.template.h:255

References oomph::RefineableTetgenMesh< ELEMENT >::Projection_is_disabled.

◆ doc_adaptivity_targets()

template<class ELEMENT >
void oomph::RefineableTetgenMesh< ELEMENT >::doc_adaptivity_targets ( std::ostream &  outfile)
inlinevirtual

Doc the targets for mesh adaptation.

Reimplemented from oomph::RefineableMeshBase.

191  {
192  outfile << std::endl;
193  outfile << "Targets for mesh adaptation: " << std::endl;
194  outfile << "---------------------------- " << std::endl;
195  outfile << "Target for max. error: " << Max_permitted_error << std::endl;
196  outfile << "Target for min. error: " << Min_permitted_error << std::endl;
197  outfile << "Target max edge ratio: "
198  << Max_permitted_edge_ratio << std::endl;
199  outfile << "Min. allowed element size: " << Min_element_size << std::endl;
200  outfile << "Max. allowed element size: " << Max_element_size << std::endl;
201  outfile << "Don't unrefine if less than " << Max_keep_unrefined
202  << " elements need unrefinement." << std::endl;
203  outfile << std::endl;
204  }
unsigned Max_keep_unrefined
Definition: refineable_mesh.h:359
double Min_permitted_error
Min. error (i.e. (try to) merge elements if their error is smaller)
Definition: refineable_mesh.h:329
double Max_permitted_error
Max. error (i.e. split elements if their error is larger)
Definition: refineable_mesh.h:326
double Max_permitted_edge_ratio
Max edge ratio before remesh gets triggered.
Definition: uns_adapt_3d_fs.cc:740

References TestArguments::Max_element_size, TestArguments::Max_permitted_error, TestArguments::Min_element_size, and TestArguments::Min_permitted_error.

◆ enable_projection()

template<class ELEMENT >
void oomph::RefineableTetgenMesh< ELEMENT >::enable_projection ( )
inline

Disable projection of old solution onto new mesh.

225  {
226  Projection_is_disabled = false;
227  }

References oomph::RefineableTetgenMesh< ELEMENT >::Projection_is_disabled.

◆ initialise_adaptation_data() [1/2]

template<class ELEMENT >
void oomph::RefineableTetgenMesh< ELEMENT >::initialise_adaptation_data ( )
inline

Helper function to initialise data associated with adaptation.

590  {
591  // Set max and min targets for adaptation
592  this->Max_element_size=1.0;
593  this->Min_element_size=0.001;
594  this->Max_permitted_edge_ratio=2.0;
595 
596  // Initialise problem pointer
597  this->Problem_pt=0;
598  }

References TestArguments::Max_element_size, and TestArguments::Min_element_size.

Referenced by oomph::RefineableTetgenMesh< ELEMENT >::RefineableTetgenMesh().

◆ initialise_adaptation_data() [2/2]

template<class ELEMENT >
void oomph::RefineableTetgenMesh< ELEMENT >::initialise_adaptation_data ( )
inlineprotected

Helper function to initialise data associated with adaptation.

By default we project solution onto new mesh during adaptation

233  {
234  // Set max and min targets for adaptation
235  this->Max_element_size = 1.0;
236  this->Min_element_size = 0.001;
237  this->Max_permitted_edge_ratio = 2.0;
238 
240  Projection_is_disabled = false;
241  }

References oomph::RefineableTetgenMesh< ELEMENT >::Max_element_size, oomph::RefineableTetgenMesh< ELEMENT >::Max_permitted_edge_ratio, oomph::RefineableTetgenMesh< ELEMENT >::Min_element_size, and oomph::RefineableTetgenMesh< ELEMENT >::Projection_is_disabled.

◆ max_element_size()

template<class ELEMENT >
double& oomph::RefineableTetgenMesh< ELEMENT >::max_element_size ( )
inline

Max element size allowed during adaptation.

181 {return Max_element_size;}

References TestArguments::Max_element_size.

◆ max_permitted_edge_ratio()

template<class ELEMENT >
double& oomph::RefineableTetgenMesh< ELEMENT >::max_permitted_edge_ratio ( )
inline

Min angle before remesh gets triggered.

187 {return Max_permitted_edge_ratio;}

◆ min_element_size()

template<class ELEMENT >
double& oomph::RefineableTetgenMesh< ELEMENT >::min_element_size ( )
inline

Min element size allowed during adaptation.

184 {return Min_element_size;}

References TestArguments::Min_element_size.

◆ problem_pt()

template<class ELEMENT >
Problem*& oomph::RefineableTetgenMesh< ELEMENT >::problem_pt ( )
inline

Problem pointer (needed for multi-domain machinery during adaptation)

178 {return Problem_pt;}

◆ projection_is_disabled()

template<class ELEMENT >
bool oomph::RefineableTetgenMesh< ELEMENT >::projection_is_disabled ( )
inline

Is projection of old solution onto new mesh disabled?

213  {
214  return Projection_is_disabled;
215  }

References oomph::RefineableTetgenMesh< ELEMENT >::Projection_is_disabled.

◆ refine_uniformly() [1/2]

template<class ELEMENT >
void oomph::RefineableTetgenMesh< ELEMENT >::refine_uniformly ( DocInfo doc_info)
inlinevirtual

Refine mesh uniformly and doc process.

Implements oomph::RefineableMeshBase.

209  {
210  throw OomphLibError("refine_uniformly() not implemented yet",
213  }

References OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

◆ refine_uniformly() [2/2]

template<class ELEMENT >
void oomph::RefineableTetgenMesh< ELEMENT >::refine_uniformly ( DocInfo doc_info)
inlinevirtual

Refine mesh uniformly and doc process.

Implements oomph::RefineableMeshBase.

187  {
188  // hierher do it
189  throw OomphLibError("refine_uniformly() not implemented yet",
192  }

References OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

◆ setup_boundary_coordinates_generic()

template<class ELEMENT >
void oomph::RefineableTetgenMesh< ELEMENT >::setup_boundary_coordinates_generic ( const unsigned b,
const bool switch_normal,
std::ofstream &  outfile 
)
inline

Overload the standard setup of boundary coordinates to use area coordinates for triangles

239  {
240  std::cout << "Calling this local version\n";
241  }

◆ snap_nodes_onto_boundary() [1/2]

template<class ELEMENT >
void oomph::RefineableTetgenMesh< ELEMENT >::snap_nodes_onto_boundary ( RefineableTetgenMesh< ELEMENT > *&  new_mesh_pt,
const unsigned b 
)
inline

Generate a new PSLG representation of the outer boundary.

Snap the boundary nodes onto any curvilinear boundaries.

Snap the boundary nodes onto any curvilinear boundaries

442  {
443 
444  // Quick return
446  {
447  oomph_info << "Not snapping nodes on boundary " << b
448  << " because no boundary coordinate has been set up.\n";
449  return;
450  }
451 
452  //Firstly we set the boundary coordinates of the new nodes
453  //In case the mapping between the geometric object's intrinsic coordiante
454  //and the arc-length coordinate is nonlinear.
455  //This is only an approximation,
456  //but it will ensure that the nodes that were input to triangle will
457  //retain exactly the same boundary coordinates and
458  //then linear interpolation
459  //is used between those values for any newly created nodes.
460 
461 
462  // Create a face mesh adjacent to the fluid mesh's b-th boundary.
463  // The face mesh consists of FaceElements that may also be
464  // interpreted as GeomObjects
465  Mesh* face_mesh_pt = new Mesh;
466  this->template build_face_mesh
467  <ELEMENT,FaceElementAsGeomObject>(b, face_mesh_pt);
468 
469  // Loop over these new face elements and tell them the boundary number
470  // from the bulk fluid mesh -- this is required to they can
471  // get access to the boundary coordinates!
472  unsigned n_face_element = face_mesh_pt->nelement();
473  for(unsigned e=0;e<n_face_element;e++)
474  {
475  //Cast the element pointer to the correct thing!
477  dynamic_cast<FaceElementAsGeomObject<ELEMENT>*>
478  (face_mesh_pt->element_pt(e));
479 
480  // Set bulk boundary number
482  }
483 
484  //Now make the mesh as geometric object
485  MeshAsGeomObject* mesh_geom_obj_pt = new MeshAsGeomObject(face_mesh_pt);
486 
487  //Now assign the new nodes positions based on the old meshes
488  //potentially curvilinear boundary (its geom object incarnation)
489  Vector<double> new_x(3);
490  Vector<double> b_coord(2);
491  unsigned n_new_boundary_node = new_mesh_pt->nboundary_node(b);
492  for(unsigned n=0;n<n_new_boundary_node;n++)
493  {
494  //Get the boundary coordinate of all new nodes
495  Node* const nod_pt = new_mesh_pt->boundary_node_pt(b,n);
496  nod_pt->get_coordinates_on_boundary(b,b_coord);
497  //Let's find boundary coordinates of the new node
498  mesh_geom_obj_pt->position(b_coord,new_x);
499  //Now snap to the boundary
500  for(unsigned i=0;i<3;i++)
501  {
502  nod_pt->x(i) = new_x[i];
503  }
504  }
505 
506  //Delete the allocated memory for the geometric object and face mesh
507  delete mesh_geom_obj_pt;
508  face_mesh_pt->flush_element_and_node_storage();
509  delete face_mesh_pt;
510 
511  //Loop over the elements adjacent to the boundary
512  unsigned n_element = new_mesh_pt->nboundary_element(b);
513  if(n_element > 0)
514  {
515  //Make a dummy simplex element
516  TElement<3,2> dummy_four_node_element;
517  //Make a dummy quadratic element
518  TElement<3,3> dummy_ten_node_element;
519  Vector<double> s(3);
520  Vector<double> x_new(3);
521  for(unsigned n=0;n<4;n++) {dummy_four_node_element.construct_node(n);}
522  for(unsigned n=0;n<10;n++) {dummy_ten_node_element.construct_node(n);}
523  for(unsigned e=0;e<n_element;e++)
524  {
525  //Cache the element pointer
526  ELEMENT* elem_pt = dynamic_cast<ELEMENT*>(
527  new_mesh_pt->boundary_element_pt(b,e));
528 
529  //Find the number of nodes
530  const unsigned n_node = elem_pt->nnode();
531  //Only do something if not simplex element
532  if(n_node > 4)
533  {
534  //Copy the nodes into the dummy
535  for(unsigned n=0;n<4;n++)
536  {
537  for(unsigned i=0;i<3;i++)
538  {
539  dummy_four_node_element.node_pt(n)->x(i) =
540  elem_pt->node_pt(n)->x(i);
541  }
542  }
543 
544  //Now sort out the mid-side nodes
545  for(unsigned n=4;n<10;n++)
546  {
547  //If it's not on a boundary then reset to be interpolated
548  //from the simplex
549  if(!elem_pt->node_pt(n)->is_on_boundary())
550  {
551  elem_pt->local_coordinate_of_node(n,s);
552  dummy_four_node_element.interpolated_x(s,x_new);
553  for(unsigned i=0;i<3;i++) {elem_pt->node_pt(n)->x(i) = x_new[i];}
554  }
555  }
556  }
557 
558  //If we have more than 10 nodes interpolate from the quadratic shape
559  if(n_node > 10)
560  {
561  //Copy the nodes into the dummy
562  for(unsigned n=0;n<10;n++)
563  {
564  for(unsigned i=0;i<3;i++)
565  {
566  dummy_ten_node_element.node_pt(n)->x(i) =
567  elem_pt->node_pt(n)->x(i);
568  }
569  }
570 
571  //Now sort out the mid-face and central nodes
572  for(unsigned n=10;n<n_node;n++)
573  {
574  //If it's not on a boundary then reset to be interpolated
575  //from the simplex
576  if(!elem_pt->node_pt(n)->is_on_boundary())
577  {
578  elem_pt->local_coordinate_of_node(n,s);
579  dummy_ten_node_element.interpolated_x(s,x_new);
580  for(unsigned i=0;i<3;i++) {elem_pt->node_pt(n)->x(i) = x_new[i];}
581  }
582  }
583  }
584  }
585  } //End of fix up of elements
586  }
Definition: face_element_as_geometric_object.h:62
void set_boundary_number_in_bulk_mesh(const unsigned &b)
Set function for the boundary number in bulk mesh.
Definition: elements.h:4482
Definition: mesh_as_geometric_object.h:93
void position(const Vector< double > &zeta, Vector< double > &r) const
Definition: mesh_as_geometric_object.h:397
Definition: mesh.h:67
std::vector< bool > Boundary_coordinate_exists
Definition: mesh.h:190
void build_face_mesh(const unsigned &b, Mesh *const &face_mesh_pt)
Definition: mesh.h:653
Mesh()
Default constructor.
Definition: mesh.h:236
Definition: nodes.h:906
virtual void get_coordinates_on_boundary(const unsigned &b, const unsigned &k, Vector< double > &boundary_zeta)
Definition: nodes.cc:2379
Definition: Telements.h:1208
RealScalar s
Definition: level1_cplx_impl.h:130

References b, oomph::Mesh::boundary_element_pt(), oomph::Mesh::boundary_node_pt(), e(), oomph::Mesh::element_pt(), oomph::Mesh::flush_element_and_node_storage(), oomph::Node::get_coordinates_on_boundary(), i, n, oomph::Mesh::nboundary_element(), oomph::Mesh::nboundary_node(), oomph::Mesh::nelement(), oomph::oomph_info, oomph::MeshAsGeomObject::position(), s, oomph::FaceElement::set_boundary_number_in_bulk_mesh(), and oomph::Node::x().

◆ snap_nodes_onto_boundary() [2/2]

template<class ELEMENT >
void oomph::RefineableTetgenMesh< ELEMENT >::snap_nodes_onto_boundary ( RefineableTetgenMesh< ELEMENT > *&  new_mesh_pt,
const unsigned b 
)
protected

Snap the boundary nodes onto any curvilinear boundaries.

◆ surface_remesh_for_inner_hole_boundaries() [1/2]

template<class ELEMENT >
void oomph::RefineableTetgenMesh< ELEMENT >::surface_remesh_for_inner_hole_boundaries
inlinevirtual

Generate a new faceted representation of the inner hole boundaries

413  {
414  //Loop over the number of internal boundarys
415  unsigned n_hole = this->Internal_surface_pt.size();
416  for(unsigned ihole=0;ihole<n_hole;ihole++)
417  {
418  //Cache the pointer to the representation
419  TetgenMeshClosedFacetedSurface* const faceted_surface_pt =
420  dynamic_cast<TetgenMeshClosedFacetedSurface*>(this->Internal_surface_pt[ihole]);
421 
422  //Now can the surface update its own representation goes in here
423 
424  //If not we have to generate it from the new mesh
425  {
426  //Update the faceted surface associated with the ihole-th hole
427  this->update_faceted_surface_using_face_mesh(faceted_surface_pt);
428 
429  //Then sort out the hole coordinates
430  }
431  }
432  }
void update_faceted_surface_using_face_mesh(TetMeshFacetedClosedSurface *faceted_surface_pt)
Definition: uns_adapt_3d_fs.cc:250

◆ surface_remesh_for_inner_hole_boundaries() [2/2]

template<class ELEMENT >
void oomph::RefineableTetgenMesh< ELEMENT >::surface_remesh_for_inner_hole_boundaries ( )
protected

◆ unrefine_uniformly() [1/2]

template<class ELEMENT >
unsigned oomph::RefineableTetgenMesh< ELEMENT >::unrefine_uniformly ( )
inlinevirtual

Unrefine mesh uniformly: Return 0 for success, 1 for failure (if unrefinement has reached the coarsest permitted level)

Implements oomph::RefineableMeshBase.

220  {
221  throw OomphLibError("unrefine_uniformly() not implemented yet",
224  // dummy return
225  return 0;
226  }

References OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

◆ unrefine_uniformly() [2/2]

template<class ELEMENT >
unsigned oomph::RefineableTetgenMesh< ELEMENT >::unrefine_uniformly ( )
inlinevirtual

Unrefine mesh uniformly: Return 0 for success, 1 for failure (if unrefinement has reached the coarsest permitted level)

Implements oomph::RefineableMeshBase.

198  {
199  // hierher do it
200  throw OomphLibError("unrefine_uniformly() not implemented yet",
203  // dummy return
204  return 0;
205  }

References OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

◆ update_faceted_surface_using_face_mesh() [1/2]

template<class ELEMENT >
void oomph::RefineableTetgenMesh< ELEMENT >::update_faceted_surface_using_face_mesh ( TetMeshFacetedClosedSurface faceted_surface_pt)
inline

Helper function that updates the input faceted surface by using the flattened elements from FaceMesh(es) that are constructed for the boundaries associated with the segments of the polygon.

List of vertex nodes

252  {
253  //The easiest thing to do is simply to update the
254  //positions of the key control nodes, leaving the connectivity alone,
255  //but that doesn't allow for any surface remeshing
256 
258  std::list<Node*> new_vertex_nodes;
259  //List of facets and boundary ids
260  std::list<std::pair<Vector<unsigned>, unsigned> > new_facet_list;
261 
262  //Loop over the number of old facets
263  unsigned n_old_facet = faceted_surface_pt->nfacet();
264  for(unsigned f=0;f<n_old_facet;f++)
265  {
266  //Get the boundary id of the facet. Need to subtract one,
267  //which is confusing now I think about it.
268  //ALH: Should fix this.
269  unsigned bound = faceted_surface_pt->one_based_facet_boundary_id(f) -1;
270 
271  // Create a face mesh adjacent to the fluid mesh's bound-th boundary.
272  // The face mesh consists of FaceElements that may also be
273  // interpreted as GeomObjects
274  Mesh* face_mesh_pt = new Mesh;
275  this->template build_face_mesh
276  <ELEMENT,FaceElementAsGeomObject>(bound, face_mesh_pt);
277 
278  // Loop over these new face elements and tell them the boundary number
279  // from the bulk fluid mesh -- this is required to they can
280  // get access to the boundary coordinates!
281  unsigned n_face_element = face_mesh_pt->nelement();
282  for(unsigned e=0;e<n_face_element;e++)
283  {
284  //Cast the element pointer to the correct thing!
286  dynamic_cast<FaceElementAsGeomObject<ELEMENT>*>
287  (face_mesh_pt->element_pt(e));
288 
289  // Set bulk boundary number
290  el_pt->set_boundary_number_in_bulk_mesh(bound);
291  }
292 
293  //In order to set up the new faceted representation
294  //Need to know the positions of the corner nodes
295  //and the connectivity
296 
297  //Storage for the connectivity information
298  Vector<unsigned> new_local_facet(3);
299 
300  //Now we have the face mesh loop over the face elements and
301  //print out the end points
302  for(unsigned e=0;e<n_face_element;++e)
303  {
304  //Cache pointer to the element
305  FiniteElement const *elem_pt = face_mesh_pt->finite_element_pt(e);
306 
307  //Just use the three primary (corner) nodes to define the facet
308  unsigned n_vertex_node = 3;
309  for(unsigned n=0;n<n_vertex_node;n++)
310  {
311  //Cache the pointer to the node
312  Node* const nod_pt = elem_pt->node_pt(n);
313  //If the vertex node is in the list return the number
314  unsigned counter=0; bool found_it=false;
315  for(std::list<Node*>::iterator it = new_vertex_nodes.begin();
316  it!=new_vertex_nodes.end();++it,++counter)
317  {
318  //If we have found the node then store it
319  if(*it==nod_pt)
320  {
321  new_local_facet[n] = counter;
322  found_it=true;
323  break;
324  }
325  }
326 
327  //If we haven't found it
328  //then add the node to the list and fill in the counter
329  if(!found_it)
330  {
331  new_vertex_nodes.push_back(nod_pt);
332  //We know where it is
333  new_local_facet[n] = counter;
334  }
335  }
336 
337  //Add the new facet connectivity to the list
338  new_facet_list.push_back(std::make_pair(new_local_facet,bound+1));
339  }
340  } //End of loop over old facets
341 
342 
343  //Probably want the surface mesh in a better data structure so
344  //that we can perform refinement or coarsening on it
345  //i.e. want neighbours, edge flips all that fun stuff
346  //That will go here!
347 
348  //Now sort out the facet nodes
349  unsigned n_facet_vertex = new_vertex_nodes.size();
350  Vector<Vector<double> > facet_point(n_facet_vertex);
351  unsigned count=0;
352  for(std::list<Node*>::iterator it=new_vertex_nodes.begin();
353  it!=new_vertex_nodes.end();++it)
354  {
355  facet_point[count].resize(3);
356  for(unsigned i=0;i<3;i++)
357  {
358  facet_point[count][i] = (*it)->x(i);
359  }
360  ++count;
361  }
362 
363  //And also the facets
364  unsigned n_facet = new_facet_list.size();
365  Vector<Vector<unsigned> > new_facet(n_facet);
366  Vector<unsigned> new_facet_boundary_id(n_facet);
367  count=0;
368  for(std::list<std::pair<Vector<unsigned>, unsigned> >::iterator
369  it=new_facet_list.begin();it!=new_facet_list.end();++it)
370  {
371  new_facet[count] = (*it).first;
372  new_facet_boundary_id[count] = (*it).second;
373  ++count;
374  }
375 
376  for(unsigned f=0;f<n_facet;f++)
377  {
378  for(unsigned i=0;i<3;i++)
379  {
380  oomph_info << new_facet[f][i] << " " ;
381  }
382  oomph_info << " : ";
383  oomph_info << new_facet_boundary_id[f] << "\n";
384  }
385 
386  //Now just create the new boundary
387  delete faceted_surface_pt;
388  faceted_surface_pt = new TetMeshFacetedClosedSurface(
389  facet_point,new_facet,new_facet_boundary_id);
390 
391 
392  //Take average to get a new hole position (Won't always work)
393  Vector<double> inner_point(3,0.0);
394  for(unsigned n=0;n<n_facet_vertex;n++)
395  {
396  for(unsigned i=0;i<3;i++)
397  {
398  inner_point[i] += facet_point[n][i];
399  }
400  }
401 
402  for(unsigned i=0;i<3;i++) {inner_point[i] /= n_facet_vertex;}
403 
404  //Now set the hole if required
405  faceted_surface_pt->set_hole(inner_point);
406 
407  }
Definition: tet_mesh.h:538
unsigned nfacet() const
Number of facets.
Definition: tet_mesh.h:325
unsigned one_based_facet_boundary_id(const unsigned &j) const
One-based boundary id of j-th facet.
Definition: tet_mesh.h:331
static int f(const TensorMap< Tensor< int, 3 > > &tensor)
Definition: cxx11_tensor_map.cpp:237

References e(), oomph::Mesh::element_pt(), f(), oomph::Mesh::finite_element_pt(), i, n, oomph::Mesh::nelement(), oomph::TetMeshFacetedSurface::nfacet(), oomph::FiniteElement::node_pt(), oomph::TetMeshFacetedSurface::one_based_facet_boundary_id(), oomph::oomph_info, and oomph::FaceElement::set_boundary_number_in_bulk_mesh().

◆ update_faceted_surface_using_face_mesh() [2/2]

template<class ELEMENT >
void oomph::RefineableTetgenMesh< ELEMENT >::update_faceted_surface_using_face_mesh ( TetMeshFacetedSurface *&  faceted_surface_pt)
protected

Helper function that updates the input faceted surface by using the flattened elements from FaceMesh(es) that are constructed for the boundaries associated with the segments of the polygon.

List of vertex nodes

51  {
52  // The easiest thing to do is simply to update the
53  // positions of the key control nodes, leaving the connectivity alone,
54  // but that doesn't allow for any surface remeshing
55 
57  std::list<Node*> new_vertex_nodes;
58  // List of facets and boundary ids
59  std::list<std::pair<Vector<unsigned>, unsigned>> new_facet_list;
60 
61  // Loop over the number of old facets
62  unsigned n_old_facet = faceted_surface_pt->nfacet();
63  for (unsigned f = 0; f < n_old_facet; f++)
64  {
65  // Get the boundary id of the facet. Need to subtract one,
66  // which is confusing now I think about it.
67  // ALH: Should fix this.
68  unsigned bound = faceted_surface_pt->one_based_facet_boundary_id(f) - 1;
69 
70  // Create a face mesh adjacent to the fluid mesh's bound-th boundary.
71  // The face mesh consists of FaceElements that may also be
72  // interpreted as GeomObjects
73  Mesh* face_mesh_pt = new Mesh;
74  this->template build_face_mesh<ELEMENT, FaceElementAsGeomObject>(
75  bound, face_mesh_pt);
76 
77  // Loop over these new face elements and tell them the boundary number
78  // from the bulk fluid mesh -- this is required to they can
79  // get access to the boundary coordinates!
80  unsigned n_face_element = face_mesh_pt->nelement();
81  for (unsigned e = 0; e < n_face_element; e++)
82  {
83  // Cast the element pointer to the correct thing!
84  FaceElementAsGeomObject<ELEMENT>* el_pt =
85  dynamic_cast<FaceElementAsGeomObject<ELEMENT>*>(
86  face_mesh_pt->element_pt(e));
87 
88  // Set bulk boundary number
89  el_pt->set_boundary_number_in_bulk_mesh(bound);
90  }
91 
92  // In order to set up the new faceted representation
93  // Need to know the positions of the corner nodes
94  // and the connectivity
95 
96  // Storage for the connectivity information
97  Vector<unsigned> new_local_facet(3);
98 
99  // Now we have the face mesh loop over the face elements and
100  // print out the end points
101  for (unsigned e = 0; e < n_face_element; ++e)
102  {
103  // Cache pointer to the element
104  FiniteElement const* elem_pt = face_mesh_pt->finite_element_pt(e);
105 
106  // Just use the three primary (corner) nodes to define the facet
107  unsigned n_vertex_node = 3;
108  for (unsigned n = 0; n < n_vertex_node; n++)
109  {
110  // Cache the pointer to the node
111  Node* const nod_pt = elem_pt->node_pt(n);
112  // If the vertex node is in the list return the number
113  unsigned counter = 0;
114  bool found_it = false;
115  for (std::list<Node*>::iterator it = new_vertex_nodes.begin();
116  it != new_vertex_nodes.end();
117  ++it, ++counter)
118  {
119  // If we have found the node then store it
120  if (*it == nod_pt)
121  {
122  new_local_facet[n] = counter;
123  found_it = true;
124  break;
125  }
126  }
127 
128  // If we haven't found it
129  // then add the node to the list and fill in the counter
130  if (!found_it)
131  {
132  new_vertex_nodes.push_back(nod_pt);
133  // We know where it is
134  new_local_facet[n] = counter;
135  }
136  }
137 
138  // Add the new facet connectivity to the list
139  new_facet_list.push_back(std::make_pair(new_local_facet, bound + 1));
140  }
141  } // End of loop over old facets
142 
143 
144  // Probably want the surface mesh in a better data structure so
145  // that we can perform refinement or coarsening on it
146  // i.e. want neighbours, edge flips all that fun stuff
147  // That will go here!
148 
149  // Now we need to put the information into the appropriate data structures
150  // for the Surface
151 
152  // Now sort out the facet nodes
153  unsigned n_facet_vertex = new_vertex_nodes.size();
154  // Vector<Vector<double> > facet_point(n_facet_vertex);
155  Vector<Node*> facet_nodes_pt(n_facet_vertex);
156  unsigned count = 0;
157  for (std::list<Node*>::iterator it = new_vertex_nodes.begin();
158  it != new_vertex_nodes.end();
159  ++it)
160  {
161  facet_nodes_pt[count] = *it;
162  // facet_point[count].resize(3);
163  // for(unsigned i=0;i<3;i++)
164  // {
165  // facet_point[count][i] = (*it)->x(i);
166  // }
167  ++count;
168  }
169 
170  // And also the facets
171  unsigned n_facet = new_facet_list.size();
172  Vector<Vector<unsigned>> new_facet(n_facet);
173  Vector<unsigned> new_facet_boundary_id(n_facet);
174  count = 0;
175  for (std::list<std::pair<Vector<unsigned>, unsigned>>::iterator it =
176  new_facet_list.begin();
177  it != new_facet_list.end();
178  ++it)
179  {
180  new_facet[count] = (*it).first;
181  new_facet_boundary_id[count] = (*it).second;
182  ++count;
183  }
184 
185  for (unsigned f = 0; f < n_facet; f++)
186  {
187  for (unsigned i = 0; i < 3; i++)
188  {
189  oomph_info << new_facet[f][i] << " ";
190  }
191  oomph_info << " : ";
192  oomph_info << new_facet_boundary_id[f] << "\n";
193  }
194 
195  // Now just create the new boundary
196  delete faceted_surface_pt;
197  faceted_surface_pt = new TetMeshFacetedClosedSurfaceForRemesh(
198  facet_nodes_pt, new_facet, new_facet_boundary_id);
199 
200  // Also need to setup the reverse look-up scheme again
201  this->setup_reverse_lookup_schemes_for_faceted_surface(faceted_surface_pt);
202 
203  // Take average to get a new hole position (Won't always work)
204  Vector<double> inner_point(3, 0.0);
205  for (unsigned n = 0; n < n_facet_vertex; n++)
206  {
207  for (unsigned i = 0; i < 3; i++)
208  {
209  inner_point[i] += facet_nodes_pt[n]->x(i);
210  }
211  }
212 
213  for (unsigned i = 0; i < 3; i++)
214  {
215  inner_point[i] /= n_facet_vertex;
216  }
217 
218  // Now set the hole if required
219  dynamic_cast<TetMeshFacetedClosedSurface*>(faceted_surface_pt)
220  ->set_hole_for_tetgen(inner_point);
221  }

References e(), oomph::Mesh::element_pt(), f(), oomph::Mesh::finite_element_pt(), i, n, oomph::Mesh::nelement(), oomph::TetMeshFacetedSurface::nfacet(), oomph::FiniteElement::node_pt(), oomph::TetMeshFacetedSurface::one_based_facet_boundary_id(), oomph::oomph_info, and oomph::FaceElement::set_boundary_number_in_bulk_mesh().

Member Data Documentation

◆ Corner_elements_must_be_split

template<class ELEMENT >
bool oomph::RefineableTetgenMesh< ELEMENT >::Corner_elements_must_be_split
protected

Corner elements which have all of their nodes on the outer boundary are to be split into elements which have some non-boundary nodes

◆ Max_element_size

template<class ELEMENT >
double oomph::RefineableTetgenMesh< ELEMENT >::Max_element_size

◆ Max_permitted_edge_ratio

template<class ELEMENT >
double oomph::RefineableTetgenMesh< ELEMENT >::Max_permitted_edge_ratio

Max edge ratio before remesh gets triggered.

Referenced by oomph::RefineableTetgenMesh< ELEMENT >::initialise_adaptation_data().

◆ Min_element_size

template<class ELEMENT >
double oomph::RefineableTetgenMesh< ELEMENT >::Min_element_size

◆ Problem_pt

template<class ELEMENT >
Problem* oomph::RefineableTetgenMesh< ELEMENT >::Problem_pt

Problem pointer (needed for multi-domain machinery during adaptation

◆ Projection_is_disabled


The documentation for this class was generated from the following files: