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 /* ----------------------------------------------------------------------
16 Contributing author: Tim Fuller (Sandia)
17 ------------------------------------------------------------------------- */
18
19 #include <stdlib.h>
20 #include <string.h>
21 #include <unistd.h>
22 #include "sparta_masks.h"
23 #include "kokkos_base.h"
24 #include "fix_ave_histo_weight_kokkos.h"
25 #include "particle_kokkos.h"
26 #include "update.h"
27 #include "particle.h"
28 #include "mixture.h"
29 #include "grid.h"
30 #include "grid_kokkos.h"
31 #include "domain.h"
32 #include "region.h"
33 #include "modify.h"
34 #include "compute.h"
35 #include "input.h"
36 #include "variable.h"
37 #include "memory.h"
38 #include "error.h"
39
40 using namespace SPARTA_NS;
41
42 enum{X,V,F,COMPUTE,FIX,VARIABLE};
43 enum{SCALAR,VECTOR,WINDOW};
44 enum{GLOBAL,PERPARTICLE,PERGRID};
45 enum{IGNORE,END,EXTRA};
46
47 #define INVOKED_SCALAR 1
48 #define INVOKED_VECTOR 2
49 #define INVOKED_ARRAY 4
50 #define INVOKED_PER_PARTICLE 8
51 #define INVOKED_PER_GRID 16
52
53 /* ---------------------------------------------------------------------- */
54
FixAveHistoWeightKokkos(SPARTA * spa,int narg,char ** arg)55 FixAveHistoWeightKokkos::FixAveHistoWeightKokkos(SPARTA *spa, int narg, char **arg) :
56 FixAveHistoKokkos(spa, narg, arg)
57 {
58
59 weightflag = 1;
60
61 // nvalues = 2 required for histo/weight
62
63 if (nvalues != 2) error->all(FLERR,"Illegal fix ave/histo/weight/kokkos command");
64
65 // check that length of 2 values is the same
66
67 int size[2];
68
69 for (int i = 0; i < nvalues; i++) {
70 if (which[i] == X || which[i] == V) {
71 size[i] = particle->nlocal;
72 } else if (which[i] == COMPUTE && kind == GLOBAL && mode == SCALAR) {
73 int icompute = modify->find_compute(ids[i]);
74 size[i] = modify->compute[icompute]->size_vector;
75 } else if (which[i] == COMPUTE && kind == GLOBAL && mode == VECTOR) {
76 int icompute = modify->find_compute(ids[i]);
77 size[i] = modify->compute[icompute]->size_array_rows;
78 } else if (which[i] == COMPUTE && kind == PERPARTICLE) {
79 size[i] = particle->nlocal;
80 } else if (which[i] == COMPUTE && kind == PERGRID) {
81 size[i] = grid->nlocal;
82 } else if (which[i] == FIX && kind == GLOBAL && mode == SCALAR) {
83 int ifix = modify->find_fix(ids[i]);
84 size[i] = modify->fix[ifix]->size_vector;
85 } else if (which[i] == FIX && kind == GLOBAL && mode == VECTOR) {
86 int ifix = modify->find_fix(ids[i]);
87 size[i]= modify->fix[ifix]->size_array_rows;
88 } else if (which[i] == FIX && kind == PERPARTICLE) {
89 size[i] = particle->nlocal;
90 } else if (which[i] == FIX && kind == PERGRID) {
91 size[i] = grid->nlocal;
92 } else if (which[i] == VARIABLE && kind == PERPARTICLE) {
93 size[i] = particle->nlocal;
94 } else if (which[i] == VARIABLE && kind == PERGRID) {
95 size[i] = grid->nlocal;
96 }
97 }
98
99 if (size[0] != size[1])
100 error->all(FLERR,"Fix ave/histo/weight/kokkos value and weight vector "
101 "lengths do not match");
102
103 vectorwt = NULL;
104 maxvectorwt = 0;
105
106 }
107
108 /* ---------------------------------------------------------------------- */
109
~FixAveHistoWeightKokkos()110 FixAveHistoWeightKokkos::~FixAveHistoWeightKokkos()
111 {
112 if (copymode) return;
113 }
114
115 /* ---------------------------------------------------------------------- */
calculate_weights()116 void FixAveHistoWeightKokkos::calculate_weights()
117 {
118 // weight factors are 2nd value (i = 1)
119
120 weight = 0.0;
121 weights = NULL;
122 stridewt = 0;
123
124 int i = 1;
125 int m = value2index[i];
126 int j = argindex[i];
127
128 // invoke compute if not previously invoked
129
130 if (which[i] == COMPUTE) {
131
132 Compute *compute = modify->compute[m];
133 if (!compute->kokkos_flag)
134 error->all(FLERR,"Cannot (yet) use non-Kokkos computes with fix ave/histo/kk");
135 KokkosBase* computeKKBase = dynamic_cast<KokkosBase*>(compute);
136
137 if (kind == GLOBAL && mode == SCALAR) {
138 if (j == 0) {
139 if (!(compute->invoked_flag & INVOKED_SCALAR)) {
140 compute->compute_scalar();
141 compute->invoked_flag |= INVOKED_SCALAR;
142 }
143 weight = compute->scalar;
144 } else {
145 error->all(FLERR,"Compute not compatible with fix ave/histo/kk");
146 if (!(compute->invoked_flag & INVOKED_VECTOR)) {
147 compute->compute_vector();
148 compute->invoked_flag |= INVOKED_VECTOR;
149 }
150 weight = compute->vector[j-1];
151 }
152 } else if (kind == GLOBAL && mode == VECTOR) {
153 error->all(FLERR,"Compute not compatible with fix ave/histo/kk");
154 if (j == 0) {
155 if (!(compute->invoked_flag & INVOKED_VECTOR)) {
156 compute->compute_vector();
157 compute->invoked_flag |= INVOKED_VECTOR;
158 }
159 weights = compute->vector;
160 stridewt = 1;
161 } else {
162 if (!(compute->invoked_flag & INVOKED_ARRAY)) {
163 compute->compute_array();
164 compute->invoked_flag |= INVOKED_ARRAY;
165 }
166 if (compute->array) weights = &compute->array[0][j-1];
167 stridewt = compute->size_array_cols;
168 }
169
170 } else if (kind == PERPARTICLE) {
171 error->all(FLERR,"Compute not compatible with fix ave/histo/kk");
172 if (!(compute->invoked_flag & INVOKED_PER_PARTICLE)) {
173 compute->compute_per_particle();
174 compute->invoked_flag |= INVOKED_PER_PARTICLE;
175 }
176 if (j == 0) {
177 weights = compute->vector_particle;
178 stridewt = 1;
179 } else if (compute->array_particle) {
180 weights = &compute->array_particle[0][j-1];
181 stridewt = compute->size_per_particle_cols;
182 }
183
184 } else if (kind == PERGRID) {
185 if (!(compute->invoked_flag & INVOKED_PER_GRID)) {
186 computeKKBase->compute_per_grid_kokkos();
187 compute->invoked_flag |= INVOKED_PER_GRID;
188 }
189 if (j == 0) {
190 d_weights = computeKKBase->d_vector;
191 } else if (compute->array_grid) {
192 d_weights = Kokkos::subview(computeKKBase->d_array_grid,Kokkos::ALL(),j-1);
193 }
194 }
195
196 // access fix fields, guaranteed to be ready
197
198 } else if (which[i] == FIX) {
199 Fix *fix = modify->fix[m];
200 if (!fix->kokkos_flag)
201 error->all(FLERR,"Cannot (yet) use non-Kokkos fixes with fix ave/histo/weight/kk");
202 KokkosBase* fixKKBase = dynamic_cast<KokkosBase*>(fix);
203
204 if (kind == GLOBAL && mode == SCALAR) {
205 if (j == 0) {
206 weight = fix->compute_scalar();
207 } else {
208 error->all(FLERR,"Fix not compatible with fix ave/histo/weight/kk");
209 weight = fix->compute_vector(j-1);
210 }
211 } else if (kind == GLOBAL && mode == VECTOR) {
212 error->all(FLERR,"Fix not compatible with fix ave/histo/weight/kk");
213 // NOTE: need to allocate local storage
214 if (j == 0) {
215 int n = fix->size_vector;
216 for (i = 0; i < n; i++) weights[n] = fix->compute_vector(i);
217 } else {
218 int n = fix->size_vector;
219 for (i = 0; i < n; i++) weights[n] = fix->compute_array(i,j-1);
220 }
221
222 } else if (kind == PERPARTICLE) {
223 error->all(FLERR,"Fix not compatible with fix ave/histo/weight/kk");
224 if (j == 0) {
225 weights = fix->vector_particle;
226 stridewt = 1;
227 } else if (fix->array_particle) {
228 weights = fix->array_particle[j-1];
229 stridewt = fix->size_per_particle_cols;
230 }
231
232 } else if (kind == PERGRID) {
233 if (j == 0) {
234 d_weights = fixKKBase->d_vector;
235 } else if (fixKKBase->d_array_grid.data()) {
236 d_weights = Kokkos::subview(fixKKBase->d_array_grid,Kokkos::ALL(),j-1);
237 }
238 }
239
240 // evaluate equal-style or particle-style or grid-style variable
241
242 } else if (which[i] == VARIABLE) {
243 error->all(FLERR,"Cannot (yet) use variables with fix ave/histo/weight/kk");
244 if (kind == GLOBAL && mode == SCALAR) {
245 weight = input->variable->compute_equal(m);
246
247 } else if (which[i] == VARIABLE && kind == PERPARTICLE) {
248 if (particle->maxlocal > maxvectorwt) {
249 memory->destroy(vectorwt);
250 maxvectorwt = particle->maxlocal;
251 memory->create(vectorwt,maxvectorwt,"ave/histo/weight:vectorwt");
252 }
253 input->variable->compute_particle(m,vectorwt,1,0);
254 weights = vectorwt;
255 stridewt = 1;
256
257 } else if (which[i] == VARIABLE && kind == PERGRID) {
258 if (grid->maxlocal > maxvectorwt) {
259 memory->destroy(vectorwt);
260 maxvectorwt = grid->maxlocal;
261 memory->create(vectorwt,maxvectorwt,"ave/histo/weight:vectorwt");
262 }
263 input->variable->compute_grid(m,vectorwt,1,0);
264 weights = vectorwt;
265 stridewt = 1;
266 }
267
268 // explicit per-particle attributes
269 // NOTE: need to allocate local storage
270 } else {
271 printf("%d, %d\n", which[i] == VARIABLE, kind == PERGRID);
272 error->all(FLERR,"Fix ave/histo/weight/kokkos option not yet supported");
273 }
274 }
275
276 /* ----------------------------------------------------------------------
277 bin a single value with weight
278 ------------------------------------------------------------------------- */
bin_scalar(typename minmax_type::value_type & minmax,double value)279 void FixAveHistoWeightKokkos::bin_scalar(
280 typename minmax_type::value_type& minmax,
281 double value)
282 {
283 bin_one(minmax, value, weight);
284 }
285
286 /* ----------------------------------------------------------------------
287 bin a vector of values with stride
288 ------------------------------------------------------------------------- */
bin_vector(minmax_type & reducer,int n,double * values,int stride)289 void FixAveHistoWeightKokkos::bin_vector(
290 minmax_type& reducer,
291 int n, double *values, int stride)
292 {
293 using FixKokkosDetails::mirror_view_from_raw_host_array;
294 this->stride = stride;
295
296 d_values = mirror_view_from_raw_host_array<double,DeviceType>(values, n, stride);
297
298 auto policy = Kokkos::RangePolicy<TagFixAveHistoWeight_BinVector,DeviceType>(0, n);
299 Kokkos::parallel_reduce(policy, *this, reducer);
300 DeviceType().fence();
301 }
302
303 /* ----------------------------------------------------------------------
304 bin a per-particle attribute
305 index is 0,1,2 if attribute is X or V
306 ------------------------------------------------------------------------- */
bin_particles(minmax_type & reducer,int attribute,int index)307 void FixAveHistoWeightKokkos::bin_particles(
308 minmax_type& reducer,
309 int attribute, int index)
310 {
311 using Kokkos::RangePolicy;
312 using FixKokkosDetails::mirror_view_from_raw_host_array;
313
314 this->index = index;
315 int n = particle->nlocal;
316
317 // FIXME: Kokkos version of region
318 //Region *region;
319 //if (regionflag) region = domain->regions[iregion];
320
321 if (regionflag)
322 error->all(FLERR,"Cannot (yet) use regionflag with fix ave/histo/kk");
323
324 if (attribute == X) {
325
326 if (regionflag && mixflag) {
327 //auto policy = RangePolicy<TagFixAveHistoWeight_BinParticlesX1,DeviceType>(0, n);
328 //Kokkos::parallel_reduce(policy, *this, reducer);
329 } else if (regionflag) {
330 //auto policy = RangePolicy<TagFixAveHistoWeight_BinParticlesX2,DeviceType>(0, n);
331 //Kokkos::parallel_reduce(policy, *this, reducer);
332 } else if (mixflag) {
333 auto policy = RangePolicy<TagFixAveHistoWeight_BinParticlesX3,DeviceType>(0, n);
334 Kokkos::parallel_reduce(policy, *this, reducer);
335 } else {
336 auto policy = RangePolicy<TagFixAveHistoWeight_BinParticlesX4,DeviceType>(0, n);
337 Kokkos::parallel_reduce(policy, *this, reducer);
338 }
339 DeviceType().fence();
340
341 } else if (attribute == V) {
342
343 if (regionflag && mixflag) {
344 //auto policy = RangePolicy<TagFixAveHistoWeight_BinParticlesV1,DeviceType>(0, n);
345 //Kokkos::parallel_reduce(policy, *this, reducer);
346 } else if (regionflag) {
347 //auto policy = RangePolicy<TagFixAveHistoWeight_BinParticlesV2,DeviceType>(0, n);
348 //Kokkos::parallel_reduce(policy, *this, reducer);
349 } else if (mixflag) {
350 auto policy = RangePolicy<TagFixAveHistoWeight_BinParticlesV3,DeviceType>(0, n);
351 Kokkos::parallel_reduce(policy, *this, reducer);
352 } else {
353 auto policy = RangePolicy<TagFixAveHistoWeight_BinParticlesV4,DeviceType>(0, n);
354 Kokkos::parallel_reduce(policy, *this, reducer);
355 }
356 DeviceType().fence();
357 }
358 }
359
360 /* ----------------------------------------------------------------------
361 bin a per-particle vector of values with stride
362 ------------------------------------------------------------------------- */
bin_particles(minmax_type & reducer,double * values,int stride)363 void FixAveHistoWeightKokkos::bin_particles(
364 minmax_type& reducer,
365 double *values, int stride)
366 {
367 using Kokkos::RangePolicy;
368 using FixKokkosDetails::mirror_view_from_raw_host_array;
369
370 this->stride = stride;
371 int n = particle->nlocal;
372
373 d_values = mirror_view_from_raw_host_array<double,DeviceType>(values, n, stride);
374
375 // FIXME: Kokkos version of region
376 // FIXME: Does values need to be made a view that lives on Device?
377 //Region *region;
378 //if (regionflag) region = domain->regions[iregion];
379
380 if (regionflag)
381 error->all(FLERR,"Cannot (yet) use regionflag with fix ave/histo/kk");
382
383 if (regionflag && mixflag) {
384 //auto policy = RangePolicy<TagFixAveHistoWeight_BinParticles1,DeviceType>(0, n);
385 //Kokkos::parallel_reduce(policy, *this, reducer);
386 } else if (regionflag) {
387 //auto policy = RangePolicy<TagFixAveHistoWeight_BinParticles2,DeviceType>(0, n);
388 //Kokkos::parallel_reduce(policy, *this, reducer);
389 } else if (mixflag) {
390 auto policy = RangePolicy<TagFixAveHistoWeight_BinParticles3,DeviceType>(0, n);
391 Kokkos::parallel_reduce(policy, *this, reducer);
392 } else {
393 auto policy = RangePolicy<TagFixAveHistoWeight_BinParticles4,DeviceType>(0, n);
394 Kokkos::parallel_reduce(policy, *this, reducer);
395 }
396 DeviceType().fence();
397 }
398
399 /* ----------------------------------------------------------------------
400 bin a per-grid vector of values with stride
401 ------------------------------------------------------------------------- */
bin_grid_cells(minmax_type & reducer,DAT::t_float_1d_strided d_vec)402 void FixAveHistoWeightKokkos::bin_grid_cells(
403 minmax_type& reducer,
404 DAT::t_float_1d_strided d_vec)
405 {
406 using Kokkos::RangePolicy;
407 using FixKokkosDetails::mirror_view_from_raw_host_array;
408
409 int n = grid->nlocal;
410
411 d_values = d_vec;
412
413 if (groupflag) {
414 GridKokkos* grid_kk = (GridKokkos*) grid;
415 grid_kk->sync(Device, CINFO_MASK);
416 auto policy = RangePolicy<TagFixAveHistoWeight_BinGridCells1,DeviceType>(0, n);
417 Kokkos::parallel_reduce(policy, *this, reducer);
418 } else {
419 auto policy = RangePolicy<TagFixAveHistoWeight_BinGridCells2,DeviceType>(0, n);
420 Kokkos::parallel_reduce(policy, *this, reducer);
421 }
422 DeviceType().fence();
423 }
424
425 /* ------------------------------------------------------------------------- */
426 KOKKOS_INLINE_FUNCTION
427 void
operator ()(TagFixAveHistoWeight_BinVector,const int i,minmax_type::value_type & lminmax) const428 FixAveHistoWeightKokkos::operator()(TagFixAveHistoWeight_BinVector, const int i,
429 minmax_type::value_type& lminmax) const
430 {
431 bin_one(lminmax, d_values(i), d_weights(i));
432 }
433
434 /* ------------------------------------------------------------------------- */
435 KOKKOS_INLINE_FUNCTION
436 void
operator ()(TagFixAveHistoWeight_BinParticles1,const int i,minmax_type::value_type & lminmax) const437 FixAveHistoWeightKokkos::operator()(TagFixAveHistoWeight_BinParticles1, const int i,
438 minmax_type::value_type& lminmax) const
439 {
440 /*
441 * region is not Kokkos compatible
442 * If a Kokkos compatible region becomes available,
443 * this code can be recommissioned.
444 *
445 const int ispecies = d_particles(i).ispecies;
446 if (region_kk->match(d_particles(i).x) && d_s2g(imix, ispecies) >= 0)
447 {
448 bin_one(lminmax, d_values(i), d_weights(i));
449 }
450 */
451 }
452
453 /* ------------------------------------------------------------------------- */
454 KOKKOS_INLINE_FUNCTION
455 void
operator ()(TagFixAveHistoWeight_BinParticles2,const int i,minmax_type::value_type & lminmax) const456 FixAveHistoWeightKokkos::operator()(TagFixAveHistoWeight_BinParticles2, const int i,
457 minmax_type::value_type& lminmax) const
458 {
459 /*
460 * region is not Kokkos compatible.
461 * If a Kokkos compatible region becomes available,
462 * this code can be recommissioned.
463 *
464 if (region_kk->match(d_particles(i).x))
465 {
466 bin_one(lminmax, d_values(i), d_weights(i));
467 }
468 */
469 }
470
471 /* ------------------------------------------------------------------------- */
472 KOKKOS_INLINE_FUNCTION
473 void
operator ()(TagFixAveHistoWeight_BinParticles3,const int i,minmax_type::value_type & lminmax) const474 FixAveHistoWeightKokkos::operator()(TagFixAveHistoWeight_BinParticles3, const int i,
475 minmax_type::value_type& lminmax) const
476 {
477 const int ispecies = d_particles(i).ispecies;
478 if (d_s2g(imix, ispecies) < 0)
479 {
480 bin_one(lminmax, d_values(i), d_weights(i));
481 }
482 }
483
484 /* ------------------------------------------------------------------------- */
485 KOKKOS_INLINE_FUNCTION
486 void
operator ()(TagFixAveHistoWeight_BinParticles4,const int i,minmax_type::value_type & lminmax) const487 FixAveHistoWeightKokkos::operator()(TagFixAveHistoWeight_BinParticles4, const int i,
488 minmax_type::value_type& lminmax) const
489 {
490 bin_one(lminmax, d_values(i), d_weights(i));
491 }
492
493 /* ------------------------------------------------------------------------- */
494 KOKKOS_INLINE_FUNCTION
495 void
operator ()(TagFixAveHistoWeight_BinGridCells1,const int i,minmax_type::value_type & lminmax) const496 FixAveHistoWeightKokkos::operator()(TagFixAveHistoWeight_BinGridCells1, const int i,
497 minmax_type::value_type& lminmax) const
498 {
499 if (grid_kk->k_cinfo.d_view[i].mask & groupbit)
500 {
501 bin_one(lminmax, d_values(i), d_weights(i));
502 }
503 }
504
505 /* ------------------------------------------------------------------------- */
506 KOKKOS_INLINE_FUNCTION
507 void
operator ()(TagFixAveHistoWeight_BinGridCells2,const int i,minmax_type::value_type & lminmax) const508 FixAveHistoWeightKokkos::operator()(TagFixAveHistoWeight_BinGridCells2, const int i,
509 minmax_type::value_type& lminmax) const
510 {
511 bin_one(lminmax, d_values(i), d_weights(i));
512 }
513
514 /* ------------------------------------------------------------------------- */
515 KOKKOS_INLINE_FUNCTION
516 void
operator ()(TagFixAveHistoWeight_BinParticlesX1,const int i,minmax_type::value_type & lminmax) const517 FixAveHistoWeightKokkos::operator()(TagFixAveHistoWeight_BinParticlesX1, const int i,
518 minmax_type::value_type& lminmax) const
519 {
520 /*
521 * region is not Kokkos compatible
522 * If a Kokkos compatible region becomes available,
523 * this code can be recommissioned.
524 *
525 const int ispecies = d_particles(i).ispecies;
526 if (region_kk->match(d_particles(i).x) && d_s2g(imix, ispecies) < 0)
527 {
528 bin_one(lminmax, d_particles(i).x[index], d_weights(i));
529 }
530 */
531 }
532
533 /* ------------------------------------------------------------------------- */
534 KOKKOS_INLINE_FUNCTION
535 void
operator ()(TagFixAveHistoWeight_BinParticlesX2,const int i,minmax_type::value_type & lminmax) const536 FixAveHistoWeightKokkos::operator()(TagFixAveHistoWeight_BinParticlesX2, const int i,
537 minmax_type::value_type& lminmax) const
538 {
539 /*
540 * region is not Kokkos compatible
541 * If a Kokkos compatible region becomes available,
542 * this code can be recommissioned.
543 *
544 if (region_kk->match(d_particles(i).x))
545 {
546 bin_one(lminmax, d_particles(i).x[index], d_weights(i));
547 }
548 */
549 }
550
551 /* ------------------------------------------------------------------------- */
552 KOKKOS_INLINE_FUNCTION
553 void
operator ()(TagFixAveHistoWeight_BinParticlesX3,const int i,minmax_type::value_type & lminmax) const554 FixAveHistoWeightKokkos::operator()(TagFixAveHistoWeight_BinParticlesX3, const int i,
555 minmax_type::value_type& lminmax) const
556 {
557 const int ispecies = d_particles(i).ispecies;
558 if (d_s2g(imix, ispecies) >= 0)
559 {
560 bin_one(lminmax, d_particles(i).x[index], d_weights(i));
561 }
562 }
563
564 /* ------------------------------------------------------------------------- */
565 KOKKOS_INLINE_FUNCTION
566 void
operator ()(TagFixAveHistoWeight_BinParticlesX4,const int i,minmax_type::value_type & lminmax) const567 FixAveHistoWeightKokkos::operator()(TagFixAveHistoWeight_BinParticlesX4, const int i,
568 minmax_type::value_type& lminmax) const
569 {
570 bin_one(lminmax, d_particles(i).x[index], d_weights(i));
571 }
572
573 /* ------------------------------------------------------------------------- */
574 KOKKOS_INLINE_FUNCTION
575 void
operator ()(TagFixAveHistoWeight_BinParticlesV1,const int i,minmax_type::value_type & lminmax) const576 FixAveHistoWeightKokkos::operator()(TagFixAveHistoWeight_BinParticlesV1, const int i,
577 minmax_type::value_type& lminmax) const
578 {
579 /*
580 * region is not Kokkos compatible
581 * If a Kokkos compatible region becomes available,
582 * this code can be recommissioned.
583 *
584 const int ispecies = d_particles(i).ispecies;
585 if (region_kk->match(d_particles(i).x) && d_s2g(imix, ispecies) < 0)
586 {
587 bin_one(lminmax, d_particles(i).v[index], d_weights(i));
588 }
589 */
590 }
591
592 /* ------------------------------------------------------------------------- */
593 KOKKOS_INLINE_FUNCTION
594 void
operator ()(TagFixAveHistoWeight_BinParticlesV2,const int i,minmax_type::value_type & lminmax) const595 FixAveHistoWeightKokkos::operator()(TagFixAveHistoWeight_BinParticlesV2, const int i,
596 minmax_type::value_type& lminmax) const
597 {
598 /*
599 * region is not Kokkos compatible
600 * If a Kokkos compatible region becomes available,
601 * this code can be recommissioned.
602 *
603 if (region_kk->match(d_particles(i).x))
604 {
605 bin_one(lminmax, d_particles(i).v[index], d_weights(i));
606 }
607 */
608 }
609
610 /* ------------------------------------------------------------------------- */
611 KOKKOS_INLINE_FUNCTION
612 void
operator ()(TagFixAveHistoWeight_BinParticlesV3,const int i,minmax_type::value_type & lminmax) const613 FixAveHistoWeightKokkos::operator()(TagFixAveHistoWeight_BinParticlesV3, const int i,
614 minmax_type::value_type& lminmax) const
615 {
616 const int ispecies = d_particles(i).ispecies;
617 if (d_s2g(imix, ispecies) >= 0)
618 {
619 bin_one(lminmax, d_particles(i).v[index], d_weights(i));
620 }
621 }
622
623 /* ------------------------------------------------------------------------- */
624 KOKKOS_INLINE_FUNCTION
625 void
operator ()(TagFixAveHistoWeight_BinParticlesV4,const int i,minmax_type::value_type & lminmax) const626 FixAveHistoWeightKokkos::operator()(TagFixAveHistoWeight_BinParticlesV4, const int i,
627 minmax_type::value_type& lminmax) const
628 {
629 bin_one(lminmax, d_particles(i).v[index], d_weights(i));
630 }
631