57 double dx = l_x / double(n_x);
58 double dy = l_y / double(n_y);
59 double dz = l_z / double(n_z);
62 unsigned nnod = (n_x + 1) * (n_y + 1) * (n_z + 1) +
64 (n_x * n_y) * (n_z + 1) +
65 (n_x * n_z) * (n_y + 1) + (n_y * n_z) * (n_x + 1);
69 unsigned nelem = 24 * n_x * n_y * n_z;
79 for (
unsigned k = 0; k < n_z + 1; k++)
81 for (
unsigned j = 0; j < n_y + 1; j++)
83 for (
unsigned i = 0;
i < n_x + 1;
i++)
86 if (((
i < n_x + 1) && (j < n_y + 1) && (k < n_z + 1)) &&
87 ((
i == 0) || (
i == n_x) || (j == 0) || (j == n_y) || (k == 0) ||
101 node_pt->
x(1) = y_0 + double(j) * dy;
102 node_pt->
x(2) = z_0 + double(k) * dz;
105 if ((
i < n_x + 1) && (j < n_y + 1) && (k < n_z + 1))
150 for (
unsigned k = 0; k < n_z + 1; k++)
152 for (
unsigned j = 0; j < n_y + 1; j++)
154 for (
unsigned i = 0;
i < n_x + 1;
i++)
159 if (((
i < n_x) && (k < n_z)) && ((j == 0) || (j == n_y)))
167 front_face_node_pt(
i, j, k) =
node_pt;
171 node_pt->
x(0) = x_0 + 0.5 * dx + double(
i) * dx;
172 node_pt->
x(1) = y_0 + double(j) * dy;
173 node_pt->
x(2) = z_0 + 0.5 * dz + double(k) * dz;
176 if ((
i < n_x) && (k < n_z))
196 if (((j < n_y) && (k < n_z)) && ((
i == 0) || (
i == n_x)))
204 left_face_node_pt(
i, j, k) =
node_pt;
208 node_pt->
x(1) = y_0 + 0.5 * dy + double(j) * dy;
209 node_pt->
x(2) = z_0 + 0.5 * dz + double(k) * dz;
213 if ((j < n_y) && (k < n_z))
232 if (((
i < n_x) && (j < n_y)) && ((k == 0) || (k == n_z)))
240 down_face_node_pt(
i, j, k) =
node_pt;
243 node_pt->
x(0) = x_0 + 0.5 * dx + double(
i) * dx;
244 node_pt->
x(1) = y_0 + 0.5 * dy + double(j) * dy;
245 node_pt->
x(2) = z_0 + double(k) * dz;
249 if ((
i < n_x) && (j < n_y))
271 for (
unsigned k = 0; k < n_z; k++)
273 for (
unsigned j = 0; j < n_y; j++)
275 for (
unsigned i = 0;
i < n_x;
i++)
280 node_pt->
x(0) = x_0 + 0.5 * dx + double(
i) * dx;
281 node_pt->
x(1) = y_0 + 0.5 * dy + double(j) * dy;
282 node_pt->
x(2) = z_0 + 0.5 * dz + double(k) * dz;
290 for (
unsigned k = 0; k < n_z; k++)
292 for (
unsigned j = 0; j < n_y; j++)
294 for (
unsigned i = 0;
i < n_x;
i++)
304 el_pt->node_pt(0) = vertex_node_pt(
i, j, k);
307 el_pt->node_pt(1) = front_face_node_pt(
i, j, k);
310 el_pt->node_pt(2) = vertex_node_pt(
i, j, k + 1);
313 el_pt->node_pt(3) = central_node_pt(
i, j, k);
323 el_pt->node_pt(0) = vertex_node_pt(
i, j, k);
326 el_pt->node_pt(1) = vertex_node_pt(
i + 1, j, k);
329 el_pt->node_pt(2) = front_face_node_pt(
i, j, k);
332 el_pt->node_pt(3) = central_node_pt(
i, j, k);
342 el_pt->node_pt(0) = vertex_node_pt(
i + 1, j, k);
345 el_pt->node_pt(1) = vertex_node_pt(
i + 1, j, k + 1);
348 el_pt->node_pt(2) = front_face_node_pt(
i, j, k);
351 el_pt->node_pt(3) = central_node_pt(
i, j, k);
361 el_pt->node_pt(0) = vertex_node_pt(
i + 1, j, k + 1);
364 el_pt->node_pt(1) = vertex_node_pt(
i, j, k + 1);
367 el_pt->node_pt(2) = front_face_node_pt(
i, j, k);
370 el_pt->node_pt(3) = central_node_pt(
i, j, k);
383 el_pt->node_pt(0) = vertex_node_pt(
i + 1, j, k);
386 el_pt->node_pt(1) = left_face_node_pt(
i + 1, j, k);
389 el_pt->node_pt(2) = vertex_node_pt(
i + 1, j, k + 1);
392 el_pt->node_pt(3) = central_node_pt(
i, j, k);
402 el_pt->node_pt(0) = vertex_node_pt(
i + 1, j, k);
405 el_pt->node_pt(1) = vertex_node_pt(
i + 1, j + 1, k);
408 el_pt->node_pt(2) = left_face_node_pt(
i + 1, j, k);
411 el_pt->node_pt(3) = central_node_pt(
i, j, k);
421 el_pt->node_pt(0) = vertex_node_pt(
i + 1, j + 1, k);
424 el_pt->node_pt(1) = vertex_node_pt(
i + 1, j + 1, k + 1);
427 el_pt->node_pt(2) = left_face_node_pt(
i + 1, j, k);
430 el_pt->node_pt(3) = central_node_pt(
i, j, k);
440 el_pt->node_pt(0) = vertex_node_pt(
i + 1, j + 1, k + 1);
443 el_pt->node_pt(1) = vertex_node_pt(
i + 1, j, k + 1);
446 el_pt->node_pt(2) = left_face_node_pt(
i + 1, j, k);
449 el_pt->node_pt(3) = central_node_pt(
i, j, k);
462 el_pt->node_pt(0) = vertex_node_pt(
i, j, k + 1);
465 el_pt->node_pt(1) = vertex_node_pt(
i + 1, j, k + 1);
468 el_pt->node_pt(2) = down_face_node_pt(
i, j, k + 1);
471 el_pt->node_pt(3) = central_node_pt(
i, j, k);
481 el_pt->node_pt(0) = vertex_node_pt(
i + 1, j, k + 1);
484 el_pt->node_pt(1) = vertex_node_pt(
i + 1, j + 1, k + 1);
487 el_pt->node_pt(2) = down_face_node_pt(
i, j, k + 1);
490 el_pt->node_pt(3) = central_node_pt(
i, j, k);
500 el_pt->node_pt(0) = vertex_node_pt(
i + 1, j + 1, k + 1);
503 el_pt->node_pt(1) = vertex_node_pt(
i, j + 1, k + 1);
506 el_pt->node_pt(2) = down_face_node_pt(
i, j, k + 1);
509 el_pt->node_pt(3) = central_node_pt(
i, j, k);
520 el_pt->node_pt(0) = vertex_node_pt(
i, j + 1, k + 1);
523 el_pt->node_pt(1) = vertex_node_pt(
i, j, k + 1);
526 el_pt->node_pt(2) = down_face_node_pt(
i, j, k + 1);
529 el_pt->node_pt(3) = central_node_pt(
i, j, k);
542 el_pt->node_pt(0) = vertex_node_pt(
i, j, k);
545 el_pt->node_pt(2) = vertex_node_pt(
i + 1, j, k);
548 el_pt->node_pt(1) = down_face_node_pt(
i, j, k);
551 el_pt->node_pt(3) = central_node_pt(
i, j, k);
561 el_pt->node_pt(0) = vertex_node_pt(
i + 1, j, k);
564 el_pt->node_pt(2) = vertex_node_pt(
i + 1, j + 1, k);
567 el_pt->node_pt(1) = down_face_node_pt(
i, j, k);
570 el_pt->node_pt(3) = central_node_pt(
i, j, k);
580 el_pt->node_pt(0) = vertex_node_pt(
i + 1, j + 1, k);
583 el_pt->node_pt(2) = vertex_node_pt(
i, j + 1, k);
586 el_pt->node_pt(1) = down_face_node_pt(
i, j, k);
589 el_pt->node_pt(3) = central_node_pt(
i, j, k);
600 el_pt->node_pt(0) = vertex_node_pt(
i, j + 1, k);
603 el_pt->node_pt(2) = vertex_node_pt(
i, j, k);
606 el_pt->node_pt(1) = down_face_node_pt(
i, j, k);
609 el_pt->node_pt(3) = central_node_pt(
i, j, k);
622 el_pt->node_pt(0) = vertex_node_pt(
i, j + 1, k);
625 el_pt->node_pt(2) = front_face_node_pt(
i, j + 1, k);
628 el_pt->node_pt(1) = vertex_node_pt(
i, j + 1, k + 1);
631 el_pt->node_pt(3) = central_node_pt(
i, j, k);
641 el_pt->node_pt(0) = vertex_node_pt(
i, j + 1, k);
644 el_pt->node_pt(2) = vertex_node_pt(
i + 1, j + 1, k);
647 el_pt->node_pt(1) = front_face_node_pt(
i, j + 1, k);
650 el_pt->node_pt(3) = central_node_pt(
i, j, k);
660 el_pt->node_pt(0) = vertex_node_pt(
i + 1, j + 1, k);
663 el_pt->node_pt(2) = vertex_node_pt(
i + 1, j + 1, k + 1);
666 el_pt->node_pt(1) = front_face_node_pt(
i, j + 1, k);
669 el_pt->node_pt(3) = central_node_pt(
i, j, k);
679 el_pt->node_pt(0) = vertex_node_pt(
i + 1, j + 1, k + 1);
682 el_pt->node_pt(2) = vertex_node_pt(
i, j + 1, k + 1);
685 el_pt->node_pt(1) = front_face_node_pt(
i, j + 1, k);
688 el_pt->node_pt(3) = central_node_pt(
i, j, k);
701 el_pt->node_pt(0) = vertex_node_pt(
i, j, k);
704 el_pt->node_pt(2) = left_face_node_pt(
i, j, k);
707 el_pt->node_pt(1) = vertex_node_pt(
i, j, k + 1);
710 el_pt->node_pt(3) = central_node_pt(
i, j, k);
720 el_pt->node_pt(0) = vertex_node_pt(
i, j, k);
723 el_pt->node_pt(2) = vertex_node_pt(
i, j + 1, k);
726 el_pt->node_pt(1) = left_face_node_pt(
i, j, k);
729 el_pt->node_pt(3) = central_node_pt(
i, j, k);
739 el_pt->node_pt(0) = vertex_node_pt(
i, j + 1, k);
742 el_pt->node_pt(2) = vertex_node_pt(
i, j + 1, k + 1);
745 el_pt->node_pt(1) = left_face_node_pt(
i, j, k);
748 el_pt->node_pt(3) = central_node_pt(
i, j, k);
758 el_pt->node_pt(0) = vertex_node_pt(
i, j + 1, k + 1);
761 el_pt->node_pt(2) = vertex_node_pt(
i, j, k + 1);
764 el_pt->node_pt(1) = left_face_node_pt(
i, j, k);
767 el_pt->node_pt(3) = central_node_pt(
i, j, k);
776 std::ostringstream error_stream;
777 error_stream <<
"Some internal error in the constructor\n"
778 <<
"Actual number of nodes : " <<
Node_pt.size()
779 <<
"\ndoesn't match the prediction : " << nnod
783 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
789 std::ostringstream error_stream;
790 error_stream <<
"Some internal error in the constructor\n"
791 <<
"Actual number of elements : " <<
Element_pt.size()
792 <<
"\ndoesn't match the prediction : " << nelem
796 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
A template Class for BoundaryNodes; that is Nodes that MAY live on the boundary of a Mesh....
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.
void set_nboundary(const unsigned &nbound)
Set the number of boundaries in the mesh.
Node *& node_pt(const unsigned long &n)
Return pointer to global node n.
Vector< GeneralisedElement * > Element_pt
Vector of pointers to generalised elements.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
double & x(const unsigned &i)
Return the i-th nodal coordinate.
An OomphLibError object which should be thrown when an run-time error is encountered....
////////////////////////////////////////////////////////////////// //////////////////////////////////...
SimpleCubicScaffoldTetMesh(const unsigned &n_x, const unsigned &n_y, const unsigned &n_z, const double &l_x, const double &l_y, const double &l_z, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass number of elements and dimensions of cube.
////////////////////////////////////////////////////////////////////// //////////////////////////////...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...