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 
41 
42 #include "vtkSmartPointer.h" // For internal method.
43 
45 class vtkIdTypeArray;
48 
50 {
51 public:
53  static vtkSLACReader *New();
54  virtual void PrintSelf(ostream &os, vtkIndent indent);
55 
56  vtkGetStringMacro(MeshFileName);
57  vtkSetStringMacro(MeshFileName);
58 
60 
64  virtual void AddModeFileName(const char *fname);
65  virtual void RemoveAllModeFileNames();
66  virtual unsigned int GetNumberOfModeFileNames();
67  virtual const char *GetModeFileName(unsigned int idx);
69 
71 
73  vtkGetMacro(ReadInternalVolume, int);
74  vtkSetMacro(ReadInternalVolume, int);
75  vtkBooleanMacro(ReadInternalVolume, int);
77 
79 
81  vtkGetMacro(ReadExternalSurface, int);
82  vtkSetMacro(ReadExternalSurface, int);
83  vtkBooleanMacro(ReadExternalSurface, int);
85 
87 
89  vtkGetMacro(ReadMidpoints, int);
90  vtkSetMacro(ReadMidpoints, int);
91  vtkBooleanMacro(ReadMidpoints, int);
93 
95 
96  virtual int GetNumberOfVariableArrays();
97  virtual const char *GetVariableArrayName(int idx);
98  virtual int GetVariableArrayStatus(const char *name);
99  virtual void SetVariableArrayStatus(const char *name, int status);
101 
103  static int CanReadFile(const char *filename);
104 
107  static vtkInformationIntegerKey *IS_INTERNAL_VOLUME();
108 
111  static vtkInformationIntegerKey *IS_EXTERNAL_SURFACE();
112 
114 
118  static vtkInformationObjectBaseKey *POINTS();
119  static vtkInformationObjectBaseKey *POINT_DATA();
121 
122 //BTX
124 
128  {
129  public:
130  EdgeEndpoints() : MinEndPoint(-1), MaxEndPoint(-1) {}
131  EdgeEndpoints(vtkIdType endpointA, vtkIdType endpointB) {
132  if (endpointA < endpointB)
133  {
134  this->MinEndPoint = endpointA; this->MaxEndPoint = endpointB;
135  }
136  else
137  {
138  this->MinEndPoint = endpointB; this->MaxEndPoint = endpointA;
139  }
140  }
141  inline vtkIdType GetMinEndPoint() const { return this->MinEndPoint; }
142  inline vtkIdType GetMaxEndPoint() const { return this->MaxEndPoint; }
143  inline bool operator==(const EdgeEndpoints &other) const {
144  return ( (this->GetMinEndPoint() == other.GetMinEndPoint())
145  && (this->GetMaxEndPoint() == other.GetMaxEndPoint()) );
146  }
147  protected:
150  };
152 
154 
156  {
157  public:
159  MidpointCoordinates(const double coord[3], vtkIdType id) {
160  this->Coordinate[0] = coord[0];
161  this->Coordinate[1] = coord[1];
162  this->Coordinate[2] = coord[2];
163  this->ID = id;
164  }
165  double Coordinate[3];
167  };
169 
170  enum {
171  SURFACE_OUTPUT = 0,
172  VOLUME_OUTPUT = 1,
173  NUM_OUTPUTS = 2
174  };
175 //ETX
176 
177 protected:
178  vtkSLACReader();
179  ~vtkSLACReader();
180 
181 //BTX
182  class vtkInternal;
183  vtkInternal *Internal;
184 
185  // Friend so vtkInternal can access MidpointIdMap
186  // (so Sun CC compiler doesn't complain).
187  friend class vtkInternal;
188 
190 
194 
197 
200 
205  double Frequency;
208  double Phase;
209 
210 //ETX
211 
212  virtual int RequestInformation(vtkInformation *request,
213  vtkInformationVector **inputVector,
214  vtkInformationVector *outputVector);
215 
216  virtual int RequestData(vtkInformation *request,
217  vtkInformationVector **inputVector,
218  vtkInformationVector *outputVector);
219 
221 
222  static void SelectionModifiedCallback(vtkObject *caller, unsigned long eid,
223  void *clientdata, void *calldata);
225 
227 
232  virtual vtkIdType GetNumTuplesInVariable(int ncFD, int varId,
233  int expectedNumComponents);
235 
238  virtual int CheckTetrahedraWinding(int meshFD);
239 
241 
243  virtual int ReadConnectivity(int meshFD, vtkMultiBlockDataSet *surfaceOutput,
244  vtkMultiBlockDataSet *volumeOutput);
246 
248 
249  virtual int ReadTetrahedronInteriorArray(int meshFD,
250  vtkIdTypeArray *connectivity);
251  virtual int ReadTetrahedronExteriorArray(int meshFD,
252  vtkIdTypeArray *connectivity);
254 
255 //BTX
257 
259  virtual vtkSmartPointer<vtkDataArray> ReadPointDataArray(int ncFD, int varId);
260 //ETX
262 
263 //BTX
265 
266  enum {
267  NumPerTetInt = 5,
268  NumPerTetExt = 9
269  };
270 //ETX
272 
273 //BTX
275 
277  {
278  public:
282 
283  void AddMidpoint(const EdgeEndpoints &edge,
284  const MidpointCoordinates &midpoint);
285  void RemoveMidpoint(const EdgeEndpoints &edge);
286  void RemoveAllMidpoints();
287  vtkIdType GetNumberOfMidpoints() const;
288 
291  MidpointCoordinates *FindMidpoint(const EdgeEndpoints &edge);
292 
293  protected:
294  class vtkInternal;
295  vtkInternal *Internal;
296 
297  private:
298  // Too lazy to implement these.
300  void operator=(const MidpointCoordinateMap &);
301  };
302 
304 
306  {
307  public:
308  MidpointIdMap();
309  ~MidpointIdMap();
311 
312  void AddMidpoint(const EdgeEndpoints &edge, vtkIdType midpoint);
313  void RemoveMidpoint(const EdgeEndpoints &edge);
314  void RemoveAllMidpoints();
315  vtkIdType GetNumberOfMidpoints() const;
316 
319  vtkIdType *FindMidpoint(const EdgeEndpoints &edge);
320 
322  void InitTraversal();
325  bool GetNextMidpoint(EdgeEndpoints &edge, vtkIdType &midpoint);
326 
327  protected:
328  class vtkInternal;
329  vtkInternal *Internal;
330 
331  private:
332  // Too lazy to implement these.
333  MidpointIdMap(const MidpointIdMap &);
334  void operator=(const MidpointIdMap &);
335  };
336 //ETX
337 
340  virtual int ReadCoordinates(int meshFD, vtkMultiBlockDataSet *output);
341 
343 
346  virtual int ReadMidpointCoordinates(int meshFD, vtkMultiBlockDataSet *output,
347  MidpointCoordinateMap &map);
349 
351 
354  virtual int ReadMidpointData(int meshFD, vtkMultiBlockDataSet *output,
355  MidpointIdMap &map);
357 
359 
361  virtual int RestoreMeshCache(vtkMultiBlockDataSet *surfaceOutput,
362  vtkMultiBlockDataSet *volumeOutput,
363  vtkMultiBlockDataSet *compositeOutput);
365 
368  virtual int ReadFieldData(int modeFD, vtkMultiBlockDataSet *output);
369 
371 
373  virtual int InterpolateMidpointData(vtkMultiBlockDataSet *output,
374  MidpointIdMap &map);
376 
381 
384  virtual int MeshUpToDate();
385 
386 private:
387  vtkSLACReader(const vtkSLACReader &); // Not implemented
388  void operator=(const vtkSLACReader &); // Not implemented
389 };
390 
391 #endif //__vtkSLACReader_h