VTK  9.1.0
vtkTemporalInterpolatedVelocityField.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkTemporalInterpolatedVelocityField.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
48#ifndef vtkTemporalInterpolatedVelocityField_h
49#define vtkTemporalInterpolatedVelocityField_h
50
51#include "vtkFiltersFlowPathsModule.h" // For export macro
52#include "vtkFunctionSet.h"
53#include "vtkSmartPointer.h" // because it is good
54
55#include <vector> // Because they are good
56
57#define ID_INSIDE_ALL 00
58#define ID_OUTSIDE_ALL 01
59#define ID_OUTSIDE_T0 02
60#define ID_OUTSIDE_T1 03
61
62class vtkDataSet;
63class vtkDataArray;
64class vtkPointData;
65class vtkGenericCell;
66class vtkDoubleArray;
68
69class VTKFILTERSFLOWPATHS_EXPORT vtkTemporalInterpolatedVelocityField : public vtkFunctionSet
70{
71public:
73 void PrintSelf(ostream& os, vtkIndent indent) override;
74
80
81 using Superclass::FunctionValues;
83
87 int FunctionValues(double* x, double* u) override;
88 int FunctionValuesAtT(int T, double* x, double* u);
90
96 void SelectVectors(const char* fieldName) { this->SetVectorsSelection(fieldName); }
97
103 void SetDataSetAtTime(int I, int N, double T, vtkDataSet* dataset, bool staticdataset);
104
106
111 bool GetCachedCellIds(vtkIdType id[2], int ds[2]);
112 void SetCachedCellIds(vtkIdType id[2], int ds[2]);
114
120
122
126 int TestPoint(double* x);
127 int QuickTestPoint(double* x);
129
131
135 vtkGetVector3Macro(LastGoodVelocity, double);
137
139
142 vtkGetMacro(CurrentWeight, double);
144
145 bool InterpolatePoint(vtkPointData* outPD1, vtkPointData* outPD2, vtkIdType outIndex);
146
147 bool InterpolatePoint(int T, vtkPointData* outPD1, vtkIdType outIndex);
148
150 int T, double pcoords[3], double* weights, vtkGenericCell*& cell, vtkDoubleArray* cellVectors);
151
153 bool IsStatic(int datasetIndex);
154
156
157protected:
160
161 int FunctionValues(vtkDataSet* ds, double* x, double* f);
162 virtual void SetVectorsSelection(const char* v);
163
164 double Vals1[3];
165 double Vals2[3];
166 double Times[2];
167 double LastGoodVelocity[3];
168
169 // The weight (0.0->1.0) of the value of T between the two available
170 // time values for the current computation
172 // One minus the CurrentWeight
174 // A scaling factor used when calculating the CurrentWeight { 1.0/(T2-T1) }
176
178 // we want to keep track of static datasets so we can optimize caching
179 std::vector<bool> StaticDataSets;
180
181private:
182 // Hide this since we need multiple time steps and are using a different
183 // function prototype
184 virtual void AddDataSet(vtkDataSet*) {}
185
186private:
188 void operator=(const vtkTemporalInterpolatedVelocityField&) = delete;
189};
190
191#endif
Interface for obtaining interpolated velocity values.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
abstract class to specify dataset behavior
Definition: vtkDataSet.h:166
dynamic, self-adjusting array of double
Abstract interface for sets of functions.
provides thread-safe access to cells
a simple class to control print indentation
Definition: vtkIndent.h:113
represent and manipulate point attribute data
Definition: vtkPointData.h:142
A helper class for interpolating between times during particle tracing.
int QuickTestPoint(double *x)
A utility function which evaluates the point at T1, T2 to see if it is inside the data at both times ...
int TestPoint(double *x)
A utility function which evaluates the point at T1, T2 to see if it is inside the data at both times ...
bool IsStatic(int datasetIndex)
bool InterpolatePoint(vtkPointData *outPD1, vtkPointData *outPD2, vtkIdType outIndex)
int FunctionValues(vtkDataSet *ds, double *x, double *f)
void SelectVectors(const char *fieldName)
If you want to work with an arbitrary vector array, then set its name here.
virtual void SetVectorsSelection(const char *v)
bool GetVorticityData(int T, double pcoords[3], double *weights, vtkGenericCell *&cell, vtkDoubleArray *cellVectors)
bool InterpolatePoint(int T, vtkPointData *outPD1, vtkIdType outIndex)
void SetCachedCellIds(vtkIdType id[2], int ds[2])
Between iterations of the Particle Tracer, Id's of the Cell are stored and then at the start of the n...
bool GetCachedCellIds(vtkIdType id[2], int ds[2])
Between iterations of the Particle Tracer, Id's of the Cell are stored and then at the start of the n...
void SetDataSetAtTime(int I, int N, double T, vtkDataSet *dataset, bool staticdataset)
In order to use this class, two sets of data must be supplied, corresponding to times T1 and T2.
void ClearCache()
Set the last cell id to -1 so that the next search does not start from the previous cell.
int FunctionValues(double *x, double *u) override
Evaluate the velocity field, f, at (x, y, z, t).
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int FunctionValuesAtT(int T, double *x, double *u)
Evaluate the velocity field, f, at (x, y, z, t).
static vtkTemporalInterpolatedVelocityField * New()
Construct a vtkTemporalInterpolatedVelocityField with no initial data set.
int vtkIdType
Definition: vtkType.h:332