Skip to content

Commit

Permalink
Merge pull request #5948 from tjhei/fix-particle-world-index
Browse files Browse the repository at this point in the history
fix particle world index in properties
  • Loading branch information
gassmoeller authored Jun 27, 2024
2 parents 37781f4 + f57ed84 commit f1282ec
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
5 changes: 5 additions & 0 deletions include/aspect/particle/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ namespace aspect
class ParticleInterfaceBase : public Plugins::InterfaceBase
{
public:
/**
* Constructor.
*/
ParticleInterfaceBase();

/**
* @brief Set which particle world the plugin belongs to.
*
Expand Down
5 changes: 5 additions & 0 deletions include/aspect/particle/property/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,11 @@ namespace aspect
write_plugin_graph (std::ostream &output_stream);

private:
/**
* Stores the index to the particle world, to which this manager belongs.
*/
unsigned int particle_world_index;

/**
* Stores the names of the plugins which are present
* in the order they are executed.
Expand Down
6 changes: 6 additions & 0 deletions source/particle/interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ namespace aspect
{
namespace Particle
{
ParticleInterfaceBase::ParticleInterfaceBase()
: particle_world_index(numbers::invalid_unsigned_int)
{}



void
ParticleInterfaceBase::set_particle_world_index(const unsigned int particle_world_index)
{
Expand Down
11 changes: 6 additions & 5 deletions source/particle/property/interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -714,11 +714,13 @@ namespace aspect
if (SimulatorAccess<dim> *sim = dynamic_cast<SimulatorAccess<dim>*>(this->plugin_objects.back().get()))
sim->initialize_simulator (this->get_simulator());

this->plugin_objects.back()->set_particle_world_index(particle_world_index);
this->plugin_objects.back()->parse_parameters (prm);
}

// lastly store internal integrator properties
// lastly store internal integrator properties:
this->plugin_objects.emplace_back (std::make_unique<IntegratorProperties<dim>>());
this->plugin_objects.back()->set_particle_world_index(particle_world_index);
this->plugin_objects.back()->parse_parameters (prm);
}

Expand All @@ -728,10 +730,9 @@ namespace aspect
void
Manager<dim>::set_particle_world_index(unsigned int particle_world_index)
{
for (auto &property : this->plugin_objects)
{
property->set_particle_world_index(particle_world_index);
}
// Save this value. We will tell our plugins about this, once they
// have been created in parse_parameters().
this->particle_world_index = particle_world_index;
}


Expand Down

0 comments on commit f1282ec

Please sign in to comment.