1#ifndef DUNE_SPGRID_CHECKIDCOMMUNICATION_HH
2#define DUNE_SPGRID_CHECKIDCOMMUNICATION_HH
4#include <dune/common/hybridutilities.hh>
6#include <dune/geometry/dimension.hh>
9#include <dune/grid/common/gridview.hh>
15 struct CheckIdCommunicationDataHandle;
18 template< InterfaceType iftype,
class VT >
19 inline void checkIdCommunication (
const GridView< VT > &gridView )
21 std::cout <<
"Checking communication ids for " << iftype <<
"..." << std::endl;
22 CheckIdCommunicationDataHandle< VT > handle( gridView );
28 inline void checkIdCommunication (
const GridView< VT > &gridView )
30 checkIdCommunication< InteriorBorder_InteriorBorder_Interface >( gridView );
31 checkIdCommunication< InteriorBorder_All_Interface >( gridView );
32 checkIdCommunication< Overlap_OverlapFront_Interface >( gridView );
33 checkIdCommunication< Overlap_All_Interface >( gridView );
34 checkIdCommunication< All_All_Interface >( gridView );
39 struct CheckIdCommunicationDataHandle
40 :
public CommDataHandleIF< CheckIdCommunicationDataHandle< VT >, typename GridView< VT >::Grid::GlobalIdSet::IdType >
48 typedef typename GlobalIdSet::IdType IdType;
50 explicit CheckIdCommunicationDataHandle (
const GridView &gridView )
51 : rank_( gridView.grid().comm().rank() ),
52 idSet_( gridView.grid().globalIdSet() )
54 Hybrid::forEach( std::make_integer_sequence< int, dimension+1 >(), [
this ] (
auto codim ) {
59 bool contains (
int const dim,
const int codim )
const
61 return ((codim >= 0) && (codim <= dimension) ? contains_[ codim ] :
false);
64 bool fixedSize (
const int dim,
const int codim )
const
69 template<
class Entity >
70 size_t size (
const Entity &entity )
const
75 template<
class Buffer,
class Entity >
76 void gather ( Buffer &buffer,
const Entity &entity )
const
78 buffer.write( idSet_.id( entity ) );
81 template<
class Buffer,
class Entity >
82 void scatter ( Buffer &buffer,
const Entity &entity,
size_t n )
87 if(
id != idSet_.id( entity ) )
89 std::cerr <<
"[ " << rank_ <<
" ] Error: receive data from entity " <<
id
90 <<
" on entity " << idSet_.id( entity ) <<
"." << std::endl;
96 const GlobalIdSet &idSet_;
97 bool contains_[ dimension+1 ];
void scatter(MessageBufferImp &buff, const EntityType &e, size_t n)
unpack data from message buffer to user.
Definition: datahandleif.hh:207
size_t size(const EntityType &e) const
how many objects of type DataType have to be sent for a given entity
Definition: datahandleif.hh:182
void gather(MessageBufferImp &buff, const EntityType &e) const
pack data from user to message buffer
Definition: datahandleif.hh:193
static constexpr int codimension
Know your own codimension.
Definition: entity.hh:106
Grid view abstract base class.
Definition: gridview.hh:66
GridFamily::Traits::GlobalIdSet GlobalIdSet
A type that is a model of Dune::IdSet which provides a unique and persistent numbering for all entiti...
Definition: grid.hh:502
A set of traits classes to store static information about grid implementation.
Traits::Grid Grid
type of the grid
Definition: gridview.hh:83
static constexpr int dimension
The dimension of the grid.
Definition: gridview.hh:148
constexpr void forEach(Range &&range, F &&f)
Range based for loop.
Definition: hybridutilities.hh:268
Dune namespace.
Definition: alignedallocator.hh:13
specialize with 'true' for all codims that a grid can communicate data on (default=false)
Definition: capabilities.hh:97
std::size_t fixedSize
The number of data items per index if it is fixed, 0 otherwise.
Definition: variablesizecommunicator.hh:265