oomph::PRefineableQElement< 1, INITIAL_NNODE_1D > Class Template Reference

#include <hp_refineable_elements.h>

+ Inheritance diagram for oomph::PRefineableQElement< 1, INITIAL_NNODE_1D >:

Public Member Functions

 PRefineableQElement ()
 Constructor. More...
 
virtual ~PRefineableQElement ()
 Destructor. More...
 
void initial_setup (Tree *const &adopted_father_pt=0, const unsigned &initial_p_order=0)
 
void pre_build (Mesh *&mesh_pt, Vector< Node * > &new_node_pt)
 
void p_refine (const int &inc, Mesh *const &mesh_pt, GeneralisedElement *const &clone_pt)
 p-refine the element (refine if inc>0, unrefine if inc<0). More...
 
void shape (const Vector< double > &s, Shape &psi) const
 Overload the shape functions. More...
 
void dshape_local (const Vector< double > &s, Shape &psi, DShape &dpsi) const
 Derivatives of shape functions for PRefineableQElement<DIM> More...
 
void d2shape_local (const Vector< double > &s, Shape &psi, DShape &dpsids, DShape &d2psids) const
 
void further_setup_hanging_nodes ()
 
unsigned nnode_1d () const
 
unsigned initial_p_order () const
 Get the initial P_order. More...
 
Nodeget_node_at_local_coordinate (const Vector< double > &s) const
 Return the node at the specified local coordinate. More...
 
Nodenode_created_by_son_of_neighbour (const Vector< double > &s_fraction, bool &is_periodic)
 
void local_coordinate_of_node (const unsigned &n, Vector< double > &s) const
 Get local coordinates of node j in the element; vector sets its own size. More...
 
void local_fraction_of_node (const unsigned &n, Vector< double > &s_fraction)
 Get the local fractino of node j in the element. More...
 
double local_one_d_fraction_of_node (const unsigned &n1d, const unsigned &i)
 The local one-d fraction is the same. More...
 
void rebuild_from_sons (Mesh *&mesh_pt)
 
void check_integrity (double &max_error)
 
- Public Member Functions inherited from oomph::RefineableQElement< 1 >
 RefineableQElement ()
 Constructor: Pass refinement level (default 0 = root) More...
 
 RefineableQElement (const RefineableQElement< 1 > &dummy)=delete
 Broken copy constructor. More...
 
virtual ~RefineableQElement ()
 Broken assignment operator. More...
 
unsigned required_nsons () const
 A refineable line element has two sons. More...
 
Nodenode_created_by_neighbour (const Vector< double > &s_fraction, bool &is_periodic)
 
Nodenode_created_by_son_of_neighbour (const Vector< double > &s_fraction, bool &is_periodic)
 
virtual void build (Mesh *&mesh_pt, Vector< Node * > &new_node_pt, bool &was_already_built, std::ofstream &new_nodes_file)
 
void check_integrity (double &max_error)
 
void output_corners (std::ostream &outfile, const std::string &colour) const
 Print corner nodes, using colour. More...
 
BinaryTreebinary_tree_pt ()
 Pointer to binary tree representation of this element. More...
 
BinaryTreebinary_tree_pt () const
 Pointer to binary tree representation of this element (const version) More...
 
void setup_hanging_nodes (Vector< std::ofstream * > &output_stream)
 Line elements have no hanging nodes so this is deliberately left empty. More...
 
- Public Member Functions inherited from oomph::RefineableElement
 RefineableElement ()
 
virtual ~RefineableElement ()
 Destructor, delete the allocated storage for the hanging equations. More...
 
 RefineableElement (const RefineableElement &)=delete
 Broken copy constructor. More...
 
void operator= (const RefineableElement &)=delete
 Broken assignment operator. More...
 
Treetree_pt ()
 Access function: Pointer to quadtree representation of this element. More...
 
void set_tree_pt (Tree *my_tree_pt)
 Set pointer to quadtree representation of this element. More...
 
bool refinement_is_enabled ()
 Flag to indicate suppression of any refinement. More...
 
void disable_refinement ()
 Suppress of any refinement for this element. More...
 
void enable_refinement ()
 Emnable refinement for this element. More...
 
template<class ELEMENT >
void split (Vector< ELEMENT * > &son_pt) const
 
int local_hang_eqn (Node *const &node_pt, const unsigned &i)
 
void set_refinement_level (const int &refine_level)
 Set the refinement level. More...
 
unsigned refinement_level () const
 Return the Refinement level. More...
 
void select_for_refinement ()
 Select the element for refinement. More...
 
void deselect_for_refinement ()
 Deselect the element for refinement. More...
 
void select_sons_for_unrefinement ()
 Unrefinement will be performed by merging the four sons of this element. More...
 
void deselect_sons_for_unrefinement ()
 
bool to_be_refined ()
 Has the element been selected for refinement? More...
 
bool sons_to_be_unrefined ()
 Has the element been selected for unrefinement? More...
 
virtual void unbuild ()
 
virtual void deactivate_element ()
 
long number () const
 Element number (for debugging/plotting) More...
 
void set_number (const long &mynumber)
 Set element number (for debugging/plotting) More...
 
virtual unsigned ncont_interpolated_values () const =0
 
virtual void get_interpolated_values (const Vector< double > &s, Vector< double > &values)
 
virtual void get_interpolated_values (const unsigned &t, const Vector< double > &s, Vector< double > &values)=0
 
virtual Nodeinterpolating_node_pt (const unsigned &n, const int &value_id)
 
virtual double local_one_d_fraction_of_interpolating_node (const unsigned &n1d, const unsigned &i, const int &value_id)
 
virtual Nodeget_interpolating_node_at_local_coordinate (const Vector< double > &s, const int &value_id)
 
virtual unsigned ninterpolating_node (const int &value_id)
 
virtual unsigned ninterpolating_node_1d (const int &value_id)
 
virtual void interpolating_basis (const Vector< double > &s, Shape &psi, const int &value_id) const
 
void identify_field_data_for_interactions (std::set< std::pair< Data *, unsigned >> &paired_field_data)
 
void assign_nodal_local_eqn_numbers (const bool &store_local_dof_pt)
 
virtual RefineableElementroot_element_pt ()
 
virtual RefineableElementfather_element_pt () const
 Return a pointer to the father element. More...
 
void get_father_at_refinement_level (unsigned &refinement_level, RefineableElement *&father_at_reflevel_pt)
 
virtual void further_build ()
 Further build: e.g. deal with interpolation of internal values. More...
 
void get_dresidual_dnodal_coordinates (RankThreeTensor< double > &dresidual_dnodal_coordinates)
 
unsigned nshape_controlling_nodes ()
 
std::map< Node *, unsignedshape_controlling_node_lookup ()
 
- Public Member Functions inherited from oomph::FiniteElement
void set_dimension (const unsigned &dim)
 
void set_nodal_dimension (const unsigned &nodal_dim)
 
void set_nnodal_position_type (const unsigned &nposition_type)
 Set the number of types required to interpolate the coordinate. More...
 
void set_n_node (const unsigned &n)
 
int nodal_local_eqn (const unsigned &n, const unsigned &i) const
 
double dJ_eulerian_at_knot (const unsigned &ipt, Shape &psi, DenseMatrix< double > &djacobian_dX) const
 
 FiniteElement ()
 Constructor. More...
 
virtual ~FiniteElement ()
 
 FiniteElement (const FiniteElement &)=delete
 Broken copy constructor. More...
 
void get_centre_of_gravity_and_max_radius_in_terms_of_zeta (Vector< double > &cog, double &max_radius) const
 
MacroElementmacro_elem_pt ()
 Access function to pointer to macro element. More...
 
void get_x (const Vector< double > &s, Vector< double > &x) const
 
void get_x (const unsigned &t, const Vector< double > &s, Vector< double > &x)
 
virtual void set_integration_scheme (Integral *const &integral_pt)
 Set the spatial integration scheme. More...
 
Integral *const & integral_pt () const
 Return the pointer to the integration scheme (const version) More...
 
virtual void shape_at_knot (const unsigned &ipt, Shape &psi) const
 
virtual void dshape_local_at_knot (const unsigned &ipt, Shape &psi, DShape &dpsids) const
 
virtual void d2shape_local_at_knot (const unsigned &ipt, Shape &psi, DShape &dpsids, DShape &d2psids) const
 
virtual double J_eulerian (const Vector< double > &s) const
 
virtual double J_eulerian_at_knot (const unsigned &ipt) const
 
void check_J_eulerian_at_knots (bool &passed) const
 
void check_jacobian (const double &jacobian) const
 
double dshape_eulerian (const Vector< double > &s, Shape &psi, DShape &dpsidx) const
 
virtual double dshape_eulerian_at_knot (const unsigned &ipt, Shape &psi, DShape &dpsidx) const
 
virtual double dshape_eulerian_at_knot (const unsigned &ipt, Shape &psi, DShape &dpsi, DenseMatrix< double > &djacobian_dX, RankFourTensor< double > &d_dpsidx_dX) const
 
double d2shape_eulerian (const Vector< double > &s, Shape &psi, DShape &dpsidx, DShape &d2psidx) const
 
virtual double d2shape_eulerian_at_knot (const unsigned &ipt, Shape &psi, DShape &dpsidx, DShape &d2psidx) const
 
virtual void describe_local_dofs (std::ostream &out, const std::string &current_string) const
 
virtual void describe_nodal_local_dofs (std::ostream &out, const std::string &current_string) const
 
virtual void assign_all_generic_local_eqn_numbers (const bool &store_local_dof_pt)
 
Node *& node_pt (const unsigned &n)
 Return a pointer to the local node n. More...
 
Node *const & node_pt (const unsigned &n) const
 Return a pointer to the local node n (const version) More...
 
unsigned nnode () const
 Return the number of nodes. More...
 
double raw_nodal_position (const unsigned &n, const unsigned &i) const
 
double raw_nodal_position (const unsigned &t, const unsigned &n, const unsigned &i) const
 
double raw_dnodal_position_dt (const unsigned &n, const unsigned &i) const
 
double raw_dnodal_position_dt (const unsigned &n, const unsigned &j, const unsigned &i) const
 
double raw_nodal_position_gen (const unsigned &n, const unsigned &k, const unsigned &i) const
 
double raw_nodal_position_gen (const unsigned &t, const unsigned &n, const unsigned &k, const unsigned &i) const
 
double raw_dnodal_position_gen_dt (const unsigned &n, const unsigned &k, const unsigned &i) const
 
double raw_dnodal_position_gen_dt (const unsigned &j, const unsigned &n, const unsigned &k, const unsigned &i) const
 
double nodal_position (const unsigned &n, const unsigned &i) const
 
double nodal_position (const unsigned &t, const unsigned &n, const unsigned &i) const
 
double dnodal_position_dt (const unsigned &n, const unsigned &i) const
 Return the i-th component of nodal velocity: dx/dt at local node n. More...
 
double dnodal_position_dt (const unsigned &n, const unsigned &j, const unsigned &i) const
 
double nodal_position_gen (const unsigned &n, const unsigned &k, const unsigned &i) const
 
double nodal_position_gen (const unsigned &t, const unsigned &n, const unsigned &k, const unsigned &i) const
 
double dnodal_position_gen_dt (const unsigned &n, const unsigned &k, const unsigned &i) const
 
double dnodal_position_gen_dt (const unsigned &j, const unsigned &n, const unsigned &k, const unsigned &i) const
 
virtual void disable_ALE ()
 
virtual void enable_ALE ()
 
virtual unsigned required_nvalue (const unsigned &n) const
 
unsigned nnodal_position_type () const
 
bool has_hanging_nodes () const
 
unsigned nodal_dimension () const
 Return the required Eulerian dimension of the nodes in this element. More...
 
virtual Nodeconstruct_node (const unsigned &n)
 
virtual Nodeconstruct_node (const unsigned &n, TimeStepper *const &time_stepper_pt)
 
virtual Nodeconstruct_boundary_node (const unsigned &n)
 
virtual Nodeconstruct_boundary_node (const unsigned &n, TimeStepper *const &time_stepper_pt)
 
int get_node_number (Node *const &node_pt) const
 
double raw_nodal_value (const unsigned &n, const unsigned &i) const
 
double raw_nodal_value (const unsigned &t, const unsigned &n, const unsigned &i) const
 
double nodal_value (const unsigned &n, const unsigned &i) const
 
double nodal_value (const unsigned &t, const unsigned &n, const unsigned &i) const
 
unsigned dim () const
 
virtual double interpolated_x (const Vector< double > &s, const unsigned &i) const
 Return FE interpolated coordinate x[i] at local coordinate s. More...
 
virtual double interpolated_x (const unsigned &t, const Vector< double > &s, const unsigned &i) const
 
virtual void interpolated_x (const Vector< double > &s, Vector< double > &x) const
 Return FE interpolated position x[] at local coordinate s as Vector. More...
 
virtual void interpolated_x (const unsigned &t, const Vector< double > &s, Vector< double > &x) const
 
virtual double interpolated_dxdt (const Vector< double > &s, const unsigned &i, const unsigned &t)
 
virtual void interpolated_dxdt (const Vector< double > &s, const unsigned &t, Vector< double > &dxdt)
 
unsigned ngeom_data () const
 
Datageom_data_pt (const unsigned &j)
 
void position (const Vector< double > &zeta, Vector< double > &r) const
 
void position (const unsigned &t, const Vector< double > &zeta, Vector< double > &r) const
 
void dposition_dt (const Vector< double > &zeta, const unsigned &t, Vector< double > &drdt)
 
virtual double zeta_nodal (const unsigned &n, const unsigned &k, const unsigned &i) const
 
void interpolated_zeta (const Vector< double > &s, Vector< double > &zeta) const
 
void locate_zeta (const Vector< double > &zeta, GeomObject *&geom_object_pt, Vector< double > &s, const bool &use_coordinate_as_initial_guess=false)
 
virtual void node_update ()
 
virtual void identify_geometric_data (std::set< Data * > &geometric_data_pt)
 
virtual double s_min () const
 Min value of local coordinate. More...
 
virtual double s_max () const
 Max. value of local coordinate. More...
 
double size () const
 
virtual double compute_physical_size () const
 
virtual void point_output_data (const Vector< double > &s, Vector< double > &data)
 
void point_output (std::ostream &outfile, const Vector< double > &s)
 
virtual unsigned nplot_points_paraview (const unsigned &nplot) const
 
virtual unsigned nsub_elements_paraview (const unsigned &nplot) const
 
void output_paraview (std::ofstream &file_out, const unsigned &nplot) const
 
virtual void write_paraview_output_offset_information (std::ofstream &file_out, const unsigned &nplot, unsigned &counter) const
 
virtual void write_paraview_type (std::ofstream &file_out, const unsigned &nplot) const
 
virtual void write_paraview_offsets (std::ofstream &file_out, const unsigned &nplot, unsigned &offset_sum) const
 
virtual unsigned nscalar_paraview () const
 
virtual void scalar_value_paraview (std::ofstream &file_out, const unsigned &i, const unsigned &nplot) const
 
virtual void scalar_value_fct_paraview (std::ofstream &file_out, const unsigned &i, const unsigned &nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt) const
 
virtual void scalar_value_fct_paraview (std::ofstream &file_out, const unsigned &i, const unsigned &nplot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt) const
 
virtual std::string scalar_name_paraview (const unsigned &i) const
 
virtual void output (std::ostream &outfile)
 
virtual void output (std::ostream &outfile, const unsigned &n_plot)
 
virtual void output (const unsigned &t, std::ostream &outfile, const unsigned &n_plot) const
 
virtual void output (FILE *file_pt)
 
virtual void output (FILE *file_pt, const unsigned &n_plot)
 
