Peano
Loading...
Searching...
No Matches
swift2::dependencychecks Namespace Reference

Namespaces

namespace  internal
 

Typedefs

template<typename ParticleContainer >
using PCParticle
 
template<typename ParticleContainer >
using PCAlgorithmStepEnum
 
template<typename ParticleContainer >
using PCInitStepEnum
 
template<typename ParticleContainer >
using PCSweepStageEnum
 
template<typename Particle >
using PAlgorithmStepEnum
 
template<typename Particle >
using PInitStepEnum
 
template<typename Particle >
using PSweepStageEnum
 

Enumerations

enum class  Invariant {
  TouchFirstUsage_MaskOutAfterwards_AllPreviousStepsUpdateAtLeastOnce , TouchFirstUsage_MaskOutAfterwards_AllPreviousStepsUpdateAtLeastOnce_SweepMayRerun , TouchAtMostOnce_MaskOutOtherwise_AllPreviousStepsUpdateAtLeastOnce , TouchAtMostOnce_MaskOutOtherwise_AllPreviousStepsUpdateAtLeastOnce_SweepMayRerun ,
  TouchAtLeastOnce_AllPreviousStepsUpdateAtLeastOnce , TouchAtLeastOnce_AllPreviousStepsUpdateAtLeastOnce_FutureStagesMayUpdate , TouchAtLeastOnce_AllPreviousStepsUpdateAtLeastOnce_MayOverwritePreviousCellUpdatesFromSameSweep , TouchAtLeastOnce_AllPreviousStepsUpdateAtLeastOnce_MayOverwritePreviousCellUpdatesFromSameSweep_FutureStagesMayUpdate
}
 Different invariants that have to hold for the code. More...
 

Functions

std::string toString (Invariant policy)
 
template<typename ParticleContainer >
static void markAlgorithmStep (const ParticleContainer &particles, const peano4::datamanagement::VertexMarker &marker, PCAlgorithmStepEnum< ParticleContainer > algorithmStepMarkerEnum, PCSweepStageEnum< ParticleContainer > sweepStageMarkerEnum, Invariant policy, ::swift2::kernels::UpdateParticleAssignedToVertexPredicate< PCParticle< ParticleContainer > > workOnParticle, int spacetreeId)
 Mark a localParticle having entered a sweep stage in a main algorithm step.
 
template<typename ParticleContainer >
static void markAlgorithmStep (const ParticleContainer &localParticles, const ParticleContainer &activeParticles, const peano4::datamanagement::CellMarker &marker, PCAlgorithmStepEnum< ParticleContainer > algorithmStepMarkerEnum, PCSweepStageEnum< ParticleContainer > sweepStageMarkerEnum, Invariant policy, ::swift2::kernels::UpdateParticlePairWithinCellPredicate< typename std::remove_pointer< typename ParticleContainer::value_type >::type > workOnParticle, int spacetreeId)
 A particle is marked if there is at least one active interaction in this cell.
 
template<typename ParticleContainer >
static void markInitStep (const ParticleContainer &localParticles, const peano4::datamanagement::VertexMarker &marker, PCInitStepEnum< ParticleContainer > initStepMarkerEnum, PCSweepStageEnum< ParticleContainer > sweepStageMarkerEnum, Invariant policy, ::swift2::kernels::UpdateParticleAssignedToVertexPredicate< PCParticle< ParticleContainer > > workOnParticle, int spacetreeId)
 Mark a localParticle having entered a sweep stage in a initialisation algorithm step.
 
template<typename ParticleContainer >
static void markInitStep (const ParticleContainer &localParticles, const ParticleContainer &activeParticles, const peano4::datamanagement::CellMarker &marker, PCInitStepEnum< ParticleContainer > initStepMarkerEnum, PCSweepStageEnum< ParticleContainer > sweepStageMarkerEnum, Invariant policy, ::swift2::kernels::UpdateParticlePairWithinCellPredicate< PCParticle< ParticleContainer > > workOnParticle, int spacetreeId)
 A particle is marked if there is at least one active interaction in this cell.
 
template<typename ParticleContainer >
static void checkAlgorithmStep (Invariant policy, const ParticleContainer &localParticles, const ParticleContainer &activeParticles, const peano4::datamanagement::CellMarker &marker, PCAlgorithmStepEnum< ParticleContainer > algorithmStepMarkerEnum, PCSweepStageEnum< ParticleContainer > sweepStageMarkerEnum, ::swift2::kernels::UpdateParticlePairWithinCellPredicate< PCParticle< ParticleContainer > > workOnParticle, int spacetreeId)
 Dependency Check: Verify that particles have completed all the algorithm steps and stages of the main algorithm steps before the current one.
 
template<typename ParticleContainer >
static void checkAlgorithmStep (Invariant policy, const ParticleContainer &localParticles, const peano4::datamanagement::VertexMarker &marker, PCAlgorithmStepEnum< ParticleContainer > algorithmStepMarkerEnum, PCSweepStageEnum< ParticleContainer > sweepStageMarkerEnum, ::swift2::kernels::UpdateParticleAssignedToVertexPredicate< PCParticle< ParticleContainer > > workOnParticle, int spacetreeId)
 
template<typename ParticleContainer >
static void checkParticlesAssignedToVertexInTouchLastTimeAlgorithmStep (Invariant policy, const ParticleContainer &assignedParticles, PCAlgorithmStepEnum< ParticleContainer > algorithmStepMarkerEnum, int spacetreeId)
 Dependency Check: At the final stage of a sweep, i.e.
 
template<typename ParticleContainer >
static void checkInitStep (Invariant policy, const ParticleContainer &localParticles, const peano4::datamanagement::VertexMarker &marker, PCInitStepEnum< ParticleContainer > initStepMarkerEnum, PCSweepStageEnum< ParticleContainer > sweepStageMarkerEnum, ::swift2::kernels::UpdateParticleAssignedToVertexPredicate< PCParticle< ParticleContainer > > workOnParticle, int spacetreeId)
 Dependency Check: Verify that particles have completed all the algorithm steps and stages of the initialisation algorithm steps before the current one.
 
template<typename ParticleContainer >
static void checkInitStep (Invariant policy, const ParticleContainer &localParticles, const ParticleContainer &activeParticles, const peano4::datamanagement::CellMarker &marker, PCInitStepEnum< ParticleContainer > initStepMarkerEnum, PCSweepStageEnum< ParticleContainer > sweepStageMarkerEnum, ::swift2::kernels::UpdateParticlePairWithinCellPredicate< PCParticle< ParticleContainer > > workOnParticle, int spacetreeId)
 
template<typename ParticleContainer >
static void checkParticlesAssignedToVertexInTouchLastTimeInitStep (Invariant policy, const ParticleContainer &activeParticles, PCInitStepEnum< ParticleContainer > initStepMarkerEnum, int spacetreeId)
 Dependency Check: At the final stage of a sweep (TouchVertexLastTime), check that all ActiveParticles have completed all their dependencies, i.e.
 
template<typename ParticleContainer >
static void clearDependencyChecksAlgorithmStep (const ParticleContainer &localParticles)
 Clear the dependency check counters of the main algorithm step dependency checks.
 
template<typename ParticleContainer >
static void clearDependencyChecksInitStep (const ParticleContainer &localParticles)
 Clear the dependency check counters of the initialisation step dependency checks.
 

Typedef Documentation

◆ PAlgorithmStepEnum

template<typename Particle >
using swift2::dependencychecks::PAlgorithmStepEnum
Initial value:
typename std::remove_pointer<
Particle>::type::DependencyChecksAlgorithmStepLastUpdated

Definition at line 64 of file DependencyChecks.h.

◆ PCAlgorithmStepEnum

template<typename ParticleContainer >
using swift2::dependencychecks::PCAlgorithmStepEnum
Initial value:
ParticleContainer>::DependencyChecksAlgorithmStepLastUpdated
typename std::remove_pointer< typename ParticleContainer::value_type >::type PCParticle

Definition at line 52 of file DependencyChecks.h.

◆ PCInitStepEnum

template<typename ParticleContainer >
using swift2::dependencychecks::PCInitStepEnum
Initial value:
ParticleContainer>::DependencyChecksInitStepLastUpdated

Definition at line 56 of file DependencyChecks.h.

◆ PCParticle

template<typename ParticleContainer >
using swift2::dependencychecks::PCParticle
Initial value:
typename std::remove_pointer<
typename ParticleContainer::value_type>::type

Definition at line 48 of file DependencyChecks.h.

◆ PCSweepStageEnum

template<typename ParticleContainer >
using swift2::dependencychecks::PCSweepStageEnum
Initial value:
ParticleContainer>::DependencyChecksPeanoEventUsedBySwift

Definition at line 60 of file DependencyChecks.h.

◆ PInitStepEnum

template<typename Particle >
using swift2::dependencychecks::PInitStepEnum
Initial value:
typename std::remove_pointer<
Particle>::type::DependencyChecksInitStepLastUpdated

