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) VTK_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) VTK_OVERRIDE;
115 
117 
123  virtual void SetLocator(vtkAbstractCellLocator* locator);
124  vtkGetObjectMacro(Locator, vtkAbstractCellLocator);
126 
130  virtual void SetTracker(vtkLagrangianParticleTracker* Tracker);
131 
133 
142  virtual void AddDataSet(vtkDataSet* dataset, bool surface = false,
143  unsigned int surfaceFlatIndex = 0);
144  virtual void ClearDataSets(bool surface = false);
146 
148 
151  vtkSetMacro(UseInitialIntegrationTime, bool);
152  vtkGetMacro(UseInitialIntegrationTime, bool);
153  vtkBooleanMacro(UseInitialIntegrationTime, bool);
155 
157 
160  vtkSetMacro(CurrentParticle, vtkLagrangianParticle*);
162 
164 
167  vtkGetMacro(Tolerance, double);
169 
187  virtual vtkLagrangianParticle* ComputeSurfaceInteraction(vtkLagrangianParticle* particle,
188  std::queue<vtkLagrangianParticle*>& particles,
189  unsigned int& interactedSurfaceFlatIndex, PassThroughParticlesType& passThroughParticles);
190 
196  virtual void SetInputArrayToProcess(int idx, int port, int connection,
197  int fieldAssociation, const char* name);
198 
200 
207  virtual bool FindInLocators(double* x, vtkDataSet*& dataset, vtkIdType& cellId,
208  vtkAbstractCellLocator*& loc, double*& weights);
209  virtual bool FindInLocators(double* x, vtkDataSet*& dataset, vtkIdType& cellId);
210  virtual bool FindInLocators(double* x);
212 
221  vtkPointData* vtkNotUsed(particleData), int vtkNotUsed(maxTuples) = 0) {}
222 
229  virtual void InsertVariablesParticleData(vtkLagrangianParticle* vtkNotUsed(particle),
230  vtkPointData* vtkNotUsed(particleData), int vtkNotUsed(stepEnum)) {}
231 
237  virtual void InitializeParticle(vtkLagrangianParticle* vtkNotUsed(particle)){}
238 
246  vtkLagrangianParticle* vtkNotUsed(particle)){return false;}
247 
249 
252  vtkSetMacro(NonPlanarQuadSupport, bool);
253  vtkGetMacro(NonPlanarQuadSupport, bool);
254  vtkBooleanMacro(NonPlanarQuadSupport, bool);
256 
261  virtual vtkStringArray* GetSeedArrayNames();
262 
267  virtual vtkIntArray* GetSeedArrayComps();
268 
273  virtual vtkIntArray* GetSeedArrayTypes();
274 
279  virtual vtkStringArray* GetSurfaceArrayNames();
280 
285  virtual vtkIntArray* GetSurfaceArrayTypes();
286 
291  virtual vtkStringArray* GetSurfaceArrayEnumValues();
292 
297  virtual vtkDoubleArray* GetSurfaceArrayDefaultValues();
298 
303  virtual vtkIntArray* GetSurfaceArrayComps();
304 
306 
310  vtkGetMacro(WeightsSize, int);
312 
335  virtual bool ManualIntegration(double* xcur, double* xnext,
336  double t, double& delT, double& delTActual,
337  double minStep, double maxStep,
338  double maxError, double& error, int& integrationResult);
339 
345  virtual void ParallelManualShift(vtkLagrangianParticle* vtkNotUsed(particle)){}
346 
352  virtual bool FinalizeOutputs(vtkPolyData* vtkNotUsed(particlePathsOutput),
353  vtkDataObject* vtkNotUsed(interractionOutput)){return true;}
354 
358  virtual void PreIntegrate(std::queue<vtkLagrangianParticle*>& vtkNotUsed(particles)){}
359 
364  virtual vtkAbstractArray* GetSeedArray(int idx, vtkPointData* pointData);
365 
366 protected:
368  ~vtkLagrangianBasicIntegrationModel() VTK_OVERRIDE;
369 
374  virtual int FunctionValues(vtkDataSet* detaSet, vtkIdType cellId, double* weights,
375  double * x, double * f) = 0;
376 
382  virtual vtkIdType FindInLocator(vtkDataSet* dataSet, vtkAbstractCellLocator* locator,
383  double* x, vtkGenericCell* cell, double* weights);
384 
389  virtual bool TerminateParticle(vtkLagrangianParticle* particle);
390 
395  virtual bool BounceParticle(vtkLagrangianParticle* particle,
396  vtkDataSet* surface, vtkIdType cellId);
397 
403  virtual bool BreakParticle(vtkLagrangianParticle* particle,
404  vtkDataSet* surface, vtkIdType cellId, std::queue<vtkLagrangianParticle*>& particles);
405 
412  virtual bool InteractWithSurface(int surfaceType, vtkLagrangianParticle* particle,
413  vtkDataSet* surface, vtkIdType cellId, std::queue<vtkLagrangianParticle*>& particles);
414 
420  virtual bool IntersectWithLine(vtkCell* cell, double p1[3], double p2[3],
421  double tol, double& t, double x[3]);
422 
426  virtual void InterpolateNextParticleVariables(vtkLagrangianParticle* particle,
427  double interpolationFactor, bool forceInside = false);
428 
433  virtual bool CheckSurfacePerforation(vtkLagrangianParticle* particle,
434  vtkDataSet* surface, vtkIdType cellId);
435 
442  virtual vtkAbstractArray* GetSeedArray(int idx, vtkLagrangianParticle* particle);
443 
449  virtual bool GetFlowOrSurfaceData(int idx, vtkDataSet* flowDataSet,
450  vtkIdType tupleId, double* weights, double*& data, int& nComponents);
451 
456  virtual int GetFlowOrSurfaceDataFieldAssociation(int idx);
457 
466  virtual void ComputeSurfaceDefaultValues(const char* arrayName, vtkDataSet* dataset,
467  int nComponent, double* defaultValues);
468 
471  vtkLocatorsType* Locators;
472 
474  vtkDataSetsType* DataSets;
476  double* LastWeights;
478 
479  struct ArrayVal
480  {
481  int val[3];
482  };
483  typedef std::pair<ArrayVal, std::string> ArrayMapVal;
484  std::map<int, ArrayMapVal> InputArrays;
485 
486  typedef struct SurfaceArrayDescription
487  {
488  int nComp;
489  int type;
490  std::vector< std::pair< int, std::string > > enumValues;
492  std::map<std::string, SurfaceArrayDescription> SurfaceArrayDescriptions;
493 
496 
497  vtkSurfaceType* Surfaces;
498  vtkLocatorsType* SurfaceLocators;
499 
501 
502  double Tolerance;
505 
514 
516 
517 private:
519  void operator=(const vtkLagrangianBasicIntegrationModel&) VTK_DELETE_FUNCTION;
520 };
521 
522 #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
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 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: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))
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: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