Commits (9)
......@@ -63,6 +63,7 @@ public:
*/
static vtkGenericInterpolatedVelocityField *New();
using Superclass::FunctionValues;
/**
* Evaluate the velocity field, f, at (x, y, z, t).
* For now, t is ignored.
......
......@@ -43,8 +43,11 @@ public:
* x and f have to point to valid double arrays of appropriate
* sizes obtained with GetNumberOfFunctions() and
* GetNumberOfIndependentVariables.
* If you inherit this class, make sure to reimplement at least one of the two
* FunctionValues signatures.
*/
virtual int FunctionValues(double* x, double* f) = 0;
virtual int FunctionValues(double* x, double* f) { return this->FunctionValues(x, f, nullptr); }
virtual int FunctionValues(double* x, double* f, void* vtkNotUsed(userData)) { return this->FunctionValues(x, f); }
/**
* Return the number of functions. Note that this is constant for
......
......@@ -68,35 +68,67 @@ public:
virtual int ComputeNextStep(double* xprev, double* xnext, double t,
double& delT, double maxError,
double& error)
{
return this->ComputeNextStep(xprev, xnext, t, delT, maxError, error, nullptr);
}
virtual int ComputeNextStep(double* xprev, double* xnext, double t,
double& delT, double maxError,
double& error, void* userData)
{
double minStep = delT;
double maxStep = delT;
double delTActual;
return this->ComputeNextStep(xprev, nullptr, xnext, t, delT, delTActual,
minStep, maxStep, maxError, error);
minStep, maxStep, maxError, error, userData);
}
virtual int ComputeNextStep(double* xprev, double* dxprev, double* xnext,
double t, double& delT, double maxError,
double& error)
{
return this->ComputeNextStep(xprev, dxprev, xnext, t, delT, maxError, error, nullptr);
}
virtual int ComputeNextStep(double* xprev, double* dxprev, double* xnext,
double t, double& delT, double maxError,
double& error, void* userData)
{
double minStep = delT;
double maxStep = delT;
double delTActual;
return this->ComputeNextStep(xprev, dxprev, xnext, t, delT, delTActual,
minStep, maxStep, maxError, error);
minStep, maxStep, maxError, error, userData);
}
virtual int ComputeNextStep(double* xprev, double* xnext,
double t, double& delT, double& delTActual,
double minStep, double maxStep,
double maxError, double& error)
{
return this->ComputeNextStep(xprev, xnext, t, delT, delTActual, minStep, maxStep, maxError, error, nullptr);
}
virtual int ComputeNextStep(double* xprev, double* xnext,
double t, double& delT, double& delTActual,
double minStep, double maxStep,
double maxError, double& error, void* userData)
{
return this->ComputeNextStep(xprev, nullptr, xnext, t, delT, delTActual,
minStep, maxStep, maxError, error);
minStep, maxStep, maxError, error, userData);
}
virtual int ComputeNextStep(double* xprev, double* dxprev, double* xnext,
double t, double& delT, double& delTActual,
double minStep, double maxStep,
double maxError, double& error) = 0;
double maxError, double& error)
{
return this->ComputeNextStep(xprev, dxprev, xnext, t, delT, delTActual, minStep, maxStep, maxError, error, nullptr);
}
virtual int ComputeNextStep(double* vtkNotUsed(xprev), double* vtkNotUsed(dxprev), double* vtkNotUsed(xnext),
double vtkNotUsed(t), double& vtkNotUsed(delT), double& vtkNotUsed(delTActual),
double vtkNotUsed(minStep), double vtkNotUsed(maxStep),
double vtkNotUsed(maxError), double& vtkNotUsed(error), void* vtkNotUsed(userData)) { return 0; }
//@}
//@{
......@@ -139,7 +171,3 @@ private:
};
#endif
......@@ -26,7 +26,7 @@ vtkRungeKutta2::~vtkRungeKutta2() = default;
// Calculate next time step
int vtkRungeKutta2::ComputeNextStep(double* xprev, double* dxprev, double* xnext,
double t, double& delT, double& delTActual,
double, double, double, double& error)
double, double, double, double& error, void* userData)
{
int i, numDerivs, numVals;
......@@ -61,7 +61,7 @@ int vtkRungeKutta2::ComputeNextStep(double* xprev, double* dxprev, double* xnext
this->Derivs[i] = dxprev[i];
}
}
else if ( !this->FunctionSet->FunctionValues(this->Vals, this->Derivs) )
else if ( !this->FunctionSet->FunctionValues(this->Vals, this->Derivs, userData) )
{
memcpy(xnext, this->Vals, (numVals-1)*sizeof(double));
return OUT_OF_DOMAIN;
......@@ -75,7 +75,7 @@ int vtkRungeKutta2::ComputeNextStep(double* xprev, double* dxprev, double* xnext
this->Vals[numVals-1] = t + delT/2.0;
// Obtain the derivatives at x_i + dt/2 * dx_i
if (!this->FunctionSet->FunctionValues(this->Vals, this->Derivs))
if (!this->FunctionSet->FunctionValues(this->Vals, this->Derivs, userData))
{
memcpy(xnext, this->Vals, (numVals-1)*sizeof(double));
delTActual = delT/2.0; // we've only taken half of a time step
......
......@@ -42,6 +42,7 @@ public:
*/
static vtkRungeKutta2 *New();
using Superclass::ComputeNextStep;
//@{
/**
* Given initial values, xprev , initial time, t and a requested time
......@@ -58,36 +59,36 @@ public:
*/
int ComputeNextStep(double* xprev, double* xnext,
double t, double& delT,
double maxError, double& error) override
double maxError, double& error, void* userData) override
{
double minStep = delT;
double maxStep = delT;
double delTActual;
return this->ComputeNextStep(xprev, nullptr, xnext, t, delT, delTActual,
minStep, maxStep, maxError, error);
minStep, maxStep, maxError, error, userData);
}
int ComputeNextStep(double* xprev, double* dxprev, double* xnext,
double t, double& delT,
double maxError, double& error) override
double maxError, double& error, void* userData) override
{
double minStep = delT;
double maxStep = delT;
double delTActual;
return this->ComputeNextStep(xprev, dxprev, xnext, t, delT, delTActual,
minStep, maxStep, maxError, error);
minStep, maxStep, maxError, error, userData);
}
int ComputeNextStep(double* xprev, double* xnext,
double t, double& delT, double& delTActual,
double minStep, double maxStep,
double maxError, double& error) override
double maxError, double& error, void* userData) override
{
return this->ComputeNextStep(xprev, nullptr, xnext, t, delT, delTActual,
minStep, maxStep, maxError, error);
minStep, maxStep, maxError, error, userData);
}
int ComputeNextStep(double* xprev, double* dxprev, double* xnext,
double t, double& delT, double& delTActual,
double minStep, double maxStep,
double maxError, double& error) override;
double maxError, double& error, void* userData) override;
//@}
protected:
......@@ -100,11 +101,4 @@ private:
#endif
// VTK-HeaderTest-Exclude: vtkRungeKutta2.h
......@@ -60,7 +60,7 @@ void vtkRungeKutta4::Initialize()
// (Addison Wesley)
int vtkRungeKutta4::ComputeNextStep(double* xprev, double* dxprev, double* xnext,
double t, double& delT, double& delTActual,
double, double, double, double& error)
double, double, double, double& error, void* userData)
{
int i, numDerivs, numVals;
......@@ -97,7 +97,7 @@ int vtkRungeKutta4::ComputeNextStep(double* xprev, double* dxprev, double* xnext
this->Derivs[i] = dxprev[i];
}
}
else if ( !this->FunctionSet->FunctionValues(this->Vals, this->Derivs) )
else if ( !this->FunctionSet->FunctionValues(this->Vals, this->Derivs, userData) )
{
memcpy(xnext, this->Vals, (numVals-1)*sizeof(double));
return OUT_OF_DOMAIN;
......@@ -110,7 +110,7 @@ int vtkRungeKutta4::ComputeNextStep(double* xprev, double* dxprev, double* xnext
this->Vals[numVals-1] = t + delT/2.0;
// 2
if (!this->FunctionSet->FunctionValues(this->Vals, this->NextDerivs[0]))
if (!this->FunctionSet->FunctionValues(this->Vals, this->NextDerivs[0], userData))
{
memcpy(xnext, this->Vals, (numVals-1)*sizeof(double));
delTActual = delT/2.0; // we've been able to take half a step
......@@ -124,7 +124,7 @@ int vtkRungeKutta4::ComputeNextStep(double* xprev, double* dxprev, double* xnext
this->Vals[numVals-1] = t + delT/2.0;
// 3
if (!this->FunctionSet->FunctionValues(this->Vals, this->NextDerivs[1]))
if (!this->FunctionSet->FunctionValues(this->Vals, this->NextDerivs[1], userData))
{
memcpy(xnext, this->Vals, (numVals-1)*sizeof(double));
delTActual = delT/2.0; // we've been able to take half a step
......@@ -138,7 +138,7 @@ int vtkRungeKutta4::ComputeNextStep(double* xprev, double* dxprev, double* xnext
this->Vals[numVals-1] = t + delT;
// 4
if (!this->FunctionSet->FunctionValues(this->Vals, this->NextDerivs[2]))
if (!this->FunctionSet->FunctionValues(this->Vals, this->NextDerivs[2], userData))
{
memcpy(xnext, this->Vals, (numVals-1)*sizeof(double));
delTActual = delT; // we've been able to take a full step but couldn't finish the algorithm
......
......@@ -43,7 +43,7 @@ public:
*/
static vtkRungeKutta4 *New();
using Superclass::ComputeNextStep;
//@{
/**
* Given initial values, xprev , initial time, t and a requested time
......@@ -60,36 +60,36 @@ public:
*/
int ComputeNextStep(double* xprev, double* xnext,
double t, double& delT,
double maxError, double& error) override
double maxError, double& error, void* userData) override
{
double minStep = delT;
double maxStep = delT;
double delTActual;
return this->ComputeNextStep(xprev, nullptr, xnext, t, delT, delTActual,
minStep, maxStep, maxError, error);
minStep, maxStep, maxError, error, userData);
}
int ComputeNextStep(double* xprev, double* dxprev, double* xnext,
double t, double& delT,
double maxError, double& error) override
double maxError, double& error, void* userData) override
{
double minStep = delT;
double maxStep = delT;
double delTActual;
return this->ComputeNextStep(xprev, dxprev, xnext, t, delT, delTActual,
minStep, maxStep, maxError, error);
minStep, maxStep, maxError, error, userData);
}
int ComputeNextStep(double* xprev, double* xnext,
double t, double& delT, double& delTActual,
double minStep, double maxStep,
double maxError, double& error) override
double maxError, double& error, void* userData) override
{
return this->ComputeNextStep(xprev, nullptr, xnext, t, delT, delTActual,
minStep, maxStep, maxError, error);
minStep, maxStep, maxError, error, userData);
}
int ComputeNextStep(double* xprev, double* dxprev, double* xnext,
double t, double& delT, double& delTActual,
double minStep, double maxStep,
double maxError, double& error) override;
double maxError, double& error, void* userData) override;
//@}
protected:
......@@ -105,11 +105,3 @@ private:
};
#endif
......@@ -91,7 +91,7 @@ int vtkRungeKutta45::ComputeNextStep(double* xprev, double* dxprev,
double* xnext, double t, double& delT,
double& delTActual,
double minStep, double maxStep,
double maxError, double& estErr )
double maxError, double& estErr, void* userData)
{
estErr = VTK_DOUBLE_MAX;
......@@ -112,7 +112,7 @@ int vtkRungeKutta45::ComputeNextStep(double* xprev, double* dxprev,
if ( ((minStep == absDT) && (maxStep == absDT)) ||
(maxError <= 0.0) )
{
int retVal = this->ComputeAStep(xprev, dxprev, xnext, t, delT, delTActual, estErr);
int retVal = this->ComputeAStep(xprev, dxprev, xnext, t, delT, delTActual, estErr, userData);
return retVal;
}
else if ( minStep > maxStep )
......@@ -127,7 +127,7 @@ int vtkRungeKutta45::ComputeNextStep(double* xprev, double* dxprev,
while ( estErr > maxError )
{
if ((retVal =
this->ComputeAStep(xprev, dxprev, xnext, t, delT, delTActual, estErr)))
this->ComputeAStep(xprev, dxprev, xnext, t, delT, delTActual, estErr, userData)))
{
return retVal;
}
......@@ -189,7 +189,7 @@ int vtkRungeKutta45::ComputeNextStep(double* xprev, double* dxprev,
if (shouldBreak)
{
if ( (retVal =
this->ComputeAStep(xprev, dxprev, xnext, t, delT, delTActual, estErr)) )
this->ComputeAStep(xprev, dxprev, xnext, t, delT, delTActual, estErr, userData)) )
{
return retVal;
}
......@@ -204,7 +204,7 @@ int vtkRungeKutta45::ComputeNextStep(double* xprev, double* dxprev,
// Calculate next time step
int vtkRungeKutta45::ComputeAStep(
double* xprev, double* dxprev, double* xnext, double t, double& delT,
double& actualDelT, double& error)
double& actualDelT, double& error, void* userData)
{
int i, j, k, numDerivs, numVals;
......@@ -240,7 +240,7 @@ int vtkRungeKutta45::ComputeAStep(
}
}
else if ( !this->FunctionSet->FunctionValues(this->Vals,
this->NextDerivs[0]) )
this->NextDerivs[0], userData))
{
for(i=0; i<numVals-1; i++)
{
......@@ -266,7 +266,7 @@ int vtkRungeKutta45::ComputeAStep(
this->Vals[numVals-1] = t + delT*A[i-1];
if ( !this->FunctionSet->FunctionValues(this->Vals,
this->NextDerivs[i]) )
this->NextDerivs[i], userData))
{
for(int l = 0; l < numVals - 1; l++)
{
......
......@@ -49,6 +49,7 @@ public:
*/
static vtkRungeKutta45 *New();
using Superclass::ComputeNextStep;
//@{
/**
* Given initial values, xprev , initial time, t and a requested time
......@@ -74,36 +75,36 @@ public:
*/
int ComputeNextStep(double* xprev, double* xnext,
double t, double& delT,
double maxError, double& error) override
double maxError, double& error, void* userData) override
{
double minStep = delT;
double maxStep = delT;
double delTActual;
return this->ComputeNextStep(xprev, nullptr, xnext, t, delT, delTActual,
minStep, maxStep, maxError, error);
minStep, maxStep, maxError, error, userData);
}
int ComputeNextStep(double* xprev, double* dxprev, double* xnext,
double t, double& delT,
double maxError, double& error) override
double maxError, double& error, void* userData) override
{
double minStep = delT;
double maxStep = delT;
double delTActual;
return this->ComputeNextStep(xprev, dxprev, xnext, t, delT, delTActual,
minStep, maxStep, maxError, error);
minStep, maxStep, maxError, error, userData);
}
int ComputeNextStep(double* xprev, double* xnext,
double t, double& delT, double& delTActual,
double minStep, double maxStep,
double maxError, double& error) override
double maxError, double& error, void* userData) override
{
return this->ComputeNextStep(xprev, nullptr, xnext, t, delT, delTActual,
minStep, maxStep, maxError, error);
minStep, maxStep, maxError, error, userData);
}
int ComputeNextStep(double* xprev, double* dxprev, double* xnext,
double t, double& delT, double& delTActual,
double minStep, double maxStep,
double maxError, double& error) override;
double maxError, double& error, void* userData) override;
//@}
protected:
......@@ -121,7 +122,7 @@ protected:
double* NextDerivs[6];
int ComputeAStep(double* xprev, double* dxprev, double* xnext, double t,
double& delT, double& delTActual, double& error);
double& delT, double& delTActual, double& error, void* userData);
private:
vtkRungeKutta45(const vtkRungeKutta45&) = delete;
......
......@@ -128,9 +128,6 @@ int TestLagrangianIntegrationModel(int, char*[])
int nvar = odeWavelet->GetNumberOfIndependentVariables();
int seedIdx = 13;
vtkLagrangianParticle* part =
new vtkLagrangianParticle(nvar, seedIdx, seedIdx, 0, 0, pd);
odeWavelet->SetInputArrayToProcess(2, 0, 0,
vtkDataObject::FIELD_ASSOCIATION_CELLS, "");
odeWavelet->SetInputArrayToProcess(3, 0, 0,
......@@ -143,7 +140,6 @@ int TestLagrangianIntegrationModel(int, char*[])
vtkDataObject::FIELD_ASSOCIATION_POINTS, "ParticleDiameter");
odeWavelet->SetInputArrayToProcess(7, 1, 0,
vtkDataObject::FIELD_ASSOCIATION_POINTS, "ParticleDensity");
odeWavelet->SetCurrentParticle(part);
vtkNew<vtkCellLocator> locator;
odeWavelet->SetLocator(locator);
odeWavelet->AddDataSet(wavelet->GetOutput());
......@@ -153,7 +149,6 @@ int TestLagrangianIntegrationModel(int, char*[])
if (odeWavelet->GetLocator() != locator)
{
std::cerr << "Problem with locator" << std::endl;
delete part;
return EXIT_FAILURE;
}
......@@ -161,32 +156,30 @@ int TestLagrangianIntegrationModel(int, char*[])
if (!odeWavelet->GetUseInitialIntegrationTime())
{
std::cerr << "Problems with UseInitialIntegrationTime" << std::endl;
delete part;
return EXIT_FAILURE;
}
odeWavelet->UseInitialIntegrationTimeOff();
if (odeWavelet->GetUseInitialIntegrationTime())
{
std::cerr << "Problems with UseInitialIntegrationTime" << std::endl;
delete part;
return EXIT_FAILURE;
}
odeWavelet->UseInitialIntegrationTimeOn();
if (!odeWavelet->GetUseInitialIntegrationTime())
{
std::cerr << "Problems with UseInitialIntegrationTime" << std::endl;
delete part;
return EXIT_FAILURE;
}
odeWavelet->SetUseInitialIntegrationTime(false);
vtkLagrangianParticle part(nvar, seedIdx, seedIdx, 0, 0, pd, odeWavelet->GetWeightsSize());
odeWavelet->InitializeVariablesParticleData(pd);
odeWavelet->InsertVariablesParticleData(part, pd, 0);
odeWavelet->InitializeParticle(part);
if (odeWavelet->CheckFreeFlightTermination(part))
odeWavelet->InsertVariablesParticleData(&part, pd, 0);
odeWavelet->InitializeParticle(&part);
if (odeWavelet->CheckFreeFlightTermination(&part))
{
std::cerr << "CheckFreeFlightTermination should not return true with a matida model" << std::endl;
delete part;
return EXIT_FAILURE;
}
......@@ -194,68 +187,58 @@ int TestLagrangianIntegrationModel(int, char*[])
if (!odeWavelet->GetNonPlanarQuadSupport())
{
std::cerr << "Something went wrong with NonPlanarQuadSupport" << std::endl;
delete part;
return EXIT_FAILURE;
}
if (odeWavelet->GetWeightsSize() != 8)
{
std::cerr << "Incorrect Weights Size" << std::endl;
delete part;
return EXIT_FAILURE;
}
odeWavelet->ParallelManualShift(part);
odeWavelet->ParallelManualShift(&part);
vtkPolyData* tmpPd = nullptr;
vtkDataObject* tmpDo = nullptr;
if (!odeWavelet->FinalizeOutputs(tmpPd, tmpDo))
{
std::cerr << "FinalizeOutputs should be doing nothing and return true with matida model" << std::endl;
delete part;
return EXIT_FAILURE;
}
if (odeWavelet->GetSeedArrayNames()->GetNumberOfValues() != 4)
{
std::cerr << "Unexpected number of seed array names" << std::endl;
delete part;
return EXIT_FAILURE;
}
if (odeWavelet->GetSeedArrayComps()->GetNumberOfValues() != 4)
{
std::cerr << "Unexpected number of seed array comps" << std::endl;
delete part;
return EXIT_FAILURE;
}
if (odeWavelet->GetSeedArrayTypes()->GetNumberOfValues() != 4)
{
std::cerr << "Unexpected number of seed array type" << std::endl;
delete part;
return EXIT_FAILURE;
}
if (odeWavelet->GetSurfaceArrayNames()->GetNumberOfValues() != 1)
{
std::cerr << "Unexpected number of surface array names" << std::endl;
delete part;
return EXIT_FAILURE;
}
if (odeWavelet->GetSurfaceArrayComps()->GetNumberOfValues() != 1)
{
std::cerr << "Unexpected number of surface array comps" << std::endl;
delete part;
return EXIT_FAILURE;
}
if (odeWavelet->GetSurfaceArrayEnumValues()->GetNumberOfValues() != 11)
{
std::cerr << "Unexpected number of surface array enum values" << std::endl;
delete part;
return EXIT_FAILURE;
}
if (odeWavelet->GetSurfaceArrayTypes()->GetNumberOfValues() != 1)
{
std::cerr << "Unexpected number of surface array types" << std::endl;
delete part;
return EXIT_FAILURE;
}
......@@ -282,7 +265,6 @@ int TestLagrangianIntegrationModel(int, char*[])
vtkDataObject::FIELD_ASSOCIATION_POINTS, "ParticleDiameter");
odeTriangle->SetInputArrayToProcess(7, 1, 0,
vtkDataObject::FIELD_ASSOCIATION_POINTS, "ParticleDensity");
odeTriangle->SetCurrentParticle(part);
odeTriangle->SetLocator(locator);
odeTriangle->AddDataSet(triangle->GetOutput());
......@@ -301,7 +283,6 @@ int TestLagrangianIntegrationModel(int, char*[])
vtkDataObject::FIELD_ASSOCIATION_POINTS, "ParticleDiameter");
odeTransform->SetInputArrayToProcess(7, 1, 0,
vtkDataObject::FIELD_ASSOCIATION_POINTS, "ParticleDensity");
odeTransform->SetCurrentParticle(part);
odeTransform->SetLocator(locator);
odeTransform->AddDataSet(transform->GetOutput());
odeTransform->AddDataSet(wavelet->GetOutput());
......@@ -320,33 +301,29 @@ int TestLagrangianIntegrationModel(int, char*[])
{
x[0] = x0;
y[0] = x0 + xTranslation;
bool imageTest = (odeWavelet->FunctionValues(x, f) == 1);
bool locatorsTest = odeWavelet->FindInLocators(x);
bool unstrucTest = (odeTriangle->FunctionValues(x, f) == 1);
bool multiTest = (odeTransform->FunctionValues(y, f) == 1);
bool imageTest = (odeWavelet->FunctionValues(x, f, &part) == 1);
bool locatorsTest = odeWavelet->FindInLocators(x, &part);
bool unstrucTest = (odeTriangle->FunctionValues(x, f, &part) == 1);
bool multiTest = (odeTransform->FunctionValues(y, f, &part) == 1);
std::cerr.precision(15);
if (!imageTest && x[0] < 10)
{
std::cerr << "Image Test fail" << std::endl;
delete part;
return EXIT_FAILURE;
}
if (!locatorsTest && x[0] < 10)
{
std::cerr << "Locators Test fail" << std::endl;
delete part;
return EXIT_FAILURE;
}
if (!multiTest && y[0] < 10)
{
std::cerr << "Multi Test fail" << std::endl;
delete part;
return EXIT_FAILURE;
}
if (!unstrucTest && x[0] < 10)
{
std::cerr << "Ustruct Test fail" << std::endl;
delete part;
return EXIT_FAILURE;
}
x0 += tolerance;
......@@ -356,17 +333,16 @@ int TestLagrangianIntegrationModel(int, char*[])
odeTriangle->ClearDataSets();
odeTriangle->AddDataSet(transform->GetOutput());
x[0] = 0;
if (odeTriangle->FunctionValues(x, f) == 1)
if (odeTriangle->FunctionValues(x, f, &part) == 1)
{
std::cerr << "ClearDataSets does not seem to work" << std::endl;
delete part;
return EXIT_FAILURE;
}
x[3] = 1.3;
x[4] = 1.4;
x[5] = 1.5;
odeTransform->FunctionValues(x, f);
odeTransform->FunctionValues(x, f, &part);
if (f[0] != 1.3 ||
f[1] != 1.4 ||
f[2] != 1.5 ||
......@@ -377,7 +353,6 @@ int TestLagrangianIntegrationModel(int, char*[])
std::cerr << "Unexpected value from Integration Model" << std::endl;
std::cerr << f[0] << " " << f[1] << " " << f[2] << " " << f[3] << " " << f[4]
<< " " << f[5] << " " << std::endl;
delete part;
return EXIT_FAILURE;
}
......@@ -438,16 +413,15 @@ int TestLagrangianIntegrationModel(int, char*[])
if (odeWavelet->GetSurfaceArrayDefaultValues()->GetNumberOfValues() != 1)
{
std::cerr << "Unexpected number of surface array default values" << std::endl;
delete part;
return EXIT_FAILURE;
}
double* pos = part->GetPosition();
double* pos = part.GetPosition();
pos[0] = 0;
pos[1] = 0;
pos[2] = 0;
double* nextPos = part->GetNextPosition();
double* nextPos = part.GetNextPosition();
std::queue<vtkLagrangianParticle*> particles;
unsigned int interactedSurfaceFlatIndex;
vtkLagrangianBasicIntegrationModel::PassThroughParticlesType passThroughParticles;
......@@ -461,11 +435,10 @@ int TestLagrangianIntegrationModel(int, char*[])
odeWavelet->SetInputArrayToProcess(2, 0, 0,
vtkDataObject::FIELD_ASSOCIATION_CELLS, "SurfaceTypeModel");
vtkLagrangianParticle* interactionParticle = odeWavelet->ComputeSurfaceInteraction(
part, particles, interactedSurfaceFlatIndex, passThroughParticles);
&part, particles, interactedSurfaceFlatIndex, passThroughParticles);
if (!interactionParticle)
{
std::cerr << "No interaction with SurfaceTypeModel" << std::endl;
delete part;
return EXIT_FAILURE;
}
delete interactionParticle;
......@@ -475,36 +448,32 @@ int TestLagrangianIntegrationModel(int, char*[])
{
std::cerr << "Unexpected interaction position with SurfaceTypeModel"
<< std::endl;
delete part;
return EXIT_FAILURE;
}
if (!particles.empty() || !passThroughParticles.empty())
{
std::cerr << "Unexpected new particles created with SurfaceTypeModel"
<< std::endl;
delete part;
return EXIT_FAILURE;
}
if (interactedSurfaceFlatIndex != 0)
{
std::cerr << "Unexpected Interacted surface flat index with SurfaceTypeModel"
<< std::endl;
delete part;
return EXIT_FAILURE;
}
part->SetLastSurfaceCell(nullptr, -1);
part.SetLastSurfaceCell(nullptr, -1);
nextPos[0] = 20;
nextPos[1] = 0;
nextPos[2] = 0;
odeWavelet->SetInputArrayToProcess(2, 0, 0,
vtkDataObject::FIELD_ASSOCIATION_CELLS, "SurfaceTypeTerm");
vtkLagrangianParticle* interactionParticle2 = odeWavelet->ComputeSurfaceInteraction(
part, particles, interactedSurfaceFlatIndex, passThroughParticles);
&part, particles, interactedSurfaceFlatIndex, passThroughParticles);
if (!interactionParticle2)
{
std::cerr << "No interaction with SurfaceTypeTerm" << std::endl;
delete part;
return EXIT_FAILURE;
}
delete interactionParticle2;
......@@ -513,36 +482,32 @@ int TestLagrangianIntegrationModel(int, char*[])
{
std::cerr << "Unexpected interaction position with SurfaceTypeTerm"
<< std::endl;
delete part;
return EXIT_FAILURE;
}
if (!particles.empty() || !passThroughParticles.empty())
{
std::cerr << "Unexpected number particles created with SurfaceTypeTerm"
<< std::endl;
delete part;
return EXIT_FAILURE;
}
if (interactedSurfaceFlatIndex != 0)
{
std::cerr << "Unexpected Interacted surface flat index with SurfaceTypeTerm"
<< std::endl;
delete part;
return EXIT_FAILURE;
}
part->SetLastSurfaceCell(nullptr, -1);
part.SetLastSurfaceCell(nullptr, -1);
nextPos[0] = 20;
nextPos[1] = 0;
nextPos[2] = 0;
odeWavelet->SetInputArrayToProcess(2, 0, 0,
vtkDataObject::FIELD_ASSOCIATION_CELLS, "SurfaceTypeBounce");
vtkLagrangianParticle* interactionParticle3 = odeWavelet->ComputeSurfaceInteraction(
part, particles, interactedSurfaceFlatIndex, passThroughParticles);
&part, particles, interactedSurfaceFlatIndex, passThroughParticles);
if (!interactionParticle3)
{
std::cerr << "No interaction with SurfaceTypeBounce" << std::endl;
delete part;
return EXIT_FAILURE;
}
delete interactionParticle3;
......@@ -551,21 +516,18 @@ int TestLagrangianIntegrationModel(int, char*[])
{
std::cerr << "Unexpected interaction position with SurfaceTypeBounce"
<< std::endl;
delete part;
return EXIT_FAILURE;
}
if (!particles.empty() || !passThroughParticles.empty())
{
std::cerr << "Unexpected number particles created with SurfaceTypeBounce:"
<< particles.size() << " " << passThroughParticles.size() << std::endl;
delete part;
return EXIT_FAILURE;
}
if (interactedSurfaceFlatIndex != 0)
{
std::cerr << "Unexpected Interacted surface flat index with SurfaceTypeBounce"
<< std::endl;
delete part;
return EXIT_FAILURE;
}
......@@ -576,12 +538,11 @@ int TestLagrangianIntegrationModel(int, char*[])
nextPos[1] = 0;
nextPos[2] = 0;
vtkLagrangianParticle* interactionParticle4 = odeWavelet->ComputeSurfaceInteraction(
part, particles, interactedSurfaceFlatIndex, passThroughParticles);
&part, particles, interactedSurfaceFlatIndex, passThroughParticles);
if (interactionParticle4)
{
std::cerr << "Unexpected interaction with SurfaceTypeBounce perforation management"
<< std::endl;
delete part;
delete interactionParticle4;
return EXIT_FAILURE;
}
......@@ -590,25 +551,22 @@ int TestLagrangianIntegrationModel(int, char*[])
{
std::cerr << "Unexpected interaction position with SurfaceTypeBounce perforation"
<< std::endl;
delete part;
return EXIT_FAILURE;
}
if (!particles.empty() || !passThroughParticles.empty())
{
std::cerr << "Unexpected number particles created with SurfaceTypeBounce perforation:"
<< particles.size() << " " << passThroughParticles.size() << std::endl;
delete part;
return EXIT_FAILURE;
}
if (interactedSurfaceFlatIndex != 0)
{
std::cerr << "Unexpected Interacted surface flat index "
"with SurfaceTypeBounce perforation" << std::endl;
delete part;
return EXIT_FAILURE;
}
part->SetLastSurfaceCell(nullptr, -1);
part.SetLastSurfaceCell(nullptr, -1);
pos[0] = 0;
pos[1] = 0;
pos[2] = 0;
......@@ -617,12 +575,11 @@ int TestLagrangianIntegrationModel(int, char*[])
nextPos[2] = 0;
odeWavelet->SetInputArrayToProcess(2, 0, 0,
vtkDataObject::FIELD_ASSOCIATION_CELLS, "SurfaceTypeBreak");
vtkLagrangianParticle* interactionParticle5 = odeWavelet->ComputeSurfaceInteraction(part, particles,
vtkLagrangianParticle* interactionParticle5 = odeWavelet->ComputeSurfaceInteraction(&part, particles,
interactedSurfaceFlatIndex, passThroughParticles);
if (!interactionParticle5)
{
std::cerr << "No interaction with SurfaceTypeBreak" << std::endl;
delete part;
return EXIT_FAILURE;
}
delete interactionParticle5;
......@@ -631,25 +588,22 @@ int TestLagrangianIntegrationModel(int, char*[])
{
std::cerr << "Unexpected interaction position with SurfaceTypeBreak"
<< std::endl;
delete part;
return EXIT_FAILURE;
}
if (particles.size() != 2 || !passThroughParticles.empty())
{
std::cerr << "Unexpected number particles created with SurfaceTypeBreak:"
<< particles.size() << " " << passThroughParticles.size() << std::endl;
delete part;
return EXIT_FAILURE;
}
if (interactedSurfaceFlatIndex != 0)
{
std::cerr << "Unexpected Interacted surface flat index with SurfaceTypeBreak"
<< std::endl;
delete part;
return EXIT_FAILURE;
}
part->SetLastSurfaceCell(nullptr, -1);
part.SetLastSurfaceCell(nullptr, -1);
delete particles.front();
particles.pop();
delete particles.front();
......@@ -659,12 +613,11 @@ int TestLagrangianIntegrationModel(int, char*[])
nextPos[2] = 0;
odeWavelet->SetInputArrayToProcess(2, 0, 0,
vtkDataObject::FIELD_ASSOCIATION_CELLS, "SurfaceTypePass");
vtkLagrangianParticle* interactionParticle6 = odeWavelet->ComputeSurfaceInteraction(part, particles,
vtkLagrangianParticle* interactionParticle6 = odeWavelet->ComputeSurfaceInteraction(&part, particles,
interactedSurfaceFlatIndex, passThroughParticles);
if (interactionParticle6)
{
std::cerr << "Unexpected interaction with SurfaceTypePass" << std::endl;
delete part;
delete interactionParticle6;
return EXIT_FAILURE;
}
......@@ -674,26 +627,23 @@ int TestLagrangianIntegrationModel(int, char*[])
{
std::cerr << "Unexpected interaction position with SurfaceTypePass"
<< std::endl;
delete part;
return EXIT_FAILURE;
}
if (!particles.empty() || passThroughParticles.size() != 1)
{
std::cerr << "Unexpected number particles created with SurfaceTypePass: "
<< particles.size() << " " << passThroughParticles.size() << std::endl;
delete part;
return EXIT_FAILURE;
}
if (interactedSurfaceFlatIndex != 0)
{
std::cerr << "Unexpected Interacted surface flat index with SurfaceTypePass"
<< std::endl;
delete part;
return EXIT_FAILURE;
}
odeWavelet->ClearDataSets(true);
part->SetLastSurfaceCell(nullptr, -1);
part.SetLastSurfaceCell(nullptr, -1);
delete passThroughParticles.front().second;
passThroughParticles.pop();
nextPos[0] = 20;
......@@ -702,13 +652,12 @@ int TestLagrangianIntegrationModel(int, char*[])
odeWavelet->SetInputArrayToProcess(2, 0, 0,
vtkDataObject::FIELD_ASSOCIATION_CELLS, "SurfaceTypeModel");
vtkLagrangianParticle* interactionParticle7 = odeWavelet->ComputeSurfaceInteraction(
part, particles, interactedSurfaceFlatIndex, passThroughParticles);
&part, particles, interactedSurfaceFlatIndex, passThroughParticles);
if (interactionParticle7)
{
std::cerr << "Unexpected interaction with SurfaceTypeModel Cleared"
<< std::endl;
delete interactionParticle7;
delete part;
return EXIT_FAILURE;
}
if (nextPos[0] > 20 + tolerance || nextPos[0] < 20 - tolerance
......@@ -716,23 +665,19 @@ int TestLagrangianIntegrationModel(int, char*[])
{
std::cerr << "Unexpected interaction position with SurfaceTypeModel Cleared"
<< std::endl;
delete part;
return EXIT_FAILURE;
}
if (!particles.empty() || !passThroughParticles.empty())
{
std::cerr << "Unexpected new particles created with SurfaceTypeModel Cleared"
<< particles.size() << " " << passThroughParticles.size() << std::endl;
delete part;
return EXIT_FAILURE;
}
if (interactedSurfaceFlatIndex != 0)
{
std::cerr << "Unexpected Interacted surface flat index "
"with SurfaceTypeModel Cleared" << std::endl;
delete part;
return EXIT_FAILURE;
}
delete part;
return EXIT_SUCCESS;
}
......@@ -14,6 +14,7 @@
=========================================================================*/
#include "vtkLagrangianParticle.h"
#include "vtkCellLocator.h"
#include "vtkDoubleArray.h"
#include "vtkNew.h"
#include "vtkPointData.h"
......@@ -36,7 +37,7 @@ int TestLagrangianParticle(int, char*[])
vtkIdType particleCounter = 0;
vtkLagrangianParticle* part = new vtkLagrangianParticle(nvar, seedId,
particleCounter, seedId, 0, pd);
particleCounter, seedId, 0, pd, 8);
particleCounter++;
if (nvar != part->GetNumberOfVariables())
{
......@@ -272,12 +273,13 @@ int TestLagrangianParticle(int, char*[])
return EXIT_FAILURE;
}
vtkNew<vtkCellLocator> locator;
vtkNew<vtkPolyData> poly;
int cellId = 17;
part->SetLastCell(poly, cellId);
if (part->GetLastDataSet() != poly || part->GetLastCellId() != cellId)
part->SetLastCell(locator, poly, cellId);
if (part->GetLastLocator() != locator || part->GetLastDataSet() != poly || part->GetLastCellId() != cellId)
{
std::cerr << "Incorrect LastCellId or LastDataSet" << std::endl;
std::cerr << "Incorrect LastCellId or LastDataSet or LastLocator" << std::endl;
delete part;
delete part2;
delete part3;
......@@ -378,10 +380,10 @@ int TestLagrangianParticle(int, char*[])
particleCounter = 0;
vtkLagrangianParticle* part4 = new vtkLagrangianParticle(nvar, seedId,
particleCounter, seedId, 0, pd);
particleCounter, seedId, 0, pd, 8);
particleCounter++;
vtkLagrangianParticle* part5 = vtkLagrangianParticle::NewInstance(nvar, seedId,
particleCounter, seedId, 0.17, pd, 17, 0.13);
particleCounter, seedId, 0.17, pd, 8, 17, 0.13);
particleCounter++;
if (part4->GetId() != 0)
{
......
......@@ -55,6 +55,7 @@ public:
void SetLastCellId( vtkIdType c ) override
{ this->Superclass::SetLastCellId( c ); }
using Superclass::FunctionValues;
/**
* Evaluate the velocity field f at point p.
* If it succeeds, then both the last data set (this->LastDataSet) and
......
......@@ -185,6 +185,7 @@ public:
{ this->Caching = from->Caching; }
using Superclass::FunctionValues;
/**
* Evaluate the velocity field f at point (x, y, z).
*/
......
......@@ -74,6 +74,7 @@ public:
*/
static vtkCachingInterpolatedVelocityField *New();
using Superclass::FunctionValues;
//@{
/**
* Evaluate the velocity field, f={u,v,w}, at {x, y, z}.
......
......@@ -102,6 +102,7 @@ public:
*/
void AddDataSet( vtkDataSet * dataset ) override;
using Superclass::FunctionValues;
/**
* Evaluate the velocity field f at point (x, y, z).
*/
......
......@@ -79,6 +79,7 @@ public:
*/
void AddDataSet( vtkDataSet * dataset ) override;
using Superclass::FunctionValues;
/**
* Evaluate the velocity field f at point (x, y, z).
*/
......
......@@ -19,11 +19,11 @@
*
* This vtkFunctionSet abstract implementation
* is meant to be used as a parameter of vtkLagrangianParticleTracker.
* It manages multiples datasets locator in order to evaluate the
* It manages multiple dataset locators in order to evaluate the
* vtkFunctionSet::FunctionValues method.
* The actual FunctionValues implementation should be found in class inheriting
* this class
* Input Array to process are expected as follows :
* The actual FunctionValues implementation should be found in the class inheriting
* this class.
* Input Arrays to process are expected as follows:
* Index 0 : "SurfaceType" array of surface input of the particle tracker
*
* Inherited classes MUST implement
......@@ -31,33 +31,34 @@
* double * x, double * f);
* to define how the integration works.
*
* Inherited classes could reimplement SetCurrentParticle, InitializeVariablesParticleData, and
* InsertVariablesParticleData to add new UserVariables to integrate with
* Inherited classes could reimplement InitializeVariablesParticleData and
* InsertVariablesParticleData to add new UserVariables to integrate with.
*
* Inherited classes could reimplement InteractWithSurface or other surface interaction method
* to changes the way particle interact with surface
* Inherited classes could reimplement InteractWithSurface or other surface interaction methods
* to change the way particles interact with surfaces.
*
* Inherited classes could reimplement IntersectWithLine to use a specific algorithm
* to intersect particles and surface cells.
*
* Inherited class could reimplement CheckFreeFlightTermination to set
* the way particle terminate in free flight
* the way particles terminate in free flight.
*
* @sa
* vtkLagrangianParticleTracker vtkLagrangianParticle
* vtkLagrangianMatidaIntegrationModel
*/
*/
#ifndef vtkLagrangianBasicIntegrationModel_h
#define vtkLagrangianBasicIntegrationModel_h
#include "vtkFiltersFlowPathsModule.h" // For export macro
#include "vtkNew.h" // For arrays
#include "vtkWeakPointer.h" // For weak pointer
#include "vtkFunctionSet.h"
#include "vtkNew.h" // For arrays
#include "vtkWeakPointer.h" // For weak pointer
#include <queue> // for new particles
#include <map> // for array indexes
#include <mutex> // for mutexes
#include <queue> // for new particles
class vtkAbstractArray;
class vtkAbstractCellLocator;
......@@ -79,8 +80,7 @@ class vtkPolyData;
class vtkStringArray;
class vtkSurfaceType;
class VTKFILTERSFLOWPATHS_EXPORT vtkLagrangianBasicIntegrationModel :
public vtkFunctionSet
class VTKFILTERSFLOWPATHS_EXPORT vtkLagrangianBasicIntegrationModel : public vtkFunctionSet
{
public:
vtkTypeMacro(vtkLagrangianBasicIntegrationModel, vtkFunctionSet);
......@@ -102,16 +102,18 @@ public:
VARIABLE_STEP_NEXT = 1,
} VariableStep;
typedef std::pair< unsigned int, vtkLagrangianParticle*> PassThroughParticlesItem;
typedef std::queue< PassThroughParticlesItem > PassThroughParticlesType;
typedef std::pair<unsigned int, vtkLagrangianParticle*> PassThroughParticlesItem;
typedef std::queue<PassThroughParticlesItem> PassThroughParticlesType;
using Superclass::FunctionValues;
/**
* Evaluate integration model velocity f at position x.
* Look for the cell containing the position x in all it's added dataset
* in found this will call
* Look for the cell containing the position x in all its added datasets
* if found this will call
* FunctionValues(vtkDataSet* detaSet, vtkIdType cellId, double* x, double* f)
* This method is thread safe.
*/
int FunctionValues(double* x, double* f) override;
int FunctionValues(double* x, double* f, void* userData) override;
//@{
/**
......@@ -147,8 +149,8 @@ public:
* surfaceFlatIndex, used only with composite surface, in order to identify the
* flatIndex of the surface for particle interaction
*/
virtual void AddDataSet(vtkDataSet* dataset, bool surface = false,
unsigned int surfaceFlatIndex = 0);
virtual void AddDataSet(
vtkDataSet* dataset, bool surface = false, unsigned int surfaceFlatIndex = 0);
virtual void ClearDataSets(bool surface = false);
//@}
......@@ -161,13 +163,6 @@ public:
vtkBooleanMacro(UseInitialIntegrationTime, bool);
//@}
//@{
/**
* Set the current particle
*/
vtkSetMacro(CurrentParticle, vtkLagrangianParticle*);
//@}
//@{
/**
* Get the tolerance to use with this model.
......@@ -193,16 +188,16 @@ public:
* with no effect on the particle
*/
virtual vtkLagrangianParticle* ComputeSurfaceInteraction(vtkLagrangianParticle* particle,
std::queue<vtkLagrangianParticle*>& particles,
unsigned int& interactedSurfaceFlatIndex, PassThroughParticlesType& passThroughParticles);
std::queue<vtkLagrangianParticle*>& particles, unsigned int& interactedSurfaceFlatIndex,
PassThroughParticlesType& passThroughParticles);
/**
* Set a input array to process at a specific index, identified by a port,
* connection, fieldAssociation and a name.
* Each inherited class can specify their own input array to process
*/
virtual void SetInputArrayToProcess(int idx, int port, int connection,
int fieldAssociation, const char* name);
virtual void SetInputArrayToProcess(
int idx, int port, int connection, int fieldAssociation, const char* name);
//@{
/**
......@@ -211,11 +206,14 @@ public:
* return true and data to recover the cell if in domain.
* does not filter out ghost cells.
* convenience method with less outputs.
*/
virtual bool FindInLocators(double* x, vtkDataSet*& dataset, vtkIdType& cellId,
vtkAbstractCellLocator*& loc, double*& weights);
virtual bool FindInLocators(double* x, vtkDataSet*& dataset, vtkIdType& cellId);
virtual bool FindInLocators(double* x);
* Provide a particle if a dataset/locator cache can be used.
* This method is thread-safe.
*/
virtual bool FindInLocators(double* x, vtkLagrangianParticle* particle, vtkDataSet*& dataset,
vtkIdType& cellId, vtkAbstractCellLocator*& loc, double*& weights);
virtual bool FindInLocators(
double* x, vtkLagrangianParticle* particle, vtkDataSet*& dataset, vtkIdType& cellId);
virtual bool FindInLocators(double* x, vtkLagrangianParticle* particle = nullptr);
//@}
/**
......@@ -248,14 +246,14 @@ public:
* Allows a inherited class to insert data in initialized
* array in the outputs field data associated with each particle path.
*/
virtual void InsertModelPathData(vtkLagrangianParticle* vtkNotUsed(particle),
vtkFieldData* vtkNotUsed(data)) {}
virtual void InsertModelPathData(
vtkLagrangianParticle* vtkNotUsed(particle), vtkFieldData* vtkNotUsed(data)) {}
/**
* Initialize a particle by setting user variables and perform any user
* model specific operation. empty in basic implementation.
*/
virtual void InitializeParticle(vtkLagrangianParticle* vtkNotUsed(particle)){}
virtual void InitializeParticle(vtkLagrangianParticle* vtkNotUsed(particle)) {}
/**
* Method to be reimplemented if needed in inherited classes.
......@@ -265,8 +263,10 @@ public:
* the current particle is passed as an argument.
* This method always returns true in this basis class.
*/
virtual bool CheckAdaptiveStepReintegration(
vtkLagrangianParticle* vtkNotUsed(particle)){return true;}
virtual bool CheckAdaptiveStepReintegration(vtkLagrangianParticle* vtkNotUsed(particle))
{
return true;
}
/**
* Method to be reimplemented if needed in inherited classes.
......@@ -274,9 +274,12 @@ public:
* should be terminated only based on particle parameters.
* This method should return true if the particle must be terminated, false otherwise.
* It always returns false in this basis class.
* This method is thread-safe, its reimplementation should still be thread-safe.
*/
virtual bool CheckFreeFlightTermination(
vtkLagrangianParticle* vtkNotUsed(particle)){return false;}
virtual bool CheckFreeFlightTermination(vtkLagrangianParticle* vtkNotUsed(particle))
{
return false;
}
//@{
/**
......@@ -363,32 +366,35 @@ public:
* will be considered actual out of domain error.
* Return true if manual integration was used, false otherwise
* Simply return false in vtkLagrangianBasicIntegrationModel
* implementation
* implementation.
* This method is thread-safe, its reimplementation should still be thread-safe.
*/
virtual bool ManualIntegration(double* xcur, double* xnext,
double t, double& delT, double& delTActual,
double minStep, double maxStep,
double maxError, double& error, int& integrationResult);
virtual bool ManualIntegration(double* xcur, double* xnext, double t, double& delT,
double& delTActual, double minStep, double maxStep, double maxError, double& error,
int& integrationResult);
/**
* Method called by parallel algorithm
* after receiving a particle from stream if PManualShift flag has been set to true
* on the particle. Does nothing in base implementation
*/
virtual void ParallelManualShift(vtkLagrangianParticle* vtkNotUsed(particle)){}
virtual void ParallelManualShift(vtkLagrangianParticle* vtkNotUsed(particle)) {}
/**
* Enable model post process on output
* Return true if successful, false otherwise
* Empty and Always return true with basic model
*/
virtual bool FinalizeOutputs(vtkPolyData* vtkNotUsed(particlePathsOutput),
vtkDataObject* vtkNotUsed(interractionOutput)){return true;}
virtual bool FinalizeOutputs(
vtkPolyData* vtkNotUsed(particlePathsOutput), vtkDataObject* vtkNotUsed(interractionOutput))
{
return true;
}
/**
* Enable model to modify particle before integration
*/
virtual void PreIntegrate(std::queue<vtkLagrangianParticle*>& vtkNotUsed(particles)){}
virtual void PreIntegrate(std::queue<vtkLagrangianParticle*>& vtkNotUsed(particles)) {}
/**
* Get a seed array, as set in setInputArrayToProcess
......@@ -403,44 +409,53 @@ protected:
/**
* Actually compute the integration model velocity field
* pure abstract, to be implemented in inherited class
* This method implementation should be thread-safe
*/
virtual int FunctionValues(vtkDataSet* detaSet, vtkIdType cellId, double* weights,
double * x, double * f) = 0;
virtual int FunctionValues(vtkLagrangianParticle* particle, vtkDataSet* dataSet, vtkIdType cellId,
double* weights, double* x, double* f) = 0;
/**
* Look in the given dataset and associated locator to see if it contains
* the point x, if so return the cellId and output the cell containing the point
* and the weights of the point in the cell
* This method is thread-safe, its reimplementation should also be.
*/
virtual vtkIdType FindInLocator(vtkDataSet* dataSet, vtkAbstractCellLocator* locator,
double* x, vtkGenericCell* cell, double* weights);
virtual vtkIdType FindInLocator(vtkDataSet* dataSet, vtkAbstractCellLocator* locator, double* x,
vtkGenericCell* cell, double* weights);
/**
* Terminate a particle, by positioning flags.
* Return true to record the interaction, false otherwise
* This method is thread-safe.
*/
virtual bool TerminateParticle(vtkLagrangianParticle* particle);
/**
* Bounce a particle, using the normal of the cell it bounces on.
* Return true to record the interaction, false otherwise
* This method is thread-safe.
*/
virtual bool BounceParticle(vtkLagrangianParticle* particle,
vtkDataSet* surface, vtkIdType cellId);
virtual bool BounceParticle(
vtkLagrangianParticle* particle, vtkDataSet* surface, vtkIdType cellId);
/**
* Breakup a particle at intersection point, by terminating it and creating two
* new particle using the intersected cells normals
* Return true to record the interaction, false otherwise
* This method is thread-safe and uses vtkLagrangianBasicIntegrationModel::ParticleQueueMutex
* to access the particles queue, its reimplementation should also be.
*/
virtual bool BreakParticle(vtkLagrangianParticle* particle,
vtkDataSet* surface, vtkIdType cellId, std::queue<vtkLagrangianParticle*>& particles);
virtual bool BreakParticle(vtkLagrangianParticle* particle, vtkDataSet* surface, vtkIdType cellId,
std::queue<vtkLagrangianParticle*>& particles);
/**
* Call vtkLagrangianBasicIntegrationModel::Terminate
* This method is to be reimplemented in inherited classes willing
* to implement specific particle surface interactions
* Return true to record the interaction, false otherwise
* This method is thread-safe and should use
* vtkLagrangianBasicIntegrationModel::ParticleQueueMutex
* to add particles to the particles queue,
*/
virtual bool InteractWithSurface(int surfaceType, vtkLagrangianParticle* particle,
vtkDataSet* surface, vtkIdType cellId, std::queue<vtkLagrangianParticle*>& particles);
......@@ -449,42 +464,58 @@ protected:
* Call vtkCell::IntersectWithLine
* This method is to be reimplemented in inherited classes willing
* to implement specific line/surface intersection
* This method is thread-safe.
*/
virtual bool IntersectWithLine(vtkCell* cell, double p1[3], double p2[3],
double tol, double& t, double x[3]);
virtual bool IntersectWithLine(
vtkCell* cell, double p1[3], double p2[3], double tol, double& t, double x[3]);
/**
* compute all particle variables using interpolation factor
* This method is thread-safe.
*/
virtual void InterpolateNextParticleVariables(vtkLagrangianParticle* particle,
double interpolationFactor, bool forceInside = false);
virtual void InterpolateNextParticleVariables(
vtkLagrangianParticle* particle, double interpolationFactor, bool forceInside = false);
/**
* Given a particle, check if it perforate a surface cell
* ie : interact with next step after interacting with it
* This method is thread-safe.
*/
virtual bool CheckSurfacePerforation(vtkLagrangianParticle* particle,
vtkDataSet* surface, vtkIdType cellId);
virtual bool CheckSurfacePerforation(
vtkLagrangianParticle* particle, vtkDataSet* surface, vtkIdType cellId);
/**
* Get a seed array, as set in setInputArrayToProcess
* from the provided particle seed data
* Access then the correct tuple using