26 #ifndef OOMPH_RECTANGLE_WITH_HOLE_MESH_HEADER
27 #define OOMPH_RECTANGLE_WITH_HOLE_MESH_HEADER
31 #include <oomph-lib-config.h>
35 #include "../generic/mesh.h"
36 #include "../generic/quadtree.h"
37 #include "../generic/quad_mesh.h"
38 #include "../generic/refineable_quad_mesh.h"
46 template<
class ELEMENT>
57 GeomObject* cylinder_pt,
59 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
65 unsigned long node_count = 0;
68 Vector<double> s(2), r(2);
71 Vector<Node*> Tmp_node_pt;
75 unsigned nmacro_element =
Domain_pt->nmacro_element();
76 for (
unsigned e = 0; e < nmacro_element; e++)
79 Element_pt.push_back(
new ELEMENT);
82 unsigned np =
dynamic_cast<ELEMENT*
>(finite_element_pt(e))->nnode_1d();
85 for (
unsigned l1 = 0; l1 < np; l1++)
88 for (
unsigned l2 = 0; l2 < np; l2++)
91 Tmp_node_pt.push_back(finite_element_pt(e)->construct_node(
92 l1 * np + l2, time_stepper_pt));
95 s[0] = -1.0 + 2.0 * (double)l2 / (
double)(np - 1);
96 s[1] = -1.0 + 2.0 * (double)l1 / (
double)(np - 1);
97 Domain_pt->macro_element_pt(e)->macro_map(s, r);
100 Tmp_node_pt[node_count]->x(0) = r[0];
101 Tmp_node_pt[node_count]->x(1) = r[1];
115 unsigned np =
dynamic_cast<ELEMENT*
>(finite_element_pt(0))->nnode_1d();
118 for (
unsigned n = 0; n < np; n++)
121 finite_element_pt(1)->node_pt(n * np) =
122 finite_element_pt(0)->node_pt((np - 1) * np + np - 1 - n);
125 delete Tmp_node_pt[np * np + n * np];
126 Tmp_node_pt[np * np + n * np] = 0;
130 for (
unsigned n = 0; n < np; n++)
133 finite_element_pt(3)->node_pt(n * np) =
134 finite_element_pt(0)->node_pt(n);
137 delete Tmp_node_pt[3 * np * np + n * np];
138 Tmp_node_pt[3 * np * np + n * np] = 0;
142 for (
unsigned n = 0; n < np; n++)
145 finite_element_pt(2)->node_pt(np * (np - 1) + n) =
146 finite_element_pt(1)->node_pt(np * n + np - 1);
149 delete Tmp_node_pt[2 * np * np + np * (np - 1) + n];
150 Tmp_node_pt[2 * np * np + np * (np - 1) + n] = 0;
155 for (
unsigned n = 0; n < np; n++)
158 finite_element_pt(2)->node_pt(n) =
159 finite_element_pt(3)->node_pt(np * (np - n - 1) + np - 1);
162 delete Tmp_node_pt[2 * np * np + n];
163 Tmp_node_pt[2 * np * np + n] = 0;
168 for (
unsigned long n = 0; n < node_count; n++)
170 if (Tmp_node_pt[n] != 0)
172 Node_pt.push_back(Tmp_node_pt[n]);
179 for (
unsigned n = 0; n < np; n++)
182 Node* nod_pt = finite_element_pt(0)->node_pt(n * np);
183 convert_to_boundary_node(nod_pt);
184 add_boundary_node(3, nod_pt);
187 nod_pt = finite_element_pt(2)->node_pt(n * np + np - 1);
188 convert_to_boundary_node(nod_pt);
189 add_boundary_node(1, nod_pt);
192 nod_pt = finite_element_pt(3)->node_pt(n);
193 convert_to_boundary_node(nod_pt);
194 add_boundary_node(0, nod_pt);
197 nod_pt = finite_element_pt(1)->node_pt(np * (np - 1) + n);
198 convert_to_boundary_node(nod_pt);
199 add_boundary_node(2, nod_pt);
202 nod_pt = finite_element_pt(3)->node_pt(np * (np - 1) + n);
203 convert_to_boundary_node(nod_pt);
204 add_boundary_node(4, nod_pt);
207 for (
unsigned n = 1; n < np; n++)
210 Node* nod_pt = finite_element_pt(2)->node_pt(n * np);
211 convert_to_boundary_node(nod_pt);
212 add_boundary_node(4, nod_pt);
215 for (
unsigned n = 1; n < np; n++)
218 Node* nod_pt = finite_element_pt(1)->node_pt(np - n - 1);
219 convert_to_boundary_node(nod_pt);
220 add_boundary_node(4, nod_pt);
223 for (
unsigned n = 1; n < np - 1; n++)
227 finite_element_pt(0)->node_pt(np * (np - n - 1) + np - 1);
228 convert_to_boundary_node(nod_pt);
229 add_boundary_node(4, nod_pt);
254 template<
class ELEMENT>
256 public RefineableQuadMesh<ELEMENT>
266 GeomObject* cylinder_pt,
267 const double& length,
268 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
275 for (
unsigned e = 0; e < 4; e++)
277 dynamic_cast<ELEMENT*
>(this->element_pt(e))
278 ->set_macro_elem_pt(this->
Domain_pt->macro_element_pt(e));
282 this->setup_boundary_element_info();
286 this->setup_quadtree_forest();
Rectangular domain with circular whole.
Domain-based mesh for rectangular mesh with circular hole.
RectangleWithHoleDomain * Domain_pt
Pointer to the domain.
RectangleWithHoleDomain * domain_pt()
Access function to the domain.
RectangleWithHoleMesh(GeomObject *cylinder_pt, const double &length, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass pointer to geometric object that represents the cylinder, the length and height of ...
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
virtual ~RefineableRectangleWithHoleMesh()
Destructor: Empty.
RefineableRectangleWithHoleMesh(GeomObject *cylinder_pt, const double &length, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor. Pass pointer to geometric object that represents the cylinder, the length and height of ...
////////////////////////////////////////////////////////////////////// //////////////////////////////...