Peano 4
|
Represent one type (species) of particles. More...
#include <ParticleSpecies.h>
Public Member Functions | |
ParticleSpecies () | |
Initialise all data with the data corresponding to a clear, i.e. | |
ParticleSpecies (const ParticleSpecies ©)=delete | |
double | getMinTimeStepSize () const |
double | getMaxTimeStepSize () const |
double | getMinTimeStamp () const |
double | getMaxTimeStamp () const |
double | getMinSearchRadius () const |
double | getMaxSearchRadius () const |
double | getMinVelocity () const |
double | getMaxVelocity () const |
bool | rerunPreviousGridSweep () const |
Query species whether the last grid sweep/update sweep has to be repeated. | |
void | clearRerunPreviousGridSweepFlag () |
Set the rerun flag back to false. | |
void | setRerunPreviousGridSweep () |
Tell Peano to run through mesh with same action sets again. | |
void | setTimeStamp (double t, bool reduceInsteadOfOverwrite=true) |
Set both min and max time stamp. | |
void | setTimeStamp (double tMin, double tMax, bool reduceInsteadOfOverwrite=true) |
void | setTimeStepSize (double dt, bool reduceInsteadOfOverwrite=true) |
void | setTimeStepSize (double dtMin, double dtMax, bool reduceInsteadOfOverwrite=true) |
void | setVelocity (double vMin, double vMax, double rMin, double rMax) |
Set the maximum velocity that has been observed in a cell. | |
void | startTimeStep () |
This routine is automatically called for each and every species by the GlobalState object. | |
void | finishTimeStep () |
This routine is automatically called for each and every species by the GlobalState object. | |
void | clearSearchRadius () |
void | clearVelocity () |
void | clearTimeStampAndTimeStepSize () |
void | allReduce () |
Private Attributes | |
double | _minTimeStepSize |
double | _maxTimeStepSize |
double | _minTimeStamp |
double | _maxTimeStamp |
double | _minSearchRadius |
double | _maxSearchRadius |
double | _minVelocity |
double | _maxVelocity |
bool | _rerunPreviousGridSweep |
Static Private Attributes | |
static tarch::logging::Log | _log |
static tarch::multicore::BooleanSemaphore | _semaphore |
Represent one type (species) of particles.
Every particle type (class) has a static species, i.e. some data tied to the class rather than each individual object. These species data hold information such as global statistics.
The class is completely thread-safe.
Definition at line 26 of file ParticleSpecies.h.
swift2::ParticleSpecies::ParticleSpecies | ( | ) |
Initialise all data with the data corresponding to a clear, i.e.
from where they can be properly reduced. The only exception is the time stamp. Both the maximum and minimum time step are set to zero. If we set the max time stamp to inf, the code would immediately terminate, as it thinks at least one particle has reached the final time stamp.
Definition at line 13 of file ParticleSpecies.cpp.
|
delete |
void swift2::ParticleSpecies::allReduce | ( | ) |
Definition at line 110 of file ParticleSpecies.cpp.
References _maxTimeStamp(), _maxTimeStepSize(), _minTimeStamp(), _minTimeStepSize(), tarch::mpi::Rank::allReduce(), tarch::mpi::Rank::getInstance(), tarch::services::ServiceRepository::getInstance(), and tarch::services::ServiceRepository::receiveDanglingMessages().
void swift2::ParticleSpecies::clearRerunPreviousGridSweepFlag | ( | ) |
Set the rerun flag back to false.
This operation has to be called explicitly in your code, i.e. we do not invoke it automatically. A canonical location to call it is the prepare_traversal_kernel event of the corresponding AlgorithmStep of your species.
Definition at line 45 of file ParticleSpecies.cpp.
void swift2::ParticleSpecies::clearSearchRadius | ( | ) |
Definition at line 88 of file ParticleSpecies.cpp.
void swift2::ParticleSpecies::clearTimeStampAndTimeStepSize | ( | ) |
Definition at line 98 of file ParticleSpecies.cpp.
References _maxTimeStamp(), _maxTimeStepSize(), _minTimeStamp(), and _minTimeStepSize().
void swift2::ParticleSpecies::clearVelocity | ( | ) |
Definition at line 93 of file ParticleSpecies.cpp.
void swift2::ParticleSpecies::finishTimeStep | ( | ) |
This routine is automatically called for each and every species by the GlobalState object.
Definition at line 108 of file ParticleSpecies.cpp.
double swift2::ParticleSpecies::getMaxSearchRadius | ( | ) | const |
Definition at line 73 of file ParticleSpecies.cpp.
double swift2::ParticleSpecies::getMaxTimeStamp | ( | ) | const |
Definition at line 69 of file ParticleSpecies.cpp.
References _maxTimeStamp().
double swift2::ParticleSpecies::getMaxTimeStepSize | ( | ) | const |
Definition at line 65 of file ParticleSpecies.cpp.
References _maxTimeStepSize().
double swift2::ParticleSpecies::getMaxVelocity | ( | ) | const |
Definition at line 77 of file ParticleSpecies.cpp.
double swift2::ParticleSpecies::getMinSearchRadius | ( | ) | const |
Definition at line 71 of file ParticleSpecies.cpp.
double swift2::ParticleSpecies::getMinTimeStamp | ( | ) | const |
Definition at line 67 of file ParticleSpecies.cpp.
References _minTimeStamp().
double swift2::ParticleSpecies::getMinTimeStepSize | ( | ) | const |
Definition at line 63 of file ParticleSpecies.cpp.
References _minTimeStepSize().
double swift2::ParticleSpecies::getMinVelocity | ( | ) | const |
Definition at line 75 of file ParticleSpecies.cpp.
bool swift2::ParticleSpecies::rerunPreviousGridSweep | ( | ) | const |
Query species whether the last grid sweep/update sweep has to be repeated.
This happens if the search radius changes for example.
Definition at line 43 of file ParticleSpecies.cpp.
void swift2::ParticleSpecies::setRerunPreviousGridSweep | ( | ) |
Tell Peano to run through mesh with same action sets again.
This flag tells Swift's main function that the step has not been complete, i.e. it has to rerun the same step again once this mesh traversal has completed. Therefore, the name is setRerunPreviousGridSweep() - by the time this information is evaluated it will be after the mesh sweep.
The flag is not automatically reset at any point. You have to do this manually by calling clearRerunPreviousGridSweepFlag(). Consult the documentation there.
The flag is automatically reduced by allReduce(), i.e. after the mesh traversal, all ranks will know if one rank has requested a rerun for the species.
Definition at line 47 of file ParticleSpecies.cpp.
void swift2::ParticleSpecies::setTimeStamp | ( | double | t, |
bool | reduceInsteadOfOverwrite = true ) |
Set both min and max time stamp.
Definition at line 24 of file ParticleSpecies.cpp.
void swift2::ParticleSpecies::setTimeStamp | ( | double | tMin, |
double | tMax, | ||
bool | reduceInsteadOfOverwrite = true ) |
Definition at line 28 of file ParticleSpecies.cpp.
References _maxTimeStamp(), and _minTimeStamp().
void swift2::ParticleSpecies::setTimeStepSize | ( | double | dt, |
bool | reduceInsteadOfOverwrite = true ) |
Definition at line 39 of file ParticleSpecies.cpp.
void swift2::ParticleSpecies::setTimeStepSize | ( | double | dtMin, |
double | dtMax, | ||
bool | reduceInsteadOfOverwrite = true ) |
Definition at line 52 of file ParticleSpecies.cpp.
References _maxTimeStepSize(), and _minTimeStepSize().
void swift2::ParticleSpecies::setVelocity | ( | double | vMin, |
double | vMax, | ||
double | rMin, | ||
double | rMax ) |
Set the maximum velocity that has been observed in a cell.
This routine takes the maximum velocity as observed so far and updates it if value is bigger.
The routine is thread-safe.
Definition at line 79 of file ParticleSpecies.cpp.
References logDebug.
void swift2::ParticleSpecies::startTimeStep | ( | ) |
This routine is automatically called for each and every species by the GlobalState object.
Definition at line 106 of file ParticleSpecies.cpp.
|
staticprivate |
Definition at line 28 of file ParticleSpecies.h.
|
private |
Definition at line 38 of file ParticleSpecies.h.
|
private |
Definition at line 35 of file ParticleSpecies.h.
|
private |
Definition at line 32 of file ParticleSpecies.h.
|
private |
Definition at line 41 of file ParticleSpecies.h.
|
private |
Definition at line 37 of file ParticleSpecies.h.
|
private |
Definition at line 34 of file ParticleSpecies.h.
|
private |
Definition at line 31 of file ParticleSpecies.h.
|
private |
Definition at line 40 of file ParticleSpecies.h.
|
private |
Definition at line 43 of file ParticleSpecies.h.
|
staticprivate |
Definition at line 29 of file ParticleSpecies.h.