diff --git a/src/vectorpostprocessors/ParticleDataVectorPostprocessor.C b/src/vectorpostprocessors/ParticleDataVectorPostprocessor.C index c1e56a6e..4873915e 100644 --- a/src/vectorpostprocessors/ParticleDataVectorPostprocessor.C +++ b/src/vectorpostprocessors/ParticleDataVectorPostprocessor.C @@ -32,7 +32,6 @@ ParticleDataVectorPostprocessor::ParticleDataVectorPostprocessor(const InputPara _study.getRayDataIndex("v_z") }), _data_values({ - &declareVector("id"), &declareVector("t_pos"), &declareVector("t_vel"), &declareVector("x"), @@ -71,15 +70,16 @@ ParticleDataVectorPostprocessor::execute() const auto rays = _study.getBankedRays(); for (const auto & ray : rays) { - _data_values[0]->push_back(ray->id()); - _data_values[1]->push_back(_t); - _data_values[2]->push_back(_t - _dt / 2); + // storing the time at which the particle position is known + _data_values[0]->push_back(_t); + // storing the time at which the particle velocity is known + _data_values[1]->push_back(_t - _dt / 2); const auto & point = ray->currentPoint(); - for (const auto i : make_range(3, 6)) - _data_values[i]->push_back(point(i - 3)); + for (const auto i : make_range(2, 5)) + _data_values[i]->push_back(point(i - 2)); - for (const auto i : make_range(6, int(6 + _ray_data_indices.size()))) - _data_values[i]->push_back(ray->data(_ray_data_indices[i - 6])); + for (const auto i : make_range(5, int(5 + _ray_data_indices.size()))) + _data_values[i]->push_back(ray->data(_ray_data_indices[i - 5])); } } diff --git a/test/include/vectorpostprocessors/TestParticleDataVectorPostprocessor.h b/test/include/vectorpostprocessors/TestParticleDataVectorPostprocessor.h index 6d782da7..2eae6668 100644 --- a/test/include/vectorpostprocessors/TestParticleDataVectorPostprocessor.h +++ b/test/include/vectorpostprocessors/TestParticleDataVectorPostprocessor.h @@ -17,6 +17,11 @@ class TestParticleDataVectorPostprocessor : public ParticleDataVectorPostprocess TestParticleDataVectorPostprocessor(const InputParameters & parameters); + /** + * adds the ray id to the particle data for sorting results + * This will help ensure testability + */ + virtual void execute() override; /** * In the testing version of this the finalize not only * communicates between procs but also sorts the data by ray diff --git a/test/src/vectorpostprocessors/TestParticleDataVectorPostprocessor.C b/test/src/vectorpostprocessors/TestParticleDataVectorPostprocessor.C index a1dd5b03..34355ace 100644 --- a/test/src/vectorpostprocessors/TestParticleDataVectorPostprocessor.C +++ b/test/src/vectorpostprocessors/TestParticleDataVectorPostprocessor.C @@ -20,8 +20,22 @@ TestParticleDataVectorPostprocessor::validParams() } TestParticleDataVectorPostprocessor::TestParticleDataVectorPostprocessor(const InputParameters & parameters) - : ParticleDataVectorPostprocessor(parameters) {} + : ParticleDataVectorPostprocessor(parameters) { + _data_values.push_back(&declareVector("id")); + } +void +TestParticleDataVectorPostprocessor::execute() +{ + // this does end up looping over the rays twice + // but since it will only be for testing this is fine + // helps to test the behaviour of the object people will actually + // use without requiring it to store meta data that is not important for them. + ParticleDataVectorPostprocessor::execute(); + const auto rays = _study.getBankedRays(); + for (const auto & ray : rays) + _data_values.back()->push_back(ray->id()); +} void TestParticleDataVectorPostprocessor::finalize() @@ -38,7 +52,7 @@ TestParticleDataVectorPostprocessor::finalize() indicies.end(), [&](size_t a, size_t b) -> bool { - return (*_data_values.front())[a] < (*_data_values.front())[b]; + return (*_data_values.back())[a] < (*_data_values.back())[b]; }); for (auto data : _data_values)