Commit 3637cce3 authored by Andrew Bauer's avatar Andrew Bauer Committed by Code Review

Merge topic 'particle_path_fix' into master

be2d7b81 Adding in SimulationTimeStep output for particle paths.
parents 6b41931d be2d7b81
......@@ -129,6 +129,7 @@ vtkParticlePathFilter::vtkParticlePathFilter()
{
this->It.Initialize(this);
this->SimulationTime = NULL;
this->SimulationTimeStep = NULL;
}
vtkParticlePathFilter::~vtkParticlePathFilter()
......@@ -138,6 +139,11 @@ vtkParticlePathFilter::~vtkParticlePathFilter()
this->SimulationTime->Delete();
this->SimulationTime = NULL;
}
if(this->SimulationTimeStep)
{
this->SimulationTimeStep->Delete();
this->SimulationTimeStep = NULL;
}
}
void vtkParticlePathFilter::ResetCache()
......@@ -169,12 +175,25 @@ void vtkParticlePathFilter::InitializeExtraPointDataArrays(vtkPointData* outputP
}
this->SimulationTime->SetNumberOfTuples(0);
outputPD->AddArray(this->SimulationTime);
if(this->SimulationTimeStep == NULL)
{
this->SimulationTimeStep = vtkIntArray::New();
this->SimulationTimeStep->SetName("SimulationTimeStep");
}
if(outputPD->GetArray("SimulationTimeStep"))
{
outputPD->RemoveArray("SimulationTimeStep");
}
this->SimulationTimeStep->SetNumberOfTuples(0);
outputPD->AddArray(this->SimulationTimeStep);
}
void vtkParticlePathFilter::AppendToExtraPointDataArrays(
vtkParticleTracerBaseNamespace::ParticleInformation &info)
{
this->SimulationTime->InsertNextValue(info.SimulationTime);
this->SimulationTimeStep->InsertNextValue(info.InjectedStepId+info.TimeStepAge);
}
void vtkParticlePathFilter::Finalize()
......
......@@ -69,6 +69,7 @@ protected:
private:
vtkDoubleArray* SimulationTime;
vtkIntArray* SimulationTimeStep;
};
......
......@@ -29,6 +29,7 @@ vtkPParticlePathFilter::vtkPParticlePathFilter()
{
this->It.Initialize(this);
this->SimulationTime = NULL;
this->SimulationTimeStep = NULL;
}
vtkPParticlePathFilter::~vtkPParticlePathFilter()
......@@ -38,6 +39,11 @@ vtkPParticlePathFilter::~vtkPParticlePathFilter()
this->SimulationTime->Delete();
this->SimulationTime = NULL;
}
if(this->SimulationTimeStep)
{
this->SimulationTimeStep->Delete();
this->SimulationTimeStep = NULL;
}
}
void vtkPParticlePathFilter::ResetCache()
......@@ -83,6 +89,7 @@ int vtkPParticlePathFilter::OutputParticles(vtkPolyData* particles)
this->GetParticleAge(tailPD)->InsertValue(tempId, info.age);
vtkDoubleArray::SafeDownCast(tailPD->GetArray("SimulationTime"))->InsertValue(tempId, info.SimulationTime);
vtkIntArray::SafeDownCast(tailPD->GetArray("SimulationTimeStep"))->InsertValue(tempId, info.InjectedStepId+info.TimeStepAge);
if(this->GetComputeVorticity())
{
......@@ -109,12 +116,25 @@ void vtkPParticlePathFilter::InitializeExtraPointDataArrays(vtkPointData* output
}
this->SimulationTime->SetNumberOfTuples(0);
outputPD->AddArray(this->SimulationTime);
if(this->SimulationTimeStep == NULL)
{
this->SimulationTimeStep = vtkIntArray::New();
this->SimulationTimeStep->SetName("SimulationTimeStep");
}
if(outputPD->GetArray("SimulationTimeStep"))
{
outputPD->RemoveArray("SimulationTimeStep");
}
this->SimulationTimeStep->SetNumberOfTuples(0);
outputPD->AddArray(this->SimulationTimeStep);
}
void vtkPParticlePathFilter::AppendToExtraPointDataArrays(
vtkParticleTracerBaseNamespace::ParticleInformation &info)
{
this->SimulationTime->InsertNextValue(info.SimulationTime);
this->SimulationTimeStep->InsertNextValue(info.InjectedStepId+info.TimeStepAge);
}
void vtkPParticlePathFilter::Finalize()
......
......@@ -53,6 +53,7 @@ private:
void operator=(const vtkPParticlePathFilter&); // Not implemented
vtkDoubleArray* SimulationTime;
vtkIntArray* SimulationTimeStep;
};
......
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