27 #include "libmesh/mesh_base.h" 28 #include "libmesh/boundary_info.h" 29 #include "libmesh/point_locator_tree.h" 51 unsigned int slave_b_id,
58 std::unique_ptr<libMesh::PointLocatorBase>
59 pt_locator(mesh.sub_point_locator());
61 libMesh::PointLocatorTree
62 &locator_tree =
dynamic_cast<libMesh::PointLocatorTree&
>(*pt_locator);
64 libMesh::MeshBase::const_element_iterator
65 e_it = mesh.local_elements_begin(),
66 e_end = mesh.local_elements_end();
68 std::set<const libMesh::Node*> slave_nodes;
70 for ( ; e_it != e_end; e_it++) {
73 for (
unsigned int slave_side=0;
74 slave_side < (*e_it)->n_sides();
80 std::unique_ptr<const libMesh::Elem>
81 slave_side_ptr((*e_it)->side_ptr(slave_side));
84 for (
unsigned int slave_n_id=0;
85 slave_n_id < slave_side_ptr->n_nodes();
89 slave_node = slave_side_ptr->node_ptr(slave_n_id);
93 if (!slave_nodes.count(slave_node)) {
95 std::set<const libMesh::Node*> master_nodes;
97 std::set<const libMesh::Elem*>
98 elems = locator_tree.perform_fuzzy_linear_search(*slave_node,
nullptr, tol);
101 libmesh_assert(elems.size());
105 std::set<const libMesh::Elem*>::const_iterator
106 master_e_it = elems.begin(),
107 master_e_end = elems.end();
109 for (; master_e_it!=master_e_end; master_e_it++) {
112 for (
unsigned int master_side=0;
113 master_side < (*master_e_it)->n_sides();
121 std::unique_ptr<const libMesh::Elem>
122 master_side_ptr((*master_e_it)->side_ptr(master_side));
125 for (
unsigned int master_n_id=0;
126 master_n_id < master_side_ptr->n_nodes();
128 master_nodes.insert(master_side_ptr->node_ptr(master_n_id));
135 (std::pair<
const libMesh::Node*, std::set<const libMesh::Node*>>
136 (slave_node, master_nodes));
139 slave_nodes.insert(slave_node);
151 unsigned int slave_b_id,
158 std::unique_ptr<libMesh::PointLocatorBase>
159 pt_locator(mesh.sub_point_locator());
161 libMesh::PointLocatorTree
162 &locator_tree =
dynamic_cast<libMesh::PointLocatorTree&
>(*pt_locator);
164 libMesh::MeshBase::const_element_iterator
165 e_it = mesh.local_elements_begin(),
166 e_end = mesh.local_elements_end();
168 std::set<const libMesh::Node*> slave_nodes;
170 for ( ; e_it != e_end; e_it++) {
173 for (
unsigned int slave_side=0;
174 slave_side < (*e_it)->n_sides();
180 std::unique_ptr<const libMesh::Elem>
181 slave_side_ptr((*e_it)->side_ptr(slave_side));
184 for (
unsigned int slave_n_id=0;
185 slave_n_id < slave_side_ptr->n_nodes();
189 slave_node = slave_side_ptr->node_ptr(slave_n_id);
193 if (!slave_nodes.count(slave_node)) {
195 std::set<const libMesh::Node*> master_nodes;
197 std::set<const libMesh::Elem*>
198 elems = locator_tree.perform_fuzzy_linear_search(*slave_node,
nullptr, tol);
201 libmesh_assert(elems.size());
205 std::set<const libMesh::Elem*>::const_iterator
206 master_e_it = elems.begin(),
207 master_e_end = elems.end();
209 for (; master_e_it!=master_e_end; master_e_it++) {
211 const libMesh::Elem* master_e = *master_e_it;
213 if (master_e->subdomain_id() == master_id) {
216 for (
unsigned int master_n_id=0;
217 master_n_id < master_e->n_nodes();
221 d = *master_e->node_ptr(master_n_id) - *slave_node;
224 master_nodes.insert(master_e->node_ptr(master_n_id));
231 (std::pair<
const libMesh::Node*, std::set<const libMesh::Node*>>
232 (slave_node, master_nodes));
235 slave_nodes.insert(slave_node);
248 const libMesh::Elem& elem,
252 std::vector<libMesh::boundary_id_type> bc_ids;
253 mesh.boundary_info->boundary_ids(&elem, side, bc_ids);
257 for (
unsigned int i=0; i<bc_ids.size(); i++)
258 if (bc_ids[i] == b_id)
MAST::NonlinearSystem & system()
void add_slave_boundary_and_master_subdomain_coupling(unsigned int master_id, unsigned int slave_b_id, Real tol)
bool _check_if_side_on_boundary(libMesh::MeshBase &mesh, const libMesh::Elem &elem, unsigned int side, unsigned int b_id)
MAST::SystemInitialization & _sys_init
std::vector< std::pair< const libMesh::Node *, std::set< const libMesh::Node * > > > _node_couplings
virtual ~MeshCouplingBase()
void add_master_and_slave_boundary_coupling(unsigned int master_b_id, unsigned int slave_b_id, Real tol)
MeshCouplingBase(MAST::SystemInitialization &sys_init)