Swarm-NG
1.1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
Swarm-NG
Overview
Text Formats
Getting Started with Swarm-NG
Advanced Options for Building Swarm
Configuration Files
Release notes
swarm-query.py command-line interface
Swarm command-line interface
How to Test Swarm
Using Swarm
Examining records from the log file.
Plotting results from a log file
Tutorial on using the Ensemble data structure.
Advanced tutorial for using GPU integrators
Tutorial for implementing an Integrator
Tutorial for making a monitor (stopper/logger)
Tutorial for Making a Propagator
Beginner Python Tutorial
Testing for ejection of planets
Tutorial for generating ensembles
Advanced Python Integration Tutorial
Resume an integration
Extracting statistical information from data files
Beginner tutorial for using the API
Todo List
Deprecated List
Modules
Namespaces
Classes
Files
File List
swarm
py
src
integrators
monitors
plugins
propagators
python
swarm
gpu
log
peyton
types
bdb_query.cpp
bdb_query.hpp
common.hpp
ensemble_alloc.hpp
integrator.cpp
integrator.hpp
kepler.h
plugin.cpp
plugin.hpp
query.cpp
query.hpp
runtime_error.hpp
snapshot.cpp
snapshot.hpp
stopwatch.h
swarm.cpp
swarm.h
swarmplugin.h
utils.cpp
utils.hpp
tutorials
utils
File Members
integrator.hpp
Go to the documentation of this file.
1
/*************************************************************************
2
* Copyright (C) 2011 by Saleh Dindar and the Swarm-NG Development Team *
3
* *
4
* This program is free software; you can redistribute it and/or modify *
5
* it under the terms of the GNU General Public License as published by *
6
* the Free Software Foundation; either version 3 of the License. *
7
* *
8
* This program is distributed in the hope that it will be useful, *
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
11
* GNU General Public License for more details. *
12
* *
13
* You should have received a copy of the GNU General Public License *
14
* along with this program; if not, write to the *
15
* Free Software Foundation, Inc., *
16
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
17
************************************************************************/
26
#pragma once
27
28
#include "
types/ensemble.hpp
"
29
#include "ensemble_alloc.hpp"
30
#include "
types/config.hpp
"
31
#include "
log/logmanager.hpp
"
32
33
34
namespace
swarm {
35
49
class
integrator
{
50
public
:
51
53
const
static
int
_default_max_iterations
;
55
const
static
int
_default_max_attempts
;
56
protected
:
57
59
defaultEnsemble
_ens
;
60
62
double
_destination_time
;
63
65
log::Pmanager
_logman
;
66
68
// WARNING: Why do we store a raw pointer here?
69
// Any reason not to just use host_log stored in _logman?
70
// Answer to WARNING: we may have different log streams and each
71
// integrator can use their own log stream
72
gpulog::host_log*
_log
;
73
75
int
_max_iterations
;
77
int
_max_attempts
;
78
80
virtual
void
launch_integrator
() = 0 ;
81
82
public
:
86
integrator
(
const
config
&cfg);
87
98
virtual
void
integrate
();
99
101
virtual
void
flush_log
() {
102
_logman
->flush();
103
}
104
106
virtual
defaultEnsemble
&
get_ensemble
() {
107
return
_ens
;
108
}
109
111
virtual
void
set_ensemble
(
defaultEnsemble
& ens) {
112
_ens
= ens;
113
}
114
116
virtual
void
set_destination_time
(
const
double
& destination_time) {
117
_destination_time
= destination_time;
118
}
119
120
virtual
double
get_destination_time()
const
{
121
return
_destination_time
;
122
}
123
140
static
shared_ptr<integrator>
create
(
const
config
&cfg);
141
143
virtual
void
set_log_manager
(log::Pmanager& l);
144
virtual
gpulog::host_log* get_host_log();
145
146
virtual
void
set_max_iterations(
const
int
& mi ) {
_max_iterations
= mi; }
147
virtual
void
set_max_attempts(
const
int
& ma ) {
_max_attempts
= ma; }
148
149
};
150
typedef
shared_ptr<integrator> Pintegrator;
151
152
154
int
number_of_active_systems
(
defaultEnsemble
ens) ;
155
156
164
namespace
gpu {
165
178
class
integrator
:
public
swarm::integrator
{
179
typedef
swarm::integrator
Base
;
180
protected
:
182
hostEnsemble
&
_hens
;
185
deviceEnsemble
_dens
;
186
188
gpulog::device_log*
_log
;
189
190
public
:
191
193
integrator
(
const
config
&cfg);
194
205
virtual
void
integrate
();
206
214
virtual
void
core_integrate
() {
215
launch_integrator
();
216
flush_log
();
217
}
218
220
virtual
void
set_log_manager
(log::Pmanager& l);
221
223
void
set_log
(gpulog::device_log* log) {
_log
= log; }
224
226
gpulog::device_log*
get_device_log
() {
return
_log
; }
227
233
void
set_ensemble
(
defaultEnsemble
& ens) {
234
_hens
= ens;
235
_dens
=
_hens
.
cloneTo
<
deviceEnsemble
>();
236
}
237
260
void
set_ensemble
(
defaultEnsemble
& host_ens,
deviceEnsemble
& device_ens) {
261
_hens
= host_ens;
262
_dens
= device_ens;
263
}
264
266
void
upload_ensemble
() {
267
_hens
.
copyTo
(
_dens
);
268
}
269
271
void
download_ensemble
() {
272
_dens
.
copyTo
(
_hens
);
273
}
274
275
};
276
typedef
shared_ptr<integrator> Pintegrator;
277
278
279
}
280
281
}
swarm
src
swarm
integrator.hpp
Generated on Sun Jul 21 2013 11:11:54 for Swarm-NG by
1.8.4