Definition at line 68 of file DependencyChecks.h.

◆ PSweepStageEnum

template<typename Particle >
using swift2::dependencychecks::PSweepStageEnum
Initial value:
typename std::remove_pointer<
Particle>::type::DependencyChecksPeanoEventUsedBySwift

Definition at line 72 of file DependencyChecks.h.

Enumeration Type Documentation

◆ Invariant

Different invariants that have to hold for the code.

They are checked by isValid() which is called by the mark... routines and checkPastStages.

Enumerator
TouchFirstUsage_MaskOutAfterwards_AllPreviousStepsUpdateAtLeastOnce 
TouchFirstUsage_MaskOutAfterwards_AllPreviousStepsUpdateAtLeastOnce_SweepMayRerun 
TouchAtMostOnce_MaskOutOtherwise_AllPreviousStepsUpdateAtLeastOnce 
TouchAtMostOnce_MaskOutOtherwise_AllPreviousStepsUpdateAtLeastOnce_SweepMayRerun 
TouchAtLeastOnce_AllPreviousStepsUpdateAtLeastOnce 
TouchAtLeastOnce_AllPreviousStepsUpdateAtLeastOnce_FutureStagesMayUpdate 
TouchAtLeastOnce_AllPreviousStepsUpdateAtLeastOnce_MayOverwritePreviousCellUpdatesFromSameSweep 
TouchAtLeastOnce_AllPreviousStepsUpdateAtLeastOnce_MayOverwritePreviousCellUpdatesFromSameSweep_FutureStagesMayUpdate 

Definition at line 33 of file DependencyChecks.h.

Function Documentation

◆ checkAlgorithmStep() [1/2]

template<typename ParticleContainer >
static void swift2::dependencychecks::checkAlgorithmStep ( Invariant policy,
const ParticleContainer & localParticles,
const ParticleContainer & activeParticles,
const peano4::datamanagement::CellMarker & marker,
PCAlgorithmStepEnum< ParticleContainer > algorithmStepMarkerEnum,
PCSweepStageEnum< ParticleContainer > sweepStageMarkerEnum,
::swift2::kernels::UpdateParticlePairWithinCellPredicate< PCParticle< ParticleContainer > > workOnParticle,
int spacetreeId )
static

Dependency Check: Verify that particles have completed all the algorithm steps and stages of the main algorithm steps before the current one.

Also ensure none of the steps nor stages after the current one have been performed yet. If an error is found, debug information is printed to stdout and the program is aborted.

This routine is typically inserted after each sweep stage (touchVertexFirstTime, CellKernel, touchVertesLastTime) of any AlgorithmStep. It ensures that all data piped into an algorithm step are valid and consistent.

Parameters
localParticlesset of local Particles to perform checks on
markera peano4::datamanagement::VertexMarker or peano4::datamanagement::CellMarker
algorithmStepMarkerEnumEnum representing current main algorithm step
sweepStageMarkerEnumEnum representing traversal sweep stage particle is currently in
workOnParticleA function used to determine whether the particle is being worked on in the specific sweep stage of the algorithm step. As arguments, it takes the particle itself and the marker. This should be the same function used in the actual stage of the algorithm step as your code, and should be one of the functions defined in src/swift2/kernels/ParticleState.h

◆ checkAlgorithmStep() [2/2]

template<typename ParticleContainer >
static void swift2::dependencychecks::checkAlgorithmStep ( Invariant policy,
const ParticleContainer & localParticles,
const peano4::datamanagement::VertexMarker & marker,
PCAlgorithmStepEnum< ParticleContainer > algorithmStepMarkerEnum,
PCSweepStageEnum< ParticleContainer > sweepStageMarkerEnum,
::swift2::kernels::UpdateParticleAssignedToVertexPredicate< PCParticle< ParticleContainer > > workOnParticle,
int spacetreeId )
static

◆ checkInitStep() [1/2]

template<typename ParticleContainer >
static void swift2::dependencychecks::checkInitStep ( Invariant policy,
const ParticleContainer & localParticles,
const ParticleContainer & activeParticles,
const peano4::datamanagement::CellMarker & marker,
PCInitStepEnum< ParticleContainer > initStepMarkerEnum,
PCSweepStageEnum< ParticleContainer > sweepStageMarkerEnum,
::swift2::kernels::UpdateParticlePairWithinCellPredicate< PCParticle< ParticleContainer > > workOnParticle,
int spacetreeId )
static

