Newer
Older
/***************************************************************************
tnlNeighbourGridEntitiesStorage.h - description
-------------------
begin : Dec 18, 2015
copyright : (C) 2015 by Tomas Oberhuber
email : tomas.oberhuber@fjfi.cvut.cz
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef TNLNEIGHBOURGRIDENTITIESSTORAGE_H
#define TNLNEIGHBOURGRIDENTITIESSTORAGE_H
#include <core/tnlCuda.h>
#include <mesh/tnlDimensionsTag.h>
#include <mesh/grids/tnlNeighbourGridEntityGetter.h>
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
95
template< typename GridEntity,
int NeighbourEntityDimensions >
class tnlNeighbourGridEntityLayer
: public tnlNeighbourGridEntityLayer< GridEntity, NeighbourEntityDimensions - 1 >
{
public:
typedef tnlNeighbourGridEntityLayer< GridEntity, NeighbourEntityDimensions - 1 > BaseType;
typedef tnlNeighbourGridEntityGetter< GridEntity, NeighbourEntityDimensions > NeighbourEntityGetterType;
using BaseType::getNeighbourEntities;
__cuda_callable__
tnlNeighbourGridEntityLayer( const GridEntity& entity )
: neighbourEntities( entity ),
BaseType( entity )
{}
__cuda_callable__
const NeighbourEntityGetterType& getNeighbourEntities( const tnlDimensionsTag< NeighbourEntityDimensions>& tag ) const
{
return this->neighbourEntities;
}
__cuda_callable__
void refresh( const typename GridEntity::GridType& grid,
const typename GridEntity::GridType::IndexType& entityIndex )
{
BaseType::refresh( grid, entityIndex );
neighbourEntities.refresh( grid, entityIndex );
};
protected:
NeighbourEntityGetterType neighbourEntities;
};
template< typename GridEntity >
class tnlNeighbourGridEntityLayer< GridEntity, 0 >
{
public:
typedef tnlNeighbourGridEntityGetter< GridEntity, 0 > NeighbourEntityGetterType;
__cuda_callable__
tnlNeighbourGridEntityLayer( const GridEntity& entity )
: neighbourEntities( entity )
{}
__cuda_callable__
const NeighbourEntityGetterType& getNeighbourEntities( const tnlDimensionsTag< 0 >& tag ) const
{
return this->neighbourEntities;
}
__cuda_callable__
void refresh( const typename GridEntity::GridType& grid,
const typename GridEntity::GridType::IndexType& entityIndex )
{
neighbourEntities.refresh( grid, entityIndex );
};
protected:
NeighbourEntityGetterType neighbourEntities;
};
template< typename GridEntity >
class tnlNeighbourGridEntitiesStorage
: public tnlNeighbourGridEntityLayer< GridEntity, GridEntity::meshDimensions >
typedef tnlNeighbourGridEntityLayer< GridEntity, GridEntity::meshDimensions > BaseType;
public:
using BaseType::getNeighbourEntities;
__cuda_callable__
tnlNeighbourGridEntitiesStorage( const GridEntity& entity )
: BaseType( entity )
{}
template< int EntityDimensions >
__cuda_callable__
const tnlNeighbourGridEntityGetter< GridEntity, EntityDimensions >&
getNeighbourEntities() const
{
return BaseType::getNeighbourEntities( tnlDimensionsTag< EntityDimensions >() );
}
__cuda_callable__
void refresh( const typename GridEntity::GridType& grid,
const typename GridEntity::GridType::IndexType& entityIndex )
{
BaseType::refresh( grid, entityIndex );
};
#endif /* TNLNEIGHBOURGRIDENTIESSTORAGE_H */