Skip to content

Commit 4d5ad98

Browse files
committed
Refactored element type check to use string comparison as suggested in #4218.
1 parent 231f9e6 commit 4d5ad98

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/systems/variational_smoother_system.C

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,10 @@ void VariationalSmootherSystem::prepare_for_smoothing()
139139
target_elem_inverse_jacobian_dets[elem->type()] =
140140
std::vector<Real>(nq_points, 1.0);
141141

142+
const auto type_str = Utility::enum_to_string(elem->type());
143+
142144
// Elems deriving from Tri
143-
if (elem->type() == TRI3 || elem->type() == TRI6)
145+
if (type_str.compare(0, 3, "TRI") == 0)
144146
{
145147

146148
// The target element will be an equilateral triangle with area equal to
@@ -180,7 +182,7 @@ void VariationalSmootherSystem::prepare_for_smoothing()
180182
}
181183

182184
default:
183-
libmesh_error_msg("Unsupported triangular element!");
185+
libmesh_error_msg("Unsupported triangular element: " << type_str);
184186
break;
185187
}
186188

tests/mesh/mesh_smoother_test.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public:
283283
// Get mesh dimension, determine whether type is triangular
284284
const auto * ref_elem = &(ReferenceElem::get(type));
285285
const auto dim = ref_elem->dim();
286-
const bool type_is_tri = dynamic_cast<const Tri*>(ref_elem);
286+
const bool type_is_tri = Utility::enum_to_string(type).compare(0, 3, "TRI") == 0;
287287

288288
unsigned int n_elems_per_side = 5;
289289

0 commit comments

Comments
 (0)