[Dune] Communicating IdSet elements

Jö Fahlke jorrit at jorrit.de
Tue Jul 26 13:31:51 CEST 2011


Am Tue, 26. Jul 2011, 10:55:40 +0200 schrieb Patrick Leidenberger:
> In my code I use this for some data attached to the grid, that
> should be re-distributed after a loadbalance step.

The Dune way™ would be to write a datahandle that does the communication and
pass that datahandle to the loadbalace() method of the grid.  Using global ids
to do the association of data and entities yourself is probably much slower.

With ALUGrid the is a small pitfall however: alugrid provides two
loadBalance(dataHandle) methods, one for Dune-datahandles, and one for
ALUGrid-native datahandles.  These two datahandles have a somewhat different
interface.  The methods are declared like

  // ALU-specific datahandle
  template<class DataHandle>
  bool loadBalance(DataHandle &data);

  // Dune datahandle
  template<class DataHandleImpl, class Data>
  bool loadBalance(CommDataHandleIF<DataHandleImpl, Data> &dataHandle);

This means that if you have a Dune data handle like

  template<class Grid>
  class RedistributeDataHandle :
    public Dune::CommDataHandleIF<RedistributeDataHandle<Grid>, int>
  { ... };

you need to cast it to it's base class when calling loadBalance():

  typedef RedistributeDataHandle<Grid> DataHandle;
  DataHandle dh(*gridp, elementTagMap);
  gridp->loadBalance(static_cast<Dune::CommDataHandleIF<DataHandle, int>&>(dh));

Otherwise the compiler will assume it is an ALU-specific datahandle and will
probably complain.  See
<https://svn.dune-project.org/svn/dune-grid/trunk/src/gmsh-to-alu/main.hh> for
an example.

Bye,
Jö.

-- 
A mathematician is a device to turn coffee into theorems.
-- Paul Erdös
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20110726/d51e7cbc/attachment.sig>


More information about the Dune mailing list