Add Geometry::jacobianInverse()
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:
Currently the method is default-implemented in the interface classDune::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 aGeometry
provided by a grid provides a different interface than e.g. aMultilinearGeometry
. 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.Which interface do we want to provide? Currently you can do exactly one thing: Multiply the matrix from the right to aFieldMatrix
usingoperator*
. 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?Maybe one also wants a cast to a suitableFieldMatrix
?ShouldGeometry::jacobian()
also be implemented in a similar way? I currently don't have a use case for this, but having both,jacobian()
andjacobianTransposed()
seems to be reasonable. This would e.g. allow to writeg.jacobianTransposed(x)*g.jacobian(x)
to compute the metric tensor which is conceptually nice (but probably inefficient).Tests are missing (in dune-grid) due to the open questions. But theTransposedMatrixWrapper
is already tested in dune-common and I also tested with the dune-functions examples, where this allows to replacing the ridiculoustranspose(geometry.jacobianInverseTransposed(x)
by a plaingeometry.jacobianInverse(x)
.
This is related to several other MRs that should be merged in appropriate order:
dune-common!1100 (merged) provides a utility needed for the subsequent extension oftranspose()
.dune-common!1101 (closed) extends thetranspose()
function to support capturing matrices by value.-
dune-common!1138 (merged) extends support for
transpose(matrix)
andmatrix.transposed()
-
!577 (merged) (present MR) extends the (grid-)
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 ontranspose()
is used. - dune-geometry!193 (merged) extends the actual geometry check and the implementations provided in dune-geomtry by the new interface.
Merge request reports
Activity
- Resolved by Carsten Gräser
Maybe one also wants a cast to a suitable FieldMatrix?
Isn't this what we except the return type of
jacobianInverseTranspose
to do as well? I think that is reasonable. In the cases whereoperator*
is not enough one can use that to get a richer interface. I needed to do that with ajacobianInverseTranspose
as well in some code I had if I remember correctly.A question concerning your implementation: since any grid geometry should use the wrapper class it in this form not possible for a given grid implementation to provide that method, is that right? If possible I would suggest to have this default and test if the implementation provides it. We can then decide to deprecate the default implementation at some point if we want to.
I think providing
jacobian
makes sense - that seems expected withjacT,jacInv,jacInvT
being available.
- Resolved by Carsten Gräser
mentioned in merge request dune-geometry!193 (merged)
The tests are now extended in dune-geometry!193 (merged).
added 1 commit
- 7aeaf07d - [doc] Mention extended jacobian interface of geometries in change log
- Resolved by Carsten Gräser
- Resolved by Carsten Gräser
mentioned in merge request dune-common!1101 (closed)
added 46 commits
-
7aeaf07d...ce5efe9e - 43 commits from branch
master
- 5ff53085 - Add Geometry::jacobian() and Geometry::jacobianInverse()
- 596ea49e - Add Geometry::jacobian() and Geometry::jacobianInverse() to static grid check
- 87abeae3 - [doc] Mention extended jacobian interface of geometries in change log
Toggle commit list-
7aeaf07d...ce5efe9e - 43 commits from branch