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"
9 
10 template<class Device>
11 struct Distribution{
12 
13  // Suffix _h to distinguish the host versions
14  // Local Domain arrays
15  View<double***,CLayout, Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>> f0g_h;
16  View<double***,CLayout,Device> f0g;
17 
18  View<double*,Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>> fg_temp_ev_h;
19  View<double*,CLayout,Device> fg_temp_ev;
20 
21  View<double*,Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>> fg_flow_h;
22  View<double*,CLayout,Device> fg_flow;
23 
24  View<double*,Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>> fg_vth_inv_h;
25  View<double*,CLayout,Device> fg_vth_inv;
26 
27 
28  View<double*,Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>> grid_vol_h;
29  View<double*,CLayout,Device> grid_vol;
30 
31  View<double*,Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>> grid_vol_vonly_h;
32  View<double*,CLayout,Device> grid_vol_vonly;
33 
34  View<double*,Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>> inv_grid_vol_h;
35  View<double*,CLayout,Device> inv_grid_vol;
36 
37  // following strucutre variables are related to f_Maxwellian
38  View<double*,Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>> temp_ev_h;
39  View<double*,CLayout,Device> temp_ev;
40 
41  View<double*,Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>> flow_h;
42  View<double*,CLayout,Device> flow;
43 
44  View<double*,Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>> den_h;
45  View<double*,CLayout,Device> den;
46 
47  // Plane Domain arrays
48  View<double*,CLayout,HostType, Kokkos::MemoryTraits<Kokkos::Unmanaged>> delta_n_h;
49  View<double*,CLayout,Device> delta_n;
50 
51  View<double*,CLayout,HostType, Kokkos::MemoryTraits<Kokkos::Unmanaged>> delta_u_h;
52  View<double*,CLayout,Device> delta_u;
53 
54  View<double*,CLayout,HostType, Kokkos::MemoryTraits<Kokkos::Unmanaged>> delta_T_h;
55  View<double*,CLayout,Device> delta_T;
56 
57  View<double*,CLayout, HostType> den_global_h;
58  View<double*,CLayout,Device> den_global;
59 
60  View<double*,CLayout, HostType> temp_global_h;
61  View<double*,CLayout,Device> temp_global;
62 
63  View<double*,CLayout, HostType> flow_global_h;
64  View<double*,CLayout,Device> flow_global;
65 
66  bool fg_temp_global_assigned=false; // flag to check fg_temp_global is assigned
67  View<double*,CLayout, HostType> fg_temp_global_h;
68  View<double*,CLayout,Device> fg_temp_global;
69 
71 
73  f0g = View<double***,CLayout,Device>(NoInit("f0g"), f0g_h.layout());
74  Kokkos::deep_copy(f0g, f0g_h);
75  }
76 
78  fg_temp_ev = View<double*,CLayout,Device>(NoInit("fg_temp_ev"), fg_temp_ev_h.layout());
79  Kokkos::deep_copy(fg_temp_ev, fg_temp_ev_h);
80  }
81 
83  fg_flow = View<double*,CLayout,Device>(NoInit("fg_flow"), fg_flow_h.layout());
84  Kokkos::deep_copy(fg_flow, fg_flow_h);
85  }
86 
88  fg_vth_inv = View<double*,CLayout,Device>(NoInit("fg_vth_inv"), fg_vth_inv_h.layout());
89  Kokkos::deep_copy(fg_vth_inv, fg_vth_inv_h);
90  }
91 
93  temp_ev = View<double*,CLayout,Device>(NoInit("temp_ev"), temp_ev_h.layout());
94  Kokkos::deep_copy(temp_ev, temp_ev_h);
95  }
96 
98  den = View<double*,CLayout,Device>(NoInit("den"), den_h.layout());
99  Kokkos::deep_copy(den, den_h);
100  }
101 
103  flow = View<double*,CLayout,Device>(NoInit("flow"), flow_h.layout());
104  Kokkos::deep_copy(flow, flow_h);
105  }
106 
108  grid_vol = View<double*,CLayout,Device>(NoInit("grid_vol"), grid_vol_h.layout());
109  Kokkos::deep_copy(grid_vol, grid_vol_h);
110  }
111 
113  grid_vol_vonly = View<double*,CLayout,Device>(NoInit("grid_vol_vonly"), grid_vol_vonly_h.layout());
114  Kokkos::deep_copy(grid_vol_vonly, grid_vol_vonly_h);
115  }
116 
118  inv_grid_vol = View<double*,CLayout,Device>(NoInit("inv_grid_vol"), inv_grid_vol_h.layout());
119  Kokkos::deep_copy(inv_grid_vol, inv_grid_vol_h);
120  }
121 
123  delta_n = View<double*,CLayout,Device>(NoInit("delta_n"), delta_n_h.layout());
124  Kokkos::deep_copy(delta_n, delta_n_h);
125  }
126 
128  delta_u = View<double*,CLayout,Device>(NoInit("delta_u"), delta_u_h.layout());
129  Kokkos::deep_copy(delta_u, delta_u_h);
130  }
131 
133  delta_T = View<double*,CLayout,Device>(NoInit("delta_T"), delta_T_h.layout());
134  Kokkos::deep_copy(delta_T, delta_T_h);
135  }
136 
138  den_global = View<double*,CLayout,Device>(NoInit("den_global"), den_global_h.layout());
139  Kokkos::deep_copy(den_global, den_global_h);
140  }
141 
143  temp_global = View<double*,CLayout,Device>(NoInit("temp_global"), temp_global_h.layout());
144  Kokkos::deep_copy(temp_global, temp_global_h);
145  }
146 
148  flow_global = View<double*,CLayout,Device>(NoInit("flow_global"), flow_global_h.layout());
149  Kokkos::deep_copy(flow_global, flow_global_h);
150  }
151 
153  fg_temp_global = View<double*,CLayout,Device>(NoInit("fg_temp_global"), fg_temp_global_h.layout());
154  Kokkos::deep_copy(fg_temp_global, fg_temp_global_h);
155  }
156 
157  // Deallocates all device views (doesn't matter if they are already deallocated)
159  f0g = View<double***,CLayout,Device>();
160 
161  fg_temp_ev = View<double*,CLayout,Device>();
162  fg_flow = View<double*,CLayout,Device>();
163  fg_vth_inv = View<double*,CLayout,Device>();
164 
165  grid_vol = View<double*,CLayout,Device>();
166  grid_vol_vonly = View<double*,CLayout,Device>();
167  inv_grid_vol = View<double*,CLayout,Device>();
168 
169  //F_M below
170  temp_ev = View<double*,CLayout,Device>();
171  flow = View<double*,CLayout,Device>();
172  den = View<double*,CLayout,Device>();
173 
174  delta_n = View<double*,CLayout,Device>();
175  delta_u = View<double*,CLayout,Device>();
176  delta_T = View<double*,CLayout,Device>();
177 
178  den_global = View<double*,CLayout,Device>();
179  temp_global = View<double*,CLayout,Device>();
180  }
181 };
182 #endif
View< double *, CLayout, Device > fg_flow
Definition: distribution.hpp:22
View< double *, CLayout, Device > den
Definition: distribution.hpp:45
bool fg_temp_global_assigned
Definition: distribution.hpp:66
void grid_vol_vonly_send_to_device()
Definition: distribution.hpp:112
void temp_ev_send_to_device()
Definition: distribution.hpp:92
void fg_vth_inv_send_to_device()
Definition: distribution.hpp:87
View< double *, CLayout, Device > den_global
Definition: distribution.hpp:58
View< double *, CLayout, Device > temp_global
Definition: distribution.hpp:61
View< double *, CLayout, Device > grid_vol_vonly
Definition: distribution.hpp:32
void den_send_to_device()
Definition: distribution.hpp:97
View< double *, CLayout, Device > temp_ev
Definition: distribution.hpp:39
void grid_vol_send_to_device()
Definition: distribution.hpp:107
void flow_send_to_device()
Definition: distribution.hpp:102
Distribution()
Definition: distribution.hpp:70
View< double *, Kokkos::HostSpace, Kokkos::MemoryTraits< Kokkos::Unmanaged > > fg_temp_ev_h
Definition: distribution.hpp:18
View< double ***, CLayout, Device > f0g
Definition: distribution.hpp:16
View< double ***, CLayout, Kokkos::HostSpace, Kokkos::MemoryTraits< Kokkos::Unmanaged > > f0g_h
Definition: distribution.hpp:15
View< double *, Kokkos::HostSpace, Kokkos::MemoryTraits< Kokkos::Unmanaged > > inv_grid_vol_h
Definition: distribution.hpp:34
View< double *, Kokkos::HostSpace, Kokkos::MemoryTraits< Kokkos::Unmanaged > > den_h
Definition: distribution.hpp:44
View< double *, Kokkos::HostSpace, Kokkos::MemoryTraits< Kokkos::Unmanaged > > fg_vth_inv_h
Definition: distribution.hpp:24
void flow_global_send_to_device()
Definition: distribution.hpp:147
View< double *, CLayout, Device > flow
Definition: distribution.hpp:42
View< double *, CLayout, Device > grid_vol
Definition: distribution.hpp:29
void fg_flow_send_to_device()
Definition: distribution.hpp:82
View< double *, Kokkos::HostSpace, Kokkos::MemoryTraits< Kokkos::Unmanaged > > temp_ev_h
Definition: distribution.hpp:38
View< double *, Kokkos::HostSpace, Kokkos::MemoryTraits< Kokkos::Unmanaged > > flow_h
Definition: distribution.hpp:41
View< double *, CLayout, Device > fg_temp_global
Definition: distribution.hpp:68
View< double *, CLayout, HostType, Kokkos::MemoryTraits< Kokkos::Unmanaged > > delta_n_h
Definition: distribution.hpp:48
void fg_temp_global_send_to_device()
Definition: distribution.hpp:152
void fg_temp_ev_send_to_device()
Definition: distribution.hpp:77
View< double *, CLayout, HostType, Kokkos::MemoryTraits< Kokkos::Unmanaged > > delta_u_h
Definition: distribution.hpp:51
View< double *, CLayout, HostType > fg_temp_global_h
Definition: distribution.hpp:67
View< double *, CLayout, HostType, Kokkos::MemoryTraits< Kokkos::Unmanaged > > delta_T_h
Definition: distribution.hpp:54
void inv_grid_vol_send_to_device()
Definition: distribution.hpp:117
View< double *, Kokkos::HostSpace, Kokkos::MemoryTraits< Kokkos::Unmanaged > > grid_vol_vonly_h
Definition: distribution.hpp:31
View< double *, Kokkos::HostSpace, Kokkos::MemoryTraits< Kokkos::Unmanaged > > grid_vol_h
Definition: distribution.hpp:28
View< double *, CLayout, Device > delta_n
Definition: distribution.hpp:49
void den_global_send_to_device()
Definition: distribution.hpp:137
View< double *, CLayout, HostType > den_global_h
Definition: distribution.hpp:57
View< double *, CLayout, Device > delta_T
Definition: distribution.hpp:55
View< double *, CLayout, Device > fg_vth_inv
Definition: distribution.hpp:25
void temp_global_send_to_device()
Definition: distribution.hpp:142
void deallocate_device_views()
Definition: distribution.hpp:158
View< double *, CLayout, Device > inv_grid_vol
Definition: distribution.hpp:35
View< double *, CLayout, Device > delta_u
Definition: distribution.hpp:52
void delta_u_send_to_device()
Definition: distribution.hpp:127
View< double *, CLayout, Device > flow_global
Definition: distribution.hpp:64
View< double *, CLayout, Device > fg_temp_ev
Definition: distribution.hpp:19
void delta_n_send_to_device()
Definition: distribution.hpp:122
void delta_T_send_to_device()
Definition: distribution.hpp:132
View< double *, Kokkos::HostSpace, Kokkos::MemoryTraits< Kokkos::Unmanaged > > fg_flow_h
Definition: distribution.hpp:21
View< double *, CLayout, HostType > temp_global_h
Definition: distribution.hpp:60
Kokkos::ViewAllocateWithoutInitializing NoInit
Definition: space_settings.hpp:68
Definition: distribution.hpp:11
void f0g_send_to_device()
Definition: distribution.hpp:72
View< double *, CLayout, HostType > flow_global_h
Definition: distribution.hpp:63