From e3984639cdfab1cfa0a44ec3682fc15a055c5337 Mon Sep 17 00:00:00 2001 From: Oliver Sander <oliver.sander@tu-dresden.de> Date: Sat, 23 Jan 2016 17:50:24 +0100 Subject: [PATCH] Fix one issue that prevented the code to compile with dimworld!=3 I want this file with dimworld!=3 grids, even though it only makes sense to use it if dimworld==3. With this patch the file still does not compile. However, the only remaining problem is the hacky computation of the surface normals, which needs to be rewritten in full generality soon anyway. --- dune/gfe/nonplanarcosseratshellenergy.hh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/dune/gfe/nonplanarcosseratshellenergy.hh b/dune/gfe/nonplanarcosseratshellenergy.hh index 8c7317c0..a0b80b63 100644 --- a/dune/gfe/nonplanarcosseratshellenergy.hh +++ b/dune/gfe/nonplanarcosseratshellenergy.hh @@ -336,8 +336,18 @@ energy(const typename Basis::LocalView& localView, // First fundamental form Dune::FieldMatrix<double,3,3> aCovariant; - aCovariant[0] = geometry.jacobianTransposed(quadPos)[0]; - aCovariant[1] = geometry.jacobianTransposed(quadPos)[1]; + // If dimworld==3, then the first two lines of aCovariant are simply the jacobianTransposed + // of the element. If dimworld<3 (i.e., ==2), we have to explicitly enters 0.0 in the last column. + auto jacobianTransposed = geometry.jacobianTransposed(quadPos); + + for (int i=0; i<2; i++) + { + for (int j=0; j<dimworld; j++) + aCovariant[i][j] = jacobianTransposed[i][j]; + for (int j=dimworld; j<3; i++) + aCovariant[i][j] = 0.0; + } + aCovariant[2] = Arithmetic::crossProduct(aCovariant[0], aCovariant[1]); aCovariant[2] /= aCovariant[2].two_norm(); -- GitLab