SENSEI
A frame work for generic in situ analytics
ParticleDensity.h
1 #ifndef ParticleDensity_h
2 #define ParticleDensity_h
3 
4 #include "AnalysisAdaptor.h"
5 #include <mpi.h>
6 #include <vector>
7 
8 class svtkDataObject;
9 class svtkDataArray;
10 
11 namespace sensei
12 {
13 /** Computes number and mass density on a mesh from a set of particle positions
14  * and masses. At each time step the results are stored on disk in PGM format.
15  *
16  * The input data is currently required to be on a svtkTable. Global mesh
17  * bounds are obtained from the mesh metadata. One must additionally provide
18  * during initialization the following: the mesh name; names of the particle
19  * positions and masses; the resolution of the output image; and an output file
20  * name where the substring %t% is replaced with the current simulation time.
21  */
22 class SENSEI_EXPORT ParticleDensity : public AnalysisAdaptor
23 {
24 public:
25  /// allocates a new instance
26  static ParticleDensity* New();
27 
28  senseiTypeMacro(ParticleDensity, AnalysisAdaptor);
29 
30  // names the projection computed
31  enum {PROJECT_XY=1, PROJECT_XZ=2, PROJECT_YZ=3 };
32 
33  /** set the name of the mesh and arrays to request from the simulation.
34  * Sets the output image resolution and the name of a file to write them in.
35  * the substring %t% is replaced with the current simulation time step. if
36  * one of resx or resy is -1 it is calculated from the data's aspect ratio
37  * so that image pixels are square.
38  */
39  void Initialize(const std::string &meshName,
40  const std::string &xPosArray, const std::string &yPosArray,
41  const std::string &zPosArray, const std::string &massArray,
42  const std::string proj, long xres, long yres, const std::string &outDir,
43  int returnData);
44 
45  /// compute the histogram for this time step
46  bool Execute(DataAdaptor* data, DataAdaptor**) override;
47 
48  /// finalize the run
49  int Finalize() override;
50 
51 protected:
53  ~ParticleDensity();
54 
55  ParticleDensity(const ParticleDensity&) = delete;
56  void operator=(const ParticleDensity&) = delete;
57 
58  int Projection;
59  long XRes;
60  long YRes;
61  std::string OutDir;
62  unsigned long Iteration;
63 
64  std::string MeshName;
65  std::string XPosArray;
66  std::string YPosArray;
67  std::string ZPosArray;
68  std::string MassArray;
69  int ReturnData;
70 };
71 
72 }
73 
74 #endif
int Initialize(MPI_Comm comm, const std::string &fileName, InTransitDataAdaptor *&dataAdaptor)
Creates a sensei::ConfigurableAnalysis adaptor and sensei::InTransitDataAdaptor based on a SENSEI XML...
Computes number and mass density on a mesh from a set of particle positions and masses.
Definition: ParticleDensity.h:22
The base class for data consumers.
Definition: AnalysisAdaptor.h:24
SENSEI.
Definition: ADIOS2AnalysisAdaptor.h:27
Base class that defines the interface for fetching data from a simulation.
Definition: DataAdaptor.h:25