30 #ifndef OOMPH_SIMPLE_RECTANGULAR_QUADMESH_TEMPLATE_CC    31 #define OOMPH_SIMPLE_RECTANGULAR_QUADMESH_TEMPLATE_CC    33 #include "../generic/Qelements.h"    56 template <
class ELEMENT>
    60  const double &Lx, 
const double &Ly,
    64  MeshChecker::assert_geometric_element<QElementGeometricBase,ELEMENT>(2);
    74  Element_pt.resize(Nx*Ny);
    77  Element_pt[0] = 
new ELEMENT;
    80  unsigned n_p = 
dynamic_cast<ELEMENT*
>(finite_element_pt(0))->nnode_1d();
    83  Node_pt.resize((1 + (n_p-1)*Nx)*(1 + (n_p-1)*Ny));
    88  unsigned long node_count=0;
    89  double xinit = 0.0, yinit = 0.0;
    96  double el_length_x = Lx/double(Nx);
    97  double el_length_y = Ly/double(Ny);
   115  Node_pt[node_count] = 
   116   finite_element_pt(0)->construct_boundary_node(0,time_stepper_pt);
   119  finite_element_pt(0)->node_pt(0) = Node_pt[node_count];
   122  Node_pt[node_count]->x(0) = xinit;
   123  Node_pt[node_count]->x(1) = yinit;
   126  add_boundary_node(0,Node_pt[node_count]);
   127  add_boundary_node(3,Node_pt[node_count]);
   133  for(
unsigned l2=1;l2<n_p;l2++)
   136    Node_pt[node_count] = finite_element_pt(0)->
   137     construct_boundary_node(l2,time_stepper_pt);
   140    finite_element_pt(0)->node_pt(l2) = Node_pt[node_count];
   143    finite_element_pt(0)->local_fraction_of_node(l2,s_fraction);
   146    Node_pt[node_count]->x(0) = xinit + el_length_x*s_fraction[0];
   147    Node_pt[node_count]->x(1) = yinit;
   150    add_boundary_node(0,Node_pt[node_count]);
   157  for(
unsigned l1=1;l1<n_p;l1++)
   160    Node_pt[node_count] = finite_element_pt(0)->
   161     construct_boundary_node(l1*n_p,time_stepper_pt);
   164    finite_element_pt(0)->node_pt(l1*n_p) = Node_pt[node_count];
   167    finite_element_pt(0)->local_fraction_of_node(l1*n_p,s_fraction);
   170    Node_pt[node_count]->x(0) = xinit;
   171    Node_pt[node_count]->x(1) = yinit + el_length_y*s_fraction[1];
   174    add_boundary_node(3,Node_pt[node_count]);
   180    for(
unsigned l2=1;l2<n_p;l2++)
   183      Node_pt[node_count] = finite_element_pt(0)->
   184       construct_node(l1*n_p+l2,time_stepper_pt);
   187      finite_element_pt(0)->node_pt(l1*n_p+l2) = Node_pt[node_count];
   190      finite_element_pt(0)->local_fraction_of_node(l1*n_p+l2,s_fraction);
   193      Node_pt[node_count]->x(0) = xinit + el_length_x*s_fraction[0];
   194      Node_pt[node_count]->x(1) = yinit + el_length_y*s_fraction[1];
   206  for(
unsigned j=1;j<(Nx-1);j++)
   209    Element_pt[j] = 
new ELEMENT;
   214    finite_element_pt(j)->node_pt(0) = finite_element_pt(j-1)->node_pt((n_p-1));
   217    for(
unsigned l2=1;l2<n_p;l2++)
   220      Node_pt[node_count] = finite_element_pt(j)->
   221       construct_boundary_node(l2,time_stepper_pt);
   224      finite_element_pt(j)->node_pt(l2) = Node_pt[node_count];
   227      finite_element_pt(j)->local_fraction_of_node(l2,s_fraction);
   230      Node_pt[node_count]->x(0) = xinit + el_length_x*(j + s_fraction[0]);
   231      Node_pt[node_count]->x(1) = yinit;
   234      add_boundary_node(0,Node_pt[node_count]);
   241    for(
unsigned l1=1;l1<n_p;l1++)
   244      finite_element_pt(j)->node_pt(l1*n_p) = 
   245       finite_element_pt(j-1)->node_pt(l1*n_p+(n_p-1));
   248      for(
unsigned l2=1;l2<n_p;l2++)
   251        Node_pt[node_count] = finite_element_pt(j)->
   252         construct_node(l1*n_p+l2,time_stepper_pt);
   255        finite_element_pt(j)->node_pt(l1*n_p+l2) = Node_pt[node_count];
   258        finite_element_pt(j)->local_fraction_of_node(l1*n_p+l2,s_fraction);
   261        Node_pt[node_count]->x(0) = xinit + el_length_x*(j + s_fraction[0]);
   262        Node_pt[node_count]->x(1) = yinit + el_length_y*s_fraction[1];
   275  Element_pt[Nx-1] = 
new ELEMENT;
   277  finite_element_pt(Nx-1)->node_pt(0) = finite_element_pt(Nx-2)->node_pt(n_p-1);
   280  for(
unsigned l2=1;l2<(n_p-1);l2++)
   283    Node_pt[node_count] = finite_element_pt(Nx-1)->
   284     construct_boundary_node(l2,time_stepper_pt);
   287    finite_element_pt(Nx-1)->node_pt(l2) = Node_pt[node_count];
   290    finite_element_pt(Nx-1)->local_fraction_of_node(l2,s_fraction);
   293    Node_pt[node_count]->x(0) = xinit + el_length_x*(Nx-1 + s_fraction[0]);
   294    Node_pt[node_count]->x(1) = yinit;
   297    add_boundary_node(0,Node_pt[node_count]);
   306  Node_pt[node_count] = finite_element_pt(Nx-1)->
   307   construct_boundary_node(n_p-1,time_stepper_pt);
   310  finite_element_pt(Nx-1)->node_pt(n_p-1) = Node_pt[node_count];
   313  finite_element_pt(Nx-1)->local_fraction_of_node(n_p-1,s_fraction);
   316  Node_pt[node_count]->x(0) = xinit + el_length_x*(Nx-1 + s_fraction[0]);
   317  Node_pt[node_count]->x(1) = yinit;
   320  add_boundary_node(0,Node_pt[node_count]);
   321  add_boundary_node(1,Node_pt[node_count]);
   327  for(
unsigned l1=1;l1<n_p;l1++)
   330    finite_element_pt(Nx-1)->node_pt(l1*n_p) = 
   331     finite_element_pt(Nx-2)->node_pt(l1*n_p+(n_p-1));
   334    for(
unsigned l2=1;l2<(n_p-1);l2++)
   337      Node_pt[node_count] = finite_element_pt(Nx-1)->
   338       construct_node(l1*n_p+l2,time_stepper_pt);
   341      finite_element_pt(Nx-1)->node_pt(l1*n_p+l2) = Node_pt[node_count];
   344      finite_element_pt(Nx-1)->local_fraction_of_node(l1*n_p+l2,s_fraction);
   347      Node_pt[node_count]->x(0) = xinit + el_length_x*(Nx-1 + s_fraction[0]);
   348      Node_pt[node_count]->x(1) = yinit + el_length_y*s_fraction[1];
   357    Node_pt[node_count] = finite_element_pt(Nx-1)->
   358     construct_boundary_node(l1*n_p+(n_p-1),time_stepper_pt);
   361    finite_element_pt(Nx-1)->node_pt(l1*n_p+(n_p-1)) = Node_pt[node_count];
   364    finite_element_pt(Nx-1)->local_fraction_of_node(l1*n_p+(n_p-1),s_fraction);
   367    Node_pt[node_count]->x(0) = xinit + el_length_x*(Nx-1 + s_fraction[0]);
   368    Node_pt[node_count]->x(1) = yinit + el_length_y*s_fraction[1];
   371    add_boundary_node(1,Node_pt[node_count]);
   382  for(
unsigned i=1;
i<(Ny-1);
i++)
   387    Element_pt[Nx*
i] = 
new ELEMENT;
   390    for(
unsigned l2=0;l2<n_p;l2++)
   392      finite_element_pt(Nx*
i)->node_pt(l2) = 
   393       finite_element_pt(Nx*(i-1))->node_pt((n_p-1)*n_p + l2);
   397    for(
unsigned l1=1;l1<n_p;l1++)
   402      Node_pt[node_count] = finite_element_pt(Nx*
i)->
   403       construct_boundary_node(l1*n_p,time_stepper_pt);
   406      finite_element_pt(Nx*i)->node_pt(l1*n_p) = Node_pt[node_count];
   409      finite_element_pt(Nx*i)->local_fraction_of_node(l1*n_p,s_fraction);
   412      Node_pt[node_count]->x(0) = xinit;
   413      Node_pt[node_count]->x(1) = yinit + el_length_y*(i + s_fraction[1]);
   416      add_boundary_node(3,Node_pt[node_count]);
   422      for(
unsigned l2=1;l2<n_p;l2++)
   425        Node_pt[node_count] = finite_element_pt(Nx*i)->
   426         construct_node(l1*n_p+l2,time_stepper_pt);
   429        finite_element_pt(Nx*i)->node_pt(l1*n_p+l2) = Node_pt[node_count];
   432        finite_element_pt(Nx*i)->local_fraction_of_node(l1*n_p+l2,s_fraction);
   435        Node_pt[node_count]->x(0) = xinit + el_length_x*s_fraction[0];
   436        Node_pt[node_count]->x(1) = yinit + el_length_y*(i + s_fraction[1]);
   444    for(
unsigned j=1;j<(Nx-1);j++)
   447      Element_pt[Nx*
i+j] = 
new ELEMENT;
   450      for(
unsigned l2=0;l2<n_p;l2++)
   452        finite_element_pt(Nx*
i+j)->node_pt(l2) = 
   453         finite_element_pt(Nx*(
i-1)+j)->node_pt((n_p-1)*n_p + l2);
   456      for(
unsigned l1=1;l1<n_p;l1++)
   459        finite_element_pt(Nx*
i+j)->node_pt(l1*n_p) = 
   460         finite_element_pt(Nx*
i+(j-1))->node_pt(l1*n_p+(n_p-1));
   463        for(
unsigned l2=1;l2<n_p;l2++)
   466          Node_pt[node_count]=finite_element_pt(Nx*
i+j)->
   467           construct_node(l1*n_p+l2,time_stepper_pt);
   470          finite_element_pt(Nx*
i+j)->node_pt(l1*n_p+l2) = Node_pt[node_count];
   473          finite_element_pt(Nx*
i+j)->
   474           local_fraction_of_node(l1*n_p+l2,s_fraction);
   477          Node_pt[node_count]->x(0) = xinit + el_length_x*(j + s_fraction[0]);
   478          Node_pt[node_count]->x(1) = yinit + el_length_y*(
i + s_fraction[1]);
   489    Element_pt[Nx*
i+Nx-1] = 
new ELEMENT;
   492    for(
unsigned l2=0;l2<n_p;l2++)
   494      finite_element_pt(Nx*
i+Nx-1)->node_pt(l2) = 
   495       finite_element_pt(Nx*(
i-1)+Nx-1)->node_pt((n_p-1)*n_p + l2);
   498    for(
unsigned l1=1;l1<n_p;l1++)
   501      finite_element_pt(Nx*
i+Nx-1)->node_pt(l1*n_p) = 
   502       finite_element_pt(Nx*
i+Nx-2)->node_pt(l1*n_p+(n_p-1));
   505      for(
unsigned l2=1;l2<(n_p-1);l2++)
   508        Node_pt[node_count] = finite_element_pt(Nx*
i+Nx-1)->
   509         construct_node(l1*n_p+l2,time_stepper_pt);
   512        finite_element_pt(Nx*
i+Nx-1)->node_pt(l1*n_p+l2) = Node_pt[node_count];
   515        finite_element_pt(Nx*
i+Nx-1)->
   516         local_fraction_of_node(l1*n_p+l2,s_fraction);
   519        Node_pt[node_count]->x(0) = xinit + el_length_x*(Nx-1 + s_fraction[0]);
   520        Node_pt[node_count]->x(1) = yinit + el_length_y*(
i + s_fraction[1]);
   529      Node_pt[node_count] = finite_element_pt(Nx*
i+Nx-1)->
   530       construct_boundary_node(l1*n_p+(n_p-1),time_stepper_pt);
   533      finite_element_pt(Nx*
i+Nx-1)->node_pt(l1*n_p+(n_p-1)) = 
   537      finite_element_pt(Nx*
i+Nx-1)->
   538       local_fraction_of_node(l1*n_p+(n_p-1),s_fraction);
   541      Node_pt[node_count]->x(0) = xinit + el_length_x*(Nx-1 + s_fraction[0]);
   542      Node_pt[node_count]->x(1) = yinit + el_length_y*(
i + s_fraction[1]);
   545      add_boundary_node(1,Node_pt[node_count]);
   563  Element_pt[Nx*(Ny-1)] = 
