15 #ifndef __MORTAR_CONTACT_STRUCTURES__
16 #define __MORTAR_CONTACT_STRUCTURES__
21 Range &range_surf_master,
22 Range &range_surf_slave,
26 if (it->getName().compare(0, 13,
"MORTAR_MASTER") == 0) {
28 range_surf_master,
true);
33 if (it->getName().compare(0, 12,
"MORTAR_SLAVE") == 0) {
34 rval = m_field.
get_moab().get_entities_by_type(it->meshset, MBTRI,
35 range_surf_slave,
true);
45 std::vector<std::pair<Range, Range>> &contact_surface_pairs) {
48 std::map<std::string, Range> slave_surface_map, master_surface_map;
50 auto fill_surface_map = [&](
auto &surface_map, std::string surface_name) {
54 if (it->getName().compare(0, surface_name.size(), surface_name) == 0) {
58 std::string key = it->getName().substr(surface_name.size());
60 surface_map.insert(std::pair<std::string, Range>(key, tris));
63 "Contact surface name %s used more than once",
64 it->getName().c_str());
72 CHKERR fill_surface_map(slave_surface_map,
"MORTAR_SLAVE");
73 CHKERR fill_surface_map(master_surface_map,
"MORTAR_MASTER");
75 for (
const auto &[key, slave_range] : slave_surface_map) {
76 auto master_search = master_surface_map.find(key);
77 if (master_search != master_surface_map.end()) {
78 contact_surface_pairs.push_back(
79 std::pair<Range, Range>(slave_range, master_search->second));
80 master_surface_map.erase(master_search);
84 "Cannot find pairing contact surface MORTAR_MASTER%s for existing "
85 "surface MORTAR_SLAVE%s",
86 key.c_str(), key.c_str());
90 if (!master_surface_map.empty()) {
91 std::string key = master_surface_map.begin()->first;
94 "Cannot find pairing contact surface MORTAR_SLAVE%s for existing "
95 "surface MORTAR_MASTER%s",
96 key.c_str(), key.c_str());