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 
202 
204  // Description:
205  // The rate at which the fields repeat.
206  // Only valid when FrequencyModes is true.
207  double Frequency;
208  // Description:
209  // The phase of the current time step. Set at the begining of RequestData.
210  double Phase;
212 
213 //ETX
214 
215  virtual int RequestInformation(vtkInformation *request,
216  vtkInformationVector **inputVector,
217  vtkInformationVector *outputVector);
218 
219  virtual int RequestData(vtkInformation *request,
220  vtkInformationVector **inputVector,
221  vtkInformationVector *outputVector);
222 
224 
225  static void SelectionModifiedCallback(vtkObject *caller, unsigned long eid,
226  void *clientdata, void *calldata);
228 
230 
235  virtual vtkIdType GetNumTuplesInVariable(int ncFD, int varId,
236  int expectedNumComponents);
238 
241  virtual int CheckTetrahedraWinding(int meshFD);
242 
244 
246  virtual int ReadConnectivity(int meshFD, vtkMultiBlockDataSet *surfaceOutput,
247  vtkMultiBlockDataSet *volumeOutput);
249 
251 
252  virtual int ReadTetrahedronInteriorArray(int meshFD,
253  vtkIdTypeArray *connectivity);
254  virtual int ReadTetrahedronExteriorArray(int meshFD,
255  vtkIdTypeArray *connectivity);
257 
258 //BTX
260 
262  virtual vtkSmartPointer<vtkDataArray> ReadPointDataArray(int ncFD, int varId);
263 //ETX
265 
266 //BTX
268 
269  enum {
270  NumPerTetInt = 5,
271  NumPerTetExt = 9
272  };
273 //ETX
275 
276 //BTX
278 
280  {
281  public:
285 
286  void AddMidpoint(const EdgeEndpoints &edge,
287  const MidpointCoordinates &midpoint);
288  void RemoveMidpoint(const EdgeEndpoints &edge);
289  void RemoveAllMidpoints();
290  vtkIdType GetNumberOfMidpoints() const;
291 
294  MidpointCoordinates *FindMidpoint(const EdgeEndpoints &edge);
295 
296  protected:
297  class vtkInternal;
298  vtkInternal *Internal;
299 
300  private:
301  // Too lazy to implement these.
303  void operator=(const MidpointCoordinateMap &);
304  };
305 
307 
309  {
310  public:
311  MidpointIdMap();
312  ~MidpointIdMap();
314 
315  void AddMidpoint(const EdgeEndpoints &edge, vtkIdType midpoint);
316  void RemoveMidpoint(const EdgeEndpoints &edge);
317  void RemoveAllMidpoints();
318  vtkIdType GetNumberOfMidpoints() const;
319 
322  vtkIdType *FindMidpoint(const EdgeEndpoints &edge);
323 
325 
326  void InitTraversal();
327  // Description:
328  // Get the next midpoint in the iteration. Return 0 if the end is reached.
329  bool GetNextMidpoint(EdgeEndpoints &edge, vtkIdType &midpoint);
331 
332  protected:
333  class vtkInternal;
334  vtkInternal *Internal;
335 
336  private:
337  // Too lazy to implement these.
338  MidpointIdMap(const MidpointIdMap &);
339  void operator=(const MidpointIdMap &);
340  };
341 //ETX
342 
345  virtual int ReadCoordinates(int meshFD, vtkMultiBlockDataSet *output);
346 
348 
351  virtual int ReadMidpointCoordinates(int meshFD, vtkMultiBlockDataSet *output,
352  MidpointCoordinateMap &map);
354 
356 
359  virtual int ReadMidpointData(int meshFD, vtkMultiBlockDataSet *output,
360  MidpointIdMap &map);
362 
364 
366  virtual int RestoreMeshCache(vtkMultiBlockDataSet *surfaceOutput,
367  vtkMultiBlockDataSet *volumeOutput,
368  vtkMultiBlockDataSet *compositeOutput);
370 
373  virtual int ReadFieldData(int modeFD, vtkMultiBlockDataSet *output);
374 
376 
378  virtual int InterpolateMidpointData(vtkMultiBlockDataSet *output,
379  MidpointIdMap &map);
381 
386 
389  virtual int MeshUpToDate();
390 
391 private:
392  vtkSLACReader(const vtkSLACReader &); // Not implemented
393  void operator=(const vtkSLACReader &); // Not implemented
394 };
395 
396 #endif //__vtkSLACReader_h
EdgeEndpoints(vtkIdType endpointA, vtkIdType endpointB)
abstract base class for most VTK objects
Definition: vtkObject.h:60
Store vtkAlgorithm input/output information.
record modification and/or execution time
Definition: vtkTimeStamp.h:33
bool operator==(const EdgeEndpoints &other) const
dynamic, self-adjusting array of vtkIdType
Hold a reference to a vtkObjectBase instance.
int vtkIdType
Definition: vtkType.h:255
Superclass for algorithms that produce only vtkMultiBlockDataSet as output.
static vtkMultiBlockDataSetAlgorithm * New()
MidpointCoordinates(const double coord[3], vtkIdType id)
a simple class to control print indentation
Definition: vtkIndent.h:37
Key for integer values in vtkInformation.
Store on/off settings for data arrays for a vtkSource.
Key for vtkObjectBase values.
vtkInternal * Internal
Composite dataset that organizes datasets into blocks.
void PrintSelf(ostream &os, vtkIndent indent)
Store zero or more vtkInformation instances.
#define VTK_IO_EXPORT
char * MeshFileName
vtkIdType GetMaxEndPoint() const
vtkIdType GetMinEndPoint() const
vtkTimeStamp MeshReadTime