VTK  9.2.6
vtkSLACReader.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 /*=========================================================================
3 
4  Program: Visualization Toolkit
5  Module: vtkSLACReader.h
6 
7  Copyright (c) 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 =========================================================================*/
16 
17 /*-------------------------------------------------------------------------
18  Copyright 2008 Sandia Corporation.
19  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
20  the U.S. Government retains certain rights in this software.
21 -------------------------------------------------------------------------*/
22 
38 #ifndef vtkSLACReader_h
39 #define vtkSLACReader_h
40 
41 #include "vtkIONetCDFModule.h" // For export macro
43 
44 #include "vtkSmartPointer.h" // For internal method.
45 
47 class vtkDoubleArray;
48 class vtkIdTypeArray;
51 
52 class VTKIONETCDF_EXPORT vtkSLACReader : public vtkMultiBlockDataSetAlgorithm
53 {
54 public:
56  static vtkSLACReader* New();
57  void PrintSelf(ostream& os, vtkIndent indent) override;
58 
59  vtkGetFilePathMacro(MeshFileName);
60  vtkSetFilePathMacro(MeshFileName);
61 
63 
68  virtual void AddModeFileName(VTK_FILEPATH const char* fname);
69  virtual void RemoveAllModeFileNames();
70  virtual unsigned int GetNumberOfModeFileNames();
71  virtual VTK_FILEPATH const char* GetModeFileName(unsigned int idx);
73 
75 
78  vtkGetMacro(ReadInternalVolume, vtkTypeBool);
79  vtkSetMacro(ReadInternalVolume, vtkTypeBool);
80  vtkBooleanMacro(ReadInternalVolume, vtkTypeBool);
82 
84 
87  vtkGetMacro(ReadExternalSurface, vtkTypeBool);
88  vtkSetMacro(ReadExternalSurface, vtkTypeBool);
89  vtkBooleanMacro(ReadExternalSurface, vtkTypeBool);
91 
93 
97  vtkGetMacro(ReadMidpoints, vtkTypeBool);
98  vtkSetMacro(ReadMidpoints, vtkTypeBool);
99  vtkBooleanMacro(ReadMidpoints, vtkTypeBool);
101 
103 
106  virtual int GetNumberOfVariableArrays();
107  virtual const char* GetVariableArrayName(int index);
108  virtual int GetVariableArrayStatus(const char* name);
109  virtual void SetVariableArrayStatus(const char* name, int status);
111 
113 
116  virtual void ResetFrequencyScales();
117  virtual void SetFrequencyScale(int index, double scale);
119 
121 
124  virtual void ResetPhaseShifts();
125  virtual void SetPhaseShift(int index, double shift);
127 
129 
132  virtual vtkDoubleArray* GetFrequencyScales();
133  virtual vtkDoubleArray* GetPhaseShifts();
135 
139  static int CanReadFile(VTK_FILEPATH const char* filename);
140 
145  static vtkInformationIntegerKey* IS_INTERNAL_VOLUME();
146 
151  static vtkInformationIntegerKey* IS_EXTERNAL_SURFACE();
152 
154 
160  static vtkInformationObjectBaseKey* POINTS();
161  static vtkInformationObjectBaseKey* POINT_DATA();
163 
165 
169  class VTKIONETCDF_EXPORT EdgeEndpoints
170  {
171  public:
173  : MinEndPoint(-1)
174  , MaxEndPoint(-1)
175  {
176  }
177  EdgeEndpoints(vtkIdType endpointA, vtkIdType endpointB)
178  {
179  if (endpointA < endpointB)
180  {
181  this->MinEndPoint = endpointA;
182  this->MaxEndPoint = endpointB;
183  }
184  else
185  {
186  this->MinEndPoint = endpointB;
187  this->MaxEndPoint = endpointA;
188  }
189  }
190  inline vtkIdType GetMinEndPoint() const { return this->MinEndPoint; }
191  inline vtkIdType GetMaxEndPoint() const { return this->MaxEndPoint; }
192  inline bool operator==(const EdgeEndpoints& other) const
193  {
194  return ((this->GetMinEndPoint() == other.GetMinEndPoint()) &&
195  (this->GetMaxEndPoint() == other.GetMaxEndPoint()));
196  }
197 
198  protected:
201  };
203 
205 
208  class VTKIONETCDF_EXPORT MidpointCoordinates
209  {
210  public:
211  MidpointCoordinates() = default;
212  MidpointCoordinates(const double coord[3], vtkIdType id)
213  {
214  this->Coordinate[0] = coord[0];
215  this->Coordinate[1] = coord[1];
216  this->Coordinate[2] = coord[2];
217  this->ID = id;
218  }
219  double Coordinate[3];
221  };
223 
224  enum
225  {
226  SURFACE_OUTPUT = 0,
227  VOLUME_OUTPUT = 1,
228  NUM_OUTPUTS = 2
229  };
230 
231 protected:
232  vtkSLACReader();
233  ~vtkSLACReader() override;
234 
235  class vtkInternal;
236  vtkInternal* Internal;
237 
238  // Friend so vtkInternal can access MidpointIdMap
239  // (so Sun CC compiler doesn't complain).
240  friend class vtkInternal;
241 
243 
247 
252 
257 
262 
263  int RequestInformation(vtkInformation* request, vtkInformationVector** inputVector,
264  vtkInformationVector* outputVector) override;
265 
266  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
267  vtkInformationVector* outputVector) override;
268 
272  static void SelectionModifiedCallback(
273  vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
274 
282  virtual vtkIdType GetNumTuplesInVariable(int ncFD, int varId, int expectedNumComponents);
283 
288  virtual int CheckTetrahedraWinding(int meshFD);
289 
294  virtual int ReadConnectivity(
295  int meshFD, vtkMultiBlockDataSet* surfaceOutput, vtkMultiBlockDataSet* volumeOutput);
296 
298 
301  virtual int ReadTetrahedronInteriorArray(int meshFD, vtkIdTypeArray* connectivity);
302  virtual int ReadTetrahedronExteriorArray(int meshFD, vtkIdTypeArray* connectivity);
304 
308  virtual vtkSmartPointer<vtkDataArray> ReadPointDataArray(int ncFD, int varId);
309 
313  enum
314  {
315  NumPerTetInt = 5,
316  NumPerTetExt = 9
317  };
318 
320 
323  class VTKIONETCDF_EXPORT MidpointCoordinateMap
324  {
325  public:
329 
330  void AddMidpoint(const EdgeEndpoints& edge, const MidpointCoordinates& midpoint);
331  void RemoveMidpoint(const EdgeEndpoints& edge);
332  void RemoveAllMidpoints();
333  vtkIdType GetNumberOfMidpoints() const;
334 
339  MidpointCoordinates* FindMidpoint(const EdgeEndpoints& edge);
340 
341  protected:
342  class vtkInternal;
343  vtkInternal* Internal;
344 
345  private:
346  // Too lazy to implement these.
348  void operator=(const MidpointCoordinateMap&) = delete;
349  };
350 
352 
355  class VTKIONETCDF_EXPORT MidpointIdMap
356  {
357  public:
358  MidpointIdMap();
359  ~MidpointIdMap();
361 
362  void AddMidpoint(const EdgeEndpoints& edge, vtkIdType midpoint);
363  void RemoveMidpoint(const EdgeEndpoints& edge);
364  void RemoveAllMidpoints();
365  vtkIdType GetNumberOfMidpoints() const;
366 
370  vtkIdType* FindMidpoint(const EdgeEndpoints& edge);
371 
375  void InitTraversal();
379  bool GetNextMidpoint(EdgeEndpoints& edge, vtkIdType& midpoint);
380 
381  protected:
382  class vtkInternal;
383  vtkInternal* Internal;
384 
385  private:
386  // Too lazy to implement these.
387  MidpointIdMap(const MidpointIdMap&) = delete;
388  void operator=(const MidpointIdMap&) = delete;
389  };
390 
395  virtual int ReadCoordinates(int meshFD, vtkMultiBlockDataSet* output);
396 
402  virtual int ReadMidpointCoordinates(
403  int meshFD, vtkMultiBlockDataSet* output, MidpointCoordinateMap& map);
404 
410  virtual int ReadMidpointData(
411  int meshFD, vtkMultiBlockDataSet* output, MidpointIdMap& midpointIds);
412 
417  virtual int RestoreMeshCache(vtkMultiBlockDataSet* surfaceOutput,
418  vtkMultiBlockDataSet* volumeOutput, vtkMultiBlockDataSet* compositeOutput);
419 
424  virtual int ReadFieldData(const int* modeFDArray, int numModeFDs, vtkMultiBlockDataSet* output);
425 
430  virtual int InterpolateMidpointData(vtkMultiBlockDataSet* output, MidpointIdMap& map);
431 
438 
443  virtual int MeshUpToDate();
444 
445 private:
446  vtkSLACReader(const vtkSLACReader&) = delete;
447  void operator=(const vtkSLACReader&) = delete;
448 };
449 
450 #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:62
Store vtkAlgorithm input/output information.
record modification and/or execution time
Definition: vtkTimeStamp.h:35
bool operator==(const EdgeEndpoints &other) const
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:332
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:52
dynamic, self-adjusting array of double
static vtkMultiBlockDataSetAlgorithm * New()
MidpointCoordinates(const double coord[3], vtkIdType id)
int vtkTypeBool
Definition: vtkABI.h:69
Manages a map from edges to midpoint coordinates.
a simple class to control print indentation
Definition: vtkIndent.h:39
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.