forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkSimpleReader.h
138 lines (113 loc) · 4.62 KB
/
vtkSimpleReader.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*=========================================================================
Program: Visualization Toolkit
Module: vtkSimpleReader.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkSimpleReader
* @brief Superclass for algorithms that are not time or parallel aware
*
*/
#ifndef vtkSimpleReader_h
#define vtkSimpleReader_h
#include "vtkCommonExecutionModelModule.h" // For export macro
#include "vtkReaderAlgorithm.h"
#include <string> // needed for std::string in the interface
struct vtkSimpleReaderInternal;
class VTKCOMMONEXECUTIONMODEL_EXPORT vtkSimpleReader : public vtkReaderAlgorithm
{
public:
vtkTypeMacro(vtkSimpleReader, vtkReaderAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent) override;
/**
* Add a filename to be read. Since this superclass handles
* file series to support time, multiple filenames can be added.
* Note that the time values are either integers growing sequentially,
* or are obtained from individual files as supported by the subclass.
*/
void AddFileName(VTK_FILEPATH const char* fname);
/**
* Removes all filenames stored by the reader.
*/
void ClearFileNames();
/**
* Returns the number of filenames stored by the reader.
*/
int GetNumberOfFileNames() const;
/**
* Returns a particular filename stored by the reader.
*/
VTK_FILEPATH const char* GetFileName(int i) const;
/**
* Returns the filename that was last loaded by the reader.
* This is set internally in ReadMesh()
*/
VTK_FILEPATH const char* GetCurrentFileName() const;
///@{
/**
* This is the superclass API overridden by this class
* to provide time support internally. Subclasses should
* not normally have to override these methods.
*/
int ReadTimeDependentMetaData(int timestep, vtkInformation* metadata) override;
int ReadMetaData(vtkInformation* metadata) override;
int ReadMesh(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
int ReadPoints(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
int ReadArrays(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
///@}
/**
* A subclass can override this method to provide an actual
* time value for a given file (this method is called for
* each filename stored by the reader). If time values is not
* available, the subclass does not have to override. This
* will return vtkMath::NaN() if no time value is present
* in the file.
*/
virtual double GetTimeValue(VTK_FILEPATH const std::string& fname);
/**
* A subclass can override this method to provide meta data
* specific to a particular file. In order for this method
* to be called, HasTemporalMetaData has to be set to true.
*/
virtual int ReadMetaDataSimple(
VTK_FILEPATH const std::string& /*fname*/, vtkInformation* /*metadata*/)
{
return 1;
}
/**
* A method that needs to be override by the subclass to provide
* the mesh (topology). Note that the filename is passed to this
* method and should be used by the subclass. The subclass directly
* adds the structure/topology to the provided data object.
*/
virtual int ReadMeshSimple(VTK_FILEPATH const std::string& fname, vtkDataObject* output) = 0;
/**
* A method that needs to be override by the subclass to provide
* the point coordinates. Note that the filename is passed to this
* method and should be used by the subclass. The subclass directly
* adds the coordinates to the provided data object.
*/
virtual int ReadPointsSimple(VTK_FILEPATH const std::string& fname, vtkDataObject* output) = 0;
/**
* A method that needs to be override by the subclass to provide
* data arrays. Note that the filename is passed to this
* method and should be used by the subclass. The subclass directly
* adds data arrays to the provided data object.
*/
virtual int ReadArraysSimple(VTK_FILEPATH const std::string& fname, vtkDataObject* output) = 0;
protected:
vtkSimpleReader();
~vtkSimpleReader() override;
int CurrentFileIndex;
bool HasTemporalMetaData;
private:
vtkSimpleReader(const vtkSimpleReader&) = delete;
void operator=(const vtkSimpleReader&) = delete;
vtkSimpleReaderInternal* Internal;
};
#endif