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(tvib/grid/kk,ComputeTvibGridKokkos)
18 
19 #else
20 
21 #ifndef SPARTA_COMPUTE_TVIB_GRID_KOKKOS_H
22 #define SPARTA_COMPUTE_TVIB_GRID_KOKKOS_H
23 
24 #include "compute_tvib_grid.h"
25 #include "kokkos_base.h"
26 #include "kokkos_type.h"
27 #include "particle_kokkos.h"
28 
29 namespace SPARTA_NS {
30 
31 template<int NEED_ATOMICS>
32 struct TagComputeTvibGrid_compute_per_grid_atomic{};
33 struct TagComputeTvibGrid_compute_per_grid{};
34 struct TagComputeTvibGrid_post_process_grid{};
35 
36 class ComputeTvibGridKokkos : public ComputeTvibGrid, public KokkosBase {
37  public:
38   ComputeTvibGridKokkos(class SPARTA *, int, char **);
39   ~ComputeTvibGridKokkos();
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()(TagComputeTvibGrid_compute_per_grid_atomic<NEED_ATOMICS>, const int&) const;
50 
51   KOKKOS_INLINE_FUNCTION
52   void operator()(TagComputeTvibGrid_compute_per_grid, const int&) const;
53 
54   KOKKOS_INLINE_FUNCTION
55   void operator()(TagComputeTvibGrid_post_process_grid, const int&) const;
56 
57   DAT::tdual_float_1d k_vector_grid;
58 
59  private:
60   int nstride,count,evib,nsp,imode;
61   double boltz;
62 
63   DAT::tdual_float_2d_lr k_tally;
64   DAT::t_float_2d_lr d_tally;
65 
66   int need_dup;
67   Kokkos::Experimental::ScatterView<F_FLOAT**, typename DAT::t_float_2d_lr::array_layout,DeviceType,Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterDuplicated> dup_tally;
68   Kokkos::Experimental::ScatterView<F_FLOAT**, typename DAT::t_float_2d_lr::array_layout,DeviceType,Kokkos::Experimental::ScatterSum,Kokkos::Experimental::ScatterNonDuplicated> ndup_tally;
69 
70   DAT::t_float_2d_lr d_etally;
71   DAT::t_float_1d_strided d_vec;
72 
73   t_cinfo_1d d_cinfo;
74   t_particle_1d d_particles;
75   t_species_1d d_species;
76   DAT::t_int_2d d_s2g;
77 
78   DAT::t_int_1d d_cellcount;
79   DAT::t_int_2d d_plist;
80 
81   DAT::t_float_1d d_tspecies;
82   DAT::t_float_2d_lr d_tspecies_mode;
83 
84   DAT::tdual_int_1d k_s2t;
85   DAT::tdual_int_1d k_t2s;
86   DAT::tdual_int_1d k_t2s_mode;
87   DAT::tdual_int_2d k_s2t_mode;
88 
89   DAT::t_int_1d d_s2t;
90   DAT::t_int_1d d_t2s;
91   DAT::t_int_1d d_t2s_mode;
92   DAT::t_int_2d d_s2t_mode;
93 
94   DAT::t_int_1d d_ewhich;
95   ParticleKokkos::tdual_struct_tdual_int_2d_1d k_eiarray;
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 tvib/grid mixture has changed
116 
117 This mixture property cannot be changed after this compute command is
118 issued.
119 
120 E: Number of species in compute tvib/grid mixture has changed
121 
122 This mixture property cannot be changed after this compute command is
123 issued.
124 
125 */
126