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) 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) override;
118 
120 
126  virtual void SetLocator(vtkAbstractCellLocator* locator);
127  vtkGetObjectMacro(Locator, vtkAbstractCellLocator);
129 
131 
134  vtkGetMacro(LocatorsBuilt, bool);
135  vtkSetMacro(LocatorsBuilt, bool);
137 
141  virtual void SetTracker(vtkLagrangianParticleTracker* Tracker);
142 
144 
153  virtual void AddDataSet(vtkDataSet* dataset, bool surface = false,
154  unsigned int surfaceFlatIndex = 0);
155  virtual void ClearDataSets(bool surface = false);
157 
159 
162  vtkSetMacro(UseInitialIntegrationTime, bool);
163  vtkGetMacro(UseInitialIntegrationTime, bool);
164  vtkBooleanMacro(UseInitialIntegrationTime, bool);
166 
168 
171  vtkSetMacro(CurrentParticle, vtkLagrangianParticle*);
173 
175 
178  vtkGetMacro(Tolerance, double);
180 
198  virtual vtkLagrangianParticle* ComputeSurfaceInteraction(vtkLagrangianParticle* particle,
199  std::queue<vtkLagrangianParticle*>& particles,
200  unsigned int& interactedSurfaceFlatIndex, PassThroughParticlesType& passThroughParticles);
201 
207  virtual void SetInputArrayToProcess(int idx, int port, int connection,
208  int fieldAssociation, const char* name);
209 
211 
218  virtual bool FindInLocators(double* x, vtkDataSet*& dataset, vtkIdType& cellId,
219  vtkAbstractCellLocator*& loc, double*& weights);
220  virtual bool FindInLocators(double* x, vtkDataSet*& dataset, vtkIdType& cellId);
221  virtual bool FindInLocators(double* x);
223 
232  vtkPointData* vtkNotUsed(particleData), int vtkNotUsed(maxTuples) = 0) {}
233 
239  virtual void InsertVariablesParticleData(vtkLagrangianParticle* vtkNotUsed(particle),
240  vtkPointData* vtkNotUsed(particleData), int vtkNotUsed(stepEnum)) {}
241 
247  virtual void InitializeModelPathData(vtkFieldData* vtkNotUsed(data)) {}
248 
254  virtual void InsertModelPathData(vtkLagrangianParticle* vtkNotUsed(particle),
255  vtkFieldData* vtkNotUsed(data)) {}
256 
261  virtual void InitializeParticle(vtkLagrangianParticle* vtkNotUsed(particle)){}
262 
272  vtkLagrangianParticle* vtkNotUsed(particle)){return true;}
273 
282  vtkLagrangianParticle* vtkNotUsed(particle)){return false;}
283 
285 
288  vtkSetMacro(NonPlanarQuadSupport, bool);
289  vtkGetMacro(NonPlanarQuadSupport, bool);
290  vtkBooleanMacro(NonPlanarQuadSupport, bool);
292 
297  virtual vtkStringArray* GetSeedArrayNames();
298 
303  virtual vtkIntArray* GetSeedArrayComps();
304 
309  virtual vtkIntArray* GetSeedArrayTypes();
310 
315  virtual vtkStringArray* GetSurfaceArrayNames();
316 
321  virtual vtkIntArray* GetSurfaceArrayTypes();
322 
327  virtual vtkStringArray* GetSurfaceArrayEnumValues();
328 
333  virtual vtkDoubleArray* GetSurfaceArrayDefaultValues();
334 
339  virtual vtkIntArray* GetSurfaceArrayComps();
340 
342 
346  vtkGetMacro(WeightsSize, int);
348 
371  virtual bool ManualIntegration(double* xcur, double* xnext,
372  double t, double& delT, double& delTActual,
373  double minStep, double maxStep,
374  double maxError, double& error, int& integrationResult);
375 
381  virtual void ParallelManualShift(vtkLagrangianParticle* vtkNotUsed(particle)){}
382 
388  virtual bool FinalizeOutputs(vtkPolyData* vtkNotUsed(particlePathsOutput),
389  vtkDataObject* vtkNotUsed(interractionOutput)){return true;}
390 
394  virtual void PreIntegrate(std::queue<vtkLagrangianParticle*>& vtkNotUsed(particles)){}
395 
400  virtual vtkAbstractArray* GetSeedArray(int idx, vtkPointData* pointData);
401 
402 protected:
405 
410  virtual int FunctionValues(vtkDataSet* detaSet, vtkIdType cellId, double* weights,
411  double * x, double * f) = 0;
412 
418  virtual vtkIdType FindInLocator(vtkDataSet* dataSet, vtkAbstractCellLocator* locator,
419  double* x, vtkGenericCell* cell, double* weights);
420 
425  virtual bool TerminateParticle(vtkLagrangianParticle* particle);
426 
431  virtual bool BounceParticle(vtkLagrangianParticle* particle,
432  vtkDataSet* surface, vtkIdType cellId);
433 
439  virtual bool BreakParticle(vtkLagrangianParticle* particle,
440  vtkDataSet* surface, vtkIdType cellId, std::queue<vtkLagrangianParticle*>& particles);
441 
448  virtual bool InteractWithSurface(int surfaceType, vtkLagrangianParticle* particle,
449  vtkDataSet* surface, vtkIdType cellId, std::queue<vtkLagrangianParticle*>& particles);
450 
456  virtual bool IntersectWithLine(vtkCell* cell, double p1[3], double p2[3],
457  double tol, double& t, double x[3]);
458 
462  virtual void InterpolateNextParticleVariables(vtkLagrangianParticle* particle,
463  double interpolationFactor, bool forceInside = false);
464 
469  virtual bool CheckSurfacePerforation(vtkLagrangianParticle* particle,
470  vtkDataSet* surface, vtkIdType cellId);
471 
478  virtual vtkAbstractArray* GetSeedArray(int idx, vtkLagrangianParticle* particle);
479 
485  virtual bool GetFlowOrSurfaceData(int idx, vtkDataSet* flowDataSet,
486  vtkIdType tupleId, double* weights, double*& data, int& nComponents);
487 
492  virtual int GetFlowOrSurfaceDataFieldAssociation(int idx);
493 
502  virtual void ComputeSurfaceDefaultValues(const char* arrayName, vtkDataSet* dataset,
503  int nComponent, double* defaultValues);
504 
508  vtkLocatorsType* Locators;
509 
511  vtkDataSetsType* DataSets;
513  double* LastWeights;
515 
516  struct ArrayVal
517  {
518  int val[3];
519  };
520  typedef std::pair<ArrayVal, std::string> ArrayMapVal;
521  std::map<int, ArrayMapVal> InputArrays;
522 
523  typedef struct SurfaceArrayDescription
524  {
525  int nComp;
526  int type;
527  std::vector< std::pair< int, std::string > > enumValues;
529  std::map<std::string, SurfaceArrayDescription> SurfaceArrayDescriptions;
530 
533 
534  vtkSurfaceType* Surfaces;
535  vtkLocatorsType* SurfaceLocators;
536 
538 
539  double Tolerance;
542 
551 
553 
554 private:
556  void operator=(const vtkLagrangianBasicIntegrationModel&) = delete;
557 };
558 
559 #endif
virtual void InitializeParticle(vtkLagrangianParticle *vtkNotUsed(particle))
Initialize a particle by setting user variables and perform any user model specific operation...
virtual void InsertModelPathData(vtkLagrangianParticle *vtkNotUsed(particle), vtkFieldData *vtkNotUsed(data))
Empty method to be reimplemented if necessary in inherited classes.
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
virtual bool CheckAdaptiveStepReintegration(vtkLagrangianParticle *vtkNotUsed(particle))
Method to be reimplemented if needed in inherited classes.
int vtkIdType
Definition: vtkType.h:347
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 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: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.
virtual void InitializeModelPathData(vtkFieldData *vtkNotUsed(data))
Empty method to be reimplemented if necessary in inherited classes.
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))
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: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