SPH
Public Member Functions | List of all members
IGravity Class Referenceabstract

Interface for computing gravitational interactions of particles. More...

#include <IGravity.h>

Inheritance diagram for IGravity:
Polymorphic BarnesHut BruteForceGravity CachedGravity SphericalGravity SymmetricGravity

Public Member Functions

virtual void build (IScheduler &scheduler, const Storage &storage)=0
 Builds the accelerating structure. More...
 
virtual void evalAll (IScheduler &scheduler, ArrayView< Vector > dv, Statistics &stats) const =0
 Evaluates the gravitational acceleration concurrently. More...
 
virtual Vector eval (const Vector &r0) const =0
 Evaluates the gravitational acceleration at given point. More...
 
virtual Float evalEnergy (IScheduler &scheduler, Statistics &stats) const =0
 Computes the total potential energy of the particles. More...
 
virtual RawPtr< const IBasicFindergetFinder () const =0
 Optionally returns a finder used by the gravity implementation. More...
 
- Public Member Functions inherited from Polymorphic
virtual ~Polymorphic ()
 

Detailed Description

Interface for computing gravitational interactions of particles.

Definition at line 14 of file IGravity.h.

Member Function Documentation

◆ build()

virtual void IGravity::build ( IScheduler scheduler,
const Storage storage 
)
pure virtual

Builds the accelerating structure.

Needs to be called every time step.

Parameters
schedulerScheduler used for parallelization of the build. Use SEQUENTAIL for sequential (single-threaded) execution.

Implemented in SymmetricGravity, CachedGravity, and BarnesHut.

◆ eval()

virtual Vector IGravity::eval ( const Vector r0) const
pure virtual

Evaluates the gravitational acceleration at given point.

The point must NOT correspond to any particle, as this case could formally lead to infinite acceleration if no smoothing kernel is used.

Parameters
r0Point where the gravity is evaluated.

Implemented in SymmetricGravity, SphericalGravity, CachedGravity, BruteForceGravity, and BarnesHut.

◆ evalAll()

virtual void IGravity::evalAll ( IScheduler scheduler,
ArrayView< Vector dv,
Statistics stats 
) const
pure virtual

Evaluates the gravitational acceleration concurrently.

The function is blocking, it must exit after the gravity is evaluated.

Parameters
schedulerScheduler used for parallelization.
dvAcceleration values; it may already contain some accelerations computed by other code components, gravity should add acceleration instead of replacing the current values.
statsOutput statistics of the gravitational solver.

Implemented in SymmetricGravity, CachedGravity, and BarnesHut.

◆ evalEnergy()

virtual Float IGravity::evalEnergy ( IScheduler scheduler,
Statistics stats 
) const
pure virtual

Computes the total potential energy of the particles.

The zero point is implementation-specific; it is not required that the energy is strictly negative.

Parameters
schedulerScheduler used for parallelization.
statsOutput statistics of the gravitational solver.

Implemented in SymmetricGravity, CachedGravity, and BarnesHut.

◆ getFinder()

virtual RawPtr<const IBasicFinder> IGravity::getFinder ( ) const
pure virtual

Optionally returns a finder used by the gravity implementation.

If the gravity uses an acceleration structure that implements the IBasicFinder interface, this function allows the user to obtain the object and re-use in other parts of the code. Finder is assumed to be initialized after build is called.

If the gravity does not use any such structure or it simply does not implement the IBasicFinder interface, the function returns nullptr.

Implemented in SymmetricGravity, SphericalGravity, CachedGravity, BruteForceGravity, and BarnesHut.


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