◆ checkInitStep() [2/2]

template<typename ParticleContainer >
static void swift2::dependencychecks::checkInitStep ( Invariant policy,
const ParticleContainer & localParticles,
const peano4::datamanagement::VertexMarker & marker,
PCInitStepEnum< ParticleContainer > initStepMarkerEnum,
PCSweepStageEnum< ParticleContainer > sweepStageMarkerEnum,
::swift2::kernels::UpdateParticleAssignedToVertexPredicate< PCParticle< ParticleContainer > > workOnParticle,
int spacetreeId )
static

Dependency Check: Verify that particles have completed all the algorithm steps and stages of the initialisation algorithm steps before the current one.

Also ensure none of the steps nor stages after the current one have been performed yet. If an error is found, debug information is printed to stdout and the program is aborted.

This routine is typically inserted after each sweep stage (touchVertexFirstTime, CellKernel, touchVertesLastTime) of any AlgorithmStep during the initialisation. It ensures that all data piped into an algorithm step are valid and consistent.

Parameters
localParticlesset of local Particles to perform checks on
markera peano4::datamanagement::VertexMarker or peano4::datamanagement::CellMarker
initStepMarkerEnumEnum representing current initialisation algorithm step
sweepStageMarkerEnumEnum representing traversal sweep stage particle is currently in
workOnParticleA function used to determine whether the particle is being worked on in the specific sweep stage of the algorithm step. As arguments, it takes the particle itself and the marker. This should be the same function used in the actual stage of the algorithm step as your code, and should be one of the functions defined in src/swift2/kernels/ParticleState.h

◆ checkParticlesAssignedToVertexInTouchLastTimeAlgorithmStep()

template<typename ParticleContainer >
static void swift2::dependencychecks::checkParticlesAssignedToVertexInTouchLastTimeAlgorithmStep ( Invariant policy,
const ParticleContainer & assignedParticles,
PCAlgorithmStepEnum< ParticleContainer > algorithmStepMarkerEnum,
int spacetreeId )
static

Dependency Check: At the final stage of a sweep, i.e.

touchVertexLastTime(), check that all particles hosted by this vertex have completed all their dependencies, i.e. have been localParticles at least once.

Within the vertex events touchVertexFirstTime() and touchVertexLastTime(), we have no active and local particles anymore. There are solely the ones around the vertex on this mesh level. They are called assignedParticles.

Throughout the traversal, there are no global active and local particles: Both sets are views onto the global particle set and they adopt per cell. These views are not even exclusive, i.e. local particles are always a subset of active ones. We know that cells update only local particles. Within a subsequent touchVertexLastTime(), every particles has have to be updated, i.e. every particle has been local at least once. Therefore, we write that all particles have to have been local at least once.

Parameters
assignedParticlesset of particles hosted by a vertex to perform checks on
algorithmStepMarkerEnumEnum representing current main algorithm step

◆ checkParticlesAssignedToVertexInTouchLastTimeInitStep()

template<typename ParticleContainer >
static void swift2::dependencychecks::checkParticlesAssignedToVertexInTouchLastTimeInitStep ( Invariant policy,
const ParticleContainer & activeParticles,
PCInitStepEnum< ParticleContainer > initStepMarkerEnum,
int spacetreeId )
static

Dependency Check: At the final stage of a sweep (TouchVertexLastTime), check that all ActiveParticles have completed all their dependencies, i.e.

have been localParticles at least once. This

Parameters
activeParticlesset of active Particles to perform checks on
initStepMarkerEnumEnum representing current initialisation algorithm step

◆ clearDependencyChecksAlgorithmStep()

template<typename ParticleContainer >
static void swift2::dependencychecks::clearDependencyChecksAlgorithmStep ( const ParticleContainer & localParticles)
static

Clear the dependency check counters of the main algorithm step dependency checks.

Intended to be called first thing every new simulation step.

Parameters
localParticlesSet of particles to work on.

◆ clearDependencyChecksInitStep()

template<typename ParticleContainer >
static void swift2::dependencychecks::clearDependencyChecksInitStep ( const ParticleContainer & localParticles)
static

Clear the dependency check counters of the initialisation step dependency checks.

Intended to be called first thing during initialisation.

Parameters
localParticlesSet of particles to work on.

◆ markAlgorithmStep() [1/2]

