26 #include "function.hpp"
31 int eval_dump(
const std::string& name) {
39 ss << std::setfill(
'0') << std::setw(6);
41 std::vector<DM> inputs;
43 for (
int i=0;i<1000000;++i) {
46 inputs = f.
generate_in(name+
"."+ss.str()+
".in.txt");
49 casadi_warning(ex.
what());
50 casadi_assert(i>0,
"Could not find a single input file "
51 "with file name " + name +
".<dddddd>.in.txt");
57 std::vector<DM> res = f(inputs);
65 int eval_dump_parse(
const std::vector<std::string>& args) {
66 casadi_assert(args.size()>0,
"Name is missing in $ casadi-cli eval_dump name.");
67 std::string name = args[0];
68 return eval_dump(name);
71 int main(
int argc,
char* argv[]) {
73 std::vector<std::string> args(argv + 1, argv + argc);
76 std::set<std::string> commands = {
"eval_dump"};
77 casadi_assert(args.size()>0,
"Must provide a command. Use one of: " +
str(commands) +
".");
78 std::string cmd = args[0];
79 if (cmd==
"eval_dump") {
80 return eval_dump_parse(std::vector<std::string>(args.begin()+1, args.end()));
82 casadi_assert(commands.find(cmd)!=commands.end(),
83 "Unrecognised command '" + cmd +
"'. Use one of: " +
str(commands) +
".");
const char * what() const override
Display error.
void generate_in(const std::string &fname, const std::vector< DM > &arg)
Export an input file that can be passed to generate C code with a main.
void generate_out(const std::string &fname, const std::vector< DM > &arg)
Export an output file that can be checked with generated C code output.
static Function load(const std::string &filename)
Build function from serialization.
void change_option(const std::string &option_name, const GenericType &option_value)
Change option after object creation for debugging.
std::string str(const T &v)
String representation, any type.