30 #ifndef OOMPH_SINGLE_LAYER_SPINE_MESH_TEMPLATE_CC 31 #define OOMPH_SINGLE_LAYER_SPINE_MESH_TEMPLATE_CC 54 template<
class ELEMENT>
56 const unsigned &nx,
const unsigned &ny,
57 const double &lx,
const double &h, TimeStepper* time_stepper_pt) :
62 MeshChecker::assert_geometric_element<QElementGeometricBase,ELEMENT>(2);
65 MeshChecker::assert_geometric_element<SpineFiniteElement,ELEMENT>(2);
88 template<
class ELEMENT>
90 const unsigned &
nx,
const unsigned &
ny,
91 const double &lx,
const double &h,
const bool& periodic_in_x,
92 TimeStepper* time_stepper_pt) :
97 MeshChecker::assert_geometric_element<QElementGeometricBase,ELEMENT>(2);
100 MeshChecker::assert_geometric_element<SpineFiniteElement,ELEMENT>(2);
118 template<
class ELEMENT>
120 TimeStepper* time_stepper_pt)
124 MeshChecker::assert_geometric_element<QElementGeometricBase,ELEMENT>(2);
130 unsigned n_x = this->
Nx;
131 unsigned n_y = this->
Ny;
137 unsigned n_p =
dynamic_cast<ELEMENT*
>(finite_element_pt(0))->nnode_1d();
142 Spine_pt.reserve((n_p-1)*n_x);
146 Spine_pt.reserve((n_p-1)*n_x+1);
156 Spine* new_spine_pt=
new Spine(1.0);
157 Spine_pt.push_back(new_spine_pt);
161 SpineNode* nod_pt=element_node_pt(0,0);
163 nod_pt->spine_pt() = new_spine_pt;
165 nod_pt->fraction() = 0.0;
167 nod_pt->spine_mesh_pt() =
this;
171 for(
unsigned long i=0;i<n_y;i++)
174 for(
unsigned l1=1;l1<n_p;l1++)
177 SpineNode* nod_pt=element_node_pt(i*n_x,l1*n_p);
179 nod_pt->spine_pt() = new_spine_pt;
181 nod_pt->fraction()=(double(i)+double(l1)/double(n_p-1))/
double(n_y);
183 nod_pt->spine_mesh_pt() =
this;
192 for(
unsigned long j=0;j<n_x;j++)
199 if ((this->
Xperiodic)&&(j==n_x-1)) n_pmax=n_p-1;
201 for(
unsigned l2=1;l2<n_pmax;l2++)
204 new_spine_pt=
new Spine(1.0);
205 Spine_pt.push_back(new_spine_pt);
208 SpineNode* nod_pt=element_node_pt(j,l2);
210 nod_pt->spine_pt() = new_spine_pt;
212 nod_pt->fraction() = 0.0;
214 nod_pt->spine_mesh_pt() =
this;
218 for(
unsigned long i=0;i<n_y;i++)
221 for(
unsigned l1=1;l1<n_p;l1++)
224 SpineNode* nod_pt=element_node_pt(i*n_x+j,l1*n_p+l2);
226 nod_pt->spine_pt() = new_spine_pt;
228 nod_pt->fraction()=(double(i)+double(l1)/double(n_p-1))/
double(n_y);
230 nod_pt->spine_mesh_pt() =
this;
243 Spine* final_spine_pt=Spine_pt[0];
246 SpineNode* nod_pt=element_node_pt((n_x-1),(n_p-1));
249 nod_pt->spine_pt() = final_spine_pt;
251 nod_pt->fraction() = element_node_pt(0,0)->fraction();
253 nod_pt->spine_mesh_pt() = element_node_pt(0,0)->spine_mesh_pt();
256 for(
unsigned i=0;i<n_y;i++)
259 for(
unsigned l1=1;l1<n_p;l1++)
262 SpineNode* nod_pt=element_node_pt(i*n_x+(n_x-1),l1*n_p+(n_p-1));
265 nod_pt->spine_pt() = final_spine_pt;
267 nod_pt->fraction() = element_node_pt(i*n_x,l1*n_p)->fraction();
269 nod_pt->spine_mesh_pt() =
270 element_node_pt(i*n_x,l1*n_p)->spine_mesh_pt();
const unsigned & nx() const
Return number of elements in x direction.
SingleLayerSpineMesh(const unsigned &nx, const unsigned &ny, const double &lx, const double &h, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass number of elements in x-direction, number of elements in y-direction, axial length, height of layer, and pointer to timestepper (defaults to Steady timestepper)
virtual void build_single_layer_mesh(TimeStepper *time_stepper_pt)
Helper function to actually build the single-layer spine mesh (called from various constructors) ...
unsigned Ny
Ny: number of elements in y-direction.
const unsigned & ny() const
Return number of elements in y direction.
unsigned Nx
Nx: number of elements in x-direction.
bool Xperiodic
Boolean variable used to determine whether the mesh is periodic in the x-direction.
void build_mesh(TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Generic mesh construction function: contains all the hard work.