template<typename ParticleContainer >
static void swift2::dependencychecks::markAlgorithmStep ( const ParticleContainer & localParticles,
const ParticleContainer & activeParticles,
const peano4::datamanagement::CellMarker & marker,
PCAlgorithmStepEnum< ParticleContainer > algorithmStepMarkerEnum,
PCSweepStageEnum< ParticleContainer > sweepStageMarkerEnum,
Invariant policy,
::swift2::kernels::UpdateParticlePairWithinCellPredicate< typename std::remove_pointer< typename ParticleContainer::value_type >::type > workOnParticle,
int spacetreeId )
static

A particle is marked if there is at least one active interaction in this cell.

◆ markAlgorithmStep() [2/2]

template<typename ParticleContainer >
static void swift2::dependencychecks::markAlgorithmStep ( const ParticleContainer & particles,
const peano4::datamanagement::VertexMarker & marker,
PCAlgorithmStepEnum< ParticleContainer > algorithmStepMarkerEnum,
PCSweepStageEnum< ParticleContainer > sweepStageMarkerEnum,
Invariant policy,
::swift2::kernels::UpdateParticleAssignedToVertexPredicate< PCParticle< ParticleContainer > > workOnParticle,
int spacetreeId )
static

Mark a localParticle having entered a sweep stage in a main algorithm step.

This routine is used both by touchVertexFirstTime and touchVertexLastTime to keep track of state transitions. We run over the particles and check for each one if the routine would update it. If so, they increment the counter getAlgorithmStepSweepStateProgression(). Any positive value here counts how often particles are updated. If a particle is not to be updated, we decrement the counter. Obviously, a particle should either be ignored all the time, or it should be updated. There's one exception to this rule: If a routine updates a particle's position, we might update the particle at one point, alter its position, then re-assign it to a new particle and there mask it out.

Parameters
assignedParticlesthe particles around a vertex that will be subject to the validation
markera peano4::datamanagement::VertexMarker or peano4::datamanagement::CellMarker
algorithmStepMarkerEnumEnum representing algorithm step particle is currently in
sweepStageMarkerEnumEnum representing traversal sweep stage particle is currently in
stepMovedParticlewhether the particle has been moved in this (or in the previous) algorithm step. This may corrupt the set of localParticles. See @page_toolbox_particles_mesh_traversal.
workOnParticleA function used to determine whether the particle is being worked on in the specific sweep stage of the algorithm step. As arguments, it takes the particle itself and the marker. This should be the same function used in the actual stage of the algorithm step as your code, and should be one of the functions defined in src/swift2/kernels/ParticleState.h

◆ markInitStep() [1/2]

template<typename ParticleContainer >
static void swift2::dependencychecks::markInitStep ( const ParticleContainer & localParticles,
const ParticleContainer & activeParticles,
const peano4::datamanagement::CellMarker & marker,
PCInitStepEnum< ParticleContainer > initStepMarkerEnum,
PCSweepStageEnum< ParticleContainer > sweepStageMarkerEnum,
Invariant policy,
::swift2::kernels::UpdateParticlePairWithinCellPredicate< PCParticle< ParticleContainer > > workOnParticle,
int spacetreeId )
static

A particle is marked if there is at least one active interaction in this cell.

◆ markInitStep() [2/2]

template<typename ParticleContainer >
static void swift2::dependencychecks::markInitStep ( const ParticleContainer & localParticles,
const peano4::datamanagement::VertexMarker & marker,
PCInitStepEnum< ParticleContainer > initStepMarkerEnum,
PCSweepStageEnum< ParticleContainer > sweepStageMarkerEnum,
Invariant policy,
::swift2::kernels::UpdateParticleAssignedToVertexPredicate< PCParticle< ParticleContainer > > workOnParticle,
int spacetreeId )
static

Mark a localParticle having entered a sweep stage in a initialisation algorithm step.

Parameters
localParticlethe problematic particle
markera peano4::datamanagement::VertexMarker or peano4::datamanagement::CellMarker
algorithmStepMarkerEnumEnum representing algorithm step particle is currently in
sweepStageMarkerEnumEnum representing traversal sweep stage particle is currently in
stepMovedParticlewhether the particle has been moved in this (or in the previous) algorithm step. This may corrupt the set of localParticles. See @page_toolbox_particles_mesh_traversal.
workOnParticleA function used to determine whether the particle is being worked on in the specific sweep stage of the algorithm step. As arguments, it takes the particle itself and the marker. This should be the same function used in the actual stage of the algorithm step as your code, and should be one of the functions defined in src/swift2/kernels/ParticleState.h

◆ toString()

std::string swift2::dependencychecks::toString ( Invariant policy)