Commit 0f3e9c32 authored by GILLES Sebastien's avatar GILLES Sebastien

#1520 Test GlobalCoordsQuadPts: refactor the huge CheckQuadratureRule()...

#1520 Test GlobalCoordsQuadPts: refactor the huge CheckQuadratureRule() anonymous function into smaller ones (still in progress) to ease reading.
parent 29c5b3e0
......@@ -131,6 +131,43 @@ namespace MoReFEM::TestNS::GlobalCoordsQuadPt
{
void FillExpectedGlobalCoords(const QuadratureRule& quadrature_rule,
std::vector<double>& expected_global_coords)
{
decltype(auto) quadrature_point_list = quadrature_rule.GetQuadraturePointList();
const auto topology_identifier = quadrature_rule.GetTopologyIdentifier();
for (const auto& it_quad_pt : quadrature_point_list)
{
const auto& vec_values = it_quad_pt->GetCoordinates();
for (const auto local_coords : vec_values)
{
double expected_value;
if (topology_identifier == RefGeomEltNS::TopologyNS::Type::tetrahedron
|| topology_identifier == RefGeomEltNS::TopologyNS::Type::triangle)
{
// Integration interval is already defined on [0., 1.]^n for these topologies.
expected_value = local_coords;
}
else
{
// Integration interval is on [-1., 1.], this maps the values to the [0., 1.] interval.
expected_value = (local_coords + 1.) * .5;
}
expected_global_coords.push_back(expected_value);
}
// Set to 0 global coords of the dimensions that are not relevant as local coords of the quadrature
// have the same number of components as the dimension of the finite element considered.
const auto Ndimension = it_quad_pt->GetDimension();
for (auto i = Ndimension; i < 3; ++i)
expected_global_coords.push_back(0.);
}
}
void CheckQuadratureRule(const QuadratureRulePerTopology& quadrature_rule_per_topology,
const ParameterAtQuadraturePoint<ParameterNS::Type::vector>& obtained_global_coords,
const FilesystemNS::Directory& result_directory_path,
......@@ -153,37 +190,9 @@ namespace MoReFEM::TestNS::GlobalCoordsQuadPt
continue;
const auto topology_identifier = ref_geom_elt.GetTopologyIdentifier();
const auto& quadrature_rule = quadrature_rule_per_topology.GetRule(topology_identifier);
const auto& quadrature_rule = quadrature_rule_per_topology.GetRule(ref_geom_elt.GetTopologyIdentifier());
const auto& ptr_pt_list = quadrature_rule.GetQuadraturePointList();
for (const auto& it_quad_pt : ptr_pt_list)
{
const auto& vec_values = it_quad_pt->GetCoordinates();
for (const auto local_coords : vec_values)
{
double expected_value;
if (topology_identifier == RefGeomEltNS::TopologyNS::Type::tetrahedron
|| topology_identifier == RefGeomEltNS::TopologyNS::Type::triangle)
{
// Integration interval is already defined on [0., 1.]^n for these topologies.
expected_value = local_coords;
}
else
{
// Integration interval is on [-1., 1.], this maps the values to the [0., 1.] interval.
expected_value = (local_coords + 1.) * .5;
}
expected_global_coords.push_back(expected_value);
}
// Set to 0 global coords of the dimensions that are not relevant as local coords of the quadrature
// have the same number of components as the dimension of the finite element considered.
const auto Ndimension = it_quad_pt->GetDimension();
for (auto i = Ndimension; i < 3; ++i)
expected_global_coords.push_back(0.);
}
FillExpectedGlobalCoords(quadrature_rule, expected_global_coords);
FilesystemNS::Directory output_directory(result_directory_path,
ref_geom_elt.GetTopologyName(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment