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 "moments.hpp"
11#include "non_uniform_interpolation_points.hpp"
12#include "species_info.hpp"
13
17struct X
18{
22#ifdef PERIODIC_RDIMX
23 static bool constexpr PERIODIC = true;
24#else
25 static bool constexpr PERIODIC = false;
26#endif
27};
28
32struct Vx
33{
37 static bool constexpr PERIODIC = false;
38};
39
43struct T
44{
48 static bool constexpr PERIODIC = false;
49};
50
51
52using CoordT = Coord<T>;
53using CoordX = Coord<X>;
54
55using CoordVx = Coord<Vx>;
56
57using CoordXVx = Coord<X, Vx>;
58
59int constexpr BSDegreeX = 3;
60int constexpr BSDegreeVx = 3;
61
62#ifdef INPUT_MESH
63bool constexpr BsplineOnUniformCellsX = false;
64bool constexpr BsplineOnUniformCellsVx = false;
65#else
66bool constexpr BsplineOnUniformCellsX = true;
67bool constexpr BsplineOnUniformCellsVx = true;
68#endif
69
71 : std::conditional_t<
72 BsplineOnUniformCellsX,
73 ddc::UniformBSplines<X, BSDegreeX>,
74 ddc::NonUniformBSplines<X, BSDegreeX>>
75{
76};
78 : std::conditional_t<
79 BsplineOnUniformCellsVx,
80 ddc::UniformBSplines<Vx, BSDegreeVx>,
81 ddc::NonUniformBSplines<Vx, BSDegreeVx>>
82{
83};
84
85auto constexpr SplineXBoundary = X::PERIODIC ? ddc::BoundCond::PERIODIC : ddc::BoundCond::GREVILLE;
86auto constexpr SplineVxBoundary = ddc::BoundCond::HERMITE;
87
88using SplineInterpPointsX
89 = ddc::GrevilleInterpolationPoints<BSplinesX, SplineXBoundary, SplineXBoundary>;
90using SplineInterpPointsVx
91 = ddc::GrevilleInterpolationPoints<BSplinesVx, SplineVxBoundary, SplineVxBoundary>;
92
93struct GridX : SplineInterpPointsX::interpolation_discrete_dimension_type
94{
95};
96struct GridVx : SplineInterpPointsVx::interpolation_discrete_dimension_type
97{
98};
99
100using SplineXBuilder = ddc::SplineBuilder<
101 Kokkos::DefaultExecutionSpace,
102 Kokkos::DefaultExecutionSpace::memory_space,
103 BSplinesX,
104 GridX,
105 SplineXBoundary,
106 SplineXBoundary,
107 ddc::SplineSolver::LAPACK,
108 GridX,
109 GridVx>;
110using SplineXEvaluator = ddc::SplineEvaluator<
111 Kokkos::DefaultExecutionSpace,
112 Kokkos::DefaultExecutionSpace::memory_space,
113 BSplinesX,
114 GridX,
115#ifdef PERIODIC_RDIMX
116 ddc::PeriodicExtrapolationRule<X>,
117 ddc::PeriodicExtrapolationRule<X>,
118#else
119 ddc::ConstantExtrapolationRule<X>,
120 ddc::ConstantExtrapolationRule<X>,
121#endif
122 GridX,
123 GridVx>;
124using SplineVxBuilder = ddc::SplineBuilder<
125 Kokkos::DefaultExecutionSpace,
126 Kokkos::DefaultExecutionSpace::memory_space,
128 GridVx,
129 SplineVxBoundary,
130 SplineVxBoundary,
131 ddc::SplineSolver::LAPACK,
132 GridX,
133 GridVx>;
134using SplineVxEvaluator = ddc::SplineEvaluator<
135 Kokkos::DefaultExecutionSpace,
136 Kokkos::DefaultExecutionSpace::memory_space,
138 GridVx,
139 ddc::ConstantExtrapolationRule<Vx>,
140 ddc::ConstantExtrapolationRule<Vx>,
141 GridX,
142 GridVx>;
143using SplineXBuilder_1d = ddc::SplineBuilder<
144 Kokkos::DefaultExecutionSpace,
145 Kokkos::DefaultExecutionSpace::memory_space,
146 BSplinesX,
147 GridX,
148 SplineXBoundary,
149 SplineXBoundary,
150 ddc::SplineSolver::LAPACK,
151 GridX>;
152using SplineXEvaluator_1d = ddc::SplineEvaluator<
153 Kokkos::DefaultExecutionSpace,
154 Kokkos::DefaultExecutionSpace::memory_space,
155 BSplinesX,
156 GridX,
157#ifdef PERIODIC_RDIMX
158 ddc::PeriodicExtrapolationRule<X>,
159 ddc::PeriodicExtrapolationRule<X>,
160#else
161 ddc::ConstantExtrapolationRule<X>,
162 ddc::ConstantExtrapolationRule<X>,
163#endif
164 GridX>;
165using SplineVxBuilder_1d = ddc::SplineBuilder<
166 Kokkos::DefaultHostExecutionSpace,
167 Kokkos::HostSpace,
169 GridVx,
170 SplineVxBoundary,
171 SplineVxBoundary,
172 ddc::SplineSolver::LAPACK,
173 GridVx>;
174using SplineVxEvaluator_1d = ddc::SplineEvaluator<
175 Kokkos::DefaultHostExecutionSpace,
176 Kokkos::HostSpace,
178 GridVx,
179 ddc::ConstantExtrapolationRule<Vx>,
180 ddc::ConstantExtrapolationRule<Vx>,
181 GridVx>;
182
184{
185};
186
187using IdxMom = Idx<GridMom>;
188
189using IdxVx = Idx<GridVx>;
190
191using IdxX = Idx<GridX>;
192
193
194using IdxSpMom = Idx<Species, GridMom>;
195
196using IdxSpMomX = Idx<Species, GridMom, GridX>;
197
198using IdxSpX = Idx<Species, GridX>;
199
200using IdxSpVx = Idx<Species, GridVx>;
201
202using IdxSpXVx = Idx<Species, GridX, GridVx>;
203
204using IdxXVx = Idx<GridX, GridVx>;
205
206
207
208using IdxStepMom = IdxStep<GridMom>;
209
210using IdxStepVx = IdxStep<GridVx>;
211
212using IdxStepX = IdxStep<GridX>;
213
214
215using IdxStepSpMom = IdxStep<Species, GridMom>;
216
217using IdxStepSpMomX = IdxStep<Species, GridMom, GridX>;
218
219using IdxStepSpVx = IdxStep<Species, GridVx>;
220
221using IdxStepSpX = IdxStep<Species, GridX>;
222
223using IdxStepSpXVx = IdxStep<Species, GridX, GridVx>;
224
225using IdxStepXVx = IdxStep<GridX, GridVx>;
226
227
228
229using IdxRangeBSX = IdxRange<BSplinesX>;
230
231using IdxRangeBSVx = IdxRange<BSplinesVx>;
232
233
234
235using IdxRangeMom = IdxRange<GridMom>;
236
237using IdxRangeVx = IdxRange<GridVx>;
238
239using IdxRangeX = IdxRange<GridX>;
240
241using IdxRangeSpMom = IdxRange<Species, GridMom>;
242
243using IdxRangeSpMomX = IdxRange<Species, GridMom, GridX>;
244
245using IdxRangeSpVx = IdxRange<Species, GridVx>;
246
247using IdxRangeSpX = IdxRange<Species, GridX>;
248
249using IdxRangeSpXVx = IdxRange<Species, GridX, GridVx>;
250
251using IdxRangeXVx = IdxRange<GridX, GridVx>;
252
253
254template <class ElementType>
255using FieldMemVx = FieldMem<ElementType, IdxRangeVx>;
256
257template <class ElementType>
258using FieldMemX = FieldMem<ElementType, IdxRangeX>;
259
260template <class ElementType>
261using BSFieldMemX = FieldMem<ElementType, IdxRangeBSX>;
262
263
264template <class ElementType>
265using FieldMemSpMom = FieldMem<ElementType, IdxRangeSpMom>;
266
267template <class ElementType>
268using FieldMemSpMomX = FieldMem<ElementType, IdxRangeSpMomX>;
269
270template <class ElementType>
271using FieldMemSpVx = FieldMem<ElementType, IdxRangeSpVx>;
272
273template <class ElementType>
274using FieldMemSpX = FieldMem<ElementType, IdxRangeSpX>;
275
276template <class ElementType>
277using FieldMemSpXVx = FieldMem<ElementType, IdxRangeSpXVx>;
278
279
280
281using DFieldMemVx = FieldMemVx<double>;
282
283using DFieldMemX = FieldMemX<double>;
284
285using DBSFieldMemX = BSFieldMemX<double>;
286
287
288using DFieldMemSpMom = FieldMemSpMom<double>;
289
290using DFieldMemSpMomX = FieldMemSpMomX<double>;
291
292using DFieldMemSpVx = FieldMemSpVx<double>;
293
294using DFieldMemSpX = FieldMemSpX<double>;
295
296using DFieldMemSpXVx = FieldMemSpXVx<double>;
297
298
299
300template <class ElementType>
301using BSFieldX = Field<ElementType, IdxRangeBSX>;
302
303template <class ElementType>
304using FieldX = Field<ElementType, IdxRangeX>;
305
306template <class ElementType>
307using FieldVx = Field<ElementType, IdxRangeVx>;
308
309template <class ElementType>
310using FieldSpMomX = Field<ElementType, IdxRangeSpMomX>;
311
312template <class ElementType>
313using FieldSpMom = Field<ElementType, IdxRangeSpMom>;
314
315template <class ElementType>
316using FieldSpVx = Field<ElementType, IdxRangeSpVx>;
317
318template <class ElementType>
319using FieldSpX = Field<ElementType, IdxRangeSpX>;
320
321template <class ElementType>
322using FieldSpXVx = Field<ElementType, IdxRangeSpXVx>;
323
324
325using DBSFieldX = BSFieldX<double>;
326
327using DFieldVx = FieldVx<double>;
328
329using DFieldX = FieldX<double>;
330
331using DFieldSpMomX = FieldSpMomX<double>;
332
333using DFieldSpMom = FieldSpMom<double>;
334
335using DFieldSpVx = FieldSpVx<double>;
336
337using DFieldSpX = FieldSpX<double>;
338
339using DFieldSpXVx = FieldSpXVx<double>;
340
341
342template <class ElementType>
343using ConstFieldVx = Field<ElementType const, IdxRangeVx>;
344
345template <class ElementType>
346using ConstFieldX = Field<ElementType const, IdxRangeX>;
347
348
349template <class ElementType>
350using BSConstFieldX = ConstField<ElementType, IdxRangeBSX>;
351
352template <class ElementType>
353using ConstFieldSpMom = ConstField<ElementType, IdxRangeSpMom>;
354
355template <class ElementType>
356using ConstFieldSpMomX = ConstField<ElementType, IdxRangeSpMomX>;
357
358template <class ElementType>
359using ConstFieldSpMom = ConstField<ElementType, IdxRangeSpMom>;
360
361template <class ElementType>
362using ConstFieldSpVx = ConstField<ElementType, IdxRangeSpVx>;
363
364template <class ElementType>
365using ConstFieldSpX = ConstField<ElementType, IdxRangeSpX>;
366
367template <class ElementType>
368using ConstFieldSpXVx = ConstField<ElementType, IdxRangeSpXVx>;
369
370
371
372using DConstFieldVx = ConstFieldVx<double>;
373
374using DConstFieldX = ConstFieldX<double>;
375
376
377using DBSConstFieldX = BSConstFieldX<double>;
378
379using DConstFieldSpMom = ConstFieldSpMom<double>;
380
381using DConstFieldSpMomX = ConstFieldSpMomX<double>;
382
383using DConstFieldSpMom = ConstFieldSpMom<double>;
384
385using DConstFieldSpX = ConstFieldSpX<double>;
386
387using DConstFieldSpVx = ConstFieldSpVx<double>;
388
389using DConstFieldSpXVx = ConstFieldSpXVx<double>;
390
391
396{
397public:
401 template <class T>
402 using velocity_dim_for = std::conditional_t<std::is_same_v<T, GridX>, GridVx, void>;
403
407 template <class T>
408 using spatial_dim_for = std::conditional_t<std::is_same_v<T, GridVx>, GridX, void>;
409
413 using IdxRangeSpatial = IdxRangeX;
414
418 using IdxRangeVelocity = IdxRangeVx;
419
420
421 // using FdistribuIdxRange = IdxRange<DimSp, typename decltype(SpatialDDom), typename decltype(VelocityDDom)>(IdxRange());
425 using IdxRangeFdistribu = IdxRangeSpXVx;
426};
A class providing aliases for useful subindex ranges of the geometry.
Definition geometry.hpp:396
IdxRangeX IdxRangeSpatial
An alias for the spatial discrete index range type.
Definition geometry.hpp:413
std::conditional_t< std::is_same_v< T, GridX >, GridVx, void > velocity_dim_for
A templated type giving the velocity discretised dimension type associated to a spatial discretised d...
Definition geometry.hpp:402
std::conditional_t< std::is_same_v< T, GridVx >, GridX, void > spatial_dim_for
A templated type giving the spatial discretised dimension type associated to a velocity discretised d...
Definition geometry.hpp:408
IdxRangeVx IdxRangeVelocity
An alias for the velocity discrete index range type.
Definition geometry.hpp:418
IdxRangeSpXVx IdxRangeFdistribu
An alias for the whole distribution function discrete index range type.
Definition geometry.hpp:425
Moments discrete dimension to access constant attributes related to fluid moments.
Definition moments.hpp:7
Definition geometry.hpp:82
Definition geometry.hpp:75
Definition geometry.hpp:184
Definition geometry.hpp:97
Definition geometry.hpp:94
A class which describes the real space in the temporal direction.
Definition geometry.hpp:44
static bool constexpr PERIODIC
A boolean indicating if the dimension is periodic.
Definition geometry.hpp:48
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 X dimension.
Definition geometry.hpp:278
static bool constexpr PERIODIC
Define periodicity of the dimension.
Definition geometry.hpp:283