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 
240  virtual void InsertVariablesParticleData(vtkLagrangianParticle* vtkNotUsed(particle),
241  vtkPointData* vtkNotUsed(particleData), int vtkNotUsed(stepEnum)) {}
242 
248  virtual void InitializeParticle(vtkLagrangianParticle* vtkNotUsed(particle)){}
249 
259  vtkLagrangianParticle* vtkNotUsed(particle)){return true;}
260 
269  vtkLagrangianParticle* vtkNotUsed(particle)){return false;}
270 
272 
275  vtkSetMacro(NonPlanarQuadSupport, bool);
276  vtkGetMacro(NonPlanarQuadSupport, bool);
277  vtkBooleanMacro(NonPlanarQuadSupport, bool);
279 
284  virtual vtkStringArray* GetSeedArrayNames();
285 
290  virtual vtkIntArray* GetSeedArrayComps();
291 
296  virtual vtkIntArray* GetSeedArrayTypes();
297 
302  virtual vtkStringArray* GetSurfaceArrayNames();
303 
308  virtual vtkIntArray* GetSurfaceArrayTypes();
309 
314  virtual vtkStringArray* GetSurfaceArrayEnumValues();
315 
320  virtual vtkDoubleArray* GetSurfaceArrayDefaultValues();
321 
326  virtual vtkIntArray* GetSurfaceArrayComps();
327 
329 
333  vtkGetMacro(WeightsSize, int);
335 
358  virtual bool ManualIntegration(double* xcur, double* xnext,
359  double t, double& delT, double& delTActual,
360  double minStep, double maxStep,
361  double maxError, double& error, int& integrationResult);
362 
368  virtual void ParallelManualShift(vtkLagrangianParticle* vtkNotUsed(particle)){}
369 
375  virtual bool FinalizeOutputs(vtkPolyData* vtkNotUsed(particlePathsOutput),
376  vtkDataObject* vtkNotUsed(interractionOutput)){return true;}
377 
381  virtual void PreIntegrate(std::queue<vtkLagrangianParticle*>& vtkNotUsed(particles)){}
382 
387  virtual vtkAbstractArray* GetSeedArray(int idx, vtkPointData* pointData);
388 
389 protected:
392 
397  virtual int FunctionValues(vtkDataSet* detaSet, vtkIdType cellId, double* weights,
398  double * x, double * f) = 0;
399 
405  virtual vtkIdType FindInLocator(vtkDataSet* dataSet, vtkAbstractCellLocator* locator,
406  double* x, vtkGenericCell* cell, double* weights);
407 
412  virtual bool TerminateParticle(vtkLagrangianParticle* particle);
413 
418  virtual bool BounceParticle(vtkLagrangianParticle* particle,
419  vtkDataSet* surface, vtkIdType cellId);
420 
426  virtual bool BreakParticle(vtkLagrangianParticle* particle,
427  vtkDataSet* surface, vtkIdType cellId, std::queue<vtkLagrangianParticle*>& particles);
428 
435  virtual bool InteractWithSurface(int surfaceType, vtkLagrangianParticle* particle,
436  vtkDataSet* surface, vtkIdType cellId, std::queue<vtkLagrangianParticle*>& particles);
437 
443  virtual bool IntersectWithLine(vtkCell* cell, double p1[3], double p2[3],
444  double tol, double& t, double x[3]);
445 
449  virtual void InterpolateNextParticleVariables(vtkLagrangianParticle* particle,
450  double interpolationFactor, bool forceInside = false);
451 
456  virtual bool CheckSurfacePerforation(vtkLagrangianParticle* particle,
457  vtkDataSet* surface, vtkIdType cellId);
458 
465  virtual vtkAbstractArray* GetSeedArray(int idx, vtkLagrangianParticle* particle);
466 
472  virtual bool GetFlowOrSurfaceData(int idx, vtkDataSet* flowDataSet,
473  vtkIdType tupleId, double* weights, double*& data, int& nComponents);
474 
479  virtual int GetFlowOrSurfaceDataFieldAssociation(int idx);
480 
489  virtual void ComputeSurfaceDefaultValues(const char* arrayName, vtkDataSet* dataset,
490  int nComponent, double* defaultValues);
491 
495  vtkLocatorsType* Locators;
496 
498  vtkDataSetsType* DataSets;
500  double* LastWeights;
502 
503  struct ArrayVal
504  {
505  int val[3];
506  };
507  typedef std::pair<ArrayVal, std::string> ArrayMapVal;
508  std::map<int, ArrayMapVal> InputArrays;
509 
510  typedef struct SurfaceArrayDescription
511  {
512  int nComp;
513  int type;
514  std::vector< std::pair< int, std::string > > enumValues;
516  std::map<std::string, SurfaceArrayDescription> SurfaceArrayDescriptions;
517 
520 
521  vtkSurfaceType* Surfaces;
522  vtkLocatorsType* SurfaceLocators;
523 
525 
526  double Tolerance;
529 
538 
540 
541 private:
543  void operator=(const vtkLagrangianBasicIntegrationModel&) = delete;
544 };
545 
546 #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
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: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
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))
Method to be reimplemented if needed in inherited classes.
std::map< std::string, SurfaceArrayDescription > SurfaceArrayDescriptions
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