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 
37 #ifndef __vtkSLACReader_h
38 #define __vtkSLACReader_h
39 
40 #include "vtkIONetCDFModule.h" // For export macro
42 
43 #include "vtkSmartPointer.h" // For internal method.
44 
46 class vtkIdTypeArray;
49 
50 class VTKIONETCDF_EXPORT vtkSLACReader : public vtkMultiBlockDataSetAlgorithm
51 {
52 public:
54  static vtkSLACReader *New();
55  virtual void PrintSelf(ostream &os, vtkIndent indent);
56 
57  vtkGetStringMacro(MeshFileName);
58  vtkSetStringMacro(MeshFileName);
59 
61 
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 
74  vtkGetMacro(ReadInternalVolume, int);
75  vtkSetMacro(ReadInternalVolume, int);
76  vtkBooleanMacro(ReadInternalVolume, int);
78 
80 
82  vtkGetMacro(ReadExternalSurface, int);
83  vtkSetMacro(ReadExternalSurface, int);
84  vtkBooleanMacro(ReadExternalSurface, int);
86 
88 
90  vtkGetMacro(ReadMidpoints, int);
91  vtkSetMacro(ReadMidpoints, int);
92  vtkBooleanMacro(ReadMidpoints, int);
94 
96 
97  virtual int GetNumberOfVariableArrays();
98  virtual const char *GetVariableArrayName(int idx);
99  virtual int GetVariableArrayStatus(const char *name);
100  virtual void SetVariableArrayStatus(const char *name, int status);
102 
104  static int CanReadFile(const char *filename);
105 
108  static vtkInformationIntegerKey *IS_INTERNAL_VOLUME();
109 
112  static vtkInformationIntegerKey *IS_EXTERNAL_SURFACE();
113 
115 
119  static vtkInformationObjectBaseKey *POINTS();
120  static vtkInformationObjectBaseKey *POINT_DATA();
122 
123 //BTX
125 
128  class VTKIONETCDF_EXPORT EdgeEndpoints
129  {
130  public:
131  EdgeEndpoints() : MinEndPoint(-1), MaxEndPoint(-1) {}
132  EdgeEndpoints(vtkIdType endpointA, vtkIdType endpointB) {
133  if (endpointA < endpointB)
134  {
135  this->MinEndPoint = endpointA; this->MaxEndPoint = endpointB;
136  }
137  else
138  {
139  this->MinEndPoint = endpointB; this->MaxEndPoint = endpointA;
140  }
141  }
142  inline vtkIdType GetMinEndPoint() const { return this->MinEndPoint; }
143  inline vtkIdType GetMaxEndPoint() const { return this->MaxEndPoint; }
144  inline bool operator==(const EdgeEndpoints &other) const {
145  return ( (this->GetMinEndPoint() == other.GetMinEndPoint())
146  && (this->GetMaxEndPoint() == other.GetMaxEndPoint()) );
147  }
148  protected:
151  };
153 
155 
156  class VTKIONETCDF_EXPORT MidpointCoordinates
157  {
158  public:
160  MidpointCoordinates(const double coord[3], vtkIdType id) {
161  this->Coordinate[0] = coord[0];
162  this->Coordinate[1] = coord[1];
163  this->Coordinate[2] = coord[2];
164  this->ID = id;
165  }
166  double Coordinate[3];
168  };
170 
171  enum {
172  SURFACE_OUTPUT = 0,
173  VOLUME_OUTPUT = 1,
174  NUM_OUTPUTS = 2
175  };
176 //ETX
177 
178 protected:
179  vtkSLACReader();
180  ~vtkSLACReader();
181 
182 //BTX
183  class vtkInternal;
184  vtkInternal *Internal;
185 
186  // Friend so vtkInternal can access MidpointIdMap
187  // (so Sun CC compiler doesn't complain).
188  friend class vtkInternal;
189 
191 
195 
198 
201 
206  double Frequency;
209  double Phase;
210 
211 //ETX
212 
213  virtual int RequestInformation(vtkInformation *request,
214  vtkInformationVector **inputVector,
215  vtkInformationVector *outputVector);
216 
217  virtual int RequestData(vtkInformation *request,
218  vtkInformationVector **inputVector,
219  vtkInformationVector *outputVector);
220 
222 
223  static void SelectionModifiedCallback(vtkObject *caller, unsigned long eid,
224  void *clientdata, void *calldata);
226 
228 
233  virtual vtkIdType GetNumTuplesInVariable(int ncFD, int varId,
234  int expectedNumComponents);
236 
239  virtual int CheckTetrahedraWinding(int meshFD);
240 
242 
244  virtual int ReadConnectivity(int meshFD, vtkMultiBlockDataSet *surfaceOutput,
245  vtkMultiBlockDataSet *volumeOutput);
247 
249 
250  virtual int ReadTetrahedronInteriorArray(int meshFD,
251  vtkIdTypeArray *connectivity);
252  virtual int ReadTetrahedronExteriorArray(int meshFD,
253  vtkIdTypeArray *connectivity);
255 
256 //BTX
258 
260  virtual vtkSmartPointer<vtkDataArray> ReadPointDataArray(int ncFD, int varId);
261 //ETX
263 
264 //BTX
266 
267  enum {
268  NumPerTetInt = 5,
269  NumPerTetExt = 9
270  };
271 //ETX
273 
274 //BTX
276 
277  class VTKIONETCDF_EXPORT MidpointCoordinateMap
278  {
279  public:
283 
284  void AddMidpoint(const EdgeEndpoints &edge,
285  const MidpointCoordinates &midpoint);
286  void RemoveMidpoint(const EdgeEndpoints &edge);
287  void RemoveAllMidpoints();
288  vtkIdType GetNumberOfMidpoints() const;
289 
292  MidpointCoordinates *FindMidpoint(const EdgeEndpoints &edge);
293 
294  protected:
295  class vtkInternal;
296  vtkInternal *Internal;
297 
298  private:
299  // Too lazy to implement these.
301  void operator=(const MidpointCoordinateMap &);
302  };
303 
305 
306  class VTKIONETCDF_EXPORT MidpointIdMap
307  {
308  public:
309  MidpointIdMap();
310  ~MidpointIdMap();
312 
313  void AddMidpoint(const EdgeEndpoints &edge, vtkIdType midpoint);
314  void RemoveMidpoint(const EdgeEndpoints &edge);
315  void RemoveAllMidpoints();
316  vtkIdType GetNumberOfMidpoints() const;
317 
320  vtkIdType *FindMidpoint(const EdgeEndpoints &edge);
321 
323  void InitTraversal();
326  bool GetNextMidpoint(EdgeEndpoints &edge, vtkIdType &midpoint);
327 
328  protected:
329  class vtkInternal;
330  vtkInternal *Internal;
331 
332  private:
333  // Too lazy to implement these.
334  MidpointIdMap(const MidpointIdMap &);
335  void operator=(const MidpointIdMap &);
336  };
337 //ETX
338 
341  virtual int ReadCoordinates(int meshFD, vtkMultiBlockDataSet *output);
342 
344 
347  virtual int ReadMidpointCoordinates(int meshFD, vtkMultiBlockDataSet *output,
348  MidpointCoordinateMap &map);
350 
352 
355  virtual int ReadMidpointData(int meshFD, vtkMultiBlockDataSet *output,
356  MidpointIdMap &map);
358 
360 
362  virtual int RestoreMeshCache(vtkMultiBlockDataSet *surfaceOutput,
363  vtkMultiBlockDataSet *volumeOutput,
364  vtkMultiBlockDataSet *compositeOutput);
366 
369  virtual int ReadFieldData(int modeFD, vtkMultiBlockDataSet *output);
370 
372 
374  virtual int InterpolateMidpointData(vtkMultiBlockDataSet *output,
375  MidpointIdMap &map);
377 
382 
385  virtual int MeshUpToDate();
386 
387 private:
388  vtkSLACReader(const vtkSLACReader &); // Not implemented
389  void operator=(const vtkSLACReader &); // Not implemented
390 };
391 
392 #endif //__vtkSLACReader_h