VTK
ADIOSScalar.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: ADIOSScalar.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 ADIOSScalar - The utility class wrapping the ADIOS_VARINFO struct
16
17#ifndef _ADIOSScalar_h
18#define _ADIOSScalar_h
19
20#include <string>
21#include <vector>
22
23#include "ADIOSUtilities.h"
24
25#include "ADIOSVarInfo.h"
26
27//----------------------------------------------------------------------------
28namespace ADIOS
29{
30
31class Scalar : public VarInfo
32{
33public:
34 Scalar(ADIOS_FILE *f, ADIOS_VARINFO *v);
35 virtual ~Scalar(void);
36
37 template<typename T>
38 const T& GetValue(size_t step, size_t block) const
39 {
40 ReadError::TestEq(this->Type, Type::NativeToADIOS<T>(), "Invalid type");
41
42 StepBlock* idx = this->GetNewestBlockIndex(step, block);
43 ReadError::TestNe<StepBlock*>(NULL, idx, "Variable not available");
44
45 return reinterpret_cast<const T*>(this->Values)[idx->BlockId];
46 }
47
48protected:
49 void *Values;
50};
51
52} // End namespace ADIOS
53#endif // _ADIOSScalar_h
54// VTK-HeaderTest-Exclude: ADIOSScalar.h
static void TestEq(const T &expected, const T &actual, const std::string &msg="")
void * Values
Definition: ADIOSScalar.h:49
Scalar(ADIOS_FILE *f, ADIOS_VARINFO *v)
const T & GetValue(size_t step, size_t block) const
Definition: ADIOSScalar.h:38
virtual ~Scalar(void)
ADIOS_DATATYPES Type
Definition: ADIOSVarInfo.h:57
StepBlock * GetNewestBlockIndex(size_t step, size_t pid) const