33 #ifndef OOMPH_REFINEABLE_ELEMENTS_HEADER 34 #define OOMPH_REFINEABLE_ELEMENTS_HEADER 38 #include <oomph-lib-config.h> 128 static void check_value_id(
const int &n_continuously_interpolated_values,
129 const int &value_id);
198 To_be_refined(false), Refinement_is_enabled(true),
199 Sons_to_be_unrefined(false), Number(-1),
243 template<
class ELEMENT>
247 int son_refine_level=Refine_level+1;
252 son_pt.resize(n_sons);
255 for(
unsigned i=0;
i<n_sons;
i++)
257 son_pt[
i]=
new ELEMENT;
259 son_pt[
i]->set_refinement_level(son_refine_level);
270 #ifdef RANGE_CHECKING 273 std::ostringstream error_message;
274 error_message <<
"Range Error: Value " << i
275 <<
" is not in the range (0," 278 OOMPH_CURRENT_FUNCTION,
279 OOMPH_EXCEPTION_LOCATION);
293 bool &was_already_built, std::ofstream &new_nodes_file)=0;
297 {Refine_level=refine_level;}
331 if(father_pt==0) {
return;}
334 unsigned n_node = this->
nnode();
335 for(
unsigned n=0;n<n_node;n++)
399 const unsigned &n1d,
const unsigned &
i,
const int &value_id)
426 const int &value_id)
const 444 std::set<std::pair<Data*,unsigned> > &paired_field_data);
466 if(Tree_pt==0) {
return this;}
475 if(Tree_pt==0) {
return 0;}
481 if(father_pt==0) {
return 0;}
498 if (level==refinement_level)
500 father_at_reflevel_pt=father_el_pt;
506 father_at_reflevel_pt);
513 virtual void initial_setup(
Tree*
const &adopted_father_pt=0,
const unsigned &initial_p_order=0) {}
541 dresidual_dnodal_coordinates);
549 return Shape_controlling_node_lookup.size();
595 To_be_p_refined(false), P_refinement_is_enabled(true),
596 To_be_p_unrefined(false) {}
635 virtual unsigned initial_p_order()
const=0;
656 virtual void p_refine(
const int &inc,
657 Mesh*
const &mesh_pt,
664 unsigned n_node = this->
nnode();
665 for(
unsigned n=0; n<n_node; n++)
667 if(this->
node_pt(n)==0) {
return false;}
702 bool &was_already_built, std::ofstream &new_nodes_file)
704 std::ostringstream error_message;
705 error_message <<
"This function is broken as it's only needed/used \n" 706 <<
"during \"proper\" refinement\n";
708 OOMPH_CURRENT_FUNCTION,
709 OOMPH_EXCEPTION_LOCATION);
718 std::ostringstream error_message;
719 error_message <<
"This function is broken as it's only needed/used \n" 720 <<
"during \"proper\" refinement\n";
723 OOMPH_CURRENT_FUNCTION,
724 OOMPH_EXCEPTION_LOCATION);
732 std::ostringstream error_message;
733 error_message <<
"This function is broken as it's only needed/used \n" 734 <<
"during \"proper\" refinement\n";
737 OOMPH_CURRENT_FUNCTION,
738 OOMPH_EXCEPTION_LOCATION);
745 std::ostringstream error_message;
746 error_message <<
"This function is broken as it's only needed/used \n" 747 <<
"during \"proper\" refinement\n";
750 OOMPH_CURRENT_FUNCTION,
751 OOMPH_EXCEPTION_LOCATION);
757 std::ostringstream error_message;
758 error_message <<
"This function is broken as it's only needed/used \n" 759 <<
"during \"proper\" refinement\n";
762 OOMPH_CURRENT_FUNCTION,
763 OOMPH_EXCEPTION_LOCATION);
800 void assign_solid_hanging_local_eqn_numbers(
const bool &store_local_dof_pt);
821 void assemble_local_to_lagrangian_jacobian(
828 void assemble_local_to_lagrangian_jacobian2(
837 double local_to_lagrangian_mapping_diagonal(
845 Use_undeformed_macro_element_for_new_lagrangian_coords(false){}
855 assign_solid_hanging_local_eqn_numbers(store_local_dof_pt);
878 void fill_in_jacobian_from_solid_position_by_fd(
Vector<double> & residuals,
893 {
return Use_undeformed_macro_element_for_new_lagrangian_coords;}
899 {Use_undeformed_macro_element_for_new_lagrangian_coords=
true;}
905 {Use_undeformed_macro_element_for_new_lagrangian_coords=
false;}
912 {
return Local_position_hang_eqn[
node_pt];}
920 Use_undeformed_macro_element_for_new_lagrangian_coords=
922 ->is_undeformed_macro_element_used_for_new_lagrangian_coords();
int local_hang_eqn(Node *const &node_pt, const unsigned &i)
Access function that returns the local equation number for the hanging node variables (values stored ...
A Generalised Element class.
virtual unsigned ncont_interpolated_values() const =0
Number of continuously interpolated values. Note: We assume that they are located at the beginning of...
virtual void identify_geometric_data(std::set< Data *> &geometric_data_pt)
The purpose of this function is to identify all Data objects that affect the elements' geometry...
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
void identify_field_data_for_interactions(std::set< std::pair< Data *, unsigned > > &paired_field_data)
The purpose of this function is to identify all possible.
void select_sons_for_unrefinement()
Unrefinement will be performed by merging the four sons of this element.
bool to_be_p_unrefined()
Has the element been selected for p-unrefinement?
virtual Node * interpolating_node_pt(const unsigned &n, const int &value_id)
In mixed elements, different sets of nodes are used to interpolate different unknowns. This function returns the n-th node that interpolates the value_id-th unknown. Default implementation is that all variables use the positional nodes, i.e. isoparametric elements. Note that any overloaded versions of this function MUST provide a set of nodes for the position, which always has the value_id -1.
void assign_hanging_local_eqn_numbers(const bool &store_local_dof_pt)
Assign the local equation numbers for hanging node variables.
void deselect_for_p_unrefinement()
Deselect the element for p-unrefinement.
void select_for_p_refinement()
Select the element for p-refinement.
virtual RefineableElement * father_element_pt() const
Return a pointer to the father element.
PRefineableElement()
Constructor, calls the RefineableElement constructor.
void deselect_for_refinement()
Deselect the element for refinement.
virtual void initial_setup(Tree *const &adopted_father_pt=0, const unsigned &initial_p_order=0)
Initial setup of the element: e.g. set the appropriate internal p-order. If an adopted father is spec...
virtual Node * get_node_at_local_coordinate(const Vector< double > &s) const
If there is a node at this local coordinate, return the pointer to the node.
Data * geom_data_pt(const unsigned &j)
A standard FiniteElement is fixed, so there are no geometric data when viewed in its GeomObject incar...
Tree * Tree_pt
A pointer to a general tree object.
unsigned & p_order()
Access function to P_order.
static double Max_integrity_tolerance
Max. allowed discrepancy in element integrity check.
void get_dresidual_dnodal_coordinates(RankThreeTensor< double > &dresidual_dnodal_coordinates)
Compute derivatives of elemental residual vector with respect to nodal coordinates. Default implementation by FD can be overwritten for specific elements. dresidual_dnodal_coordinates(l,i,j) = d res(l) / dX_{ij} This version is overloaded from the version in FiniteElement and takes hanging nodes into account – j in the above loop loops over all the nodes that actively control the shape of the element (i.e. they are non-hanging or master nodes of hanging nodes in this element).
bool P_refinement_is_enabled
Flag to indicate suppression of any refinement.
static void check_value_id(const int &n_continuously_interpolated_values, const int &value_id)
Static helper function that is used to check that the value_id is in range.
void operator=(const RefineableElement &)
Broken assignment operator.
virtual void get_interpolated_values(const Vector< double > &s, Vector< double > &values)
Get all continously interpolated function values in this element as a Vector. Note: Vector sets is ow...
bool to_be_p_refined()
Has the element been selected for refinement?
void check_integrity(double &max_error)
Broken function – this shouldn't really be needed.
bool Use_undeformed_macro_element_for_new_lagrangian_coords
Flag deciding if the Lagrangian coordinates of newly-created interior SolidNodes are to be determined...
void assemble_local_to_eulerian_jacobian2(const DShape &d2psids, DenseMatrix< double > &jacobian2) const
Assemble the the "jacobian" matrix of second derivatives of the mapping from local to Eulerian coordi...
A general Finite Element class.
unsigned ngeom_data() const
A standard FiniteElement is fixed, so there are no geometric data when viewed in its GeomObject incar...
virtual unsigned required_nsons() const
Set the number of sons that can be constructed by the element The default is none.
virtual ~RefineableSolidElement()
Virtual Destructor, delete any allocated storage.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
virtual Node * get_interpolating_node_at_local_coordinate(const Vector< double > &s, const int &value_id)
Return a pointer to the node that interpolates the value-id-th unknown at local coordinate s...
void assemble_local_to_eulerian_jacobian(const DShape &dpsids, DenseMatrix< double > &jacobian) const
Assemble the jacobian matrix for the mapping from local.
void disable_p_refinement()
Suppress of any refinement for this element.
virtual RefineableElement * root_element_pt()
Pointer to the root element in refinement hierarchy (must be implemented in specific elements that do...
virtual void interpolating_basis(const Vector< double > &s, Shape &psi, const int &value_id) const
Return the basis functions that are used to interpolate the value_id-th unknown. By default assume is...
virtual ~PRefineableElement()
Destructor, empty.
virtual void further_build()
Further build: e.g. deal with interpolation of internal values.
long number() const
Element number (for debugging/plotting)
std::map< Node *, int > * Local_hang_eqn
Storage for local equation numbers of hanging node variables (values stored at master nodes)...
unsigned p_order() const
Access function to P_order (const version)
unsigned Refine_level
Refinement level.
virtual void assign_nodal_local_eqn_numbers(const bool &store_local_dof_pt)
Assign the local equation numbers for Data stored at the nodes Virtual so that it can be overloaded b...
void operator=(const PRefineableElement &)
Broken assignment operator.
virtual void unbuild()
Unbuild the element, i.e. mark the nodes that were created during its creation for possible deletion...
virtual void setup_hanging_nodes(Vector< std::ofstream *> &output_stream)
Mark up any hanging nodes that arise as a result of non-uniform refinement. Any hanging nodes will be...
bool To_be_refined
Flag for refinement.
unsigned nshape_controlling_nodes()
Number of shape-controlling nodes = the number of non-hanging nodes plus the number of master nodes a...
virtual void further_setup_hanging_nodes()
Perform additional hanging node procedures for variables that are not interpolated by all nodes (e...
virtual unsigned ninterpolating_node(const int &value_id)
Return the number of nodes that are used to interpolate the value_id-th unknown. Default is to assume...
virtual void assign_solid_local_eqn_numbers(const bool &store_local_dof)
Assigns local equation numbers for the generic solid local equation numbering schemes. If the boolean flag is true the the degrees of freedom are stored in Dof_pt.
virtual void pre_build(Mesh *&mesh_pt, Vector< Node *> &new_node_pt)
Pre-build the element.
virtual void fill_in_jacobian_from_nodal_by_fd(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Calculate the contributions to the jacobian from the nodal degrees of freedom using finite difference...
long Number
Global element number – for plotting/validation purposes.
void disable_refinement()
Suppress of any refinement for this element.
Tree * tree_pt()
Access function: Pointer to quadtree representation of this element.
bool To_be_p_unrefined
Flag for unrefinement.
virtual void further_build()
Further build: Pass the father's Use_undeformed_macro_element_for_new_lagrangian_coords flag down...
void deselect_for_p_refinement()
Deselect the element for p-refinement.
void set_tree_pt(Tree *my_tree_pt)
Set pointer to quadtree representation of this element.
bool Sons_to_be_unrefined
Flag for unrefinement.
RefineableElement(const RefineableElement &)
Broken copy constructor.
bool To_be_p_refined
Flag for p-refinement.
A class that represents a collection of data; each Data object may contain many different individual ...
void deselect_sons_for_unrefinement()
No unrefinement will be performed by merging the four sons of this element.
void build(Mesh *&mesh_pt, Vector< Node *> &new_node_pt, bool &was_already_built, std::ofstream &new_nodes_file)
Broken build function – shouldn't really be needed.
bool p_refinement_is_enabled()
Flag to indicate suppression of any refinement.
void assign_solid_local_eqn_numbers(const bool &store_local_dof_pt)
Overload the local equation numbers for Data stored as part of solid nodes to include hanging node da...
void get_father_at_refinement_level(unsigned &refinement_level, RefineableElement *&father_at_reflevel_pt)
Return a pointer to the "father" element at the specified refinement level.
static double & max_integrity_tolerance()
Max. allowed discrepancy in element integrity check.
unsigned refinement_level() const
Return the Refinement level.
bool refinement_is_enabled()
Flag to indicate suppression of any refinement.
RefineableElement()
Constructor, calls the FiniteElement constructor and initialises the member data. ...
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
void disable_use_of_undeformed_macro_element_for_new_lagrangian_coords()
Unset the flag deciding if the Lagrangian coordinates of newly-created interior SolidNodes are to be ...
bool is_undeformed_macro_element_used_for_new_lagrangian_coords() const
Return the flag deciding if the Lagrangian coordinates of newly-created interior SolidNodes are to be...
void enable_use_of_undeformed_macro_element_for_new_lagrangian_coords()
Set the flag deciding if the Lagrangian coordinates of newly-created interior SolidNodes are to be de...
void set_refinement_level(const int &refine_level)
Set the refinement level.
std::map< Node *, unsigned > Shape_controlling_node_lookup
Lookup scheme for unique number associated with any of the nodes that actively control the shape of t...
virtual void rebuild_from_sons(Mesh *&mesh_pt)=0
Rebuild the element, e.g. set internal values in line with those of the sons that have now merged...
void get_interpolated_values(const Vector< double > &s, Vector< double > &values)
Broken function – this shouldn't really be needed.
void set_number(const long &mynumber)
Set element number (for debugging/plotting)
void enable_p_refinement()
Emnable refinement for this element.
void select_for_refinement()
Select the element for refinement.
virtual void build(Mesh *&mesh_pt, Vector< Node *> &new_node_pt, bool &was_already_built, std::ofstream &new_nodes_file)=0
Interface to function that builds the element: i.e. construct the nodes, assign their positions...
virtual bool nodes_built()
Return true if all the nodes have been built, false if not.
bool Refinement_is_enabled
Flag to indicate suppression of any refinement.
std::map< Node *, unsigned > shape_controlling_node_lookup()
Return lookup scheme for unique number associated with any of the nodes that actively control the sha...
bool to_be_refined()
Has the element been selected for refinement?
void assign_nodal_local_eqn_numbers(const bool &store_local_dof_pt)
Overload the function that assigns local equation numbers for the Data stored at the nodes so that ha...
virtual unsigned nnode_1d() const
Return the number of nodes along one edge of the element Default is to return zero — must be overloa...
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
virtual double local_one_d_fraction_of_interpolating_node(const unsigned &n1d, const unsigned &i, const int &value_id)
Return the local one dimensional fraction of the n1d-th node in the direction of the local coordinate...
virtual void check_integrity(double &max_error)=0
Check the integrity of the element: Continuity of positions values, etc. Essentially, check that the approximation of the functions is consistent when viewed from both sides of the element boundaries Must be overloaded for each different geometric element.
int get_node_number(Node *const &node_pt) const
Return the number of the node *node_pt if this node is in the element, else return -1;...
Tree * father_pt() const
Return pointer to father: NULL if it's a root node.
std::map< Node *, DenseMatrix< int > > Local_position_hang_eqn
Storage for local equation numbers of hanging node variables associated with nodal positions...
p-refineable version of RefineableElement
PRefineableElement(const PRefineableElement &)
Broken copy constructor.
void assemble_eulerian_base_vectors(const DShape &dpsids, DenseMatrix< double > &interpolated_G) const
Assemble the covariant Eulerian base vectors, assuming that the derivatives of the shape functions wi...
virtual void deactivate_element()
Final operations that must be performed when the element is no longer active in the mesh...
bool nodes_built()
Return true if all the nodes have been built, false if not.
bool sons_to_be_unrefined()
Has the element been selected for unrefinement?
unsigned P_order
The polynomial expansion order of the elemental basis functions.
RefineableElement * object_pt() const
Return the pointer to the object (RefineableElement) represented by the tree.
virtual ~RefineableElement()
Destructor, delete the allocated storage for the hanging equations.
void split(Vector< ELEMENT *> &son_pt) const
Split the element into the number of sons to be constructed and return a vector of pointers to the so...
DenseMatrix< int > & local_position_hang_eqn(Node *const &node_pt)
Access the local equation number of of hanging node variables associated with nodal positions...
void set_non_obsolete()
Mark node as non-obsolete.
virtual double local_one_d_fraction_of_node(const unsigned &n1d, const unsigned &i)
Get the local fraction of any node in the n-th position in a one dimensional expansion along the i-th...
unsigned nnode() const
Return the number of nodes.
virtual void get_interpolated_values(const unsigned &t, const Vector< double > &s, Vector< double > &values)
Broken function – this shouldn't really be needed.
SolidFiniteElement class.
virtual unsigned ninterpolating_node_1d(const int &value_id)
Return the number of nodes in a one_d direction that are used to interpolate the value_id-th unknown...
void select_for_p_unrefinement()
Select the element for p-unrefinement.
virtual void shape(const Vector< double > &s, Shape &psi) const =0
Calculate the geometric shape functions at local coordinate s. This function must be overloaded for e...
void enable_refinement()
Emnable refinement for this element.
TreeRoot *& root_pt()
Return pointer to root of the tree.
double local_to_eulerian_mapping_diagonal(const DShape &dpsids, DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
Calculate the mapping from local to Eulerian coordinates given the derivatives of the shape functions...
void rebuild_from_sons(Mesh *&mesh_pt)
Broken function – this shouldn't really be needed.
RefineableSolidElement()
Constructor.