26 #ifndef OOMPH_SIMPLE_RECTANGULAR_TRIMESH_TEMPLATE_CC
27 #define OOMPH_SIMPLE_RECTANGULAR_TRIMESH_TEMPLATE_CC
32 #include "../generic/Telements.h"
53 template<
class ELEMENT>
60 : Nx(n_x), Ny(n_y), Lx(l_x), Ly(l_y)
62 using namespace MathematicalConstants;
65 MeshChecker::assert_geometric_element<TElementGeometricBase, ELEMENT>(2);
71 unsigned n_element = (
Nx) * (
Ny)*2;
83 "Currently this mesh only works for 3, 6 & 10-noded triangles",
84 OOMPH_CURRENT_FUNCTION,
85 OOMPH_EXCEPTION_LOCATION);
90 unsigned additional_nnode = 0;
95 n_node = (
Nx + 1) * (
Ny + 1);
100 additional_nnode = 3;
102 n_node = (2 *
Nx + 1) * (2 *
Ny + 1);
107 additional_nnode = 7;
109 n_node = (3 *
Nx + 1) * (3 *
Ny + 1);
116 unsigned long node_count = 0;
117 unsigned long element_count = 0;
118 double xinit = 0.0, yinit = 0.0;
120 double xstep =
Lx / (
Nx);
121 double ystep =
Ly / (
Ny);
149 for (
unsigned j = 0; j <
Ny + 1; ++j)
151 for (
unsigned i = 0;
i <
Nx + 1; ++
i)
155 if (j <
Ny &&
i <
Nx)
159 if (element_count != 0)
210 Node_pt[node_count]->x(0) = xinit +
i * xstep;
211 Node_pt[node_count]->x(1) = yinit + j * ystep;
241 if (additional_nnode == 3)
247 for (
unsigned j = 0; j <
Ny + 1; ++j)
251 for (
unsigned i = 0;
i <
Nx; ++
i)
286 Node_pt[node_count]->x(0) = xinit + double(
i + 0.5) * xstep;
287 Node_pt[node_count]->x(1) = yinit + j * ystep;
314 for (
unsigned j = 0; j <
Ny; ++j)
316 for (
unsigned i = 0;
i <
Nx + 1; ++
i)
318 if (j <
Ny &&
i <
Nx)
343 Node_pt[node_count]->x(0) = xinit +
i * xstep;
344 Node_pt[node_count]->x(1) = yinit + double(j + 0.5) * ystep;
369 for (
unsigned j = 0; j <
Ny; ++j)
371 for (
unsigned i = 0;
i <
Nx; ++
i)
387 Node_pt[node_count]->x(0) = xinit + double(
i + 0.5) * xstep;
388 Node_pt[node_count]->x(1) = yinit + double(j + 0.5) * ystep;
401 if (additional_nnode == 7)
407 for (
unsigned j = 0; j <
Ny + 1; ++j)
411 for (
unsigned i = 0;
i <
Nx; ++
i)
447 Node_pt[node_count]->x(0) = xinit + double(
i + 1.0 / 3.0) * xstep;
448 Node_pt[node_count]->x(1) = yinit + j * ystep;
472 for (
unsigned j = 0; j <
Ny + 1; ++j)
475 for (
unsigned i = 0;
i <
Nx; ++
i)
505 Node_pt[node_count]->x(0) = xinit + double(
i + 2.0 / 3.0) * xstep;
506 Node_pt[node_count]->x(1) = yinit + j * ystep;
532 for (
unsigned j = 0; j <
Ny; ++j)
534 for (
unsigned i = 0;
i <
Nx + 1; ++
i)
536 if (j <
Ny &&
i <
Nx)
561 Node_pt[node_count]->x(0) = xinit +
i * xstep;
562 Node_pt[node_count]->x(1) = yinit + double(j + 1.0 / 3.0) * ystep;
588 for (
unsigned j = 0; j <
Ny; ++j)
590 for (
unsigned i = 0;
i <
Nx + 1; ++
i)
592 if (j <
Ny &&
i <
Nx)
617 Node_pt[node_count]->x(0) = xinit +
i * xstep;
618 Node_pt[node_count]->x(1) = yinit + double(j + 2.0 / 3.0) * ystep;
641 for (
unsigned j = 0; j <
Ny; ++j)
643 for (
unsigned i = 0;
i <
Nx; ++
i)
656 Node_pt[node_count]->x(0) = xinit + double(
i + 1.0 / 3.0) * xstep;
657 Node_pt[node_count]->x(1) = yinit + double(j + 1.0 / 3.0) * ystep;
672 for (
unsigned j = 0; j <
Ny; ++j)
674 for (
unsigned i = 0;
i <
Nx; ++
i)
689 Node_pt[node_count]->x(0) = xinit + double(
i + 2.0 / 3.0) * xstep;
690 Node_pt[node_count]->x(1) = yinit + double(j + 1.0 / 3.0) * ystep;
705 for (
unsigned j = 0; j <
Ny; ++j)
707 for (
unsigned i = 0;
i <
Nx; ++
i)
722 Node_pt[node_count]->x(0) = xinit + double(
i + 1.0 / 3.0) * xstep;
723 Node_pt[node_count]->x(1) = yinit + double(j + 2.0 / 3.0) * ystep;
737 for (
unsigned j = 0; j <
Ny; ++j)
739 for (
unsigned i = 0;
i <
Nx; ++
i)
753 Node_pt[node_count]->x(0) = xinit + double(
i + 2.0 / 3.0) * xstep;
754 Node_pt[node_count]->x(1) = yinit + double(j + 2.0 / 3.0) * ystep;
virtual Node * construct_node(const unsigned &n)
Construct the local node n and return a pointer to the newly created node object.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
virtual unsigned nnode_1d() const
Return the number of nodes along one edge of the element Default is to return zero — must be overload...
void add_boundary_node(const unsigned &b, Node *const &node_pt)
Add a (pointer to) a node to the b-th boundary.
Vector< Node * > Node_pt
Vector of pointers to nodes.
FiniteElement * finite_element_pt(const unsigned &e) const
Upcast (downcast?) to FiniteElement (needed to access FiniteElement member functions).
void set_nboundary(const unsigned &nbound)
Set the number of boundaries in the mesh.
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,...
Vector< GeneralisedElement * > Element_pt
Vector of pointers to generalised elements.
An OomphLibError object which should be thrown when an run-time error is encountered....
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;...
double Lx
Length of mesh in x-direction.
unsigned Ny
Number of elements in y directions.
unsigned Nx
Number of elements in x direction.
double Ly
Length of mesh in y-direction.
////////////////////////////////////////////////////////////////////// //////////////////////////////...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...