VTK
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 
35 #ifndef vtkSLACReader_h
36 #define vtkSLACReader_h
37 
38 #include "vtkIONetCDFModule.h" // For export macro
40 
41 #include "vtkSmartPointer.h" // For internal method.
42 
44 class vtkDoubleArray;
45 class vtkIdTypeArray;
48 
49 class VTKIONETCDF_EXPORT vtkSLACReader : public vtkMultiBlockDataSetAlgorithm
50 {
51 public:
53  static vtkSLACReader* New();
54  void PrintSelf(ostream& os, vtkIndent indent) override;
55 
56  vtkGetStringMacro(MeshFileName);
57  vtkSetStringMacro(MeshFileName);
58 
60 
65  virtual void AddModeFileName(const char* fname);
66  virtual void RemoveAllModeFileNames();
67  virtual unsigned int GetNumberOfModeFileNames();
68  virtual const char* GetModeFileName(unsigned int idx);
70 
72 
75  vtkGetMacro(ReadInternalVolume, vtkTypeBool);
76  vtkSetMacro(ReadInternalVolume, vtkTypeBool);
77  vtkBooleanMacro(ReadInternalVolume, vtkTypeBool);
79 
81 
84  vtkGetMacro(ReadExternalSurface, vtkTypeBool);
85  vtkSetMacro(ReadExternalSurface, vtkTypeBool);
86  vtkBooleanMacro(ReadExternalSurface, vtkTypeBool);
88 
90 
94  vtkGetMacro(ReadMidpoints, vtkTypeBool);
95  vtkSetMacro(ReadMidpoints, vtkTypeBool);
96  vtkBooleanMacro(ReadMidpoints, vtkTypeBool);
98 
100 
103  virtual int GetNumberOfVariableArrays();
104  virtual const char* GetVariableArrayName(int idx);
105  virtual int GetVariableArrayStatus(const char* name);
106  virtual void SetVariableArrayStatus(const char* name, int status);
108 
110 
113  virtual void ResetFrequencyScales();
114  virtual void SetFrequencyScale(int index, double scale);
116 
118 
121  virtual void ResetPhaseShifts();
122  virtual void SetPhaseShift(int index, double shift);
124 
126 
129  virtual vtkDoubleArray* GetFrequencyScales();
130  virtual vtkDoubleArray* GetPhaseShifts();
132 
136  static int CanReadFile(const char* filename);
137 
142  static vtkInformationIntegerKey* IS_INTERNAL_VOLUME();
143 
148  static vtkInformationIntegerKey* IS_EXTERNAL_SURFACE();
149 
151 
157  static vtkInformationObjectBaseKey* POINTS();
158  static vtkInformationObjectBaseKey* POINT_DATA();
160 
162 
166  class VTKIONETCDF_EXPORT EdgeEndpoints
167  {
168  public:
170  : MinEndPoint(-1)
171  , MaxEndPoint(-1)
172  {
173  }
174  EdgeEndpoints(vtkIdType endpointA, vtkIdType endpointB)
175  {
176  if (endpointA < endpointB)
177  {
178  this->MinEndPoint = endpointA;
179  this->MaxEndPoint = endpointB;
180  }
181  else
182  {
183  this->MinEndPoint = endpointB;
184  this->MaxEndPoint = endpointA;
185  }
186  }
187  inline vtkIdType GetMinEndPoint() const { return this->MinEndPoint; }
188  inline vtkIdType GetMaxEndPoint() const { return this->MaxEndPoint; }
189  inline bool operator==(const EdgeEndpoints& other) const
190  {
191  return ((this->GetMinEndPoint() == other.GetMinEndPoint()) &&
192  (this->GetMaxEndPoint() == other.GetMaxEndPoint()));
193  }
194 
195  protected:
198  };
200 
202 
205  class VTKIONETCDF_EXPORT MidpointCoordinates
206  {
207  public:
209  MidpointCoordinates(const double coord[3], vtkIdType id)
210  {
211  this->Coordinate[0] = coord[0];
212  this->Coordinate[1] = coord[1];
213  this->Coordinate[2] = coord[2];
214  this->ID = id;
215  }
216  double Coordinate[3];
218  };
220 
221  enum
222  {
223  SURFACE_OUTPUT = 0,
224  VOLUME_OUTPUT = 1,
225  NUM_OUTPUTS = 2
226  };
227 
228 protected:
229  vtkSLACReader();
230  ~vtkSLACReader() override;
231 
232  class vtkInternal;
233  vtkInternal* Internal;
234 
235  // Friend so vtkInternal can access MidpointIdMap
236  // (so Sun CC compiler doesn't complain).
237  friend class vtkInternal;
238 
240 
244 
249 
254 
259 
260  int RequestInformation(vtkInformation* request, vtkInformationVector** inputVector,
261  vtkInformationVector* outputVector) override;
262 
263  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
264  vtkInformationVector* outputVector) override;
265 
269  static void SelectionModifiedCallback(
270  vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
271 
279  virtual vtkIdType GetNumTuplesInVariable(int ncFD, int varId, int expectedNumComponents);
280 
285  virtual int CheckTetrahedraWinding(int meshFD);
286 
291  virtual int ReadConnectivity(
292  int meshFD, vtkMultiBlockDataSet* surfaceOutput, vtkMultiBlockDataSet* volumeOutput);
293 
295 
298  virtual int ReadTetrahedronInteriorArray(int meshFD, vtkIdTypeArray* connectivity);
299  virtual int ReadTetrahedronExteriorArray(int meshFD, vtkIdTypeArray* connectivity);
301 
305  virtual vtkSmartPointer<vtkDataArray> ReadPointDataArray(int ncFD, int varId);
306 
310  enum
311  {
312  NumPerTetInt = 5,
313  NumPerTetExt = 9
314  };
315 
317 
320  class VTKIONETCDF_EXPORT MidpointCoordinateMap
321  {
322  public:
326 
327  void AddMidpoint(const EdgeEndpoints& edge, const MidpointCoordinates& midpoint);
328  void RemoveMidpoint(const EdgeEndpoints& edge);
329  void RemoveAllMidpoints();
330  vtkIdType GetNumberOfMidpoints() const;
331 
336  MidpointCoordinates* FindMidpoint(const EdgeEndpoints& edge);
337 
338  protected:
339  class vtkInternal;
340  vtkInternal* Internal;
341 
342  private:
343  // Too lazy to implement these.
345  void operator=(const MidpointCoordinateMap&);
346  };
347 
349 
352  class VTKIONETCDF_EXPORT MidpointIdMap
353  {
354  public:
355  MidpointIdMap();
356  ~MidpointIdMap();
358 
359  void AddMidpoint(const EdgeEndpoints& edge, vtkIdType midpoint);
360  void RemoveMidpoint(const EdgeEndpoints& edge);
361  void RemoveAllMidpoints();
362  vtkIdType GetNumberOfMidpoints() const;
363 
367  vtkIdType* FindMidpoint(const EdgeEndpoints& edge);
368 
372  void InitTraversal();
376  bool GetNextMidpoint(EdgeEndpoints& edge, vtkIdType& midpoint);
377 
378  protected:
379  class vtkInternal;
380  vtkInternal* Internal;
381 
382  private:
383  // Too lazy to implement these.
385  void operator=(const MidpointIdMap&);
386  };
387 
392  virtual int ReadCoordinates(int meshFD, vtkMultiBlockDataSet* output);
393 
399  virtual int ReadMidpointCoordinates(
400  int meshFD, vtkMultiBlockDataSet* output, MidpointCoordinateMap& map);
401 
407  virtual int ReadMidpointData(int meshFD, vtkMultiBlockDataSet* output, MidpointIdMap& map);
408 
413  virtual int RestoreMeshCache(vtkMultiBlockDataSet* surfaceOutput,
414  vtkMultiBlockDataSet* volumeOutput, vtkMultiBlockDataSet* compositeOutput);
415 
420  virtual int ReadFieldData(const int* modeFDArray, int numModeFDs, vtkMultiBlockDataSet* output);
421 
426  virtual int InterpolateMidpointData(vtkMultiBlockDataSet* output, MidpointIdMap& map);
427 
434 
439  virtual int MeshUpToDate();
440 
441 private:
442  vtkSLACReader(const vtkSLACReader&) = delete;
443  void operator=(const vtkSLACReader&) = delete;
444 };
445 
446 #endif // vtkSLACReader_h
vtkSLACReader::MidpointCoordinateMap
Manages a map from edges to midpoint coordinates.
Definition: vtkSLACReader.h:320
vtkSLACReader::MidpointIdMap
Manages a map from edges to the point id of the midpoint.
Definition: vtkSLACReader.h:352
vtkSLACReader::MidpointCoordinates::MidpointCoordinates
MidpointCoordinates()
Definition: vtkSLACReader.h:208
vtkSLACReader::EdgeEndpoints
Simple class used internally to define an edge based on the endpoints.
Definition: vtkSLACReader.h:166
vtkSLACReader::EdgeEndpoints::MinEndPoint
vtkIdType MinEndPoint
Definition: vtkSLACReader.h:196
vtkX3D::scale
Definition: vtkX3D.h:235
vtkIdType
int vtkIdType
Definition: vtkType.h:343
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkSLACReader::FrequencyModes
bool FrequencyModes
True if mode files describe vibrating fields.
Definition: vtkSLACReader.h:258
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:32
vtkSLACReader::ReadInternalVolume
vtkTypeBool ReadInternalVolume
Definition: vtkSLACReader.h:241
vtkSLACReader::MeshFileName
char * MeshFileName
Definition: vtkSLACReader.h:239
vtkSmartPointer< vtkDataArray >
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:53
vtkMultiBlockDataSetAlgorithm::New
static vtkMultiBlockDataSetAlgorithm * New()
vtkSLACReader::EdgeEndpoints::MaxEndPoint
vtkIdType MaxEndPoint
Definition: vtkSLACReader.h:197
vtkSLACReader
Definition: vtkSLACReader.h:49
vtkSLACReader::TimeStepModes
bool TimeStepModes
True if "mode" files are a sequence of time steps.
Definition: vtkSLACReader.h:253
vtkMultiBlockDataSet
Composite dataset that organizes datasets into blocks.
Definition: vtkMultiBlockDataSet.h:45
vtkDataArraySelection
Store on/off settings for data arrays for a vtkSource.
Definition: vtkDataArraySelection.h:34
vtkSLACReader::EdgeEndpoints::operator==
bool operator==(const EdgeEndpoints &other) const
Definition: vtkSLACReader.h:189
vtkSLACReader::MidpointCoordinates::ID
vtkIdType ID
Definition: vtkSLACReader.h:217
vtkInformationObjectBaseKey
Key for vtkObjectBase values.
Definition: vtkInformationObjectBaseKey.h:33
vtkSLACReader::ReadModeData
bool ReadModeData
True if reading from a proper mode file.
Definition: vtkSLACReader.h:248
vtkInformationIntegerKey
Key for integer values in vtkInformation.
Definition: vtkInformationIntegerKey.h:31
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkSLACReader::EdgeEndpoints::EdgeEndpoints
EdgeEndpoints()
Definition: vtkSLACReader.h:169
vtkSmartPointer.h
vtkSLACReader::ReadMidpoints
vtkTypeBool ReadMidpoints
Definition: vtkSLACReader.h:243
vtkMultiBlockDataSetAlgorithm.h
vtkSLACReader::EdgeEndpoints::GetMinEndPoint
vtkIdType GetMinEndPoint() const
Definition: vtkSLACReader.h:187
vtkX3D::name
Definition: vtkX3D.h:225
vtkSLACReader::MeshReadTime
vtkTimeStamp MeshReadTime
A time stamp for the last time the mesh file was read.
Definition: vtkSLACReader.h:433
vtkMultiBlockDataSetAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:64
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:35
vtkSLACReader::MidpointIdMap::Internal
vtkInternal * Internal
Definition: vtkSLACReader.h:379
vtkSLACReader::EdgeEndpoints::GetMaxEndPoint
vtkIdType GetMaxEndPoint() const
Definition: vtkSLACReader.h:188
vtkSLACReader::MidpointCoordinates
Simple class used internally for holding midpoint information.
Definition: vtkSLACReader.h:205
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:35
vtkSLACReader::MidpointCoordinates::MidpointCoordinates
MidpointCoordinates(const double coord[3], vtkIdType id)
Definition: vtkSLACReader.h:209
vtkSLACReader::EdgeEndpoints::EdgeEndpoints
EdgeEndpoints(vtkIdType endpointA, vtkIdType endpointB)
Definition: vtkSLACReader.h:174
vtkSLACReader::Internal
vtkInternal * Internal
Definition: vtkSLACReader.h:232
vtkX3D::index
Definition: vtkX3D.h:252
vtkSLACReader::MidpointCoordinateMap::Internal
vtkInternal * Internal
Definition: vtkSLACReader.h:339
vtkSLACReader::ReadExternalSurface
vtkTypeBool ReadExternalSurface
Definition: vtkSLACReader.h:242
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkX3D::Coordinate
Definition: vtkX3D.h:50
vtkMultiBlockDataSetAlgorithm
Superclass for algorithms that produce only vtkMultiBlockDataSet as output.
Definition: vtkMultiBlockDataSetAlgorithm.h:32