26 #ifndef OOMPH_FISH_MESH_HEADER
27 #define OOMPH_FISH_MESH_HEADER
30 #include "../generic/refineable_quad_mesh.h"
31 #include "../generic/macro_element.h"
32 #include "../generic/domain.h"
33 #include "../generic/algebraic_elements.h"
34 #include "../generic/quad_mesh.h"
35 #include "../generic/macro_element_node_update_element.h"
38 #include "../generic/algebraic_elements.h"
41 #include "../generic/macro_element_node_update_element.h"
53 template<
class ELEMENT>
59 FishMesh(TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper);
65 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper);
102 void build_mesh(TimeStepper* time_stepper_pt);
126 template<
class ELEMENT>
128 public RefineableQuadMesh<ELEMENT>
134 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
135 :
FishMesh<ELEMENT>(time_stepper_pt)
151 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
152 :
FishMesh<ELEMENT>(back_pt, time_stepper_pt)
183 class MacroElementNodeUpdateNode;
196 template<
class ELEMENT>
198 :
public virtual MacroElementNodeUpdateMesh,
207 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
208 :
FishMesh<ELEMENT>(back_pt, time_stepper_pt),
212 ELEMENT* el_pt =
new ELEMENT;
213 if (
dynamic_cast<MacroElementNodeUpdateElementBase*
>(el_pt) == 0)
215 std::ostringstream error_message;
216 error_message <<
"Base class for ELEMENT in "
217 <<
"MacroElementNodeUpdateRefineableFishMesh needs"
218 <<
"to be of type MacroElementNodeUpdateElement!\n";
219 error_message <<
"Whereas it is: typeid(el_pt).name()"
220 <<
typeid(el_pt).name() << std::endl;
222 std::string function_name =
223 "MacroElementNodeUpdateRefineableFishMesh::\n";
224 function_name +=
"MacroElementNodeUpdateRefineableFishMesh()";
226 throw OomphLibError(error_message.str(),
227 OOMPH_CURRENT_FUNCTION,
228 OOMPH_EXCEPTION_LOCATION);
237 unsigned n_element = this->nelement();
238 for (
unsigned i = 0; i < n_element; i++)
241 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(this->element_pt(i));
245 MacroElementNodeUpdateElementBase* m_el_pt =
246 dynamic_cast<MacroElementNodeUpdateElementBase*
>(el_pt);
249 std::ostringstream error_message;
251 <<
"Failed to upcast to MacroElementNodeUpdateElementBase\n";
252 error_message <<
"Element must be derived from "
253 "MacroElementNodeUpdateElementBase\n";
254 error_message <<
"but it is of type " <<
typeid(el_pt).name();
256 std::string function_name =
257 "MacroElementNodeUpdateRefineableFishMesh::\n";
258 function_name +=
"MacroElementNodeUpdateRefinableFishMesh()";
260 throw OomphLibError(error_message.str(),
261 OOMPH_CURRENT_FUNCTION,
262 OOMPH_EXCEPTION_LOCATION);
266 Vector<GeomObject*> geom_object_pt(1);
267 geom_object_pt[0] = this->
Back_pt;
271 el_pt->set_node_update_info(geom_object_pt);
275 Vector<GeomObject*> geom_object_pt(1);
276 geom_object_pt[0] = this->
Back_pt;
277 MacroElementNodeUpdateMesh::set_geom_object_vector_pt(geom_object_pt);
280 MacroElementNodeUpdateMesh::macro_domain_pt() = this->
domain_pt();
294 if (update_all_solid_nodes)
296 std::string error_message =
297 "Doesn't make sense to use an MacroElementNodeUpdateMesh with\n";
299 "SolidElements so specifying update_all_solid_nodes=true\n";
300 error_message +=
"doesn't make sense either\n";
302 std::string function_name =
303 "MacroElementNodeUpdateRefineableFishMesh::";
304 function_name +=
"node_update()";
307 error_message, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
310 MacroElementNodeUpdateMesh::node_update();
325 template<
class ELEMENT>
333 :
FishMesh<ELEMENT>(time_stepper_pt)
343 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
344 :
FishMesh<ELEMENT>(back_pt, time_stepper_pt)
347 AlgebraicMesh::add_geom_object_list_pt(back_pt);
362 unsigned id = node_pt->node_update_fct_id();
376 std::ostringstream error_message;
377 error_message <<
"The node update fct id is " <<
id
378 <<
", but it should only be one of " << this->
Lower_body
380 <<
" or " << this->
Upper_fin << std::endl;
381 std::string function_name =
382 "AlgebraicFishMesh::algebraic_node_update()";
384 throw OomphLibError(error_message.str(),
385 OOMPH_CURRENT_FUNCTION,
386 OOMPH_EXCEPTION_LOCATION);
395 virtual void node_update(
const bool& update_all_solid_nodes =
false)
398 if (update_all_solid_nodes)
400 std::string error_message =
401 "Doesn't make sense to use an AlgebraicMesh with\n";
403 "SolidElements so specifying update_all_solid_nodes=true\n";
404 error_message +=
"doesn't make sense either\n";
406 std::string function_name =
"AlgebraicFishMesh::node_update()";
409 error_message, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
412 AlgebraicMesh::node_update();
438 Vector<double> zeta(1);
439 zeta[0] = 0.5 * (xi_nose + xi_tail);
442 GeomObject* geom_obj_pt = 0;
443 this->
Back_pt->locate_zeta(zeta, geom_obj_pt, s);
445 if ((geom_obj_pt != this->
Back_pt) || (s[0] != zeta[0]))
447 std::ostringstream error_message;
448 error_message <<
"AlgebraicFishMesh only works with GeomObjects\n"
449 <<
"that do not contain sub-elements (e.g. GeomObjects\n"
450 <<
"that represent a wall finite element mesh!\n"
451 <<
"Back_pt : " << this->
Back_pt << std::endl
452 <<
"geom_obj_pt: " << geom_obj_pt << std::endl
453 <<
"s[0] : " << s[0] << std::endl
454 <<
"zeta[0] : " << zeta[0] << std::endl;
456 throw OomphLibError(error_message.str(),
457 OOMPH_CURRENT_FUNCTION,
458 OOMPH_EXCEPTION_LOCATION);
488 template<
class ELEMENT>
500 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
501 :
FishMesh<ELEMENT>(time_stepper_pt),
517 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
518 :
FishMesh<ELEMENT>(back_pt, time_stepper_pt),
////////////////////////////////////////////////////////////////////
virtual ~AlgebraicFishMesh()
Destructor: empty.
void setup_algebraic_node_update()
Setup algebraic update operation for all nodes (separate function because this task needs to be perfo...
virtual void node_update(const bool &update_all_solid_nodes=false)
Resolve the node update function (we neither want the broken empty one in the Mesh base class nor the...
AlgebraicFishMesh(TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass pointer to timestepper. (defaults to (Steady) default timestepper defined in Mesh)
void node_update_in_body(const unsigned &t, AlgebraicNode *&node_pt)
Algebraic update function for nodes in upper/lower body.
void update_node_update(AlgebraicNode *&node_pt)
Update the geometric references that are used to update node after mesh adaptation....
AlgebraicFishMesh(GeomObject *back_pt, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass pointer GeomObject that defines the fish's back and pointer to timestepper (default...
void algebraic_node_update(const unsigned &t, AlgebraicNode *&node_pt)
Update nodal position at time level t (t=0: present; t>0: previous)
void node_update_in_fin(const unsigned &t, AlgebraicNode *&node_pt)
Algebraic update function for nodes in upper/lower fin.
////////////////////////////////////////////////////////////////////
AlgebraicRefineableFishMesh(GeomObject *back_pt, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass pointer GeomObject that defines the fish's back and pointer to timestepper....
virtual ~AlgebraicRefineableFishMesh()
Destructor: empty.
void node_update(const bool &update_all_solid_nodes=false)
Resolve node update function: Use the one defined in the AlgebraicFishMesh (where the bool flag is ex...
AlgebraicRefineableFishMesh(TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass pointer to timestepper. (defaults to (Steady) default timestepper defined in Mesh)
Fish shaped domain, represented by four MacroElements. Shape is parametrised by GeomObject that repre...
double & xi_nose()
Start coordinate on wall (near nose)
double & xi_tail()
End coordinate on wall (near tail)
Fish shaped mesh. The geometry is defined by the Domain object FishDomain.
GeomObject * Back_pt
Pointer to fish back.
virtual ~FishMesh()
Destructor: Kill the geom object that represents the fish's back (if necessary)
FishMesh(TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass pointer to timestepper (defaults to the (Steady) default timestepper defined in Mes...
GeomObject *& fish_back_pt()
Access function to geom object that represents the fish's back.
void build_mesh(TimeStepper *time_stepper_pt)
Build the mesh, using the geometric object identified by Back_pt.
bool Must_kill_fish_back
Do I need to kill the fish back geom object?
FishDomain *& domain_pt()
Access function to FishDomain.
FishDomain * Domain_pt
Pointer to domain.
Refineable fish shaped mesh with MacroElement-based node update. The fish's back is represented by a ...
void node_update(const bool &update_all_solid_nodes=false)
Resolve mesh update: NodeUpdate current nodal positions via sparse MacroElement-based update....
virtual ~MacroElementNodeUpdateRefineableFishMesh()
Destructor: empty.
MacroElementNodeUpdateRefineableFishMesh(GeomObject *back_pt, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass pointer GeomObject that defines the fish's back and pointer to timestepper (default...
////////////////////////////////////////////////////////////////////
void setup_adaptivity()
Setup all the information that's required for spatial adaptivity: Set pointers to macro elements and ...
RefineableFishMesh(TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass pointer to timestepper – defaults to (Steady) default timestepper defined in the Me...
RefineableFishMesh(GeomObject *back_pt, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass pointer GeomObject that defines the fish's back and pointer to timestepper (default...
virtual ~RefineableFishMesh()
Destructor: Empty – all cleanup gets handled in the base classes.
////////////////////////////////////////////////////////////////////// //////////////////////////////...