Peano
Loading...
Searching...
No Matches
swift2::ParticleSpecies Class Reference

Represent one type (species) of particles. More...

#include <ParticleSpecies.h>

Collaboration diagram for swift2::ParticleSpecies:

Public Member Functions

 ParticleSpecies ()
 Initialise all data with the data corresponding to a clear, i.e.
 
 ParticleSpecies (const ParticleSpecies &copy)=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 ()
 Clear all the time step sizes and time stamps.
 
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
 

Detailed Description

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.

Thread-safety

The class is completely thread-safe.

Definition at line 33 of file ParticleSpecies.h.

Constructor & Destructor Documentation

◆ ParticleSpecies() [1/2]

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 61 of file ParticleSpecies.h.

◆ ParticleSpecies() [2/2]

swift2::ParticleSpecies::ParticleSpecies ( const ParticleSpecies & copy)
delete

Member Function Documentation

◆ allReduce()

◆ clearRerunPreviousGridSweepFlag()

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 119 of file ParticleSpecies.h.

References _rerunPreviousGridSweep.

◆ clearSearchRadius()

void swift2::ParticleSpecies::clearSearchRadius ( )

Definition at line 205 of file ParticleSpecies.h.

References _maxSearchRadius, and _minSearchRadius.

◆ clearTimeStampAndTimeStepSize()

void swift2::ParticleSpecies::clearTimeStampAndTimeStepSize ( )

Clear all the time step sizes and time stamps.

These values then can be reduced again through

  • setTimeStepSize()
  • setTimeStamp()

before they are actually queried through getMinTimeStepSize() and related routines.

Definition at line 226 of file ParticleSpecies.h.

References _maxTimeStamp, _maxTimeStepSize, _minTimeStamp, and _minTimeStepSize.

◆ clearVelocity()

void swift2::ParticleSpecies::clearVelocity ( )

Definition at line 210 of file ParticleSpecies.h.

References _maxVelocity, and _minVelocity.

◆ finishTimeStep()

void swift2::ParticleSpecies::finishTimeStep ( )

This routine is automatically called for each and every species by the GlobalState object.

Definition at line 203 of file ParticleSpecies.h.

◆ getMaxSearchRadius()

double swift2::ParticleSpecies::getMaxSearchRadius ( ) const

Definition at line 93 of file ParticleSpecies.h.

References _maxSearchRadius.

◆ getMaxTimeStamp()

double swift2::ParticleSpecies::getMaxTimeStamp ( ) const

Definition at line 85 of file ParticleSpecies.h.

References _maxTimeStamp.

◆ getMaxTimeStepSize()

double swift2::ParticleSpecies::getMaxTimeStepSize ( ) const

Definition at line 77 of file ParticleSpecies.h.

References _maxTimeStepSize.

◆ getMaxVelocity()

double swift2::ParticleSpecies::getMaxVelocity ( ) const

Definition at line 101 of file ParticleSpecies.h.

References _maxVelocity.

◆ getMinSearchRadius()

double swift2::ParticleSpecies::getMinSearchRadius ( ) const

Definition at line 89 of file ParticleSpecies.h.

References _minSearchRadius.

◆ getMinTimeStamp()

double swift2::ParticleSpecies::getMinTimeStamp ( ) const

Definition at line 81 of file ParticleSpecies.h.

References _minTimeStamp.

◆ getMinTimeStepSize()

double swift2::ParticleSpecies::getMinTimeStepSize ( ) const

Definition at line 73 of file ParticleSpecies.h.

References _minTimeStepSize.

◆ getMinVelocity()

double swift2::ParticleSpecies::getMinVelocity ( ) const

Definition at line 97 of file ParticleSpecies.h.

References _minVelocity.

◆ rerunPreviousGridSweep()

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 109 of file ParticleSpecies.h.

References _rerunPreviousGridSweep.

◆ setRerunPreviousGridSweep()

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 138 of file ParticleSpecies.h.

References _rerunPreviousGridSweep, and _semaphore.

◆ setTimeStamp() [1/2]

void swift2::ParticleSpecies::setTimeStamp ( double t,
bool reduceInsteadOfOverwrite = true )

Set both min and max time stamp.

Definition at line 146 of file ParticleSpecies.h.

References setTimeStamp().

Referenced by setTimeStamp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTimeStamp() [2/2]

void swift2::ParticleSpecies::setTimeStamp ( double tMin,
double tMax,
bool reduceInsteadOfOverwrite = true )

Definition at line 150 of file ParticleSpecies.h.

References _maxTimeStamp, _minTimeStamp, and _semaphore.

◆ setTimeStepSize() [1/2]

void swift2::ParticleSpecies::setTimeStepSize ( double dt,
bool reduceInsteadOfOverwrite = true )

Definition at line 161 of file ParticleSpecies.h.

References setTimeStepSize().

Referenced by setTimeStepSize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTimeStepSize() [2/2]

void swift2::ParticleSpecies::setTimeStepSize ( double dtMin,
double dtMax,
bool reduceInsteadOfOverwrite = true )

Definition at line 165 of file ParticleSpecies.h.

References _maxTimeStepSize, _minTimeStepSize, and _semaphore.

◆ setVelocity()

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 183 of file ParticleSpecies.h.

References _maxSearchRadius, _maxVelocity, _minSearchRadius, _minVelocity, _semaphore, and logDebug.

◆ startTimeStep()

void swift2::ParticleSpecies::startTimeStep ( )

This routine is automatically called for each and every species by the GlobalState object.

Definition at line 196 of file ParticleSpecies.h.

Field Documentation

◆ _log

tarch::logging::Log swift2::ParticleSpecies::_log
staticprivate

Definition at line 35 of file ParticleSpecies.h.

◆ _maxSearchRadius

double swift2::ParticleSpecies::_maxSearchRadius
private

Definition at line 45 of file ParticleSpecies.h.

Referenced by allReduce(), clearSearchRadius(), getMaxSearchRadius(), and setVelocity().

◆ _maxTimeStamp

double swift2::ParticleSpecies::_maxTimeStamp
private

◆ _maxTimeStepSize

double swift2::ParticleSpecies::_maxTimeStepSize
private

◆ _maxVelocity

double swift2::ParticleSpecies::_maxVelocity
private

Definition at line 48 of file ParticleSpecies.h.

Referenced by allReduce(), clearVelocity(), getMaxVelocity(), and setVelocity().

◆ _minSearchRadius

double swift2::ParticleSpecies::_minSearchRadius
private

Definition at line 44 of file ParticleSpecies.h.

Referenced by allReduce(), clearSearchRadius(), getMinSearchRadius(), and setVelocity().

◆ _minTimeStamp

double swift2::ParticleSpecies::_minTimeStamp
private

◆ _minTimeStepSize

double swift2::ParticleSpecies::_minTimeStepSize
private

◆ _minVelocity

double swift2::ParticleSpecies::_minVelocity
private

Definition at line 47 of file ParticleSpecies.h.

Referenced by allReduce(), clearVelocity(), getMinVelocity(), and setVelocity().

◆ _rerunPreviousGridSweep

bool swift2::ParticleSpecies::_rerunPreviousGridSweep
private

◆ _semaphore

tarch::multicore::BooleanSemaphore swift2::ParticleSpecies::_semaphore
staticprivate

The documentation for this class was generated from the following file: