VTK  9.0.3
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 
37 #include "vtkDataObjectAlgorithm.h"
38 #include "vtkIOXdmf2Module.h" // For export macro
39 #include <map> // for caching
40 #include <string> // needed for string API
41 
43 class vtkXdmfDocument;
44 class vtkGraph;
45 class vtkCharArray;
46 
47 class VTKIOXDMF2_EXPORT vtkXdmfReader : public vtkDataObjectAlgorithm
48 {
49 public:
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 
82  vtkSetStringMacro(FileName);
83  vtkGetStringMacro(FileName);
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 
147  int GetNumberOfSetArrays() { return this->GetNumberOfSets(); }
148  const char* GetSetArrayName(int index) { return this->GetSetName(index); }
149  int GetSetArrayStatus(const char* name) { return this->GetSetStatus(name); }
150 
152 
156  vtkSetVector3Macro(Stride, int);
157  vtkGetVector3Macro(Stride, int);
159 
163  virtual int CanReadFile(const char* filename);
164 
166 
169  vtkGetMacro(SILUpdateStamp, int);
171 
176  virtual vtkGraph* GetSIL();
177 
179  {
180  public:
182  : dataset(0)
183  , topologyPath()
184  , geometryPath()
185  {
186  }
190  };
191 
192  typedef std::map<int, XdmfDataSetTopoGeoPath> XdmfReaderCachedData;
193 
198 
200 
204  vtkSetMacro(ReadFromInputString, bool);
205  vtkGetMacro(ReadFromInputString, bool);
206  vtkBooleanMacro(ReadFromInputString, bool);
208 
210 
218  virtual void SetInputArray(vtkCharArray*);
219  vtkGetObjectMacro(InputArray, vtkCharArray);
221 
223 
229  void SetInputString(const char* in);
230  vtkGetStringMacro(InputString);
231  void SetInputString(const char* in, int len);
232  vtkGetMacro(InputStringLength, int);
233  void SetBinaryInputString(const char*, int len);
234  void SetInputString(const std::string& input)
235  {
236  this->SetBinaryInputString(input.c_str(), static_cast<int>(input.length()));
237  }
239 
240 protected:
242  ~vtkXdmfReader() override;
243 
244  char* FileName;
245 
247 
249 
250  char* InputString;
253 
255  vtkInformationVector* outputVector) override;
260 
266 
267  char* DomainName;
268  // char* ActiveDomainName;
269  int Stride[3];
270  unsigned int LastTimeIndex;
271 
273 
274  // Until RequestInformation() is called, the active domain is not set
275  // correctly. If SetGridStatus() etc. are called before that happens, then we
276  // have no place to save the user choices. So we cache them in these temporary
277  // caches. These are passed on to the actual vtkXdmfArraySelection instances
278  // used by the active vtkXdmfDomain in RequestInformation().
279  // Note that these are only used until the first domain is setup, once that
280  // happens, the information set in these is passed to the domain and these
281  // are cleared an no longer used, until the active domain becomes invalid
282  // again.
287 
289 
291 
292 private:
296  bool PrepareDocument();
297 
298  void ClearDataSetCache();
299 
304  int ChooseTimeStep(vtkInformation* outInfo);
305 
306 private:
307  vtkXdmfReader(const vtkXdmfReader&) = delete;
308  void operator=(const vtkXdmfReader&) = delete;
309 };
310 
311 #endif
dynamic, self-adjusting array of char
Definition: vtkCharArray.h:36
Superclass for algorithms that produce only data object as output.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:57
Base class for graph data types.
Definition: vtkGraph.h:290
a simple class to control print indentation
Definition: vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Reads eXtensible Data Model and Format files.
Definition: vtkXdmfReader.h:48
const char * GetGridName(int index)
vtkXdmfDocument * XdmfDocument
void SetBinaryInputString(const char *, int len)
vtkXdmfArraySelection * GridsCache
int GetNumberOfPointArrays()
Get information about point-based arrays.
unsigned int LastTimeIndex
vtkXdmfArraySelection * GetSetsSelection()
std::map< int, XdmfDataSetTopoGeoPath > XdmfReaderCachedData
vtkCharArray * InputArray
vtkXdmfArraySelection * GetCellArraySelection()
int GetSetStatus(const char *gridname)
void SetGridStatus(const char *gridname, int status)
int GetCellArrayStatus(const char *name)
vtkXdmfArraySelection * SetsCache
void SetInputString(const char *in, int len)
void SetPointArrayStatus(const char *name, int status)
vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
see vtkAlgorithm for details
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
virtual int CanReadFile(const char *filename)
Determine if the file can be read with this reader.
int GetNumberOfSets()
Get/Set information about sets.
vtkXdmfArraySelection * CellArraysCache
void PassCachedSelections()
void SetCellArrayStatus(const char *name, int status)
XdmfReaderCachedData DataSetCache
void SetInputString(const char *in)
Specify the InputString for use when reading from a character array.
int GetSetArrayStatus(const char *name)
~vtkXdmfReader() override
const char * GetCellArrayName(int index)
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 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.
XdmfReaderCachedData & GetDataSetCache()
Get the data set cache.
const char * GetSetName(int index)
char * InputString
const char * GetSetArrayName(int index)
int GetGridStatus(const char *gridname)
void SetInputString(const std::string &input)
const char * GetPointArrayName(int index)
Returns the name of point array at the give index.
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
static vtkXdmfReader * New()
vtkXdmfArraySelection * GetPointArraySelection()
int GetNumberOfGrids()
Get/Set information about grids.
vtkXdmfArraySelection * GetGridSelection()
virtual int RequestDataObjectInternal(vtkInformationVector *outputVector)
virtual vtkGraph * GetSIL()
SIL describes organization of/relationships between classifications eg.
vtkXdmfArraySelection * PointArraysCache
void SetSetStatus(const char *gridname, int status)
int GetNumberOfCellArrays()
Get information about cell-based arrays.
bool ReadFromInputString
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
@ name
Definition: vtkX3D.h:225
@ index
Definition: vtkX3D.h:252
@ string
Definition: vtkX3D.h:496
int vtkTypeBool
Definition: vtkABI.h:69