Swarm-NG  1.1
montecarlo_mcmc_outputs.cpp File Reference

Implement Monte Carlo simulation to find planetary systems and generate ensemble. More...

#include <iostream>
#include <fstream>
#include <math.h>
#include <signal.h>
#include "swarm/swarm.h"
#include "swarm/snapshot.hpp"
#include "swarm/log/log.hpp"
#include "random.hpp"
#include "kepler.hpp"
#include "swarm/log/host_array_writer.hpp"

Go to the source code of this file.

Macros

#define SYNC   cudaThreadSynchronize()
 In writing this monte carlo simulation which is supposed to find planetary systems using Monte Carlo simulations, I used the old monte carlo code. More...
 

Functions

defaultEnsemble generate_ensemble_with_initial_conditions_keplerian_from_file (const config &cfg)
 Read in Keplerian coordinates from a text file. More...
 
defaultEnsemble generate_ensemble_with_initial_conditions_cartesian_from_file (const config &cfg)
 Read in Cartesian coordinates from a text file. More...
 
void print_system (const swarm::ensemble &ens, const int systemid, std::ostream &os=std::cout)
 output the system
 
std::vector< std::vector
< double > > 
calc_semimajor_axes (defaultEnsemble &ens)
 Calculate the semi-major axes.
 
void save_snapshot (defaultEnsemble &ens)
 Save a periodical snapshot if one is defined in the config file Snapshot is usually saved as binary file, because it happens very frequently and text files take very long time to generate.
 
defaultEnsemble trim_disabled_systems (const defaultEnsemble &ens)
 This is a very crucial part of the Monte Carlo simulation We remove the disabled ones and make a smaller ensemble. More...
 
void ctrl_c_trap (int)
 We can use this signal handler function to detect Ctrl-C and save the last snapshot and leave in a clean way. More...
 
int main (int argc, char *argv[])
 The main program.
 

Detailed Description

Implement Monte Carlo simulation to find planetary systems and generate ensemble.

Definition in file montecarlo_mcmc_outputs.cpp.

Macro Definition Documentation

#define SYNC   cudaThreadSynchronize()

In writing this monte carlo simulation which is supposed to find planetary systems using Monte Carlo simulations, I used the old monte carlo code.

It is useful, the tricky part is generating the ensemble.

Definition at line 45 of file montecarlo_mcmc_outputs.cpp.

Referenced by main().

Function Documentation

void ctrl_c_trap ( int  )

We can use this signal handler function to detect Ctrl-C and save the last snapshot and leave in a clean way.

Definition at line 574 of file montecarlo_mcmc_outputs.cpp.

defaultEnsemble trim_disabled_systems ( const defaultEnsemble ens)

This is a very crucial part of the Monte Carlo simulation We remove the disabled ones and make a smaller ensemble.

We don't really need to make another ensemble. But keeping the same ensemble is a lot of trouble.

Definition at line 533 of file montecarlo_mcmc_outputs.cpp.

References swarm::EnsembleAlloc< W, _Allocator >::copyTo(), swarm::EnsembleAlloc< W, _Allocator >::create(), swarm::EnsembleBase< _CHUNK_SIZE, _NUM_BODY_ATTRIBUTES, _NUM_SYS_ATTRIBUTES >::nbod(), swarm::EnsembleBase< _CHUNK_SIZE, _NUM_BODY_ATTRIBUTES, _NUM_SYS_ATTRIBUTES >::nsys(), and number_of_disabled_systems().