Skip to content

Commit

Permalink
Fix AMR + uniform refinement with tet meshes marking
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiangrimberg committed Jun 26, 2024
1 parent 9871da9 commit 12c2711
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion palace/drivers/basesolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void BaseSolver::SolveEstimateMarkRefine(std::vector<std::unique_ptr<Mesh>> &mes
Mpi::Warning("AMR is not currently supported for transient simulations!\n");
return false;
}
return refinement.max_it > 0;
return (refinement.max_it > 0);
}();
if (use_amr && mesh.size() > 1)
{
Expand Down
6 changes: 5 additions & 1 deletion palace/utils/geodata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,13 @@ void RefineMesh(const IoData &iodata, std::vector<std::unique_ptr<mfem::ParMesh>
// Simplex meshes need to be re-finalized in order to use local refinement (see
// the docstring for mfem::Mesh::UniformRefinement).
const auto element_types = mesh::CheckElements(*mesh.back());
if (uniform_ref_levels > 0 && element_types.has_simplices)
if (element_types.has_simplices && uniform_ref_levels > 0 &&
(max_region_ref_levels > 0 || iodata.model.refinement.max_it > 0))
{
constexpr bool refine = true, fix_orientation = false;
Mpi::Print("\nFlattening mesh sequence:\n Local mesh refinement will start from the "
"final uniformly-refined mesh\n");
mesh.erase(mesh.begin(), mesh.end() - 1);
mesh.back()->Finalize(refine, fix_orientation);
}

Expand Down

0 comments on commit 12c2711

Please sign in to comment.