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 
85  vtkSetFilePathMacro(FileName);
86  vtkGetFilePathMacro(FileName);
88 
94  int GetNumberOfPointArrays();
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 
116  int GetNumberOfCellArrays();
117  const char* GetCellArrayName(int index);
118  void SetCellArrayStatus(const char* name, int status);
119  int GetCellArrayStatus(const char* name);
121 
123 
128  int GetNumberOfGrids();
129  const char* GetGridName(int index);
130  void SetGridStatus(const char* gridname, int status);
131  int GetGridStatus(const char* gridname);
133 
135 
141  int GetNumberOfSets();
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 
205  XdmfReaderCachedData& GetDataSetCache();
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:
249  vtkXdmfReader();
250  ~vtkXdmfReader() override;
251 
252  char* FileName;
253 
255 
257 
258  char* InputString;
260 
262  vtkInformationVector* outputVector) override;
263  virtual int RequestDataObjectInternal(vtkInformationVector* outputVector);
267 
268  vtkXdmfArraySelection* GetPointArraySelection();
269  vtkXdmfArraySelection* GetCellArraySelection();
270  vtkXdmfArraySelection* GetGridSelection();
271  vtkXdmfArraySelection* GetSetsSelection();
272  void PassCachedSelections();
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 
297  XdmfReaderCachedData DataSetCache;
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
int GetNumberOfGridArrays()
These methods are provided to make it easier to use the Sets/Grids in ParaView.
void SetInputString(const std::string &input)
Specify the InputString for use when reading from a character array.
int GetGridArrayStatus(const char *name)
These methods are provided to make it easier to use the Sets/Grids in ParaView.
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
static vtkDataObjectAlgorithm * New()
vtkTypeBool ProcessRequest(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
see vtkAlgorithm for details
vtkXdmfArraySelection * CellArraysCache
Reads eXtensible Data Model and Format files.
Definition: vtkXdmfReader.h:50
std::map< int, XdmfDataSetTopoGeoPath > XdmfReaderCachedData
int vtkTypeBool
Definition: vtkABI.h:69
Base class for graph data types.
Definition: vtkGraph.h:295
vtkXdmfArraySelection * PointArraysCache
int FillOutputPortInformation(int port, vtkInformation *info) override
Fill the output port information objects for this algorithm.
dynamic, self-adjusting array of char
Definition: vtkCharArray.h:51
bool ReadFromInputString
a simple class to control print indentation
Definition: vtkIndent.h:39
const char * GetGridArrayName(int index)
These methods are provided to make it easier to use the Sets/Grids in ParaView.
const char * GetSetArrayName(int index)
These methods are provided to make it easier to use the Sets/Grids in ParaView.
vtkCharArray * InputArray
char * InputString
vtkXdmfDocument * XdmfDocument
vtkXdmfArraySelection * GridsCache
#define VTK_FILEPATH
Superclass for algorithms that produce only data object as output.
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
int GetNumberOfSetArrays()
These methods are provided to make it easier to use the Sets/Grids in ParaView.
Store zero or more vtkInformation instances.
XdmfReaderCachedData DataSetCache
unsigned int LastTimeIndex
vtkXdmfArraySelection * SetsCache
int GetSetArrayStatus(const char *name)
These methods are provided to make it easier to use the Sets/Grids in ParaView.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.