32 #ifndef OOMPH_FACE_MESH_PROJECT_HEADER 33 #define OOMPH_FACE_MESH_PROJECT_HEADER 49 template <
class ELEMENT>
63 double zeta_nodal(
const unsigned &n,
const unsigned &k,
const unsigned &
i)
72 std::ostringstream error_message;
74 <<
"Boundary_id is (still) UINT_MAX -- please set\n" 75 <<
"the actual value with set_boundary_id(...)\n";
77 OOMPH_CURRENT_FUNCTION,
78 OOMPH_EXCEPTION_LOCATION);
102 std::ostringstream error_message;
104 <<
"Boundary_id is (still) UINT_MAX -- please set\n" 105 <<
"the actual value with set_boundary_id(...)\n";
107 OOMPH_CURRENT_FUNCTION,
108 OOMPH_EXCEPTION_LOCATION);
120 unsigned nnod=this->
nnode();
124 for (
unsigned j=0;j<nnod;j++)
127 data_values[j]=std::make_pair(this->
node_pt(j),fld);
176 unsigned n_node=this->
nnode();
183 double interpolated_u = 0.0;
186 for(
unsigned l=0;l<n_node;l++)
188 interpolated_u += this->
nodal_value(t,l,fld)*psi[l];
190 return interpolated_u;
196 return this->
nnode();
236 template <
class GEOMETRIC_ELEMENT>
248 const unsigned& id_of_field_to_be_projected=UINT_MAX)
250 ID_of_field_to_be_projected(id_of_field_to_be_projected)
256 Element_pt.reserve(nel);
258 for (
unsigned e=0;
e<nel;
e++)
265 if (dynamic_cast<GEOMETRIC_ELEMENT*>(mesh_pt->
element_pt(
e))==0)
267 std::ostringstream error_message;
269 <<
"Element is of wrong type " <<
typeid(el_pt).name()
270 <<
" doesn't match template parameter!" << std::endl;
272 OOMPH_CURRENT_FUNCTION,
273 OOMPH_EXCEPTION_LOCATION);
277 std::ostringstream error_message;
279 <<
"Internal data will NOT be projected across!\n" 280 <<
"If you want this functionality you'll have to \n" 281 <<
"implement it yourself" << std::endl;
283 OOMPH_CURRENT_FUNCTION,
284 OOMPH_EXCEPTION_LOCATION);
298 new_el_pt->set_nodal_dimension(nodal_dim);
301 add_element_pt(new_el_pt);
304 unsigned nnod=el_pt->
nnode();
305 for (
unsigned j=0;j<nnod;j++)
308 if (New_node_pt[old_node_pt]==0)
317 std::ostringstream error_message;
319 <<
"Node isn't on a boundary!" 322 OOMPH_CURRENT_FUNCTION,
323 OOMPH_EXCEPTION_LOCATION);
329 unsigned nval=old_node_pt->
nvalue();
330 unsigned first_index_in_old_node=0;
331 if (ID_of_field_to_be_projected!=UINT_MAX)
334 (old_node_pt)->nvalue_assigned_by_face_element
335 (ID_of_field_to_be_projected);
337 (old_node_pt)->index_of_first_value_assigned_by_face_element
338 (ID_of_field_to_be_projected);
348 unsigned n_time = old_node_pt->
ntstorage();
349 for(
unsigned t=0;
t<n_time;
t++)
351 for(
unsigned i=0;
i<nval;
i++)
354 (
t,
i,old_node_pt->
value(
t,first_index_in_old_node+
i));
359 unsigned n_dim=old_node_pt->
ndim();
360 for(
unsigned i=0;
i<n_dim;
i++)
362 new_nod_pt->
x(
i)=old_node_pt->
x(
i);
372 std::ostringstream error_message;
375 <<
" but node isn't actually on that boundary!" 378 OOMPH_CURRENT_FUNCTION,
379 OOMPH_EXCEPTION_LOCATION);
395 New_node_pt[old_node_pt]=new_nod_pt;
399 new_el_pt->node_pt(j)=New_node_pt[old_node_pt];
415 ID_of_field_to_be_projected);
419 <GEOMETRIC_ELEMENT> >*
422 <GEOMETRIC_ELEMENT> >;
425 proj_problem_pt->mesh_pt()=projectable_new_mesh_pt;
428 bool dont_project_positions=
true;
429 proj_problem_pt->project(
this,dont_project_positions);
435 delete proj_problem_pt;
436 delete projectable_new_mesh_pt;
446 for (std::map<Node*,Node*>::iterator it=New_node_pt.begin();
447 it!=New_node_pt.end();it++)
450 Node* old_node_pt=(*it).first;
453 Node* new_node_pt=(*it).second;
456 unsigned nval=old_node_pt->
nvalue();
457 unsigned first_index_in_old_node=0;
458 if (ID_of_field_to_be_projected!=UINT_MAX)
461 nvalue_assigned_by_face_element
462 (ID_of_field_to_be_projected);
464 index_of_first_value_assigned_by_face_element
465 (ID_of_field_to_be_projected);
469 unsigned n_time = old_node_pt->
ntstorage();
470 for(
unsigned t=0;
t<n_time;
t++)
472 for(
unsigned i=0;
i<nval;
i++)
475 (
t,first_index_in_old_node+
i,new_node_pt->
value(
t,
i));
unsigned boundary_id() const
Boundary id.
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...
unsigned nfields_for_projection()
Number of fields to be projected.
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.
std::map< Node *, Node * > New_node_pt
Map returning new node, labeled by node point in original mesh.
unsigned Boundary_id
Boundary id.
A general Finite Element class.
void copy_onto_original_mesh()
Copy nodal values back onto original mesh from which this mesh was built. This obviously only makes s...
TimeStepper *& position_time_stepper_pt()
Return a pointer to the position timestepper.
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...
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
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...
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
Nodal value of boundary coordinate.
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. Broken virtual interface provides run-time error checking.
virtual unsigned ncoordinates_on_boundary(const unsigned &b)
Get the number of boundary coordinates on mesh boundary b. Broken virtual interface provides run-time...
unsigned long nelement() const
Return number of elements in the mesh.
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
unsigned Boundary_id
Boundary id.
double & x(const unsigned &i)
Return the i-th nodal coordinate.
A class that contains the information required by Nodes that are located on Mesh boundaries. A BoundaryNode of a particular type is obtained by combining a given Node with this class. By differentiating between Nodes and BoundaryNodes we avoid a lot of un-necessary storage in the bulk Nodes.
GeneralisedElement *& element_pt(const unsigned long &e)
Return pointer to element e.
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 ...
A template Class for BoundaryNodes; that is Nodes that MAY live on the boundary of a Mesh...
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 nposition_type() const
Number of coordinate types needed in the mapping between local and global coordinates.
void set_boundary_id(const 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...
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...
unsigned ntstorage() const
Return the number of doubles required to represent history (one for steady)
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 ...
unsigned long nnode() const
Return number of nodes in the mesh.
unsigned ntstorage() const
Return total number of doubles stored per value to record time history of each value (one for steady ...
FiniteElement * finite_element_pt(const unsigned &e) const
Upcast (downcast?) to FiniteElement (needed to access FiniteElement member functions).
unsigned dim() const
Return the spatial dimension of the element, i.e. the number of local coordinates required to paramet...
unsigned ninternal_data() const
Return the number of internal data objects.
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...
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
Node ** Node_pt
Storage for pointers to the nodes in the element.
virtual bool is_on_boundary() const
Test whether the Node lies on a boundary. The "bulk" Node cannot lie on a boundary, so return false. This will be overloaded by BoundaryNodes.
virtual void add_to_boundary(const unsigned &b)
Broken interface for adding the node to the mesh boundary b Essentially here for error reporting...
GenericLagrangeInterpolatedProjectableElement()
Constructor.
Class that makes the finite element specified as template argument projectable – on the assumption t...
unsigned nnode() const
Return the number of nodes.
virtual double J_eulerian(const Vector< double > &s) const
Return the Jacobian of mapping from local to global coordinates at local position s...
virtual void shape(const Vector< double > &s, Shape &psi) const =0
Calculate the geometric shape functions at local coordinate s. This function must be overloaded for e...
unsigned nvalue_of_field(const unsigned &fld)
Return number of values in field fld.
double value(const unsigned &i) const
Return i-th value (dofs or pinned) at this node either directly or via hanging node representation...
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...
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...
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...