dune-grid
2.11
Toggle main menu visibility
Loading...
Searching...
No Matches
dune
grid
geometrygrid
geometrygrid/datahandle.hh
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
2
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4
// vi: set et ts=4 sw=2 sts=2:
5
#ifndef DUNE_GEOGRID_DATAHANDLE_HH
6
#define DUNE_GEOGRID_DATAHANDLE_HH
7
8
#include <dune/common/typetraits.hh>
9
10
#include <
dune/grid/common/datahandleif.hh
>
11
#include <
dune/grid/common/grid.hh
>
12
#include <
dune/grid/geometrygrid/capabilities.hh
>
13
#include <
dune/grid/geometrygrid/entity.hh
>
14
15
namespace
Dune
16
{
17
18
namespace
GeoGrid
19
{
20
21
// GeometryGridDataHandle
22
// ----------------------
23
24
template
<
class
Gr
id
,
class
WrappedHandle >
25
class
CommDataHandle
26
:
public
CommDataHandleIF
< CommDataHandle< Grid, WrappedHandle >, typename WrappedHandle::DataType >
27
{
28
typedef
typename
std::remove_const< Grid >::type::Traits Traits;
29
30
public
:
31
CommDataHandle
(
const
Grid
&grid, WrappedHandle &handle )
32
: grid_( grid ),
33
wrappedHandle_( handle )
34
{}
35
36
bool
contains
(
int
dim,
int
codim )
const
37
{
38
const
bool
contains
= wrappedHandle_.contains( dim, codim );
39
if
(
contains
)
40
assertHostEntity( dim, codim );
41
return
contains
;
42
}
43
44
bool
fixedSize
(
int
dim,
int
codim )
const
45
{
46
return
wrappedHandle_.fixedSize( dim, codim );
47
}
48
49
template
<
class
HostEntity >
50
size_t
size
(
const
HostEntity &hostEntity )
const
51
{
52
typedef
typename
Grid::Traits::template Codim< HostEntity::codimension >::Entity
Entity
;
53
typedef
typename
Grid::Traits::template Codim< HostEntity::codimension >::EntityImpl EntityImpl;
54
Entity
entity( EntityImpl( grid_, hostEntity ) );
55
return
wrappedHandle_.size( entity );
56
}
57
58
template
<
class
MessageBuffer,
class
HostEntity >
59
void
gather
( MessageBuffer &buffer,
const
HostEntity &hostEntity )
const
60
{
61
typedef
typename
Grid::Traits::template Codim< HostEntity::codimension >::Entity
Entity
;
62
typedef
typename
Grid::Traits::template Codim< HostEntity::codimension >::EntityImpl EntityImpl;
63
Entity
entity( EntityImpl( grid_, hostEntity ) );
64
wrappedHandle_.gather( buffer, entity );
65
}
66
67
template
<
class
MessageBuffer,
class
HostEntity >
68
void
scatter
( MessageBuffer &buffer,
const
HostEntity &hostEntity,
size_t
size_ )
69
{
70
typedef
typename
Grid::Traits::template Codim< HostEntity::codimension >::Entity
Entity
;
71
typedef
typename
Grid::Traits::template Codim< HostEntity::codimension >::EntityImpl EntityImpl;
72
Entity
entity( EntityImpl( grid_, hostEntity ) );
73
wrappedHandle_.scatter( buffer, entity, size_ );
74
}
75
76
private
:
77
static
void
assertHostEntity (
int
,
int
codim )
78
{
79
if
( !
Capabilities::CodimCache< Grid >::hasHostEntity
( codim ) )
80
DUNE_THROW( NotImplemented,
"Host grid has no entities for codimension "
<< codim <<
"."
);
81
}
82
83
const
Grid
&grid_;
84
WrappedHandle &wrappedHandle_;
85
};
86
87
}
// namespace GeoGrid
88
89
}
// namespace Dune
90
91
#endif
// #ifndef DUNE_GEOGRID_DATAHANDLE_HH
datahandleif.hh
Describes the parallel communication interface class for MessageBuffers and DataHandles.
Dune
Include standard header files.
Definition
agrid.hh:60
Dune::GeoGrid
namespace containing the implementations of GeometryGrid
Definition
geometrygrid/backuprestore.hh:20
Dune::CommDataHandleIF< CommDataHandle< Grid, WrappedHandle >, WrappedHandle::DataType >::CommDataHandleIF
CommDataHandleIF()
Definition
datahandleif.hh:86
Dune::Grid
Grid abstract base class.
Definition
common/grid.hh:375
Dune::Capabilities::CodimCache::hasHostEntity
static bool hasHostEntity(int codim)
Definition
geometrygrid/capabilities.hh:134
Dune::GeoGrid::CommDataHandle::fixedSize
bool fixedSize(int dim, int codim) const
Definition
geometrygrid/datahandle.hh:44
Dune::GeoGrid::CommDataHandle::contains
bool contains(int dim, int codim) const
Definition
geometrygrid/datahandle.hh:36
Dune::GeoGrid::CommDataHandle::size
size_t size(const HostEntity &hostEntity) const
Definition
geometrygrid/datahandle.hh:50
Dune::GeoGrid::CommDataHandle::CommDataHandle
CommDataHandle(const Grid &grid, WrappedHandle &handle)
Definition
geometrygrid/datahandle.hh:31
Dune::GeoGrid::CommDataHandle::gather
void gather(MessageBuffer &buffer, const HostEntity &hostEntity) const
Definition
geometrygrid/datahandle.hh:59
Dune::GeoGrid::CommDataHandle::scatter
void scatter(MessageBuffer &buffer, const HostEntity &hostEntity, size_t size_)
Definition
geometrygrid/datahandle.hh:68
Dune::GeoGrid::Entity
DUNE-conform implementation of the entity.
Definition
geometrygrid/entity.hh:694
capabilities.hh
entity.hh
grid.hh
Different resources needed by all grid implementations.
Generated by
1.17.0