Skip to content
Snippets Groups Projects
Commit e06f16d8 authored by Test User's avatar Test User Committed by Oliver Sander
Browse files

Make Geometry export the return type of the 'volume' method

Previously this was 'ctype', but grids may care about proper
dimensions.  In that case, a volume is not the same as a
coordinate, and a separate type for volumes is necessary.

The interface class does not hard-wire any type but rather exports
the type used by the Geometry implementation class.  That type
is determined by introspection, there is no need to adapt
downstream grid implementations.
parent 6f10b0ec
No related branches found
No related tags found
1 merge request!342Change type of volume method to typedef
Pipeline #18826 passed
......@@ -64,6 +64,12 @@
- The Capability `hasBackupRestoreFacilities<GeometryGrid<HG, CoordFunction>>`
now returns `false` in case the `CoordFunction` is not default-constructible.
- The `Geometry` interface now provides the type `Volume` for the return value of the
method of the same name. Note that this may be different from `ctype` if you care
about dimensions. In that case `ctype` is a length, and not appropriate for
a quantity that is a volume.
# Release 2.6
- The deprecated `EntityPointer` has been removed completely and `EntityIterator`
......
......@@ -100,6 +100,9 @@ namespace Dune
//! type of the global coordinates
typedef FieldVector< ctype, cdim > GlobalCoordinate;
//! Number type used for the geometry volume
typedef decltype(std::declval<Implementation>().volume()) Volume;
/**
* \brief type of jacobian inverse transposed
*
......@@ -202,7 +205,7 @@ namespace Dune
}
/** \brief return volume of geometry */
ctype volume () const
Volume volume () const
{
return impl().volume();
}
......@@ -307,6 +310,9 @@ namespace Dune
typedef FieldVector< ctype, mydim > LocalCoordinate;
typedef FieldVector< ctype, cdim > GlobalCoordinate;
//! Number type used for the geometry volume
typedef ctype Volume;
//! type of jacobian inverse transposed
typedef FieldMatrix< ctype, cdim, mydim > JacobianInverseTransposed;
......@@ -314,7 +320,7 @@ namespace Dune
typedef FieldMatrix< ctype, mydim, cdim > JacobianTransposed;
//! return volume of the geometry
ctype volume () const
Volume volume () const
{
GeometryType type = asImp().type();
......@@ -365,6 +371,7 @@ namespace Dune
typedef FieldVector< ctype, mydim > LocalCoordinate;
typedef FieldVector< ctype, cdim > GlobalCoordinate;
typedef ctype Volume;
//! type of jacobian inverse transposed
typedef FieldMatrix< ctype, cdim, mydim > JacobianInverseTransposed;
......@@ -385,9 +392,9 @@ namespace Dune
}
//! return volume of the geometry
ctype volume () const
Volume volume () const
{
return 1.0;
return Volume(1.0);
}
//! return center of the geometry
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment