Skip to content

Commit 0a41e91

Browse files
committed
Made BoundaryInfo::boundary_ids for _children_on_boundary
1 parent aeb6df3 commit 0a41e91

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
@@ -1235,29 +1235,38 @@ void BoundaryInfo::boundary_ids (const Elem * const elem,
12351235
// Clear out any previous contents
12361236
vec_to_fill.clear();
12371237

1238-
// Only level-0 elements store BCs. If this is not a level-0
1239-
// element get its level-0 parent and infer the BCs.
1240-
const Elem * searched_elem = elem;
1238+
// Only level-0 elements store BCs if _children_on_boundary is off
1239+
// We want to check current element if _children_on_boundary is on
1240+
std::vector<const Elem *> searched_elems;
1241+
if (_children_on_boundary || elem->level() == 0)
1242+
searched_elems.push_back(elem);
1243+
12411244
if (elem->level() != 0)
12421245
{
12431246
if (elem->neighbor_ptr(side) == nullptr)
1244-
searched_elem = elem->top_parent ();
1247+
searched_elems.push_back(elem->top_parent());
12451248
#ifdef LIBMESH_ENABLE_AMR
12461249
else
1250+
{
1251+
const Elem * searched_elem = elem;
12471252
while (searched_elem->parent() != nullptr)
12481253
{
12491254
const Elem * parent = searched_elem->parent();
1250-
if (parent->is_child_on_side(parent->which_child_am_i(searched_elem), side) == false)
1255+
if (parent->is_child_on_side(parent->which_child_am_i(searched_elem), side) == false && !_children_on_boundary)
12511256
return;
12521257
searched_elem = parent;
12531258
}
1259+
searched_elems.push_back(elem->top_parent());
1260+
}
12541261
#endif
12551262
}
12561263

1264+
12571265
// Check each element in the range to see if its side matches the requested side.
1258-
for (const auto & pr : as_range(_boundary_side_id.equal_range(searched_elem)))
1259-
if (pr.second.first == side)
1260-
vec_to_fill.push_back(pr.second.second);
1266+
for (auto searched_elem: searched_elems)
1267+
for (const auto & pr : as_range(_boundary_side_id.equal_range(searched_elem)))
1268+
if (pr.second.first == side)
1269+
vec_to_fill.push_back(pr.second.second);
12611270
}
12621271

12631272

@@ -1283,7 +1292,7 @@ void BoundaryInfo::raw_boundary_ids (const Elem * const elem,
12831292
vec_to_fill.clear();
12841293

12851294
// Only level-0 elements store BCs.
1286-
if (elem->parent())
1295+
if (elem->parent() && !_children_on_boundary)
12871296
return;
12881297

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

0 commit comments

Comments
 (0)