new ELEMENT;
   566  for(
unsigned l2=0;l2<n_p;l2++)
   568    finite_element_pt(Nx*(Ny-1))->node_pt(l2) 
   569     = finite_element_pt(Nx*(Ny-2))->node_pt((n_p-1)*n_p + l2);
   574  for(
unsigned l1=1;l1<(n_p-1);l1++)
   577    Node_pt[node_count] = finite_element_pt(Nx*(Ny-1))->
   578     construct_boundary_node(n_p*l1,time_stepper_pt);
   581    finite_element_pt(Nx*(Ny-1))->node_pt(n_p*l1) = Node_pt[node_count];
   584    finite_element_pt(Nx*(Ny-1))->local_fraction_of_node(n_p*l1,s_fraction);
   587    Node_pt[node_count]->x(0) = xinit;
   588    Node_pt[node_count]->x(1) = yinit + el_length_y*(Ny-1 + s_fraction[1]);
   591    add_boundary_node(3,Node_pt[node_count]);
   597    for(
unsigned l2=1;l2<n_p;l2++)
   600      Node_pt[node_count] = 
   601       finite_element_pt(Nx*(Ny-1))->construct_node(n_p*l1+l2,time_stepper_pt);
   604      finite_element_pt(Nx*(Ny-1))->node_pt(n_p*l1+l2) = Node_pt[node_count];
   607      finite_element_pt(Nx*(Ny-1))->
   608       local_fraction_of_node(n_p*l1+l2,s_fraction);
   611      Node_pt[node_count]->x(0) = xinit + el_length_x*s_fraction[0];
   612      Node_pt[node_count]->x(1) = yinit + el_length_y*(Ny-1 + s_fraction[1]);
   624  Node_pt[node_count] = finite_element_pt(Nx*(Ny-1))->
   625   construct_boundary_node(n_p*(n_p-1),time_stepper_pt);
   627  finite_element_pt(Nx*(Ny-1))->node_pt(n_p*(n_p-1)) = Node_pt[node_count];
   630  finite_element_pt(Nx*(Ny-1))->
   631   local_fraction_of_node(n_p*(n_p-1),s_fraction);
   634  Node_pt[node_count]->x(0) = xinit;
   635  Node_pt[node_count]->x(1) = yinit + el_length_y*Ny;
   638  add_boundary_node(2,Node_pt[node_count]);
   639  add_boundary_node(3,Node_pt[node_count]);
   645  for(
unsigned l2=1;l2<n_p;l2++)
   648    Node_pt[node_count] = finite_element_pt(Nx*(Ny-1))->
   649     construct_boundary_node(n_p*(n_p-1)+l2,time_stepper_pt);
   652    finite_element_pt(Nx*(Ny-1))->node_pt(n_p*(n_p-1)+l2) = Node_pt[node_count];
   655    finite_element_pt(Nx*(Ny-1))->
   656     local_fraction_of_node(n_p*(n_p-1)+l2,s_fraction);
   660    Node_pt[node_count]->x(0) = xinit + el_length_x*s_fraction[0];
   661    Node_pt[node_count]->x(1) = yinit + el_length_y*Ny;
   664    add_boundary_node(2,Node_pt[node_count]);
   671  for(
unsigned j=1;j<(Nx-1);j++)
   674    Element_pt[Nx*(Ny-1)+j] = 
