VTK  9.4.20241219
VTXSchema.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
3
4/*
5 * VTXSchema.h : abstract class from which all supported adios2 schemas
6 * derive from. Provide common functionality.
7 *
8 * Created on: May 6, 2019
9 * Author: William F Godoy godoywf@ornl.gov
10 */
11
12#ifndef VTK_IO_ADIOS2_VTX_SCHEMA_VTXSchema_h
13#define VTK_IO_ADIOS2_VTX_SCHEMA_VTXSchema_h
14
15#include <map>
16#include <string>
17
19
20#include <adios2.h>
21
23#include "VTX/common/VTXTypes.h"
24
25namespace vtx
26{
27VTK_ABI_NAMESPACE_BEGIN
32{
33public:
35 const std::string Type;
36
38 std::string Schema;
39
47 std::map<double, size_t> Times;
48
57 const std::string& type, const std::string& schema, adios2::IO& io, adios2::Engine& engine);
58
59 // can't use = default, due to forward class not defined
60 virtual ~VTXSchema();
61
67 void Fill(vtkMultiBlockDataSet* multiBlock, size_t step = 0);
68
69protected:
70 adios2::IO& IO;
71 adios2::Engine& Engine;
72
73 virtual void Init() = 0;
74 virtual void InitTimes() = 0;
75
76 virtual void DoFill(vtkMultiBlockDataSet* multiBlock, size_t step) = 0;
77 virtual void ReadPiece(size_t step, size_t pieceID) = 0;
78
79 void GetTimes(const std::string& variableName = "");
80 void GetDataArray(const std::string& variableName, types::DataArray& dataArray, size_t step = 0);
81
82#define declare_type(T) \
83 virtual void SetDimensions( \
84 adios2::Variable<T> variable, const types::DataArray& dataArray, size_t step); \
85 \
86 virtual void SetBlocks(adios2::Variable<T> variable, types::DataArray& dataArray, size_t step);
87
89#undef declare_type
90
91private:
92 template <class T>
93 void GetDataArrayCommon(adios2::Variable<T> variable, types::DataArray& dataArray, size_t step);
94
95 template <class T>
96 void GetDataArrayGlobal(adios2::Variable<T> variable, types::DataArray& dataArray, size_t step);
97
98 template <class T>
99 void GetDataArrayLocal(adios2::Variable<T> variable, types::DataArray& dataArray, size_t step);
100
101 template <class T>
102 void GetDataValueGlobal(adios2::Variable<T> variable, types::DataArray& dataArray, size_t step);
103
104 template <class T>
105 void GetTimesCommon(const std::string& variableName);
106
107 template <class T>
108 void InitDataArray(
109 const std::string& name, size_t elements, size_t components, types::DataArray& dataArray);
110};
111
112VTK_ABI_NAMESPACE_END
113} // end namespace vtx
114
115#endif /* VTK_IO_ADIOS2_VTX_SCHEMA_VTXSchema_h */
#define VTK_IO_ADIOS2_VTX_ARRAY_TYPE(MACRO)
Definition VTXTypes.h:45
#define declare_type(T)
Definition VTXvtkVTI.h:49
Composite dataset that organizes datasets into blocks.
Abstract common class to supported ADIOS2 schemas.
Definition VTXSchema.h:32
virtual void ReadPiece(size_t step, size_t pieceID)=0
void GetTimes(const std::string &variableName="")
virtual ~VTXSchema()
VTXSchema(const std::string &type, const std::string &schema, adios2::IO &io, adios2::Engine &engine)
Generic base constructor.
virtual void DoFill(vtkMultiBlockDataSet *multiBlock, size_t step)=0
std::string Schema
schema contents as a single string
Definition VTXSchema.h:38
std::map< double, size_t > Times
Stored times and corresponding steps.
Definition VTXSchema.h:47
adios2::IO & IO
Definition VTXSchema.h:70
adios2::Engine & Engine
Definition VTXSchema.h:71
const std::string Type
carries schema type from derived class
Definition VTXSchema.h:35
void Fill(vtkMultiBlockDataSet *multiBlock, size_t step=0)
Fills multiblock data from request steps.
void GetDataArray(const std::string &variableName, types::DataArray &dataArray, size_t step=0)
virtual void Init()=0
virtual void InitTimes()=0