30 #ifndef OOMPH_ALGEBRAIC_ELEMENTS_HEADER 31 #define OOMPH_ALGEBRAIC_ELEMENTS_HEADER 45 class AlgebraicElementBase;
46 class DummyAlgebraicMesh;
74 const unsigned &n_position_type,
75 const unsigned &initial_nvalue) :
76 Node(n_dim,n_position_type,initial_nvalue)
96 const unsigned &n_dim,
97 const unsigned &n_position_type,
98 const unsigned &initial_nvalue) :
99 Node(time_stepper_pt,n_dim,n_position_type,initial_nvalue)
147 void node_update(
const bool& update_all_time_levels_for_new_node=
false);
176 typedef std::map<int,AlgebraicMesh* >::iterator IT;
179 id.push_back(it->first);
293 const bool& called_from_constructor=
false)
298 if (!called_from_constructor)
300 std::ostringstream error_message;
302 <<
"\nNegative ID, " <<
id 303 <<
", only allowed if called from constructor and\n" 304 <<
"indicated as such by optional boolean flag." 307 OOMPH_CURRENT_FUNCTION,
308 OOMPH_EXCEPTION_LOCATION);
325 Mesh_pt.insert(std::make_pair(
id,mesh_pt));
327 Ref_value.insert(std::make_pair(
id,ref_value));
364 Mesh_pt.insert(std::make_pair(
id,mesh_pt));
366 Ref_value.insert(std::make_pair(
id,ref_value));
411 std::ostringstream error_message;
413 "There is no reference mesh for node update fct id" <<
id << std::endl;
415 OOMPH_CURRENT_FUNCTION,
416 OOMPH_EXCEPTION_LOCATION);
425 std::ostringstream error_message;
427 "There is no Geom_object_pt for node update fct id" <<
id << std::endl;
429 OOMPH_CURRENT_FUNCTION,
430 OOMPH_EXCEPTION_LOCATION);
437 if (Default_it_ref_value==
Ref_value.end())
439 std::ostringstream error_message;
441 "There is no Ref_value for node update fct id" <<
id << std::endl;
443 OOMPH_CURRENT_FUNCTION,
444 OOMPH_EXCEPTION_LOCATION);
472 std::map<int,Vector<GeomObject*> >::iterator
477 std::map<int,Vector<double> >::iterator
544 void setup_algebraic_node_update(
Node*& node_pt,
562 template<
class ELEMENT>
579 const int &face_index) :
581 element_pt,face_index),
609 template<
class ELEMENT>
645 add_geom_object_list_pt(0);
668 if(!dynamic_cast<AlgebraicNode*>(Node_pt[n]))
670 std::ostringstream error_stream;
671 error_stream <<
"Error: Node " << n <<
"is a " 672 <<
typeid(Node_pt[n]).name()
673 <<
", not an AlgebraicNode" << std::endl;
675 OOMPH_CURRENT_FUNCTION,
676 OOMPH_EXCEPTION_LOCATION);
680 return (dynamic_cast<AlgebraicNode*>(Node_pt[n]));
686 virtual void algebraic_node_update(
const unsigned&
t,
702 if (update_all_solid_nodes)
705 "Doesn't make sense to use an AlgebraicMesh with\n";
707 "SolidElements so specifying update_all_solid_nodes=true\n";
708 error_message +=
"doesn't make sense either\n";
711 OOMPH_CURRENT_FUNCTION,
712 OOMPH_EXCEPTION_LOCATION);
719 unsigned n_node=nnode();
724 for (
unsigned n=0;n<n_node;n++)
731 unsigned n_dim = alg_nod_pt->
ndim();
735 for (
unsigned n=0;n<n_node;n++)
737 Node* nod_pt=node_pt(n);
742 for (
unsigned i=0;
i<n_dim;
i++)
749 for (
unsigned imaster=0;imaster<nmaster;imaster++)
752 for (
unsigned i=0;
i<n_dim;
i++)
755 master_node_pt(imaster)->x(
i)*
761 for (
unsigned i=0;
i<n_dim;
i++)
774 External_halo_node_pt.begin();it!=External_halo_node_pt.end();it++)
776 int iproc=(*it).first;
778 unsigned n_ext_halo_node=nexternal_halo_node(iproc);
780 if (n_ext_halo_node>0)
782 for (
unsigned n=0;n<n_ext_halo_node;n++)
785 (external_halo_node_pt(iproc,n));
790 unsigned n_dim = alg_nod_pt->
ndim();
794 for (
unsigned n=0;n<n_ext_halo_node;n++)
796 Node* nod_pt=external_halo_node_pt(iproc,n);
801 for (
unsigned i=0;
i<n_dim;
i++)
808 for (
unsigned imaster=0;imaster<nmaster;imaster++)
811 for (
unsigned i=0;
i<n_dim;
i++)
814 master_node_pt(imaster)->x(
i)*
820 for (
unsigned i=0;
i<n_dim;
i++)
847 unsigned n_node=nnode();
848 for (
unsigned n=0;n<n_node;n++)
850 if (static_cast<AlgebraicNode*>(node_pt(n))->
self_test()!=0)
856 oomph_info <<
"Done algnode selftest in mesh" << std::endl;
859 if (passed) {
return 0;}
869 Geom_object_list_pt.push_back(geom_object_pt);
875 return Geom_object_list_pt.size();
882 return Geom_object_list_pt[
i];
AlgebraicElement()
Constructor – simply calls the constructor of the underlying ELEMENT.
~AlgebraicElement()
Broken assignment operator.
void node_update(const bool &update_all_time_levels_for_new_node=false)
Broken assignment operator.
AlgebraicNode * node_pt(const unsigned long &n)
Return a pointer to the n-th global AlgebraicNode.
void add_node_update_info(AlgebraicMesh *mesh_pt, const Vector< GeomObject *> &geom_object_pt, const Vector< double > &ref_value)
Add algebraic update information for node: Which Mesh implements the update operation? Also, pass the vector of geometric objects and the vectors of reference values that are needed for the update operation. We're assigning a default node update fct id of 0.
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
GeomObject * geom_object_pt(const unsigned &i)
Return pointer to i-th geometric object involved in default (usually first) update function...
HangInfo *const & hanging_pt() const
Return pointer to hanging node data (this refers to the geometric hanging node status) (const version...
DummyAlgebraicMesh()
Empty constructor.
AlgebraicNode()
Default Constructor.
void kill_node_update_info(const int &id=0)
Erase algebraic node update information for id-th node update function. Id defaults to 0...
static Vector< GeomObject * > Dummy_geom_object_pt
Default dummy vector of geom objects to point to for nodes for which no remesh fct is defined...
Vector< double > & vector_ref_value(const int &id)
Return vector of reference values involved in id-th update function.
void perform_auxiliary_node_update_fct()
Execute auxiliary update function (if any) – this can be used to update any nodal values following t...
void add_node_update_info(const int &id, AlgebraicMesh *mesh_pt, const Vector< GeomObject *> &geom_object_pt, const Vector< double > &ref_value, const bool &called_from_constructor=false)
Add algebraic update information for node: What's the ID of the mesh update function (typically used ...
unsigned nref_value(const int &id)
Number of reference values involved in id-th update function.
static AlgebraicMesh * Dummy_mesh_pt
Default dummy mesh to point to for nodes for which no remesh fct is defined.
A general Finite Element class.
AlgebraicElement(FiniteElement *const &element_pt, const int &face_index)
Constructor for face elements.
void add_geom_object_list_pt(GeomObject *geom_object_pt)
Add the specified GeomObject to the list of geometric objects associated with this AlgebraicMesh; rem...
GeomObject ** all_geom_object_pt()
Return the vector of all geometric objects.
double const & master_weight(const unsigned &i) const
Return weight for dofs on i-th master node.
AlgebraicMesh * mesh_pt()
Default (usually first) mesh that implements update function.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
unsigned nmaster() const
Return the number of master nodes.
unsigned self_test()
Self-test: Check elements and nodes. Return 0 for OK.
AlgebraicNode(const unsigned &n_dim, const unsigned &n_position_type, const unsigned &initial_nvalue)
Constructor for steady algebraic node of spatial dimension n_dim, with n_position_type generalised co...
bool is_hanging() const
Test whether the node is geometrically hanging.
unsigned ngeom_object() const
Number of geometric objects involved in default (usually first) update function.
GeomObject * geom_object_list_pt(const unsigned &i)
Access function to the ith GeomObject.
int node_update_fct_id()
Default (usually first if there are multiple ones) node update fct id.
unsigned self_test()
Self test: check consistentency of multiple node updates.
Vector< double > & vector_ref_value()
Return vector of reference values involved in default (usually first) update function.
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
Vector< GeomObject * > & vector_geom_object_pt()
Return vector of geometric objects involved in default (usually first) update function.
double & x(const unsigned &i)
Return the i-th nodal coordinate.
void node_update(const bool &update_all_solid_nodes=false)
Update all nodal positions via algebraic node update functions [Doesn't make sense to use this mesh w...
unsigned nref_value()
Number of reference values involved in default (usually first) update function.
std::map< int, AlgebraicMesh * >::iterator Default_it_mesh_pt
Default iterator for mesh: This mesh performs the default update.
std::map< int, AlgebraicMesh *> Mesh_pt
Pointer to mesh that performs the specified node update operation (Map because this node may only use...
DummyAlgebraicMesh(const DummyAlgebraicMesh &)
Broken copy constructor.
AlgebraicNode(TimeStepper *time_stepper_pt, const unsigned &n_dim, const unsigned &n_position_type, const unsigned &initial_nvalue)
Constructor for bog-standard algebraic node of spatial dimension n_dim, with n_position_type generali...
static double Max_allowed_difference_between_node_update_fcts
unsigned self_test()
Perform self test: If the node has multiple node update functions, check that they all give the same ...
virtual void algebraic_node_update(const unsigned &t, AlgebraicNode *&node_pt)
Broken assignment operator.
AlgebraicNode(const AlgebraicNode &)
Broken copy constructor.
AlgebraicElementBase()
Empty constructor.
int Default_node_update_fct_id
Default node update function ID.
AlgebraicElementBase(const AlgebraicElementBase &)
Broken copy constructor.
AlgebraicElement(const AlgebraicElement &)
Broken copy constructor.
virtual ~AlgebraicNode()
Destructor (empty)
double ref_value(const unsigned &i)
Return i-th reference value involved in default (usually first) update function.
unsigned ngeom_object_list_pt()
Return number of geometric objects associated with AlgebraicMesh.
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
Dummy algebraic mesh – used for default assignements.
void set_default_node_update(const int &id)
Make id-th node update function the default.
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
AlgebraicMesh(const AlgebraicMesh &)
Broken copy constructor.
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
unsigned ngeom_object(const int &id)
Number of geometric objects involved in id-th update function.
static DummyAlgebraicMesh Dummy_mesh
Static Dummy mesh to which the pointer is addressed.
FaceGeometry()
Constructor.
static int Dummy_node_update_fct_id
Default (negative!) remesh fct id for nodes for which no remesh fct is defined.
std::map< int, Vector< double > > Ref_value
Vector of reference values that are required for the specified node update operation. (Map because this node may only use the Mesh's 116th node update fct. There's no point in wasting an entire vector for the non-existing entries)
void node_update_fct_id(Vector< int > &id)
Return vector of node update fct ids (vector is resized to contain the correct number of entries)...
virtual void update_node_update(AlgebraicNode *&node_pt)
Update the node update info for given node, following mesh adaptation. Must be implemented for every ...
virtual void setup_algebraic_node_update(AlgebraicNode *&nod_pt)
Setup algebraic node update for specified node; do nothing in this dummy version. ...
void operator=(const AlgebraicElementBase &)
Broken assignment operator.
AlgebraicMesh * mesh_pt(const int &id)
Mesh that implements the id-th node update function.
Vector< GeomObject * > Geom_object_list_pt
Vector of GeomObjects associated with this AlgebraicMesh The zeroth entry is null, proper entries from the 1st index onwards...
~AlgebraicMesh()
Broken assignment operator.
std::map< int, Vector< double > >::iterator Default_it_ref_value
std::map< int, Vector< GeomObject * > > Geom_object_pt
Vector of geometric objects that are involved in the specified node update operation. (Map because this node may only use the Mesh's 116th node update fct. There's no point in wasting an entire vector for the non-existing entries)
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
Vector< GeomObject * > & vector_geom_object_pt(const int &id)
Return vector of geometric objects involved in id-th update function.
unsigned nnode_update_fcts()
Number of node update fcts.
std::map< int, Vector< GeomObject * > >::iterator Default_it_geom_object_pt
Default iterator for vector of geom objects. These GeomObjects are involved in the default update...
static Vector< double > Dummy_ref_value
Default dummy vector of reference values to point to for nodes for which no remesh fct is defined...