@@ -141,6 +141,7 @@ BoundaryInfo & BoundaryInfo::operator=(const BoundaryInfo & other_boundary_info)
141
141
_global_boundary_ids = other_boundary_info ._global_boundary_ids ;
142
142
_side_boundary_ids = other_boundary_info ._side_boundary_ids ;
143
143
_node_boundary_ids = other_boundary_info ._node_boundary_ids ;
144
+ _sideset_to_nodeset_conversion = other_boundary_info ._sideset_to_nodeset_conversion ;
144
145
_edge_boundary_ids = other_boundary_info ._edge_boundary_ids ;
145
146
_shellface_boundary_ids = other_boundary_info ._shellface_boundary_ids ;
146
147
@@ -348,6 +349,7 @@ void BoundaryInfo::clear()
348
349
_boundary_ids .clear ();
349
350
_side_boundary_ids .clear ();
350
351
_node_boundary_ids .clear ();
352
+ _sideset_to_nodeset_conversion .clear ();
351
353
_edge_boundary_ids .clear ();
352
354
_shellface_boundary_ids .clear ();
353
355
_ss_id_to_name .clear ();
@@ -1188,6 +1190,12 @@ void BoundaryInfo::add_side(const Elem * elem,
1188
1190
_boundary_side_id .emplace (elem , std ::make_pair (side , id ));
1189
1191
_boundary_ids .insert (id );
1190
1192
_side_boundary_ids .insert (id ); // Also add this ID to the set of side boundary IDs
1193
+
1194
+ // create temp side and check if sideset has a matching nodeset
1195
+ ElemSideBuilder side_builder ;
1196
+ const Elem * new_side = & side_builder (* elem , side );
1197
+ if (has_equivalent_nodeset (new_side , id ))
1198
+ _sideset_to_nodeset_conversion .emplace (id , id );
1191
1199
}
1192
1200
1193
1201
@@ -1258,6 +1266,12 @@ void BoundaryInfo::add_side(const Elem * elem,
1258
1266
_boundary_side_id .emplace (elem , std ::make_pair (side , id ));
1259
1267
_boundary_ids .insert (id );
1260
1268
_side_boundary_ids .insert (id ); // Also add this ID to the set of side boundary IDs
1269
+
1270
+ // create temp side and check if sideset has a matching nodeset
1271
+ ElemSideBuilder side_builder ;
1272
+ const Elem * new_side = & side_builder (* elem , side );
1273
+ if (has_equivalent_nodeset (new_side , id ))
1274
+ _sideset_to_nodeset_conversion .emplace (id , id );
1261
1275
}
1262
1276
}
1263
1277
@@ -1902,7 +1916,51 @@ void BoundaryInfo::renumber_id (boundary_id_type old_id,
1902
1916
this -> libmesh_assert_valid_multimaps ();
1903
1917
}
1904
1918
1919
+ boundary_id_type BoundaryInfo ::check_renumber_nodeset (boundary_id_type bc_id )
1920
+ {
1921
+ if (_sideset_to_nodeset_conversion .find (bc_id ) != _sideset_to_nodeset_conversion .end ())
1922
+ // A new bc ID has already been created for this nodeset. Return that
1923
+ return _sideset_to_nodeset_conversion [bc_id ];
1924
+ else
1925
+ {
1926
+ // Find a suitable id and add to map
1927
+ boundary_id_type new_id = _node_boundary_ids .size () + 1 ;
1928
+ while (_node_boundary_ids .find (new_id ) != _node_boundary_ids .end ())
1929
+ new_id ++ ;
1930
+ _sideset_to_nodeset_conversion .emplace (bc_id , new_id );
1931
+ return new_id ;
1932
+ }
1933
+ }
1905
1934
1935
+ bool BoundaryInfo ::has_equivalent_nodeset (const Elem * side , boundary_id_type bc_id )
1936
+ {
1937
+ bool equivalent_nodeset = false;
1938
+ if (_sideset_to_nodeset_conversion .find (bc_id ) != _sideset_to_nodeset_conversion .end ())
1939
+ // The appropriate sideset->nodeset conversion has already been found and we can skip this check
1940
+ return equivalent_nodeset ;
1941
+ const auto * n_list = side -> get_nodes ();
1942
+ for (unsigned int i = 0 ; i < side -> n_nodes (); i ++ )
1943
+ {
1944
+ const auto node = n_list [i ];
1945
+ //auto bc_ids = _boundary_node_id.equal_range(node);
1946
+ for (const auto & itr : as_range (_boundary_node_id .equal_range (node )))
1947
+ {
1948
+ if (itr .second == bc_id )
1949
+ {
1950
+ equivalent_nodeset = true;
1951
+ break ;
1952
+ }
1953
+ else
1954
+ equivalent_nodeset = false;
1955
+ // no equivalent nodeset exists
1956
+ //equivalent_nodeset = false;
1957
+ //break;
1958
+ }
1959
+ if (!equivalent_nodeset )
1960
+ break ;
1961
+ }
1962
+ return equivalent_nodeset ;
1963
+ }
1906
1964
1907
1965
unsigned int BoundaryInfo ::side_with_boundary_id (const Elem * const elem ,
1908
1966
const boundary_id_type boundary_id_in ) const
@@ -2358,20 +2416,28 @@ BoundaryInfo::build_node_list_from_side_list()
2358
2416
for (const auto & cur_elem : family )
2359
2417
{
2360
2418
side = & side_builder (* cur_elem , id_pair .first );
2361
-
2419
+ // Check for equivalent nodeset here. If it has one the next portion can be skipped
2362
2420
// Add each node node on the side with the side's boundary id
2421
+ //if (has_equivalent_nodeset(side, id_pair.second))
2422
+ //_sideset_to_nodeset_conversion.emplace(id_pair.second, id_pair.second);
2363
2423
for (auto i : side -> node_index_range ())
2424
+ {
2425
+ const boundary_id_type bcid = id_pair .second ;
2426
+ auto bcid_renum = bcid ;
2427
+ // Check that bcid is not the same as a sideset id
2428
+ if (_node_boundary_ids .find (bcid ) != _node_boundary_ids .end ())
2429
+ // Check that the nodeset and sideset don't cover the same area
2430
+ bcid_renum = check_renumber_nodeset (bcid_renum );
2431
+ this -> add_node (side -> node_ptr (i ), bcid_renum );
2432
+ _sideset_to_nodeset_conversion .emplace (bcid , bcid_renum );
2433
+ if (!mesh_is_serial )
2364
2434
{
2365
- const boundary_id_type bcid = id_pair .second ;
2366
- this -> add_node (side -> node_ptr (i ), bcid );
2367
- if (!mesh_is_serial )
2368
- {
2369
- const processor_id_type proc_id =
2370
- side -> node_ptr (i )-> processor_id ();
2371
- if (proc_id != my_proc_id )
2372
- nodes_to_push [proc_id ].emplace (side -> node_id (i ), bcid );
2373
- }
2435
+ const processor_id_type proc_id =
2436
+ side -> node_ptr (i )-> processor_id ();
2437
+ if (proc_id != my_proc_id )
2438
+ nodes_to_push [proc_id ].emplace (side -> node_id (i ), bcid );
2374
2439
}
2440
+ }
2375
2441
}
2376
2442
}
2377
2443
0 commit comments