VTK  9.7.1
vtkSLACReader.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-LANL-California-USGov
4 
20 #ifndef vtkSLACReader_h
21 #define vtkSLACReader_h
22 
23 #include "vtkIONetCDFModule.h" // For export macro
25 
26 #include "vtkSmartPointer.h" // For internal method.
27 
28 VTK_ABI_NAMESPACE_BEGIN
30 class vtkDoubleArray;
31 class vtkIdTypeArray;
34 
35 class VTKIONETCDF_EXPORT vtkSLACReader : public vtkMultiBlockDataSetAlgorithm
36 {
37 public:
39  static vtkSLACReader* New();
40  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
42  vtkGetFilePathMacro(MeshFileName);
43  vtkSetFilePathMacro(MeshFileName);
44 
46 
51  virtual void AddModeFileName(VTK_FILEPATH const char* fname);
52  virtual void RemoveAllModeFileNames();
53  virtual unsigned int GetNumberOfModeFileNames();
54  virtual VTK_FILEPATH const char* GetModeFileName(unsigned int idx);
56 
58 
61  vtkGetMacro(ReadInternalVolume, vtkTypeBool);
62  vtkSetMacro(ReadInternalVolume, vtkTypeBool);
63  vtkBooleanMacro(ReadInternalVolume, vtkTypeBool);
65 
67 
70  vtkGetMacro(ReadExternalSurface, vtkTypeBool);
71  vtkSetMacro(ReadExternalSurface, vtkTypeBool);
72  vtkBooleanMacro(ReadExternalSurface, vtkTypeBool);
74 
76 
80  vtkGetMacro(ReadMidpoints, vtkTypeBool);
81  vtkSetMacro(ReadMidpoints, vtkTypeBool);
82  vtkBooleanMacro(ReadMidpoints, vtkTypeBool);
84 
86 
89  virtual int GetNumberOfVariableArrays();
90  virtual const char* GetVariableArrayName(int index);
91  virtual int GetVariableArrayStatus(const char* name);
92  virtual void SetVariableArrayStatus(const char* name, int status);
94 
96 
99  virtual void ResetFrequencyScales();
100  virtual void SetFrequencyScale(int index, double scale);
102 
104 
107  virtual void ResetPhaseShifts();
108  virtual void SetPhaseShift(int index, double shift);
110 
112 
115  virtual vtkDoubleArray* GetFrequencyScales();
116  virtual vtkDoubleArray* GetPhaseShifts();
118 
122  static int CanReadFile(VTK_FILEPATH const char* filename);
123 
129  static vtkInformationIntegerKey* IS_INTERNAL_VOLUME();
130 
136  static vtkInformationIntegerKey* IS_EXTERNAL_SURFACE();
137 
139 
146  static vtkInformationObjectBaseKey* POINTS();
147  static vtkInformationObjectBaseKey* POINT_DATA();
149 
151 
155  class VTKIONETCDF_EXPORT EdgeEndpoints
156  {
157  public:
159  : MinEndPoint(-1)
160  , MaxEndPoint(-1)
161  {
162  }
163  EdgeEndpoints(vtkIdType endpointA, vtkIdType endpointB)
164  {
165  if (endpointA < endpointB)
166  {
167  this->MinEndPoint = endpointA;
168  this->MaxEndPoint = endpointB;
169  }
170  else
171  {
172  this->MinEndPoint = endpointB;
173  this->MaxEndPoint = endpointA;
174  }
175  }
176  vtkIdType GetMinEndPoint() const { return this->MinEndPoint; }
177  vtkIdType GetMaxEndPoint() const { return this->MaxEndPoint; }
178  bool operator==(const EdgeEndpoints& other) const
179  {
180  return ((this->GetMinEndPoint() == other.GetMinEndPoint()) &&
181  (this->GetMaxEndPoint() == other.GetMaxEndPoint()));
182  }
183 
184  protected:
187  };
189 
191 
194  class VTKIONETCDF_EXPORT MidpointCoordinates
195  {
196  public:
197  MidpointCoordinates() = default;
198  MidpointCoordinates(const double coord[3], vtkIdType id)
199  {
200  this->Coordinate[0] = coord[0];
201  this->Coordinate[1] = coord[1];
202  this->Coordinate[2] = coord[2];
203  this->ID = id;
204  }
205  double Coordinate[3];
207  };
209 
210  enum
211  {
212  SURFACE_OUTPUT = 0,
213  VOLUME_OUTPUT = 1,
214  NUM_OUTPUTS = 2
215  };
216 
217 protected:
218  vtkSLACReader();
219  ~vtkSLACReader() override;
220 
221  class vtkInternal;
222  vtkInternal* Internal;
223 
224  // Friend so vtkInternal can access MidpointIdMap
225  // (so Sun CC compiler doesn't complain).
226  friend class vtkInternal;
227 
229 
233 
238 
243 
248 
249  int RequestInformation(vtkInformation* request, vtkInformationVector** inputVector,
250  vtkInformationVector* outputVector) override;
251 
252  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
253  vtkInformationVector* outputVector) override;
254 
258  static void SelectionModifiedCallback(
259  vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
260 
268  virtual vtkIdType GetNumTuplesInVariable(int ncFD, int varId, int expectedNumComponents);
269 
274  virtual int CheckTetrahedraWinding(int meshFD);
275 
280  virtual int ReadConnectivity(
281  int meshFD, vtkMultiBlockDataSet* surfaceOutput, vtkMultiBlockDataSet* volumeOutput);
282 
284 
287  virtual int ReadTetrahedronInteriorArray(int meshFD, vtkIdTypeArray* connectivity);
288  virtual int ReadTetrahedronExteriorArray(int meshFD, vtkIdTypeArray* connectivity);
290 
294  virtual vtkSmartPointer<vtkDataArray> ReadPointDataArray(int ncFD, int varId);
295 
299  enum
300  {
301  NumPerTetInt = 5,
302  NumPerTetExt = 9
303  };
304 
306 
309  class VTKIONETCDF_EXPORT MidpointCoordinateMap
310  {
311  public:
315 
316  void AddMidpoint(const EdgeEndpoints& edge, const MidpointCoordinates& midpoint);
317  void RemoveMidpoint(const EdgeEndpoints& edge);
318  void RemoveAllMidpoints();
319  vtkIdType GetNumberOfMidpoints() const;
320 
325  MidpointCoordinates* FindMidpoint(const EdgeEndpoints& edge);
326 
327  protected:
328  class vtkInternal;
329  vtkInternal* Internal;
330 
331  private:
332  // Too lazy to implement these.
334  void operator=(const MidpointCoordinateMap&) = delete;
335  };
336 
338 
341  class VTKIONETCDF_EXPORT MidpointIdMap
342  {
343  public:
344  MidpointIdMap();
345  ~MidpointIdMap();
347 
348  void AddMidpoint(const EdgeEndpoints& edge, vtkIdType midpoint);
349  void RemoveMidpoint(const EdgeEndpoints& edge);
350  void RemoveAllMidpoints();
351  vtkIdType GetNumberOfMidpoints() const;
352 
356  vtkIdType* FindMidpoint(const EdgeEndpoints& edge);
357 
361  void InitTraversal();
365  bool GetNextMidpoint(EdgeEndpoints& edge, vtkIdType& midpoint);
366 
367  protected:
368  class vtkInternal;
369  vtkInternal* Internal;
370 
371  private:
372  // Too lazy to implement these.
373  MidpointIdMap(const MidpointIdMap&) = delete;
374  void operator=(const MidpointIdMap&) = delete;
375  };
376 
381  virtual int ReadCoordinates(int meshFD, vtkMultiBlockDataSet* output);
382 
388  virtual int ReadMidpointCoordinates(
389  int meshFD, vtkMultiBlockDataSet* output, MidpointCoordinateMap& map);
390 
396  virtual int ReadMidpointData(
397  int meshFD, vtkMultiBlockDataSet* output, MidpointIdMap& midpointIds);
398 
403  virtual int RestoreMeshCache(vtkMultiBlockDataSet* surfaceOutput,
404  vtkMultiBlockDataSet* volumeOutput, vtkMultiBlockDataSet* compositeOutput);
405 
410  virtual int ReadFieldData(const int* modeFDArray, int numModeFDs, vtkMultiBlockDataSet* output);
411 
416  virtual int InterpolateMidpointData(vtkMultiBlockDataSet* output, MidpointIdMap& map);
417 
424 
429  virtual int MeshUpToDate();
430 
431 private:
432  vtkSLACReader(const vtkSLACReader&) = delete;
433  void operator=(const vtkSLACReader&) = delete;
434 };
435 
436 VTK_ABI_NAMESPACE_END
437 #endif // vtkSLACReader_h
vtkTypeBool ReadInternalVolume
Simple class used internally to define an edge based on the endpoints.
EdgeEndpoints(vtkIdType endpointA, vtkIdType endpointB)
Simple class used internally for holding midpoint information.
abstract base class for most VTK objects
Definition: vtkObject.h:52
Store vtkAlgorithm input/output information.
record modification and/or execution time
Definition: vtkTimeStamp.h:24
bool operator==(const EdgeEndpoints &other) const
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:363
Superclass for algorithms that produce only vtkMultiBlockDataSet as output.
A reader for a data format used by Omega3p, Tau3p, and several other tools used at the Standford Line...
Definition: vtkSLACReader.h:35
dynamic, self-adjusting array of double
static vtkMultiBlockDataSetAlgorithm * New()
MidpointCoordinates(const double coord[3], vtkIdType id)
int vtkTypeBool
Definition: vtkABI.h:64
Manages a map from edges to midpoint coordinates.
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkTypeBool ReadMidpoints
Key for integer values in vtkInformation.
Store on/off settings for data arrays, etc.
Key for vtkObjectBase values.
vtkInternal * Internal
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
#define VTK_FILEPATH
Composite dataset that organizes datasets into blocks.
bool ReadModeData
True if reading from a proper mode file.
Store zero or more vtkInformation instances.
vtkTypeBool ReadExternalSurface
bool FrequencyModes
True if mode files describe vibrating fields.
char * MeshFileName
vtkIdType GetMaxEndPoint() const
vtkIdType GetMinEndPoint() const
bool TimeStepModes
True if "mode" files are a sequence of time steps.
Manages a map from edges to the point id of the midpoint.
vtkTimeStamp MeshReadTime
A time stamp for the last time the mesh file was read.