Skip to content

Commit

Permalink
Formatting and doc edits for PR idaholab#18913
Browse files Browse the repository at this point in the history
  • Loading branch information
socratesgorilla committed Sep 28, 2021
1 parent 6761965 commit 88d69fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion framework/include/meshgenerators/RefineSidesetGenerator.h
Expand Up @@ -37,7 +37,7 @@ class RefineSidesetGenerator : public MeshGenerator
/// Toggles whether neighboring level one elements should be refined or not. Defaults to true.
const bool _enable_neighbor_refinement;

/// Side of the boundary to be refined
/// Side(s) of the boundary/boundaries to be refined. Can be either "primary"(just the boundary elements), "secondary"(just the neighboring elements), or "both."
const MultiMooseEnum _boundary_side;

/// The actual function refining the boundaries. This is done recursively in order to minimize the number of refinement iterations.
Expand Down
12 changes: 3 additions & 9 deletions framework/src/meshgenerators/RefineSidesetGenerator.C
Expand Up @@ -31,7 +31,7 @@ RefineSidesetGenerator::validParams()
true,
"Toggles whether neighboring level one elements should be refined or not. Defaults to true");
MultiMooseEnum boundary_side("primary secondary both", "both");
params.addParam<MultiMooseEnum>("boundary_side", boundary_side, " ");
params.addParam<MultiMooseEnum>("boundary_side", boundary_side, "Whether the generator should refine itself(primary), its neighbors(secondary), or itself and its neighbors(both)");

return params;
}
Expand All @@ -45,16 +45,15 @@ RefineSidesetGenerator::RefineSidesetGenerator(const InputParameters & parameter
_boundary_side(getParam<MultiMooseEnum>("boundary_side"))
{
}

std::unique_ptr<MeshBase>
RefineSidesetGenerator::generate()
{

// Get the list of boundary ids from the boundary names
const auto boundary_ids =
MooseMeshUtils::getBoundaryIDs(*_input, getParam<std::vector<BoundaryName>>("boundaries"), true);

// Check that the boundary ids/names exist in the mesh

for (std::size_t i = 0; i < boundary_ids.size(); ++i)
if (boundary_ids[i] == Moose::INVALID_BOUNDARY_ID)
{
Expand All @@ -67,8 +66,6 @@ RefineSidesetGenerator::generate()

std::unique_ptr<MeshBase> mesh = std::move(_input);
int max = *std::max_element(_refinement.begin(), _refinement.end());


return recursive_refine(boundary_ids, mesh, _refinement, max);
}

Expand All @@ -79,7 +76,7 @@ RefineSidesetGenerator::recursive_refine(std::vector<boundary_id_type> boundary_
int max,
int ref_step)
{

//If the refinement step has reached the largest value in the _refinement array, return the mesh, as we are done.
if (ref_step == max)
return dynamic_pointer_cast<MeshBase>(mesh);
mesh->prepare_for_use();
Expand All @@ -88,7 +85,6 @@ RefineSidesetGenerator::recursive_refine(std::vector<boundary_id_type> boundary_
if (refinement[i] > 0 && refinement[i] > ref_step)
{
BoundaryInfo boundInfo = mesh->get_boundary_info();
//declared up here to avoid weird typing bug
std::vector< std::tuple< dof_id_type, unsigned short int, boundary_id_type > > sideList = boundInfo.build_active_side_list();
for (std::tuple<dof_id_type, unsigned short int, boundary_id_type> tuple : sideList){
if (std::get<2>(tuple) == boundary_ids[i]){
Expand All @@ -109,7 +105,6 @@ RefineSidesetGenerator::recursive_refine(std::vector<boundary_id_type> boundary_
child_elem->set_refinement_flag(Elem::REFINE);
}
}

}
}
}
Expand All @@ -119,7 +114,6 @@ RefineSidesetGenerator::recursive_refine(std::vector<boundary_id_type> boundary_
if (!_enable_neighbor_refinement)
refinedmesh.face_level_mismatch_limit() = 0;
refinedmesh.refine_elements();

ref_step++;
return recursive_refine(boundary_ids, mesh, refinement, max, ref_step);
}

0 comments on commit 88d69fd

Please sign in to comment.