virtual void output_fct (std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
 Output an exact solution over the element. More...
 
virtual void output_fct (std::ostream &outfile, const unsigned &n_plot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt)
 Output a time-dependent exact solution over the element. More...
 
virtual void output_fct (std::ostream &outfile, const unsigned &n_plot, const double &time, const SolutionFunctorBase &exact_soln) const
 Output a time-dependent exact solution over the element. More...
 
virtual void get_s_plot (const unsigned &i, const unsigned &nplot, Vector< double > &s, const bool &shifted_to_interior=false) const
 
virtual std::string tecplot_zone_string (const unsigned &nplot) const
 
virtual void write_tecplot_zone_footer (std::ostream &outfile, const unsigned &nplot) const
 
virtual void write_tecplot_zone_footer (FILE *file_pt, const unsigned &nplot) const
 
virtual unsigned nplot_points (const unsigned &nplot) const
 
virtual void compute_error (FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
 Calculate the norm of the error and that of the exact solution. More...
 
virtual void compute_error (FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, double &error, double &norm)
 Calculate the norm of the error and that of the exact solution. More...
 
virtual void compute_error (FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, Vector< double > &error, Vector< double > &norm)
 
virtual void compute_error (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, double &error, 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, 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_abs_error (std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error)
 
void integrate_fct (FiniteElement::SteadyExactSolutionFctPt integrand_fct_pt, Vector< double > &integral)
 Integrate Vector-valued function over element. More...
 
void integrate_fct (FiniteElement::UnsteadyExactSolutionFctPt integrand_fct_pt, const double &time, Vector< double > &integral)
 Integrate Vector-valued time-dep function over element. More...
 
virtual void build_face_element (const int &face_index, FaceElement *face_element_pt)
 
virtual unsigned self_test ()
 
virtual unsigned get_bulk_node_number (const int &face_index, const unsigned &i) const
 
virtual int face_outer_unit_normal_sign (const int &face_index) const
 Get the sign of the outer unit normal on the face given by face_index. More...
 
void face_node_number_error_check (const unsigned &i) const
 Range check for face node numbers. More...
 
virtual CoordinateMappingFctPt face_to_bulk_coordinate_fct_pt (const int &face_index) const
 
virtual BulkCoordinateDerivativesFctPt bulk_coordinate_derivatives_fct_pt (const int &face_index) const
 
- Public Member Functions inherited from oomph::GeneralisedElement
 GeneralisedElement ()
 Constructor: Initialise all pointers and all values to zero. More...
 
virtual ~GeneralisedElement ()
 Virtual destructor to clean up any memory allocated by the object. More...
 
 GeneralisedElement (const GeneralisedElement &)=delete
 Broken copy constructor. More...
 
void operator= (const GeneralisedElement &)=delete
 Broken assignment operator. More...
 
Data *& internal_data_pt (const unsigned &i)
 Return a pointer to i-th internal data object. More...
 
Data *const & internal_data_pt (const unsigned &i) const
 Return a pointer to i-th internal data object (const version) More...
 
Data *& external_data_pt (const unsigned &i)
 Return a pointer to i-th external data object. More...
 
Data *const & external_data_pt (const unsigned &i) const
 Return a pointer to i-th external data object (const version) More...
 
unsigned long eqn_number (const unsigned &ieqn_local) const
 
int local_eqn_number (const unsigned long &ieqn_global) const
 
unsigned add_external_data (Data *const &data_pt, const bool &fd=true)
 
bool external_data_fd (const unsigned &i) const
 
void exclude_external_data_fd (const unsigned &i)
 
void include_external_data_fd (const unsigned &i)
 
void flush_external_data ()
 Flush all external data. More...
 
void flush_external_data (Data *const &data_pt)
 Flush the object addressed by data_pt from the external data array. More...
 
unsigned ninternal_data () const
 Return the number of internal data objects. More...
 
unsigned nexternal_data () const
 Return the number of external data objects. More...
 
unsigned ndof () const
 Return the number of equations/dofs in the element. More...
 
void dof_vector (const unsigned &t, Vector< double > &dof)
 Return the vector of dof values at time level t. More...
 
void dof_pt_vector (Vector< double * > &dof_pt)
 Return the vector of pointers to dof values. More...
 
void set_internal_data_time_stepper (const unsigned &i, TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data)
 
void assign_internal_eqn_numbers (unsigned long &global_number, Vector< double * > &Dof_pt)
 
void describe_dofs (std::ostream &out, const std::string &current_string) const
 
void add_internal_value_pt_to_map (std::map< unsigned, double * > &map_of_value_pt)
 
virtual void assign_local_eqn_numbers (const bool &store_local_dof_pt)
 
virtual void complete_setup_of_dependencies ()
 
virtual void get_residuals (Vector< double > &residuals)
 
virtual void get_jacobian (Vector< double > &residuals, DenseMatrix< double > &jacobian)
 
virtual void get_mass_matrix (Vector< double > &residuals, DenseMatrix< double > &mass_matrix)
 
virtual void get_jacobian_and_mass_matrix (Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix)
 
virtual void get_dresiduals_dparameter (double *const &parameter_pt, Vector< double > &dres_dparam)
 
virtual void get_djacobian_dparameter (double *const &parameter_pt, Vector< double > &dres_dparam, DenseMatrix< double > &djac_dparam)
 
virtual void get_djacobian_and_dmass_matrix_dparameter (double *const &parameter_pt, Vector< double > &dres_dparam, DenseMatrix< double > &djac_dparam, DenseMatrix< double > &dmass_matrix_dparam)
 
virtual void get_hessian_vector_products (Vector< double > const &Y, DenseMatrix< double > const &C, DenseMatrix< double > &product)
 
virtual void get_inner_products (Vector< std::pair< unsigned, unsigned >> const &history_index, Vector< double > &inner_product)
 
virtual void get_inner_product_vectors (Vector< unsigned > const &history_index, Vector< Vector< double >> &inner_product_vector)
 
virtual void compute_norm (Vector< double > &norm)
 
virtual void compute_norm (double &norm)
 
virtual unsigned ndof_types () const
 
virtual void get_dof_numbers_for_unknowns (std::list< std::pair< unsigned long, unsigned >> &dof_lookup_list) const
 
- Public Member Functions inherited from oomph::GeomObject
 GeomObject ()
 Default constructor. More...
 
 GeomObject (const unsigned &ndim)
 
 GeomObject (const unsigned &nlagrangian, const unsigned &ndim)
 
 GeomObject (const unsigned &nlagrangian, const unsigned &ndim, TimeStepper *time_stepper_pt)
 
 GeomObject (const GeomObject &dummy)=delete
 Broken copy constructor. More...
 
void operator= (const GeomObject &)=delete
 Broken assignment operator. More...
 
virtual ~GeomObject ()
 (Empty) destructor More...
 
unsigned nlagrangian () const
 Access function to # of Lagrangian coordinates. More...
 
unsigned ndim () const
 Access function to # of Eulerian coordinates. More...
 
void set_nlagrangian_and_ndim (const unsigned &n_lagrangian, const unsigned &n_dim)
 Set # of Lagrangian and Eulerian coordinates. More...
 
TimeStepper *& time_stepper_pt ()
 
TimeSteppertime_stepper_pt () const
 
virtual void position (const double &t, const Vector< double > &zeta, Vector< double > &r) const
 
virtual void dposition (const Vector< double > &zeta, DenseMatrix< double > &drdzeta) const
 
virtual void d2position (const Vector< double > &zeta, RankThreeTensor< double > &ddrdzeta) const
 
virtual void d2position (const Vector< double > &zeta, Vector< double > &r, DenseMatrix< double > &drdzeta, RankThreeTensor< double > &ddrdzeta) const
 
- Public Member Functions inherited from oomph::LineElementBase
 LineElementBase ()
 Constructor. Empty. More...
 
virtual unsigned nvertex_node () const =0
 Number of vertex nodes in the element. More...
 
virtual Nodevertex_node_pt (const unsigned &j) const =0
 Pointer to the j-th vertex node in the element. More...
 
- Public Member Functions inherited from oomph::QElementBase
 QElementBase ()
 Constructor: Initialise pointers to macro element reference coords. More...
 
 QElementBase (const QElementBase &)=delete
 Broken copy constructor. More...
 
virtual ~QElementBase ()
 Broken assignment operator. More...
 
bool local_coord_is_valid (const Vector< double > &s)
 Check whether the local coordinate are valid or not. More...
 
void move_local_coord_back_into_element (Vector< double > &s) const
 
virtual void set_macro_elem_pt (MacroElement *macro_elem_pt)
 
doubles_macro_ll (const unsigned &i)
 
doubles_macro_ur (const unsigned &i)
 
double s_macro_ll (const unsigned &i) const
 
double s_macro_ur (const unsigned &i) const
 
void get_x_from_macro_element (const Vector< double > &s, Vector< double > &x) const
 
void get_x_from_macro_element (const unsigned &t, const Vector< double > &s, Vector< double > &x)
 
unsigned nnode_on_face () const
 
ElementGeometry::ElementGeometry element_geometry () const
 It's a Q element! More...
 
- Public Member Functions inherited from oomph::QElementGeometricBase
 QElementGeometricBase ()
 Empty default constructor. More...
 
 QElementGeometricBase (const QElementGeometricBase &)=delete
 Broken copy constructor. More...
 
- Public Member Functions inherited from oomph::PRefineableElement
 PRefineableElement ()
 Constructor, calls the RefineableElement constructor. More...
 
virtual ~PRefineableElement ()
 Destructor, empty. More...
 
 PRefineableElement (const PRefineableElement &)=delete
 Broken copy constructor. More...
 
void operator= (const PRefineableElement &)=delete
 Broken assignment operator. More...
 
bool p_refinement_is_enabled ()
 Flag to indicate suppression of any refinement. More...
 
void disable_p_refinement ()
 Suppress of any refinement for this element. More...
 
void enable_p_refinement ()
 Emnable refinement for this element. More...
 
unsignedp_order ()
 Access function to P_order. More...
 
unsigned p_order () const
 Access function to P_order (const version) More...
 
void select_for_p_refinement ()
 Select the element for p-refinement. More...
 
void deselect_for_p_refinement ()
 Deselect the element for p-refinement. More...
 
void select_for_p_unrefinement ()
 Select the element for p-unrefinement. More...
 
void deselect_for_p_unrefinement ()
 Deselect the element for p-unrefinement. More...
 
bool to_be_p_refined ()
 Has the element been selected for refinement? More...
 
bool to_be_p_unrefined ()
 Has the element been selected for p-unrefinement? More...
 
bool nodes_built ()
 Return true if all the nodes have been built, false if not. More...
 

Protected Member Functions

void binary_hang_helper (const int &value_id, const int &my_edge, std::ofstream &output_hangfile)
 Set up hanging node information. Empty for 1D elements. More...
 
- Protected Member Functions inherited from oomph::RefineableQElement< 1 >
void setup_father_bounds ()
 
void setup_hang_for_value (const int &value_id)
 Line elements have no hanging nodes so this is deliberately left empty. More...
 
void binary_hang_helper (const int &value_id, const int &my_edge, std::ofstream &output_hangfile)
 Line elements have no hanging nodes so this is deliberately left empty. More...
 
- Protected Member Functions inherited from oomph::RefineableElement
void assemble_local_to_eulerian_jacobian (const DShape &dpsids, DenseMatrix< double > &jacobian) const
 
void assemble_local_to_eulerian_jacobian2 (const DShape &d2psids, DenseMatrix< double > &jacobian2) const
 
void assemble_eulerian_base_vectors (const DShape &dpsids, DenseMatrix< double > &interpolated_G) const
 
double local_to_eulerian_mapping_diagonal (const DShape &dpsids, DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
 
void assign_hanging_local_eqn_numbers (const bool &store_local_dof_pt)
 Assign the local equation numbers for hanging node variables. More...
 
virtual void fill_in_jacobian_from_nodal_by_fd (Vector< double > &residuals, DenseMatrix< double > &jacobian)
 
- Protected Member Functions inherited from oomph::FiniteElement
template<unsigned DIM>
double invert_jacobian (const DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
 
virtual double invert_jacobian_mapping (const DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
 
virtual double local_to_eulerian_mapping (const DShape &dpsids, DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
 
double local_to_eulerian_mapping (const DShape &dpsids, DenseMatrix< double > &inverse_jacobian) const
 
virtual void dJ_eulerian_dnodal_coordinates (const DenseMatrix< double > &jacobian, const DShape &dpsids, DenseMatrix< double > &djacobian_dX) const
 
template<unsigned DIM>
void dJ_eulerian_dnodal_coordinates_templated_helper (const DenseMatrix< double > &jacobian, const DShape &dpsids, DenseMatrix< double > &djacobian_dX) const
 
virtual void d_dshape_eulerian_dnodal_coordinates (const double &det_jacobian, const DenseMatrix< double > &jacobian, const DenseMatrix< double > &djacobian_dX, const DenseMatrix< double > &inverse_jacobian, const DShape &dpsids, RankFourTensor< double > &d_dpsidx_dX) const
 
template<unsigned DIM>
void d_dshape_eulerian_dnodal_coordinates_templated_helper (const double &det_jacobian, const DenseMatrix< double > &jacobian, const DenseMatrix< double > &djacobian_dX, const DenseMatrix< double > &inverse_jacobian, const DShape &dpsids, RankFourTensor< double > &d_dpsidx_dX) const
 
virtual void transform_derivatives (const DenseMatrix< double > &inverse_jacobian, DShape &dbasis) const
 
void transform_derivatives_diagonal (const DenseMatrix< double > &inverse_jacobian, DShape &dbasis) const
 
virtual void transform_second_derivatives (const DenseMatrix< double > &jacobian, const DenseMatrix< double > &inverse_jacobian, const DenseMatrix< double > &jacobian2, DShape &dbasis, DShape &d2basis) const
 
template<unsigned DIM>
void transform_second_derivatives_template (const DenseMatrix< double > &jacobian, const DenseMatrix< double > &inverse_jacobian, const DenseMatrix< double > &jacobian2, DShape &dbasis, DShape &d2basis) const
 
template<unsigned DIM>
void transform_second_derivatives_diagonal (const DenseMatrix< double > &jacobian, const DenseMatrix< double > &inverse_jacobian, const DenseMatrix< double > &jacobian2, DShape &dbasis, DShape &d2basis) const
 
void fill_in_jacobian_from_nodal_by_fd (DenseMatrix< double > &jacobian)
 
virtual void update_before_nodal_fd ()
 
virtual void reset_after_nodal_fd ()
 
virtual void update_in_nodal_fd (const unsigned &i)
 
virtual void reset_in_nodal_fd (const unsigned &i)
 
void fill_in_contribution_to_jacobian (Vector< double > &residuals, DenseMatrix< double > &jacobian)
 
template<>
double invert_jacobian (const DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
 Zero-d specialisation of function to calculate inverse of jacobian mapping. More...
 
template<>
double invert_jacobian (const DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
 One-d specialisation of function to calculate inverse of jacobian mapping. More...
 
template<>
double invert_jacobian (const DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
 Two-d specialisation of function to calculate inverse of jacobian mapping. More...
 
template<>
double invert_jacobian (const DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
 
template<>
void dJ_eulerian_dnodal_coordinates_templated_helper (const DenseMatrix< double > &jacobian, const DShape &dpsids, DenseMatrix< double > &djacobian_dX) const
 
template<>
void dJ_eulerian_dnodal_coordinates_templated_helper (const DenseMatrix< double > &jacobian, const DShape &dpsids, DenseMatrix< double > &djacobian_dX) const
 
template<>
void dJ_eulerian_dnodal_coordinates_templated_helper (const DenseMatrix< double > &jacobian, const DShape &dpsids, DenseMatrix< double > &djacobian_dX) const
 
template<>
void dJ_eulerian_dnodal_coordinates_templated_helper (const DenseMatrix< double > &jacobian, const DShape &dpsids, DenseMatrix< double > &djacobian_dX) const
 
template<>
void d_dshape_eulerian_dnodal_coordinates_templated_helper (const double &det_jacobian, const DenseMatrix< double > &jacobian, const DenseMatrix< double > &djacobian_dX, const DenseMatrix< double > &inverse_jacobian, const DShape &dpsids, RankFourTensor< double > &d_dpsidx_dX) const
 
template<>
void d_dshape_eulerian_dnodal_coordinates_templated_helper (const double &det_jacobian, const DenseMatrix< double > &jacobian, const DenseMatrix< double > &djacobian_dX, const DenseMatrix< double > &inverse_jacobian, const DShape &dpsids, RankFourTensor< double > &d_dpsidx_dX) const
 
template<>
void d_dshape_eulerian_dnodal_coordinates_templated_helper (const double &det_jacobian, const DenseMatrix< double > &jacobian, const DenseMatrix< double > &djacobian_dX, const DenseMatrix< double > &inverse_jacobian, const DShape &dpsids, RankFourTensor< double > &d_dpsidx_dX) const
 
template<>
void d_dshape_eulerian_dnodal_coordinates_templated_helper (const double &det_jacobian, const DenseMatrix< double > &jacobian, const DenseMatrix< double > &djacobian_dX, const DenseMatrix< double > &inverse_jacobian, const DShape &dpsids, RankFourTensor< double > &d_dpsidx_dX) const
 
template<>
void transform_second_derivatives_template (const DenseMatrix< double > &jacobian, const DenseMatrix< double > &inverse_jacobian, const DenseMatrix< double > &jacobian2, DShape &dbasis, DShape &d2basis) const
 
template<>
void transform_second_derivatives_template (const DenseMatrix< double > &jacobian, const DenseMatrix< double > &inverse_jacobian, const DenseMatrix< double > &jacobian2, DShape &dbasis, DShape &d2basis) const
 
template<>
void transform_second_derivatives_diagonal (const DenseMatrix< double > &jacobian, const DenseMatrix< double > &inverse_jacobian, const DenseMatrix< double > &jacobian2, DShape &dbasis, DShape &d2basis) const
 
template<>
void transform_second_derivatives_diagonal (const DenseMatrix< double > &jacobian, const DenseMatrix< double > &inverse_jacobian, const DenseMatrix< double > &jacobian2, DShape &dbasis, DShape &d2basis) const
 
- Protected Member Functions inherited from oomph::GeneralisedElement
unsigned add_internal_data (Data *const &data_pt, const bool &fd=true)
 
bool internal_data_fd (const unsigned &i) const
 
void exclude_internal_data_fd (const unsigned &i)
 
void include_internal_data_fd (const unsigned &i)
 
void clear_global_eqn_numbers ()
 
void add_global_eqn_numbers (std::deque< unsigned long > const &global_eqn_numbers, std::deque< double * > const &global_dof_pt)
 
virtual void assign_internal_and_external_local_eqn_numbers (const bool &store_local_dof_pt)
 
virtual void assign_additional_local_eqn_numbers ()
 
int internal_local_eqn (const unsigned &i, const unsigned &j) const
 
int external_local_eqn (const unsigned &i, const unsigned &j)
 
virtual void fill_in_contribution_to_residuals (Vector< double > &residuals)
 
void fill_in_jacobian_from_internal_by_fd (Vector< double > &residuals, DenseMatrix< double > &jacobian, const bool &fd_all_data=false)
 
void fill_in_jacobian_from_internal_by_fd (DenseMatrix< double > &jacobian, const bool &fd_all_data=false)
 
void fill_in_jacobian_from_external_by_fd (Vector< double > &residuals, DenseMatrix< double > &jacobian, const bool &fd_all_data=false)
 
void fill_in_jacobian_from_external_by_fd (DenseMatrix< double > &jacobian, const bool &fd_all_data=false)
 
virtual void update_before_internal_fd ()
 
virtual void reset_after_internal_fd ()
 
virtual void update_in_internal_fd (const unsigned &i)
 
virtual void reset_in_internal_fd (const unsigned &i)
 
virtual void update_before_external_fd ()
 
virtual void reset_after_external_fd ()
 
virtual void update_in_external_fd (const unsigned &i)
 
virtual void reset_in_external_fd (const unsigned &i)
 
virtual void fill_in_contribution_to_mass_matrix (Vector< double > &residuals, DenseMatrix< double > &mass_matrix)
 
virtual void fill_in_contribution_to_jacobian_and_mass_matrix (Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix)
 
virtual void fill_in_contribution_to_dresiduals_dparameter (double *const &parameter_pt, Vector< double > &dres_dparam)
 
virtual void fill_in_contribution_to_djacobian_dparameter (double *const &parameter_pt, Vector< double > &dres_dparam, DenseMatrix< double > &djac_dparam)
 
virtual void fill_in_contribution_to_djacobian_and_dmass_matrix_dparameter (double *const &parameter_pt, Vector< double > &dres_dparam, DenseMatrix< double > &djac_dparam, DenseMatrix< double > &dmass_matrix_dparam)
 
virtual void fill_in_contribution_to_hessian_vector_products (Vector< double > const &Y, DenseMatrix< double > const &C, DenseMatrix< double > &product)
 
virtual void fill_in_contribution_to_inner_products (Vector< std::pair< unsigned, unsigned >> const &history_index, Vector< double > &inner_product)
 
virtual void fill_in_contribution_to_inner_product_vectors (Vector< unsigned > const &history_index, Vector< Vector< double >> &inner_product_vector)
 

Additional Inherited Members

- Public Types inherited from oomph::RefineableQElement< 1 >
typedef void(RefineableQElement< 1 >::* VoidMemberFctPt) ()
 
- Public Types inherited from oomph::FiniteElement
typedef void(* SteadyExactSolutionFctPt) (const Vector< double > &, Vector< double > &)
 
typedef void(* UnsteadyExactSolutionFctPt) (const double &, const Vector< double > &, Vector< double > &)
 
- Static Public Member Functions inherited from oomph::RefineableElement
static doublemax_integrity_tolerance ()
 Max. allowed discrepancy in element integrity check. More...
 
- Static Public Attributes inherited from oomph::FiniteElement
static double Tolerance_for_singular_jacobian = 1.0e-16
 Tolerance below which the jacobian is considered singular. More...
 
static bool Accept_negative_jacobian = false
 
static bool Suppress_output_while_checking_for_inverted_elements
 
- Static Public Attributes inherited from oomph::GeneralisedElement
static bool Suppress_warning_about_repeated_internal_data
 
static bool Suppress_warning_about_repeated_external_data = true
 
static double Default_fd_jacobian_step = 1.0e-8
 
- Static Protected Member Functions inherited from oomph::RefineableElement
static void check_value_id (const int &n_continuously_interpolated_values, const int &value_id)
 
- Protected Attributes inherited from oomph::RefineableElement
TreeTree_pt
 A pointer to a general tree object. More...
 
unsigned Refine_level
 Refinement level. More...
 
bool To_be_refined
 Flag for refinement. More...
 
bool Refinement_is_enabled
 Flag to indicate suppression of any refinement. More...
 
bool Sons_to_be_unrefined
 Flag for unrefinement. More...
 
long Number
 Global element number – for plotting/validation purposes. More...
 
- Protected Attributes inherited from oomph::FiniteElement
MacroElementMacro_elem_pt
 Pointer to the element's macro element (NULL by default) More...
 
- Protected Attributes inherited from oomph::GeomObject
unsigned NLagrangian
 Number of Lagrangian (intrinsic) coordinates. More...
 
unsigned Ndim
 Number of Eulerian coordinates. More...
 
TimeStepperGeom_object_time_stepper_pt
 
- Protected Attributes inherited from oomph::PRefineableElement
unsigned P_order
 The polynomial expansion order of the elemental basis functions. More...
 
bool To_be_p_refined
 Flag for p-refinement. More...
 
bool P_refinement_is_enabled
 Flag to indicate suppression of any refinement. More...
 
bool To_be_p_unrefined
 Flag for unrefinement. More...
 
- Static Protected Attributes inherited from oomph::RefineableQElement< 1 >
static std::map< unsigned, DenseMatrix< int > > Father_bound
 
- Static Protected Attributes inherited from oomph::RefineableElement
static double Max_integrity_tolerance = 1.0e-8
 Max. allowed discrepancy in element integrity check. More...
 
- Static Protected Attributes inherited from oomph::FiniteElement
static const unsigned Default_Initial_Nvalue = 0
 Default value for the number of values at a node. More...
 
static const double Node_location_tolerance = 1.0e-14
 
static const unsigned N2deriv [] = {0, 1, 3, 6}
 
- Static Protected Attributes inherited from oomph::GeneralisedElement
static DenseMatrix< doubleDummy_matrix
 
static std::deque< double * > Dof_pt_deque
 

Detailed Description

template<unsigned INITIAL_NNODE_1D>
class oomph::PRefineableQElement< 1, INITIAL_NNODE_1D >

p-refineable version of RefineableQElement<1,INITIAL_NNODE_1D>. Generic class definitions

Constructor & Destructor Documentation

◆ PRefineableQElement()

template<unsigned INITIAL_NNODE_1D>
oomph::PRefineableQElement< 1, INITIAL_NNODE_1D >::PRefineableQElement ( )
inline

Constructor.

57 : PRefineableElement(), RefineableQElement<1>() {}
PRefineableElement()
Constructor, calls the RefineableElement constructor.
Definition: refineable_elements.h:668

◆ ~PRefineableQElement()

template<unsigned INITIAL_NNODE_1D>
virtual oomph::PRefineableQElement< 1, INITIAL_NNODE_1D >::~PRefineableQElement ( )
inlinevirtual

Destructor.

60 {}

Member Function Documentation

◆ binary_hang_helper()

template<unsigned INITIAL_NNODE_1D>
void oomph::PRefineableQElement< 1, INITIAL_NNODE_1D >::binary_hang_helper ( const int value_id,
const int my_edge,
std::ofstream &  output_hangfile 
)
protected

Set up hanging node information. Empty for 1D elements.

Internal function to set up the hanging nodes on a particular edge of the element. (Not required in 1D.)

938  {
939  }

◆ check_integrity()

template<unsigned INITIAL_NNODE_1D>
void oomph::PRefineableQElement< 1, INITIAL_NNODE_1D >::check_integrity ( double max_error)
virtual

Check the integrity of interpolated values across element boundaries.

Check inter-element continuity of

  • nodal positions
  • (nodally) interpolated function values

Implements oomph::RefineableElement.

1200  {
1202  }
void check_integrity(double &max_error)
Definition: refineable_line_element.cc:686
double max_error
Definition: MortaringCantileverCompareToNonMortaring.cpp:188

References MeshRefinement::max_error.

◆ d2shape_local()

template<unsigned INITIAL_NNODE_1D>
void oomph::PRefineableQElement< 1, INITIAL_NNODE_1D >::d2shape_local ( const Vector< double > &  s,
Shape psi,
DShape dpsids,
DShape d2psids 
) const
virtual

Second derivatives of shape functions for PRefineableQElement<DIM> d2psids(i,0) = \( d^2 \psi_j / d s^2 \)

Reimplemented from oomph::FiniteElement.

923  {
924  std::ostringstream error_message;
925  error_message
926  << "\nd2shape_local currently not implemented for this element\n";
927  throw OomphLibError(
928  error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
929  }
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86

References OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

◆ dshape_local()

template<unsigned INITIAL_NNODE_1D>
void oomph::PRefineableQElement< 1, INITIAL_NNODE_1D >::dshape_local ( const Vector< double > &  s,
Shape psi,
DShape dpsi 
) const
virtual

Derivatives of shape functions for PRefineableQElement<DIM>

Reimplemented from oomph::FiniteElement.

814  {
815  switch (p_order())
816  {
817  case 2:
818  {
819  // Calculate nodal positions
821  // Call the shape functions and derivatives
822  OneDimensionalLegendreShape<2> psi1(s[0]);
823  OneDimensionalLegendreDShape<2> dpsi1ds(s[0]);
824  // Loop over shapes and copy across
825  for (unsigned i = 0; i < p_order(); i++)
826  {
827  psi(i) = psi1[i];
828  dpsi(i, 0) = dpsi1ds[i];
829  }
830 
831  break;
832  }
833  case 3:
834  {
835  // Calculate nodal positions
837  // Call the shape functions and derivatives
838  OneDimensionalLegendreShape<3> psi1(s[0]);
839  OneDimensionalLegendreDShape<3> dpsi1ds(s[0]);
840  // Loop over shapes and copy across
841  for (unsigned i = 0; i < p_order(); i++)
842  {
843  psi(i) = psi1[i];
844  dpsi(i, 0) = dpsi1ds[i];
845  }
846  break;
847  }
848  case 4:
849  {
850  // Calculate nodal positions
852  // Call the shape functions and derivatives
853  OneDimensionalLegendreShape<4> psi1(s[0]);
854  OneDimensionalLegendreDShape<4> dpsi1ds(s[0]);
855  // Loop over shapes and copy across
856  for (unsigned i = 0; i < p_order(); i++)
857  {
858  psi(i) = psi1[i];
859  dpsi(i, 0) = dpsi1ds[i];
860  }
861  break;
862  }
863  case 5:
864  {
865  // Calculate nodal positions
867  // Call the shape functions and derivatives
868  OneDimensionalLegendreShape<5> psi1(s[0]);
869  OneDimensionalLegendreDShape<5> dpsi1ds(s[0]);
870  // Loop over shapes and copy across
871  for (unsigned i = 0; i < p_order(); i++)
872  {
873  psi(i) = psi1[i];
874  dpsi(i, 0) = dpsi1ds[i];
875  }
876  break;
877  }
878  case 6:
879  {
880  // Calculate nodal positions
882  // Call the shape functions and derivatives
883  OneDimensionalLegendreShape<6> psi1(s[0]);
884  OneDimensionalLegendreDShape<6> dpsi1ds(s[0]);
885  // Loop over shapes and copy across
886  for (unsigned i = 0; i < p_order(); i++)
887  {
888  psi(i) = psi1[i];
889  dpsi(i, 0) = dpsi1ds[i];
890  }
891  break;
892  }
893  case 7:
894  {
895  // Calculate nodal positions
897  // Call the shape functions and derivatives
898  OneDimensionalLegendreShape<7> psi1(s[0]);
899  OneDimensionalLegendreDShape<7> dpsi1ds(s[0]);
900  // Loop over shapes and copy across
901  for (unsigned i = 0; i < p_order(); i++)
902  {
903  psi(i) = psi1[i];
904  dpsi(i, 0) = dpsi1ds[i];
905  }
906  break;
907  }
908  default:
909  oomph_info
910  << "\n ERROR: PRefineableQElement::dshape_local() exceeded maximum";
911  oomph_info << "\n polynomial order for shape functions."
912  << std::endl;
913  }
914  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
static void calculate_nodal_positions()
Static function used to populate the stored positions.
Definition: shape.h:1241
unsigned & p_order()
Access function to P_order.
Definition: refineable_elements.h:705
RealScalar s
Definition: level1_cplx_impl.h:130
OomphInfo oomph_info
Definition: oomph_definitions.cc:319

References oomph::OneDimensionalLegendreShape< NNODE_1D >::calculate_nodal_positions(), i, oomph::oomph_info, and s.

◆ further_setup_hanging_nodes()

template<unsigned INITIAL_NNODE_1D>
void oomph::PRefineableQElement< 1, INITIAL_NNODE_1D >::further_setup_hanging_nodes ( )
inlinevirtual

Perform additional hanging node procedures for variables that are not interpolated by all nodes (e.g. lower order interpolations for the pressure in Taylor Hood).

Reimplemented from oomph::RefineableElement.

90 {}

◆ get_node_at_local_coordinate()

template<unsigned INITIAL_NNODE_1D>
Node * oomph::PRefineableQElement< 1, INITIAL_NNODE_1D >::get_node_at_local_coordinate ( const Vector< double > &  s) const
virtual

Return the node at the specified local coordinate.

Reimplemented from oomph::FiniteElement.

137  {
138  // Load the tolerance into a local variable
140  // There is one possible index.
141  Vector<int> index(1);
142 
143  // Determine the index
144  // -------------------
145 
146  // If we are at the lower limit, the index is zero
147  if (std::fabs(s[0] + 1.0) < tol)
148  {
149  index[0] = 0;
150  }
151  // If we are at the upper limit, the index is the number of nodes minus 1
152  else if (std::fabs(s[0] - 1.0) < tol)
153  {
154  index[0] = this->nnode_1d() - 1;
155  }
156  // Otherwise, we have to calculate the index in general
157  else
158  {
159  // Compute Gauss-Lobatto-Legendre node positions
160  Vector<double> z;
161  Orthpoly::gll_nodes(this->nnode_1d(), z);
162  // Loop over possible internal nodal positions
163  for (unsigned n = 1; n < this->nnode_1d() - 1; n++)
164  {
165  if (std::fabs(z[n] - s[0]) < tol)
166  {
167  index[0] = n;
168  break;
169  }
170  }
171  // No matching nodes
172  return 0;
173  }
174  // If we've got here we have a node, so let's return a pointer to it
175  return this->node_pt(index[0]);
176  }
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Definition: elements.h:2175
static const double Node_location_tolerance
Definition: elements.h:1374
unsigned nnode_1d() const
Definition: hp_refineable_elements.h:95
Real fabs(const Real &a)
Definition: boostmultiprec.cpp:117
void gll_nodes(const unsigned &Nnode, Vector< double > &x)
Calculates the Gauss Lobatto Legendre abscissas for degree p = NNode-1.
Definition: orthpoly.cc:33

References boost::multiprecision::fabs(), oomph::Orthpoly::gll_nodes(), n, oomph::FiniteElement::Node_location_tolerance, and s.

Referenced by p_refine().

◆ initial_p_order()

template<unsigned INITIAL_NNODE_1D>
unsigned oomph::PRefineableQElement< 1, INITIAL_NNODE_1D >::initial_p_order ( ) const
inlinevirtual

Get the initial P_order.

Implements oomph::PRefineableElement.

102  {
103  return INITIAL_NNODE_1D;
104  }

◆ initial_setup()

template<unsigned INITIAL_NNODE_1D>
void oomph::PRefineableQElement< 1, INITIAL_NNODE_1D >::initial_setup ( Tree *const &  adopted_father_pt = 0,
const unsigned initial_p_order = 0 
)
virtual

Initial setup of element (set the correct p-order and integration scheme) If an adopted father is specified, information from this is used instead of using the father found from the tree.

Set the correct p-order of the element based on that of its father. Then construct an integration scheme of the correct order. If an adopted father is specified, information from this is used instead of using the father found from the tree.

Reimplemented from oomph::RefineableElement.

203  {
204  // Storage for pointer to my father (in binarytree impersonation)
205  BinaryTree* father_pt = 0;
206 
207  // Check if an adopted father has been specified
208  if (adopted_father_pt != 0)
209  {
210  // Get pointer to my father (in binarytree impersonation)
211  father_pt = dynamic_cast<BinaryTree*>(adopted_father_pt);
212  }
213  // Check if element is in a tree
214  else if (Tree_pt != 0)
215  {
216  // Get pointer to my father (in binarytree impersonation)
217  father_pt = dynamic_cast<BinaryTree*>(binary_tree_pt()->father_pt());
218  }
219  // else
220  // {
221  // throw OomphLibError(
222  // "Element not in a tree, and no adopted father has been
223  // specified!", OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
224  // }
225 
226  // Check if element has father
227  if (father_pt != 0 || initial_p_order != 0)
228  {
229  if (father_pt != 0)
230  {
231  PRefineableQElement<1, INITIAL_NNODE_1D>* father_el_pt =
232  dynamic_cast<PRefineableQElement<1, INITIAL_NNODE_1D>*>(
233  father_pt->object_pt());
234  if (father_el_pt != 0)
235  {
236  unsigned father_p_order = father_el_pt->p_order();
237  // Set p-order to that of father
238  P_order = father_p_order;
239  }
240  }
241  else
242  {
244  }
245 
246  // Now sort out the element...
247  // (has p nodes)
248  unsigned new_n_node = P_order;
249 
250  // Allocate new space for Nodes (at the element level)
251  this->set_n_node(new_n_node);
252 
253  // Set integration scheme
254  delete this->integral_pt();
255  switch (P_order)
256  {
257  case 2:
258  this->set_integration_scheme(new GaussLobattoLegendre<1, 2>);
259  break;
260  case 3:
261  this->set_integration_scheme(new GaussLobattoLegendre<1, 3>);
262  break;
263  case 4:
264  this->set_integration_scheme(new GaussLobattoLegendre<1, 4>);
265  break;
266  case 5:
267  this->set_integration_scheme(new GaussLobattoLegendre<1, 5>);
268  break;
269  case 6:
270  this->set_integration_scheme(new GaussLobattoLegendre<1, 6>);
271  break;
272  case 7:
273  this->set_integration_scheme(new GaussLobattoLegendre<1, 7>);
274  break;
275  default:
276  std::ostringstream error_message;
277  error_message << "\nERROR: Exceeded maximum polynomial order for";
278  error_message << "\n integration scheme.\n";
279  throw OomphLibError(error_message.str(),
282  }
283  }
284  }
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
Definition: elements.h:1963
void set_n_node(const unsigned &n)
Definition: elements.h:1404
virtual void set_integration_scheme(Integral *const &integral_pt)
Set the spatial integration scheme.
Definition: elements.cc:3210
unsigned P_order
The polynomial expansion order of the elemental basis functions.
Definition: refineable_elements.h:655
unsigned initial_p_order() const
Get the initial P_order.
Definition: hp_refineable_elements.h:101
Tree * Tree_pt
A pointer to a general tree object.
Definition: refineable_elements.h:100
BinaryTree * binary_tree_pt()
Pointer to binary tree representation of this element.
Definition: refineable_line_element.h:144
Tree * father_pt() const
Return pointer to father: NULL if it's a root node.
Definition: tree.h:235

References oomph::Tree::object_pt(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, and oomph::PRefineableElement::p_order().

◆ local_coordinate_of_node()

template<unsigned INITIAL_NNODE_1D>
void oomph::PRefineableQElement< 1, INITIAL_NNODE_1D >::local_coordinate_of_node ( const unsigned n,
Vector< double > &  s 
) const
virtual

Get local coordinates of node j in the element; vector sets its own size.

Reimplemented from oomph::FiniteElement.

44  {
45  s.resize(1);
46 
47  switch (this->nnode_1d())
48  {
49  case 2:
52  break;
53  case 3:
56  break;
57  case 4:
60  break;
61  case 5:
64  break;
65  case 6:
68  break;
69  case 7:
72  break;
73  default:
74  oomph_info << "\n ERROR: Exceeded maximum polynomial order for";
75  oomph_info << "\n shape functions." << std::endl;
76  break;
77  }
78  }
static double nodal_position(const unsigned &n)
Definition: shape.h:1250

References oomph::OneDimensionalLegendreShape< NNODE_1D >::calculate_nodal_positions(), n, oomph::OneDimensionalLegendreShape< NNODE_1D >::nodal_position(), oomph::oomph_info, and s.

◆ local_fraction_of_node()

template<unsigned INITIAL_NNODE_1D>
void oomph::PRefineableQElement< 1, INITIAL_NNODE_1D >::local_fraction_of_node ( const unsigned n,
Vector< double > &  s_fraction 
)
virtual

Get the local fractino of node j in the element.

Reimplemented from oomph::FiniteElement.

84  {
85  this->local_coordinate_of_node(n, s_fraction);
86  s_fraction[0] = 0.5 * (s_fraction[0] + 1.0);
87  }
void local_coordinate_of_node(const unsigned &n, Vector< double > &s) const
Get local coordinates of node j in the element; vector sets its own size.
Definition: hp_refineable_elements.cc:42

References n.

◆ local_one_d_fraction_of_node()

template<unsigned INITIAL_NNODE_1D>
double oomph::PRefineableQElement< 1, INITIAL_NNODE_1D >::local_one_d_fraction_of_node ( const unsigned n1d,
const unsigned i 
)
virtual

The local one-d fraction is the same.

Reimplemented from oomph::FiniteElement.

92  {
93  switch (this->nnode_1d())
94  {
95  case 2:
97  return 0.5 *
99  case 3:
101  return 0.5 *
103  case 4:
105  return 0.5 *
107  case 5:
109  return 0.5 *
111  case 6:
113  return 0.5 *
115  case 7:
117  return 0.5 *
119  default:
120  std::ostringstream error_message;
121  error_message << "\nERROR: Exceeded maximum polynomial order for";
122  error_message << "\n shape functions.\n";
123  throw OomphLibError(error_message.str(),
126  return 0.0;
127  }
128  }

References oomph::OneDimensionalLegendreShape< NNODE_1D >::calculate_nodal_positions(), oomph::OneDimensionalLegendreShape< NNODE_1D >::nodal_position(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

◆ nnode_1d()

template<unsigned INITIAL_NNODE_1D>
unsigned oomph::PRefineableQElement< 1, INITIAL_NNODE_1D >::nnode_1d ( ) const
inlinevirtual

Returns the number of nodes along each edge of the element. Overloaded to return the (variable) p-order rather than the template argument.

Reimplemented from oomph::FiniteElement.

96  {
97  return this->p_order();
98  }

◆ node_created_by_son_of_neighbour()

template<unsigned INITIAL_NNODE_1D>
Node * oomph::PRefineableQElement< 1, INITIAL_NNODE_1D >::node_created_by_son_of_neighbour ( const Vector< double > &  s_fraction,
bool is_periodic 
)

If a neighbouring element's son has already created a node at a position corresponding to the local fractional position within the present element, s_fraction, return a pointer to that node. If not, return NULL (0). If the node is periodic the flag is_periodic will be true

189  {
190  // Not possible in 1D case, so return null pointer
191  return 0;
192  }

◆ p_refine()

template<unsigned INITIAL_NNODE_1D>
void oomph::PRefineableQElement< 1, INITIAL_NNODE_1D >::p_refine ( const int inc,
Mesh *const &  mesh_pt,
GeneralisedElement *const &  clone_pt 
)
virtual

p-refine the element (refine if inc>0, unrefine if inc<0).

p-refine the element inc times. (If inc<0 then p-unrefinement is performed.)

Implements oomph::PRefineableElement.

329  {
330  // Cast clone to correct type
331  PRefineableQElement<1, INITIAL_NNODE_1D>* clone_el_pt =
332  dynamic_cast<PRefineableQElement<1, INITIAL_NNODE_1D>*>(clone_pt);
333 
334  // Check if we can use it
335  if (clone_el_pt == 0)
336  {
337  throw OomphLibError(
338  "Cloned copy must be a PRefineableQElement<1,INITIAL_NNODE_1D>!",
341  }
342 #ifdef PARANOID
343  // Clone exists, so check that it is infact a copy of me
344  else
345  {
346  // Flag to keep track of check
347  bool clone_is_ok = true;
348 
349  // Does the clone have the correct p-order?
350  clone_is_ok = clone_is_ok && (clone_el_pt->p_order() == this->p_order());
351 
352  if (!clone_is_ok)
353  {
354  std::ostringstream err_stream;
355  err_stream << "Clone element has a different p-order from me,"
356  << std::endl
357  << "but it is supposed to be a copy!" << std::endl;
358 
359  throw OomphLibError(
361  }
362 
363  // Does the clone have the same number of nodes as me?
364  clone_is_ok = clone_is_ok && (clone_el_pt->nnode() == this->nnode());
365 
366  if (!clone_is_ok)
367  {
368  std::ostringstream err_stream;
369  err_stream << "Clone element has a different number of nodes from me,"
370  << std::endl
371  << "but it is supposed to be a copy!" << std::endl;
372 
373  throw OomphLibError(
375  }
376 
377  // Does the clone have the same nodes as me?
378  for (unsigned n = 0; n < this->nnode(); n++)
379  {
380  clone_is_ok =
381  clone_is_ok && (clone_el_pt->node_pt(n) == this->node_pt(n));
382  }
383 
384  if (!clone_is_ok)
385  {
386  std::ostringstream err_stream;
387  err_stream << "The nodes belonging to the clone element are different"
388  << std::endl
389  << "from mine, but it is supposed to be a copy!"
390  << std::endl;
391 
392  throw OomphLibError(
394  }
395 
396  // If we get to here then the clone has all the information we require
397  }
398 #endif
399 
400  // Currently we can't handle the case of generalised coordinates
401  // since we haven't established how they should be interpolated.
402  // Buffer this case:
403  if (clone_el_pt->node_pt(0)->nposition_type() != 1)
404  {
405  throw OomphLibError("Can't handle generalised nodal positions (yet).",
408  }
409 
410  // Timestepper should be the same for all nodes -- use it
411  // to create timesteppers for new nodes
412  TimeStepper* time_stepper_pt = this->node_pt(0)->time_stepper_pt();
413 
414  // Get number of history values (incl. present)
415  unsigned ntstorage = time_stepper_pt->ntstorage();
416 
417  // Increment p-order of the element
418  P_order += inc;
419 
420  // Change integration scheme
421  delete this->integral_pt();
422  switch (P_order)
423  {
424  case 2:
425  this->set_integration_scheme(new GaussLobattoLegendre<1, 2>);
426  break;
427  case 3:
428  this->set_integration_scheme(new GaussLobattoLegendre<1, 3>);
429  break;
430  case 4:
431  this->set_integration_scheme(new GaussLobattoLegendre<1, 4>);
432  break;
433  case 5:
434  this->set_integration_scheme(new GaussLobattoLegendre<1, 5>);
435  break;
436  case 6:
437  this->set_integration_scheme(new GaussLobattoLegendre<1, 6>);
438  break;
439  case 7:
440  this->set_integration_scheme(new GaussLobattoLegendre<1, 7>);
441  break;
442  default:
443  std::ostringstream error_message;
444  error_message << "\nERROR: Exceeded maximum polynomial order for";
445  error_message << "\n integration scheme.\n";
446  throw OomphLibError(error_message.str(),
449  }
450 
451  // Allocate new space for Nodes (at the element level)
452  this->set_n_node(P_order);
453 
454  // Copy vertex nodes and create new internal nodes
455  //------------------------------------------------
456 
457  // Setup vertex coordinates in element:
458  //-------------------------------------
459  Vector<double> s_left(1);
460  Vector<double> s_right(1);
461  s_left[0] = -1.0;
462  s_right[0] = 1.0;
463 
464  // Local coordinate in element
465  Vector<double> s(1);
466 
467  Vector<double> s_fraction(1);
468  // Loop over all nodes in the element
469  for (unsigned n = 0; n < P_order; n++)
470  {
471  // Get the fractional position (in the current element) of the node
472  // in the direction of s[0]
473  s_fraction[0] = this->local_one_d_fraction_of_node(n, 0);
474 
475  // Evaluate the local coordinate of the node in the father element
476  s[0] = s_left[0] + (s_right[0] - s_left[0]) * s_fraction[0];
477 
478  // Initialise flag: So far, this node hasn't been built or copied yet
479  bool node_done = false;
480 
481  // Get the pointer to the node in this element (or rather, its clone),
482  // returns NULL if there is not node
483  Node* created_node_pt = clone_el_pt->get_node_at_local_coordinate(s);
484 
485  // Does this node already exist in this element?
486  //----------------------------------------------
487  if (created_node_pt != 0)
488  {
489  // Copy node across
490  this->node_pt(n) = created_node_pt;
491 
492  // Make sure that we update the values at the node so that they
493  // are consistent with the present representation. This is only
494  // needed for mixed interpolation where the value at the father
495  // could now become active.
496 
497  // Loop over all history values
498  for (unsigned t = 0; t < ntstorage; t++)
499  {
500  // Get values from father element
501  // Note: get_interpolated_values() sets Vector size itself
502  Vector<double> prev_values;
503  clone_el_pt->get_interpolated_values(t, s, prev_values);
504  // Find the minimum number of values
505  //(either those stored at the node, or those returned by
506  // the function)
507  unsigned n_val_at_node = created_node_pt->nvalue();
508  unsigned n_val_from_function = prev_values.size();
509  // Use the ternary conditional operator here
510  unsigned n_var = n_val_at_node < n_val_from_function ?
511  n_val_at_node :
512  n_val_from_function;
513  // Assign the values that we can
514  for (unsigned k = 0; k < n_var; k++)
515  {
516  created_node_pt->set_value(t, k, prev_values[k]);
517  }
518  }
519 
520  // Indicate that node has been created by copy
521  node_done = true;
522  }
523 
524  // Node does not exist in this element
525  //------------------------------------
526 
527  // If the node has not been built anywhere ---> build it here
528  if (!node_done)
529  {
530  // In a 1D mesh any node which lies on the boundary must exist in
531  // the initial (coarse) mesh, so any newly-built nodes cannot be
532  // boundary nodes. Therefore we always create a normal "bulk" node.
533 
534  // Create node and set the pointer to it from the element
535  created_node_pt = this->construct_node(n, time_stepper_pt);
536 
537  // Now we set the position and values at the newly created node
538 
539  // Now we set the position and values at the newly created node.
540  // In the first instance use macro element or FE representation
541  // to create past and present nodal positions.
542  // (THIS STEP SHOULD NOT BE SKIPPED FOR ALGEBRAIC ELEMENTS AS NOT
543  // ALL OF THEM NECESSARILY IMPLEMENT NONTRIVIAL NODE UPDATE
544  // FUNCTIONS. CALLING THE NODE UPDATE FOR SUCH ELEMENTS/NODES WILL
545  // LEAVE THEIR NODAL POSITIONS WHERE THEY WERE (THIS IS APPROPRIATE
546  // ONCE THEY HAVE BEEN GIVEN POSITIONS) BUT WILL NOT ASSIGN SENSIBLE
547  // INITIAL POSITIONS!)
548 
549  // Loop over history values
550  for (unsigned t = 0; t < ntstorage; t++)
551  {
552  // Allocate storage for the previous position of the node
553  Vector<double> x_prev(1);
554 
555  // Get position from father element -- this uses the macro
556  // element representation if appropriate.
557  clone_el_pt->get_x(t, s, x_prev);
558 
559  // Set the previous position of the new node
560  created_node_pt->x(t, 0) = x_prev[0];
561 
562  // Allocate storage for the previous values at the node
563  // NOTE: the size of this vector is equal to the number of values
564  // (e.g. 3 velocity components and 1 pressure, say)
565  // associated with each node and NOT the number of history values
566  // which the node stores!
567  Vector<double> prev_values;
568 
569  // Get values from father element
570  // Note: get_interpolated_values() sets Vector size itself.
571  clone_el_pt->get_interpolated_values(t, s, prev_values);
572 
573  // Determine the number of values at the new node
574  const unsigned n_value = created_node_pt->nvalue();
575 
576  // Loop over all values and set the previous values
577  for (unsigned v = 0; v < n_value; v++)
578  {
579  created_node_pt->set_value(t, v, prev_values[v]);
580  }
581  } // End of loop over history values
582 
583  // Add new node to mesh (if requested)
584  if (mesh_pt != 0)
585  {
586  mesh_pt->add_node_pt(created_node_pt);
587  }
588 
589  AlgebraicElementBase* alg_el_pt =
590  dynamic_cast<AlgebraicElementBase*>(this);
591 
592  // If we do have an algebraic element
593  if (alg_el_pt != 0)
594  {
595  std::string error_message = "Have not implemented p-refinement for";
596  error_message += "Algebraic p-refineable elements yet\n";
597 
598  throw OomphLibError(
599  error_message,
600  "PRefineableQElement<1,INITIAL_NNODE_1D>::p_refine()",
602  }
603 
604  } // End of case where we build the node ourselves
605 
606  // Check if the element is an algebraic element
607  AlgebraicElementBase* alg_el_pt =
608  dynamic_cast<AlgebraicElementBase*>(this);
609 
610  // If the element is an algebraic element, setup
611  // node position (past and present) from algebraic node update
612  // function. This over-writes previous assingments that
613  // were made based on the macro-element/FE representation.
614  // NOTE: YES, THIS NEEDS TO BE CALLED REPEATEDLY IF THE
615  // NODE IS MEMBER OF MULTIPLE ELEMENTS: THEY ALL ASSIGN
616  // THE SAME NODAL POSITIONS BUT WE NEED TO ADD THE REMESH
617  // INFO FOR *ALL* ROOT ELEMENTS!
618  if (alg_el_pt != 0)
619  {
620  // Build algebraic node update info for new node
621  // This sets up the node update data for all node update
622  // functions that are shared by all nodes in the father
623  // element
624  alg_el_pt->setup_algebraic_node_update(
625  this->node_pt(n), s, clone_el_pt);
626  }
627 
628  } // End of loop over all nodes in element
629 
630 
631  // If the element is a MacroElementNodeUpdateElement, set
632  // the update parameters for the current element's nodes --
633  // all this needs is the vector of (pointers to the)
634  // geometric objects that affect the MacroElement-based
635  // node update -- this needs to be done to set the node
636  // update info for newly created nodes
637  MacroElementNodeUpdateElementBase* clone_m_el_pt =
638  dynamic_cast<MacroElementNodeUpdateElementBase*>(clone_el_pt);
639  if (clone_m_el_pt != 0)
640  {
641  // Get vector of geometric objects from father (construct vector
642  // via copy operation)
643  Vector<GeomObject*> geom_object_pt(clone_m_el_pt->geom_object_pt());
644 
645  // Cast current element to MacroElementNodeUpdateElement:
646  MacroElementNodeUpdateElementBase* m_el_pt =
647  dynamic_cast<MacroElementNodeUpdateElementBase*>(this);
648 
649 #ifdef PARANOID
650  if (m_el_pt == 0)
651  {
652  std::string error_message =
653  "Failed to cast to MacroElementNodeUpdateElementBase*\n";
654  error_message +=
655  "Strange -- if my clone is a MacroElementNodeUpdateElement\n";
656  error_message += "then I should be too....\n";
657 
658  throw OomphLibError(
660  }
661 #endif
662  // Build update info by passing vector of geometric objects:
663  // This sets the current element to be the update element
664  // for all of the element's nodes -- this is reversed
665  // if the element is ever un-refined in the father element's
666  // rebuild_from_sons() function which overwrites this
667  // assignment to avoid nasty segmentation faults that occur
668  // when a node tries to update itself via an element that no
669  // longer exists...
670  m_el_pt->set_node_update_info(geom_object_pt);
671  }
672 
673 
674  // Loop over all nodes in element again, to re-set the positions
675  // This must be done using the new element's macro-element
676  // representation, rather than the old version which may be
677  // of a different p-order!
678  for (unsigned n = 0; n < P_order; n++)
679  {
680  // Get the fractional position of the node in the direction of s[0]
681  s_fraction[0] = this->local_one_d_fraction_of_node(n, 0);
682  // Local coordinate
683  s[0] = s_left[0] + (s_right[0] - s_left[0]) * s_fraction[0];
684 
685  // Loop over # of history values
686  for (unsigned t = 0; t < ntstorage; t++)
687  {
688  // Get position from father element -- this uses the macro
689  // element representation if appropriate. If the node
690  // turns out to be a hanging node later on, then
691  // its position gets adjusted in line with its
692  // hanging node interpolation.
693  Vector<double> x_prev(1);
694  this->get_x(t, s, x_prev);
695 
696  // Set previous positions of the new node
697  this->node_pt(n)->x(t, 0) = x_prev[0];
698  }
699  }
700 
701  // Not necessary to delete the old nodes since all original nodes are in the
702  // current mesh and so will be pruned as part of the mesh adaption process.
703 
704  // Do any further-build required
705  this->further_build();
706  }
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
Definition: nodes.h:238
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
Definition: nodes.h:483
virtual Node * construct_node(const unsigned &n)
Definition: elements.h:2509
unsigned nnode() const
Return the number of nodes.
Definition: elements.h:2210
void get_x(const Vector< double > &s, Vector< double > &x) const
Definition: elements.h:1885
TimeStepper *& time_stepper_pt()
Definition: geom_objects.h:192
double & x(const unsigned &i)
Return the i-th nodal coordinate.
Definition: nodes.h:1060
double local_one_d_fraction_of_node(const unsigned &n1d, const unsigned &i)
The local one-d fraction is the same.
Definition: hp_refineable_elements.cc:90
virtual void further_build()
Further build: e.g. deal with interpolation of internal values.
Definition: refineable_elements.h:599
unsigned ntstorage() const
Definition: timesteppers.h:601
char char char int int * k
Definition: level2_impl.h:374
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
t
Definition: plotPSD.py:36

References oomph::Mesh::add_node_pt(), oomph::MacroElementNodeUpdateElementBase::geom_object_pt(), oomph::RefineableElement::get_interpolated_values(), get_node_at_local_coordinate(), oomph::FiniteElement::get_x(), k, n, oomph::FiniteElement::nnode(), oomph::FiniteElement::node_pt(), oomph::Node::nposition_type(), oomph::TimeStepper::ntstorage(), oomph::Data::nvalue(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::PRefineableElement::p_order(), s, oomph::MacroElementNodeUpdateElementBase::set_node_update_info(), oomph::Data::set_value(), oomph::AlgebraicElementBase::setup_algebraic_node_update(), oomph::Global_string_for_annotation::string(), plotPSD::t, v, and oomph::Node::x().

◆ pre_build()

template<unsigned INITIAL_NNODE_1D>
void oomph::PRefineableQElement< 1, INITIAL_NNODE_1D >::pre_build ( Mesh *&  mesh_pt,
Vector< Node * > &  new_node_pt 
)
virtual

Pre-build (search father for required nodes which may already exist)

Check the father element for any required nodes which already exist

Reimplemented from oomph::RefineableElement.

293  {
294  /*
295  //Pointer to my father (in binarytree impersonation)
296  BinaryTree* father_pt =
297  dynamic_cast<BinaryTree*>(binary_tree_pt()->father_pt());
298 
299  // Check if element has father
300  if (father_pt!=0)
301  {
302  PRefineableQElement<1>* father_el_pt =
303  dynamic_cast<PRefineableQElement<1>*>
304  (this->tree_pt()->father_pt()->object_pt());
305  if (father_el_pt!=0)
306  {
307  // Pre-build actions
308  //??
309  }
310  else
311  {
312  std::ostringstream error_message;
313  error_message <<"\nERROR: Dynamic cast failed!\n";
314  throw OomphLibError(error_message.str(),
315  OOMPH_CURRENT_FUNCTION,
316  OOMPH_EXCEPTION_LOCATION);
317  }
318  }
319  */
320  }

◆ rebuild_from_sons()

template<unsigned INITIAL_NNODE_1D>
void oomph::PRefineableQElement< 1, INITIAL_NNODE_1D >::rebuild_from_sons ( Mesh *&  mesh_pt)
virtual

Rebuild the element. This needs to find any nodes in the sons which are still required.

Rebuild the element from nodes found in its sons Adjusts its p-order to be the maximum of its sons' p-orders

Implements oomph::RefineableElement.

948  {
949  // Get p-orders of sons
950  unsigned n_sons = this->tree_pt()->nsons();
951  Vector<unsigned> son_p_order(n_sons);
952  unsigned max_son_p_order = 0;
953  for (unsigned ison = 0; ison < n_sons; ison++)
954  {
955  PRefineableElement* el_pt = dynamic_cast<PRefineableElement*>(
956  this->tree_pt()->son_pt(ison)->object_pt());
957  son_p_order[ison] = el_pt->p_order();
958  if (son_p_order[ison] > max_son_p_order)
959  max_son_p_order = son_p_order[ison];
960  }
961 
962  unsigned old_Nnode = this->nnode();
963  unsigned old_P_order = this->p_order();
964  // Set p-order of the element
965  this->p_order() = max_son_p_order;
966 
967  // Change integration scheme
968  delete this->integral_pt();
969  switch (this->p_order())
970  {
971  case 2:
972  this->set_integration_scheme(new GaussLobattoLegendre<1, 2>);
973  break;
974  case 3:
975  this->set_integration_scheme(new GaussLobattoLegendre<1, 3>);
976  break;
977  case 4:
978  this->set_integration_scheme(new GaussLobattoLegendre<1, 4>);
979  break;
980  case 5:
981  this->set_integration_scheme(new GaussLobattoLegendre<1, 5>);
982  break;
983  case 6:
984  this->set_integration_scheme(new GaussLobattoLegendre<1, 6>);
985  break;
986  case 7:
987  this->set_integration_scheme(new GaussLobattoLegendre<1, 7>);
988  break;
989  default:
990  std::ostringstream error_message;
991  error_message << "\nERROR: Exceeded maximum polynomial order for";
992  error_message << "\n integration scheme.\n";
993  throw OomphLibError(error_message.str(),
996  }
997 
998  // Back up pointers to old nodes before they are lost
999  Vector<Node*> old_node_pt(old_Nnode);
1000  for (unsigned n = 0; n < old_Nnode; n++)
1001  {
1002  old_node_pt[n] = this->node_pt(n);
1003  }
1004 
1005  // Allocate new space for Nodes (at the element level)
1006  this->set_n_node(this->p_order());
1007 
1008  // Copy vertex nodes and create new edge and internal nodes
1009  //---------------------------------------------------------
1010 
1011  // Copy vertex nodes
1012  this->node_pt(0) = old_node_pt[0];
1013  this->node_pt(this->p_order() - 1) = old_node_pt[old_P_order - 1];
1014 
1015 
1016  //=============================================================
1017  // Below this line is copied from RefineableQSpectralElement<2>
1018 
1019  // The timestepper should be the same for all nodes and node 0 should
1020  // never be deleted.
1021  if (this->node_pt(0) == 0)
1022  {
1023  throw OomphLibError("The vertex node (0) does not exist",
1026  }
1027 
1028  TimeStepper* time_stepper_pt = this->node_pt(0)->time_stepper_pt();
1029 
1030  // Determine number of history values stored
1031  const unsigned ntstorage = time_stepper_pt->ntstorage();
1032 
1033  // Allocate storage for local coordinates
1034  Vector<double> s_fraction(1), s(1);
1035 
1036  // Determine the number of nodes in the element
1037  const unsigned n_node = this->nnode_1d();
1038 
1039  // Loop over the nodes in the element
1040  for (unsigned n = 0; n < n_node; n++)
1041  {
1042  // Get the fractional position of the node in the direction of s[0]
1043  s_fraction[0] = this->local_one_d_fraction_of_node(n, 0);
1044 
1045  // Determine the local coordinate in the father element
1046  s[0] = -1.0 + 2.0 * s_fraction[0];
1047 
1048  // If the node has not been built
1049  if (this->node_pt(n) == 0)
1050  {
1051  // Has the node been created by one of its neighbours?
1052  bool is_periodic = false;
1053  Node* created_node_pt =
1054  this->node_created_by_neighbour(s_fraction, is_periodic);
1055 
1056  // If it has, set the pointer
1057  if (created_node_pt != 0)
1058  {
1059  // If the node is periodic
1060  if (is_periodic)
1061  {
1062  throw OomphLibError("Cannot handle periodic nodes yet",
1065  }
1066  // Non-periodic case, just set the pointer
1067  else
1068  {
1069  this->node_pt(n) = created_node_pt;
1070  }
1071  }
1072  // Otherwise, we need to build it
1073  else
1074  {
1075  // First, find the son element in which the node should live
1076 
1077  // Find coordinate in the son
1078  Vector<double> s_in_son(1);
1079  using namespace BinaryTreeNames;
1080  int son = -10;
1081  // If s_fraction is between 0 and 0.5, we are in the left son
1082  if (s_fraction[0] < 0.5)
1083  {
1084  son = L;
1085  s_in_son[0] = -1.0 + 4.0 * s_fraction[0];
1086  }
1087  // Otherwise we are in the right son
1088  else
1089  {
1090  son = R;
1091  s_in_son[0] = -1.0 + 4.0 * (s_fraction[0] - 0.5);
1092  }
1093 
1094  // Get the pointer to the son element in which the new node
1095  // would live
1096  PRefineableQElement<1, INITIAL_NNODE_1D>* son_el_pt =
1097  dynamic_cast<PRefineableQElement<1, INITIAL_NNODE_1D>*>(
1098  this->tree_pt()->son_pt(son)->object_pt());
1099 
1100  // In 1D we should never be rebuilding an element's vertex nodes
1101  // (since they will never be deleted), so throw an error if we
1102  // appear to be doing so
1103 #ifdef PARANOID
1104  if (n == 0 || n == n_node - 1)
1105  {
1106  std::string error_message =
1107  "I am trying to rebuild one of the (two) vertex nodes in\n";
1108  error_message +=
1109  "this 1D element. It should not have been possible to delete\n";
1110  error_message += "either of these!\n";
1111 
1112  throw OomphLibError(
1114  }
1115 #endif
1116 
1117  // With this in mind we will always be creating normal "bulk" nodes
1118  this->node_pt(n) = this->construct_node(n, time_stepper_pt);
1119 
1120  // Now we set the position and values at the newly created node
1121 
1122  // In the first instance use macro element or FE representation
1123  // to create past and present nodal positions.
1124  // (THIS STEP SHOULD NOT BE SKIPPED FOR ALGEBRAIC ELEMENTS AS NOT
1125  // ALL OF THEM NECESSARILY IMPLEMENT NONTRIVIAL NODE UPDATE
1126  // FUNCTIONS. CALLING THE NODE UPDATE FOR SUCH ELEMENTS/NODES WILL
1127  // LEAVE THEIR NODAL POSITIONS WHERE THEY WERE (THIS IS APPROPRIATE
1128  // ONCE THEY HAVE BEEN GIVEN POSITIONS) BUT WILL NOT ASSIGN SENSIBLE
1129  // INITIAL POSITIONS!)
1130 
1131  // Loop over history values
1132  for (unsigned t = 0; t < ntstorage; t++)
1133  {
1134  // Allocate storage for the previous position of the node
1135  Vector<double> x_prev(1);
1136 
1137  // Get position from son element -- this uses the macro element
1138  // representation if appropriate
1139  son_el_pt->get_x(t, s_in_son, x_prev);
1140 
1141  // Set the previous position of the new node
1142  this->node_pt(n)->x(t, 0) = x_prev[0];
1143 
1144  // Allocate storage for the previous values at the node
1145  // NOTE: the size of this vector is equal to the number of values
1146  // (e.g. 3 velocity components and 1 pressure, say)
1147  // associated with each node and NOT the number of history values
1148  // which the node stores!
1149  Vector<double> prev_values;
1150 
1151  // Get values from son element
1152  // Note: get_interpolated_values() sets Vector size itself.
1153  son_el_pt->get_interpolated_values(t, s_in_son, prev_values);
1154 
1155  // Determine the number of values at the new node
1156  const unsigned n_value = this->node_pt(n)->nvalue();
1157 
1158  // Loop over all values and set the previous values
1159  for (unsigned v = 0; v < n_value; v++)
1160  {
1161  this->node_pt(n)->set_value(t, v, prev_values[v]);
1162  }
1163  } // End of loop over history values
1164 
1165  // Add new node to mesh
1166  mesh_pt->add_node_pt(this->node_pt(n));
1167 
1168  } // End of case where we build the node ourselves
1169 
1170  } // End of if this node has not been built
1171  } // End of loop over nodes in element
1172 
1173  // Check if the element is an algebraic element
1174  // This is done on all nodes in the element after reconstruction
1175  // rather than as the nodes are built
1176  AlgebraicElementBase* alg_el_pt = dynamic_cast<AlgebraicElementBase*>(this);
1177 
1178  // If so, throw error
1179  if (alg_el_pt != 0)
1180  {
1181  std::string error_message =
1182  "Have not implemented rebuilding from sons for";
1183  error_message += "Algebraic p-refineable elements yet\n";
1184 
1185  throw OomphLibError(
1186  error_message,
1187  "PRefineableQElement<1,INITIAL_NNODE_1D>::rebuild_from_sons()",
1189  }
1190  }
MatrixXd L
Definition: LLT_example.cpp:6
@ R
Definition: StatisticsVector.h:21
void set_value(const unsigned &i, const double &value_)
Definition: nodes.h:271
Tree * tree_pt()
Access function: Pointer to quadtree representation of this element.
Definition: refineable_elements.h:211
Node * node_created_by_neighbour(const Vector< double > &s_fraction, bool &is_periodic)
Definition: refineable_line_element.cc:91
RefineableElement * object_pt() const
Definition: tree.h:88
unsigned nsons() const
Return number of sons (zero if it's a leaf node)
Definition: tree.h:129
Tree * son_pt(const int &son_index) const
Definition: tree.h:103

References oomph::Mesh::add_node_pt(), oomph::RefineableElement::get_interpolated_values(), oomph::FiniteElement::get_x(), L, n, oomph::TimeStepper::ntstorage(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::PRefineableElement::p_order(), R, s, oomph::Global_string_for_annotation::string(), plotPSD::t, and v.

◆ shape()

template<unsigned INITIAL_NNODE_1D>
void oomph::PRefineableQElement< 1, INITIAL_NNODE_1D >::shape ( const Vector< double > &  s,
Shape psi 
) const
virtual

Overload the shape functions.

Shape functions for PRefineableQElement<DIM>

Implements oomph::FiniteElement.

714  {
715  switch (p_order())
716  {
717  case 2:
718  {
719  // Calculate nodal positions
721  // Create one-dim shape functions
722  OneDimensionalLegendreShape<2> psi1(s[0]);
723  // Now let's loop over the nodal points in the element
724  // and copy the values back in
725  for (unsigned i = 0; i < p_order(); i++)
726  {
727  psi(i) = psi1[i];
728  }
729  break;
730  }
731  case 3:
732  {
733  // Calculate nodal positions
735  // Create one-dim shape functions
736  OneDimensionalLegendreShape<3> psi1(s[0]);
737  // Now let's loop over the nodal points in the element
738  // and copy the values back in
739  for (unsigned i = 0; i < p_order(); i++)
740  {
741  psi(i) = psi1[i];
742  }
743  break;
744  }
745  case 4:
746  {
747  // Calculate nodal positions
749  // Create one-dim shape functions
750  OneDimensionalLegendreShape<4> psi1(s[0]);
751  // Now let's loop over the nodal points in the element
752  // and copy the values back in
753  for (unsigned i = 0; i < p_order(); i++)
754  {
755  psi(i) = psi1[i];
756  }
757  break;
758  }
759  case 5:
760  {
761  // Calculate nodal positions
763  // Create one-dim shape functions
764  OneDimensionalLegendreShape<5> psi1(s[0]);
765  // Now let's loop over the nodal points in the element
766  // and copy the values back in
767  for (unsigned i = 0; i < p_order(); i++)
768  {
769  psi(i) = psi1[i];
770  }
771  break;
772  }
773  case 6:
774  {
775  // Calculate nodal positions
777  // Create one-dim shape functions
778  OneDimensionalLegendreShape<6> psi1(s[0]);
779  // Now let's loop over the nodal points in the element
780  // and copy the values back in
781  for (unsigned i = 0; i < p_order(); i++)
782  {
783  psi(i) = psi1[i];
784  }
785  break;
786  }
787  case 7:
788  {
789  // Calculate nodal positions
791  // Create one-dim shape functions
792  OneDimensionalLegendreShape<7> psi1(s[0]);
793  // Now let's loop over the nodal points in the element
794  // and copy the values back in
795  for (unsigned i = 0; i < p_order(); i++)
796  {
797  psi(i) = psi1[i];
798  }
799  break;
800  }
801  default:
802  oomph_info << "\n ERROR: PRefineableQElement::shape() exceeded maximum";
803  oomph_info << "\n polynomial order for shape functions."
804  << std::endl;
805  }
806  }

References oomph::OneDimensionalLegendreShape< NNODE_1D >::calculate_nodal_positions(), i, oomph::oomph_info, and s.


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