/usr/include/vtk-6.3/vtkSLACReader.h is in libvtk6-dev 6.3.0+dfsg1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | // -*- c++ -*-
/*=========================================================================
Program: Visualization Toolkit
Module: vtkSLACReader.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*-------------------------------------------------------------------------
Copyright 2008 Sandia Corporation.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------*/
// .NAME vtkSLACReader
//
// .SECTION Description
//
// A reader for a data format used by Omega3p, Tau3p, and several other tools
// used at the Standford Linear Accelerator Center (SLAC). The underlying
// format uses netCDF to store arrays, but also imposes several conventions
// to form an unstructured grid of elements.
//
#ifndef vtkSLACReader_h
#define vtkSLACReader_h
#include "vtkIONetCDFModule.h" // For export macro
#include "vtkMultiBlockDataSetAlgorithm.h"
#include "vtkSmartPointer.h" // For internal method.
class vtkDataArraySelection;
class vtkDoubleArray;
class vtkIdTypeArray;
class vtkInformationIntegerKey;
class vtkInformationObjectBaseKey;
class VTKIONETCDF_EXPORT vtkSLACReader : public vtkMultiBlockDataSetAlgorithm
{
public:
vtkTypeMacro(vtkSLACReader, vtkMultiBlockDataSetAlgorithm);
static vtkSLACReader *New();
virtual void PrintSelf(ostream &os, vtkIndent indent);
vtkGetStringMacro(MeshFileName);
vtkSetStringMacro(MeshFileName);
// Description:
// There may be one mode file (usually for actual modes) or multiple mode
// files (which usually actually represent time series). These methods
// set and clear the list of mode files (which can be a single mode file).
virtual void AddModeFileName(const char *fname);
virtual void RemoveAllModeFileNames();
virtual unsigned int GetNumberOfModeFileNames();
virtual const char *GetModeFileName(unsigned int idx);
// Description:
// If on, reads the internal volume of the data set. Set to off by default.
vtkGetMacro(ReadInternalVolume, int);
vtkSetMacro(ReadInternalVolume, int);
vtkBooleanMacro(ReadInternalVolume, int);
// Description:
// If on, reads the external surfaces of the data set. Set to on by default.
vtkGetMacro(ReadExternalSurface, int);
vtkSetMacro(ReadExternalSurface, int);
vtkBooleanMacro(ReadExternalSurface, int);
// Description:
// If on, reads midpoint information for external surfaces and builds
// quadratic surface triangles. Set to on by default.
vtkGetMacro(ReadMidpoints, int);
vtkSetMacro(ReadMidpoints, int);
vtkBooleanMacro(ReadMidpoints, int);
// Description:
// Variable array selection.
virtual int GetNumberOfVariableArrays();
virtual const char *GetVariableArrayName(int idx);
virtual int GetVariableArrayStatus(const char *name);
virtual void SetVariableArrayStatus(const char *name, int status);
// Description:
// Sets the scale factor for each mode. Each scale factor is reset to 1.
virtual void ResetFrequencyScales();
virtual void SetFrequencyScale(int index, double scale);
// Description:
// Sets the phase offset for each mode. Each shift is reset to 0.
virtual void ResetPhaseShifts();
virtual void SetPhaseShift(int index, double shift);
// Description:
// NOTE: This is not thread-safe.
virtual vtkDoubleArray* GetFrequencyScales();
virtual vtkDoubleArray* GetPhaseShifts();
// Description:
// Returns true if the given file can be read by this reader.
static int CanReadFile(const char *filename);
// Description:
// This key is attached to the metadata information of all data sets in the
// output that are part of the internal volume.
static vtkInformationIntegerKey *IS_INTERNAL_VOLUME();
// Description:
// This key is attached to the metadata information of all data sets in the
// output that are part of the external surface.
static vtkInformationIntegerKey *IS_EXTERNAL_SURFACE();
// Description:
// All the data sets stored in the multiblock output share the same point
// data. For convienience, the point coordinates (vtkPoints) and point data
// (vtkPointData) are saved under these keys in the vtkInformation of the
// output data set.
static vtkInformationObjectBaseKey *POINTS();
static vtkInformationObjectBaseKey *POINT_DATA();
//BTX
// Description:
// Simple class used internally to define an edge based on the endpoints. The
// endpoints are canonically identified by the lower and higher values.
class VTKIONETCDF_EXPORT EdgeEndpoints
{
public:
EdgeEndpoints() : MinEndPoint(-1), MaxEndPoint(-1) {}
EdgeEndpoints(vtkIdType endpointA, vtkIdType endpointB) {
if (endpointA < endpointB)
{
this->MinEndPoint = endpointA; this->MaxEndPoint = endpointB;
}
else
{
this->MinEndPoint = endpointB; this->MaxEndPoint = endpointA;
}
}
inline vtkIdType GetMinEndPoint() const { return this->MinEndPoint; }
inline vtkIdType GetMaxEndPoint() const { return this->MaxEndPoint; }
inline bool operator==(const EdgeEndpoints &other) const {
return ( (this->GetMinEndPoint() == other.GetMinEndPoint())
&& (this->GetMaxEndPoint() == other.GetMaxEndPoint()) );
}
protected:
vtkIdType MinEndPoint;
vtkIdType MaxEndPoint;
};
// Description:
// Simple class used internally for holding midpoint information.
class VTKIONETCDF_EXPORT MidpointCoordinates
{
public:
MidpointCoordinates() {}
MidpointCoordinates(const double coord[3], vtkIdType id) {
this->Coordinate[0] = coord[0];
this->Coordinate[1] = coord[1];
this->Coordinate[2] = coord[2];
this->ID = id;
}
double Coordinate[3];
vtkIdType ID;
};
enum {
SURFACE_OUTPUT = 0,
VOLUME_OUTPUT = 1,
NUM_OUTPUTS = 2
};
//ETX
protected:
vtkSLACReader();
~vtkSLACReader();
//BTX
class vtkInternal;
vtkInternal *Internal;
// Friend so vtkInternal can access MidpointIdMap
// (so Sun CC compiler doesn't complain).
friend class vtkInternal;
char *MeshFileName;
int ReadInternalVolume;
int ReadExternalSurface;
int ReadMidpoints;
// Description:
// True if reading from a proper mode file. Set in RequestInformation.
bool ReadModeData;
// Description:
// True if "mode" files are a sequence of time steps.
bool TimeStepModes;
// Description:
// True if mode files describe vibrating fields.
bool FrequencyModes;
//ETX
virtual int RequestInformation(vtkInformation *request,
vtkInformationVector **inputVector,
vtkInformationVector *outputVector);
virtual int RequestData(vtkInformation *request,
vtkInformationVector **inputVector,
vtkInformationVector *outputVector);
// Description:
// Callback registered with the VariableArraySelection.
static void SelectionModifiedCallback(vtkObject *caller, unsigned long eid,
void *clientdata, void *calldata);
// Description:
// Convenience function that checks the dimensions of a 2D netCDF array that
// is supposed to be a set of tuples. It makes sure that the number of
// dimensions is expected and that the number of components in each tuple
// agree with what is expected. It then returns the number of tuples. An
// error is emitted and 0 is returned if the checks fail.
virtual vtkIdType GetNumTuplesInVariable(int ncFD, int varId,
int expectedNumComponents);
// Description:
// Checks the winding of the tetrahedra in the mesh file. Returns 1 if
// the winding conforms to VTK, 0 if the winding needs to be corrected.
virtual int CheckTetrahedraWinding(int meshFD);
// Description:
// Read the connectivity information from the mesh file. Returns 1 on
// success, 0 on failure.
virtual int ReadConnectivity(int meshFD, vtkMultiBlockDataSet *surfaceOutput,
vtkMultiBlockDataSet *volumeOutput);
// Description:
// Reads tetrahedron connectivity arrays. Called by ReadConnectivity.
virtual int ReadTetrahedronInteriorArray(int meshFD,
vtkIdTypeArray *connectivity);
virtual int ReadTetrahedronExteriorArray(int meshFD,
vtkIdTypeArray *connectivity);
//BTX
// Description:
// Reads point data arrays. Called by ReadCoordinates and ReadFieldData.
virtual vtkSmartPointer<vtkDataArray> ReadPointDataArray(int ncFD, int varId);
//ETX
//BTX
// Description:
// Helpful constants equal to the amount of identifiers per tet.
enum {
NumPerTetInt = 5,
NumPerTetExt = 9
};
//ETX
//BTX
// Description:
// Manages a map from edges to midpoint coordinates.
class VTKIONETCDF_EXPORT MidpointCoordinateMap
{
public:
MidpointCoordinateMap();
~MidpointCoordinateMap();
void AddMidpoint(const EdgeEndpoints &edge,
const MidpointCoordinates &midpoint);
void RemoveMidpoint(const EdgeEndpoints &edge);
void RemoveAllMidpoints();
vtkIdType GetNumberOfMidpoints() const;
// Description:
// Finds the coordinates for the given edge or returns NULL if it
// does not exist.
MidpointCoordinates *FindMidpoint(const EdgeEndpoints &edge);
protected:
class vtkInternal;
vtkInternal *Internal;
private:
// Too lazy to implement these.
MidpointCoordinateMap(const MidpointCoordinateMap &);
void operator=(const MidpointCoordinateMap &);
};
// Description:
// Manages a map from edges to the point id of the midpoint.
class VTKIONETCDF_EXPORT MidpointIdMap
{
public:
MidpointIdMap();
~MidpointIdMap();
void AddMidpoint(const EdgeEndpoints &edge, vtkIdType midpoint);
void RemoveMidpoint(const EdgeEndpoints &edge);
void RemoveAllMidpoints();
vtkIdType GetNumberOfMidpoints() const;
// Description:
// Finds the id for the given edge or returns NULL if it does not exist.
vtkIdType *FindMidpoint(const EdgeEndpoints &edge);
// Description:
// Initialize iteration. The iteration can occur in any order.
void InitTraversal();
// Description:
// Get the next midpoint in the iteration. Return 0 if the end is reached.
bool GetNextMidpoint(EdgeEndpoints &edge, vtkIdType &midpoint);
protected:
class vtkInternal;
vtkInternal *Internal;
private:
// Too lazy to implement these.
MidpointIdMap(const MidpointIdMap &);
void operator=(const MidpointIdMap &);
};
//ETX
// Description:
// Read in the point coordinate data from the mesh file. Returns 1 on
// success, 0 on failure.
virtual int ReadCoordinates(int meshFD, vtkMultiBlockDataSet *output);
// Description:
// Reads in the midpoint coordinate data from the mesh file and returns a map
// from edges to midpoints. This method is called by ReadMidpointData.
// Returns 1 on success, 0 on failure.
virtual int ReadMidpointCoordinates(int meshFD, vtkMultiBlockDataSet *output,
MidpointCoordinateMap &map);
// Description:
// Read in the midpoint data from the mesh file. Returns 1 on success,
// 0 on failure. Also fills a midpoint id map that will be passed into
// InterpolateMidpointFieldData.
virtual int ReadMidpointData(int meshFD, vtkMultiBlockDataSet *output,
MidpointIdMap &map);
// Description:
// Instead of reading data from the mesh file, restore the data from the
// previous mesh file read.
virtual int RestoreMeshCache(vtkMultiBlockDataSet *surfaceOutput,
vtkMultiBlockDataSet *volumeOutput,
vtkMultiBlockDataSet *compositeOutput);
// Description:
// Read in the field data from the mode file. Returns 1 on success, 0
// on failure.
virtual int ReadFieldData(const int *modeFDArray,
int numModeFDs,
vtkMultiBlockDataSet *output);
// Description:
// Takes the data read on the fields and interpolates data for the midpoints.
// map is the same map that was created in ReadMidpointData.
virtual int InterpolateMidpointData(vtkMultiBlockDataSet *output,
MidpointIdMap &map);
// Description:
// A time stamp for the last time the mesh file was read. This is used to
// determine whether the mesh needs to be read in again or if we just need
// to read the mode data.
vtkTimeStamp MeshReadTime;
// Description:
// Returns 1 if the mesh is up to date, 0 if the mesh needs to be read from
// disk.
virtual int MeshUpToDate();
private:
vtkSLACReader(const vtkSLACReader &); // Not implemented
void operator=(const vtkSLACReader &); // Not implemented
};
#endif //vtkSLACReader_h
|