[dune-functions] Range type for scalar grids functions
Carsten Gräser
graeser at mi.fu-berlin.de
Tue Sep 22 12:39:11 CEST 2015
Dear Christian,
Am 22.09.2015 um 00:16 schrieb Christian Engwer:
> Dear all,
>
> while checking that my pdelab implementation of a
> discretegridviewfunction adheres to the dune-functions interface I
> encountered something, which might be well known to you ;-)
>
> I was deriving the Range type from LocalBasis::Traits::RangeType. This
> means that for scalar functions our return type is
> Dune::FieldVector<RF,1> and the DerivativeRange is consequently a
> FieldMatrix.
>
> Now this is surprising for the user (and I did the same mistake in my
> tests), as the user would assume that the scalar function return just
> RF. How do you interpret the situation? Should we live with this
I'm not sure if he would do that. Once we use vector
types, it's reasonable to expect that the derivatives
are matrices and can be accessed accordingly. Even
if the size is one. One may also expect that it can be
used like a scalar (which is true for FM<K,1,1>).
The other way around won't work: Use a scala as matrix.
Hence I'd stick with the current approach.
This however reveals a deeper problem: We don't
have a proper type the encapsulate scalars in dune.
Typically we use FieldVector<K,1> for this but then
it should work as vector and as scalar with the well
known problems--the one you mentioned being one of them.
For functions however there's no strong need for a special
type Scalar<K> (as in nested vectors). Hence you can
just use K. For a function mapping K->K you'll get
K as derivative type. For FV<K,n>->K you'll get FV<K,n>
Best,
Carsten
> situation and inherit the return type form localfunctions, or should
> be work around this and force scalar functions to return RF? We could
> easily achieve this by yet an other traits class ;-)
>
> Ciao
> Christian
>
> _______________________________________________
> dune-functions mailing list
> dune-functions at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-functions
>
--
Prof. Dr. Carsten Gräser
Freie Universität Berlin
Institut für Mathematik
Arnimallee 6
14195 Berlin, Germany
phone: +49 30 838 72637
fax : +49 30 838 472637
email: graeser at mi.fu-berlin.de
URL : http://page.mi.fu-berlin.de/graeser
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://lists.dune-project.org/pipermail/dune-functions/attachments/20150922/9a534f77/attachment.sig>
More information about the dune-functions
mailing list