Add MonteCarlo::variables accessor

Closes #713
This commit is contained in:
Derek Bankieris 2018-12-04 10:25:03 -06:00
parent 049485eeae
commit 0394867dfd
2 changed files with 13 additions and 0 deletions

View File

@ -17,6 +17,8 @@
#ifdef SWIG
// This instructs SWIG to use dynamic_cast and return one of the derived type for the get_variable function.
%factory(Trick::MonteVar * Trick::MonteCarlo::get_variable, Trick::MonteVarCalculated, Trick::MonteVarFile, Trick::MonteVarFixed, Trick::MonteVarRandom) ;
// This, paired with get_variables, allows access to the variables from the input file.
%template(MonteVarVector) std::vector<Trick::MonteVar*>;
#endif
namespace Trick {
@ -625,6 +627,13 @@ namespace Trick {
*/
Trick::MonteVar * get_variable(std::string variable_name);
/**
* Gets the list of added variables.
*
* @return the current list of variables
*/
const std::vector<Trick::MonteVar*>& get_variables();
/**
* Adds a new slave with the specified machine name.
*

View File

@ -178,6 +178,10 @@ Trick::MonteVar * Trick::MonteCarlo::get_variable(std::string variable_name) {
return (NULL);
}
const std::vector<Trick::MonteVar*>& Trick::MonteCarlo::get_variables() {
return variables;
}
void Trick::MonteCarlo::add_slave(std::string in_machine_name) {
add_slave(new MonteSlave(in_machine_name));
}