VTK  9.3.20240329
vtkXdmfReader.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
24 #ifndef vtkXdmfReader_h
25 #define vtkXdmfReader_h
26 
27 #include "vtkDataObjectAlgorithm.h"
28 #include "vtkIOXdmf2Module.h" // For export macro
29 #include <map> // for caching
30 #include <string> // needed for string API
31 
32 VTK_ABI_NAMESPACE_BEGIN
34 class vtkXdmfDocument;
35 class vtkGraph;
36 class vtkCharArray;
37 
38 class VTKIOXDMF2_EXPORT vtkXdmfReader : public vtkDataObjectAlgorithm
39 {
40 public:
41  static vtkXdmfReader* New();
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
45  // Until needed, multiple domains are not supported.
50  // unsigned int GetNumberOfDomains();
51 
53 
60  vtkSetStringMacro(DomainName);
61  vtkGetStringMacro(DomainName);
63 
67  // vtkGetStringMacro(ActiveDomainName);
68 
70 
76 
83 
88  const char* GetPointArrayName(int index);
89 
91 
94  int GetPointArrayStatus(const char* name);
95  void SetPointArrayStatus(const char* name, int status);
97 
99 
105  const char* GetCellArrayName(int index);
106  void SetCellArrayStatus(const char* name, int status);
107  int GetCellArrayStatus(const char* name);
109 
111 
117  const char* GetGridName(int index);
118  void SetGridStatus(const char* gridname, int status);
119  int GetGridStatus(const char* gridname);
121 
123 
130  const char* GetSetName(int index);
131  void SetSetStatus(const char* gridname, int status);
132  int GetSetStatus(const char* gridname);
134 
136 
139  int GetNumberOfSetArrays() { return this->GetNumberOfSets(); }
140  const char* GetSetArrayName(int index) { return this->GetSetName(index); }
141  int GetSetArrayStatus(const char* name) { return this->GetSetStatus(name); }
142  int GetNumberOfGridArrays() { return this->GetNumberOfGrids(); }
143  const char* GetGridArrayName(int index) { return this->GetGridName(index); }
144  int GetGridArrayStatus(const char* name) { return this->GetGridStatus(name); }
146 
148 
152  vtkSetVector3Macro(Stride, int);
153  vtkGetVector3Macro(Stride, int);
155 
159  virtual int CanReadFile(VTK_FILEPATH const char* filename);
160 
162 
165  vtkGetMacro(SILUpdateStamp, int);
167 
172  virtual vtkGraph* GetSIL();
173 
175  {
176  public:
178  : dataset(nullptr)
179  {
180  }
184  };
185 
186  typedef std::map<int, XdmfDataSetTopoGeoPath> XdmfReaderCachedData;
187 
192 
194 
198  vtkSetMacro(ReadFromInputString, bool);
199  vtkGetMacro(ReadFromInputString, bool);
200  vtkBooleanMacro(ReadFromInputString, bool);
202 
204 
212  virtual void SetInputArray(vtkCharArray*);
213  vtkGetObjectMacro(InputArray, vtkCharArray);
215 
217 
223  void SetInputString(const char* in);
224  vtkGetStringMacro(InputString);
225  void SetInputString(const char* in, int len);
226  vtkGetMacro(InputStringLength, int);
227  void SetBinaryInputString(const char*, int len);
228  void SetInputString(const std::string& input)
229  {
230  this->SetBinaryInputString(input.c_str(), static_cast<int>(input.length()));
231  }
233 
234 protected:
236  ~vtkXdmfReader() override;
237 
238  char* FileName;
239 
241 
243 
244  char* InputString;
246 
248  vtkInformationVector* outputVector) override;
253 
259 
260  char* DomainName;
261  // char* ActiveDomainName;
262  int Stride[3];
263  unsigned int LastTimeIndex;
264 
266 
267  // Until RequestInformation() is called, the active domain is not set
268  // correctly. If SetGridStatus() etc. are called before that happens, then we
269  // have no place to save the user choices. So we cache them in these temporary
270  // caches. These are passed on to the actual vtkXdmfArraySelection instances
271  // used by the active vtkXdmfDomain in RequestInformation().
272  // Note that these are only used until the first domain is setup, once that
273  // happens, the information set in these is passed to the domain and these
274  // are cleared and no longer used, until the active domain becomes invalid
275  // again.
280 
282 
284 
285 private:
289  bool PrepareDocument();
290 
291  void ClearDataSetCache();
292 
297  int ChooseTimeStep(vtkInformation* outInfo);
298 
299  vtkXdmfReader(const vtkXdmfReader&) = delete;
300  void operator=(const vtkXdmfReader&) = delete;
301 };
302 
303 VTK_ABI_NAMESPACE_END
304 #endif
dynamic, self-adjusting array of char
Definition: vtkCharArray.h:60
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:340
a simple class to control print indentation
Definition: vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Reads eXtensible Data Model and Format files.
Definition: vtkXdmfReader.h:39
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:376
@ port
Definition: vtkX3D.h:447
@ name
Definition: vtkX3D.h:219
@ index
Definition: vtkX3D.h:246
@ string
Definition: vtkX3D.h:490
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_FILEPATH