VTK  9.2.6
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 =========================================================================*/
37 #ifndef vtkXdmfReader_h
38 #define vtkXdmfReader_h
39 
40 #include "vtkDataObjectAlgorithm.h"
41 #include "vtkIOXdmf2Module.h" // For export macro
42 #include <map> // for caching
43 #include <string> // needed for string API
44 
46 class vtkXdmfDocument;
47 class vtkGraph;
48 class vtkCharArray;
49 
50 class VTKIOXDMF2_EXPORT vtkXdmfReader : public vtkDataObjectAlgorithm
51 {
52 public:
53  static vtkXdmfReader* New();
55  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
57  // Until needed, multiple domains are not supported.
62  // unsigned int GetNumberOfDomains();
63 
65 
72  vtkSetStringMacro(DomainName);
73  vtkGetStringMacro(DomainName);
75 
79  // vtkGetStringMacro(ActiveDomainName);
80 
82 
88 
95 
100  const char* GetPointArrayName(int index);
101 
103 
106  int GetPointArrayStatus(const char* name);
107  void SetPointArrayStatus(const char* name, int status);
109 
111 
117  const char* GetCellArrayName(int index);
118  void SetCellArrayStatus(const char* name, int status);
119  int GetCellArrayStatus(const char* name);
121 
123 
129  const char* GetGridName(int index);
130  void SetGridStatus(const char* gridname, int status);
131  int GetGridStatus(const char* gridname);
133 
135 
142  const char* GetSetName(int index);
143  void SetSetStatus(const char* gridname, int status);
144  int GetSetStatus(const char* gridname);
146 
148 
151  int GetNumberOfSetArrays() { return this->GetNumberOfSets(); }
152  const char* GetSetArrayName(int index) { return this->GetSetName(index); }
153  int GetSetArrayStatus(const char* name) { return this->GetSetStatus(name); }
154  int GetNumberOfGridArrays() { return this->GetNumberOfGrids(); }
155  const char* GetGridArrayName(int index) { return this->GetGridName(index); }
156  int GetGridArrayStatus(const char* name) { return this->GetGridStatus(name); }
158 
160 
164  vtkSetVector3Macro(Stride, int);
165  vtkGetVector3Macro(Stride, int);
167 
171  virtual int CanReadFile(VTK_FILEPATH const char* filename);
172 
174 
177  vtkGetMacro(SILUpdateStamp, int);
179 
184  virtual vtkGraph* GetSIL();
185 
187  {
188  public:
190  : dataset(nullptr)
191  , topologyPath()
192  , geometryPath()
193  {
194  }
198  };
199 
200  typedef std::map<int, XdmfDataSetTopoGeoPath> XdmfReaderCachedData;
201 
206 
208 
212  vtkSetMacro(ReadFromInputString, bool);
213  vtkGetMacro(ReadFromInputString, bool);
214  vtkBooleanMacro(ReadFromInputString, bool);
216 
218 
226  virtual void SetInputArray(vtkCharArray*);
227  vtkGetObjectMacro(InputArray, vtkCharArray);
229 
231 
237  void SetInputString(const char* in);
238  vtkGetStringMacro(InputString);
239  void SetInputString(const char* in, int len);
240  vtkGetMacro(InputStringLength, int);
241  void SetBinaryInputString(const char*, int len);
242  void SetInputString(const std::string& input)
243  {
244  this->SetBinaryInputString(input.c_str(), static_cast<int>(input.length()));
245  }
247 
248 protected:
250  ~vtkXdmfReader() override;
251 
252  char* FileName;
253 
255 
257 
258  char* InputString;
260 
262  vtkInformationVector* outputVector) override;
267 
273 
274  char* DomainName;
275  // char* ActiveDomainName;
276  int Stride[3];
277  unsigned int LastTimeIndex;
278 
280 
281  // Until RequestInformation() is called, the active domain is not set
282  // correctly. If SetGridStatus() etc. are called before that happens, then we
283  // have no place to save the user choices. So we cache them in these temporary
284  // caches. These are passed on to the actual vtkXdmfArraySelection instances
285  // used by the active vtkXdmfDomain in RequestInformation().
286  // Note that these are only used until the first domain is setup, once that
287  // happens, the information set in these is passed to the domain and these
288  // are cleared and no longer used, until the active domain becomes invalid
289  // again.
294 
296 
298 
299 private:
303  bool PrepareDocument();
304 
305  void ClearDataSetCache();
306 
311  int ChooseTimeStep(vtkInformation* outInfo);
312 
313 private:
314  vtkXdmfReader(const vtkXdmfReader&) = delete;
315  void operator=(const vtkXdmfReader&) = delete;
316 };
317 
318 #endif
dynamic, self-adjusting array of char
Definition: vtkCharArray.h:71
Superclass for algorithms that produce only data object as output.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:172
Base class for graph data types.
Definition: vtkGraph.h:345
a simple class to control print indentation
Definition: vtkIndent.h:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Reads eXtensible Data Model and Format files.
Definition: vtkXdmfReader.h:51
const char * GetGridName(int index)
Get/Set information about grids.
vtkXdmfDocument * XdmfDocument
void SetBinaryInputString(const char *, int len)
Specify the InputString for use when reading from a character array.
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)
Get/Set information about sets.
void SetGridStatus(const char *gridname, int status)
Get/Set information about grids.
int GetCellArrayStatus(const char *name)
Get information about cell-based arrays.
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.
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.
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.
int GetNumberOfSets()
Get/Set information about sets.
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 * GetCellArrayName(int index)
Get information about cell-based arrays.
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.
XdmfReaderCachedData & GetDataSetCache()
Get the data set cache.
const char * GetSetName(int index)
Get/Set information about sets.
char * InputString
const char * GetSetArrayName(int index)
These methods are provided to make it easier to use the Sets/Grids in ParaView.
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.
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()
const char * GetGridArrayName(int index)
These methods are provided to make it easier to use the Sets/Grids in ParaView.
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)
Get/Set information about sets.
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
#define VTK_FILEPATH