Push 'corners' Object into Assert

That way we don't get "unused variable" warnings when someone
defines NDEBUG.  While here, also switch to using Geometry
references where appropriate to avoid needlessly copying Geometry
objects.
This commit is contained in:
Bård Skaflestad 2021-03-18 18:13:24 +01:00
parent 2b34dc843c
commit c220d7f127
2 changed files with 3 additions and 4 deletions

View File

@ -892,7 +892,7 @@ private:
static constexpr int zCoord = Element::dimension - 1;
Scalar zz = 0.0;
const Geometry geometry = element.geometry();
const Geometry& geometry = element.geometry();
const int corners = geometry.corners();
for (int i=0; i < corners; ++i)
zz += geometry.corner(i)[zCoord];

View File

@ -414,14 +414,13 @@ protected:
Scalar zz1 = 0.0;
Scalar zz2 = 0.0;
const Geometry geometry = element.geometry();
const int corners = geometry.corners();
const Geometry& geometry = element.geometry();
// This code only works with CP-grid where the
// number of corners are 8 and
// also assumes that the first
// 4 corners are the top surface and
// the 4 next are the bottomn.
assert(corners == 8);
assert(geometry.corners() == 8);
for (int i=0; i < 4; ++i){
zz1 += geometry.corner(i)[zCoord];
zz2 += geometry.corner(i+4)[zCoord];