Swarm-NG  1.1
utils.cpp File Reference

Implements the utility functions for swarm. More...

#include "common.hpp"
#include "utils.hpp"

Go to the source code of this file.

Functions

int number_of_disabled_systems (defaultEnsemble ens)
 Basic helper function to count the number of systems with SYSTEM_DISABLED status.
 
swarm::hostEnsemble generate_ensemble (swarm::config &cfg)
 The velocity vector for planets is perpendicular to the position vector (from star to planet) and the magnitude depends on the ejection_factor |v| = sqrt(2*G*M/r)*ejection_factor. More...
 
bool validate_configuration (config &cfg)
 Deprecated: Validate the configuration. More...
 
void outputConfigSummary (std::ostream &o, swarm::config &cfg)
 Pretty print selected values in a config data structure. More...
 
config default_config ()
 Default configuration. More...
 

Detailed Description

Implements the utility functions for swarm.

Authors
Saleh Dindar

Definition in file utils.cpp.

Function Documentation

config default_config ( )

Default configuration.

Prepopulate a config data structure with some pre-tested configuration values for non-optional parameters.

Definition at line 149 of file utils.cpp.

swarm::hostEnsemble generate_ensemble ( swarm::config cfg)

The velocity vector for planets is perpendicular to the position vector (from star to planet) and the magnitude depends on the ejection_factor |v| = sqrt(2*G*M/r)*ejection_factor.

Generate an ensemble of random generated star-centeric planetary systems.

We get different type of orbit based on ejection_factor: 1/sqrt(2) : circular orbit < 1 : elliptical orbit = 1 : parabolic orbit > 1 : hyperbolic orbit

Configuration options: nsys: Number of systems in the ensemble nbod: Number of bodies per system spacing_factor: determines the spacing between the planets, distance of planet i from star is spacing_factor times the distance of planet i-1 from star. ejection_factor: determines the type of orbit see above planet_mass: ratio of the planet mass to the star mass. defaults to Jupiter mass planets (0.001)

Definition at line 63 of file utils.cpp.

References swarm::EnsembleAlloc< ENSEMBLE_CHUNK_SIZE, DefaultAllocator >::create(), swarm::EnsembleBase< _CHUNK_SIZE, _NUM_BODY_ATTRIBUTES, _NUM_SYS_ATTRIBUTES >::nbod(), swarm::EnsembleBase< _CHUNK_SIZE, _NUM_BODY_ATTRIBUTES, _NUM_SYS_ATTRIBUTES >::nsys(), swarm::config::optional(), swarm::config::require(), and x.

void outputConfigSummary ( std::ostream &  o,
swarm::config cfg 
)

Pretty print selected values in a config data structure.

Definition at line 135 of file utils.cpp.

bool validate_configuration ( swarm::config cfg)

Deprecated: Validate the configuration.

The criterias are very general and will cause problems.

Todo:
This function needs to be restructured or at least updated

Definition at line 119 of file utils.cpp.

References swarm::config::optional().

Referenced by benchmark_item().