mirror of
https://github.com/cosmo-sims/monofonIC.git
synced 2024-09-12 08:53:45 +02:00
added more doxygen documentation to infrastructure files
This commit is contained in:
parent
f053b86316
commit
daafcbef01
6 changed files with 101 additions and 3 deletions
|
@ -17,6 +17,10 @@
|
|||
|
||||
#include <cosmology_parameters.hh>
|
||||
|
||||
/**
|
||||
* @brief namespace encapsulating all things cosmology
|
||||
*
|
||||
*/
|
||||
namespace cosmology{
|
||||
|
||||
//! we store here the preset cosmological paramters
|
||||
|
@ -100,7 +104,10 @@ parameters::defaultmmap_t parameters::default_pmaps_
|
|||
{"Tcmb", 2.7255}}}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Output all sets of cosmological parameters that we store internally
|
||||
*
|
||||
*/
|
||||
void print_ParameterSets( void ){
|
||||
music::ilog << "Available cosmology parameter sets:" << std::endl;
|
||||
cosmology::parameters p;
|
||||
|
|
|
@ -27,19 +27,39 @@
|
|||
|
||||
#include <unistd.h> // for unlink
|
||||
|
||||
|
||||
/**
|
||||
* @brief the possible species of fluids
|
||||
*
|
||||
*/
|
||||
std::map<cosmo_species,std::string> cosmo_species_name =
|
||||
{
|
||||
{cosmo_species::dm,"Dark matter"},
|
||||
{cosmo_species::baryon,"Baryons"},
|
||||
{cosmo_species::neutrino,"Neutrinos"}
|
||||
{cosmo_species::neutrino,"Neutrinos"} // not implemented yet
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief the namespace encapsulating the main IC generation routines
|
||||
*
|
||||
*/
|
||||
namespace ic_generator{
|
||||
|
||||
//! global RNG object
|
||||
std::unique_ptr<RNG_plugin> the_random_number_generator;
|
||||
|
||||
//! global output object
|
||||
std::unique_ptr<output_plugin> the_output_plugin;
|
||||
|
||||
//! global cosmology object (calculates all things cosmological)
|
||||
std::unique_ptr<cosmology::calculator> the_cosmo_calc;
|
||||
|
||||
/**
|
||||
* @brief Initialises all global objects
|
||||
*
|
||||
* @param the_config reference to config_file object
|
||||
* @return int 0 if successful
|
||||
*/
|
||||
int initialise( config_file& the_config )
|
||||
{
|
||||
the_random_number_generator = std::move(select_RNG_plugin(the_config));
|
||||
|
@ -49,12 +69,23 @@ int initialise( config_file& the_config )
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reset all global objects
|
||||
*
|
||||
*/
|
||||
void reset () {
|
||||
the_random_number_generator.reset();
|
||||
the_output_plugin.reset();
|
||||
the_cosmo_calc.reset();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Main driver routine for IC generation, everything interesting happens here
|
||||
*
|
||||
* @param the_config reference to the config_file object
|
||||
* @return int 0 if successful
|
||||
*/
|
||||
int run( config_file& the_config )
|
||||
{
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -60,6 +60,13 @@ void handle_eptr(std::exception_ptr eptr) // passing by value is ok
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief the main routine of MUSIC2-monofonIC
|
||||
*
|
||||
* @param argc
|
||||
* @param argv
|
||||
* @return int
|
||||
*/
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
|
||||
|
|
|
@ -17,13 +17,21 @@
|
|||
|
||||
#include "output_plugin.hh"
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get the output plugin map object
|
||||
*
|
||||
* @return std::map< std::string, output_plugin_creator *>&
|
||||
*/
|
||||
std::map< std::string, output_plugin_creator *>& get_output_plugin_map()
|
||||
{
|
||||
static std::map< std::string, output_plugin_creator* > output_plugin_map;
|
||||
return output_plugin_map;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Print out the names of all output plugins compiled in
|
||||
*
|
||||
*/
|
||||
void print_output_plugins()
|
||||
{
|
||||
std::map< std::string, output_plugin_creator *>& m = get_output_plugin_map();
|
||||
|
@ -40,6 +48,15 @@ void print_output_plugins()
|
|||
music::ilog << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return a pointer to the desired output plugin as given in the config file
|
||||
*
|
||||
* Implements the abstract factory pattern (https://en.wikipedia.org/wiki/Abstract_factory_pattern)
|
||||
*
|
||||
* @param cf reference to config_file object
|
||||
* @param pcc reference to cosmology::calculator object
|
||||
* @return std::unique_ptr<output_plugin>
|
||||
*/
|
||||
std::unique_ptr<output_plugin> select_output_plugin( config_file& cf, std::unique_ptr<cosmology::calculator>& pcc )
|
||||
{
|
||||
std::string formatname = cf.get_value<std::string>( "output", "format" );
|
||||
|
|
|
@ -18,6 +18,11 @@
|
|||
#include <general.hh>
|
||||
#include <random_plugin.hh>
|
||||
|
||||
/**
|
||||
* @brief Get the RNG plugin map object
|
||||
*
|
||||
* @return std::map<std::string, RNG_plugin_creator *>&
|
||||
*/
|
||||
std::map<std::string, RNG_plugin_creator *> &
|
||||
get_RNG_plugin_map()
|
||||
{
|
||||
|
@ -25,6 +30,10 @@ get_RNG_plugin_map()
|
|||
return RNG_plugin_map;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Print out the names of all RNG plugins compiled in
|
||||
*
|
||||
*/
|
||||
void print_RNG_plugins()
|
||||
{
|
||||
std::map<std::string, RNG_plugin_creator *> &m = get_RNG_plugin_map();
|
||||
|
@ -41,6 +50,15 @@ void print_RNG_plugins()
|
|||
music::ilog << std::endl;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Return a pointer to the desired random number generator plugin as given in the config file
|
||||
*
|
||||
* Implements the abstract factory pattern (https://en.wikipedia.org/wiki/Abstract_factory_pattern)
|
||||
*
|
||||
* @param cf reference to config_file object
|
||||
* @return std::unique_ptr<RNG_plugin> unique pointer to plugin
|
||||
*/
|
||||
std::unique_ptr<RNG_plugin> select_RNG_plugin(config_file &cf)
|
||||
{
|
||||
std::string rngname = cf.get_value<std::string>("random", "generator");
|
||||
|
|
|
@ -17,6 +17,11 @@
|
|||
|
||||
#include <transfer_function_plugin.hh>
|
||||
|
||||
/**
|
||||
* @brief Get the TransferFunction plugin map object
|
||||
*
|
||||
* @return std::map<std::string, TransferFunction_plugin_creator *>&
|
||||
*/
|
||||
std::map<std::string, TransferFunction_plugin_creator *> &
|
||||
get_TransferFunction_plugin_map()
|
||||
{
|
||||
|
@ -24,6 +29,10 @@ get_TransferFunction_plugin_map()
|
|||
return TransferFunction_plugin_map;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Print out the names of all transfer function plugins compiled in
|
||||
*
|
||||
*/
|
||||
void print_TransferFunction_plugins()
|
||||
{
|
||||
std::map<std::string, TransferFunction_plugin_creator *> &m = get_TransferFunction_plugin_map();
|
||||
|
@ -39,6 +48,15 @@ void print_TransferFunction_plugins()
|
|||
music::ilog << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return a pointer to the desired transfer function plugin as given in the config file
|
||||
*
|
||||
* Implements the abstract factory pattern (https://en.wikipedia.org/wiki/Abstract_factory_pattern)
|
||||
*
|
||||
* @param cf reference to config_file object
|
||||
* @param cosmo_param reference to cosmology::parameters object holding cosmological parameter values
|
||||
* @return std::unique_ptr<TransferFunction_plugin>
|
||||
*/
|
||||
std::unique_ptr<TransferFunction_plugin> select_TransferFunction_plugin(config_file &cf, const cosmology::parameters& cosmo_param)
|
||||
{
|
||||
std::string tfname = cf.get_value<std::string>("cosmology", "transfer");
|
||||
|
|
Loading…
Reference in a new issue