1 /* ----------------------------------------------------------------------
2    SPARTA - Stochastic PArallel Rarefied-gas Time-accurate Analyzer
3    http://sparta.sandia.gov
4    Steve Plimpton, sjplimp@sandia.gov, Michael Gallis, magalli@sandia.gov
5    Sandia National Laboratories
6 
7    Copyright (2014) Sandia Corporation.  Under the terms of Contract
8    DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
9    certain rights in this software.  This software is distributed under
10    the GNU General Public License.
11 
12    See the README file in the top-level SPARTA directory.
13 ------------------------------------------------------------------------- */
14 
15 #ifdef COMPUTE_CLASS
16 
17 ComputeStyle(eflux/grid/kk,ComputeEFluxGridKokkos)
18 
19 #else
20 
21 #ifndef SPARTA_COMPUTE_EFLUX_GRID_KOKKOS_H
22 #define SPARTA_COMPUTE_EFLUX_GRID_KOKKOS_H
23 
24 #include "compute_eflux_grid.h"
25 #include "kokkos_base.h"
26 #include "kokkos_type.h"
27 
28 namespace SPARTA_NS {
29 
30 template<int NEED_ATOMICS>
31 struct TagComputeEFluxGrid_compute_per_grid_atomic{};
32 
33 struct TagComputeEFluxGrid_compute_per_grid{};
34 struct TagComputeEFluxGrid_post_process_grid{};
35 
36 class ComputeEFluxGridKokkos : public ComputeEFluxGrid, public KokkosBase {
37  public:
38   ComputeEFluxGridKokkos(class SPARTA *, int, char **);
39   ~ComputeEFluxGridKokkos();
40   void compute_per_grid();
41   void compute_per_grid_kokkos();
42   int query_tally_grid_kokkos(DAT::t_float_2d_lr &);
43   void post_process_grid_kokkos(int, int, DAT::t_float_2d_lr, int *,
44                                   DAT::t_float_1d_strided);
45   void reallocate();
46 
47   template<int NEED_ATOMICS>
48   KOKKOS_INLINE_FUNCTION
49   void operator()(TagComputeEFluxGrid_compute_per_grid_atomic<NEED_ATOMICS>, const int&) const;
50 
51   KOKKOS_INLINE_FUNCTION
52   void operator()(TagComputeEFluxGrid_compute_per_grid, const int&) const;
53 
54   KOKKOS_INLINE_FUNCTION
55   void operator()(TagComputeEFluxGrid_post_process_grid, const int&) const;
56 
57 
58   DAT::tdual_float_1d k_vector_grid;
59 
60  private:
61   DAT::tdual_float_2d_lr k_tally;
62   DAT::t_float_2d_lr d_tally;
63   int need_dup;
64   Kokkos::Experimental::ScatterView<F_FLOAT**, typename DAT::t_float_2d_lr::array_layout,DeviceType,typename Kokkos::Experimental::ScatterSum,typename Kokkos::Experimental::ScatterDuplicated> dup_tally;
65   Kokkos::Experimental::ScatterView<F_FLOAT**, typename DAT::t_float_2d_lr::array_layout,DeviceType,typename Kokkos::Experimental::ScatterSum,typename Kokkos::Experimental::ScatterNonDuplicated> ndup_tally;
66 
67   DAT::t_float_2d_lr d_etally;
68   DAT::t_float_1d_strided d_vec;
69 
70   t_cinfo_1d d_cinfo;
71   t_particle_1d d_particles;
72   t_species_1d d_species;
73   DAT::t_int_2d d_s2g;
74 
75   DAT::t_int_1d d_cellcount;
76   DAT::t_int_2d d_plist;
77 
78   DAT::tdual_int_1d k_unique;
79   DAT::t_int_1d d_unique;
80 
81   int nstride,nsample;
82   double fnum;
83 
84   int mass;
85   int mv;
86   int mv1;
87   int mv2;
88   int mvv;
89   int mv1v1;
90   int mv2v2;
91   int mvv1;
92   int mvv2;
93   int mvvv;
94   int mvv1v1;
95   int mvv2v2;
96 };
97 
98 }
99 
100 #endif
101 #endif
102 
103 /* ERROR/WARNING messages:
104 
105 E: Illegal ... command
106 
107 Self-explanatory.  Check the input script syntax and compare to the
108 documentation for the command.  You can use -echo screen as a
109 command-line option when running SPARTA to see the offending line.
110 
111 E: Compute grid mixture ID does not exist
112 
113 Self-explanatory.
114 
115 E: Number of groups in compute grid mixture has changed
116 
117 This mixture property cannot be changed after this compute command is
118 issued.
119 
120 E: Invalid call to ComputeGrid::post_process_grid()
121 
122 This indicates a coding error.  Please report the issue to the SPARTA
123 developers.
124 
125 */
126