VTK
ADIOSReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: ADIOSReader.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 // .NAME ADIOSReader - The utility class performing ADIOS read operations
16 
17 #ifndef _ADIOSReader_h
18 #define _ADIOSReader_h
19 
20 #include <stdexcept>
21 #include <string>
22 #include <vector>
23 
24 #include <adios_mpi.h>
25 
26 #include "ADIOSAttribute.h"
27 #include "ADIOSDefs.h"
28 #include "ADIOSScalar.h"
29 #include "ADIOSVarInfo.h"
30 
31 namespace ADIOS
32 {
33 
34 class Reader
35 {
36 public:
37  static bool SetCommunicator(MPI_Comm);
38  static bool SetReadMethod(ReadMethod, const std::string&);
39 
40  Reader();
41  ~Reader();
42 
43  // Description:
44  // Open the ADIOS file and cache the variable names and scalar data
45  void Open(const std::string &fileName);
46 
47  // Description:
48  // Close an already open file handle and free it's resources
49  void Close();
50 
51  // Description:
52  // Retrieve the total number of seps
53  void GetStepRange(int &tStart, int &tEnd) const;
54 
55  // Description:
56  // Retrieve a list of attributes
57  const std::vector<const Attribute*>& GetAttributes() const;
58 
59  // Description:
60  // Retrieve a list of scalars and thier associated metadata
61  const std::vector<const Scalar*>& GetScalars() const;
62 
63  // Description:
64  // Retrieve a list of arrays and thier associated metadata
65  const std::vector<const VarInfo*>& GetArrays() const;
66 
67  // Description:
68  // Schedule array data to be read. Data will be read with ReadArrays.
69  // step specified the time step index to read and block specifies the
70  // write block index to read (-1 means use whatever your current mpi rank is)
71  void ScheduleReadArray(int id, void *data, int step, int block);
72 
73  // Description:
74  // Perform all scheduled array read operations
75  void ReadArrays();
76 
77  // Description:
78  // Whether or not the file / stream is already open
79  bool IsOpen() const;
80 
81 private:
82  // Initialization context to manage one-time init and finalize of ADIOS
83  struct InitContext;
84  InitContext *Ctx;
85 
86  // ADIOS specific implementation details (file handles, group sizes, etc.)
87  struct ReaderImpl;
88  ReaderImpl *Impl;
89 };
90 
91 } // End anmespace ADIOS
92 #endif
93 // VTK-HeaderTest-Exclude: ADIOSReader.h
const std::vector< const Attribute * > & GetAttributes() const
bool IsOpen() const
static bool SetCommunicator(MPI_Comm)
static bool SetReadMethod(ReadMethod, const std::string &)
void GetStepRange(int &tStart, int &tEnd) const
ReadMethod
Definition: ADIOSDefs.h:48
void ReadArrays()
void ScheduleReadArray(int id, void *data, int step, int block)
const std::vector< const Scalar * > & GetScalars() const
const std::vector< const VarInfo * > & GetArrays() const
void Open(const std::string &fileName)