forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkParallelReader.h
131 lines (107 loc) · 4.46 KB
/
vtkParallelReader.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
/*=========================================================================
Program: Visualization Toolkit
Module: vtkParallelReader.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 vtkParallelReader
* @brief Superclass for algorithms that are parallel aware
*
* vtkParallelReader is a vtkReaderAlgorithm subclass that provides
* a specialized API to develop readers that are parallel aware (i.e.
* can handle piece requests) but do not natively support time series.
* This reader adds support for file series in order to support time
* series.
*/
#ifndef vtkParallelReader_h
#define vtkParallelReader_h
#include "vtkCommonExecutionModelModule.h" // For export macro
#include "vtkReaderAlgorithm.h"
#include <string> // needed for std::string in the interface
struct vtkParallelReaderInternal;
class VTKCOMMONEXECUTIONMODEL_EXPORT vtkParallelReader : public vtkReaderAlgorithm
{
public:
vtkTypeMacro(vtkParallelReader, 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 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;
///@}
protected:
vtkParallelReader();
~vtkParallelReader() 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.
*/
virtual double GetTimeValue(const std::string& fname);
/**
* 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 ReadMesh(
const std::string& fname, int piece, int npieces, int nghosts, 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 ReadPoints(
const std::string& fname, int piece, int npieces, int nghosts, 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 ReadArrays(
const std::string& fname, int piece, int npieces, int nghosts, vtkDataObject* output) = 0;
int CurrentFileIndex;
private:
vtkParallelReader(const vtkParallelReader&) = delete;
void operator=(const vtkParallelReader&) = delete;
vtkParallelReaderInternal* Internal;
};
#endif