XGC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
local_fields.hpp
Go to the documentation of this file.
1 #ifndef LOCAL_FIELDS_HPP
2 #define LOCAL_FIELDS_HPP
3 
4 #include "globals.hpp"
5 #include "pack.hpp"
6 #include "grid_field.hpp"
7 
8 
9 template<VarType VT> struct getLocalFldType;
10 template<> struct getLocalFldType<VarType::Scalar>{ using var_type = Simd<double>; };
11 template<> struct getLocalFldType<VarType::Vector>{ using var_type = SimdVector; };
12 // The result vector is still 3D even if the input is 2D. We could potentially change this if it is less confusing/saves memory
13 template<> struct getLocalFldType<VarType::Vector2D>{ using var_type = SimdVector; };
14 
15 template<class LGFType> struct getLocalLabeledFld{
17 };
18 
19 template<class... Rest> struct LocalPackType;
20 
21 template<class... Rest> struct LocalPackType<Pack<Rest...>>{
22  using pack_type = Pack<typename getLocalLabeledFld<Rest>::labeled_type...>;
23 };
24 
25 /* Struct used at compile time to hold the template parameters needed to determine the structure of the fields */
26 template<class GFPackType> struct getLocalPackType{
27 // using pack_type = typename LocalPackType<typename GFPackType::pack_type>::pack_type;
28 // Temporary:
30 };
31 
32 // Fields at a set of points, interpolated from solved grid quantities
33 struct LocalFields {
34 #ifdef XGC1
35  // Temporarily here to make PR simpler:
36 # ifdef EXPLICIT_EM
37  using gfpack_type = Pack<Labeled<EfieldType, Label::E>,
43 # else
44 # ifdef DELTAF_CONV
45  using gfpack_type = Pack<Labeled<EfieldType, Label::E>,
48 # else
49  using gfpack_type = Pack<Labeled<EfieldType, Label::E>>;
50 # endif
51 # endif
52 #else
53 # ifdef SONIC_GK
54  using gfpack_type = Pack<Labeled<EfieldType, Label::E>,
58 # else
59  using gfpack_type = Pack<Labeled<EfieldType, Label::E>>;
60 # endif
61 #endif
62  //
63 
65 
67 
68  template<Label FN>
69  KOKKOS_INLINE_FUNCTION const auto& get() const{
70  return pack.template get<FN>();
71  }
72 
73  template<Label FN>
74  KOKKOS_INLINE_FUNCTION auto& get(){
75  return pack.template get<FN>();
76  }
77 };
78 
79 #endif
VarType
Definition: field.hpp:11
Definition: local_fields.hpp:26
Pack< Labeled< EfieldType, Label::E >> gfpack_type
Definition: local_fields.hpp:49
Definition: simd.hpp:149
pack_type pack
Definition: local_fields.hpp:66
typename getLocalPackType< gfpack_type >::pack_type pack_type
Definition: local_fields.hpp:64
Definition: local_fields.hpp:33
Definition: local_fields.hpp:19
Definition: label.hpp:44
Definition: local_fields.hpp:15
typename LocalPackType< gfpack_type >::pack_type pack_type
Definition: local_fields.hpp:29
Pack< typename getLocalLabeledFld< Rest >::labeled_type...> pack_type
Definition: local_fields.hpp:22
Definition: local_fields.hpp:9