Orrery
A GPU-accelerated N-body gravitational simulator
Loading...
Searching...
No Matches
orrery::solvers::ForceSolver Class Referenceabstract

A method for computing the gravitational acceleration of a set of particles. More...

#include <orrery/solvers/force_solver.hpp>

Inheritance diagram for orrery::solvers::ForceSolver:
orrery::integrators::AccelerationField orrery::solvers::BarnesHutSolver orrery::solvers::DirectSolver orrery::solvers::SyclDirectSolver orrery::solvers::SyclTreeSolver

Public Member Functions

 ~ForceSolver () override=default
 Public and virtual, the second by inheritance from AccelerationField.
virtual std::string_view name () const noexcept=0
 The solver's name, for benchmark tables and test messages.
virtual core::Softening softening () const noexcept=0
 The softening this solver applies.
virtual InteractionCount interaction_count () const noexcept=0
 The work done since construction or since the last reset.
virtual void reset_interaction_count () noexcept=0
 Set every counter back to zero.
Public Member Functions inherited from orrery::integrators::AccelerationField
virtual void evaluate (core::Vec3Span< const core::Real > positions, std::span< const core::Real > masses, core::Vec3Span< core::Real > accelerations)=0
 Write the acceleration of each position into accelerations.

Protected Member Functions

 ForceSolver (const ForceSolver &)=default
 ForceSolver (ForceSolver &&)=default
ForceSolver & operator= (const ForceSolver &)=default
ForceSolver & operator= (ForceSolver &&)=default
Protected Member Functions inherited from orrery::integrators::AccelerationField
 AccelerationField (const AccelerationField &)=default
 AccelerationField (AccelerationField &&)=default
AccelerationField & operator= (const AccelerationField &)=default
AccelerationField & operator= (AccelerationField &&)=default

Detailed Description

A method for computing the gravitational acceleration of a set of particles.

Implementations differ in the algorithm, in the hardware they run on and in the accuracy they promise, and are selected at run time from a command-line flag. The virtual call is made once per force evaluation, ahead of at least N log N and usually N^2 interactions, which is the boundary section 3 of the implementation plan permits dispatch at.

Constructor & Destructor Documentation

◆ ~ForceSolver()

orrery::solvers::ForceSolver::~ForceSolver ( )
overridedefault

Public and virtual, the second by inheritance from AccelerationField.

Stated here rather than left implicit because the copy and move operations below are declared, and a class that declares some of the special members and not the rest is the shape that hides a mistake. Public rather than protected like the others: a caller holding a std::unique_ptr<ForceSolver> has to be able to destroy what it points at, and it is the derived destructor that runs.

Member Function Documentation

◆ name()

virtual std::string_view orrery::solvers::ForceSolver::name ( ) const
nodiscardpure virtualnoexcept

The solver's name, for benchmark tables and test messages.

Implemented in orrery::solvers::BarnesHutSolver, orrery::solvers::DirectSolver, orrery::solvers::SyclDirectSolver, and orrery::solvers::SyclTreeSolver.

◆ softening()

virtual core::Softening orrery::solvers::ForceSolver::softening ( ) const
nodiscardpure virtualnoexcept

The softening this solver applies.

Exposed so that a caller measuring energies asks the solver what it softened with rather than carrying a second copy of the value alongside it. Two copies of a number that must agree are how they come to disagree, and a potential energy computed with a different softening from the force kernel turns the project's headline conservation result into a measurement of the mismatch (ADR-0008).

Implemented in orrery::solvers::BarnesHutSolver, orrery::solvers::DirectSolver, orrery::solvers::SyclDirectSolver, and orrery::solvers::SyclTreeSolver.

◆ interaction_count()

virtual InteractionCount orrery::solvers::ForceSolver::interaction_count ( ) const
nodiscardpure virtualnoexcept

The work done since construction or since the last reset.

Cheap: solvers accumulate this as they go and this call only reads it.

Implemented in orrery::solvers::BarnesHutSolver, orrery::solvers::DirectSolver, orrery::solvers::SyclDirectSolver, and orrery::solvers::SyclTreeSolver.

◆ reset_interaction_count()

virtual void orrery::solvers::ForceSolver::reset_interaction_count ( )
pure virtualnoexcept

Set every counter back to zero.

A benchmark counts the work of the measured region rather than of the warm-up that preceded it, and the two are otherwise indistinguishable once they have been added together.

Implemented in orrery::solvers::BarnesHutSolver, orrery::solvers::DirectSolver, orrery::solvers::SyclDirectSolver, and orrery::solvers::SyclTreeSolver.


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