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
tutorials
utils
binary_reader.cpp
binary_reader.hpp
log2db.cpp
parabolic_collision.cpp
straight_line.cpp
unit_tests.cpp
File Members
straight_line.cpp
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
************************************************************************/
18
25
#include "
swarm/swarm.h
"
26
#include <iostream>
27
using namespace
swarm;
28
using namespace
std
;
29
30
const
int
nbod = 3;
31
const
int
nsys = 64;
32
34
int
main(
int
argc,
char
* argv[]){
35
if
(argc <= 1){
36
cout <<
"Usage: straight_line <outputfilename>"
<< endl;
37
}
38
const
string
outputfn = argv[1];
39
init
(
config
());
40
defaultEnsemble
ens =
defaultEnsemble::create
(nbod,nsys);
41
42
for
(
int
s = 0; s < nsys ; s++){
43
ens[s].id() = 0;
44
ens[s].time() = 0;
45
46
// Set all the bodies to zero
47
for
(
int
b = 0; b < nbod; b++){
48
ens[s][b].mass() = 0;
49
for
(
int
c
= 0;
c
< 3;
c
++)
50
ens[s][b][
c
].pos() = 0, ens[s][b][
c
].vel() = 0;
51
}
52
53
// the central one has to pull everything together
54
ens[s][0].mass() = 1;
55
ens[s][1][0].pos() = -10;
56
ens[s][2][0].pos() = +10;
57
58
}
59
snapshot::save_text
(ens,outputfn);
60
}
61
62
63
swarm
src
utils
straight_line.cpp
Generated on Sun Jul 21 2013 11:11:54 for Swarm-NG by
1.8.4