VTK  9.4.20250207
vtkSLACReader.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3// SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-LANL-California-USGov
4
20#ifndef vtkSLACReader_h
21#define vtkSLACReader_h
22
23#include "vtkIONetCDFModule.h" // For export macro
25
26#include "vtkSmartPointer.h" // For internal method.
27
28VTK_ABI_NAMESPACE_BEGIN
30class vtkDoubleArray;
31class vtkIdTypeArray;
34
35class VTKIONETCDF_EXPORT vtkSLACReader : public vtkMultiBlockDataSetAlgorithm
36{
37public:
39 static vtkSLACReader* New();
40 void PrintSelf(ostream& os, vtkIndent indent) override;
41
42 vtkGetFilePathMacro(MeshFileName);
43 vtkSetFilePathMacro(MeshFileName);
44
46
51 virtual void AddModeFileName(VTK_FILEPATH const char* fname);
52 virtual void RemoveAllModeFileNames();
53 virtual unsigned int GetNumberOfModeFileNames();
54 virtual VTK_FILEPATH const char* GetModeFileName(unsigned int idx);
56
58
61 vtkGetMacro(ReadInternalVolume, vtkTypeBool);
62 vtkSetMacro(ReadInternalVolume, vtkTypeBool);
63 vtkBooleanMacro(ReadInternalVolume, vtkTypeBool);
65
67
70 vtkGetMacro(ReadExternalSurface, vtkTypeBool);
71 vtkSetMacro(ReadExternalSurface, vtkTypeBool);
72 vtkBooleanMacro(ReadExternalSurface, vtkTypeBool);
74
76
80 vtkGetMacro(ReadMidpoints, vtkTypeBool);
81 vtkSetMacro(ReadMidpoints, vtkTypeBool);
82 vtkBooleanMacro(ReadMidpoints, vtkTypeBool);
84
86
90 virtual const char* GetVariableArrayName(int index);
91 virtual int GetVariableArrayStatus(const char* name);
92 virtual void SetVariableArrayStatus(const char* name, int status);
94
96
99 virtual void ResetFrequencyScales();
100 virtual void SetFrequencyScale(int index, double scale);
102
104
107 virtual void ResetPhaseShifts();
108 virtual void SetPhaseShift(int index, double shift);
110
112
118
122 static int CanReadFile(VTK_FILEPATH const char* filename);
123
130
137
139
149
151
155 class VTKIONETCDF_EXPORT EdgeEndpoints
156 {
157 public:
159 : MinEndPoint(-1)
160 , MaxEndPoint(-1)
161 {
162 }
163 EdgeEndpoints(vtkIdType endpointA, vtkIdType endpointB)
164 {
165 if (endpointA < endpointB)
166 {
167 this->MinEndPoint = endpointA;
168 this->MaxEndPoint = endpointB;
169 }
170 else
171 {
172 this->MinEndPoint = endpointB;
173 this->MaxEndPoint = endpointA;
174 }
175 }
176 inline vtkIdType GetMinEndPoint() const { return this->MinEndPoint; }
177 inline vtkIdType GetMaxEndPoint() const { return this->MaxEndPoint; }
178 inline bool operator==(const EdgeEndpoints& other) const
179 {
180 return ((this->GetMinEndPoint() == other.GetMinEndPoint()) &&
181 (this->GetMaxEndPoint() == other.GetMaxEndPoint()));
182 }
183
184 protected:
187 };
189
191
194 class VTKIONETCDF_EXPORT MidpointCoordinates
195 {
196 public:
198 MidpointCoordinates(const double coord[3], vtkIdType id)
199 {
200 this->Coordinate[0] = coord[0];
201 this->Coordinate[1] = coord[1];
202 this->Coordinate[2] = coord[2];
203 this->ID = id;
204 }
205 double Coordinate[3];
207 };
209
210 enum
211 {
212 SURFACE_OUTPUT = 0,
213 VOLUME_OUTPUT = 1,
214 NUM_OUTPUTS = 2
215 };
216
217protected:
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
250 vtkInformationVector* outputVector) override;
251
253 vtkInformationVector* outputVector) override;
254
259 vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
260
268 virtual vtkIdType GetNumTuplesInVariable(int ncFD, int varId, int expectedNumComponents);
269
274 virtual int CheckTetrahedraWinding(int meshFD);
275
280 virtual int ReadConnectivity(
281 int meshFD, vtkMultiBlockDataSet* surfaceOutput, vtkMultiBlockDataSet* volumeOutput);
282
284
287 virtual int ReadTetrahedronInteriorArray(int meshFD, vtkIdTypeArray* connectivity);
288 virtual int ReadTetrahedronExteriorArray(int meshFD, vtkIdTypeArray* connectivity);
290
295
299 enum
300 {
301 NumPerTetInt = 5,
302 NumPerTetExt = 9
303 };
304
306
309 class VTKIONETCDF_EXPORT MidpointCoordinateMap
310 {
311 public:
315
316 void AddMidpoint(const EdgeEndpoints& edge, const MidpointCoordinates& midpoint);
317 void RemoveMidpoint(const EdgeEndpoints& edge);
320
326
327 protected:
328 class vtkInternal;
329 vtkInternal* Internal;
330
331 private:
332 // Too lazy to implement these.
334 void operator=(const MidpointCoordinateMap&) = delete;
335 };
336
338
341 class VTKIONETCDF_EXPORT MidpointIdMap
342 {
343 public:
347
348 void AddMidpoint(const EdgeEndpoints& edge, vtkIdType midpoint);
349 void RemoveMidpoint(const EdgeEndpoints& edge);
352
357
366
367 protected:
368 class vtkInternal;
369 vtkInternal* Internal;
370
371 private:
372 // Too lazy to implement these.
373 MidpointIdMap(const MidpointIdMap&) = delete;
374 void operator=(const MidpointIdMap&) = delete;
375 };
376
381 virtual int ReadCoordinates(int meshFD, vtkMultiBlockDataSet* output);
382
389 int meshFD, vtkMultiBlockDataSet* output, MidpointCoordinateMap& map);
390
396 virtual int ReadMidpointData(
397 int meshFD, vtkMultiBlockDataSet* output, MidpointIdMap& midpointIds);
398
403 virtual int RestoreMeshCache(vtkMultiBlockDataSet* surfaceOutput,
404 vtkMultiBlockDataSet* volumeOutput, vtkMultiBlockDataSet* compositeOutput);
405
410 virtual int ReadFieldData(const int* modeFDArray, int numModeFDs, vtkMultiBlockDataSet* output);
411
417
424
429 virtual int MeshUpToDate();
430
431private:
432 vtkSLACReader(const vtkSLACReader&) = delete;
433 void operator=(const vtkSLACReader&) = delete;
434};
435
436VTK_ABI_NAMESPACE_END
437#endif // vtkSLACReader_h
Store on/off settings for data arrays, etc.
dynamic, self-adjusting array of double
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition vtkIndent.h:108
Key for integer values in vtkInformation.
Key for vtkObjectBase values.
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Superclass for algorithms that produce only vtkMultiBlockDataSet as output.
Composite dataset that organizes datasets into blocks.
abstract base class for most VTK objects
Definition vtkObject.h:162
Simple class used internally to define an edge based on the endpoints.
vtkIdType GetMinEndPoint() const
vtkIdType GetMaxEndPoint() const
bool operator==(const EdgeEndpoints &other) const
EdgeEndpoints(vtkIdType endpointA, vtkIdType endpointB)
Manages a map from edges to midpoint coordinates.
MidpointCoordinates * FindMidpoint(const EdgeEndpoints &edge)
Finds the coordinates for the given edge or returns nullptr if it does not exist.
void RemoveMidpoint(const EdgeEndpoints &edge)
void AddMidpoint(const EdgeEndpoints &edge, const MidpointCoordinates &midpoint)
Simple class used internally for holding midpoint information.
MidpointCoordinates(const double coord[3], vtkIdType id)
Manages a map from edges to the point id of the midpoint.
vtkIdType GetNumberOfMidpoints() const
void AddMidpoint(const EdgeEndpoints &edge, vtkIdType midpoint)
void InitTraversal()
Initialize iteration.
bool GetNextMidpoint(EdgeEndpoints &edge, vtkIdType &midpoint)
Get the next midpoint in the iteration.
vtkIdType * FindMidpoint(const EdgeEndpoints &edge)
Finds the id for the given edge or returns nullptr if it does not exist.
void RemoveMidpoint(const EdgeEndpoints &edge)
A reader for a data format used by Omega3p, Tau3p, and several other tools used at the Standford Line...
virtual void ResetFrequencyScales()
Sets the scale factor for each mode.
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
bool TimeStepModes
True if "mode" files are a sequence of time steps.
vtkInternal * Internal
virtual void SetPhaseShift(int index, double shift)
Sets the phase offset for each mode.
virtual void SetFrequencyScale(int index, double scale)
Sets the scale factor for each mode.
virtual int ReadMidpointCoordinates(int meshFD, vtkMultiBlockDataSet *output, MidpointCoordinateMap &map)
Reads in the midpoint coordinate data from the mesh file and returns a map from edges to midpoints.
virtual const char * GetVariableArrayName(int index)
Variable array selection.
static void SelectionModifiedCallback(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata)
Callback registered with the VariableArraySelection.
static int CanReadFile(VTK_FILEPATH const char *filename)
Returns true if the given file can be read by this reader.
static vtkSLACReader * New()
vtkTypeBool ReadMidpoints
virtual VTK_FILEPATH const char * GetModeFileName(unsigned int idx)
There may be one mode file (usually for actual modes) or multiple mode files (which usually actually ...
~vtkSLACReader() override
vtkGetFilePathMacro(MeshFileName)
virtual int RestoreMeshCache(vtkMultiBlockDataSet *surfaceOutput, vtkMultiBlockDataSet *volumeOutput, vtkMultiBlockDataSet *compositeOutput)
Instead of reading data from the mesh file, restore the data from the previous mesh file read.
virtual int ReadTetrahedronExteriorArray(int meshFD, vtkIdTypeArray *connectivity)
Reads tetrahedron connectivity arrays.
virtual int ReadFieldData(const int *modeFDArray, int numModeFDs, vtkMultiBlockDataSet *output)
Read in the field data from the mode file.
virtual void ResetPhaseShifts()
Sets the phase offset for each mode.
virtual int MeshUpToDate()
Returns 1 if the mesh is up to date, 0 if the mesh needs to be read from disk.
virtual vtkDoubleArray * GetPhaseShifts()
NOTE: This is not thread-safe.
virtual int ReadMidpointData(int meshFD, vtkMultiBlockDataSet *output, MidpointIdMap &midpointIds)
Read in the midpoint data from the mesh file.
virtual unsigned int GetNumberOfModeFileNames()
There may be one mode file (usually for actual modes) or multiple mode files (which usually actually ...
bool FrequencyModes
True if mode files describe vibrating fields.
virtual int ReadCoordinates(int meshFD, vtkMultiBlockDataSet *output)
Read in the point coordinate data from the mesh file.
virtual vtkDoubleArray * GetFrequencyScales()
NOTE: This is not thread-safe.
virtual int ReadTetrahedronInteriorArray(int meshFD, vtkIdTypeArray *connectivity)
Reads tetrahedron connectivity arrays.
vtkTimeStamp MeshReadTime
A time stamp for the last time the mesh file was read.
virtual int ReadConnectivity(int meshFD, vtkMultiBlockDataSet *surfaceOutput, vtkMultiBlockDataSet *volumeOutput)
Read the connectivity information from the mesh file.
bool ReadModeData
True if reading from a proper mode file.
virtual int GetVariableArrayStatus(const char *name)
Variable array selection.
int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
virtual vtkIdType GetNumTuplesInVariable(int ncFD, int varId, int expectedNumComponents)
Convenience function that checks the dimensions of a 2D netCDF array that is supposed to be a set of ...
vtkTypeBool ReadInternalVolume
vtkTypeBool ReadExternalSurface
virtual int InterpolateMidpointData(vtkMultiBlockDataSet *output, MidpointIdMap &map)
Takes the data read on the fields and interpolates data for the midpoints.
virtual void AddModeFileName(VTK_FILEPATH const char *fname)
There may be one mode file (usually for actual modes) or multiple mode files (which usually actually ...
virtual int GetNumberOfVariableArrays()
Variable array selection.
virtual void RemoveAllModeFileNames()
There may be one mode file (usually for actual modes) or multiple mode files (which usually actually ...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSetFilePathMacro(MeshFileName)
virtual int CheckTetrahedraWinding(int meshFD)
Checks the winding of the tetrahedra in the mesh file.
virtual void SetVariableArrayStatus(const char *name, int status)
Variable array selection.
virtual vtkSmartPointer< vtkDataArray > ReadPointDataArray(int ncFD, int varId)
Reads point data arrays.
Hold a reference to a vtkObjectBase instance.
record modification and/or execution time
static vtkInformationIntegerKey * IS_EXTERNAL_SURFACE()
This key is attached to the metadata information of all data sets in the output that are part of the ...
static vtkInformationObjectBaseKey * POINT_DATA()
All the data sets stored in the multiblock output share the same point data.
static vtkInformationObjectBaseKey * POINTS()
All the data sets stored in the multiblock output share the same point data.
static vtkInformationIntegerKey * IS_INTERNAL_VOLUME()
This key is attached to the metadata information of all data sets in the output that are part of the ...
int vtkTypeBool
Definition vtkABI.h:64
int vtkIdType
Definition vtkType.h:315
#define VTK_FILEPATH