Skip to content

Commit 0c01ac7

Browse files
committed
Made BoundaryInfo::boundary_ids for _children_on_boundary
1 parent 7cb30f1 commit 0c01ac7

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

src/mesh/boundary_info.C

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,29 +1237,38 @@ void BoundaryInfo::boundary_ids (const Elem * const elem,
12371237
// Clear out any previous contents
12381238
vec_to_fill.clear();
12391239

1240-
// Only level-0 elements store BCs. If this is not a level-0
1241-
// element get its level-0 parent and infer the BCs.
1242-
const Elem * searched_elem = elem;
1240+
// Only level-0 elements store BCs if _children_on_boundary is off
1241+
// We want to check current element if _children_on_boundary is on
1242+
std::vector<const Elem *> searched_elems;
1243+
if (_children_on_boundary || elem->level() == 0)
1244+
searched_elems.push_back(elem);
1245+
12431246
if (elem->level() != 0)
12441247
{
12451248
if (elem->neighbor_ptr(side) == nullptr)
1246-
searched_elem = elem->top_parent ();
1249+
searched_elems.push_back(elem->top_parent());
12471250
#ifdef LIBMESH_ENABLE_AMR
12481251
else
1252+
{
1253+
const Elem * searched_elem = elem;
12491254
while (searched_elem->parent() != nullptr)
12501255
{
12511256
const Elem * parent = searched_elem->parent();
1252-
if (parent->is_child_on_side(parent->which_child_am_i(searched_elem), side) == false)
1257+
if (parent->is_child_on_side(parent->which_child_am_i(searched_elem), side) == false && !_children_on_boundary)
12531258
return;
12541259
searched_elem = parent;
12551260
}
1261+
searched_elems.push_back(elem->top_parent());
1262+
}
12561263
#endif
12571264
}
12581265

1266+
12591267
// Check each element in the range to see if its side matches the requested side.
1260-
for (const auto & pr : as_range(_boundary_side_id.equal_range(searched_elem)))
1261-
if (pr.second.first == side)
1262-
vec_to_fill.push_back(pr.second.second);
1268+
for (auto searched_elem: searched_elems)
1269+
for (const auto & pr : as_range(_boundary_side_id.equal_range(searched_elem)))
1270+
if (pr.second.first == side)
1271+
vec_to_fill.push_back(pr.second.second);
12631272
}
12641273

12651274

@@ -1285,7 +1294,7 @@ void BoundaryInfo::raw_boundary_ids (const Elem * const elem,
12851294
vec_to_fill.clear();
12861295

12871296
// Only level-0 elements store BCs.
1288-
if (elem->parent())
1297+
if (elem->parent() && !_children_on_boundary)
12891298
return;
12901299

12911300
// Check each element in the range to see if its side matches the requested side.

0 commit comments

Comments
 (0)