Glue specified nodes to co-located nodes in consituent mesh i_mesh_replace. i.e pointers to nodes in constituent mesh i_mesh_replace are replaced by pointers to colocated nodes (in glue_node_pt). Original nodes are then deleted and the boundary lookup schemes of constituent mesh i_mesh_replace are updated.
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
Scalar * b
Definition: benchVecAdd.cpp:17
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