Commit 3f86167e authored by Andrew Bauer's avatar Andrew Bauer
Browse files

Fixing particle paths to have proper SimulationTime output.

Change-Id: Ifd2517b5a1b1e7a8de4d8e16454abdcb4cc477d7
parent 3cf773f3
......@@ -171,9 +171,10 @@ void vtkParticlePathFilter::InitializeExtraPointDataArrays(vtkPointData* outputP
outputPD->AddArray(this->SimulationTime);
}
void vtkParticlePathFilter::AppendToExtraPointDataArrays()
void vtkParticlePathFilter::AppendToExtraPointDataArrays(
vtkParticleTracerBaseNamespace::ParticleInformation &info)
{
this->SimulationTime->InsertNextValue(this->GetCurrentTimeValue());
this->SimulationTime->InsertNextValue(info.SimulationTime);
}
void vtkParticlePathFilter::Finalize()
......
......@@ -61,7 +61,7 @@ protected:
virtual void ResetCache();
virtual int OutputParticles(vtkPolyData* poly);
virtual void InitializeExtraPointDataArrays(vtkPointData* outputPD);
virtual void AppendToExtraPointDataArrays();
virtual void AppendToExtraPointDataArrays(vtkParticleTracerBaseNamespace::ParticleInformation &);
void Finalize();
......
......@@ -666,6 +666,7 @@ void vtkParticleTracerBase::AssignSeedsToProcessors(
info.age = 0.0;
info.speed = 0.0;
info.ErrorCode = 0;
info.SimulationTime = this->GetCurrentTimeValue();
info.PointId = -1;
}
//
......@@ -1166,6 +1167,7 @@ void vtkParticleTracerBase::IntegrateParticle(
// increment the particle time
point2[3] = point1[3] + stepTaken;
info.age += stepTaken;
info.SimulationTime += stepTaken;
// Point is valid. Insert it.
memcpy(&info.CurrentPosition, point2, sizeof(Position));
......@@ -1503,6 +1505,7 @@ bool vtkParticleTracerBase::RetryWithPush(
info.CurrentPosition.x[3] += delT;
info.LocationState = this->Interpolator->TestPoint(info.CurrentPosition.x);
info.age += delT;
info.SimulationTime += delT; // = this->GetCurrentTimeValue();
if (info.LocationState!=ID_OUTSIDE_ALL)
{
......@@ -1528,7 +1531,7 @@ void vtkParticleTracerBase::AddParticle(
this->InjectedStepIds->InsertNextValue(info.InjectedStepId);
this->ErrorCode->InsertNextValue(info.ErrorCode);
this->ParticleAge->InsertNextValue(info.age);
this->AppendToExtraPointDataArrays();
this->AppendToExtraPointDataArrays(info);
info.PointId = tempId;
//
......
......@@ -68,6 +68,7 @@ namespace vtkParticleTracerBaseNamespace
int InjectedPointId;
int InjectedStepId;
int UniqueParticleId;
double SimulationTime;
// These are useful to track for debugging etc
int ErrorCode;
float age;
......@@ -399,7 +400,7 @@ public:
// only be desired on specific concrete derived classes.
virtual void InitializeExtraPointDataArrays(vtkPointData* vtkNotUsed(outputPD)) {}
virtual void AppendToExtraPointDataArrays() {}
virtual void AppendToExtraPointDataArrays(vtkParticleTracerBaseNamespace::ParticleInformation &) {}
private:
// Description:
// Hide this because we require a new interpolator type
......@@ -501,5 +502,16 @@ private:
static const double Epsilon;
};
namespace
{
inline bool acbwithintol(double d, float f)
{
double diff = d-f;
if(diff*diff < .000001)
return true;
else
return false;
}
}
#endif
......@@ -81,7 +81,8 @@ int vtkPParticlePathFilter::OutputParticles(vtkPolyData* particles)
this->GetInjectedStepIds(tailPD)->InsertValue(tempId, info.InjectedStepId);
this->GetErrorCodeArr(tailPD)->InsertValue(tempId, info.ErrorCode);
this->GetParticleAge(tailPD)->InsertValue(tempId, info.age);
this->SimulationTime->InsertValue(tempId, this->GetCurrentTimeValue());
vtkDoubleArray::SafeDownCast(tailPD->GetArray("SimulationTime"))->InsertValue(tempId, info.SimulationTime);
if(this->GetComputeVorticity())
{
......@@ -110,9 +111,10 @@ void vtkPParticlePathFilter::InitializeExtraPointDataArrays(vtkPointData* output
outputPD->AddArray(this->SimulationTime);
}
void vtkPParticlePathFilter::AppendToExtraPointDataArrays()
void vtkPParticlePathFilter::AppendToExtraPointDataArrays(
vtkParticleTracerBaseNamespace::ParticleInformation &info)
{
this->SimulationTime->InsertNextValue(this->GetCurrentTimeValue());
this->SimulationTime->InsertNextValue(info.SimulationTime);
}
void vtkPParticlePathFilter::Finalize()
......
......@@ -44,7 +44,7 @@ protected:
virtual void ResetCache();
virtual int OutputParticles(vtkPolyData* poly);
virtual void InitializeExtraPointDataArrays(vtkPointData* outputPD);
virtual void AppendToExtraPointDataArrays();
virtual void AppendToExtraPointDataArrays(vtkParticleTracerBaseNamespace::ParticleInformation &);
void Finalize();
ParticlePathFilterInternal It;
......
......@@ -67,6 +67,7 @@ bool vtkPParticleTracerBase::SendParticleToAnotherProcess(
RemoteParticleInfo remoteInfo;
remoteInfo.Current = info;
remoteInfo.Previous = previousInfo;
remoteInfo.PreviousPD = vtkSmartPointer<vtkPointData>::New();
remoteInfo.PreviousPD->CopyAllocate(this->ProtoPD);
......@@ -95,7 +96,7 @@ bool vtkPParticleTracerBase::SendParticleToAnotherProcess(
this->MPISendList.reserve(static_cast<int>(this->MPISendList.size()*1.5));
}
this->MPISendList.push_back(remoteInfo);
return 1;
return true;
}
//---------------------------------------------------------------------------
......@@ -135,6 +136,7 @@ void vtkPParticleTracerBase::AssignSeedsToProcessors(
info.time = 0.0;
info.age = 0.0;
info.speed = 0.0;
info.SimulationTime = this->GetCurrentTimeValue();
info.ErrorCode = 0;
}
//
......@@ -284,7 +286,7 @@ void vtkPParticleTracerBase::SendReceiveParticles(RemoteParticleVector &sParticl
std::vector<RemoteParticleInfo>::iterator last =
first + messageLength[this->Controller->GetLocalProcessId()]/typeSize;
rParticles.erase(first, last);
// // don't want the ones that we sent away
// don't want the ones that we sent away
this->MPISendList.clear();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment