30 #ifndef OOMPH_SIMPLE_RECTANGULAR_TRIMESH_TEMPLATE_CC 31 #define OOMPH_SIMPLE_RECTANGULAR_TRIMESH_TEMPLATE_CC 36 #include "../generic/Telements.h" 60 template <
class ELEMENT>
64 const double &l_x,
const double &l_y,
65 TimeStepper* time_stepper_pt) : Nx(n_x), Ny(n_y), Lx(l_x), Ly(l_y)
68 using namespace MathematicalConstants;
71 MeshChecker::assert_geometric_element<TElementGeometricBase,ELEMENT>(2);
77 unsigned n_element = (
Nx)*(
Ny)*2;
89 "Currently this mesh only works for 3, 6 & 10-noded triangles",
90 OOMPH_CURRENT_FUNCTION,
91 OOMPH_EXCEPTION_LOCATION);
96 unsigned additional_nnode=0;
101 n_node = (
Nx+1)*(
Ny+1);
106 additional_nnode = 3;
108 n_node = (2*
Nx + 1)*(2*
Ny + 1);
113 additional_nnode = 7;
115 n_node = (3*
Nx + 1)*(3*
Ny + 1);
122 unsigned long node_count=0;
123 unsigned long element_count=0;
124 double xinit=0.0, yinit=0.0;
126 double xstep =
Lx/(
Nx);
127 double ystep =
Ly/(
Ny);
154 for (
unsigned j=0;j<
Ny+1;++j)
156 for (
unsigned i=0;
i<
Nx+1;++
i)
164 if (element_count != 0)
178 construct_node(0,time_stepper_pt);
185 construct_node(2,time_stepper_pt);
190 construct_node(1,time_stepper_pt);
209 Node_pt[node_count]->x(0) = xinit +
i*xstep;
210 Node_pt[node_count]->x(1) = yinit + j*ystep;
240 if (additional_nnode==3)
246 for (
unsigned j=0;j<Ny+1 ;++j)
250 for (
unsigned i=0;
i<
Nx ;++
i)
264 construct_node(4,time_stepper_pt);
270 construct_node(4,time_stepper_pt);
284 Node_pt[node_count]->x(0)=xinit + double(
i+0.5)*xstep;
285 Node_pt[node_count]->x(1)=yinit + j*ystep;
312 for (
unsigned j=0;j<
Ny;++j)
314 for (
unsigned i=0;
i<
Nx+1;++
i)
323 construct_node(3,time_stepper_pt);
329 construct_node(3,time_stepper_pt);
340 Node_pt[node_count]->x(0)=xinit +
i*xstep;
341 Node_pt[node_count]->x(1)=yinit + double(j+0.5)*ystep;
366 for (
unsigned j=0;j<
Ny;++j)
368 for (
unsigned i=0;
i<
Nx;++
i)
372 construct_node(5,time_stepper_pt);
383 Node_pt[node_count]->x(0)=xinit + double(
i+0.5)*xstep;
384 Node_pt[node_count]->x(1)=yinit + double(j+0.5)*ystep;
400 if (additional_nnode==7)
406 for (
unsigned j=0;j<Ny+1 ;++j)
410 for (
unsigned i=0;
i<
Nx ;++
i)
425 construct_node(5,time_stepper_pt);
431 construct_node(6,time_stepper_pt);
445 Node_pt[node_count]->x(0)=xinit + double(
i+ 1.0/3.0)*xstep;
446 Node_pt[node_count]->x(1)=yinit + j*ystep;
470 for (
unsigned j=0;j<Ny+1 ;++j)
473 for (
unsigned i=0;
i<
Nx ;++
i)
482 construct_node(6,time_stepper_pt);
488 construct_node(5,time_stepper_pt);
502 Node_pt[node_count]->x(0)=xinit + double(
i+ 2.0/3.0)*xstep;
503 Node_pt[node_count]->x(1)=yinit + j*ystep;
530 for (
unsigned j=0;j<
Ny;++j)
532 for (
unsigned i=0;
i<
Nx+1;++
i)
541 construct_node(4,time_stepper_pt);
547 construct_node(3,time_stepper_pt);
558 Node_pt[node_count]->x(0)=xinit +
i*xstep;
559 Node_pt[node_count]->x(1)=yinit + double(j+ 1.0/3.0)*ystep;
585 for (
unsigned j=0;j<
Ny;++j)
587 for (
unsigned i=0;
i<
Nx+1;++
i)
596 construct_node(3,time_stepper_pt);
602 construct_node(4,time_stepper_pt);
613 Node_pt[node_count]->x(0)=xinit +
i*xstep;
614 Node_pt[node_count]->x(1)=yinit + double(j+ 2.0/3.0)*ystep;
637 for (
unsigned j=0;j<
Ny;++j)
639 for (
unsigned i=0;
i<
Nx;++
i)
643 construct_node(9,time_stepper_pt);
652 Node_pt[node_count]->x(0)=xinit + double(
i+ 1.0/3.0)*xstep;
653 Node_pt[node_count]->x(1)=yinit + double(j+ 1.0/3.0)*ystep;
668 for (
unsigned j=0;j<
Ny;++j)
670 for (
unsigned i=0;
i<
Nx;++
i)
674 construct_node(7,time_stepper_pt);
684 Node_pt[node_count]->x(0)=xinit + double(
i+ 2.0/3.0)*xstep;
685 Node_pt[node_count]->x(1)=yinit + double(j+ 1.0/3.0)*ystep;
701 for (
unsigned j=0;j<
Ny;++j)
703 for (
unsigned i=0;
i<
Nx;++
i)
707 construct_node(8,time_stepper_pt);
717 Node_pt[node_count]->x(0)=xinit + double(
i+ 1.0/3.0)*xstep;
718 Node_pt[node_count]->x(1)=yinit + double(j+ 2.0/3.0)*ystep;
731 for (
unsigned j=0;j<
Ny;++j)
733 for (
unsigned i=0;
i<
Nx;++
i)
737 construct_node(9,time_stepper_pt);
746 Node_pt[node_count]->x(0)=xinit + double(
i+ 2.0/3.0)*xstep;
747 Node_pt[node_count]->x(1)=yinit + double(j+ 2.0/3.0)*ystep;
unsigned Nx
Number of elements in x direction.
Vector< Node * > Node_pt
Vector of pointers to nodes.
void convert_to_boundary_node(Node *&node_pt, const Vector< FiniteElement *> &finite_element_pt)
A function that upgrades an ordinary node to a boundary node We shouldn't ever really use this...
void add_boundary_node(const unsigned &b, Node *const &node_pt)
Add a (pointer to) a node to the b-th boundary.
double Ly
Length of mesh in y-direction.
SimpleRectangularTriMesh(const unsigned &n_x, const unsigned &n_y, const double &l_x, const double &l_y, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor n_x : number of elements in the x direction; n_y : number of elements in the y direction;...
virtual Node * construct_node(const unsigned &n)
Construct the local node n and return a pointer to the newly created node object. ...
double Lx
Length of mesh in x-direction.
void set_nboundary(const unsigned &nbound)
Set the number of boundaries in the mesh.
Vector< GeneralisedElement * > Element_pt
Vector of pointers to generalised elements.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
unsigned Ny
Number of elements in y directions.
FiniteElement * finite_element_pt(const unsigned &e) const
Upcast (downcast?) to FiniteElement (needed to access FiniteElement member functions).
virtual unsigned nnode_1d() const
Return the number of nodes along one edge of the element Default is to return zero — must be overloa...
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...