VTK  9.1.0
VTXSchema.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: VTXSchema.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
16/*
17 * VTXSchema.h : abstract class from which all supported adios2 schemas
18 * derive from. Provide common functionality.
19 *
20 * Created on: May 6, 2019
21 * Author: William F Godoy godoywf@ornl.gov
22 */
23
24#ifndef VTK_IO_ADIOS2_VTX_SCHEMA_VTXSchema_h
25#define VTK_IO_ADIOS2_VTX_SCHEMA_VTXSchema_h
26
27#include <map>
28#include <string>
29
31
32#include <adios2.h>
33
35#include "VTX/common/VTXTypes.h"
36
37namespace vtx
38{
43{
44public:
46 const std::string Type;
47
49 std::string Schema;
50
58 std::map<double, size_t> Times;
59
68 const std::string& type, const std::string& schema, adios2::IO& io, adios2::Engine& engine);
69
70 // can't use = default, due to forward class not defined
71 virtual ~VTXSchema();
72
78 void Fill(vtkMultiBlockDataSet* multiBlock, const size_t step = 0);
79
80protected:
81 adios2::IO& IO;
82 adios2::Engine& Engine;
83
84 virtual void Init() = 0;
85 virtual void InitTimes() = 0;
86
87 virtual void DoFill(vtkMultiBlockDataSet* multiBlock, const size_t step) = 0;
88 virtual void ReadPiece(const size_t step, const size_t pieceID) = 0;
89
90 void GetTimes(const std::string& variableName = "");
92 const std::string& variableName, types::DataArray& dataArray, const size_t step = 0);
93
94#define declare_type(T) \
95 virtual void SetDimensions( \
96 adios2::Variable<T> variable, const types::DataArray& dataArray, const size_t step); \
97 \
98 virtual void SetBlocks( \
99 adios2::Variable<T> variable, types::DataArray& dataArray, const size_t step);
100
102#undef declare_type
103
104private:
105 template <class T>
106 void GetDataArrayCommon(
107 adios2::Variable<T> variable, types::DataArray& dataArray, const size_t step);
108
109 template <class T>
110 void GetDataArrayGlobal(
111 adios2::Variable<T> variable, types::DataArray& dataArray, const size_t step);
112
113 template <class T>
114 void GetDataArrayLocal(
115 adios2::Variable<T> variable, types::DataArray& dataArray, const size_t step);
116
117 template <class T>
118 void GetDataValueGlobal(
119 adios2::Variable<T> variable, types::DataArray& dataArray, const size_t step);
120
121 template <class T>
122 void GetTimesCommon(const std::string& variableName);
123
124 template <class T>
125 void InitDataArray(const std::string& name, const size_t elements, const size_t components,
126 types::DataArray& dataArray);
127};
128
129} // end namespace vtx
130
131#endif /* VTK_IO_ADIOS2_VTX_SCHEMA_VTXSchema_h */
#define VTK_IO_ADIOS2_VTX_ARRAY_TYPE(MACRO)
Definition: VTXTypes.h:56
#define declare_type(T)
Definition: VTXvtkVTI.h:60
Composite dataset that organizes datasets into blocks.
Abstract common class to supported ADIOS2 schemas.
Definition: VTXSchema.h:43
void GetDataArray(const std::string &variableName, types::DataArray &dataArray, const size_t step=0)
void Fill(vtkMultiBlockDataSet *multiBlock, const size_t step=0)
Fills multiblock data from request steps.
void GetTimes(const std::string &variableName="")
virtual ~VTXSchema()
virtual void DoFill(vtkMultiBlockDataSet *multiBlock, const size_t step)=0
VTXSchema(const std::string &type, const std::string &schema, adios2::IO &io, adios2::Engine &engine)
Generic base constructor.
std::string Schema
schema contents as a single string
Definition: VTXSchema.h:49
std::map< double, size_t > Times
Stored times and corresponding steps.
Definition: VTXSchema.h:58
adios2::IO & IO
Definition: VTXSchema.h:81
adios2::Engine & Engine
Definition: VTXSchema.h:82
const std::string Type
carries schema type from derived class
Definition: VTXSchema.h:46
virtual void Init()=0
virtual void ReadPiece(const size_t step, const size_t pieceID)=0
virtual void InitTimes()=0