[dune-pdelab] PowerGridFunctionSpace localIndex()
Oleh Krehel
krehel at am.uni-erlangen.de
Mon Mar 28 12:28:22 CEST 2011
Dear PDELab-ers,
I try to write a multiple species diffusion-reaction simulation.
I start with the code of example05 from pdelab-howto and I need to replace
CompositeGridFunctionSpace of two components
with a PowerGridFunctionSpace of arbitrary(around 10) number of components.
This is the code from example05 that I want to rewrite:
// compute u_0, u_1 at integration point
RF u_0=0.0;
for (size_type i=0; i<lfsu0.size(); i++)
u_0 += x[lfsu0.localIndex(i)]*phi0[i]; // localIndex()
maps dof within
RF u_1=0.0; // leaf
space to all dofs
for (size_type i=0; i<lfsu1.size(); i++) // within
given element
u_1 += x[lfsu1.localIndex(i)]*phi1[i];
Is this the correct generalization for PowerGridFunctionSpace?
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.
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.
Another question is which mapper should I use for PowerGridFunctionSpace:
GridFunctionSpaceLexicographicMapper,
GridFunctionSpaceComponentBlockwiseMapper
or GridFunctionSpaceBlockwiseMapper?
best regards,
Oleh Krehel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune-pdelab/attachments/20110328/a8293a43/attachment.htm>
More information about the dune-pdelab
mailing list