[dune-pdelab] PowerGridFunctionSpace localIndex()

Christian Engwer christi at uni-hd.de
Tue Mar 29 10:22:03 CEST 2011


Dear Oleh,

>         RF u[NS];
>             for(int k=0;k<NS;++k)
>             {
>                 u[k]=0.0;
>                 for(size_type i=0;i<n;++i)
>                     u[k]+=x[lfsu.subMap<k>(i)]*phi[i];
                                   ^^^^^^
>             }
> 
> Is subMap() equivalent to localIndex() in this context?
> I judge from it's description comment that it might be, but I'm not sure.

No, you have to obtain the subsapce and call the localIndex method on
the subspace.

> Otherwise I guess I could write
> 
>         typedef typename LFSU::template Child<0>::Type LFSUK;
>         const LFSUK lfsuk[NS];
>         for(int i=0;i<NS;++i)
>             lfsuk[i]=lfsu.getChild(i);
> 
>         ....
>         for(size_type i=0;i<n;++i)
>             u[k]+=x[lfsuk[k].localIndex(i)]*phi[i];
> 
> but it looks less nice.

That is correct. Regarding the elegance, in the current development
branch, we introduced some changes to eliminate the need for the
localIndex call, which will make the code more readable.

> Another question is which mapper should I use for PowerGridFunctionSpace:
> GridFunctionSpaceLexicographicMapper,
> GridFunctionSpaceComponentBlockwiseMapper
> or GridFunctionSpaceBlockwiseMapper?

As you don't know the blocksize in advance, you should use the
GridFunctionSpaceLexicographicMapper. The
GridFunctionSpaceComponentBlockwiseMapper and
GridFunctionSpaceBlockwiseMapper use static blocking patterns.

Cheers
Christian




More information about the dune-pdelab mailing list