30 #ifndef OOMPH_NODES_HEADER
31 #define OOMPH_NODES_HEADER
35 #include <oomph-lib-config.h>
61 class BoundaryNodeBase;
62 template<
class NODE_TYPE>
96 template<
class NODE_TYPE>
146 void range_check(
const unsigned&
t,
const unsigned&
i)
const;
206 Data(
const unsigned& initial_n_value);
216 const unsigned& initial_n_value,
217 const bool& allocate_storage =
true);
235 const bool& preserve_existing_data);
273 #ifdef RANGE_CHECKING
281 void set_value(
const unsigned&
t,
const unsigned&
i,
const double& value_)
283 #ifdef RANGE_CHECKING
295 #ifdef RANGE_CHECKING
305 double value(
const unsigned&
t,
const unsigned&
i)
const
307 #ifdef RANGE_CHECKING
326 #ifdef RANGE_CHECKING
339 #ifdef RANGE_CHECKING
352 void dump(std::ostream& dump_file)
const;
355 void read(std::ifstream& restart_file);
360 #ifdef RANGE_CHECKING
369 #ifdef RANGE_CHECKING
378 #ifdef RANGE_CHECKING
385 inline void pin(
const unsigned&
i)
399 const unsigned n_value =
Nvalue;
400 for (
unsigned i = 0;
i < n_value;
i++)
409 const unsigned n_value =
Nvalue;
410 for (
unsigned i = 0;
i < n_value;
i++)
453 const unsigned n_value =
Nvalue;
454 for (
unsigned i = 0;
i < n_value;
i++)
463 const unsigned n_value =
Nvalue;
464 for (
unsigned i = 0;
i < n_value;
i++)
509 virtual void resize(
const unsigned& n_value);
514 std::map<unsigned, double*>& map_of_value_pt);
563 const Vector<long>& vector_of_eqn_numbers,
unsigned& index);
642 void resize(
const unsigned& n_value);
716 void resize(
const unsigned& n_value);
796 throw OomphLibError(
"Hanging node data hasn't been setup yet \n",
797 OOMPH_CURRENT_FUNCTION,
798 OOMPH_EXCEPTION_LOCATION);
801 #ifdef RANGE_CHECKING
813 throw OomphLibError(
"Hanging node data hasn't been setup yet \n",
814 OOMPH_CURRENT_FUNCTION,
815 OOMPH_EXCEPTION_LOCATION);
818 #ifdef RANGE_CHECKING
827 const double& weight);
921 const unsigned&
i)
const;
983 Node(
const unsigned& n_dim,
984 const unsigned& n_position_type,
985 const unsigned& initial_n_value,
986 const bool& allocate_x_position =
true);
996 const unsigned& n_dim,
997 const unsigned& n_position_type,
998 const unsigned& initial_n_value,
999 const bool& allocate_x_position =
true);
1012 friend std::ostream&
operator<<(std::ostream& out,
const Node& d);
1037 const bool& preserve_existing_data);
1043 double*
const& parameter_pt)
1060 double&
x(
const unsigned&
i)
1062 #ifdef RANGE_CHECKING
1069 const double&
x(
const unsigned&
i)
const
1071 #ifdef RANGE_CHECKING
1079 double&
x(
const unsigned&
t,
const unsigned&
i)
1081 #ifdef RANGE_CHECKING
1089 const double&
x(
const unsigned&
t,
const unsigned&
i)
const
1091 #ifdef RANGE_CHECKING
1098 double dx_dt(
const unsigned&
i)
const;
1102 double dx_dt(
const unsigned& j,
const unsigned&
i)
const;
1126 double&
x_gen(
const unsigned& k,
const unsigned&
i)
1128 #ifdef RANGE_CHECKING
1136 const double&
x_gen(
const unsigned& k,
const unsigned&
i)
const
1138 #ifdef RANGE_CHECKING
1146 double&
x_gen(
const unsigned&
t,
const unsigned& k,
const unsigned&
i)
1148 #ifdef RANGE_CHECKING
1159 const unsigned&
i)
const
1161 #ifdef RANGE_CHECKING
1169 double dx_gen_dt(
const unsigned& k,
const unsigned&
i)
const;
1177 const unsigned&
i)
const;
1181 double*
x_pt(
const unsigned&
t,
const unsigned&
i)
1190 virtual void dump(std::ostream& dump_file)
const;
1193 void read(std::ifstream& restart_file);
1217 for (
int i = -1;
i < nval;
i++)
1220 unsigned(std::pow(2.0,
double(
i + 1)));
1234 "Vector of pointers to hanging data is not setup yet\n",
1235 OOMPH_CURRENT_FUNCTION,
1236 OOMPH_EXCEPTION_LOCATION);
1248 std::ostringstream error_message;
1249 error_message <<
"Vector of pointers to hanging data is not setup yet\n"
1250 #ifdef OOMPH_HAS_MPI
1251 <<
"I'm on processor "
1254 <<
"Coordinates: \n";
1256 unsigned n_dim =
ndim();
1257 for (
unsigned i = 0;
i < n_dim;
i++)
1259 error_message << this->
x(i) <<
" ";
1262 OOMPH_CURRENT_FUNCTION,
1263 OOMPH_EXCEPTION_LOCATION);
1266 #ifdef RANGE_CHECKING
1270 const int n_value =
static_cast<int>(this->
nvalue());
1271 if ((i < -1) || (
i > n_value))
1273 std::ostringstream error_message;
1274 error_message <<
"Range Error: Value " <<
i
1275 <<
" is not in the range (-1," << n_value <<
")";
1277 OOMPH_CURRENT_FUNCTION,
1278 OOMPH_EXCEPTION_LOCATION);
1300 #ifdef RANGE_CHECKING
1303 const int n_value =
static_cast<int>(this->
nvalue());
1304 if ((i < -1) || (
i > n_value))
1306 std::ostringstream error_message;
1307 error_message <<
"Range Error: Value " <<
i
1308 <<
" is not in the range (-1," << n_value <<
")";
1310 OOMPH_CURRENT_FUNCTION,
1311 OOMPH_EXCEPTION_LOCATION);
1341 void resize(
const unsigned& n_value);
1477 double value(
const unsigned&
i)
const;
1488 double value(
const unsigned&
t,
const unsigned&
i)
const;
1539 double position(
const unsigned&
i)
const;
1544 double position(
const unsigned&
t,
const unsigned&
i)
const;
1548 double position_gen(
const unsigned& k,
const unsigned&
i)
const;
1555 const unsigned&
i)
const;
1563 double dposition_dt(
const unsigned& j,
const unsigned&
i)
const;
1576 const unsigned&
i)
const;
1587 const bool& update_all_time_levels_for_new_node =
false)
1653 void output(std::ostream& outfile);
1656 #ifdef OOMPH_HAS_MPI
1718 const unsigned& n_lagrangian_type,
1719 const unsigned& n_dim,
1720 const unsigned& n_position_type,
1721 const unsigned& initial_n_value);
1731 const unsigned& n_lagrangian,
1732 const unsigned& n_lagrangian_type,
1733 const unsigned& n_dim,
1735 const unsigned& initial_n_value);
1752 void dump(std::ostream& dump_file)
const;
1756 void read(std::ifstream& restart_file);
1777 const bool& preserve_existing_data);
1885 #ifdef RANGE_CHECKING
1892 const double&
xi(
const unsigned&
i)
const
1894 #ifdef RANGE_CHECKING
1902 double&
xi_gen(
const unsigned& k,
const unsigned&
i)
1904 #ifdef RANGE_CHECKING
1912 const double&
xi_gen(
const unsigned& k,
const unsigned&
i)
const
1914 #ifdef RANGE_CHECKING
1947 #ifdef OOMPH_HAS_MPI
1981 void node_update(
const bool& update_all_time_levels_for_new_node =
false)
2016 std::map<unsigned, unsigned>*
2027 Node*
const& original_node_pt);
2042 const unsigned& n_additional_value,
const unsigned& face_id = 0) = 0;
2062 const unsigned& face_id = 0)
const
2067 std::ostringstream error_message;
2069 <<
"Index_of_first_value_assigned_by_face_element_pt==0;\n"
2070 <<
"Pointer must be set via call to: \n\n"
2071 <<
" BoundaryNode::assign_additional_values_with_face_id(...), \n\n"
2072 <<
"typically from FaceElement::add_additional_values(...).";
2074 OOMPH_CURRENT_FUNCTION,
2075 OOMPH_EXCEPTION_LOCATION);
2099 const bool& throw_if_no_value_assigned_by_face_element,
2100 const bool& throw_quietly,
2101 const unsigned& face_id = 0)
const
2104 bool local_throw_if_no_value_assigned_by_face_element =
2105 throw_if_no_value_assigned_by_face_element;
2107 local_throw_if_no_value_assigned_by_face_element =
true;
2110 if (local_throw_if_no_value_assigned_by_face_element)
2114 std::ostringstream error_message;
2116 <<
"Index_of_first_value_assigned_by_face_element_pt==0;\n"
2117 <<
"Pointer must be set via call to: \n\n"
2118 <<
" BoundaryNode::assign_additional_values_with_face_id(...), "
2120 <<
"typically from FaceElement::add_additional_values(...).";
2129 OOMPH_CURRENT_FUNCTION,
2130 OOMPH_EXCEPTION_LOCATION);
2149 const unsigned& face_id = 0)
const = 0;
2240 template<
class NODE_TYPE>
2251 OOMPH_CURRENT_FUNCTION,
2252 OOMPH_EXCEPTION_LOCATION);
2269 if (cast_copied_node_pt)
2277 std::ostringstream error_stream;
2278 error_stream <<
"Copied_node_pt is not of type BoundaryNode*"
2281 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
2297 new std::map<unsigned, unsigned>;
2304 if (cast_copied_node_pt)
2310 std::map<unsigned, unsigned>::const_iterator end =
2311 (*(cast_copied_node_pt
2314 for (std::map<unsigned, unsigned>::const_iterator it =
2315 (*(cast_copied_node_pt
2322 [it->first] = it->second;
2338 OOMPH_CURRENT_FUNCTION,
2339 OOMPH_EXCEPTION_LOCATION);
2349 const unsigned n_value = this->nvalue();
2350 const unsigned n_tstorage = this->ntstorage();
2353 this->Eqn_number =
new long[n_value];
2356 this->Value =
new double*[n_value];
2359 double* values =
new double[n_value * n_tstorage];
2362 for (
unsigned i = 0;
i < n_value; ++
i)
2365 this->Value[
i] = &values[
i * n_tstorage];
2367 for (
unsigned t = 0;
t < n_tstorage; ++
t)
2392 const unsigned& n_position_type,
2393 const unsigned& initial_n_value)
2408 const unsigned& n_dim,
2409 const unsigned& n_position_type,
2410 const unsigned& initial_n_value)
2411 : NODE_TYPE(time_stepper_pt, n_dim, n_position_type, initial_n_value),
2425 const unsigned& n_lagrangian_type,
2426 const unsigned& n_dim,
2427 const unsigned& n_position_type,
2428 const unsigned& initial_n_value)
2429 : NODE_TYPE(n_lagrangian,
2446 const unsigned& n_lagrangian,
2447 const unsigned& n_lagrangian_type,
2448 const unsigned& n_dim,
2449 const unsigned& n_position_type,
2450 const unsigned& initial_n_value)
2451 : NODE_TYPE(time_stepper_pt,
2469 for (
unsigned i = 0;
i < this->Ncopies;
i++)
2475 if (cast_node_pt != 0)
2485 if (
dynamic_cast<HijackedData*
>(this->Copy_of_data_pt[
i]) == 0)
2488 "Copy of a BoundaryNode is not a BoundaryNode or HijackedData",
2489 "BoundaryNode::~BoundaryNode",
2490 OOMPH_EXCEPTION_LOCATION);
2504 this->Eqn_number = 0;
2615 std::ostringstream error_message;
2617 <<
"Index_of_first_value_assigned_by_face_element_pt==0;\n"
2618 <<
"Pointer must be set via call to: \n\n"
2619 <<
" BoundaryNode::assign_additional_values_with_face_id(), \n\n"
2620 <<
"typically from FaceElement::add_additional_values(...).";
2622 OOMPH_CURRENT_FUNCTION,
2623 OOMPH_EXCEPTION_LOCATION);
2629 unsigned nval = this->nvalue();
2642 else if ((*Index_of_first_value_assigned_by_face_element_pt).size() == 1)
2645 (*Index_of_first_value_assigned_by_face_element_pt)[face_id];
2650 unsigned next_first_index = nval;
2651 unsigned my_first_index =
2652 (*Index_of_first_value_assigned_by_face_element_pt)[face_id];
2653 for (std::map<unsigned, unsigned>::iterator it =
2654 (*Index_of_first_value_assigned_by_face_element_pt).begin();
2655 it != (*Index_of_first_value_assigned_by_face_element_pt).end();
2658 unsigned first_index = (*it).second;
2659 if ((first_index > my_first_index) &&
2660 (first_index < next_first_index))
2662 next_first_index = first_index;
2665 return next_first_index - my_first_index;
2678 const unsigned& n_additional_value,
const unsigned& face_id = 0)
2682 if (n_additional_value == 0)
2684 std::ostringstream warn_message;
2686 <<
"No additional data values are being added to the boundary node "
2688 <<
"by face id " << face_id <<
".\n"
2689 <<
"This means that the function \n"
2690 <<
"BoundaryNode::index_of_first_value_assigned_by_face_element(id) "
2692 <<
"will return a value that is equal to the number of values stored "
2694 <<
"Calling Node::value(...) with this index will lead to an "
2695 "out-of-range error.\n"
2696 <<
"The anticpated usage of a loop from the index over the number of "
2698 <<
"will not cause any problems, but if you try to do anything else, "
2699 "you may be surprised.\n"
2700 <<
"You have been warned!\n";
2702 warn_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
2710 new std::map<unsigned, unsigned>;
2714 const unsigned n_value = this->nvalue();
2719 this->Index_of_first_value_assigned_by_face_element_pt->end())
2722 (*Index_of_first_value_assigned_by_face_element_pt)[face_id] = n_value;
2728 const unsigned n_value_for_id =
2733 if (n_value_for_id == n_additional_value)
2744 n_value_for_id) != n_value)
2747 std::ostringstream warn_message;
2748 warn_message <<
"Trying to (resize) number of unknowns associated "
2751 <<
"but previous storage for this data is not at the "
2752 "end of the nodal values.\n"
2753 <<
"The anticipated usage here is within constructors "
2754 "that add additional equations\n"
2755 <<
"to existing FaceElements in which case we will "
2756 "always be at the end.\n"
2757 <<
"If you are trying to do something else, then try "
2758 "using a different id.\n"
2759 <<
" FaceElement::add_additional_values(...)."
2760 <<
" For consistency with earlier versions, this will "
2763 OOMPH_CURRENT_FUNCTION,
2764 OOMPH_EXCEPTION_LOCATION);
2773 this->
resize(n_value + n_additional_value);
2834 NODE_TYPE::assign_eqn_numbers(global_ndof, dof_pt);
2862 if (n_value_new != n_value)
2864 std::ostringstream error_stream;
2866 <<
"Call to resize copied node before original has been resized!"
2869 OOMPH_CURRENT_FUNCTION,
2870 OOMPH_EXCEPTION_LOCATION);
2877 NODE_TYPE::resize(n_value);
2888 std::ostringstream warn_message;
2889 warn_message <<
"You are trying to make a Solid Node Periodic.\n"
2890 <<
"This action will reset pointers to stored values and "
2891 <<
"equation numbers,\n"
2892 <<
"meaning that all values will be shared by this Node and "
2894 <<
"Unfortunately, this does not ensure that the variable "
2895 <<
"nodal coordinates coincide.\n"
2896 <<
"For matching nodal coordinates the options are:\n"
2897 <<
"(i) Introduce Lagrange multipliers,\n"
2898 <<
"(ii) Pin one side and treat the data as dependent,\n"
2899 <<
"(iii) Hijack the nodal coordinates on one side "
2900 <<
"and specify an alternative equation.\n\n"
2901 <<
"If you plan to use refineability, then the easiest\n"
2902 <<
"option is to use Lagrange multipliers.\n"
2905 warn_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
A class that contains the information required by Nodes that are located on Mesh boundaries....
BoundaryNodeBase()
Default constructor, set the pointers to the storage to NULL.
unsigned ncoordinates_on_boundary(const unsigned &b)
Get the number of boundary coordinates on mesh boundary b.
std::set< unsigned > * Boundaries_pt
Pointer to set of mesh boundaries occupied by the Node; NULL if the Node is not on any boundaries.
unsigned index_of_first_value_assigned_by_face_element(const bool &throw_if_no_value_assigned_by_face_element, const bool &throw_quietly, const unsigned &face_id=0) const
Return the index of the first value associated with the i-th face element value. If no argument id is...
void get_boundaries_pt(std::set< unsigned > *&boundaries_pt)
Access to pointer to set of mesh boundaries that this node occupies; NULL if the node is not on any b...
virtual void assign_additional_values_with_face_id(const unsigned &n_additional_value, const unsigned &face_id=0)=0
Member function that allocates storage for a given number of additional degrees of freedom,...
void set_coordinates_on_boundary(const unsigned &b, const Vector< double > &boundary_zeta)
Set the vector of boundary coordinates on mesh boundary b.
void make_node_periodic(Node *const &node_pt, Node *const &original_node_pt)
Helper function that is used to turn BoundaryNodes into peridic boundary nodes by setting the data va...
BoundaryNodeBase(const BoundaryNodeBase &boundary_node_base)=delete
Broken copy constructor.
void make_nodes_periodic(Node *const &node_pt, Vector< Node * > const &periodic_copies_pt)
Helper function that is used to turn BoundaryNodes into periodic boundary nodes by setting the data v...
void add_to_boundary(const unsigned &b)
Add the node to the mesh boundary b.
Node * Copied_node_pt
If the BoundaryNode is periodic, this pointer is set to the BoundaryNode whose data it shares.
void get_coordinates_on_boundary(const unsigned &b, Vector< double > &boundary_zeta)
Return the vector of boundary coordinates on mesh boundary b.
bool boundary_coordinates_have_been_set_up()
Have boundary coordinates been set up?
unsigned index_of_first_value_assigned_by_face_element(const unsigned &face_id=0) const
Return the index of the first value associated with the i-th face element value. If no argument is sp...
std::map< unsigned, DenseMatrix< double > * > * Boundary_coordinates_pt
Pointer to a map of pointers to intrinsic boundary coordinates of the Node, indexed by the boundary n...
void operator=(const BoundaryNodeBase &)=delete
Broken assignment operator.
std::map< unsigned, unsigned > * Index_of_first_value_assigned_by_face_element_pt
Pointer to a map, indexed by the face element identifier it returns the position of the first face el...
bool is_on_boundary() const
Test whether the node lies on a boundary.
void remove_from_boundary(const unsigned &b)
Remove the node from the mesh boundary b.
virtual ~BoundaryNodeBase()
Destructor, clean up any allocated storage for the boundaries.
std::map< unsigned, unsigned > *& index_of_first_value_assigned_by_face_element_pt()
Return pointer to the map giving the index of the first face element value.
virtual unsigned nvalue_assigned_by_face_element(const unsigned &face_id=0) const =0
Return the number of values associated with the i-th face element field. If no argument is specified ...
A template Class for BoundaryNodes; that is Nodes that MAY live on the boundary of a Mesh....
void assign_additional_values_with_face_id(const unsigned &n_additional_value, const unsigned &face_id=0)
Member function to allocates storage for a given number of additional degrees of freedom,...
BoundaryNode(TimeStepper *const &time_stepper_pt, const unsigned &n_dim, const unsigned &n_position_type, const unsigned &initial_n_value)
Unsteady constructor for a BoundaryNode of spatial dimension n_dim. Simply passes all arguments throu...
unsigned ncoordinates_on_boundary(const unsigned &b)
Get the number of boundary coordinates on mesh boundary b.
~BoundaryNode()
Destructor resets pointers if.
void operator=(const BoundaryNode< NODE_TYPE > &)=delete
Broken assignment operator.
void set_coordinates_on_boundary(const unsigned &b, const Vector< double > &boundary_zeta)
Set the vector of coordinates on mesh boundary b Final overload.
BoundaryNode(const BoundaryNode< NODE_TYPE > &node)=delete
Broken copy constructor.
bool is_a_copy() const
Return a boolean to indicate whether the data contains any copied values. If the node is periodic all...
Node * copied_node_pt() const
Return pointer to copied node (null if the current node is not a copy)
BoundaryNode(const unsigned &n_dim, const unsigned &n_position_type, const unsigned &initial_n_value)
Steady constructor, for a BoundaryNode of spatial dimension n_dim. Simply passes all arguments throug...
void make_periodic_nodes(const Vector< Node * > &periodic_nodes_pt)
Make the nodes passed in periodic_nodes periodic from this node.
BoundaryNode(const unsigned &n_lagrangian, const unsigned &n_lagrangian_type, const unsigned &n_dim, const unsigned &n_position_type, const unsigned &initial_n_value)
Steady constructor for Solid-type boundary nodes. The node has n_lagrangian Lagrangian coordinates of...
bool is_on_boundary() const
Test whether the node lies on a boundary Final overload.
bool is_a_copy(const unsigned &i) const
Return a boolean to indicate whether the i-th value is a copied value. If the node is periodic all va...
void clear_copied_pointers()
Clear pointers to the copied data used when we have periodic nodes. The shallow (pointer) copy is tur...
void assign_eqn_numbers(unsigned long &global_ndof, Vector< double * > &dof_pt)
Overload the equation assignment operation.
void resize(const unsigned &n_value)
Resize the number of equations.
void remove_from_boundary(const unsigned &b)
Remover the node from mesh boundary b, final overload.
BoundaryNode(TimeStepper *const &time_stepper_pt, const unsigned &n_lagrangian, const unsigned &n_lagrangian_type, const unsigned &n_dim, const unsigned &n_position_type, const unsigned &initial_n_value)
Unsteady constructor for Solid-type boundary nodes Allocates storage for initial_n_value nodal values...
void make_periodic(Node *const &node_pt)
Make the node periodic.
void add_to_boundary(const unsigned &b)
Add the node to mesh boundary b, final overload.
BoundaryNode()
Default Constructor.
void clear_additional_copied_pointers()
Copy over additional information so that if the node is periodic it can remain active if the node tha...
void reset_copied_pointers()
Set pointers to the copied data used when we have periodic nodes.
bool boundary_coordinates_have_been_set_up()
Have boundary coordinates been set up?
unsigned nvalue_assigned_by_face_element(const unsigned &face_id=0) const
Return the number of values associated with the i-th face element field. If no argument is specified ...
void get_coordinates_on_boundary(const unsigned &b, Vector< double > &boundary_zeta)
Return the vector of coordinates on mesh boundary b Final overload.
void set_coordinates_on_boundary(const unsigned &b, const unsigned &k, const Vector< double > &boundary_zeta)
Set the vector of k-th generalised boundary coordinates on mesh boundary b. Final overload.
void get_boundaries_pt(std::set< unsigned > *&boundaries_pt)
Access to pointer to set of mesh boundaries that this node occupies; NULL if the node is not on any b...
void get_coordinates_on_boundary(const unsigned &b, const unsigned &k, Vector< double > &boundary_zeta)
Return the vector of k-th generalised boundary coordinates on mesh boundary b Final overload.
bool is_on_boundary(const unsigned &b) const
Test whether the node lies on mesh boundary b Final overload.
Custom Data class that is used when making a shallow copy of a data object. The class contains a copy...
void assign_eqn_numbers(unsigned long &global_ndof, Vector< double * > &dof_pt)
CopiedData is always a copy, so no equation numbers should be allocated. This function just returns.
~CopiedData()
Destructor informs original object that the copy is being deleted and clears its pointers to the stor...
Data * Copied_data_pt
Pointer to the Data object from which the values are copied.
void clear_copied_pointers()
Clear the pointers to the copied data.
void reset_copied_pointers()
Reset the pointers to the copied data.
bool is_a_copy(const unsigned &i) const
Return a boolean to indicate whether the i-th value is a copied value. All copied data is always a co...
void resize(const unsigned &n_value)
We cannot resize CopiedData, so the resize function throws a warning.
bool is_a_copy() const
Return a boolean to indicate whether the data contains any copied values. Copied data is always a cop...
CopiedData(const Data &data)=delete
(Shallow) copy constructor
void operator=(const CopiedData &)=delete
Broken assignment operator.
A class that represents a collection of data; each Data object may contain many different individual ...
long eqn_number(const unsigned &i) const
Return the equation number of the i-th stored variable.
static TimeStepper * Default_static_time_stepper_pt
Default (static) timestepper used in steady problems.
void add_copy(Data *const &data_pt)
Add the pointer data_pt to the array Copy_of_data_pt. This should be used whenever copies are made of...
long & eqn_number(const unsigned &i)
Return the equation number of the i-th stored variable.
void pin_all()
Pin all the stored variables.
long * Eqn_number
C-style array of pointers to the (global) equation numbers of the values.
virtual void add_eqn_numbers_to_vector(Vector< long > &vector_of_eqn_numbers)
Add all equation numbers to the vector in the internal storage order.
bool does_pointer_correspond_to_value(double *const ¶meter_pt)
Check whether the pointer parameter_pt addresses internal data values.
void constrain(const unsigned &i)
Constrain the i-th stored variable when making hanging data If the data is already pinned leave it al...
virtual void describe_dofs(std::ostream &out, const std::string ¤t_string) const
Function to describe the dofs of the Node. The ostream specifies the output stream to which the descr...
virtual void add_value_pt_to_map(std::map< unsigned, double * > &map_of_value_pt)
Add pointers to all unpinned and unconstrained data to a map indexed by (global) equation number.
Data(const unsigned &initial_n_value)
Default constructor for steady problems: assign memory for initial_n_value values.
long * eqn_number_pt(const unsigned &i)
Return the pointer to the equation number of the i-th stored variable.
unsigned Nvalue
Number of values stored in the data object.
void set_value(const unsigned &t, const unsigned &i, const double &value_)
Set the t-th history value of the i-th stored data value to specified value.
static long Is_pinned
Static "Magic number" used in place of the equation number to indicate that the value is pinned.
double value(const unsigned &t, const unsigned &i) const
Return i-th value at time level t (t=0: present, t>0: previous) This function is not virtual so that ...
void range_check(const unsigned &t, const unsigned &i) const
Check that the arguments are within the range of the stored data values and timesteps.
void remove_copy(Data *const &data_pt)
Remove the pointer data_pt from the array Copy_of_data_pt. This should be used whenever copies of the...
virtual void clear_copied_pointers()
Helper function that should be overloaded derived classes that contain copies of data....
void pin(const unsigned &i)
Pin the i-th stored variable.
friend class HijackedData
bool is_segregated_solve_pinned(const unsigned &i)
Test whether the i-th variable is temporaily pinned for a segregated solve.
Data ** Copy_of_data_pt
C-style array of any Data objects that contain copies of the current Data object's data values.
void unpin(const unsigned &i)
Unpin the i-th stored variable.
int Non_halo_proc_ID
Non-halo processor ID for Data; -1 if it's not a halo.
double * value_pt(const unsigned &i) const
Return the pointer to the i-the stored value. Typically this is required when direct access to the st...
void copy(Data *orig_data_pt)
Copy Data values from specified Data object.
void unpin_all()
Unpin all the stored variables.
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
void unconstrain_all()
Unconstrain all the stored variables when the data is made nonhanging.
bool is_halo() const
Is this Data a halo?
TimeStepper * Time_stepper_pt
Pointer to a Timestepper. The inclusion of a Timestepper pointer in the Data class,...
virtual void read_values_from_vector(const Vector< double > &vector_of_values, unsigned &index)
Read all data and time history values from the vector starting from index. On return the index will b...
virtual void add_values_to_vector(Vector< double > &vector_of_values)
Add all data and time history values to the vector in the internal storage order.
static long Is_constrained
Static "Magic number" used in place of the equation number to indicate that the value is constrained ...
void set_value(const unsigned &i, const double &value_)
Set the i-th stored data value to specified value. The only reason that we require an explicit set fu...
virtual bool is_a_copy() const
Return a boolean to indicate whether the Data objact contains any copied values. A base Data object c...
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
unsigned Ncopies
Number of Data that contain copies of this Data object's values.
void dump(std::ostream &dump_file) const
Dump the data object to a file.
virtual ~Data()
Destructor, deallocates memory assigned for data.
double value(const unsigned &i) const
Return i-th stored value. This function is not virtual so that it can be inlined. This means that if ...
unsigned ntstorage() const
Return total number of doubles stored per value to record time history of each value (one for steady ...
virtual void assign_eqn_numbers(unsigned long &global_ndof, Vector< double * > &dof_pt)
Assign global equation numbers; increment global number of unknowns, global_ndof; and add any new dof...
double ** Value
C-style array of pointers to data values and possible history values. The data must be ordered in suc...
void set_nonhalo()
Label the node as not being a halo.
Data(const Data &data)=delete
Broken copy constructor.
void constrain_all()
Constrain all the stored variables when the data is made hanging.
friend std::ostream & operator<<(std::ostream &out, const Data &d)
Output operator: output all values at all times, along with any extra information stored for the time...
bool is_constrained(const unsigned &i)
Test whether the i-th variable is constrained (1: true; 0: false).
static long Is_unclassified
Static "Magic number" used in place of the equation number to denote a value that hasn't been classif...
void delete_value_storage()
Delete all storage allocated by the Data object for values and equation numbers.
virtual void resize(const unsigned &n_value)
Change (increase) the number of values that may be stored.
void set_halo(const unsigned &non_halo_proc_ID)
Label the node as halo and specify processor that holds non-halo counterpart.
Data()
Default: Just set pointer to (steady) timestepper. No storage for values is allocated.
void unconstrain(const unsigned &i)
Unconstrain the i-th stored variable when make the data nonhanging. Only unconstrain if it was actual...
void set_time_stepper(TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data)
Set a new timestepper by resizing the appropriate storage. If already assigned the equation numbering...
TimeStepper *const & time_stepper_pt() const
Return the pointer to the timestepper (const version).
void read(std::ifstream &restart_file)
Read data object from a file.
static long Is_segregated_solve_pinned
Static "Magic number" used in place of the equation number to indicate that the value is pinned,...
virtual bool is_a_copy(const unsigned &i) const
Return flag to indicate whether the i-th value is a copy. A base Data object can never be a copy so t...
unsigned self_test()
Self-test: Have all values been classified as pinned/unpinned? Return 0 if OK.
int non_halo_proc_ID()
ID of processor ID that holds non-halo counterpart of halo node; negative if not a halo.
virtual void read_eqn_numbers_from_vector(const Vector< long > &vector_of_eqn_numbers, unsigned &index)
Read all equation numbers from the vector starting from index. On return the index will be set to the...
double * value_pt(const unsigned &t, const unsigned &i) const
Return the pointer to the i-th stored value, or any of its history values (const version)....
bool is_pinned(const unsigned &i) const
Test whether the i-th variable is pinned (1: true; 0: false).
void operator=(const Data &)=delete
Broken assignment operator.
virtual void reset_copied_pointers()
Helper function that should be overloaded in derived classes that can contain copies of Data....
Data(TimeStepper *const &time_stepper_pt, const unsigned &initial_n_value, const bool &allocate_storage=true)
Constructor for unsteady problems: assign memory for initial_n_value values and any memory required b...
/////////////////////////////////////////////////////////////////////
Class that contains data for hanging nodes.
Node ** Master_nodes_pt
C-style array of pointers to nodes that this hanging node depends on.
~HangInfo()
Delete the storage.
HangInfo()
Default constructor, initialise vectors to have size zero.
double const & master_weight(const unsigned &i) const
Return weight for dofs on i-th master node.
Node *const & master_node_pt(const unsigned &i) const
Return a pointer to the i-th master node.
void operator=(const HangInfo &)=delete
Broken assignment operator.
HangInfo(const unsigned &n_master)
Alternative constructor when the number of master nodes is known.
void range_check(const unsigned &i) const
Check that the argument is within the range of stored data values.
unsigned Nmaster
Number of master nodes required by this hanging node.
unsigned nmaster() const
Return the number of master nodes.
double * Master_weights
C-style array of weights for the dofs on the master nodes.
void add_master_node_pt(Node *const &master_node_pt, const double &weight)
Add (pointer to) master node and corresponding weight to the internally stored (pointers to) master n...
HangInfo(const HangInfo &)=delete
Broken copy constructor.
void set_master_node_pt(const unsigned &i, Node *const &master_node_pt, const double &weight)
Set the pointer to the i-th master node and its weight.
Custom Data class that is used when HijackingData. The class always contains a single value that is c...
Data * Copied_data_pt
Pointer to the Data object from which the value is copied.
~HijackedData()
Destructor informs original object that the copy is being deleted and clears its pointers to the stor...
void assign_eqn_numbers(unsigned long &global_ndof, Vector< double * > &dof_pt)
HijackedData is always a copy, so no equation numbers should be allocated. This function just returns...
unsigned Copied_index
Index of the value that is copied from within the Data object.
bool is_a_copy(const unsigned &i) const
Return a boolean to indicate whether the i-th value is a copied value. Hijacked data is always a copy...
bool is_a_copy() const
Return a boolean to indicate whether the data contains any copied values. Hijacked data is always a c...
void resize(const unsigned &n_value)
We cannot resize HijackedData, so the resize function throws a warning.
void reset_copied_pointers()
Reset the pointers to the copied data.
void operator=(const HijackedData &)=delete
Broken assignment operator.
HijackedData(const Data &data)=delete
(Shallow) copy constructor
void clear_copied_pointers()
Clear the pointers to the copied data.
static OomphCommunicator * communicator_pt()
access to global communicator. This is the oomph-lib equivalent of MPI_COMM_WORLD
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
double dx_gen_dt(const unsigned &k, const unsigned &i) const
i-th component of time derivative (velocity) of the generalised position, dx(k,i)/dt....
double & x(const unsigned &i)
Return the i-th nodal coordinate.
double & x_gen(const unsigned &k, const unsigned &i)
Reference to the generalised position x(k,i). ‘Type’: k; Coordinate direction: i.
virtual void set_coordinates_on_boundary(const unsigned &b, const Vector< double > &boundary_zeta)
Set the vector of coordinates on mesh boundary b Broken virtual interface provides run-time error che...
HangInfo *const & hanging_pt() const
Return pointer to hanging node data (this refers to the geometric hanging node status) (const version...
HangInfo *const & hanging_pt(const int &i) const
Return pointer to hanging node data for value i (const version)
virtual bool position_is_a_copy(const unsigned &i) const
Return whether the position coordinate i has been copied (always false)
void copy(Node *orig_node_pt)
Copy all nodal data from specified Node object.
void add_values_to_vector(Vector< double > &vector_of_values)
Add all data and time history values to the vector. Overloaded to add the position information as wel...
double & x_gen(const unsigned &t, const unsigned &k, const unsigned &i)
Reference to the generalised position x(k,i) at the previous timestep [t=0: present]....
virtual void set_position_time_stepper(TimeStepper *const &position_time_stepper_pt, const bool &preserve_existing_data)
Set a new position timestepper be resizing the appropriate storage.
void operator=(const Node &)=delete
Broken assignment operator.
virtual unsigned ncoordinates_on_boundary(const unsigned &b)
Get the number of boundary coordinates on mesh boundary b. Broken virtual interface provides run-time...
void set_nonhanging()
Label node as non-hanging node by removing all hanging node data.
bool is_obsolete()
Test whether node is obsolete.
virtual unsigned ngeom_object() const
Return the number of geometric objects that affect the nodal position. The default value is zero (nod...
virtual bool is_on_boundary() const
Test whether the Node lies on a boundary. The "bulk" Node cannot lie on a boundary,...
virtual GeomObject ** all_geom_object_pt()
Return a pointer to an array of all (geometric) objects that affect the nodal position....
void set_obsolete()
Mark node as obsolete.
virtual void get_boundaries_pt(std::set< unsigned > *&boundaries_pt)
Return a pointer to set of mesh boundaries that this node occupies; this will be overloaded by Bounda...
virtual void pin_all()
The pin_all() function must be overloaded by SolidNodes, so we put the virtual interface here to avoi...
void read(std::ifstream &restart_file)
Read nodal position and associated data from file for restart.
static unsigned No_independent_position
Static "Magic number" used to indicate that there is no independent position in a periodic node.
bool is_hanging(const int &i) const
Test whether the i-th value is hanging.
TimeStepper *const & position_time_stepper_pt() const
Return a pointer to the position timestepper (const version).
void x_gen_range_check(const unsigned &t, const unsigned &k, const unsigned &i) const
Private function to check that the arguemnts to the position functions are in range.
virtual void assign_eqn_numbers(unsigned long &global_ndof, Vector< double * > &dof_pt)
Assign global equation numbers; increment global number of unknowns, global_ndof; and add any new dof...
void set_auxiliary_node_update_fct_pt(AuxNodeUpdateFctPt aux_node_update_fct_pt)
Set pointer to auxiliary update function – this can be used to update any nodal values following the ...
virtual void remove_from_boundary(const unsigned &b)
Broken interface for removing the node from the mesh boundary b Here to provide error reporting.
void perform_auxiliary_node_update_fct()
Execute auxiliary update function (if any) – this can be used to update any nodal values following th...
virtual void get_coordinates_on_boundary(const unsigned &b, Vector< double > &boundary_zeta)
Return the vector of coordinates on mesh boundary b Broken virtual interface provides run-time error ...
void set_non_obsolete()
Mark node as non-obsolete.
virtual Data ** all_geom_data_pt()
Return a pointer to an array of all (geometric) data that affect the nodal position....
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
virtual void make_periodic_nodes(const Vector< Node * > &periodic_nodes_pt)
Make the nodes passed in the vector periodic_nodes share the same data as this node.
double & x(const unsigned &t, const unsigned &i)
Return the position x(i) at previous timestep t (t=0: present; t>0 previous timestep).
virtual bool position_is_a_copy() const
Return whether any position coordinate has been copied (always false)
const double & x_gen(const unsigned &k, const unsigned &i) const
Reference to the generalised position x(k,i). ‘Type’: k; Coordinate direction: i (const version).
double * x_position_pt(const unsigned &i)
Direct access to the pointer to the i-th stored coordinate data.
virtual void constrain_positions()
Constrain the positions when the node is made hanging Empty virtual function that is overloaded in So...
void output(std::ostream &outfile)
Output nodal position.
AuxNodeUpdateFctPt Aux_node_update_fct_pt
Pointer to auxiliary update function – this can be used to update any nodal values following the upda...
TimeStepper * Position_time_stepper_pt
Pointer to the timestepper associated with the position data.
virtual void unpin_all()
The unpin_all() function must be overloaded by SolidNode, so we put the virtual interface here to avo...
double ** X_position
Array of pointers to the data holding the Eulerian positions. The storage format must be the same as ...
virtual void add_to_boundary(const unsigned &b)
Broken interface for adding the node to the mesh boundary b Essentially here for error reporting.
virtual void set_coordinates_on_boundary(const unsigned &b, const unsigned &k, const Vector< double > &boundary_zeta)
Set the vector of the k-th generalised boundary coordinates on mesh boundary b. Broken virtual interf...
HangInfo ** Hanging_pt
C-style array of pointers to hanging node info. It's set to NULL if the node isn't hanging....
void set_hanging_pt(HangInfo *const &hang_pt, const int &i)
Set the hanging data for the i-th value. (hang_pt=0 to make non-hanging)
Vector< double > value() const
Return vector of values calculated using value(vector).
double * x_pt(const unsigned &t, const unsigned &i)
Direct access to the i-th coordinate at time level t (t=0: present; t>0: previous)
TimeStepper *& position_time_stepper_pt()
Return a pointer to the position timestepper.
const double & x(const unsigned &i) const
Return the i-th nodal coordinate (const version).
const double & x(const unsigned &t, const unsigned &i) const
Return the position x(i) at previous timestep t (t=0: present; t>0 previous timestep) (const version)
unsigned Nposition_type
Number of coordinate types used in the mapping between local and global coordinates (e....
virtual bool boundary_coordinates_have_been_set_up()
Have boundary coordinates been set up? Broken virtual interface provides run-time error checking.
double position_gen(const unsigned &k, const unsigned &i) const
Return generalised nodal coordinate either directly or via hanging node representation.
unsigned Ndim
Eulerian dimension of the node.
unsigned hang_code()
Code that encapsulates the hanging status of the node (incl. the geometric hanging status) as .
virtual bool does_pointer_correspond_to_position_data(double *const ¶meter_pt)
Check whether the pointer parameter_pt addresses position data values. It never does for a standard n...
virtual void get_coordinates_on_boundary(const unsigned &b, const unsigned &k, Vector< double > &boundary_zeta)
Return the vector of the k-th generalised boundary coordinates on mesh boundary b....
double raw_value(const unsigned &i) const
Return the i-th value stored at the Node. This interface does NOT take the hanging status of the Node...
virtual void unconstrain_positions()
Unconstrain the positions when the node is made non-hanging Empty virtual function that is overloaded...
Node(const Node &node)=delete
Broken copy constructor.
Vector< double > position() const
Return vector of position of node at current time.
virtual Node * copied_node_pt() const
Return pointer to copied node (null if the current node is not a copy – always the case here; it's ov...
void read_values_from_vector(const Vector< double > &vector_of_values, unsigned &index)
Read all data and time history values from the vector starting from index. On return the index will b...
virtual void dump(std::ostream &dump_file) const
Dump nodal position and associated data to file for restart.
friend std::ostream & operator<<(std::ostream &out, const Node &d)
Output operator: output location and all values at all times, along with any extra information stored...
virtual bool is_on_boundary(const unsigned &b) const
Test whether the node lies on mesh boundary b. The "bulk" Node cannot lie on a boundary,...
virtual unsigned ngeom_data() const
Return the number of geometric data that affect the nodal position. The default value is zero (node i...
const double & x_gen(const unsigned &t, const unsigned &k, const unsigned &i) const
Reference to the generalised position x(k,i) at the previous timestep [t=0: present]....
double dposition_dt(const unsigned &i) const
Return the i-th component of nodal velocity: dx/dt, either directly or via hanging node representatio...
bool has_auxiliary_node_update_fct_pt()
Boolean to indicate if node has a pointer to and auxiliary update function.
double dx_dt(const unsigned &i) const
Return the i-th component of nodal velocity: dx/dt.
bool Obsolete
Flag to indicate that the Node has become obsolete — usually during mesh refinement process.
void resize(const unsigned &n_value)
Resize the number of equations.
virtual void make_periodic(Node *const &node_pt)
Make the node periodic by copying the values from node_pt. Note that the coordinates will always rema...
double raw_value(const unsigned &t, const unsigned &i) const
Return the i-th value at time level t (t=0: present, t>0: previous). This interface does NOT take the...
virtual void node_update(const bool &update_all_time_levels_for_new_node=false)
Interface for functions that update the nodal position using algebraic remeshing strategies....
unsigned nposition_type() const
Number of coordinate types needed in the mapping between local and global coordinates.
bool is_hanging() const
Test whether the node is geometrically hanging.
Node()
Default constructor.
double dposition_gen_dt(const unsigned &k, const unsigned &i) const
i-th component of time derivative (velocity) of the generalised position, dx(k,i)/dt....
virtual ~Node()
Destructor: Clean up the memory allocated for nodal position.
void(* AuxNodeUpdateFctPt)(Node *)
Function pointer to auxiliary node update function.
double value(const unsigned &i) const
Return i-th value (dofs or pinned) at this node either directly or via hanging node representation....
An OomphLibError object which should be thrown when an run-time error is encountered....
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
An OomphLibWarning object which should be created as a temporary object to issue a warning....
A Class for nodes that deform elastically (i.e. position is an unknown in the problem)....
void constrain_positions()
Overload the constrain positions function to constrain all position values.
void xi_gen_range_check(const unsigned &k, const unsigned &i) const
Private function to check that the arguments to the position functions are in range.
void unpin_all()
Unpin all the stored variables (Overloaded)
const double & xi(const unsigned &i) const
Reference to i-th Lagrangian position (const version)
void set_position_time_stepper(TimeStepper *const &position_time_stepper_pt, const bool &preserve_existing_data)
Set a new position timestepper be resizing the appropriate storage Overloaded from the basic implemen...
unsigned Nlagrangian
Number of Lagrangian coordinates of the node.
void unconstrain_positions()
Overload the unconstrain positions function to unconstrain all position values.
void add_values_to_vector(Vector< double > &vector_of_values)
Add all data, position and time history values to the vector Overload to add the Lagrangian coordinat...
bool does_pointer_correspond_to_position_data(double *const ¶meter_pt)
Overload the check whether the pointer parameter_pt addresses position data values.
void read_eqn_numbers_from_vector(const Vector< long > &vector_of_eqn_numbers, unsigned &index)
Read all equation numbers from the vector starting from index. On return the index will be set to the...
const double & xi_gen(const unsigned &k, const unsigned &i) const
Reference to the generalised Lagrangian position. ‘Type’: k; 'Coordinate direction: i....
unsigned nlagrangian_type() const
Number of types of Lagrangian coordinates used to interpolate the Lagrangian coordinates within the e...
void unpin_position(const unsigned &k, const unsigned &i)
Unpin the generalised nodal position. ‘Type’: k; Coordinate direction: i.
double & xi_gen(const unsigned &k, const unsigned &i)
Reference to the generalised Lagrangian position. ‘Type’: k; 'Coordinate direction: i.
SolidNode(const SolidNode &solid_node)=delete
Broken copy constructor.
const Data & variable_position() const
Return the variable_position data (const version)
Data * Variable_position_pt
Pointer to data that will hold variable positions in elastic nodes.
void add_value_pt_to_map(std::map< unsigned, double * > &map_of_value_pt)
Overload the function add_values_to_map so that it also adds the variable position data.
unsigned Nlagrangian_type
Number of types of Lagrangian coordinates used to interpolate the Lagrangian coordinates within the e...
double lagrangian_position(const unsigned &i) const
Return lagrangian coordinate either directly or via hanging node representation.
double lagrangian_position_gen(const unsigned &k, const unsigned &i) const
Return generalised lagrangian coordinate either directly or via hanging node representation.
SolidNode()
Default Constructor.
void read_values_from_vector(const Vector< double > &vector_of_values, unsigned &index)
Read all data and time history values from the vector starting from index. On return the index will b...
const long & position_eqn_number(const unsigned &k, const unsigned &i) const
Return the equation number for generalised Eulerian coordinate: type of coordinate: k,...
virtual ~SolidNode()
Destructor that cleans up the additional memory allocated in SolidNodes.
void describe_dofs(std::ostream &out, const std::string ¤t_string) const
Function to describe the dofs of the Node. The ostream specifies the output stream to which the descr...
bool position_is_a_copy(const unsigned &i) const
Return whether the position coordinate i has been copied.
void pin_position(const unsigned &i)
Pin the nodal position.
bool position_is_a_copy() const
Return whether any position component has been copied.
void dump(std::ostream &dump_file) const
Dump nodal positions (variable and fixed) and associated data to file for restart.
void pin_all()
Pin all the stored variables (Overloaded)
void unpin_position(const unsigned &i)
Unpin the nodal position.
void set_external_variable_position_pt(Data *const &data_pt)
Set the variable position data from an external data object.
void read(std::ifstream &restart_file)
Read nodal positions (variable and fixed) and associated data from file for restart.
double * Xi_position
Storage for the Lagrangian positions.
double & xi(const unsigned &i)
Reference to i-th Lagrangian position.
void pin_position(const unsigned &k, const unsigned &i)
Pin the generalised nodal position. ‘Type’: k; Coordinate direction: i.
void add_eqn_numbers_to_vector(Vector< long > &vector_of_eqn_numbers)
Add all equation numbers to the vector in the internal storage order. Overload to add equation number...
void assign_eqn_numbers(unsigned long &global_number, Vector< double * > &dof_pt)
Overload the assign equation numbers routine.
void copy(SolidNode *orig_node_pt)
Copy nodal positions and associated data from specified node object.
void node_update(const bool &update_all_time_levels_for_new_node=false)
Overload node update function: Since the position of SolidNodes is determined by unknowns,...
Data *const & variable_position_pt() const
Pointer to variable_position data (const version)
bool position_is_pinned(const unsigned &k, const unsigned &i)
Test whether the k-th type of the i-th coordinate is pinned 0: false; 1: true.
unsigned nlagrangian() const
Return number of lagrangian coordinates.
bool position_is_pinned(const unsigned &i)
Test whether the i-th coordinate is pinned, 0: false; 1: true.
void operator=(const SolidNode &)=delete
Broken assignment operator.
////////////////////////////////////////////////////////////////////// //////////////////////////////...
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...