aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2016-12-02 01:40:30 -0800
committerbnewbold <bnewbold@robocracy.org>2016-12-02 01:40:30 -0800
commitf6364ebcac0d0a88a3cc6812fd2120c97b42cc26 (patch)
tree7c4ea30f71d39872ce63dffeb7dfa63b934a8205 /src/bin
parent7ccdaf4c4b5c50892c654d9f16875c03214168d4 (diff)
downloadmodelthing-f6364ebcac0d0a88a3cc6812fd2120c97b42cc26.tar.gz
modelthing-f6364ebcac0d0a88a3cc6812fd2120c97b42cc26.zip
basic impl of solving equations
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/mt-tool.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/bin/mt-tool.rs b/src/bin/mt-tool.rs
index 929990f..8ef2464 100644
--- a/src/bin/mt-tool.rs
+++ b/src/bin/mt-tool.rs
@@ -57,6 +57,8 @@ fn main() {
let mut opts = Options::new();
opts.optflag("h", "help", "print this help menu");
opts.optflag("", "version", "print the version");
+ opts.optmulti("", "dep", "dependent variable", "VAR");
+ opts.optmulti("", "indep", "dependent variable", "VAR");
let matches = match opts.parse(&args[1..]) {
Ok(m) => m,
@@ -85,6 +87,14 @@ fn main() {
let cmd = matches.free[0].clone();
match cmd.as_str() {
"parse" => { parse_modelica_files(matches.free[1..].iter().map(|x| x.to_string()).collect()); },
+ "solve_for" => {
+ if matches.free.len() != 2 {
+ println!("Expected a path to load");
+ exit(-1);
+ }
+ let me = modelthing::load_model_entry(Path::new(&matches.free[1])).unwrap();
+ println!("{:?}", me.ast.solve_for(matches.opt_strs("indep"), matches.opt_strs("dep")));
+ },
"transpile_scheme" => {
if matches.free.len() != 2 {
println!("Expected a single path to load");