[Dune] Working with buffer in CommDataHandleIF ?

Markus Blatt Markus.Blatt at iwr.uni-heidelberg.de
Wed May 12 14:09:59 CEST 2010


Hi,

On Wed, May 12, 2010 at 12:32:45PM +0200, Benedikt Oswald wrote:
> Dear Dune, I have a question related to the CommDataHandleIF:
> 
> If I use the MessageBuffer like a vector, i.e. like this:
> 
> MessageBuffer& buff 
> 
> for(unsigned int dof=0;dof<ndof;++dof)
> {
> DataType x = v_[dofmapper_.template global<CODIM>(indexset_.index
> (entity),dof)];
> buff.write(x);
> }
> 
> 
> I also read it on the receiving side like this:
> 
> for(unsigned int dof=0;dof<ndof;++dof)
> {
> DataType x;
> buff.read(x);
> v_[dofmapper_.template global<CODIM>(indexset_.index(entity),dof)] += x;
> }
> 

you do not actively read or write to and from the buffer, but the
grid's communicate methods tells your data handle object for which
entities it needs data (method gather of data handel) and for which entities it
received data (method scatter of your data handle).

Therefore the things you do in your loops should be moved to the
correct methods.

Further information can be found in the grid howto
<http://www.dune-project.org/doc/grid-howto/grid-howtoch9.html#x18-770009.2>

Cheers,

Markus





More information about the Dune mailing list