new ELEMENT;
   676    for(
unsigned l2=0;l2<n_p;l2++)
   678      finite_element_pt(Nx*(Ny-1)+j)->node_pt(l2) = 
   679       finite_element_pt(Nx*(Ny-2)+j)->node_pt((n_p-1)*n_p + l2);
   683    for(
unsigned l1=1;l1<(n_p-1);l1++)
   686      finite_element_pt(Nx*(Ny-1)+j)->node_pt(n_p*l1) 
   687       = finite_element_pt(Nx*(Ny-1)+(j-1))->node_pt(n_p*l1+(n_p-1));
   690      for(
unsigned l2=1;l2<n_p;l2++)
   693        Node_pt[node_count] = finite_element_pt(Nx*(Ny-1)+j)->
   694         construct_node(n_p*l1+l2,time_stepper_pt);
   696        finite_element_pt(Nx*(Ny-1)+j)->node_pt(n_p*l1+l2) = 
   700        finite_element_pt(Nx*(Ny-1)+j)->
   701         local_fraction_of_node(n_p*l1+l2,s_fraction);
   704        Node_pt[node_count]->x(0) = xinit + el_length_x*(j + s_fraction[0]);
   705        Node_pt[node_count]->x(1) = yinit + el_length_y*(Ny-1 + s_fraction[1]);
   714    finite_element_pt(Nx*(Ny-1)+j)->node_pt(n_p*(n_p-1)) 
   715     = finite_element_pt(Nx*(Ny-1)+(j-1))->node_pt(n_p*(n_p-1)+(n_p-1));
   717    for(
unsigned l2=1;l2<n_p;l2++)
   720      Node_pt[node_count] = finite_element_pt(Nx*(Ny-1)+j)->
   721       construct_boundary_node(n_p*(n_p-1)+l2,time_stepper_pt);
   723      finite_element_pt(Nx*(Ny-1)+j)->node_pt(n_p*(n_p-1)+l2) = 
   727      finite_element_pt(Nx*(Ny-1)+j)->
   728       local_fraction_of_node(n_p*(n_p-1)+l2,s_fraction);
   731      Node_pt[node_count]->x(0) = xinit + el_length_x*(j + s_fraction[0]);
   732      Node_pt[node_count]->x(1) = yinit + el_length_y*Ny;
   735      add_boundary_node(2,Node_pt[node_count]);
   748  Element_pt[Nx*(Ny-1)+Nx-1] = 
