XGC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
distribution.hpp
Go to the documentation of this file.
1 #ifndef DISTRIBUTION_HPP
2 #define DISTRIBUTION_HPP
3 
4 #include <Kokkos_Core.hpp>
5 #include "space_settings.hpp"
6 #include "globals.hpp"
7 #include "velocity_grid.hpp"
8 
9 template<class Device>
10 struct Distribution{
11 
12  // Suffix _h to distinguish the host versions
13  // Local Domain arrays
14  View<double***,CLayout, Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>> f0g_h;
15  View<double***,CLayout,Device> f0g;
16 
17  View<double*,Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>> temp_ev_h;
18  View<double*,CLayout,Device> temp_ev;
19 
20  View<double*,Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>> flow_h;
21  View<double*,CLayout,Device> flow;
22 
23  View<double*,Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>> den_h;
24  View<double*,CLayout,Device> den;
25 
26  View<double*,Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>> grid_vol_h;
27  View<double*,CLayout,Device> grid_vol;
28 
29  View<double*,Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>> grid_vol_vonly_h;
30  View<double*,CLayout,Device> grid_vol_vonly;
31 
32  View<double*,Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>> inv_grid_vol_h;
33  View<double*,CLayout,Device> inv_grid_vol;
34 
35  View<double*,Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>> n_Ta_h;
36  View<double*,CLayout,Device> n_Ta;
37 
38  // Plane Domain arrays
39  View<double*,CLayout,HostType, Kokkos::MemoryTraits<Kokkos::Unmanaged>> delta_n_h;
40  View<double*,CLayout,Device> delta_n;
41 
42  View<double*,CLayout,HostType, Kokkos::MemoryTraits<Kokkos::Unmanaged>> delta_u_h;
43  View<double*,CLayout,Device> delta_u;
44 
45  View<double*,CLayout,HostType, Kokkos::MemoryTraits<Kokkos::Unmanaged>> delta_T_h;
46  View<double*,CLayout,Device> delta_T;
47 
48  View<double*,CLayout, HostType, Kokkos::MemoryTraits<Kokkos::Unmanaged>> den_global_h;
49  View<double*,CLayout,Device> den_global;
50 
51  View<double*,CLayout, HostType, Kokkos::MemoryTraits<Kokkos::Unmanaged>> temp_global_h;
52  View<double*,CLayout,Device> temp_global;
53 
54 
56 
58  f0g = View<double***,CLayout,Device>(NoInit("f0g"), f0g_h.layout());
59  Kokkos::deep_copy(f0g, f0g_h);
60  }
61 
63  temp_ev = View<double*,CLayout,Device>(NoInit("temp_ev"), temp_ev_h.layout());
64  Kokkos::deep_copy(temp_ev, temp_ev_h);
65  }
66 
68  den = View<double*,CLayout,Device>(NoInit("den"), den_h.layout());
69  Kokkos::deep_copy(den, den_h);
70  }
71 
73  flow = View<double*,CLayout,Device>(NoInit("flow"), flow_h.layout());
74  Kokkos::deep_copy(flow, flow_h);
75  }
76 
78  grid_vol = View<double*,CLayout,Device>(NoInit("grid_vol"), grid_vol_h.layout());
79  Kokkos::deep_copy(grid_vol, grid_vol_h);
80  }
81 
83  grid_vol_vonly = View<double*,CLayout,Device>(NoInit("grid_vol_vonly"), grid_vol_vonly_h.layout());
84  Kokkos::deep_copy(grid_vol_vonly, grid_vol_vonly_h);
85  }
86 
88  inv_grid_vol = View<double*,CLayout,Device>(NoInit("inv_grid_vol"), inv_grid_vol_h.layout());
89  Kokkos::deep_copy(inv_grid_vol, inv_grid_vol_h);
90  }
91 
93  n_Ta = View<double*,CLayout,Device>(NoInit("n_Ta"), n_Ta_h.layout());
94  Kokkos::deep_copy(n_Ta, n_Ta_h);
95  }
96 
98  delta_n = View<double*,CLayout,Device>(NoInit("delta_n"), delta_n_h.layout());
99  Kokkos::deep_copy(delta_n, delta_n_h);
100  }
101 
103  delta_u = View<double*,CLayout,Device>(NoInit("delta_u"), delta_u_h.layout());
104  Kokkos::deep_copy(delta_u, delta_u_h);
105  }
106 
108  delta_T = View<double*,CLayout,Device>(NoInit("delta_T"), delta_T_h.layout());
109  Kokkos::deep_copy(delta_T, delta_T_h);
110  }
111 
113  den_global = View<double*,CLayout,Device>(NoInit("den_global"), den_global_h.layout());
114  Kokkos::deep_copy(den_global, den_global_h);
115  }
116 
118  temp_global = View<double*,CLayout,Device>(NoInit("temp_global"), temp_global_h.layout());
119  Kokkos::deep_copy(temp_global, temp_global_h);
120  }
121 
122  // Deallocates all device views (doesn't matter if they are already deallocated)
124  f0g = View<double***,CLayout,Device>();
125 
126  temp_ev = View<double*,CLayout,Device>();
127  flow = View<double*,CLayout,Device>();
128  den = View<double*,CLayout,Device>();
129  grid_vol = View<double*,CLayout,Device>();
130  grid_vol_vonly = View<double*,CLayout,Device>();
131  inv_grid_vol = View<double*,CLayout,Device>();
132  n_Ta = View<double*,CLayout,Device>();
133 
134  delta_n = View<double*,CLayout,Device>();
135  delta_u = View<double*,CLayout,Device>();
136  delta_T = View<double*,CLayout,Device>();
137 
138  den_global = View<double*,CLayout,Device>();
139  temp_global = View<double*,CLayout,Device>();
140  }
141 };
142 #endif
View< double *, CLayout, Device > den
Definition: distribution.hpp:24
void grid_vol_vonly_send_to_device()
Definition: distribution.hpp:82
void temp_ev_send_to_device()
Definition: distribution.hpp:62
View< double *, CLayout, Device > den_global
Definition: distribution.hpp:49
View< double *, CLayout, Device > temp_global
Definition: distribution.hpp:52
View< double *, CLayout, Device > grid_vol_vonly
Definition: distribution.hpp:30
void den_send_to_device()
Definition: distribution.hpp:67
View< double *, CLayout, Device > temp_ev
Definition: distribution.hpp:18
void grid_vol_send_to_device()
Definition: distribution.hpp:77
void flow_send_to_device()
Definition: distribution.hpp:72
Distribution()
Definition: distribution.hpp:55
View< double ***, CLayout, Device > f0g
Definition: distribution.hpp:15
View< double ***, CLayout, Kokkos::HostSpace, Kokkos::MemoryTraits< Kokkos::Unmanaged > > f0g_h
Definition: distribution.hpp:14
View< double *, Kokkos::HostSpace, Kokkos::MemoryTraits< Kokkos::Unmanaged > > inv_grid_vol_h
Definition: distribution.hpp:32
View< double *, Kokkos::HostSpace, Kokkos::MemoryTraits< Kokkos::Unmanaged > > den_h
Definition: distribution.hpp:23
View< double *, CLayout, Device > flow
Definition: distribution.hpp:21
View< double *, CLayout, Device > grid_vol
Definition: distribution.hpp:27
void n_Ta_send_to_device()
Definition: distribution.hpp:92
View< double *, Kokkos::HostSpace, Kokkos::MemoryTraits< Kokkos::Unmanaged > > temp_ev_h
Definition: distribution.hpp:17
View< double *, Kokkos::HostSpace, Kokkos::MemoryTraits< Kokkos::Unmanaged > > flow_h
Definition: distribution.hpp:20
View< double *, CLayout, HostType, Kokkos::MemoryTraits< Kokkos::Unmanaged > > temp_global_h
Definition: distribution.hpp:51
View< double *, CLayout, HostType, Kokkos::MemoryTraits< Kokkos::Unmanaged > > delta_n_h
Definition: distribution.hpp:39
View< double *, CLayout, HostType, Kokkos::MemoryTraits< Kokkos::Unmanaged > > den_global_h
Definition: distribution.hpp:48
View< double *, CLayout, HostType, Kokkos::MemoryTraits< Kokkos::Unmanaged > > delta_u_h
Definition: distribution.hpp:42
View< double *, CLayout, HostType, Kokkos::MemoryTraits< Kokkos::Unmanaged > > delta_T_h
Definition: distribution.hpp:45
void inv_grid_vol_send_to_device()
Definition: distribution.hpp:87
View< double *, Kokkos::HostSpace, Kokkos::MemoryTraits< Kokkos::Unmanaged > > grid_vol_vonly_h
Definition: distribution.hpp:29
View< double *, Kokkos::HostSpace, Kokkos::MemoryTraits< Kokkos::Unmanaged > > grid_vol_h
Definition: distribution.hpp:26
View< double *, CLayout, Device > delta_n
Definition: distribution.hpp:40
void den_global_send_to_device()
Definition: distribution.hpp:112
View< double *, CLayout, Device > delta_T
Definition: distribution.hpp:46
void temp_global_send_to_device()
Definition: distribution.hpp:117
void deallocate_device_views()
Definition: distribution.hpp:123
View< double *, CLayout, Device > inv_grid_vol
Definition: distribution.hpp:33
View< double *, CLayout, Device > delta_u
Definition: distribution.hpp:43
void delta_u_send_to_device()
Definition: distribution.hpp:102
void delta_n_send_to_device()
Definition: distribution.hpp:97
void delta_T_send_to_device()
Definition: distribution.hpp:107
Kokkos::ViewAllocateWithoutInitializing NoInit
Definition: space_settings.hpp:68
View< double *, Kokkos::HostSpace, Kokkos::MemoryTraits< Kokkos::Unmanaged > > n_Ta_h
Definition: distribution.hpp:35
View< double *, CLayout, Device > n_Ta
Definition: distribution.hpp:36
Definition: distribution.hpp:10
void f0g_send_to_device()
Definition: distribution.hpp:57