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 template<VarType VT> struct getLocalFldType;
9 template<> struct getLocalFldType<VarType::Scalar>{ using var_type = Simd<double>; };
10 template<> struct getLocalFldType<VarType::Vector>{ using var_type = SimdVector; };
11 // The result vector is still 3D even if the input is 2D. We could potentially change this if it is less confusing/saves memory
12 template<> struct getLocalFldType<VarType::Vector2D>{ using var_type = SimdVector; };
13 
14 template<class LGFType> struct getLocalLabeledFld{
16 };
17 
18 template<class... Rest> struct LocalPackType;
19 
20 template<class... Rest> struct LocalPackType<Pack<Rest...>>{
21  using pack_type = Pack<typename getLocalLabeledFld<Rest>::labeled_type...>;
22 };
23 
24 /* Struct used at compile time to hold the template parameters needed to determine the structure of the fields */
25 template<class GFPackType> struct getLocalPackType{
26 // using pack_type = typename LocalPackType<typename GFPackType::pack_type>::pack_type;
27 // Temporary:
29 };
30 
31 // Fields at a set of points, interpolated from solved grid quantities
32 template<typename gen_pack_type>
33 struct LocalFields {
35 
37 
38  template<Label FN>
39  KOKKOS_INLINE_FUNCTION const auto& get() const{
40  return pack.template get<FN>();
41  }
42 
43  template<Label FN>
44  KOKKOS_INLINE_FUNCTION auto& get(){
45  return pack.template get<FN>();
46  }
47 };
48 
49 #endif
VarType
Definition: field.hpp:11
Definition: local_fields.hpp:25
Definition: simd.hpp:149
pack_type pack
Definition: local_fields.hpp:36
Definition: local_fields.hpp:33
Definition: local_fields.hpp:18
Definition: label.hpp:44
Definition: local_fields.hpp:14
typename LocalPackType< gen_pack_type >::pack_type pack_type
Definition: local_fields.hpp:28
Pack< typename getLocalLabeledFld< Rest >::labeled_type...> pack_type
Definition: local_fields.hpp:21
Definition: local_fields.hpp:8
typename getLocalPackType< GFPT >::pack_type pack_type
Definition: local_fields.hpp:34