31 #ifndef OOMPH_RECTANGULAR_QUADMESH_HEADER 32 #define OOMPH_RECTANGULAR_QUADMESH_HEADER 36 #include <oomph-lib-config.h> 40 #include "../generic/mesh.h" 41 #include "../generic/quad_mesh.h" 42 #include "../generic/refineable_quad_mesh.h" 62 template <
class ELEMENT>
89 void build_mesh(TimeStepper* time_stepper_pt=&Mesh::Default_TimeStepper);
99 const double &xmin,
const double &xmax,
100 const double &ymin,
const double &ymax,
101 const bool &periodic_in_x,
103 TimeStepper* time_stepper_pt=&Mesh::Default_TimeStepper) :
104 Nx(nx), Ny(ny), Xmin(xmin), Xmax(xmax), Ymin(ymin), Ymax(ymax),
105 Xperiodic(periodic_in_x)
121 const double &lx,
const double &ly,
122 TimeStepper* time_stepper_pt=&Mesh::Default_TimeStepper) :
123 Nx(nx), Ny(ny), Xmin(0.0), Xmax(lx), Ymin(0.0), Ymax(ly), Xperiodic(false)
126 MeshChecker::assert_geometric_element<QElementGeometricBase,ELEMENT>(2);
135 const double &xmin,
const double &xmax,
136 const double &ymin,
const double &ymax,
137 TimeStepper* time_stepper_pt=&Mesh::Default_TimeStepper) :
138 Nx(nx), Ny(ny), Xmin(xmin), Xmax(xmax), Ymin(ymin), Ymax(ymax),
142 MeshChecker::assert_geometric_element<QElementGeometricBase,ELEMENT>(2);
154 const double &lx,
const double &ly,
155 const bool& periodic_in_x,
156 TimeStepper* time_stepper_pt=&Mesh::Default_TimeStepper) :
157 Nx(nx), Ny(ny), Xmin(0.0), Xmax(lx), Ymin(0.0), Ymax(ly),
158 Xperiodic(periodic_in_x)
161 MeshChecker::assert_geometric_element<QElementGeometricBase,ELEMENT>(2);
171 const double &xmin,
const double &xmax,
172 const double &ymin,
const double &ymax,
173 const bool& periodic_in_x,
174 TimeStepper* time_stepper_pt=&Mesh::Default_TimeStepper) :
175 Nx(nx), Ny(ny), Xmin(xmin), Xmax(xmax), Ymin(ymin), Ymax(ymax),
176 Xperiodic(periodic_in_x)
179 MeshChecker::assert_geometric_element<QElementGeometricBase,ELEMENT>(2);
186 const unsigned&
nx()
const 193 const unsigned&
ny()
const 242 unsigned yelement,
unsigned ynode)
245 double xstep = (Xmax-
Xmin)/((Np-1)*
Nx);
247 return (Xmin + xstep*((Np-1)*xelement + xnode));
257 unsigned yelement,
unsigned ynode)
259 double ystep = (Ymax-
Ymin)/((Np-1)*
Ny);
261 return (Ymin + ystep*((Np-1)*yelement + ynode));
284 template <
class ELEMENT>
287 public RefineableQuadMesh<ELEMENT>
297 const double &lx,
const double &ly,
298 TimeStepper* time_stepper_pt=
299 &Mesh::Default_TimeStepper) :
304 this->setup_quadtree_forest();
313 const double &lx,
const double &ly,
314 const bool &periodic_in_x,
315 TimeStepper* time_stepper_pt=
316 &Mesh::Default_TimeStepper) :
321 this->setup_quadtree_forest();
328 const double &xmin,
const double &xmax,
329 const double &ymin,
const double &ymax,
330 TimeStepper* time_stepper_pt=
331 &Mesh::Default_TimeStepper) :
336 this->setup_quadtree_forest();
343 const double &xmin,
const double &xmax,
344 const double &ymin,
const double &ymax,
345 const bool &periodic_in_x,
346 TimeStepper* time_stepper_pt=
347 &Mesh::Default_TimeStepper) :
352 this->setup_quadtree_forest();
372 template <
class ELEMENT>
375 public virtual SolidMesh
389 const Vector<double>& origin,
390 TimeStepper* time_stepper_pt=
391 &Mesh::Default_TimeStepper) :
396 unsigned nnod=nnode();
397 for (
unsigned j=0;j<nnod;j++)
399 node_pt(j)->x(0)+=origin[0];
400 node_pt(j)->x(1)+=origin[1];
406 set_lagrangian_nodal_coordinates();
409 set_boundary_coordinates(origin);
422 TimeStepper* time_stepper_pt=
423 &Mesh::Default_TimeStepper) :
428 Vector<double> origin(2,0.0);
433 set_lagrangian_nodal_coordinates();
436 set_boundary_coordinates(origin);
448 const bool& periodic_in_x,
449 TimeStepper* time_stepper_pt=
450 &Mesh::Default_TimeStepper) :
455 Vector<double> origin(2,0.0);
460 set_lagrangian_nodal_coordinates();
463 set_boundary_coordinates(origin);
475 Vector<double> zeta(1);
479 for (
unsigned b=0;b<3;b+=2)
482 unsigned n_nod = nboundary_node(b);
485 for(
unsigned i=0;i<n_nod;i++)
488 zeta[0]=boundary_node_pt(b,i)->xi(0)-origin[0];
489 boundary_node_pt(b,i)->set_coordinates_on_boundary(b,zeta);
491 Boundary_coordinate_exists[b]=
true;
497 for (
unsigned b=1;b<4;b+=2)
500 unsigned n_nod = nboundary_node(b);
503 for(
unsigned i=0;i<n_nod;i++)
506 zeta[0]=boundary_node_pt(b,i)->xi(1) - origin[1]
508 boundary_node_pt(b,i)->set_coordinates_on_boundary(b,zeta);
510 Boundary_coordinate_exists[b]=
true;
536 template <
class ELEMENT>
539 public RefineableQuadMesh<ELEMENT>
552 TimeStepper* time_stepper_pt=
553 &Mesh::Default_TimeStepper) :
560 this->setup_quadtree_forest();
572 const bool& periodic_in_x,
573 TimeStepper* time_stepper_pt=
574 &Mesh::Default_TimeStepper) :
581 this->setup_quadtree_forest();
594 const Vector<double>& origin,
595 TimeStepper* time_stepper_pt=
596 &Mesh::Default_TimeStepper) :
603 this->setup_quadtree_forest();
const unsigned & nx() const
Return number of elements in x direction.
RefineableRectangularQuadMesh(const unsigned &nx, const unsigned &ny, const double &xmin, const double &xmax, const double &ymin, const double &ymax, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor that allows the specification of minimum and maximum values of x and y coordinates Also p...
virtual double x_spacing_function(unsigned xelement, unsigned xnode, unsigned yelement, unsigned ynode)
Return the value of the x-coordinate at the node given by the local node number (xnode, ynode) in the element (xelement,yelement). The description is in a "psudeo" two-dimensional coordinate system, so the range of xelement is [0,Nx-1], yelement is [0,Ny-1], and that of xnode and ynode is [0,Np-1]. The default is to return nodes that are equally spaced in the x coodinate.
RectangularQuadMesh(const unsigned &nx, const unsigned &ny, const double &lx, const double &ly, const bool &periodic_in_x, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Simple constructor: nx: number of elements in x direction; ny: number of elements in y direction; lx...
unsigned Ny
Ny: number of elements in y-direction.
const double x_min() const
Return the minimum value of x coordinate.
virtual double y_spacing_function(unsigned xelement, unsigned xnode, unsigned yelement, unsigned ynode)
Return the value of the y-coordinate at the node given by the local node number (xnode, ynode) in the element (xelement,yelement). The description is in a "psudeo" two-dimensional coordinate system, so the range of xelement is [0,Nx-1], yelement is [0,Ny-1], and that of xnode and ynode is [0,Np-1]. The default it to return nodes that are equally spaced in the y coordinate.
RefineableRectangularQuadMesh(const unsigned &nx, const unsigned &ny, const double &lx, const double &ly, const bool &periodic_in_x, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Simple constructor: nx: number of elements in x direction; ny: number of elements in y direction; lx...
RefineableRectangularQuadMesh(const unsigned &nx, const unsigned &ny, const double &lx, const double &ly, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Simple constructor: nx: number of elements in x direction; ny: number of elements in y direction; lx...
RefineableRectangularQuadMesh(const unsigned &nx, const unsigned &ny, const double &xmin, const double &xmax, const double &ymin, const double &ymax, const bool &periodic_in_x, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor that allows the specification of minimum and maximum values of x and y coordinates and pe...
const unsigned & ny() const
Return number of elements in y direction.
const double x_max() const
Return the maximum value of x coordinate.
unsigned Nx
Nx: number of elements in x-direction.
RectangularQuadMesh(const unsigned &nx, const unsigned &ny, const double &xmin, const double &xmax, const double &ymin, const double &ymax, const bool &periodic_in_x, const bool &build, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor that allows the specification of minimum and maximum values of x and y coordinates and do...
unsigned Np
Np: number of (linear) points in the element.
bool Xperiodic
Boolean variable used to determine whether the mesh is periodic in the x-direction.
RectangularQuadMesh(const unsigned &nx, const unsigned &ny, const double &lx, const double &ly, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Simple constructor: nx: number of elements in x direction; ny: number of elements in y direction; lx...
virtual void element_reorder()
Reorder the elements: By default they are ordered in "horizontal" layers (increasing in x...
void build_mesh(TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Generic mesh construction function: contains all the hard work.
RectangularQuadMesh(const unsigned &nx, const unsigned &ny, const double &xmin, const double &xmax, const double &ymin, const double &ymax, const bool &periodic_in_x, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor that allows the specification of minimum and maximum values of x and y coordinates...
const double y_max() const
Return the maximum value of y coordinate.
void set_boundary_coordinates(const Vector< double > &origin)
Setup the boundary coordinates. Vector origin specifies the coordinates of the lower left corner of t...
RectangularQuadMesh(const unsigned &nx, const unsigned &ny, const double &xmin, const double &xmax, const double &ymin, const double &ymax, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor that allows the specification of minimum and maximum values of x and y coordinates...
double Xmin
Minimum value of x coordinate.
double Ymax
Maximum value of y coordinate.
const double y_min() const
Return the minimum value of y coordinate.
double Xmax
Maximum value of x coordinate.
double Ymin
Minimum value of y coordinate.