SPH
Classes | Public Member Functions | List of all members
HardSphereSolver Class Reference

Solver computing gravitational interactions of hard-sphere particles. More...

#include <NBodySolver.h>

Inheritance diagram for HardSphereSolver:
ISolver Polymorphic AggregateSolver

Public Member Functions

 HardSphereSolver (IScheduler &scheduler, const RunSettings &settings)
 Creates the solver, using the gravity implementation specified by settings. More...
 
 HardSphereSolver (IScheduler &scheduler, const RunSettings &settings, AutoPtr< IGravity > &&gravity)
 Creates the solver by passing the user-defined gravity implementation. More...
 
 HardSphereSolver (IScheduler &scheduler, const RunSettings &settings, AutoPtr< IGravity > &&gravity, AutoPtr< ICollisionHandler > &&collisionHandler, AutoPtr< IOverlapHandler > &&overlapHandler)
 Creates the solver by specifying gravity and handlers for collision and overlaps. More...
 
 ~HardSphereSolver () override
 
virtual void integrate (Storage &storage, Statistics &stats) override
 Computes derivatives of all time-dependent quantities. More...
 
virtual void collide (Storage &storage, Statistics &stats, const Float dt) override
 Checks and resolves particle collisions. More...
 
virtual void create (Storage &storage, IMaterial &material) const override
 Initializes all quantities needed by the solver in the storage. More...
 
- Public Member Functions inherited from ISolver
virtual void collide (Storage &UNUSED(storage), Statistics &UNUSED(stats), const Float UNUSED(dt))
 Detects the collisions and computes new positions of particles. More...
 
- Public Member Functions inherited from Polymorphic
virtual ~Polymorphic ()
 

Detailed Description

Solver computing gravitational interactions of hard-sphere particles.

Definition at line 24 of file NBodySolver.h.

Constructor & Destructor Documentation

◆ HardSphereSolver() [1/3]

NAMESPACE_SPH_BEGIN HardSphereSolver::HardSphereSolver ( IScheduler scheduler,
const RunSettings settings 
)

Creates the solver, using the gravity implementation specified by settings.

Definition at line 17 of file NBodySolver.cpp.

◆ HardSphereSolver() [2/3]

HardSphereSolver::HardSphereSolver ( IScheduler scheduler,
const RunSettings settings,
AutoPtr< IGravity > &&  gravity 
)

Creates the solver by passing the user-defined gravity implementation.

Definition at line 20 of file NBodySolver.cpp.

◆ HardSphereSolver() [3/3]

HardSphereSolver::HardSphereSolver ( IScheduler scheduler,
const RunSettings settings,
AutoPtr< IGravity > &&  gravity,
AutoPtr< ICollisionHandler > &&  collisionHandler,
AutoPtr< IOverlapHandler > &&  overlapHandler 
)

Creates the solver by specifying gravity and handlers for collision and overlaps.

Definition at line 29 of file NBodySolver.cpp.

◆ ~HardSphereSolver()

HardSphereSolver::~HardSphereSolver ( )
overridedefault

Member Function Documentation

◆ collide()

void HardSphereSolver::collide ( Storage storage,
Statistics stats,
const Float  dt 
)
overridevirtual

Checks and resolves particle collisions.

Todo:
We have to process the all collision in order, sorted according to collision time, but this is hardly parallelized. We can however process collisions concurrently, as long as the collided particles don't intersect the spheres with radius equal to the search radius. Note that this works as long as the search radius does not increase during collision handling.
Todo:

Reimplemented in AggregateSolver.

Definition at line 325 of file NBodySolver.cpp.

◆ create()

void HardSphereSolver::create ( Storage storage,
IMaterial material 
) const
overridevirtual

Initializes all quantities needed by the solver in the storage.

When called, storage already contains particle positions and their masses. All remaining quantities must be created by the solver. The function is called once for every body in the run. The given storage is guaranteed to be homogeneous; it contains only a single material.

Parameters
storageParticle storage that shall be modified as needed by the solver.
materialMaterial containing parameters of the body being created. The solver can also set up necessary timestepping parameters of the material (ranges and minimal values of quantities).

Implements ISolver.

Reimplemented in AggregateSolver.

Definition at line 475 of file NBodySolver.cpp.

◆ integrate()

void HardSphereSolver::integrate ( Storage storage,
Statistics stats 
)
overridevirtual

Computes derivatives of all time-dependent quantities.

The solver can also modify the quantities arbitrarily. It is however not recommended to perform the integration in the solver (using the time step stored in Statistics) as this is a job for timestepping. The solver can modify quantities using boundary conditions, inter-quantity relationships (such as the summation equation for density in SPH), clamping of values etc. It is also possible to add or remove particles in the storage and modify materials. Threads running concurrently with the solver must assume the solver can modify the storage at any time, so accessing the storage from different threads is only allowed before or after integrate; the is no locking for performance reasons.

All highest order derivatives are guaranteed to be set to zero when integrate is called (this is a responsibility of ITimeStepping implementation).

Parameters
storageStorage containing all quantities.
statsObject where the solver saves all computed statistics of the run.

Implements ISolver.

Reimplemented in AggregateSolver.

Definition at line 96 of file NBodySolver.cpp.

Member Data Documentation

◆ allowedRatio

Float HardSphereSolver::allowedRatio

Limit ovelap of particle to be classified as "overlap" rather than "collision".

Definition at line 68 of file NBodySolver.h.

◆ finder

AutoPtr<ISymmetricFinder> HardSphereSolver::finder

Finder for searching the neighbours.

Definition at line 58 of file NBodySolver.h.

◆ handler [1/2]

AutoPtr<ICollisionHandler> HardSphereSolver::handler

Handler used to resolve particle collisions.

Definition at line 55 of file NBodySolver.h.

◆ handler [2/2]

AutoPtr<IOverlapHandler> HardSphereSolver::handler

Handler used to resolve particle overlaps.

Definition at line 65 of file NBodySolver.h.

◆ maxAngle

Float HardSphereSolver::maxAngle

Maximum rotation of a particle in a single (sub)step.

Definition at line 77 of file NBodySolver.h.

◆ use

bool HardSphereSolver::use

Use moment of inertia of individual particles.

Definition at line 74 of file NBodySolver.h.


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