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.
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;
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51