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>
 
  126   template<
class ELEMENT>
 
  135       : 
FishMesh<ELEMENT>(time_stepper_pt)
 
  152       : 
FishMesh<ELEMENT>(back_pt, time_stepper_pt)
 
  183   class MacroElementNodeUpdateNode;
 
  196   template<
class ELEMENT>
 
  208       : 
FishMesh<ELEMENT>(back_pt, time_stepper_pt),
 
  212       ELEMENT* el_pt = 
new ELEMENT;
 
  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;
 
  223           "MacroElementNodeUpdateRefineableFishMesh::\n";
 
  224         function_name += 
"MacroElementNodeUpdateRefineableFishMesh()";
 
  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));
 
  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();
 
  257             "MacroElementNodeUpdateRefineableFishMesh::\n";
 
  258           function_name += 
"MacroElementNodeUpdateRefinableFishMesh()";
 
  261                               OOMPH_CURRENT_FUNCTION,
 
  262                               OOMPH_EXCEPTION_LOCATION);
 
  267         geom_object_pt[0] = this->
Back_pt;
 
  271         el_pt->set_node_update_info(geom_object_pt);
 
  276       geom_object_pt[0] = this->
Back_pt;
 
  294       if (update_all_solid_nodes)
 
  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";
 
  303           "MacroElementNodeUpdateRefineableFishMesh::";
 
  304         function_name += 
"node_update()";
 
  307           error_message, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
 
  325   template<
class ELEMENT>
 
  333       : 
FishMesh<ELEMENT>(time_stepper_pt)
 
  344       : 
FishMesh<ELEMENT>(back_pt, time_stepper_pt)
 
  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;
 
  382           "AlgebraicFishMesh::algebraic_node_update()";
 
  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)
 
  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);
 
  439       zeta[0] = 0.5 * (xi_nose + xi_tail);
 
  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;
 
  457                             OOMPH_CURRENT_FUNCTION,
 
  458                             OOMPH_EXCEPTION_LOCATION);
 
  488   template<
class ELEMENT>
 
  501       : 
FishMesh<ELEMENT>(time_stepper_pt),
 
  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.
////////////////////////////////////////////////////////////////////
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...
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...
AlgebraicNode * node_pt(const unsigned long &n)
Return a pointer to the n-th global AlgebraicNode.
////////////////////////////////////////////////////////////////////
int node_update_fct_id()
Default (usually first if there are multiple ones) node update fct id.
////////////////////////////////////////////////////////////////////
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.
/////////////////////////////////////////////////////////////////////
virtual void locate_zeta(const Vector< double > &zeta, GeomObject *&sub_geom_object_pt, Vector< double > &s, const bool &use_coordinate_as_initial_guess=false)
A geometric object may be composed of may sub-objects (e.g. a finite-element representation of a boun...
////////////////////////////////////////////////////////////////////
MacroElementNodeUpdateMeshes contain MacroElementNodeUpdateNodes which have their own node update fun...
void set_geom_object_vector_pt(Vector< GeomObject * > geom_object_vector_pt)
Set geometric objects associated with MacroElementNodeUpdateMesh; this must also be called from the c...
void node_update(const bool &update_all_solid_nodes=false)
Update all nodal positions via sparse MacroElement-based update functions. If a Node is hanging its p...
Domain *& macro_domain_pt()
Broken assignment operator.
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...
static Steady< 0 > Default_TimeStepper
Default Steady Timestepper, to be used in default arguments to Mesh constructors.
const Vector< GeneralisedElement * > & element_pt() const
Return reference to the Vector of elements.
unsigned long nelement() const
Return number of elements in the mesh.
An OomphLibError object which should be thrown when an run-time error is encountered....
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
////////////////////////////////////////////////////////////////////
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.
Intermediate mesh class that implements the mesh adaptation functions specified in the TreeBasedRefin...
////////////////////////////////////////////////////////////////////// //////////////////////////////...
A slight extension to the standard template vector class so that we can include "graceful" array rang...
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...