SENSEI
A frame work for generic in situ analytics
AscentAnalysisAdaptor.h
1 #ifndef sensei_AscentAnalysisAdaptor_h
2 #define sensei_AscentAnalysisAdaptor_h
3 
4 #include "AnalysisAdaptor.h"
5 #include "DataRequirements.h"
6 
7 #include <conduit.hpp>
8 #include <ascent.hpp>
9 #include <string>
10 
11 namespace sensei
12 {
13 
14 /// An analysis adaptor for ascent-based analysis pipelines.
15 class SENSEI_EXPORT AscentAnalysisAdaptor : public AnalysisAdaptor
16 {
17 public:
18  /// Creates an AscentAnalysisAdaptor instance.
19  static AscentAnalysisAdaptor* New();
20 
21  senseiTypeMacro(AscentAnalysisAdaptor, AnalysisAdaptor);
22 
23  /// @name Run time configuration
24  /// @{
25 
26  /// Initialize the Ascent library using Ascent specific json configurations.
27  int Initialize(const std::string &json_file_path,
28  const std::string &options_file_path);
29 
30  /** Adds a set of sensei::DataRequirements, typically this will come from an XML
31  * configuratiopn file. Data requirements tell the adaptor what to fetch from
32  * the simulation and write to disk. If none are given then all available
33  * data is fetched and written.
34  */
35  int SetDataRequirements(const DataRequirements &reqs);
36 
37  /** Add an indivudal data requirement. Data requirements tell the adaptor
38  * what to fetch from the simulation and write to disk. If none are given
39  * then all available data is fetched and written.
40 
41  * @param[in] meshName the name of the mesh to fetch and write
42  * @param[in] association the type of data array to fetch and write
43  * vtkDataObject::POINT or vtkDataObject::CELL
44  * @param[in] arrays a list of arrays to fetch and write
45  * @returns zero if successful.
46  */
47  int AddDataRequirement(const std::string &meshName,
48  int association, const std::vector<std::string> &arrays);
49 
50  /// @}
51 
52  /// Invoke in situ processing using Ascent
53  bool Execute(DataAdaptor* data, DataAdaptor**) override;
54 
55  /// Shut down and clean up the Ascent library.
56  int Finalize() override;
57 
58 protected:
61 
63  void operator=(const AscentAnalysisAdaptor&) = delete;
64 
65 private:
66  ascent::Ascent _ascent;
67  conduit::Node optionsNode; // Ascent options from json file.
68  conduit::Node actionsNode; // Ascent actions from json file.
69 
70  void GetFieldsFromActions();
71  std::set<std::string> Fields;
72 
73  DataRequirements Requirements;
74 };
75 
76 }
77 
78 #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...
The base class for data consumers.
Definition: AnalysisAdaptor.h:24
This is a helper class that handles the common task of specifying the set of meshes and arrays rqeuir...
Definition: DataRequirements.h:25
SENSEI.
Definition: ADIOS2AnalysisAdaptor.h:27
Base class that defines the interface for fetching data from a simulation.
Definition: DataAdaptor.h:25
An analysis adaptor for ascent-based analysis pipelines.
Definition: AscentAnalysisAdaptor.h:15