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:
169  EdgeEndpoints() : MinEndPoint(-1), MaxEndPoint(-1) {}
170  EdgeEndpoints(vtkIdType endpointA, vtkIdType endpointB) {
171  if (endpointA < endpointB)
172  {
173  this->MinEndPoint = endpointA; this->MaxEndPoint = endpointB;
174  }
175  else
176  {
177  this->MinEndPoint = endpointB; this->MaxEndPoint = endpointA;
178  }
179  }
180  inline vtkIdType GetMinEndPoint() const { return this->MinEndPoint; }
181  inline vtkIdType GetMaxEndPoint() const { return this->MaxEndPoint; }
182  inline bool operator==(const EdgeEndpoints &other) const {
183  return ( (this->GetMinEndPoint() == other.GetMinEndPoint())
184  && (this->GetMaxEndPoint() == other.GetMaxEndPoint()) );
185  }
186  protected:
189  };
191 
193 
196  class VTKIONETCDF_EXPORT MidpointCoordinates
197  {
198  public:
200  MidpointCoordinates(const double coord[3], vtkIdType id) {
201  this->Coordinate[0] = coord[0];
202  this->Coordinate[1] = coord[1];
203  this->Coordinate[2] = coord[2];
204  this->ID = id;
205  }
206  double Coordinate[3];
208  };
210 
211  enum {
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,
250  vtkInformationVector **inputVector,
251  vtkInformationVector *outputVector) override;
252 
253  int RequestData(vtkInformation *request,
254  vtkInformationVector **inputVector,
255  vtkInformationVector *outputVector) override;
256 
260  static void SelectionModifiedCallback(vtkObject *caller, unsigned long eid,
261  void *clientdata, void *calldata);
262 
270  virtual vtkIdType GetNumTuplesInVariable(int ncFD, int varId,
271  int expectedNumComponents);
272 
277  virtual int CheckTetrahedraWinding(int meshFD);
278 
283  virtual int ReadConnectivity(int meshFD, vtkMultiBlockDataSet *surfaceOutput,
284  vtkMultiBlockDataSet *volumeOutput);
285 
287 
290  virtual int ReadTetrahedronInteriorArray(int meshFD,
291  vtkIdTypeArray *connectivity);
292  virtual int ReadTetrahedronExteriorArray(int meshFD,
293  vtkIdTypeArray *connectivity);
295 
299  virtual vtkSmartPointer<vtkDataArray> ReadPointDataArray(int ncFD, int varId);
300 
304  enum {
305  NumPerTetInt = 5,
306  NumPerTetExt = 9
307  };
308 
310 
313  class VTKIONETCDF_EXPORT MidpointCoordinateMap
314  {
315  public:
319 
320  void AddMidpoint(const EdgeEndpoints &edge,
321  const MidpointCoordinates &midpoint);
322  void RemoveMidpoint(const EdgeEndpoints &edge);
323  void RemoveAllMidpoints();
324  vtkIdType GetNumberOfMidpoints() const;
325 
330  MidpointCoordinates *FindMidpoint(const EdgeEndpoints &edge);
331 
332  protected:
333  class vtkInternal;
334  vtkInternal *Internal;
335 
336  private:
337  // Too lazy to implement these.
339  void operator=(const MidpointCoordinateMap &);
340  };
341 
343 
346  class VTKIONETCDF_EXPORT MidpointIdMap
347  {
348  public:
349  MidpointIdMap();
350  ~MidpointIdMap();
352 
353  void AddMidpoint(const EdgeEndpoints &edge, vtkIdType midpoint);
354  void RemoveMidpoint(const EdgeEndpoints &edge);
355  void RemoveAllMidpoints();
356  vtkIdType GetNumberOfMidpoints() const;
357 
361  vtkIdType *FindMidpoint(const EdgeEndpoints &edge);
362 
366  void InitTraversal();
370  bool GetNextMidpoint(EdgeEndpoints &edge, vtkIdType &midpoint);
371 
372  protected:
373  class vtkInternal;
374  vtkInternal *Internal;
375 
376  private:
377  // Too lazy to implement these.
378  MidpointIdMap(const MidpointIdMap &);
379  void operator=(const MidpointIdMap &);
380  };
381 
386  virtual int ReadCoordinates(int meshFD, vtkMultiBlockDataSet *output);
387 
393  virtual int ReadMidpointCoordinates(int meshFD, vtkMultiBlockDataSet *output,
394  MidpointCoordinateMap &map);
395 
401  virtual int ReadMidpointData(int meshFD, vtkMultiBlockDataSet *output,
402  MidpointIdMap &map);
403 
408  virtual int RestoreMeshCache(vtkMultiBlockDataSet *surfaceOutput,
409  vtkMultiBlockDataSet *volumeOutput,
410  vtkMultiBlockDataSet *compositeOutput);
411 
416  virtual int ReadFieldData(const int *modeFDArray,
417  int numModeFDs,
418  vtkMultiBlockDataSet *output);
419 
424  virtual int InterpolateMidpointData(vtkMultiBlockDataSet *output,
425  MidpointIdMap &map);
426 
433 
438  virtual int MeshUpToDate();
439 
440 private:
441  vtkSLACReader(const vtkSLACReader &) = delete;
442  void operator=(const vtkSLACReader &) = delete;
443 };
444 
445 #endif //vtkSLACReader_h
vtkSLACReader::MidpointCoordinateMap
Manages a map from edges to midpoint coordinates.
Definition: vtkSLACReader.h:313
vtkSLACReader::MidpointIdMap
Manages a map from edges to the point id of the midpoint.
Definition: vtkSLACReader.h:346
vtkSLACReader::MidpointCoordinates::MidpointCoordinates
MidpointCoordinates()
Definition: vtkSLACReader.h:199
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:187
vtkX3D::scale
Definition: vtkX3D.h:229
vtkIdType
int vtkIdType
Definition: vtkType.h:347
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:247
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:32
vtkSLACReader::ReadInternalVolume
vtkTypeBool ReadInternalVolume
Definition: vtkSLACReader.h:230
vtkSLACReader::MeshFileName
char * MeshFileName
Definition: vtkSLACReader.h:228
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:188
vtkSLACReader
Definition: vtkSLACReader.h:49
vtkSLACReader::TimeStepModes
bool TimeStepModes
True if "mode" files are a sequence of time steps.
Definition: vtkSLACReader.h:242
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:182
vtkSLACReader::MidpointCoordinates::ID
vtkIdType ID
Definition: vtkSLACReader.h:207
vtkInformationObjectBaseKey
Key for vtkObjectBase values.
Definition: vtkInformationObjectBaseKey.h:33
vtkSLACReader::ReadModeData
bool ReadModeData
True if reading from a proper mode file.
Definition: vtkSLACReader.h:237
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:232
vtkMultiBlockDataSetAlgorithm.h
vtkSLACReader::EdgeEndpoints::GetMinEndPoint
vtkIdType GetMinEndPoint() const
Definition: vtkSLACReader.h:180
vtkX3D::name
Definition: vtkX3D.h:219
vtkSLACReader::MeshReadTime
vtkTimeStamp MeshReadTime
A time stamp for the last time the mesh file was read.
Definition: vtkSLACReader.h:432
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:80
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:35
vtkSLACReader::MidpointIdMap::Internal
vtkInternal * Internal
Definition: vtkSLACReader.h:373
vtkSLACReader::EdgeEndpoints::GetMaxEndPoint
vtkIdType GetMaxEndPoint() const
Definition: vtkSLACReader.h:181
vtkSLACReader::MidpointCoordinates
Simple class used internally for holding midpoint information.
Definition: vtkSLACReader.h:196
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:35
vtkSLACReader::MidpointCoordinates::MidpointCoordinates
MidpointCoordinates(const double coord[3], vtkIdType id)
Definition: vtkSLACReader.h:200
vtkSLACReader::EdgeEndpoints::EdgeEndpoints
EdgeEndpoints(vtkIdType endpointA, vtkIdType endpointB)
Definition: vtkSLACReader.h:170
vtkSLACReader::Internal
vtkInternal * Internal
Definition: vtkSLACReader.h:221
vtkX3D::index
Definition: vtkX3D.h:246
vtkSLACReader::MidpointCoordinateMap::Internal
vtkInternal * Internal
Definition: vtkSLACReader.h:333
vtkSLACReader::ReadExternalSurface
vtkTypeBool ReadExternalSurface
Definition: vtkSLACReader.h:231
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkX3D::Coordinate
Definition: vtkX3D.h:44
vtkMultiBlockDataSetAlgorithm
Superclass for algorithms that produce only vtkMultiBlockDataSet as output.
Definition: vtkMultiBlockDataSetAlgorithm.h:32