Newer
Older
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
95
/***************************************************************************
SimpleCell.h - description
-------------------
begin : Jan 5, 2019
copyright : (C) 2019 by oberhuber
email : tomas.oberhuber@fjfi.cvut.cz
***************************************************************************/
/* See Copyright Notice in tnl/Copyright */
// Implemented by: Tomas Oberhuber
#pragma once
#include <TNL/Devices/Cuda.h>
#include <TNL/Meshes/Grid.h>
namespace TNL {
namespace Benchmarks {
namespace Traversers {
template< typename Grid >
class SimpleCell{};
template< typename Real,
typename Device,
typename Index >
class SimpleCell< Meshes::Grid< 1, Real, Device, Index > >
{
public:
using GridType = Meshes::Grid< 1, Real, Device, Index >;
using RealType = typename GridType::RealType;
using DeviceType = typename GridType::DeviceType;
using IndexType = typename GridType::IndexType;
using CoordinatesType = typename GridType::CoordinatesType;
constexpr static int getEntityDimension() { return 1; };
__cuda_callable__
SimpleCell( const GridType& grid ) :
grid( grid ){};
__cuda_callable__
const GridType& getMesh() const { return this->grid;};
__cuda_callable__
CoordinatesType& getCoordinates() { return this->coordinates; };
__cuda_callable__
void refresh() {index = coordinates.x();};
__cuda_callable__
const IndexType& getIndex() const { return this->index; };
protected:
const GridType& grid;
CoordinatesType coordinates;
IndexType index;
};
template< typename Real,
typename Device,
typename Index >
class SimpleCell< Meshes::Grid< 2, Real, Device, Index > >
{
public:
using GridType = Meshes::Grid< 1, Real, Device, Index >;
using RealType = typename GridType::RealType;
using DeviceType = typename GridType::DeviceType;
using IndexType = typename GridType::IndexType;
using CoordinatesType = typename GridType::CoordinatesType;
constexpr static int getEntityDimension() { return 2; };
};
template< typename Real,
typename Device,
typename Index >
class SimpleCell< Meshes::Grid< 3, Real, Device, Index > >
{
public:
using GridType = Meshes::Grid< 1, Real, Device, Index >;
using RealType = typename GridType::RealType;
using DeviceType = typename GridType::DeviceType;
using IndexType = typename GridType::IndexType;
using CoordinatesType = typename GridType::CoordinatesType;
constexpr static int getEntityDimension() { return 3; };
};
} // namespace Traversers
} // namespace Benchmarks
} // namespace TNL