trick/trick_source/sim_services/MonteCarlo/MonteVarFixed.cpp
2015-08-04 15:46:44 -05:00

24 lines
676 B
C++

#include <sstream>
#include <iomanip>
#include "trick/MonteVarFixed.hh"
Trick::MonteVarFixed::MonteVarFixed(std::string in_name, double in_value, std::string in_unit) {
this->name = in_name;
std::ostringstream string_stream;
string_stream << std::setprecision(15) << in_value ;
this->value = string_stream.str();
this->unit = in_unit;
}
std::string Trick::MonteVarFixed::get_next_value() {
std::ostringstream string_stream;
if (unit.empty()) {
string_stream << name << " = " << value;
}
else {
string_stream << name << " = trick.attach_units(\"" << unit << "\", " << value << ")";
}
return string_stream.str();
}