1 #ifndef DISTRIBUTION_HPP
2 #define DISTRIBUTION_HPP
4 #include <Kokkos_Core.hpp>
16 template<
class Device>
23 Kokkos::View<double***,Kokkos::LayoutRight, Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>>
f;
26 Kokkos::View<double***,Kokkos::LayoutRight, Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>>
f0g_h;
27 Kokkos::View<double*,Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>>
temp_ev_h;
30 Kokkos::View<double***,Kokkos::LayoutRight,Device>
f0g;
31 Kokkos::View<double*,Kokkos::LayoutRight,Device>
temp_ev;
34 Kokkos::View<double*,Kokkos::LayoutRight,Device>
delta_n;
35 Kokkos::View<double*,Kokkos::LayoutRight,Device>
delta_u;
36 Kokkos::View<double*,Kokkos::LayoutRight,Device>
delta_t;
39 Kokkos::View<double*,Kokkos::LayoutRight,Device>
grid_vol;
43 Kokkos::View<double***,Kokkos::LayoutRight,Device>
n;
44 Kokkos::View<double***,Kokkos::LayoutRight, Device>
f_d;
45 Kokkos::View<double*,Kokkos::LayoutRight,Device>
temp_ev_d;
66 Kokkos::resize(
f0g, vgrid.
nvr, nnode, vgrid.
nvz);
68 Kokkos::resize(
delta_n, nnode_entire_plane);
69 Kokkos::resize(
delta_u, nnode_entire_plane);
70 Kokkos::resize(
delta_t, nnode_entire_plane);
75 Kokkos::resize(
f0g, 0,0,0);
83 void send_to_device(
double* delta_n_array,
double* delta_u_array,
double* delta_t_array,
int isp)
111 Kokkos::resize(
f0g, vgrid.
nvr, nnode, vgrid.
nvz);
113 Kokkos::resize(
f_d, vgrid.
nvr, nnode, vgrid.
nvz);
114 Kokkos::resize(
n, vgrid.
nvr, nnode, vgrid.
nvz);
120 Kokkos::resize(
f0g, 0,0,0);
122 Kokkos::resize(
f_d, 0,0,0);
123 Kokkos::resize(
n, 0,0,0);
135 int one_sp_size = vgrid.
nvr*nnode*vgrid.
nvz;
136 int ptr_offset = isp*one_sp_size;
138 f0g_h = Kokkos::View<double***,Kokkos::LayoutRight, Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>>
139 (f0g_ptr + ptr_offset, vgrid.
nvr, nnode, vgrid.
nvz);
143 ptr_offset = isp*one_sp_size;
144 temp_ev_h = Kokkos::View<double*,Kokkos::LayoutRight, Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>>
145 (temp_ev_ptr + ptr_offset, nnode);
156 int one_sp_size = vgrid.
nvr*nnode*vgrid.
nvz;
157 int ptr_offset = isp*one_sp_size;
158 f = Kokkos::View<double***,Kokkos::LayoutRight, Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>>
159 (f_ptr + ptr_offset, vgrid.
nvr, nnode, vgrid.
nvz);
double * get_temp_ev_loc()
void send_to_device(double *delta_n_array, double *delta_u_array, double *delta_t_array, int isp)
Definition: distribution.hpp:83
Definition: velocity_grid.hpp:5
Kokkos::View< double *, Kokkos::LayoutRight, Device > delta_n
Definition: distribution.hpp:34
int nvr
full grid size (including zero)
Definition: velocity_grid.hpp:16
Kokkos::View< double *, Kokkos::LayoutRight, Device > temp_ev
Definition: distribution.hpp:31
void resize_for_update_f0_on_device(const VelocityGrid &vgrid, int nnode)
Definition: distribution.hpp:110
Definition: distribution.hpp:17
void resize_for_update_f0_to_zero()
Definition: distribution.hpp:119
Kokkos::View< double *, Kokkos::LayoutRight, Device > delta_t
Definition: distribution.hpp:36
void resize_for_distribute_f0g_to_zero()
Definition: distribution.hpp:102
void subarray_deep_copy(T *array, const Kokkos::View< T *, Kokkos::LayoutRight, DeviceType > &view, int isp)
Definition: array_deep_copy.hpp:102
void update_pointers(const VelocityGrid &vgrid, int nnode, int isp, double *f0g_ptr, double *temp_ev_ptr)
Definition: distribution.hpp:130
Kokkos::View< double *, Kokkos::HostSpace, Kokkos::MemoryTraits< Kokkos::Unmanaged > > temp_ev_h
Definition: distribution.hpp:27
Kokkos::View< double ***, Kokkos::LayoutRight, Device > f_d
Definition: distribution.hpp:44
Kokkos::View< double *, Kokkos::LayoutRight, Device > delta_u
Definition: distribution.hpp:35
Distribution()
Definition: distribution.hpp:48
double * get_delta_t_loc()
Kokkos::View< double ***, Kokkos::LayoutRight, Device > f0g
Definition: distribution.hpp:30
void resize_for_distribute_f0g_on_device(const VelocityGrid &vgrid, int nnode)
Definition: distribution.hpp:96
Kokkos::View< double ***, Kokkos::LayoutRight, Device > n
Definition: distribution.hpp:43
double * get_delta_u_loc()
Kokkos::View< double *, Kokkos::LayoutRight, Device > inv_grid_vol
Definition: distribution.hpp:42
void update_tmp_pointer(const VelocityGrid &vgrid, int nnode, int isp, double *f_ptr)
Definition: distribution.hpp:151
Kokkos::View< double *, Kokkos::LayoutRight, Device > temp_ev_d
Definition: distribution.hpp:45
int nvz
full grid size (including negative and zero)
Definition: velocity_grid.hpp:17
void resize_on_device(const VelocityGrid &vgrid, int nnode, int nnode_entire_plane)
Definition: distribution.hpp:65
Kokkos::View< double ***, Kokkos::LayoutRight, Kokkos::HostSpace, Kokkos::MemoryTraits< Kokkos::Unmanaged > > f0g_h
Definition: distribution.hpp:26
void resize_to_zero()
Definition: distribution.hpp:74
double * get_delta_n_loc()
Kokkos::View< double ***, Kokkos::LayoutRight, Kokkos::HostSpace, Kokkos::MemoryTraits< Kokkos::Unmanaged > > f
Definition: distribution.hpp:23
Kokkos::View< double *, Kokkos::LayoutRight, Device > grid_vol
Definition: distribution.hpp:39