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

Markus Blatt Markus.Blatt at iwr.uni-heidelberg.de
Fri Sep 2 10:35:40 CEST 2011


Hi,

On Fri, Sep 02, 2011 at 10:15:03AM +0200, Oleh Krehel wrote:
> 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).


This is exactly why it is not there and not called size().
size() gives you the size of the container, which for the blockvector
is the number of blocks and not the number of unknowns (like you assume).
Depending on how you initialize the backend these might be different.

In the future there might be other backends that do not support
blocking. Code written for them (or for scalar block) won't work for
real blocks then. This is what I consider unsafe.

Giving access to the underlying containers is a kind of compromise we
make, because this is pretty much needed for backend coding. But
whenever you access the underlying container in the describe way all
alarm bells should ring in your head as it is potentially dangerous.

Cheers,

Markus




More information about the dune-pdelab mailing list