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 #ifndef SPARTA_COMPUTE_H 16 #define SPARTA_COMPUTE_H 17 18 #include "pointers.h" 19 #include "particle.h" 20 21 namespace SPARTA_NS { 22 23 class Compute : protected Pointers { 24 public: 25 char *id,*style; 26 27 double scalar; // computed global scalar 28 double *vector; // computed global vector 29 double **array; // computed global array 30 double *vector_particle; // computed per-particle vector 31 double **array_particle; // computed per-particle array 32 double *vector_grid; // computed per-grid vector 33 double **array_grid; // computed per-grid array 34 35 // vec/array surf are length = # of explicit surf elements owned 36 // vec/array tally are length = # of surf elements tallied 37 38 double *vector_surf; // computed per-surf vector 39 double **array_surf; // computed per-surf array 40 double *vector_surf_tally; // computed per-surf tally vector 41 double **array_surf_tally; // computed per-surf tally array 42 43 int scalar_flag; // 0/1 if compute_scalar() function exists 44 int vector_flag; // 0/1 if compute_vector() function exists 45 int array_flag; // 0/1 if compute_array() function exists 46 int size_vector; // length of global vector 47 int size_array_rows; // rows in global array 48 int size_array_cols; // columns in global array 49 50 int per_particle_flag; // 0/1 if compute_per_particle() function exists 51 int size_per_particle_cols; // 0 = vector, N = columns in per-particle array 52 53 int per_grid_flag; // 0/1 if compute_per_grid() function exists 54 int size_per_grid_cols; // 0 = vector, N = columns in per-grid array 55 int post_process_grid_flag; // 1 if requires post_process_grid() for output 56 int post_process_isurf_grid_flag; // 1 if requires post_process_tally() for out 57 58 int per_surf_flag; // 0/1 if compute_per_surf() function exists 59 int size_per_surf_cols; // 0 = vector, N = columns in per-surf array 60 61 int surf_tally_flag; // 1 if compute tallies surface bounce info 62 int boundary_tally_flag; // 1 if compute tallies boundary bounce info 63 64 int timeflag; // 1 if Compute stores list of timesteps it's called on 65 int ntime; // # of entries in time list 66 int maxtime; // max # of entries time list can hold 67 bigint *tlist; // list of timesteps the Compute is called on 68 69 int invoked_flag; // non-zero if invoked or accessed this step, 0 if not 70 bigint invoked_scalar; // last timestep on which compute_scalar() was invoked 71 bigint invoked_vector; // ditto for compute_vector() 72 bigint invoked_array; // ditto for compute_array() 73 bigint invoked_per_particle; // ditto for compute_per_particle() 74 bigint invoked_per_grid; // ditto for compute_per_grid() 75 bigint invoked_per_surf; // ditto for compute_per_surf() 76 77 Compute(class SPARTA *, int, char **); Compute(class SPARTA * sparta)78 Compute(class SPARTA* sparta) : Pointers(sparta) {} 79 virtual ~Compute(); init()80 virtual void init() {} 81 compute_scalar()82 virtual double compute_scalar() {return 0.0;} compute_vector()83 virtual void compute_vector() {} compute_array()84 virtual void compute_array() {} compute_per_particle()85 virtual void compute_per_particle() {} compute_per_grid()86 virtual void compute_per_grid() {} compute_per_surf()87 virtual void compute_per_surf() {} clear()88 virtual void clear() {} surf_tally(int,int,int,Particle::OnePart *,Particle::OnePart *,Particle::OnePart *)89 virtual void surf_tally(int, int, int, Particle::OnePart *, 90 Particle::OnePart *, Particle::OnePart *) {} boundary_tally(int,int,int,Particle::OnePart *,Particle::OnePart *,Particle::OnePart *)91 virtual void boundary_tally(int, int, int, Particle::OnePart *, 92 Particle::OnePart *, Particle::OnePart *) {} 93 post_process_grid(int,int,double **,int *,double *,int)94 virtual void post_process_grid(int, int, double **, int *, double *, int) {} 95 // NOTE: get rid of this method at some point post_process_grid_old(void *,void *,int,int,double *,int)96 virtual void post_process_grid_old(void *, void *, int, int, double *, int) {} post_process_isurf_grid()97 virtual void post_process_isurf_grid() {} 98 query_tally_grid(int,double ** &,int * &)99 virtual int query_tally_grid(int, double **&, int *&) {return 0;} tallyinfo(surfint * &)100 virtual int tallyinfo(surfint *&) {return 0;} post_process_surf()101 virtual void post_process_surf() {} 102 reallocate()103 virtual void reallocate() {} 104 virtual bigint memory_usage(); 105 106 // methods in compute.cpp 107 108 void addstep(bigint); 109 int matchstep(bigint); 110 void clearstep(); 111 112 // Kokkos methods 113 114 int kokkos_flag; // 1 if Kokkos-enabled 115 int copy,copymode; // 1 if copy of class (prevents deallocation of 116 // base class when child copy is destroyed) 117 }; 118 119 } 120 121 #endif 122 123 /* ERROR/WARNING messages: 124 125 E: Illegal ... command 126 127 Self-explanatory. Check the input script syntax and compare to the 128 documentation for the command. You can use -echo screen as a 129 command-line option when running SPARTA to see the offending line. 130 131 E: Compute ID must be alphanumeric or underscore characters 132 133 Self-explanatory. 134 135 */ 136