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 =========================================================================*/
51 #ifndef vtkLagrangianBasicIntegrationModel_h
52 #define vtkLagrangianBasicIntegrationModel_h
53 
54 #include "vtkFiltersFlowPathsModule.h" // For export macro
55 #include "vtkNew.h" // For arrays
56 #include "vtkWeakPointer.h" // For weak pointer
57 #include "vtkFunctionSet.h"
58 
59 #include <queue> // for new particles
60 #include <map> // for array indexes
61 
62 class vtkAbstractArray;
64 class vtkCell;
65 class vtkCellData;
66 class vtkDataArray;
67 class vtkDataObject;
68 class vtkDataSet;
69 class vtkDataSetsType;
70 class vtkDoubleArray;
71 class vtkFieldData;
72 class vtkGenericCell;
73 class vtkIntArray;
76 class vtkLocatorsType;
77 class vtkPointData;
78 class vtkPolyData;
79 class vtkStringArray;
80 class vtkSurfaceType;
81 
82 class VTKFILTERSFLOWPATHS_EXPORT vtkLagrangianBasicIntegrationModel :
83  public vtkFunctionSet
84 {
85 public:
87  void PrintSelf(ostream& os, vtkIndent indent) override;
88 
89  typedef enum SurfaceType
90  {
91  SURFACE_TYPE_MODEL = 0,
92  SURFACE_TYPE_TERM = 1,
93  SURFACE_TYPE_BOUNCE = 2,
94  SURFACE_TYPE_BREAK = 3,
95  SURFACE_TYPE_PASS = 4
96  } SurfaceType;
97 
98  typedef enum VariableStep
99  {
100  VARIABLE_STEP_PREV = -1,
101  VARIABLE_STEP_CURRENT = 0,
102  VARIABLE_STEP_NEXT = 1,
103  } VariableStep;
104 
105  typedef std::pair< unsigned int, vtkLagrangianParticle*> PassThroughParticlesItem;
106  typedef std::queue< PassThroughParticlesItem > PassThroughParticlesType;
107 
114  int FunctionValues(double* x, double* f) override;
115 
117 
123  virtual void SetLocator(vtkAbstractCellLocator* locator);
124  vtkGetObjectMacro(Locator, vtkAbstractCellLocator);
126 
128 
131  vtkGetMacro(LocatorsBuilt, bool);
132  vtkSetMacro(LocatorsBuilt, bool);
134 
138  virtual void SetTracker(vtkLagrangianParticleTracker* Tracker);
139 
141 
150  virtual void AddDataSet(vtkDataSet* dataset, bool surface = false,
151  unsigned int surfaceFlatIndex = 0);
152  virtual void ClearDataSets(bool surface = false);
154 
156 
159  vtkSetMacro(UseInitialIntegrationTime, bool);
160  vtkGetMacro(UseInitialIntegrationTime, bool);
161  vtkBooleanMacro(UseInitialIntegrationTime, bool);
163 
165 
168  vtkSetMacro(CurrentParticle, vtkLagrangianParticle*);
170 
172 
175  vtkGetMacro(Tolerance, double);
177 
195  virtual vtkLagrangianParticle* ComputeSurfaceInteraction(vtkLagrangianParticle* particle,
196  std::queue<vtkLagrangianParticle*>& particles,
197  unsigned int& interactedSurfaceFlatIndex, PassThroughParticlesType& passThroughParticles);
198 
204  virtual void SetInputArrayToProcess(int idx, int port, int connection,
205  int fieldAssociation, const char* name);
206 
208 
215  virtual bool FindInLocators(double* x, vtkDataSet*& dataset, vtkIdType& cellId,
216  vtkAbstractCellLocator*& loc, double*& weights);
217  virtual bool FindInLocators(double* x, vtkDataSet*& dataset, vtkIdType& cellId);
218  virtual bool FindInLocators(double* x);
220 
229  vtkPointData* vtkNotUsed(particleData), int vtkNotUsed(maxTuples) = 0) {}
230 
237  virtual void InsertVariablesParticleData(vtkLagrangianParticle* vtkNotUsed(particle),
238  vtkPointData* vtkNotUsed(particleData), int vtkNotUsed(stepEnum)) {}
239 
245  virtual void InitializeParticle(vtkLagrangianParticle* vtkNotUsed(particle)){}
246 
256  vtkLagrangianParticle* vtkNotUsed(particle)){return true;}
257 
266  vtkLagrangianParticle* vtkNotUsed(particle)){return false;}
267 
269 
272  vtkSetMacro(NonPlanarQuadSupport, bool);
273  vtkGetMacro(NonPlanarQuadSupport, bool);
274  vtkBooleanMacro(NonPlanarQuadSupport, bool);
276 
281  virtual vtkStringArray* GetSeedArrayNames();
282 
287  virtual vtkIntArray* GetSeedArrayComps();
288 
293  virtual vtkIntArray* GetSeedArrayTypes();
294 
299  virtual vtkStringArray* GetSurfaceArrayNames();
300 
305  virtual vtkIntArray* GetSurfaceArrayTypes();
306 
311  virtual vtkStringArray* GetSurfaceArrayEnumValues();
312 
317  virtual vtkDoubleArray* GetSurfaceArrayDefaultValues();
318 
323  virtual vtkIntArray* GetSurfaceArrayComps();
324 
326 
330  vtkGetMacro(WeightsSize, int);
332 
355  virtual bool ManualIntegration(double* xcur, double* xnext,
356  double t, double& delT, double& delTActual,
357  double minStep, double maxStep,
358  double maxError, double& error, int& integrationResult);
359 
365  virtual void ParallelManualShift(vtkLagrangianParticle* vtkNotUsed(particle)){}
366 
372  virtual bool FinalizeOutputs(vtkPolyData* vtkNotUsed(particlePathsOutput),
373  vtkDataObject* vtkNotUsed(interractionOutput)){return true;}
374 
378  virtual void PreIntegrate(std::queue<vtkLagrangianParticle*>& vtkNotUsed(particles)){}
379 
384  virtual vtkAbstractArray* GetSeedArray(int idx, vtkPointData* pointData);
385 
386 protected:
389 
394  virtual int FunctionValues(vtkDataSet* detaSet, vtkIdType cellId, double* weights,
395  double * x, double * f) = 0;
396 
402  virtual vtkIdType FindInLocator(vtkDataSet* dataSet, vtkAbstractCellLocator* locator,
403  double* x, vtkGenericCell* cell, double* weights);
404 
409  virtual bool TerminateParticle(vtkLagrangianParticle* particle);
410 
415  virtual bool BounceParticle(vtkLagrangianParticle* particle,
416  vtkDataSet* surface, vtkIdType cellId);
417 
423  virtual bool BreakParticle(vtkLagrangianParticle* particle,
424  vtkDataSet* surface, vtkIdType cellId, std::queue<vtkLagrangianParticle*>& particles);
425 
432  virtual bool InteractWithSurface(int surfaceType, vtkLagrangianParticle* particle,
433  vtkDataSet* surface, vtkIdType cellId, std::queue<vtkLagrangianParticle*>& particles);
434 
440  virtual bool IntersectWithLine(vtkCell* cell, double p1[3], double p2[3],
441  double tol, double& t, double x[3]);
442 
446  virtual void InterpolateNextParticleVariables(vtkLagrangianParticle* particle,
447  double interpolationFactor, bool forceInside = false);
448 
453  virtual bool CheckSurfacePerforation(vtkLagrangianParticle* particle,
454  vtkDataSet* surface, vtkIdType cellId);
455 
462  virtual vtkAbstractArray* GetSeedArray(int idx, vtkLagrangianParticle* particle);
463 
469  virtual bool GetFlowOrSurfaceData(int idx, vtkDataSet* flowDataSet,
470  vtkIdType tupleId, double* weights, double*& data, int& nComponents);
471 
476  virtual int GetFlowOrSurfaceDataFieldAssociation(int idx);
477 
486  virtual void ComputeSurfaceDefaultValues(const char* arrayName, vtkDataSet* dataset,
487  int nComponent, double* defaultValues);
488 
492  vtkLocatorsType* Locators;
493 
495  vtkDataSetsType* DataSets;
497  double* LastWeights;
499 
500  struct ArrayVal
501  {
502  int val[3];
503  };
504  typedef std::pair<ArrayVal, std::string> ArrayMapVal;
505  std::map<int, ArrayMapVal> InputArrays;
506 
507  typedef struct SurfaceArrayDescription
508  {
509  int nComp;
510  int type;
511  std::vector< std::pair< int, std::string > > enumValues;
513  std::map<std::string, SurfaceArrayDescription> SurfaceArrayDescriptions;
514 
517 
518  vtkSurfaceType* Surfaces;
519  vtkLocatorsType* SurfaceLocators;
520 
522 
523  double Tolerance;
526 
535 
537 
538 private:
540  void operator=(const vtkLagrangianBasicIntegrationModel&) = delete;
541 };
542 
543 #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:31
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
Abstract superclass for all arrays.
represent and manipulate cell attribute data
Definition: vtkCellData.h:32
an abstract base class for locators which find cells
a vtkAbstractArray subclass for strings
virtual bool CheckAdaptiveStepReintegration(vtkLagrangianParticle *vtkNotUsed(particle))
Method to be reimplemented if needed in inherited classes.
int vtkIdType
Definition: vtkType.h:345
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
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 successful, false otherwise Empty and Always retur...
std::queue< PassThroughParticlesItem > PassThroughParticlesType
provides thread-safe access to cells
dynamic, self-adjusting array of double
abstract class to specify cell behavior
Definition: vtkCell.h:56
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:39
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:33
vtkFunctionSet abstract implementation to be used in the vtkLagrangianParticleTracker integrator.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
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))
Method to be reimplemented if needed in inherited classes.
std::map< std::string, SurfaceArrayDescription > SurfaceArrayDescriptions
virtual void PreIntegrate(std::queue< vtkLagrangianParticle * > &vtkNotUsed(particles))
Enable model to modify particle before integration.
std::pair< ArrayVal, std::string > ArrayMapVal
general representation of visualization data
Definition: vtkDataObject.h:58
Filter to inject and track particles in a flow.
std::pair< unsigned int, vtkLagrangianParticle * > PassThroughParticlesItem
represent and manipulate fields of data
Definition: vtkFieldData.h:53