317 virtual void DeriveDT(Double_t dt = 1);
322 void DeriveDTN(Int_t n = 1, Double_t dt = 1);
377 Long_t
GetDeriveN(
const Bool_t minima=kFALSE);
389 Double_t
GetPE(Int_t index, Bool_t OnlyInvincibles=kFALSE);
401 Double_t
GetNetKE(
const Bool_t SR=kFALSE);
487 TString
Print(Bool_t onlymechanic=kFALSE, Bool_t mute=kFALSE, Bool_t pprint=kFALSE);
566 void GetState(std::vector<TVector3> & x, std::vector<TVector3> & u);
569 void SetState(
const std::vector<TVector3> & x,
const std::vector<TVector3> & u);
Compile-time limits and default tolerances (macros).
Base class of event volumes: the region in which an event is "alive".
One simulated system: particles, pairwise forces, inspectors and the time integration.
void ComputeForce(std::vector< TVector3 > &frc)
Net force on every particle at the present state, in amu c^2/fm (zero for invincibles).
Double_t GetMaxAcceleration()
The largest acceleration (force / rest mass) of the non-invincible particles (amu c^2/fm/amu = c^2/fm...
Double_t rk45Abs
absolute tolerance
TVector3 GetNetAngularMomentum(TVector3 origin=TVector3())
Total angular momentum of the non-invincible particles (amu c fm).
void CalibrateVelocity()
Correct the speed of every non-invincible particle so that the given velocity is the velocity far fro...
Bool_t integFailed
the integrator gave up (see HasIntegratorFailed())
eventVolume * volume
not owned
std::vector< TVector3 > accCacheX
positions for which accCache is valid
Bool_t rk45Warned
the minimum-substep warning was printed
inspectMode GetInspectMode()
The way the non-abort inspectors are combined.
void AddForce(force *force_)
Add a force that acts on every pair of particles of the event.
Bool_t preDerived
whether pEvent is valid
Bool_t IsInsideVolume(Bool_t all=kTRUE)
Whether the non-invincible particles are inside the volume (SetVolume()).
void SetTolerance(Double_t rel, Double_t abs)
Set the tolerances of kRK45.
Bool_t pairSymmetric
Newton's third law in use.
void SetInspectMode(inspectMode mode_)
Set how the non-abort inspectors are combined in Inspect() (default kInspectAND).
Double_t GetNetKERel()
Relativistic kinetic energy, the sum of over the non-invincible particles (amu c^2).
inspector * getInspector(Int_t index)
Get an inspector by the order of addition (index as in getParticle(); owned by the event).
void SetRelativistic(Bool_t rel_=kTRUE)
Switch the dynamics to special relativity (default off).
Double_t GetRelTolerance()
Relative tolerance of kRK45.
Double_t GetNetPE()
Potential energy of the whole event (amu c^2).
TString GetStopReasonName()
Name of the last stop reason: "NONE", "INSPECTOR", "ABORT", "MAXSTEPS", "INVALID" or "FAILED".
void DeriveVelocityVerlet(Double_t dt)
Velocity-Verlet step (kick-drift-kick on the momentum in the relativistic mode).
Double_t rk45Rel
relative tolerance
std::vector< inspector * > inspectors
owned
Int_t getNParticle()
Number of particles.
Double_t rk45H
substep suggested for the next call
void SetVolume(eventVolume *volume_)
Set the volume used by IsInsideVolume() and the "VOUT"/"VOUTA" inspectors.
void preDeriveSetup()
Placeholder for the set-up after preDerive().
Bool_t HasIntegratorFailed()
True once the integrator has given up.
force * getForce(Int_t index)
Get a force by the order of addition (index as in getParticle(); the force is not owned).
integrator integ
selected integrator
void AddInspector(inspector *inspector_)
Add an inspector (a terminating condition for DeriveInspect()).
Double_t GetPE(Int_t index, Bool_t OnlyInvincibles=kFALSE)
Potential energy of one particle with the other particles (amu c^2).
inspectMode imode
how the inspectors are combined
TVector3 GetNetMomentum()
Total momentum of the non-invincible particles (amu c).
event * pEvent
pre-derived copy (owned)
void SetPairSymmetric(Bool_t sym_=kTRUE)
Use Newton's third law to evaluate each pair once (default on).
void DeriveMAX(Double_t dt=1)
Call DeriveDT() MAXSTEPS times (100,000, RPConfig.hpp), ignoring the inspectors.
void SetMaxInspectSteps(Long_t n)
Set the safety cap of DeriveInspect().
Long_t GetRK45NSubsteps()
Number of accepted kRK45 substeps so far.
Long_t GetDeriveN(const Bool_t minima=kFALSE)
Number of derived steps (particle::GetECNT()) over all particles, invincible ones included.
stopReason
Why the last DeriveInspect() returned.
@ kStopFailed
the integrator gave up (kRK45 on a singular force, see HasIntegratorFailed())
@ kStopInspector
the inspectors were satisfied (normal end)
@ kStopAbort
an abort inspector fired
@ kStopNone
DeriveInspect() was not called yet (or is running)
@ kStopInvalid
an inspector has an undefined method; nothing was derived
@ kStopMaxSteps
the safety cap of steps (SetMaxInspectSteps()) was reached
TString GetIntegratorName()
Name of the integrator in use, as accepted by SetIntegrator(TString).
particle * AddParticle(particle *particle_)
Add a particle to the event.
Long_t GetRK45NRejected()
Number of rejected kRK45 substeps so far.
Bool_t resetPreDerive()
Delete the pre-derived copy.
Double_t GetMinDistance()
The smallest distance between two particles, invincible ones included (fm). The largest double for fe...
virtual Bool_t UseRelativistic()
Whether the relativistic option is really in effect: set, and not kTaylor.
event()
Make an empty event: no particles, forces, inspectors nor volume.
void FinishStep(Double_t dt)
Close one step: every particle counts the step, the moving ones advance their time,...
stopReason lastStop
reason of the last DeriveInspect()
integrator
Integration scheme used by DeriveDT().
@ kRK45
"RK45", adaptive Dormand-Prince
@ kVelocityVerlet
"VERLET", velocity Verlet
@ kRK4
"RK4", classical Runge-Kutta
@ kSymplecticEuler
"SEULER", symplectic Euler
@ kTaylor
"TAYLOR", original scheme (default)
void GetState(std::vector< TVector3 > &x, std::vector< TVector3 > &u)
Read the positions x and state variables u of all particles.
particle * getParticle(Int_t index)
Get a particle by the order of addition.
void ComputeDerivative(std::vector< TVector3 > &dx, std::vector< TVector3 > &du)
Time derivatives dx/dt = v and du/dt (F/m0, or F when relativistic) at the present state.
stopReason GetStopReason()
Why the last DeriveInspect() ended (kStopNone before the first call).
virtual ~event()
Delete the particles, the inspectors and the pre-derived copy (not the forces nor the volume).
Int_t nforce
number of forces
integrator GetIntegrator()
The integrator in use (default kTaylor).
std::vector< particle * > particles
the particles, in the order of addition (owned)
Int_t getNForce()
Number of forces.
Double_t GetNetE(const Bool_t SR=kFALSE)
GetNetKE(SR) + GetNetPE(); conserved in the non-relativistic mode only (see GetNetERel()).
virtual void DeriveDT(Double_t dt=1)
Advance the event by one time step with the selected integrator.
void SetIntegrator(integrator integ_)
Select the integrator by enumerator (see integrator).
Bool_t IsPairSymmetric()
Whether the pair symmetry is in use (default kTRUE).
Bool_t Inspect()
Evaluate the terminating condition once, without deriving.
Long_t rk45NReject
rejected substeps
void ComputeAcceleration(std::vector< TVector3 > &acc)
Acceleration F/m0 of every particle at the present state, in c^2/fm (zero for invincibles).
Double_t GetNetKE(const Bool_t SR=kFALSE)
Kinetic energy of the non-invincible particles (amu c^2).
TString Print(Bool_t onlymechanic=kFALSE, Bool_t mute=kFALSE, Bool_t pprint=kFALSE)
Describe the event (particles and inspectors) as text.
Bool_t relativistic
relativistic flag
Long_t rk45NAccept
accepted substeps
event & operator=(const event &)=delete
Deleted: the default assignment would copy the pointers and delete them twice.
Double_t GetRK45Substep()
Substep suggested for the next kRK45 DeriveDT, in fm/c (0 : none yet).
void SetState(const std::vector< TVector3 > &x, const std::vector< TVector3 > &u)
Write positions and state variables back to the non-invincible particles.
void DeriveSymplecticEuler(Double_t dt)
Symplectic Euler step, v += a dt then x += v dt (momentum in the relativistic mode).
void DeriveTaylor(Double_t dt)
The original scheme: all forces are evaluated for the present state of every moving particle (every o...
void DeriveRK4(Double_t dt)
Classical 4th order Runge-Kutta step.
TVector3 MomentumOf(particle *p, const TVector3 &v)
The state variable u of the velocity v: v itself, or when relativistic.
std::vector< force * > forces
the forces (not owned)
Long_t GetMaxInspectSteps()
The safety cap of steps of DeriveInspect() (0 : unlimited).
TVector3 VelocityOf(particle *p, const TVector3 &u)
The velocity v of the state variable u (inverse of MomentumOf()).
void preDerive()
Make a copy of the event and derive it until its inspectors are satisfied (pre-derivation).
Long_t maxInspectSteps
safety cap of DeriveInspect()
Double_t GetTime()
The largest evolved time among the particles (fm/c). Invincible particles do not advance their time,...
void DeriveRK45(Double_t dt)
Dormand-Prince 5(4) with adaptive substeps, advancing exactly dt (see integrator).
Bool_t IsRelativistic()
Whether the relativistic flag is set (the flag only; kTaylor ignores it).
Double_t GetAbsTolerance()
Absolute tolerance of kRK45 (fm for positions, c for velocities).
Double_t GetNetERel()
GetNetKERel() + GetNetPE(); the conserved energy of the relativistic mode.
Bool_t DeriveInspect(Int_t iperiod=1, Double_t dt=1)
Derive until Inspect() is satisfied.
Int_t getNInspector()
Number of inspectors.
std::vector< TVector3 > accCache
acceleration (or force) at the end of the last step
Int_t nparticle
number of particles
void DeriveDTN(Int_t n=1, Double_t dt=1)
Call DeriveDT() n times.
Bool_t SetInitial()
Set the initial condition from the present one.
inspectMode
How the non-abort inspectors are combined in Inspect().
@ kInspectAND
stop when all of them are satisfied (default)
@ kInspectOR
stop when any of them is satisfied
Base class of the pairwise forces.
Inspector : one terminating condition of event::DeriveInspect().
A point body with mass, position, velocity, step count, time and an optional recorded path.
Spatial region attached to an event (eventVolume, eventVGeneral).
Small value holder that remembers one number, optionally read from a variable (recorder).