[dune-pdelab] ISTLBlockVectorContainer::size() method

Oleh Krehel krehel at am.uni-erlangen.de
Fri Sep 2 10:15:03 CEST 2011


Hi,

It just seems to me that GridOperator::Traits::Domain, which is implemented
as ISTLBlockVectorContainer, represents the idea of vector of unknowns.
And the most basic operation of vector of unknowns is to see how many there are.
And it's awkward to call N() instead of size() to find out this
information(and unsafe, since
GridOperator::Traits::Domain might change to something else).
I know that GridFunctionSpace::globalSize() provides this information, but
it would be convenient if vector of unknowns class copied this method.

The situation where I need to get the size(or the some mapping, that
I mentioned in the previous email) is this:

solve_with_operator_splitting(...){

U u(...);// vector of unknowns for PowerGridFunctionSpace
U0 u0(...);// vector of unknowns for GridFunctionSpace, the child space
PDELab::interpolate(uInitial,gfs,u); // reuse from solve_fully_coupled

while(t...){// time loop
for(int i=0;i<ns;++i){ // loop over all children
   for(int j=0;j<u0.size();++j) // copy from u to u0 assuming
LexicographicOrdering
      u0[j]=u[i*u0.size()+j];

   one_step_method.apply(...,u0,...,u0new);// this is one step method
for one child

   for(int j=0;j<u0.size();++j) // copy the result back in vector for
all species
     u[i*u0.size()+j]=u0new[j];

   ...// perform reaction step here
   ...// store the result u here
}

Now functions solve_with_operator_splitting() and solve_fully_coupled() produce
the result in same structures, which is beneficial for comparison etc.

As for your comment about how the interface is what it is, I don't see
how this differs from the situation where localFiniteElement() was changed
to finiteElement().
Also note that as a user I'm not supposed to know that
GridOperator::Traits::Domain
is exactly ISTLBlockVectorContainer,
but I should be able to assume that it has a size() method and operator [].

best regards,
Oleh



2011/9/1 Christian Engwer <christian.engwer at uni-muenster.de>:
> Hi,
>
>> It appears that ISTLBlockVectorContainer has no size method,
>> although it wraps around BlockVector, which does.
>> Instead it wraps BlockVector's N() method, which does exactly the same
>> thing(currently) as size().
>> Please add the size() method to ISTLBlockVectorContainer,
>> and possibly deprecate N() method in BlockVector, unless it serves some purpose.
>
> a) the interface is what it is ;-)
> b) the size method is not exported on purpose. The
>   ISTLBlockVectorContainer should encapsulate the BlockVector, and
>   not extend it. It does provide a very different semantic. If you
>   want to access methods of the BlockVector, you can access the
>   encapsulated block vector and then call the method.
>
> Christian
>




More information about the dune-pdelab mailing list