-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMeshFramework.hh
66 lines (52 loc) · 1.5 KB
/
MeshFramework.hh
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
#ifndef _MESHFRAMEWORK_HH_
#define _MESHFRAMEWORK_HH_
#include "MeshDefs.hh"
struct MeshAlgorithms{
template<class Mesh_type>
KOKKOS_INLINE_FUNCTION
static cPoint_View getCellCoordinates(const Mesh_type& mesh, const Entity_ID c)
{
cEntity_ID_View nodes = mesh.getCellNodes(c);
Point_View coords;
Kokkos::resize(coords,nodes.size());
for (int n = 0; n < nodes.size(); ++n) {
coords[n] = mesh.getNodeCoordinate(nodes[n]);
}
return coords;
}
// Fake implementation
template<class Mesh_type>
KOKKOS_INLINE_FUNCTION static Entity_ID_List
computeCellNodes(const Mesh_type& mesh, const Entity_ID c)
{
Entity_ID_List nodes;
const int nnodes = 2;
// Warning __host__ function on __device__
nodes.resize(nnodes);
for(int i = 0 ; i < nnodes ; ++i){
nodes[i] = c*2+i;
}
return nodes;
}
};
struct MeshFramework {
KOKKOS_INLINE_FUNCTION void getCellNodes(const Entity_ID c, cEntity_ID_View& nodes) const
{
auto v = MeshAlgorithms::computeCellNodes(*this, c);
nodes = VectorToView(v);
}
KOKKOS_INLINE_FUNCTION void getCellFaces(
const Entity_ID c,
cEntity_ID_View& faces) const {
getCellFacesAndDirs(c, faces, nullptr);
}
KOKKOS_INLINE_FUNCTION void getCellFacesAndDirs(
const Entity_ID c,
cEntity_ID_View& faces,
cEntity_Direction_View * const dirs) const {
}
KOKKOS_INLINE_FUNCTION Coordinates getNodeCoordinate(const Entity_ID node) const {
return {1.,1.,1.};
}
}; // MeshFramework
#endif