/usr/include/dune/grid/geometrygrid/datahandle.hh is in libdune-grid-dev 2.4.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_GEOGRID_DATAHANDLE_HH
#define DUNE_GEOGRID_DATAHANDLE_HH
#include <dune/common/typetraits.hh>
#include <dune/grid/common/datahandleif.hh>
#include <dune/grid/common/grid.hh>
#include <dune/grid/geometrygrid/capabilities.hh>
#include <dune/grid/geometrygrid/entity.hh>
namespace Dune
{
namespace GeoGrid
{
// GeometryGridDataHandle
// ----------------------
template< class Grid, class WrappedHandle >
class CommDataHandle
: public CommDataHandleIF< CommDataHandle< Grid, WrappedHandle >, typename WrappedHandle::DataType >
{
typedef typename remove_const< Grid >::type::Traits Traits;
public:
CommDataHandle ( const Grid &grid, WrappedHandle &handle )
: grid_( grid ),
wrappedHandle_( handle )
{}
bool contains ( int dim, int codim ) const
{
const bool contains = wrappedHandle_.contains( dim, codim );
if( contains )
assertHostEntity( dim, codim );
return contains;
}
bool fixedsize ( int dim, int codim ) const
{
return wrappedHandle_.fixedsize( dim, codim );
}
template< class HostEntity >
size_t size ( const HostEntity &hostEntity ) const
{
typedef typename Grid::Traits::template Codim< HostEntity::codimension >::Entity Entity;
typedef typename Grid::Traits::template Codim< HostEntity::codimension >::EntityImpl EntityImpl;
Entity entity( EntityImpl( grid_, hostEntity ) );
return wrappedHandle_.size( entity );
}
template< class MessageBuffer, class HostEntity >
void gather ( MessageBuffer &buffer, const HostEntity &hostEntity ) const
{
typedef typename Grid::Traits::template Codim< HostEntity::codimension >::Entity Entity;
typedef typename Grid::Traits::template Codim< HostEntity::codimension >::EntityImpl EntityImpl;
Entity entity( EntityImpl( grid_, hostEntity ) );
wrappedHandle_.gather( buffer, entity );
}
template< class MessageBuffer, class HostEntity >
void scatter ( MessageBuffer &buffer, const HostEntity &hostEntity, size_t size )
{
typedef typename Grid::Traits::template Codim< HostEntity::codimension >::Entity Entity;
typedef typename Grid::Traits::template Codim< HostEntity::codimension >::EntityImpl EntityImpl;
Entity entity( EntityImpl( grid_, hostEntity ) );
wrappedHandle_.scatter( buffer, entity, size );
}
private:
static void assertHostEntity ( int dim, int codim )
{
if( !Capabilities::CodimCache< Grid >::hasHostEntity( codim ) )
noEntity( codim );
}
static void noEntity ( int codim )
{
DUNE_THROW( NotImplemented, "Host grid has no entities for codimension " << codim << "." );
}
const Grid &grid_;
WrappedHandle &wrappedHandle_;
};
} // namespace GeoGrid
} // namespace Dune
#endif // #ifndef DUNE_GEOGRID_DATAHANDLE_HH
|