Swarm-NG
1.1
|
Interface class for all integrators. More...
#include <integrator.hpp>
Public Member Functions | |
integrator (const config &cfg) | |
Inetgrator class should be configurable. Derived instances should also have a constructor with similar signature and pass on the config parameter. | |
virtual void | integrate () |
Interfaces function to integrate, for use by general user. More... | |
virtual void | flush_log () |
Flush the host log. | |
virtual defaultEnsemble & | get_ensemble () |
Access the ensemble subject to integration. | |
virtual void | set_ensemble (defaultEnsemble &ens) |
Set the ensemble subject to integration. | |
virtual void | set_destination_time (const double &destination_time) |
Set the time marker to end the integration. | |
virtual void | set_log_manager (log::Pmanager &l) |
accessor function to set the manager for log output | |
Static Public Member Functions | |
static shared_ptr< integrator > | create (const config &cfg) |
Loads an integrator using the plugin system. More... | |
Static Public Attributes | |
static const int | _default_max_iterations = 10000000 |
Default value for maximum number of iterations. c.f. _max_iterations. | |
static const int | _default_max_attempts = 1000000 |
Default value for maximum number of attempts. c.f. _max_attempts. | |
Protected Member Functions | |
virtual void | launch_integrator ()=0 |
Integrater implementation provided by derived instance. | |
Protected Attributes | |
defaultEnsemble | _ens |
ensemble to be integrated | |
double | _destination_time |
the timestamp at which the integration should finish | |
log::Pmanager | _logman |
log manager for log output, set to manager::default() by default | |
gpulog::host_log * | _log |
log object, obtained from log manager | |
int | _max_iterations |
Maximum number of iterations per each integration step. c.f. integrate for usage. | |
int | _max_attempts |
Maximum number of attempts to complete the integration. c.f. integrate for usage. | |
Interface class for all integrators.
This class sets out the general functions to use an integrator for external applications.
All CPU integrators should be based on this class. It contains all the variables required for basic integrations. User variables can be added in derived instances.
GPU integrators should be based on gpu::integrator.
To add your integrator to swarm library look at plugin development guide.
Definition at line 49 of file integrator.hpp.
|
static |
Loads an integrator using the plugin system.
Dynamically load integrators based on the configuration.
value of cfg["integrator"] is used to identify the plugin to be instantiated. The integrator plugin usually requires additional configuration.
The "integrator_" suffix is automatically added to the the value of cfg["integrator"]. Example: To load hermite integrator set cfg["integrator"]="hermite" and then the plugin "integrator_hermite" will be loaded and instantiated.
If cfg["integrator"] contains an invalid value then plugin_not_found exception is raised.
to see the list of plugins available use swarm -P.
Must use factory class to dynamically load integrator subclass instead of using constructor. Users can define their own integrators that can be loaded dynamically later.
[in] | cfg | configuration class |
Definition at line 129 of file integrator.cpp.
References swarm::plugin::instance().
Referenced by main().
|
virtual |
Interfaces function to integrate, for use by general user.
Calls launch_integrator() several times up to the value specified in _max_attempts until all the systems are inactive. Each call can go through at most a limited number of iterations specified in _max_iterations .
To set the parameters for integration use set_ensemble(ens), set_destination_time(t), set_log_manager(l)
Reimplemented in swarm::gpu::integrator.
Definition at line 91 of file integrator.cpp.
References _ens, _logman, _max_attempts, launch_integrator(), and swarm::number_of_active_systems().