26 #ifndef OOMPH_EIGHTH_SPHERE_MESH_TEMPLATE_CC
27 #define OOMPH_EIGHTH_SPHERE_MESH_TEMPLATE_CC
38 template<
class ELEMENT>
40 TimeStepper* time_stepper_pt)
44 MeshChecker::assert_geometric_element<QElementGeometricBase, ELEMENT>(3);
47 this->set_nboundary(4);
50 this->Element_pt.resize(4);
56 Vector<double> s(3), s_fraction(3);
61 this->Element_pt[0] =
new ELEMENT;
66 unsigned nnode1d = this->finite_element_pt(0)->nnode_1d();
69 for (
unsigned i = 0; i < nnode1d; i++)
71 for (
unsigned j = 0; j < nnode1d; j++)
73 for (
unsigned k = 0; k < nnode1d; k++)
75 unsigned jnod = k * nnode1d * nnode1d + j * nnode1d + i;
78 if ((i == 0) || (j == 0) || (k == 0))
81 this->Node_pt.push_back(
82 this->finite_element_pt(0)->construct_boundary_node(
83 jnod, time_stepper_pt));
89 this->Node_pt.push_back(this->finite_element_pt(0)->construct_node(
90 jnod, time_stepper_pt));
95 this->finite_element_pt(0)->local_fraction_of_node(jnod, s_fraction);
99 s[0] = -1.0 + 2.0 * s_fraction[0];
100 s[1] = -1.0 + 2.0 * s_fraction[1];
101 s[2] = -1.0 + 2.0 * s_fraction[2];
102 Domain_pt->macro_element_pt(0)->macro_map(s, r);
105 this->finite_element_pt(0)->node_pt(jnod)->x(0) = r[0];
106 this->finite_element_pt(0)->node_pt(jnod)->x(1) = r[1];
107 this->finite_element_pt(0)->node_pt(jnod)->x(2) = r[2];
111 add_boundary_node(0, this->finite_element_pt(0)->node_pt(jnod));
113 add_boundary_node(1, this->finite_element_pt(0)->node_pt(jnod));
115 add_boundary_node(2, this->finite_element_pt(0)->node_pt(jnod));
123 this->Element_pt[1] =
new ELEMENT;
129 for (
unsigned i = 0; i < nnode1d; i++)
131 for (
unsigned j = 0; j < nnode1d; j++)
133 for (
unsigned k = 0; k < nnode1d; k++)
135 unsigned jnod = k * nnode1d * nnode1d + j * nnode1d + i;
141 if ((i == nnode1d - 1) || (j == 0) || (k == 0))
143 this->Node_pt.push_back(
144 this->finite_element_pt(1)->construct_boundary_node(
145 jnod, time_stepper_pt));
150 this->Node_pt.push_back(
151 this->finite_element_pt(1)->construct_node(jnod,
157 this->finite_element_pt(1)->local_fraction_of_node(jnod,
161 s[0] = -1.0 + 2.0 * s_fraction[0];
162 s[1] = -1.0 + 2.0 * s_fraction[1];
163 s[2] = -1.0 + 2.0 * s_fraction[2];
164 Domain_pt->macro_element_pt(1)->macro_map(s, r);
167 this->finite_element_pt(1)->node_pt(jnod)->x(0) = r[0];
168 this->finite_element_pt(1)->node_pt(jnod)->x(1) = r[1];
169 this->finite_element_pt(1)->node_pt(jnod)->x(2) = r[2];
173 add_boundary_node(1, this->finite_element_pt(1)->node_pt(jnod));
175 add_boundary_node(2, this->finite_element_pt(1)->node_pt(jnod));
176 if (i == nnode1d - 1)
177 add_boundary_node(3, this->finite_element_pt(1)->node_pt(jnod));
183 this->finite_element_pt(1)->node_pt(jnod) =
184 this->finite_element_pt(0)->node_pt(jnod + nnode1d - 1);
193 this->Element_pt[2] =
new ELEMENT;
198 for (
unsigned i = 0; i < nnode1d; i++)
200 for (
unsigned j = 0; j < nnode1d; j++)
202 for (
unsigned k = 0; k < nnode1d; k++)
204 unsigned jnod = k * nnode1d * nnode1d + j * nnode1d + i;
207 if ((i < nnode1d - 1) && (j > 0))
210 if ((i == 0) || (j == nnode1d - 1) || (k == 0))
213 this->Node_pt.push_back(
214 this->finite_element_pt(2)->construct_boundary_node(
215 jnod, time_stepper_pt));
221 this->Node_pt.push_back(
222 this->finite_element_pt(2)->construct_node(jnod,
228 this->finite_element_pt(2)->local_fraction_of_node(jnod,
232 s[0] = -1.0 + 2.0 * s_fraction[0];
233 s[1] = -1.0 + 2.0 * s_fraction[1];
234 s[2] = -1.0 + 2.0 * s_fraction[2];
235 Domain_pt->macro_element_pt(2)->macro_map(s, r);
238 this->finite_element_pt(2)->node_pt(jnod)->x(0) = r[0];
239 this->finite_element_pt(2)->node_pt(jnod)->x(1) = r[1];
240 this->finite_element_pt(2)->node_pt(jnod)->x(2) = r[2];
244 add_boundary_node(0, this->finite_element_pt(2)->node_pt(jnod));
246 add_boundary_node(2, this->finite_element_pt(2)->node_pt(jnod));
247 if (j == nnode1d - 1)
248 add_boundary_node(3, this->finite_element_pt(2)->node_pt(jnod));
256 this->finite_element_pt(2)->node_pt(jnod) =
257 this->finite_element_pt(0)->node_pt(jnod +
258 nnode1d * (nnode1d - 1));
261 else if (i == nnode1d - 1)
262 this->finite_element_pt(2)->node_pt(jnod) =
263 this->finite_element_pt(1)->node_pt(nnode1d * nnode1d * k + j +
273 this->Element_pt[3] =
new ELEMENT;
278 for (
unsigned i = 0; i < nnode1d; i++)
280 for (
unsigned j = 0; j < nnode1d; j++)
282 for (
unsigned k = 0; k < nnode1d; k++)
284 unsigned jnod = k * nnode1d * nnode1d + j * nnode1d + i;
287 if ((k > 0) && (i < nnode1d - 1) && (j < nnode1d - 1))
290 if ((i == 0) || (j == 0) || (k == nnode1d - 1))
293 this->Node_pt.push_back(
294 this->finite_element_pt(3)->construct_boundary_node(
295 jnod, time_stepper_pt));
301 this->Node_pt.push_back(
302 this->finite_element_pt(3)->construct_node(jnod,
308 this->finite_element_pt(3)->local_fraction_of_node(jnod,
312 s[0] = -1.0 + 2.0 * s_fraction[0];
313 s[1] = -1.0 + 2.0 * s_fraction[1];
314 s[2] = -1.0 + 2.0 * s_fraction[2];
315 Domain_pt->macro_element_pt(3)->macro_map(s, r);
318 this->finite_element_pt(3)->node_pt(jnod)->x(0) = r[0];
319 this->finite_element_pt(3)->node_pt(jnod)->x(1) = r[1];
320 this->finite_element_pt(3)->node_pt(jnod)->x(2) = r[2];
324 add_boundary_node(0, this->finite_element_pt(3)->node_pt(jnod));
326 add_boundary_node(1, this->finite_element_pt(3)->node_pt(jnod));
327 if (k == nnode1d - 1)
328 add_boundary_node(3, this->finite_element_pt(3)->node_pt(jnod));
337 this->finite_element_pt(3)->node_pt(jnod) =
338 this->finite_element_pt(0)->node_pt(jnod + nnode1d * nnode1d *
344 if (i == nnode1d - 1)
346 this->finite_element_pt(3)->node_pt(jnod) =
347 this->finite_element_pt(1)->node_pt(
348 k + i * nnode1d * nnode1d + j * nnode1d);
353 this->finite_element_pt(3)->node_pt(jnod) =
354 this->finite_element_pt(2)->node_pt(i + k * nnode1d +
355 j * nnode1d * nnode1d);
364 setup_boundary_element_info();
Eighth sphere as domain. Domain is parametrised by four macro elements.
EighthSphereMesh(const double &radius, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass radius and timestepper; defaults to static default timestepper.
Domain * Domain_pt
Pointer to the domain.
double Radius
Radius of the sphere.
////////////////////////////////////////////////////////////////////// //////////////////////////////...