new ELEMENT;
   750  for(
unsigned l2=0;l2<n_p;l2++)
   752    finite_element_pt(Nx*(Ny-1)+Nx-1)->node_pt(l2) = 
   753     finite_element_pt(Nx*(Ny-2)+Nx-1)->node_pt((n_p-1)*n_p + l2);
   757  for(
unsigned l1=1;l1<(n_p-1);l1++)
   760    finite_element_pt(Nx*(Ny-1)+Nx-1)->node_pt(n_p*l1) 
   761     = finite_element_pt(Nx*(Ny-1)+Nx-2)->node_pt(n_p*l1+(n_p-1));
   764    for(
unsigned l2=1;l2<(n_p-1);l2++)
   767      Node_pt[node_count] = finite_element_pt(Nx*(Ny-1)+Nx-1)->
   768       construct_node(n_p*l1+l2,time_stepper_pt);
   770      finite_element_pt(Nx*(Ny-1)+Nx-1)->node_pt(n_p*l1+l2) = 
   774      finite_element_pt(Nx*(Ny-1)+Nx-1)->
   775       local_fraction_of_node(n_p*l1+l2,s_fraction);
   778      Node_pt[node_count]->x(0) = xinit + el_length_x*(Nx-1 + s_fraction[0]);
   779      Node_pt[node_count]->x(1) = yinit + el_length_y*(Ny-1 + s_fraction[1]);
   788    Node_pt[node_count] = finite_element_pt(Nx*(Ny-1)+Nx-1)->
   789     construct_boundary_node(n_p*l1+(n_p-1),time_stepper_pt);
   791    finite_element_pt(Nx*(Ny-1)+Nx-1)->node_pt(n_p*l1+(n_p-1)) = 
   795    finite_element_pt(Nx*(Ny-1)+Nx-1)->
   796     local_fraction_of_node(n_p*l1+(n_p-1),s_fraction);
   799    Node_pt[node_count]->x(0) = xinit + el_length_x*Nx;
   800    Node_pt[node_count]->x(1) = yinit + el_length_y*(Ny-1 + s_fraction[1]);
   803    add_boundary_node(1,Node_pt[node_count]);
   812  finite_element_pt(Nx*(Ny-1)+Nx-1)->node_pt(n_p*(n_p-1)) 
   813   = finite_element_pt(Nx*(Ny-1)+Nx-2)->node_pt(n_p*(n_p-1)+(n_p-1));
   816  for(
unsigned l2=1;l2<(n_p-1);l2++)
   819    Node_pt[node_count] = finite_element_pt(Nx*(Ny-1)+Nx-1)->
   820     construct_boundary_node(n_p*(n_p-1)+l2,time_stepper_pt);
   822    finite_element_pt(Nx*(Ny-1)+Nx-1)->node_pt(n_p*(n_p-1)+l2) = 
   826    finite_element_pt(Nx*(Ny-1)+Nx-1)->
   827     local_fraction_of_node(n_p*(n_p-1)+l2,s_fraction);
   830    Node_pt[node_count]->x(0) = xinit + el_length_x*(Nx-1 + s_fraction[0]);
   832    Node_pt[node_count]->x(1) = yinit + el_length_y*Ny;
   835    add_boundary_node(2,Node_pt[node_count]);
   844  Node_pt[node_count] = finite_element_pt(Nx*(Ny-1)+Nx-1)->
   845   construct_boundary_node(n_p*(n_p-1)+(n_p-1),time_stepper_pt);
   847  finite_element_pt(Nx*(Ny-1)+Nx-1)->node_pt(n_p*(n_p-1)+(n_p-1)) = 
   851  finite_element_pt(Nx*(Ny-1)+Nx-1)->
   852   local_fraction_of_node(n_p*(n_p-1)+(n_p-1),s_fraction);
   855  Node_pt[node_count]->x(0) = xinit + el_length_x*Nx;
   856  Node_pt[node_count]->x(1) = yinit + el_length_y*Ny;
   859  add_boundary_node(1,Node_pt[node_count]);
   860  add_boundary_node(2,Node_pt[node_count]);
   867  setup_boundary_element_info();
 
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
SimpleRectangularQuadMesh(const unsigned &Nx, const unsigned &Ny, const double &Lx, const double &Ly, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass number of elements in the horizontal and vertical directions, and the corresponding...