Skip to content

Commit aeb6df3

Browse files
committed
Added APIs to allow users set the flag: _children_on_boundary
The motivaiton is that: "automatic" way might not work for cases. For example, if the flag is on on a subset of processor cores, and then we do reparitioning, and then we might hit trouble because the flag is off on the other processors I try to avoid having a global reduction to have everyone on the same page. In fact, we know when we want to allow children on boundary in MOOSE. In this case, we should set the flag to make the code more robust
1 parent d6e2dd8 commit aeb6df3

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

include/mesh/boundary_info.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,18 @@ class BoundaryInfo : public ParallelObject
874874
const std::multimap<const Elem *, std::pair<unsigned short int, boundary_id_type>> & get_sideset_map() const
875875
{ return _boundary_side_id; }
876876

877+
/**
878+
* \returns Whether or not there are some children on boundary sides
879+
*/
880+
bool is_children_on_boundary_side() const
881+
{ return _children_on_boundary; }
882+
883+
/**
884+
* Whether or not to allow set boundary sides on children elements
885+
*/
886+
void allow_children_on_boundary_side(const bool children_on_boundary)
887+
{ _children_on_boundary = children_on_boundary; }
888+
877889
private:
878890

879891
/**

src/mesh/boundary_info.C

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,8 +1364,8 @@ void BoundaryInfo::remove_edge (const Elem * elem,
13641364
{
13651365
libmesh_assert(elem);
13661366

1367-
// Only level 0 elements unless the flag "_children_on_boundary" is on.
1368-
libmesh_assert(elem->level()==0 || _children_on_boundary);
1367+
// Only level 0 elements are stored in BoundaryInfo.
1368+
libmesh_assert_equal_to (elem->level(), 0);
13691369

13701370
// Erase (elem, edge, *) entries from map.
13711371
erase_if(_boundary_edge_id, elem,
@@ -1381,8 +1381,8 @@ void BoundaryInfo::remove_edge (const Elem * elem,
13811381
{
13821382
libmesh_assert(elem);
13831383

1384-
// Only level 0 elements unless the flag "_children_on_boundary" is on.
1385-
libmesh_assert(elem->level() == 0 || _children_on_boundary);
1384+
// Only level 0 elements are stored in BoundaryInfo.
1385+
libmesh_assert_equal_to (elem->level(), 0);
13861386

13871387
// Erase (elem, edge, id) entries from map.
13881388
erase_if(_boundary_edge_id, elem,
@@ -1396,8 +1396,8 @@ void BoundaryInfo::remove_shellface (const Elem * elem,
13961396
{
13971397
libmesh_assert(elem);
13981398

1399-
// Only level 0 elements unless the flag "_children_on_boundary" is on.
1400-
libmesh_assert(elem->level() == 0 || _children_on_boundary);
1399+
// Only level 0 elements are stored in BoundaryInfo.
1400+
libmesh_assert_equal_to (elem->level(), 0);
14011401

14021402
// Shells only have 2 faces
14031403
libmesh_assert_less(shellface, 2);
@@ -1416,8 +1416,8 @@ void BoundaryInfo::remove_shellface (const Elem * elem,
14161416
{
14171417
libmesh_assert(elem);
14181418

1419-
// Only level 0 elements unless the flag "_children_on_boundary" is on.
1420-
libmesh_assert(elem->level() == 0 || _children_on_boundary);
1419+
// Only level 0 elements are stored in BoundaryInfo.
1420+
libmesh_assert_equal_to (elem->level(), 0);
14211421

14221422
// Shells only have 2 faces
14231423
libmesh_assert_less(shellface, 2);
@@ -1508,6 +1508,8 @@ unsigned int BoundaryInfo::side_with_boundary_id(const Elem * const elem,
15081508
// parent if any
15091509
if (elem->level() != 0)
15101510
searched_elem_vec.push_back(elem->top_parent());
1511+
else if (!_children_on_boundary)
1512+
searched_elem_vec.push_back(elem);
15111513

15121514
for (auto it = searched_elem_vec.begin(); it != searched_elem_vec.end(); ++it)
15131515
{
@@ -1567,6 +1569,8 @@ BoundaryInfo::sides_with_boundary_id(const Elem * const elem,
15671569
// Return boundary information of its parent as well
15681570
if (elem->level() != 0)
15691571
searched_elem_vec.push_back(elem->top_parent());
1572+
else if (!_children_on_boundary)
1573+
searched_elem_vec.push_back(elem);
15701574

15711575
for (auto it = searched_elem_vec.begin(); it != searched_elem_vec.end(); ++it)
15721576
{

0 commit comments

Comments
 (0)