Dear PDELab-ers,<br><br>I try to write a multiple species diffusion-reaction simulation.<br>I start with the code of example05 from pdelab-howto and I need to replace CompositeGridFunctionSpace of two components<br>with a PowerGridFunctionSpace of arbitrary(around 10) number of components.<br>
<br>This is the code from example05 that I want to rewrite:<br><br>// compute u_0, u_1 at integration point<br> RF u_0=0.0;<br> for (size_type i=0; i<lfsu0.size(); i++) <br> u_0 += x[lfsu0.localIndex(i)]*phi0[i]; // localIndex() maps dof within<br>
RF u_1=0.0; // leaf space to all dofs<br> for (size_type i=0; i<lfsu1.size(); i++) // within given element<br> u_1 += x[lfsu1.localIndex(i)]*phi1[i];<br>
<br>Is this the correct generalization for PowerGridFunctionSpace?<br><br> RF u[NS];<br> for(int k=0;k<NS;++k)<br> {<br> u[k]=0.0;<br> for(size_type i=0;i<n;++i)<br>
u[k]+=x[lfsu.subMap<k>(i)]*phi[i];<br> }<br><br>Is subMap() equivalent to localIndex() in this context?<br>I judge from it's description comment that it might be, but I'm not sure.<br>
<br>Otherwise I guess I could write<br><br> typedef typename LFSU::template Child<0>::Type LFSUK;<br> const LFSUK lfsuk[NS];<br> for(int i=0;i<NS;++i)<br> lfsuk[i]=lfsu.getChild(i);<br>
<br> ....<br> for(size_type i=0;i<n;++i)<br>
u[k]+=x[lfsuk[k].localIndex(i)]*phi[i];<br><br>but it looks less nice.<br><br>Another question is which mapper should I use for PowerGridFunctionSpace: <br>GridFunctionSpaceLexicographicMapper, <br>GridFunctionSpaceComponentBlockwiseMapper <br>
or GridFunctionSpaceBlockwiseMapper?<br><br><br>best regards,<br>Oleh Krehel<br><br>