[dune-pdelab] GridFunction with dim < dimworld

Jö Fahlke jorrit at jorrit.de
Wed Sep 5 11:49:49 CEST 2012


Am Wed,  5. Sep 2012, 09:44:11 +0200 schrieb Nicolas Schwenck:
> I am sorry that I stated my problem incorrectly. The
> AnalyticGridFunctin of course does work.
> 
> By using it I stumbled upon the problem that I can't use its traits
> to derive the correct type for the position in the evaluateGlobal
> method.
> 
> That is, as correctly described by Jö, because the base class is
> GridFunction which evaluates element-local.
> 
> Now I was wondering
> 
> 1) if DomainType in general should be dim- or dimworld-sized

It should be dim-sized.  It is used as the argument to evaluate(), which must
be element-local coordinates.  Changing this would break a lot of code using
GridFunctions.  (Remember, there are other incarnations of the GridFunction
interface besides AnalyticGridFunctions, some of them may never come in touch
with world-coordinates.)

> 2) and in particular if it would make life easier when the
> AnalyticGridFunctionTraits exports, maybe additionally, a DomainType
> in dimworld?

My feeling is that this would be cluttering the interface for little benefit,
since this type is usually only used once or twice.  But I don't feel very
strong about this and won't mind if somebody else commits such a change.

> template<typename GV, typename RF>
> class ExampleAnalyticalGridFunction :
>     public Dune::PDELab::AnalyticGridFunctionBase<Dune::PDELab::AnalyticGridFunctionTraits<GV,RF,1>,ExampleAnalyticalGridFunction<GV,RF>
> >
> {
> public:
>     typedef Dune::PDELab::AnalyticGridFunctionTraits<GV,RF,1> Traits;
>     typedef Dune::PDELab::AnalyticGridFunctionBase<Traits,ExampleAnalyticalGridFunction<GV,RF>
> > B;
> 
>     ExampleAnalyticalGridFunction (const GV& gv) : B(gv) {}
> 
>     // xg is the global coordinate vector of the integration point.
>     inline void evaluateGlobal (const typename Traits::DomainType&
> xg, typename Traits::RangeType& y) const
> //    inline void evaluateGlobal (const typename
> Dune::FieldVector<double,dimworld> &xg, typename Traits::RangeType&
> y) const

This should actually be

  inline void evaluateGlobal(
    const Dune::FieldVector<typename Traits::DomainFieldType,dimworld> &xg,
    typename Traits::RangeType& y) const

>     {
>         y= 1.0;//do something
>     }
> };

Regards,
Jö.

-- 
Jorrit (Jö) Fahlke, Interdisciplinary Center for Scientific Computing,
Heidelberg University, Im Neuenheimer Feld 368, D-69120 Heidelberg
Tel: +49 6221 54 8890 Fax: +49 6221 54 8884

featured product: Debian GNU/Linux - http://www.debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <https://lists.dune-project.org/pipermail/dune-pdelab/attachments/20120905/8100d769/attachment.pgp>


More information about the dune-pdelab mailing list