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 "species_info.hpp"
11
15struct X
16{
20 static bool constexpr PERIODIC = true;
21};
22
26struct Y
27{
31 static bool constexpr PERIODIC = true;
32};
33
37struct Vx
38{
42 static bool constexpr PERIODIC = false;
43};
44
48struct Vy
49{
53 static bool constexpr PERIODIC = false;
54};
55
56using CoordX = Coord<X>;
57using CoordY = Coord<Y>;
58using CoordXY = Coord<X, Y>;
59
60using CoordVx = Coord<Vx>;
61using CoordVy = Coord<Vy>;
62
63int constexpr BSDegreeX = 3;
64int constexpr BSDegreeY = 3;
65
66int constexpr BSDegreeVx = 3;
67int constexpr BSDegreeVy = 3;
68
69bool constexpr BsplineOnUniformCellsX = true;
70bool constexpr BsplineOnUniformCellsY = true;
71
72bool constexpr BsplineOnUniformCellsVx = true;
73bool constexpr BsplineOnUniformCellsVy = true;
74
75struct BSplinesX
76 : std::conditional_t<
77 BsplineOnUniformCellsX,
78 ddc::UniformBSplines<X, BSDegreeX>,
79 ddc::NonUniformBSplines<X, BSDegreeX>>
80{
81};
82struct BSplinesY
83 : std::conditional_t<
84 BsplineOnUniformCellsY,
85 ddc::UniformBSplines<Y, BSDegreeY>,
86 ddc::NonUniformBSplines<Y, BSDegreeY>>
87{
88};
89
90struct BSplinesVx
91 : std::conditional_t<
92 BsplineOnUniformCellsVx,
93 ddc::UniformBSplines<Vx, BSDegreeVx>,
94 ddc::NonUniformBSplines<Vx, BSDegreeVx>>
95{
96};
98 : std::conditional_t<
99 BsplineOnUniformCellsVy,
100 ddc::UniformBSplines<Vy, BSDegreeVy>,
101 ddc::NonUniformBSplines<Vy, BSDegreeVy>>
102{
103};
104
105ddc::BoundCond constexpr SplineXBoundary = ddc::BoundCond::PERIODIC;
106ddc::BoundCond constexpr SplineYBoundary = ddc::BoundCond::PERIODIC;
107ddc::BoundCond constexpr SplineVxBoundary = ddc::BoundCond::HERMITE;
108ddc::BoundCond constexpr SplineVyBoundary = ddc::BoundCond::HERMITE;
109
110// IDim initialisers
111using SplineInterpPointsX
112 = ddc::GrevilleInterpolationPoints<BSplinesX, SplineXBoundary, SplineXBoundary>;
113using SplineInterpPointsY
114 = ddc::GrevilleInterpolationPoints<BSplinesY, SplineYBoundary, SplineYBoundary>;
115using SplineInterpPointsVx
116 = ddc::GrevilleInterpolationPoints<BSplinesVx, SplineVxBoundary, SplineVxBoundary>;
117using SplineInterpPointsVy
118 = ddc::GrevilleInterpolationPoints<BSplinesVy, SplineVyBoundary, SplineVyBoundary>;
119
120// IDim definition
121struct GridX : SplineInterpPointsX::interpolation_discrete_dimension_type
122{
123};
124struct GridY : SplineInterpPointsY::interpolation_discrete_dimension_type
125{
126};
127struct GridVx : SplineInterpPointsVx::interpolation_discrete_dimension_type
128{
129};
130struct GridVy : SplineInterpPointsVy::interpolation_discrete_dimension_type
131{
132};
133
134// SplineBuilder and SplineEvaluator definition
135using SplineXBuilder = ddc::SplineBuilder<
136 Kokkos::DefaultExecutionSpace,
137 Kokkos::DefaultExecutionSpace::memory_space,
138 BSplinesX,
139 GridX,
140 SplineXBoundary,
141 SplineXBoundary,
142 ddc::SplineSolver::LAPACK,
143 GridX,
144 GridY,
145 GridVx,
146 GridVy>;
147using SplineXEvaluator = ddc::SplineEvaluator<
148 Kokkos::DefaultExecutionSpace,
149 Kokkos::DefaultExecutionSpace::memory_space,
150 BSplinesX,
151 GridX,
152 ddc::PeriodicExtrapolationRule<X>,
153 ddc::PeriodicExtrapolationRule<X>,
154 GridX,
155 GridY,
156 GridVx,
157 GridVy>;
158using SplineYBuilder = ddc::SplineBuilder<
159 Kokkos::DefaultExecutionSpace,
160 Kokkos::DefaultExecutionSpace::memory_space,
161 BSplinesY,
162 GridY,
163 SplineYBoundary,
164 SplineYBoundary,
165 ddc::SplineSolver::LAPACK,
166 GridX,
167 GridY,
168 GridVx,
169 GridVy>;
170using SplineYEvaluator = ddc::SplineEvaluator<
171 Kokkos::DefaultExecutionSpace,
172 Kokkos::DefaultExecutionSpace::memory_space,
173 BSplinesY,
174 GridY,
175 ddc::PeriodicExtrapolationRule<Y>,
176 ddc::PeriodicExtrapolationRule<Y>,
177 GridX,
178 GridY,
179 GridVx,
180 GridVy>;
181using SplineVxBuilder = ddc::SplineBuilder<
182 Kokkos::DefaultExecutionSpace,
183 Kokkos::DefaultExecutionSpace::memory_space,
185 GridVx,
186 SplineVxBoundary,
187 SplineVxBoundary,
188 ddc::SplineSolver::LAPACK,
189 GridX,
190 GridY,
191 GridVx,
192 GridVy>;
193using SplineVxEvaluator = ddc::SplineEvaluator<
194 Kokkos::DefaultExecutionSpace,
195 Kokkos::DefaultExecutionSpace::memory_space,
197 GridVx,
198 ddc::ConstantExtrapolationRule<Vx>,
199 ddc::ConstantExtrapolationRule<Vx>,
200 GridX,
201 GridY,
202 GridVx,
203 GridVy>;
204using SplineVyBuilder = ddc::SplineBuilder<
205 Kokkos::DefaultExecutionSpace,
206 Kokkos::DefaultExecutionSpace::memory_space,
208 GridVy,
209 SplineVyBoundary,
210 SplineVyBoundary,
211 ddc::SplineSolver::LAPACK,
212 GridX,
213 GridY,
214 GridVx,
215 GridVy>;
216using SplineVyEvaluator = ddc::SplineEvaluator<
217 Kokkos::DefaultExecutionSpace,
218 Kokkos::DefaultExecutionSpace::memory_space,
220 GridVy,
221 ddc::ConstantExtrapolationRule<Vy>,
222 ddc::ConstantExtrapolationRule<Vy>,
223 GridX,
224 GridY,
225 GridVx,
226 GridVy>;
227
228using IdxRangeBSX = IdxRange<BSplinesX>;
229using IdxRangeBSY = IdxRange<BSplinesY>;
230using IdxRangeBSXY = IdxRange<BSplinesX, BSplinesY>;
231using IdxRangeBSVx = IdxRange<BSplinesVx>;
232using IdxRangeBSVy = IdxRange<BSplinesVy>;
233using IdxRangeBSVxVy = IdxRange<BSplinesVx, BSplinesVy>;
234
235template <class ElementType>
236using BSConstFieldXY = Field<ElementType const, IdxRangeBSXY>;
237using DBSConstFieldXY = BSConstFieldXY<double>;
238
239// Index
240using IdxX = Idx<GridX>;
241using IdxY = Idx<GridY>;
242using IdxXY = Idx<GridX, GridY>;
243using IdxVx = Idx<GridVx>;
244using IdxVy = Idx<GridVy>;
245using IdxVxVy = Idx<GridVx, GridVy>;
246using IdxXYVxVy = Idx<GridX, GridY, GridVx, GridVy>;
247using IdxSpXYVxVy = Idx<Species, GridX, GridY, GridVx, GridVy>;
248
249// IVect definition
250using IdxStepX = IdxStep<GridX>;
251using IdxStepY = IdxStep<GridY>;
252using IdxStepVx = IdxStep<GridVx>;
253using IdxStepVy = IdxStep<GridVy>;
254
255// Iindex range definition
256using IdxRangeX = IdxRange<GridX>;
257using IdxRangeY = IdxRange<GridY>;
258using IdxRangeXY = IdxRange<GridX, GridY>;
259using IdxRangeVx = IdxRange<GridVx>;
260using IdxRangeVy = IdxRange<GridVy>;
261using IdxRangeXYVxVy = IdxRange<GridX, GridY, GridVx, GridVy>;
262using IdxRangeVxVy = IdxRange<GridVx, GridVy>;
263using IdxRangeSpVxVy = IdxRange<Species, GridVx, GridVy>;
264using IdxRangeSpXYVxVy = IdxRange<Species, GridX, GridY, GridVx, GridVy>;
265
266template <class ElementType>
267using FieldMemX = FieldMem<ElementType, IdxRangeX>;
268using DFieldMemX = FieldMemX<double>;
269
270template <class ElementType>
271using FieldMemY = FieldMem<ElementType, IdxRangeY>;
272using DFieldMemY = FieldMemY<double>;
273
274template <class ElementType>
275using FieldMemXY = FieldMem<ElementType, IdxRangeXY>;
276using DFieldMemXY = FieldMemXY<double>;
277
278template <class ElementType>
279using FieldMemVx = FieldMem<ElementType, IdxRangeVx>;
280
281template <class ElementType>
282using FieldMemVy = FieldMem<ElementType, IdxRangeVy>;
283
284template <class ElementType>
285using FieldMemVxVy = FieldMem<ElementType, IdxRangeVxVy>;
286using DFieldMemVxVy = FieldMemVxVy<double>;
287
288template <class ElementType>
289using FieldMemXYVxVy = FieldMem<ElementType, IdxRangeXYVxVy>;
290using DFieldMemXYVxVy = FieldMemXYVxVy<double>;
291
292template <class ElementType>
293using FieldMemSpVxVy = FieldMem<ElementType, IdxRangeSpVxVy>;
294using DFieldMemSpVxVy = FieldMemSpVxVy<double>;
295
296template <class ElementType>
297using FieldMemSpXYVxVy = FieldMem<ElementType, IdxRangeSpXYVxVy>;
298using DFieldMemSpXYVxVy = FieldMemSpXYVxVy<double>;
299
300// Field definitions
301template <class ElementType>
302using FieldX = Field<ElementType, IdxRangeX>;
303using DFieldX = FieldX<double>;
304
305template <class ElementType>
306using FieldY = Field<ElementType, IdxRangeY>;
307using DFieldY = FieldY<double>;
308
309template <class ElementType>
310using FieldXY = Field<ElementType, IdxRangeXY>;
311using DFieldXY = FieldXY<double>;
312
313template <class ElementType>
314using FieldVx = Field<ElementType, IdxRangeVx>;
315using DFieldVx = FieldVx<double>;
316
317template <class ElementType>
318using FieldVy = Field<ElementType, IdxRangeVy>;
319using DFieldVy = FieldVy<double>;
320
321template <class ElementType>
322using FieldVxVy = Field<ElementType, IdxRangeVxVy>;
323using DFieldVxVy = FieldVxVy<double>;
324
325template <class ElementType>
326using FieldSpVxVy = Field<ElementType, IdxRangeSpVxVy>;
327using DFieldSpVxVy = FieldSpVxVy<double>;
328
329template <class ElementType>
330using FieldSpXYVxVy = Field<ElementType, IdxRangeSpXYVxVy>;
331using DFieldSpXYVxVy = FieldSpXYVxVy<double>;
332
333// ConstField definitions
334template <class ElementType>
335using ConstFieldX = Field<ElementType const, IdxRangeX>;
336
337template <class ElementType>
338using ConstFieldY = Field<ElementType const, IdxRangeY>;
339
340template <class ElementType>
341using ConstFieldXY = Field<ElementType const, IdxRangeXY>;
342using DConstFieldXY = ConstFieldXY<double>;
343
344template <class ElementType>
345using ConstFieldVx = Field<ElementType const, IdxRangeVx>;
346
347template <class ElementType>
348using ConstFieldVy = Field<ElementType const, IdxRangeVy>;
349
350template <class ElementType>
351using ConstFieldVxVy = Field<ElementType const, IdxRangeVxVy>;
352using DConstFieldVxVy = ConstFieldVxVy<double>;
353
354template <class ElementType>
355using ConstFieldSpVxVy = Field<ElementType const, IdxRangeSpVxVy>;
356using DConstFieldSpVxVy = ConstFieldSpVxVy<double>;
357
358template <class ElementType>
359using ConstFieldSpXYVxVy = Field<ElementType const, IdxRangeSpXYVxVy>;
360using DConstFieldSpXYVxVy = ConstFieldSpXYVxVy<double>;
361
367{
368public:
372 template <class T>
373 using velocity_dim_for = std::conditional_t<
374 std::is_same_v<T, GridX>,
375 GridVx,
376 std::conditional_t<std::is_same_v<T, GridY>, GridVy, void>>;
377
381 // template <class T>
382 // using spatial_dim_for = std::conditional_t<std::is_same_v<T, GridVx>, GridX, std::conditional_t<std::is_same_v<T, GridVy>, GridY, void>>;
383
387 using IdxRangeSpatial = IdxRangeXY;
388
392 using IdxRangeVelocity = IdxRangeVxVy;
393
397 using IdxRangeFdistribu = IdxRangeSpXYVxVy;
398};
A class providing aliases for useful subindex ranges of the geometry.
Definition geometry.hpp:367
IdxRangeXY IdxRangeSpatial
A templated type giving the spatial discretised dimension type associated to a velocity discretised d...
Definition geometry.hpp:387
std::conditional_t< std::is_same_v< T, GridX >, GridVx, std::conditional_t< std::is_same_v< T, GridY >, GridVy, void > > velocity_dim_for
A templated type giving the velocity discretised dimension type associated to a spatial discretised d...
Definition geometry.hpp:376
IdxRangeVxVy IdxRangeVelocity
An alias for the velocity discrete index range type.
Definition geometry.hpp:392
IdxRangeSpXYVxVy IdxRangeFdistribu
An alias for the whole distribution function discrete index range type.
Definition geometry.hpp:397
Definition geometry.hpp:82
Definition geometry.hpp:102
Definition geometry.hpp:75
Definition geometry.hpp:61
Definition geometry.hpp:97
Definition geometry.hpp:131
Definition geometry.hpp:94
Definition geometry.hpp:78
Define non periodic real X velocity dimension.
Definition geometry.hpp:301
static bool constexpr PERIODIC
Define periodicity of the dimension.
Definition geometry.hpp:306
Define non periodic real Y velocity dimension.
Definition geometry.hpp:312
static bool constexpr PERIODIC
Define periodicity of the dimension.
Definition geometry.hpp:317
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