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 #ifndef __VTK_WRAP__
20 #ifndef VTK_WRAPPING_CXX
21 
22 #include <stdexcept>
23 #include <string>
24 #include <vector>
25 
26 #include <adios_mpi.h>
27 
28 #include "ADIOSAttribute.h"
29 #include "ADIOSDefs.h"
30 #include "ADIOSScalar.h"
31 #include "ADIOSVarInfo.h"
32 
33 namespace ADIOS
34 {
35 
36 class Reader
37 {
38 public:
39  static bool SetCommunicator(MPI_Comm);
40  static bool SetReadMethod(ReadMethod, const std::string&);
41 
42  Reader();
43  ~Reader();
44 
45  // Description:
46  // Open the ADIOS file and cache the variable names and scalar data
47  void Open(const std::string &fileName);
48 
49  // Description:
50  // Close an already open file handle and free it's resources
51  void Close();
52 
53  // Description:
54  // Retrieve the total number of seps
55  void GetStepRange(int &tStart, int &tEnd) const;
56 
57  // Description:
58  // Retrieve a list of attributes
59  const std::vector<const Attribute*>& GetAttributes() const;
60 
61  // Description:
62  // Retrieve a list of scalars and their associated metadata
63  const std::vector<const Scalar*>& GetScalars() const;
64 
65  // Description:
66  // Retrieve a list of arrays and their associated metadata
67  const std::vector<const VarInfo*>& GetArrays() const;
68 
69  // Description:
70  // Schedule array data to be read. Data will be read with ReadArrays.
71  // step specified the time step index to read and block specifies the
72  // write block index to read (-1 means use whatever your current mpi rank is)
73  void ScheduleReadArray(int id, void *data, int step, int block);
74 
75  // Description:
76  // Perform all scheduled array read operations
77  void ReadArrays();
78 
79  // Description:
80  // Whether or not the file / stream is already open
81  bool IsOpen() const;
82 
83 private:
84  // Initialization context to manage one-time init and finalize of ADIOS
85  struct InitContext;
86  InitContext *Ctx;
87 
88  // ADIOS specific implementation details (file handles, group sizes, etc.)
89  struct ReaderImpl;
90  ReaderImpl *Impl;
91 };
92 
93 } // End anmespace ADIOS
94 #endif
95 #endif
96 #endif
97 // 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:49
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)