28 #ifndef OOMPH_FACE_MESH_PROJECT_HEADER
29 #define OOMPH_FACE_MESH_PROJECT_HEADER
43 template<
class ELEMENT>
57 const unsigned&
i)
const
65 std::ostringstream error_message;
66 error_message <<
"Boundary_id is (still) UINT_MAX -- please set\n"
67 <<
"the actual value with set_boundary_id(...)\n";
69 OOMPH_CURRENT_FUNCTION,
70 OOMPH_EXCEPTION_LOCATION);
93 std::ostringstream error_message;
94 error_message <<
"Boundary_id is (still) UINT_MAX -- please set\n"
95 <<
"the actual value with set_boundary_id(...)\n";
97 OOMPH_CURRENT_FUNCTION,
98 OOMPH_EXCEPTION_LOCATION);
110 unsigned nnod = this->
nnode();
114 for (
unsigned j = 0; j < nnod; j++)
117 data_values[j] = std::make_pair(this->
node_pt(j), fld);
165 unsigned n_node = this->
nnode();
172 double interpolated_u = 0.0;
175 for (
unsigned l = 0; l < n_node; l++)
177 interpolated_u += this->
nodal_value(t, l, fld) * psi[l];
179 return interpolated_u;
185 return this->
nnode();
221 template<
class GEOMETRIC_ELEMENT>
232 const unsigned& boundary_id,
233 const unsigned& id_of_field_to_be_projected = UINT_MAX)
243 for (
unsigned e = 0;
e < nel;
e++)
250 if (
dynamic_cast<GEOMETRIC_ELEMENT*
>(mesh_pt->
element_pt(
e)) == 0)
252 std::ostringstream error_message;
253 error_message <<
"Element is of wrong type " <<
typeid(el_pt).name()
254 <<
" doesn't match template parameter!" << std::endl;
256 OOMPH_CURRENT_FUNCTION,
257 OOMPH_EXCEPTION_LOCATION);
261 std::ostringstream error_message;
263 <<
"Internal data will NOT be projected across!\n"
264 <<
"If you want this functionality you'll have to \n"
265 <<
"implement it yourself" << std::endl;
267 OOMPH_CURRENT_FUNCTION,
268 OOMPH_EXCEPTION_LOCATION);
289 unsigned nnod = el_pt->
nnode();
290 for (
unsigned j = 0; j < nnod; j++)
295 Node* new_nod_pt = 0;
302 std::ostringstream error_message;
303 error_message <<
"Node isn't on a boundary!" << std::endl;
305 OOMPH_CURRENT_FUNCTION,
306 OOMPH_EXCEPTION_LOCATION);
312 unsigned nval = old_node_pt->
nvalue();
313 unsigned first_index_in_old_node = 0;
317 ->nvalue_assigned_by_face_element(
319 first_index_in_old_node =
321 ->index_of_first_value_assigned_by_face_element(
333 unsigned n_time = old_node_pt->
ntstorage();
334 for (
unsigned t = 0;
t < n_time;
t++)
336 for (
unsigned i = 0;
i < nval;
i++)
339 t,
i, old_node_pt->
value(
t, first_index_in_old_node +
i));
344 unsigned n_dim = old_node_pt->
ndim();
345 for (
unsigned i = 0;
i < n_dim;
i++)
347 new_nod_pt->
x(
i) = old_node_pt->
x(
i);
357 std::ostringstream error_message;
358 error_message <<
"Boundary ID specified as " <<
Boundary_id
359 <<
" but node isn't actually on that boundary!"
362 OOMPH_CURRENT_FUNCTION,
363 OOMPH_EXCEPTION_LOCATION);
408 proj_problem_pt->mesh_pt() = projectable_new_mesh_pt;
411 bool dont_project_positions =
true;
412 proj_problem_pt->project(
this, dont_project_positions);
418 delete proj_problem_pt;
419 delete projectable_new_mesh_pt;
428 for (std::map<Node*, Node*>::iterator it =
New_node_pt.begin();
433 Node* old_node_pt = (*it).first;
436 Node* new_node_pt = (*it).second;
439 unsigned nval = old_node_pt->
nvalue();
440 unsigned first_index_in_old_node = 0;
446 first_index_in_old_node =
448 ->index_of_first_value_assigned_by_face_element(
453 unsigned n_time = old_node_pt->
ntstorage();
454 for (
unsigned t = 0;
t < n_time;
t++)
456 for (
unsigned i = 0;
i < nval;
i++)
459 t, first_index_in_old_node +
i, new_node_pt->
value(
t,
i));
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
BackupMeshForProjection(Mesh *mesh_pt, const unsigned &boundary_id, const unsigned &id_of_field_to_be_projected=UINT_MAX)
Constructor: Pass existing mesh and the boundary ID (need to find the boundary coordinates that are u...
std::map< Node *, Node * > New_node_pt
Map returning new node, labeled by node point in original mesh.
void copy_onto_original_mesh()
Copy nodal values back onto original mesh from which this mesh was built. This obviously only makes s...
unsigned Boundary_id
Boundary id.
unsigned ID_of_field_to_be_projected
ID of field to be projected (UINT_MAX if there isn't one, in which case we're doing all of them.
void project_onto_new_mesh(Mesh *new_mesh_pt)
Project the solution that was present in the original mesh and from which this backup mesh was create...
A class that contains the information required by Nodes that are located on Mesh boundaries....
A template Class for BoundaryNodes; that is Nodes that MAY live on the boundary of a Mesh....
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
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...
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
unsigned ntstorage() const
Return total number of doubles stored per value to record time history of each value (one for steady ...
A general Finite Element class.
virtual double J_eulerian(const Vector< double > &s) const
Return the Jacobian of mapping from local to global coordinates at local position s.
void set_nodal_dimension(const unsigned &nodal_dim)
Set the dimension of the nodes in the element. This will typically only be required when constructing...
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
double nodal_value(const unsigned &n, const unsigned &i) const
Return the i-th value stored at local node n. Produces suitably interpolated values for hanging nodes...
virtual void shape(const Vector< double > &s, Shape &psi) const =0
Calculate the geometric shape functions at local coordinate s. This function must be overloaded for e...
int nodal_local_eqn(const unsigned &n, const unsigned &i) const
Return the local equation number corresponding to the i-th value at the n-th local node.
unsigned dim() const
Return the spatial dimension of the element, i.e. the number of local coordinates required to paramet...
unsigned nnode() const
Return the number of nodes.
unsigned ninternal_data() const
Return the number of internal data objects.
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
Vector< std::pair< Data *, unsigned > > data_values_of_field(const unsigned &fld)
Specify the values associated with field fld. The information is returned in a vector of pairs which ...
unsigned Boundary_id
Boundary id.
unsigned nhistory_values_for_coordinate_projection()
Number of positional history values (Note: count includes current value!). Extract from first node bu...
unsigned boundary_id() const
Boundary id.
double get_field(const unsigned &t, const unsigned &fld, const Vector< double > &s)
Return interpolated field fld at local coordinate s, at time level t (t=0: present; t>0: history valu...
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
Nodal value of boundary coordinate.
unsigned nhistory_values_for_projection(const unsigned &fld)
Number of history values to be stored for fld-th field (includes current value!). Extract from first ...
GenericLagrangeInterpolatedProjectableElement()
Constructor.
int local_equation(const unsigned &fld, const unsigned &j)
Return local equation number of value j in field fld. Assumed to be the local nodal equation.
unsigned nvalue_of_field(const unsigned &fld)
Return number of values in field fld.
unsigned nfields_for_projection()
Number of fields to be projected.
void set_boundary_id(const unsigned &boundary_id)
Boundary id.
double jacobian_and_shape_of_field(const unsigned &fld, const Vector< double > &s, Shape &psi)
Return Jacobian of mapping and shape functions of field fld at local coordinate s.
Vector< Node * > Node_pt
Vector of pointers to nodes.
FiniteElement * finite_element_pt(const unsigned &e) const
Upcast (downcast?) to FiniteElement (needed to access FiniteElement member functions).
GeneralisedElement *& element_pt(const unsigned long &e)
Return pointer to element e.
unsigned long nnode() const
Return number of nodes in the mesh.
void add_element_pt(GeneralisedElement *const &element_pt)
Add a (pointer to) an element to the mesh.
Vector< GeneralisedElement * > Element_pt
Vector of pointers to generalised elements.
unsigned long nelement() const
Return number of elements in the mesh.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
double & x(const unsigned &i)
Return the i-th nodal coordinate.
virtual unsigned ncoordinates_on_boundary(const unsigned &b)
Get the number of boundary coordinates on mesh boundary b. Broken virtual interface provides run-time...
virtual bool is_on_boundary() const
Test whether the Node lies on a boundary. The "bulk" Node cannot lie on a boundary,...
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
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...
TimeStepper *& position_time_stepper_pt()
Return a pointer to the position timestepper.
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....
unsigned nposition_type() const
Number of coordinate types needed in the mapping between local and global coordinates.
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....
Wrapper class for projectable elements. Adds "projectability" to the underlying ELEMENT.
Projection problem. This is created during the adaptation of unstructured meshes and it is assumed th...
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
unsigned ntstorage() const
Return the number of doubles required to represent history (one for steady)
//////////////////////////////////////////////////////////////////// ////////////////////////////////...