SPH
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
IRun Class Referenceabstract

Defines the interface for a run. More...

#include <IRun.h>

Inheritance diagram for IRun:
Polymorphic BoundaryRun CliffCollapse Collision Collision DeathStar ElasticBands Fragmentation GalaxyRun Hde HelloAsteroid KelvinHelmholtz NBodyRun Reaccumulation RotatingRod Sedov SimpleRun Sod SphRun VanDerWallsSimulation

Public Member Functions

 IRun ()
 
 ~IRun ()
 
Statistics run (Storage &storage)
 Runs the simulation. More...
 
Statistics run (Storage &storage, IRunCallbacks &callbacks)
 Runs the simulation. More...
 
- Public Member Functions inherited from Polymorphic
virtual ~Polymorphic ()
 

Protected Member Functions

virtual void setUp (SharedPtr< Storage > storage)=0
 Prepares the run, creates logger, output, ... More...
 
virtual void tearDown (const Storage &storage, const Statistics &stats)=0
 Called after the run. More...
 
void setNullToDefaults (SharedPtr< Storage > storage)
 
void tearDownInternal (const Storage &storage, const Statistics &stats)
 

Protected Attributes

RunSettings settings
 
AutoPtr< IOutputoutput
 Data output. More...
 
SharedPtr< ILoggerlogger
 Logging. More...
 
AutoPtr< ILogWriterlogWriter
 Writes statistics into logger every timestep. More...
 
SharedPtr< ISchedulerscheduler
 Scheduler used for parallelization. More...
 
AutoPtr< ITimeSteppingtimeStepping
 Timestepping. More...
 
AutoPtr< ISolversolver
 Solver. More...
 
List< AutoPtr< ITrigger > > triggers
 Triggers. More...
 
Array< AutoPtr< IDiagnostic > > diagnostics
 Diagnostics. More...
 

Detailed Description

Defines the interface for a run.

Each run must implement methods setUp and tearDown, settings up initial conditions for the run and closing down the run, respectively.

Implementation can set up all member variables to any given value. If any variable is left uninitialized, it will be initialized to a default value as specified by run settings. Only particle storage MUST be initialized by the setUp function. User must call setUp before calling run. After run ends, function setUp must be called again before another run can be started.

Attention
Implementation of setUp function must either create a new storage or clear any previous quantities stored in it. Other member variables do not have to be initialized nor cleared.

Run is started up using run member function. The function is blocking and ends when run is finished. The function can be called from any thread, but cannot be executed from multiple threads simultaneously. The flow of the run can be controlled from different thread using provided implementation of Callbacks.

Definition at line 61 of file IRun.h.

Constructor & Destructor Documentation

◆ IRun()

IRun::IRun ( )

Definition at line 40 of file IRun.cpp.

◆ ~IRun()

IRun::~IRun ( )
default

Member Function Documentation

◆ run() [1/2]

Statistics IRun::run ( Storage storage)

Runs the simulation.

The provided storage can either be filled with initial conditions specified by the IRun implementation, or it can use particles already stored in the storage. The function is blocking and returns after the simulation ends. The storage then contains the particle state at the end of the simulation.

Definition at line 187 of file IRun.cpp.

◆ run() [2/2]

Statistics IRun::run ( Storage storage,
IRunCallbacks callbacks 
)

Runs the simulation.

The provided storage can either be filled with initial conditions specified by the IRun implementation, or it can use particles already stored in the storage. The function is blocking and returns after the simulation ends. The storage then contains the particle state at the end of the simulation.

Parameters
callbacksInterface used to obtain particle data during the simulation, etc.

Definition at line 192 of file IRun.cpp.

◆ setNullToDefaults()

void IRun::setNullToDefaults ( SharedPtr< Storage storage)
protected

Definition at line 297 of file IRun.cpp.

◆ setUp()

virtual void IRun::setUp ( SharedPtr< Storage storage)
protectedpure virtual

◆ tearDown()

virtual void IRun::tearDown ( const Storage storage,
const Statistics stats 
)
protectedpure virtual

Called after the run.

Used to save the necessary data, log run statistics, etc. Is called at the end of run function.

Parameters
statsRun statistics at the end of the run.

Implemented in Reaccumulation, Fragmentation, Collision, DeathStar, HelloAsteroid, NBodyRun, SphRun, RotatingRod, GalaxyRun, ElasticBands, Collision, and CliffCollapse.

◆ tearDownInternal()

void IRun::tearDownInternal ( const Storage storage,
const Statistics stats 
)
protected

Definition at line 324 of file IRun.cpp.

Member Data Documentation

◆ diagnostics

Array<AutoPtr<IDiagnostic> > IRun::diagnostics
protected

Diagnostics.

Definition at line 87 of file IRun.h.

◆ logger

SharedPtr<ILogger> IRun::logger
protected

Logging.

Definition at line 69 of file IRun.h.

◆ logWriter

AutoPtr<ILogWriter> IRun::logWriter
protected

Writes statistics into logger every timestep.

Definition at line 72 of file IRun.h.

◆ output

AutoPtr<IOutput> IRun::output
protected

Data output.

Definition at line 66 of file IRun.h.

◆ scheduler

SharedPtr<IScheduler> IRun::scheduler
protected

Scheduler used for parallelization.

Definition at line 75 of file IRun.h.

◆ settings

RunSettings IRun::settings
protected

Definition at line 63 of file IRun.h.

◆ solver

AutoPtr<ISolver> IRun::solver
protected

Solver.

Definition at line 81 of file IRun.h.

◆ timeStepping

AutoPtr<ITimeStepping> IRun::timeStepping
protected

Timestepping.

Definition at line 78 of file IRun.h.

◆ triggers

List<AutoPtr<ITrigger> > IRun::triggers
protected

Triggers.

Definition at line 84 of file IRun.h.


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