Add Geometry::jacobianInverse()
Compare changes
Files
3+ 87
− 0
@@ -11,6 +11,8 @@
@@ -126,6 +128,42 @@ namespace Dune
@@ -267,6 +305,55 @@ namespace Dune
This adds a method Geometry::jacobianInverse(localCoordinate)
and a
corresponding typedef Geometry::JacobianInverse
to the Geometry
interface class. The method is default implemented using the
TransposedMatrixWrapper
from dune-common which internally captures
(by value) the matrix returned by Geometry::jacobianInverseTransposed()
.
This is marked WIP, because a few things need to be discussed:
Dune::Geometry
.
Hence it will work for all grid implementations. But one may argue (I tend to do so)
that it should be implemented directly in the geometry implementations. Otherwise
a Geometry
provided by a grid provides a different interface than e.g. a MultilinearGeometry
.
To avoid that all grid implementations need to be modified, one could conditionally
activate the default-implementation depending on presence of an implemenation in the grid
implementation.FieldMatrix
using operator*
. This is exactly what you
need for the chain rule. This is in some sense the 'linear operator interface' proposed by @peter, but for the case where you want to chain the operator instead of directly applying it. Is this sufficient?FieldMatrix
?Geometry::jacobian()
also be implemented in a similar way? I currently don't
have a use case for this, but having both, jacobian()
and jacobianTransposed()
seems to be reasonable. This would e.g. allow to write g.jacobianTransposed(x)*g.jacobian(x)
to compute the metric tensor which is conceptually nice (but probably inefficient).TransposedMatrixWrapper
is already tested in dune-common
and I also tested with the dune-functions examples, where this allows to replacing the ridiculous transpose(geometry.jacobianInverseTransposed(x)
by a plain geometry.jacobianInverse(x)
.This is related to several other MRs that should be merged in appropriate order:
transpose()
.transpose()
function to support capturing matrices by value.transpose(matrix)
and matrix.transposed()
Geometry
interface class by the new interface. This is conditionally default-implemented: If the actual grid geometry provides the new interface it is used, otherwise a default implementation based on transpose()
is used.