178 const unsigned dim = node_pt[0][0]->ndim();
185 node_was_matched[0].resize(n_node[0], 0);
186 node_was_matched[1].resize(n_node[1], 0);
189 unsigned n_matched_nodes = 0;
190 for(
unsigned i=0;
i<n_node[0];
i++)
193 for(
unsigned j=0;
j<n_node[1];
j++)
196 if(node_was_matched[1][
j])
continue;
201 double distance = 0.0;
202 for(
unsigned d=0; d<dim; d++)
204 distance += (node_0_pt->
xi(d) - node_1_pt->
xi(d))*
205 (node_0_pt->
xi(d) - node_1_pt->
xi(d));
212 if(node_0_pt == node_1_pt)
continue;
214 node_was_matched[0][
i] = 1;
215 node_was_matched[1][
j] = 1;
218 constraint_element_pt.push_back(
new NodeNodeConstraintClass(node_0_pt, node_1_pt));
227 if((n_node[0] - n_matched_nodes) == 0 && (n_node[1] - n_matched_nodes) == 0 )
return constraint_element_pt;
232 if(mesh_pt[0] == mesh_pt[1])
234 throw OomphLibError(
"Mortaring failed - meshes are the same and node-node mortaring has not captured all nodes",
239 const bool Previous_Accept_failed_locate_zeta_in_setup_multi_domain_interaction
246 n_node[1] - n_matched_nodes};
248 for(
unsigned m : {0,1})
250 if(n_unmatched_nodes[
m] == 0)
continue;
255 for(
unsigned i=0;
i<n_node[
m];
i++)
257 if(!node_was_matched[
m][
i])
259 unmatched_node_pt[count++] = node_pt[
m][
i];
267 for(
unsigned i=0;
i<n_unmatched_nodes[
m];
i++)
270 for(
unsigned d=0; d<dim; d++)
272 x[d] =
dynamic_cast<SolidNode*
>(unmatched_node_pt[
i])->xi(d);
275 locating_elements_pt[
i] =
new PointElementWithExternalElement(
x);
280 Multi_domain_functions::setup_multi_domain_interaction<ELEMENTTYPE>(problem_pt,
282 mesh_pt[
unsigned(1-
m)],
286 for(
unsigned i=0;
i<n_unmatched_nodes[
m];
i++)
290 if(locating_elements_pt[
i]->external_element_pt(0,0) ==
nullptr)
continue;
291 constraint_element_pt.push_back(
new NodeElementConstraintClass(
dynamic_cast<SolidNode*
>(unmatched_node_pt[
i]),
292 locating_elements_pt[
i]->external_element_pt(0,0),
293 locating_elements_pt[
i]->external_element_local_coord(0,0)));
298 return constraint_element_pt;
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
int i
Definition: BiCGSTAB_step_by_step.cpp:9
void add_element_pt(GeneralisedElement *const &element_pt)
Add a (pointer to) an element to the mesh.
Definition: mesh.h:617
Definition: oomph_definitions.h:222
double & xi(const unsigned &i)
Reference to i-th Lagrangian position.
Definition: nodes.h:1883
int * m
Definition: level2_cplx_impl.h:294
static double Mortaring_Constraints_Distance_Tolerance
Definition: mortaring_helpers.h:162
bool Accept_failed_locate_zeta_in_setup_multi_domain_interaction
Definition: multi_domain.cc:56
list x
Definition: plotDoE.py:28
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2