Gyselalib++
 
Loading...
Searching...
No Matches
geometry.hpp
1// SPDX-License-Identifier: MIT
2
3#pragma once
4#include <ddc/ddc.hpp>
5#include <ddc/kernels/splines.hpp>
6
7#include "ddc_alias_inline_functions.hpp"
8#include "ddc_aliases.hpp"
9#include "ddc_helper.hpp"
10#include "directional_tag.hpp"
11#include "vector_field.hpp"
12#include "vector_field_mem.hpp"
13
14
15
19struct X
20{
24 static bool constexpr PERIODIC = true;
25};
26
30struct Y
31{
35 static bool constexpr PERIODIC = true;
36};
37
38
39using CoordX = Coord<X>;
40using CoordY = Coord<Y>;
41using CoordXY = Coord<X, Y>;
42
43int constexpr BSDegreeX = 3;
44int constexpr BSDegreeY = 3;
45
46bool constexpr BsplineOnUniformCellsX = true;
47bool constexpr BsplineOnUniformCellsY = true;
48
49struct BSplinesX
50 : std::conditional_t<
51 BsplineOnUniformCellsX,
52 ddc::UniformBSplines<X, BSDegreeX>,
53 ddc::NonUniformBSplines<X, BSDegreeX>>
54{
55};
57 : std::conditional_t<
58 BsplineOnUniformCellsY,
59 ddc::UniformBSplines<Y, BSDegreeY>,
60 ddc::NonUniformBSplines<Y, BSDegreeY>>
61{
62};
63
64ddc::BoundCond constexpr SplineXBoundary = ddc::BoundCond::PERIODIC;
65ddc::BoundCond constexpr SplineYBoundary = ddc::BoundCond::PERIODIC;
66
67// IDim initialisers
68using SplineInterpPointsX
69 = ddc::GrevilleInterpolationPoints<BSplinesX, SplineXBoundary, SplineXBoundary>;
70using SplineInterpPointsY
71 = ddc::GrevilleInterpolationPoints<BSplinesY, SplineYBoundary, SplineYBoundary>;
72
73// IDim definitions
74struct GridX : SplineInterpPointsX::interpolation_discrete_dimension_type
75{
76};
77struct GridY : SplineInterpPointsY::interpolation_discrete_dimension_type
78{
79};
80
81
82// SplineBuilder and SplineEvaluator definitions
83using SplineXBuilder_XY = ddc::SplineBuilder<
84 Kokkos::DefaultExecutionSpace,
85 Kokkos::DefaultExecutionSpace::memory_space,
87 GridX,
88 SplineXBoundary,
89 SplineXBoundary,
90 ddc::SplineSolver::LAPACK,
91 GridX,
92 GridY>;
93using SplineXEvaluator_XY = ddc::SplineEvaluator<
94 Kokkos::DefaultExecutionSpace,
95 Kokkos::DefaultExecutionSpace::memory_space,
97 GridX,
98 ddc::PeriodicExtrapolationRule<X>,
99 ddc::PeriodicExtrapolationRule<X>,
100 GridX,
101 GridY>;
102
103
104using SplineYBuilder_XY = ddc::SplineBuilder<
105 Kokkos::DefaultExecutionSpace,
106 Kokkos::DefaultExecutionSpace::memory_space,
107 BSplinesY,
108 GridY,
109 SplineYBoundary,
110 SplineYBoundary,
111 ddc::SplineSolver::LAPACK,
112 GridX,
113 GridY>;
114using SplineYEvaluator_XY = ddc::SplineEvaluator<
115 Kokkos::DefaultExecutionSpace,
116 Kokkos::DefaultExecutionSpace::memory_space,
117 BSplinesY,
118 GridY,
119 ddc::PeriodicExtrapolationRule<Y>,
120 ddc::PeriodicExtrapolationRule<Y>,
121 GridX,
122 GridY>;
123
124// Spline index range
125using IdxRangeBSX = IdxRange<BSplinesX>;
126using IdxRangeBSY = IdxRange<BSplinesY>;
127using IdxRangeBSXY = IdxRange<BSplinesX, BSplinesY>;
128
129template <class ElementType>
130using BSConstFieldXY = Field<ElementType const, IdxRangeBSXY>;
131using DBSConstFieldXY = BSConstFieldXY<double>;
132
133// Index definitions
134using IdxX = Idx<GridX>;
135using IdxY = Idx<GridY>;
136using IdxXY = Idx<GridX, GridY>;
137
138// Index Step definitions
139using IdxStepX = IdxStep<GridX>;
140using IdxStepY = IdxStep<GridY>;
141
142// Index Range definitions
143using IdxRangeX = IdxRange<GridX>;
144using IdxRangeY = IdxRange<GridY>;
145using IdxRangeXY = IdxRange<GridX, GridY>;
146
147
148// Field definitions
149template <class ElementType>
150using FieldMemX = FieldMem<ElementType, IdxRangeX>;
151using DFieldMemX = FieldMemX<double>;
152
153template <class ElementType>
154using FieldMemY = FieldMem<ElementType, IdxRangeY>;
155using DFieldMemY = FieldMemY<double>;
156
157template <class ElementType>
158using FieldMemXY = FieldMem<ElementType, IdxRangeXY>;
159using DFieldMemXY = FieldMemXY<double>;
160
161
162// Field definitions
163template <class ElementType>
164using FieldX = Field<ElementType, IdxRangeX>;
165using DFieldX = FieldX<double>;
166
167template <class ElementType>
168using FieldY = Field<ElementType, IdxRangeY>;
169using DFieldY = FieldY<double>;
170
171template <class ElementType>
172using FieldXY = Field<ElementType, IdxRangeXY>;
173using DFieldXY = FieldXY<double>;
174
175
176// ConstField definitions
177template <class ElementType>
178using ConstFieldX = Field<ElementType const, IdxRangeX>;
179
180template <class ElementType>
181using ConstFieldY = Field<ElementType const, IdxRangeY>;
182
183template <class ElementType>
184using ConstFieldXY = Field<ElementType const, IdxRangeXY>;
185using DConstFieldXY = ConstFieldXY<double>;
186
187
188// VectorFieldMem aliases
189// Represent a vector field (v_x, v_y) on indices (x_i, y_j) : (v_x(x_i, y_j), v_y(x_i,y_j))
191 double,
192 IdxRangeXY,
193 NDTag<X, Y>,
194 Kokkos::DefaultExecutionSpace::memory_space>;
195using VectorFieldXY_XY = typename VectorFieldMemXY_XY::span_type;
196using VectorConstFieldXY_XY = typename VectorFieldMemXY_XY::view_type;
Pre-declaration of VectorFieldMem.
Definition vector_field_mem.hpp:54
VectorField< const ElementType, IdxRangeType, NDTag, MemSpace, Kokkos::layout_right > view_type
A type which can hold a constant reference to this VectorFieldMem.
Definition vector_field_mem.hpp:94
VectorField< ElementType, IdxRangeType, NDTag, MemSpace, Kokkos::layout_right > span_type
A type which can hold a reference to this VectorFieldMem.
Definition vector_field_mem.hpp:86
Definition geometry.hpp:75
Definition geometry.hpp:61
Definition geometry.hpp:94
Definition geometry.hpp:78
Define non periodic real X dimension.
Definition geometry.hpp:278
static bool constexpr PERIODIC
Define periodicity of the dimension.
Definition geometry.hpp:283
Define non periodic real Y dimension.
Definition geometry.hpp:289
static bool constexpr PERIODIC
Define periodicity of the dimension.
Definition geometry.hpp:294