Skip to content

Commit

Permalink
Made BoundaryInfo::boundary_ids for _children_on_boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
fdkong committed Feb 24, 2022
1 parent 7cb30f1 commit 0c01ac7
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions src/mesh/boundary_info.C
Original file line number Diff line number Diff line change
Expand Up @@ -1237,29 +1237,38 @@ void BoundaryInfo::boundary_ids (const Elem * const elem,
// Clear out any previous contents
vec_to_fill.clear();

// Only level-0 elements store BCs. If this is not a level-0
// element get its level-0 parent and infer the BCs.
const Elem * searched_elem = elem;
// Only level-0 elements store BCs if _children_on_boundary is off
// We want to check current element if _children_on_boundary is on
std::vector<const Elem *> searched_elems;
if (_children_on_boundary || elem->level() == 0)
searched_elems.push_back(elem);

if (elem->level() != 0)
{
if (elem->neighbor_ptr(side) == nullptr)
searched_elem = elem->top_parent ();
searched_elems.push_back(elem->top_parent());
#ifdef LIBMESH_ENABLE_AMR
else
{
const Elem * searched_elem = elem;
while (searched_elem->parent() != nullptr)
{
const Elem * parent = searched_elem->parent();
if (parent->is_child_on_side(parent->which_child_am_i(searched_elem), side) == false)
if (parent->is_child_on_side(parent->which_child_am_i(searched_elem), side) == false && !_children_on_boundary)
return;
searched_elem = parent;
}
searched_elems.push_back(elem->top_parent());
}
#endif
}


// Check each element in the range to see if its side matches the requested side.
for (const auto & pr : as_range(_boundary_side_id.equal_range(searched_elem)))
if (pr.second.first == side)
vec_to_fill.push_back(pr.second.second);
for (auto searched_elem: searched_elems)
for (const auto & pr : as_range(_boundary_side_id.equal_range(searched_elem)))
if (pr.second.first == side)
vec_to_fill.push_back(pr.second.second);
}


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

// Only level-0 elements store BCs.
if (elem->parent())
if (elem->parent() && !_children_on_boundary)
return;

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

0 comments on commit 0c01ac7

Please sign in to comment.