VTK
vtkLagrangianBasicIntegrationModel.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkLagrangianBasicIntegrationModel.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 =========================================================================*/
54 #ifndef vtkLagrangianBasicIntegrationModel_h
55 #define vtkLagrangianBasicIntegrationModel_h
56 
57 #include "vtkFiltersFlowPathsModule.h" // For export macro
58 #include "vtkNew.h" // For arrays
59 #include "vtkWeakPointer.h" // For weak pointer
60 #include "vtkFunctionSet.h"
61 
62 #include <queue> // for new particles
63 #include <map> // for array indexes
64 
65 class vtkAbstractArray;
67 class vtkCell;
68 class vtkCellData;
69 class vtkDataArray;
70 class vtkDataObject;
71 class vtkDataSet;
72 class vtkDataSetsType;
73 class vtkDoubleArray;
74 class vtkFieldData;
75 class vtkGenericCell;
76 class vtkIntArray;
79 class vtkLocatorsType;
80 class vtkPointData;
81 class vtkPolyData;
82 class vtkStringArray;
83 class vtkSurfaceType;
84 
85 class VTKFILTERSFLOWPATHS_EXPORT vtkLagrangianBasicIntegrationModel :
86  public vtkFunctionSet
87 {
88 public:
90  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
91 
92  typedef enum SurfaceType
93  {
94  SURFACE_TYPE_MODEL = 0,
95  SURFACE_TYPE_TERM = 1,
96  SURFACE_TYPE_BOUNCE = 2,
97  SURFACE_TYPE_BREAK = 3,
98  SURFACE_TYPE_PASS = 4
99  } SurfaceType;
100 
101  typedef enum VariableStep
102  {
103  VARIABLE_STEP_PREV = -1,
104  VARIABLE_STEP_CURRENT = 0,
105  VARIABLE_STEP_NEXT = 1,
106  } VariableStep;
107 
108  typedef std::pair< unsigned int, vtkLagrangianParticle*> PassThroughParticlesItem;
109  typedef std::queue< PassThroughParticlesItem > PassThroughParticlesType;
110 
117  int FunctionValues(double* x, double* f) VTK_OVERRIDE;
118 
120 
126  virtual void SetLocator(vtkAbstractCellLocator* locator);
127  vtkGetObjectMacro(Locator, vtkAbstractCellLocator);
129 
133  virtual void SetTracker(vtkLagrangianParticleTracker* Tracker);
134 
136 
145  virtual void AddDataSet(vtkDataSet* dataset, bool surface = false,
146  unsigned int surfaceFlatIndex = 0);
147  virtual void ClearDataSets(bool surface = false);
149 
151 
154  vtkSetMacro(UseInitialIntegrationTime, bool);
155  vtkGetMacro(UseInitialIntegrationTime, bool);
156  vtkBooleanMacro(UseInitialIntegrationTime, bool);
158 
160 
163  vtkSetMacro(CurrentParticle, vtkLagrangianParticle*);
165 
167 
170  vtkGetMacro(Tolerance, double);
172 
190  virtual vtkLagrangianParticle* ComputeSurfaceInteraction(vtkLagrangianParticle* particle,
191  std::queue<vtkLagrangianParticle*>& particles,
192  unsigned int& interactedSurfaceFlatIndex, PassThroughParticlesType& passThroughParticles);
193 
199  virtual void SetInputArrayToProcess(int idx, int port, int connection,
200  int fieldAssociation, const char* name);
201 
203 
210  virtual bool FindInLocators(double* x, vtkDataSet*& dataset, vtkIdType& cellId,
211  vtkAbstractCellLocator*& loc, double*& weights);
212  virtual bool FindInLocators(double* x, vtkDataSet*& dataset, vtkIdType& cellId);
213  virtual bool FindInLocators(double* x);
215 
224  vtkPointData* vtkNotUsed(particleData), int vtkNotUsed(maxTuples) = 0) {}
225 
232  virtual void InsertVariablesParticleData(vtkLagrangianParticle* vtkNotUsed(particle),
233  vtkPointData* vtkNotUsed(particleData), int vtkNotUsed(stepEnum)) {}
234 
240  virtual void InitializeParticle(vtkLagrangianParticle* vtkNotUsed(particle)){}
241 
249  vtkLagrangianParticle* vtkNotUsed(particle)){return false;}
250 
252 
255  vtkSetMacro(NonPlanarQuadSupport, bool);
256  vtkGetMacro(NonPlanarQuadSupport, bool);
257  vtkBooleanMacro(NonPlanarQuadSupport, bool);
259 
264  virtual vtkStringArray* GetSeedArrayNames();
265 
270  virtual vtkIntArray* GetSeedArrayComps();
271 
276  virtual vtkIntArray* GetSeedArrayTypes();
277 
282  virtual vtkStringArray* GetSurfaceArrayNames();
283 
288  virtual vtkIntArray* GetSurfaceArrayTypes();
289 
294  virtual vtkStringArray* GetSurfaceArrayEnumValues();
295 
300  virtual vtkDoubleArray* GetSurfaceArrayDefaultValues();
301 
306  virtual vtkIntArray* GetSurfaceArrayComps();
307 
309 
313  vtkGetMacro(WeightsSize, int);
315 
338  virtual bool ManualIntegration(double* xcur, double* xnext,
339  double t, double& delT, double& delTActual,
340  double minStep, double maxStep,
341  double maxError, double& error, int& integrationResult);
342 
348  virtual void ParallelManualShift(vtkLagrangianParticle* vtkNotUsed(particle)){}
349 
355  virtual bool FinalizeOutputs(vtkPolyData* vtkNotUsed(particlePathsOutput),
356  vtkDataObject* vtkNotUsed(interractionOutput)){return true;}
357 
361  virtual void PreIntegrate(std::queue<vtkLagrangianParticle*>& vtkNotUsed(particles)){}
362 
367  virtual vtkAbstractArray* GetSeedArray(int idx, vtkPointData* pointData);
368 
369 protected:
371  ~vtkLagrangianBasicIntegrationModel() VTK_OVERRIDE;
372 
377  virtual int FunctionValues(vtkDataSet* detaSet, vtkIdType cellId, double* weights,
378  double * x, double * f) = 0;
379 
385  virtual vtkIdType FindInLocator(vtkDataSet* dataSet, vtkAbstractCellLocator* locator,
386  double* x, vtkGenericCell* cell, double* weights);
387 
392  virtual bool TerminateParticle(vtkLagrangianParticle* particle);
393 
398  virtual bool BounceParticle(vtkLagrangianParticle* particle,
399  vtkDataSet* surface, vtkIdType cellId);
400 
406  virtual bool BreakParticle(vtkLagrangianParticle* particle,
407  vtkDataSet* surface, vtkIdType cellId, std::queue<vtkLagrangianParticle*>& particles);
408 
415  virtual bool InteractWithSurface(int surfaceType, vtkLagrangianParticle* particle,
416  vtkDataSet* surface, vtkIdType cellId, std::queue<vtkLagrangianParticle*>& particles);
417 
423  virtual bool IntersectWithLine(vtkCell* cell, double p1[3], double p2[3],
424  double tol, double& t, double x[3]);
425 
429  virtual void InterpolateNextParticleVariables(vtkLagrangianParticle* particle,
430  double interpolationFactor, bool forceInside = false);
431 
436  virtual bool CheckSurfacePerforation(vtkLagrangianParticle* particle,
437  vtkDataSet* surface, vtkIdType cellId);
438 
445  virtual vtkAbstractArray* GetSeedArray(int idx, vtkLagrangianParticle* particle);
446 
452  virtual bool GetFlowOrSurfaceData(int idx, vtkDataSet* flowDataSet,
453  vtkIdType tupleId, double* weights, double*& data, int& nComponents);
454 
459  virtual int GetFlowOrSurfaceDataFieldAssociation(int idx);
460 
469  virtual void ComputeSurfaceDefaultValues(const char* arrayName, vtkDataSet* dataset,
470  int nComponent, double* defaultValues);
471 
474  vtkLocatorsType* Locators;
475 
477  vtkDataSetsType* DataSets;
479  double* LastWeights;
481 
482  struct ArrayVal
483  {
484  int val[3];
485  };
486  typedef std::pair<ArrayVal, std::string> ArrayMapVal;
487  std::map<int, ArrayMapVal> InputArrays;
488 
489  typedef struct SurfaceArrayDescription
490  {
491  int nComp;
492  int type;
493  std::vector< std::pair< int, std::string > > enumValues;
495  std::map<std::string, SurfaceArrayDescription> SurfaceArrayDescriptions;
496 
499 
500  vtkSurfaceType* Surfaces;
501  vtkLocatorsType* SurfaceLocators;
502 
504 
505  double Tolerance;
508 
517 
519 
520 private:
522  void operator=(const vtkLagrangianBasicIntegrationModel&) VTK_DELETE_FUNCTION;
523 };
524 
525 #endif
virtual void InitializeParticle(vtkLagrangianParticle *vtkNotUsed(particle))
Initialize a particle by setting user variables and perform any user model specific operation empty i...
represent and manipulate point attribute data
Definition: vtkPointData.h:37
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
Abstract superclass for all arrays.
represent and manipulate cell attribute data
Definition: vtkCellData.h:38
an abstract base class for locators which find cells
a vtkAbstractArray subclass for strings
int vtkIdType
Definition: vtkType.h:345
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
virtual void InsertVariablesParticleData(vtkLagrangianParticle *vtkNotUsed(particle), vtkPointData *vtkNotUsed(particleData), int vtkNotUsed(stepEnum))
Empty method to be reimplemented if necessary in inherited classes.
vtkWeakPointer< vtkLagrangianParticleTracker > Tracker
virtual int FunctionValues(double *x, double *f)=0
Evaluate functions at x_j.
virtual bool FinalizeOutputs(vtkPolyData *vtkNotUsed(particlePathsOutput), vtkDataObject *vtkNotUsed(interractionOutput))
Enable model post process on output Return true if sucessful, false otherwise Empty and Always return...
std::queue< PassThroughParticlesItem > PassThroughParticlesType
provides thread-safe access to cells
dynamic, self-adjusting array of double
virtual void PreIntegrate(std::queue< vtkLagrangianParticle *> &vtkNotUsed(particles))
Enable model to modify particle before integration.
abstract class to specify cell behavior
Definition: vtkCell.h:59
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:45
virtual void ParallelManualShift(vtkLagrangianParticle *vtkNotUsed(particle))
Method called by parallel algorithm after receiving a particle from stream if PManualShift flag has b...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkFunctionSet abstract implementation to be used in the vtkLagrangianParticleTracker integrator...
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
virtual void InitializeVariablesParticleData(vtkPointData *vtkNotUsed(particleData), int vtkNotUsed(maxTuples)=0)
Empty method to be reimplemented if necessary in inherited classes.
Abstract interface for sets of functions.
Basis class for Lagrangian particles.
virtual bool CheckFreeFlightTermination(vtkLagrangianParticle *vtkNotUsed(particle))
Empty method to be reimplemented if necessary in inherited classes.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
std::map< std::string, SurfaceArrayDescription > SurfaceArrayDescriptions
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
std::pair< ArrayVal, std::string > ArrayMapVal
general representation of visualization data
Definition: vtkDataObject.h:64
Filter to inject and track particles in a flow.
std::pair< unsigned int, vtkLagrangianParticle * > PassThroughParticlesItem
represent and manipulate fields of data
Definition: vtkFieldData.h:56