29 #ifndef OOMPH_REFINEABLE_ELEMENTS_HEADER
30 #define OOMPH_REFINEABLE_ELEMENTS_HEADER
34 #include <oomph-lib-config.h>
122 static void check_value_id(
const int& n_continuously_interpolated_values,
123 const int& value_id);
253 template<
class ELEMENT>
262 son_pt.resize(n_sons);
265 for (
unsigned i = 0;
i < n_sons;
i++)
267 son_pt[
i] =
new ELEMENT;
269 son_pt[
i]->set_refinement_level(son_refine_level);
280 #ifdef RANGE_CHECKING
283 std::ostringstream error_message;
284 error_message <<
"Range Error: Value " <<
i
285 <<
" is not in the range (0,"
288 OOMPH_CURRENT_FUNCTION,
289 OOMPH_EXCEPTION_LOCATION);
304 bool& was_already_built,
305 std::ofstream& new_nodes_file) = 0;
373 unsigned n_node = this->
nnode();
374 for (
unsigned n = 0; n < n_node; n++)
448 const unsigned& n1d,
const unsigned&
i,
const int& value_id)
483 const int& value_id)
const
505 std::set<std::pair<Data*, unsigned>>& paired_field_data);
577 father_at_reflevel_pt = father_el_pt;
583 father_at_reflevel_pt);
591 const unsigned& initial_p_order = 0)
762 Mesh*
const& mesh_pt,
769 unsigned n_node = this->
nnode();
770 for (
unsigned n = 0; n < n_node; n++)
803 bool& was_already_built,
804 std::ofstream& new_nodes_file)
806 std::ostringstream error_message;
807 error_message <<
"This function is broken as it's only needed/used \n"
808 <<
"during \"proper\" refinement\n";
810 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
818 std::ostringstream error_message;
819 error_message <<
"This function is broken as it's only needed/used \n"
820 <<
"during \"proper\" refinement\n";
822 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
830 std::ostringstream error_message;
831 error_message <<
"This function is broken as it's only needed/used \n"
832 <<
"during \"proper\" refinement\n";
834 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
841 std::ostringstream error_message;
842 error_message <<
"This function is broken as it's only needed/used \n"
843 <<
"during \"proper\" refinement\n";
845 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
851 std::ostringstream error_message;
852 error_message <<
"This function is broken as it's only needed/used \n"
853 <<
"during \"proper\" refinement\n";
855 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
A class that represents a collection of data; each Data object may contain many different individual ...
A general Finite Element class.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
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.
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...
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...
unsigned nnode() const
Return the number of nodes.
virtual unsigned nnode_1d() const
Return the number of nodes along one edge of the element Default is to return zero — must be overload...
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...
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;.
A Generalised Element class.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
void set_non_obsolete()
Mark node as non-obsolete.
/////////////////////////////////////////////////////////////////// /////////////////////////////////...
void get_interpolated_values(const Vector< double > &s, Vector< double > &values)
Broken function – this shouldn't really be needed.
void check_integrity(double &max_error)
Broken function – this shouldn't really be needed.
void rebuild_from_sons(Mesh *&mesh_pt)
Broken function – this shouldn't really be needed.
virtual void get_interpolated_values(const unsigned &t, const Vector< double > &s, Vector< double > &values)
Broken function – this shouldn't really be needed.
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.
/////////////////////////////////////////////////////////////////// /////////////////////////////////...
An OomphLibError object which should be thrown when an run-time error is encountered....
/////////////////////////////////////////////////////////////////// /////////////////////////////////...
bool to_be_p_unrefined()
Has the element been selected for p-unrefinement?
bool p_refinement_is_enabled()
Flag to indicate suppression of any refinement.
void enable_p_refinement()
Emnable refinement for this element.
bool nodes_built()
Return true if all the nodes have been built, false if not.
unsigned & p_order()
Access function to P_order.
void operator=(const PRefineableElement &)=delete
Broken assignment operator.
PRefineableElement(const PRefineableElement &)=delete
Broken copy constructor.
virtual ~PRefineableElement()
Destructor, empty.
virtual unsigned initial_p_order() const =0
Get the initial P_order This is required so that elements which are constructed with a higher p-order...
virtual void p_refine(const int &inc, Mesh *const &mesh_pt, GeneralisedElement *const &clone_pt)=0
p-refine the element
void disable_p_refinement()
Suppress of any refinement for this element.
bool To_be_p_refined
Flag for p-refinement.
unsigned P_order
The polynomial expansion order of the elemental basis functions.
void select_for_p_refinement()
Select the element for p-refinement.
bool To_be_p_unrefined
Flag for unrefinement.
void deselect_for_p_unrefinement()
Deselect the element for p-unrefinement.
bool to_be_p_refined()
Has the element been selected for refinement?
void select_for_p_unrefinement()
Select the element for p-unrefinement.
bool P_refinement_is_enabled
Flag to indicate suppression of any refinement.
unsigned p_order() const
Access function to P_order (const version)
void deselect_for_p_refinement()
Deselect the element for p-refinement.
PRefineableElement()
Constructor, calls the RefineableElement constructor.
////////////////////////////////////////////////////////////////// //////////////////////////////////...
RefineableElements are FiniteElements that may be subdivided into children to provide a better local ...
void set_number(const long &mynumber)
Set element number (for debugging/plotting)
void select_sons_for_unrefinement()
Unrefinement will be performed by merging the four sons of this element.
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...
Tree * tree_pt()
Access function: Pointer to quadtree representation of this element.
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,...
static double Max_integrity_tolerance
Max. allowed discrepancy in element integrity check.
virtual RefineableElement * root_element_pt()
Pointer to the root element in refinement hierarchy (must be implemented in specific elements that do...
static double & max_integrity_tolerance()
Max. allowed discrepancy in element integrity check.
virtual void further_build()
Further build: e.g. deal with interpolation of internal values.
void select_for_refinement()
Select the element for refinement.
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 assign_hanging_local_eqn_numbers(const bool &store_local_dof_pt)
Assign the local equation numbers for hanging node variables.
virtual void pre_build(Mesh *&mesh_pt, Vector< Node * > &new_node_pt)
Pre-build the element.
void set_refinement_level(const int &refine_level)
Set the refinement level.
virtual void unbuild()
Unbuild the element, i.e. mark the nodes that were created during its creation for possible deletion.
Tree * Tree_pt
A pointer to a general tree object.
virtual void deactivate_element()
Final operations that must be performed when the element is no longer active in the mesh,...
long number() const
Element number (for debugging/plotting)
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...
virtual bool nodes_built()
Return true if all the nodes have been built, false if not.
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 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...
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...
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 Data that can affect the fields interpolated...
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.
unsigned refinement_level() const
Return the Refinement level.
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.
unsigned Refine_level
Refinement level.
void get_dresidual_dnodal_coordinates(RankThreeTensor< double > &dresidual_dnodal_coordinates)
Compute derivatives of elemental residual vector with respect to nodal coordinates....
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...
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 disable_refinement()
Suppress of any refinement for this element.
virtual void further_setup_hanging_nodes()
Perform additional hanging node procedures for variables that are not interpolated by all nodes (e....
long Number
Global element number – for plotting/validation purposes.
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 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...
bool refinement_is_enabled()
Flag to indicate suppression of any refinement.
virtual unsigned required_nsons() const
Set the number of sons that can be constructed by the element The default is none.
void deselect_for_refinement()
Deselect the element for refinement.
void assemble_local_to_eulerian_jacobian(const DShape &dpsids, DenseMatrix< double > &jacobian) const
Assemble the jacobian matrix for the mapping from local to Eulerian coordinates, given the derivative...
virtual RefineableElement * father_element_pt() const
Return a pointer to the father element.
unsigned nshape_controlling_nodes()
Number of shape-controlling nodes = the number of non-hanging nodes plus the number of master nodes a...
bool To_be_refined
Flag for refinement.
std::map< Node *, int > * Local_hang_eqn
Storage for local equation numbers of hanging node variables (values stored at master nodes)....
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...
RefineableElement()
Constructor, calls the FiniteElement constructor and initialises the member data.
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....
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...
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...
bool to_be_refined()
Has the element been selected for refinement?
void enable_refinement()
Emnable refinement for this element.
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 ...
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 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...
RefineableElement(const RefineableElement &)=delete
Broken copy constructor.
void set_tree_pt(Tree *my_tree_pt)
Set pointer to quadtree representation of this element.
bool Sons_to_be_unrefined
Flag for unrefinement.
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....
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...
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 get_interpolated_values(const unsigned &t, const Vector< double > &s, Vector< double > &values)=0
Get all continously interpolated function values at previous timestep in this element as a Vector....
bool sons_to_be_unrefined()
Has the element been selected for unrefinement?
bool Refinement_is_enabled
Flag to indicate suppression of any refinement.
virtual ~RefineableElement()
Destructor, delete the allocated storage for the hanging equations.
virtual void check_integrity(double &max_error)=0
Check the integrity of the element: Continuity of positions values, etc. Essentially,...
void operator=(const RefineableElement &)=delete
Broken assignment operator.
void deselect_sons_for_unrefinement()
No unrefinement will be performed by merging the four sons of this element.
/////////////////////////////////////////////////////////////////// /////////////////////////////////...
virtual void further_build()
Further build: Pass the father's Use_undeformed_macro_element_for_new_lagrangian_coords flag down,...
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...
Data * geom_data_pt(const unsigned &j)
Return pointer to the j-th Data item that the object's shape depends on: Positional data of non-hangi...
double local_to_lagrangian_mapping_diagonal(const DShape &dpsids, DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
Calculate the mapping from local to Lagrangian coordinates given the derivatives of the shape functio...
void assemble_local_to_lagrangian_jacobian2(const DShape &d2psids, DenseMatrix< double > &jacobian2) const
Assemble the the "jacobian" matrix of second derivatives, given the second derivatives of the shape f...
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...
unsigned ngeom_data() const
The number of geometric data affecting a RefineableSolidFiniteElement is the positional Data of all n...
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...
bool Use_undeformed_macro_element_for_new_lagrangian_coords
Flag deciding if the Lagrangian coordinates of newly-created interior SolidNodes are to be determined...
virtual ~RefineableSolidElement()
Virtual Destructor, delete any allocated storage.
RefineableSolidElement()
Constructor.
void assign_solid_hanging_local_eqn_numbers(const bool &store_local_dof_pt)
Assign local equation numbers to the hanging values associated with positions or additional solid val...
void fill_in_jacobian_from_solid_position_by_fd(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Compute element residual Vector and element Jacobian matrix corresponding to the solid positions....
std::map< Node *, DenseMatrix< int > > Local_position_hang_eqn
Storage for local equation numbers of hanging node variables associated with nodal positions....
void identify_geometric_data(std::set< Data * > &geometric_data_pt)
Specify Data that affects the geometry of the element by adding the position Data to the set that's p...
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 assemble_local_to_lagrangian_jacobian(const DShape &dpsids, DenseMatrix< double > &jacobian) const
Assemble the jacobian matrix for the mapping from local to lagrangian coordinates,...
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
////////////////////////////////////////////////////////////////////// //////////////////////////////...
virtual void assign_solid_local_eqn_numbers(const bool &store_local_dof)
Assigns local equation numbers for the generic solid local equation numbering schemes....
A generalised tree base class that abstracts the common functionality between the quad- and octrees u...
RefineableElement * object_pt() const
Return the pointer to the object (RefineableElement) represented by the tree.
Tree * father_pt() const
Return pointer to father: NULL if it's a root node.
TreeRoot *& root_pt()
Return pointer to root of the tree.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...