32 unsigned n_mesh = solid_mesh_pt.size();
33 unsigned total_nnode = 0;
34 for (
unsigned i_mesh = 0; i_mesh < n_mesh; i_mesh++) {
35 total_nnode += solid_mesh_pt[i_mesh]->nnode();
37 Node_pt.resize(total_nnode);
39 unsigned node_count = 0;
40 for (
unsigned i_mesh = 0; i_mesh < n_mesh; i_mesh++) {
41 unsigned nnode = solid_mesh_pt[i_mesh]->nnode();
42 for (
unsigned j = 0; j < nnode; j++) {
43 Node_pt[node_count] = solid_mesh_pt[i_mesh]->node_pt(j);
49 unsigned total_nel = 0;
50 for (
unsigned i_mesh = 0; i_mesh < n_mesh; i_mesh++) {
51 total_nel += solid_mesh_pt[i_mesh]->nelement();
53 Element_pt.resize(total_nel);
55 unsigned el_count = 0;
56 for (
unsigned i_mesh = 0; i_mesh < n_mesh; i_mesh++) {
57 unsigned nel = solid_mesh_pt[i_mesh]->nelement();
58 for (
unsigned e = 0; e < nel; e++) {
59 Element_pt[el_count] = solid_mesh_pt[i_mesh]->element_pt(e);
72 void glue(
const Vector<Node *> glue_node_pt,
73 const unsigned &i_mesh_replace) {
74 double t_start = TimingHelpers::timer();
81 std::map<Node *, Node *> replacement_node_pt;
85 unsigned nnod_glue = glue_node_pt.size();
86 for (
unsigned j = 0; j < nnod_glue; j++) {
87 Node *nod_pt = glue_node_pt[j];
88 unsigned dim = nod_pt->ndim();
89 Node *node_to_be_replaced_pt = 0;
90 unsigned jj_replace_index = 0;
92 for (
unsigned jj = 0; jj < nnod_candidate; jj++) {
94 double dist_squared = 0.0;
95 for (
unsigned i = 0;
i < 3;
i++) {
97 (nod_alt_pt->x(
i) - nod_pt->x(
i)) *
98 (nod_alt_pt->x(
i) - nod_pt->x(
i));
100 if (sqrt(dist_squared) < tol) {
101 node_to_be_replaced_pt = nod_alt_pt;
102 jj_replace_index = jj;
106 if (node_to_be_replaced_pt == 0) {
107 oomph_info <<
"ERROR: Not found a replacement node for node at ";
108 for (
unsigned i = 0;
i < dim;
i++) {
109 oomph_info << nod_pt->x(
i) <<
" ";
111 oomph_info << std::endl;
117 Node *replaced_node_pt =
120 node_pt(jj_replace_index) = nod_pt;
121 replacement_node_pt[replaced_node_pt] = nod_pt;
125 for (
unsigned e = 0; e < nel; e++) {
126 FiniteElement *fe_pt =
128 unsigned nod_el = fe_pt->nnode();
129 for (
unsigned j_in_el = 0; j_in_el < nod_el; j_in_el++) {
130 if (fe_pt->node_pt(j_in_el) == node_to_be_replaced_pt) {
131 fe_pt->node_pt(j_in_el) = nod_pt;
138 for (
unsigned b = 0; b < nb; b++) {
140 for (
unsigned j = 0; j < nnod; j++) {
141 Node *potentially_replaced_node_pt =
143 std::map<Node *, Node *>::iterator it;
144 it = replacement_node_pt.find(potentially_replaced_node_pt);
145 if (it == replacement_node_pt.end()) {
159 boundary_node_pt(b, j) = it->second;
166 Vector<Node *> tmp_node_pt(Node_pt);
167 unsigned nnod = tmp_node_pt.size();
168 Node_pt.resize(nnod - 1);
170 for (
unsigned jj = 0; jj < nnod; jj++) {
171 if (tmp_node_pt[jj] != node_to_be_replaced_pt) {
172 Node_pt[count] = tmp_node_pt[jj];
179 delete node_to_be_replaced_pt;
188 double t_end = TimingHelpers::timer();
189 oomph_info <<
"Time for (inefficient!) mesh gluing: "
190 << t_end - t_start << std::endl;
206 template<
class ELEMENT>
218 TimeStepper *time_stepper_pt =
219 &Mesh::Default_TimeStepper) :
220 SimpleCubicMesh<
ELEMENT>(nx, ny, nz, -a, a, -b, b, -c, c, time_stepper_pt),
223 set_lagrangian_nodal_coordinates();
237 TimeStepper *time_stepper_pt =
238 &Mesh::Default_TimeStepper) :
246 set_lagrangian_nodal_coordinates();
Definition: glued_mesh_stuff.h:20
void glue(const Vector< Node * > glue_node_pt, const unsigned &i_mesh_replace)
Definition: glued_mesh_stuff.h:72
Vector< SolidMesh * > Constituent_mesh_pt
Definition: glued_mesh_stuff.h:23
GluedSolidMesh(Vector< SolidMesh * > solid_mesh_pt)
Definition: glued_mesh_stuff.h:29
Simple cubic mesh upgraded to become a solid mesh.
Definition: glued_mesh_stuff.h:208
virtual ~SolidCubicMesh()
Empty Destructor.
Definition: glued_mesh_stuff.h:250
SolidCubicMesh(const unsigned &nx, const unsigned &ny, const unsigned &nz, const double &a, const double &b, const double &c, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Specify half widths.
Definition: glued_mesh_stuff.h:213
SolidCubicMesh(const unsigned &nx, const unsigned &ny, const unsigned &nz, const double &x_min, const double &x_max, const double &y_min, const double &y_max, const double &z_min, const double &z_max, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor:
Definition: glued_mesh_stuff.h:228
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51