VTK  9.1.0
vtkXdmfReader.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkXdmfReader.h
5 Language: C++
6
7 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
8 All rights reserved.
9 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
10
11 This software is distributed WITHOUT ANY WARRANTY; without even
12 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE. See the above copyright notice for more information.
14
15=========================================================================*/
34#ifndef vtkXdmfReader_h
35#define vtkXdmfReader_h
36
38#include "vtkIOXdmf2Module.h" // For export macro
39#include <map> // for caching
40#include <string> // needed for string API
41
43class vtkXdmfDocument;
44class vtkGraph;
45class vtkCharArray;
46
47class VTKIOXDMF2_EXPORT vtkXdmfReader : public vtkDataObjectAlgorithm
48{
49public:
50 static vtkXdmfReader* New();
52 void PrintSelf(ostream& os, vtkIndent indent) override;
53
54 // Until needed, multiple domains are not supported.
59 // unsigned int GetNumberOfDomains();
60
62
69 vtkSetStringMacro(DomainName);
70 vtkGetStringMacro(DomainName);
72
76 // vtkGetStringMacro(ActiveDomainName);
77
79
85
92
97 const char* GetPointArrayName(int index);
98
100
103 int GetPointArrayStatus(const char* name);
104 void SetPointArrayStatus(const char* name, int status);
106
108
114 const char* GetCellArrayName(int index);
115 void SetCellArrayStatus(const char* name, int status);
116 int GetCellArrayStatus(const char* name);
118
120
126 const char* GetGridName(int index);
127 void SetGridStatus(const char* gridname, int status);
128 int GetGridStatus(const char* gridname);
130
132
139 const char* GetSetName(int index);
140 void SetSetStatus(const char* gridname, int status);
141 int GetSetStatus(const char* gridname);
143
145
148 int GetNumberOfSetArrays() { return this->GetNumberOfSets(); }
149 const char* GetSetArrayName(int index) { return this->GetSetName(index); }
150 int GetSetArrayStatus(const char* name) { return this->GetSetStatus(name); }
151 int GetNumberOfGridArrays() { return this->GetNumberOfGrids(); }
152 const char* GetGridArrayName(int index) { return this->GetGridName(index); }
153 int GetGridArrayStatus(const char* name) { return this->GetGridStatus(name); }
155
157
161 vtkSetVector3Macro(Stride, int);
162 vtkGetVector3Macro(Stride, int);
164
168 virtual int CanReadFile(VTK_FILEPATH const char* filename);
169
171
174 vtkGetMacro(SILUpdateStamp, int);
176
181 virtual vtkGraph* GetSIL();
182
184 {
185 public:
187 : dataset(0)
188 , topologyPath()
189 , geometryPath()
190 {
191 }
193 std::string topologyPath;
194 std::string geometryPath;
195 };
196
197 typedef std::map<int, XdmfDataSetTopoGeoPath> XdmfReaderCachedData;
198
203
205
209 vtkSetMacro(ReadFromInputString, bool);
210 vtkGetMacro(ReadFromInputString, bool);
211 vtkBooleanMacro(ReadFromInputString, bool);
213
215
224 vtkGetObjectMacro(InputArray, vtkCharArray);
226
228
234 void SetInputString(const char* in);
235 vtkGetStringMacro(InputString);
236 void SetInputString(const char* in, int len);
237 vtkGetMacro(InputStringLength, int);
238 void SetBinaryInputString(const char*, int len);
239 void SetInputString(const std::string& input)
240 {
241 this->SetBinaryInputString(input.c_str(), static_cast<int>(input.length()));
242 }
244
245protected:
247 ~vtkXdmfReader() override;
248
249 char* FileName;
250
252
254
258
260 vtkInformationVector* outputVector) override;
264 int FillOutputPortInformation(int port, vtkInformation* info) override;
265
271
273 // char* ActiveDomainName;
274 int Stride[3];
275 unsigned int LastTimeIndex;
276
278
279 // Until RequestInformation() is called, the active domain is not set
280 // correctly. If SetGridStatus() etc. are called before that happens, then we
281 // have no place to save the user choices. So we cache them in these temporary
282 // caches. These are passed on to the actual vtkXdmfArraySelection instances
283 // used by the active vtkXdmfDomain in RequestInformation().
284 // Note that these are only used until the first domain is setup, once that
285 // happens, the information set in these is passed to the domain and these
286 // are cleared an no longer used, until the active domain becomes invalid
287 // again.
292
294
296
297private:
301 bool PrepareDocument();
302
303 void ClearDataSetCache();
304
309 int ChooseTimeStep(vtkInformation* outInfo);
310
311private:
312 vtkXdmfReader(const vtkXdmfReader&) = delete;
313 void operator=(const vtkXdmfReader&) = delete;
314};
315
316#endif
dynamic, self-adjusting array of char
Definition: vtkCharArray.h:68
Superclass for algorithms that produce only data object as output.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:166
Base class for graph data types.
Definition: vtkGraph.h:339
a simple class to control print indentation
Definition: vtkIndent.h:113
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Reads eXtensible Data Model and Format files.
Definition: vtkXdmfReader.h:48
XdmfReaderCachedData & GetDataSetCache()
Get the data set cache.
vtkXdmfDocument * XdmfDocument
void SetBinaryInputString(const char *, int len)
Specify the InputString for use when reading from a character array.
vtkXdmfArraySelection * GridsCache
vtkXdmfArraySelection * GetSetsSelection()
const char * GetSetName(int index)
Get/Set information about sets.
int GetNumberOfPointArrays()
Get information about point-based arrays.
unsigned int LastTimeIndex
std::map< int, XdmfDataSetTopoGeoPath > XdmfReaderCachedData
vtkCharArray * InputArray
int GetSetStatus(const char *gridname)
Get/Set information about sets.
void SetGridStatus(const char *gridname, int status)
Get/Set information about grids.
vtkXdmfArraySelection * GetCellArraySelection()
int GetCellArrayStatus(const char *name)
Get information about cell-based arrays.
const char * GetGridArrayName(int index)
These methods are provided to make it easier to use the Sets/Grids in ParaView.
vtkXdmfArraySelection * SetsCache
int GetGridArrayStatus(const char *name)
These methods are provided to make it easier to use the Sets/Grids in ParaView.
int GetNumberOfGridArrays()
These methods are provided to make it easier to use the Sets/Grids in ParaView.
void SetInputString(const char *in, int len)
Specify the InputString for use when reading from a character array.
void SetPointArrayStatus(const char *name, int status)
Get/Set the point array status.
static vtkXdmfReader * New()
vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
see vtkAlgorithm for details
virtual vtkGraph * GetSIL()
SIL describes organization of/relationships between classifications eg.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkXdmfArraySelection * GetGridSelection()
vtkGetFilePathMacro(FileName)
Name of the file to read.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
virtual int CanReadFile(VTK_FILEPATH const char *filename)
Determine if the file can be read with this reader.
const char * GetPointArrayName(int index)
Returns the name of point array at the give index.
int GetNumberOfSets()
Get/Set information about sets.
vtkXdmfArraySelection * GetPointArraySelection()
vtkXdmfArraySelection * CellArraysCache
void PassCachedSelections()
void SetCellArrayStatus(const char *name, int status)
Get information about cell-based arrays.
XdmfReaderCachedData DataSetCache
void SetInputString(const char *in)
Specify the InputString for use when reading from a character array.
int GetSetArrayStatus(const char *name)
These methods are provided to make it easier to use the Sets/Grids in ParaView.
~vtkXdmfReader() override
const char * GetGridName(int index)
Get/Set information about grids.
const char * GetSetArrayName(int index)
These methods are provided to make it easier to use the Sets/Grids in ParaView.
int FillOutputPortInformation(int port, vtkInformation *info) override
Fill the output port information objects for this algorithm.
int GetNumberOfSetArrays()
These methods are provided to make it easier to use the Sets/Grids in ParaView.
virtual void SetInputArray(vtkCharArray *)
Specify the vtkCharArray to be used when reading from a string.
int GetPointArrayStatus(const char *name)
Get/Set the point array status.
const char * GetCellArrayName(int index)
Get information about cell-based arrays.
char * InputString
int GetGridStatus(const char *gridname)
Get/Set information about grids.
void SetInputString(const std::string &input)
Specify the InputString for use when reading from a character array.
vtkSetFilePathMacro(FileName)
Name of the file to read.
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
int GetNumberOfGrids()
Get/Set information about grids.
virtual int RequestDataObjectInternal(vtkInformationVector *outputVector)
vtkXdmfArraySelection * PointArraysCache
void SetSetStatus(const char *gridname, int status)
Get/Set information about sets.
int GetNumberOfCellArrays()
Get information about cell-based arrays.
bool ReadFromInputString
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_FILEPATH