VTK
dox/Filtering/vtkAbstractInterpolatedVelocityField.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkAbstractInterpolatedVelocityField.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00066 #ifndef __vtkAbstractInterpolatedVelocityField_h
00067 #define __vtkAbstractInterpolatedVelocityField_h
00068 
00069 #include "vtkFunctionSet.h"
00070 //BTX
00071 #include <vector> // STL Header; Required for vector
00072 //ETX
00073 
00074 class vtkDataSet;
00075 //BTX
00076 class vtkDataArray;
00077 //ETX
00078 class vtkPointData;
00079 class vtkGenericCell;
00080 class vtkAbstractInterpolatedVelocityFieldDataSetsType;
00081 
00082 class VTK_FILTERING_EXPORT vtkAbstractInterpolatedVelocityField : public vtkFunctionSet
00083 {
00084 public:
00085   vtkTypeMacro( vtkAbstractInterpolatedVelocityField, vtkFunctionSet );
00086   void PrintSelf( ostream & os, vtkIndent indent );
00087   
00089 
00095   vtkSetMacro( Caching, bool );
00096   vtkGetMacro( Caching, bool );
00098 
00100 
00102   vtkGetMacro( CacheHit, int );
00103   vtkGetMacro( CacheMiss, int );
00105   
00107 
00113   vtkGetMacro( LastDataSetIndex, int );
00114   vtkGetObjectMacro( LastDataSet, vtkDataSet );
00116 
00118 
00119   vtkGetMacro( LastCellId, vtkIdType );
00120   virtual void SetLastCellId( vtkIdType c ) { this->LastCellId = c; }
00122   
00124   virtual void SetLastCellId( vtkIdType c, int dataindex ) = 0;
00125   
00127 
00129   vtkGetStringMacro( VectorsSelection );
00130   void SelectVectors( const char * fieldName )
00131     { this->SetVectorsSelection( fieldName ); }
00133     
00135 
00151   vtkSetMacro( NormalizeVector, bool );
00152   vtkGetMacro( NormalizeVector, bool );
00154   
00156 
00157   virtual void CopyParameters( vtkAbstractInterpolatedVelocityField * from )
00158     { this->Caching = from->Caching; }
00160   
00165   virtual void AddDataSet( vtkDataSet * dataset ) = 0;
00166   
00168   virtual int FunctionValues( double * x, double * f ) = 0;
00169 
00172   void ClearLastCellId() { this->LastCellId = -1; }
00173 
00175 
00177   int GetLastWeights( double * w );
00178   int GetLastLocalCoordinates( double pcoords[3] );
00180 
00181 protected:
00182   vtkAbstractInterpolatedVelocityField();
00183   ~vtkAbstractInterpolatedVelocityField();
00184   
00185   static const double TOLERANCE_SCALE;
00186 
00187   int       CacheHit;
00188   int       CacheMiss;
00189   int       WeightsSize;
00190   int       LastDataSetIndex;
00191   bool      Caching;
00192   bool      NormalizeVector;
00193   char *    VectorsSelection;
00194   double *  Weights;
00195   double    LastPCoords[3];
00196   vtkIdType LastCellId;
00197   vtkDataSet *     LastDataSet;
00198   vtkGenericCell * Cell;
00199   vtkGenericCell * GenCell; // the current cell
00200   vtkAbstractInterpolatedVelocityFieldDataSetsType * DataSets;
00201   
00203 
00204   vtkSetStringMacro( VectorsSelection );
00206   
00215   virtual int FunctionValues( vtkDataSet * ds, double * x, double * f );
00216   
00217 //BTX
00218   friend class vtkTemporalInterpolatedVelocityField;
00220 
00224   void FastCompute( vtkDataArray * vectors, double f[3] );
00225   bool InterpolatePoint( vtkPointData * outPD, vtkIdType outIndex );
00226   vtkGenericCell * GetLastCell()
00227     { return ( this->LastCellId != -1 ) ? this->GenCell : NULL; }
00228 //ETX
00230 
00231 private:
00232   vtkAbstractInterpolatedVelocityField
00233     ( const vtkAbstractInterpolatedVelocityField & );  // Not implemented.
00234   void operator = ( const vtkAbstractInterpolatedVelocityField & );  // Not implemented.
00235 };
00236 
00237 //BTX
00238 typedef std::vector< vtkDataSet * > DataSetsTypeBase;
00239 class   vtkAbstractInterpolatedVelocityFieldDataSetsType: public DataSetsTypeBase { };
00240 //ETX
00241 
00242 #endif