37 unsigned n_mesh = solid_mesh_pt.size();
38 unsigned total_nnode = 0;
39 for (
unsigned i_mesh = 0; i_mesh < n_mesh; i_mesh++) {
40 total_nnode += solid_mesh_pt[i_mesh]->nnode();
42 Node_pt.resize(total_nnode);
44 unsigned node_count = 0;
45 for (
unsigned i_mesh = 0; i_mesh < n_mesh; i_mesh++) {
46 unsigned nnode = solid_mesh_pt[i_mesh]->nnode();
47 for (
unsigned j = 0;
j < nnode;
j++) {
48 Node_pt[node_count] = solid_mesh_pt[i_mesh]->node_pt(
j);
54 unsigned total_nel = 0;
55 for (
unsigned i_mesh = 0; i_mesh < n_mesh; i_mesh++) {
56 total_nel += solid_mesh_pt[i_mesh]->nelement();
58 Element_pt.resize(total_nel);
60 unsigned el_count = 0;
61 for (
unsigned i_mesh = 0; i_mesh < n_mesh; i_mesh++) {
62 unsigned nel = solid_mesh_pt[i_mesh]->nelement();
63 for (
unsigned e = 0;
e < nel;
e++) {
64 Element_pt[el_count] = solid_mesh_pt[i_mesh]->element_pt(
e);
77 void glue(
const Vector<Node *> glue_node_pt,
78 const unsigned &i_mesh_replace) {
86 std::map<Node *, Node *> replacement_node_pt;
90 unsigned nnod_glue = glue_node_pt.size();
91 for (
unsigned j = 0;
j < nnod_glue;
j++) {
92 Node *nod_pt = glue_node_pt[
j];
93 unsigned dim = nod_pt->ndim();
94 Node *node_to_be_replaced_pt = 0;
95 unsigned jj_replace_index = 0;
97 for (
unsigned jj = 0; jj < nnod_candidate; jj++) {
99 double dist_squared = 0.0;
100 for (
unsigned i = 0;
i < 3;
i++) {
102 (nod_alt_pt->x(
i) - nod_pt->x(
i)) *
103 (nod_alt_pt->x(
i) - nod_pt->x(
i));
105 if (
sqrt(dist_squared) < tol) {
106 node_to_be_replaced_pt = nod_alt_pt;
107 jj_replace_index = jj;
111 if (node_to_be_replaced_pt == 0) {
112 oomph_info <<
"ERROR: Not found a replacement node for node at ";
113 for (
unsigned i = 0;
i < dim;
i++) {
122 Node *replaced_node_pt =
125 node_pt(jj_replace_index) = nod_pt;
126 replacement_node_pt[replaced_node_pt] = nod_pt;
130 for (
unsigned e = 0;
e < nel;
e++) {
131 FiniteElement *fe_pt =
133 unsigned nod_el = fe_pt->nnode();
134 for (
unsigned j_in_el = 0; j_in_el < nod_el; j_in_el++) {
135 if (fe_pt->node_pt(j_in_el) == node_to_be_replaced_pt) {
136 fe_pt->node_pt(j_in_el) = nod_pt;
143 for (
unsigned b = 0;
b <
nb;
b++) {
145 for (
unsigned j = 0;
j < nnod;
j++) {
146 Node *potentially_replaced_node_pt =
148 std::map<Node *, Node *>::iterator it;
149 it = replacement_node_pt.find(potentially_replaced_node_pt);
150 if (it == replacement_node_pt.end()) {
164 boundary_node_pt(
b,
j) = it->second;
171 Vector<Node *> tmp_node_pt(Node_pt);
172 unsigned nnod = tmp_node_pt.size();
173 Node_pt.resize(nnod - 1);
175 for (
unsigned jj = 0; jj < nnod; jj++) {
176 if (tmp_node_pt[jj] != node_to_be_replaced_pt) {
177 Node_pt[count] = tmp_node_pt[jj];
184 delete node_to_be_replaced_pt;
194 oomph_info <<
"Time for (inefficient!) mesh gluing: "
195 << t_end - t_start << std::endl;
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Scalar * b
Definition: benchVecAdd.cpp:17
Definition: glued_mesh_stuff.h:25
void glue(const Vector< Node * > glue_node_pt, const unsigned &i_mesh_replace)
Definition: glued_mesh_stuff.h:77
Vector< SolidMesh * > Constituent_mesh_pt
Definition: glued_mesh_stuff.h:28
GluedSolidMesh(Vector< SolidMesh * > solid_mesh_pt)
Definition: glued_mesh_stuff.h:34
int nb
Definition: level2_impl.h:286
OomphInfo oomph_info
Definition: oomph_definitions.cc:319
double timer
Definition: oomph_metis_from_parmetis_3.1.1/struct.h:210
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2