Commit 166d0b37 authored by GILLES Sebastien's avatar GILLES Sebastien

#1520 Test GlobalCoordsQuadPts: replace an if by a switch: the code is a bit...

#1520 Test GlobalCoordsQuadPts: replace an if by a switch: the code is a bit clumsy to take into account the fact some reference geometric elements are defined over [0, 1] and others over [-1, 1], but should we add a new type the switch will immediately warn us that the new type must be properly placed in either one of these cases.
parent 0f3e9c32
......@@ -144,6 +144,26 @@ namespace MoReFEM::TestNS::GlobalCoordsQuadPt
{
double expected_value;
switch(topology_identifier)
{
case RefGeomEltNS::TopologyNS::Type::triangle:
case RefGeomEltNS::TopologyNS::Type::tetrahedron:
{
// Integration interval is already defined on [0., 1.]^n for these topologies.
expected_value = local_coords;
break;
}
case RefGeomEltNS::TopologyNS::Type::point:
case RefGeomEltNS::TopologyNS::Type::segment:
case RefGeomEltNS::TopologyNS::Type::quadrangle:
case RefGeomEltNS::TopologyNS::Type::hexahedron:
{
// Integration interval is on [-1., 1.], this maps the values to the [0., 1.] interval.
expected_value = (local_coords + 1.) * .5;
break;
}
}
if (topology_identifier == RefGeomEltNS::TopologyNS::Type::tetrahedron
|| topology_identifier == RefGeomEltNS::TopologyNS::Type::triangle)
{
......@@ -151,10 +171,7 @@ namespace MoReFEM::TestNS::GlobalCoordsQuadPt
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);
}
......
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