diff options
author | bnewbold <bnewbold@robocracy.org> | 2017-01-16 18:07:09 -0800 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2017-01-16 18:07:09 -0800 |
commit | 7486ed83a310cc82a1c3149f9258d853f43cc11b (patch) | |
tree | e7f867ee25de95c6ad5c300e01214b9b83e89296 /src | |
parent | fefe370e0bdb3e80427a26a3eb2727b47e22ed03 (diff) | |
download | modelthing-7486ed83a310cc82a1c3149f9258d853f43cc11b.tar.gz modelthing-7486ed83a310cc82a1c3149f9258d853f43cc11b.zip |
remove redundant helpers from modelthing
Diffstat (limited to 'src')
-rw-r--r-- | src/modelica_model.rs | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/src/modelica_model.rs b/src/modelica_model.rs index 40b83d6..54363c8 100644 --- a/src/modelica_model.rs +++ b/src/modelica_model.rs @@ -2,7 +2,6 @@ extern crate modelica_parser; use std::clone::Clone; -use std::collections::HashMap; use std::collections::HashSet; use std::iter::FromIterator; @@ -13,8 +12,6 @@ use errors::Result; /// Helpers pub trait ModelicaModelExt { - fn get_constant_vars(&self) -> HashMap<String, Option<Expr>>; - fn get_free_vars(&self) -> HashSet<String>; fn solve_for(&self, indep_vars: Vec<String>, dep_vars: Vec<String>) @@ -22,48 +19,6 @@ pub trait ModelicaModelExt { } impl ModelicaModelExt for ModelicaModel { - fn get_constant_vars(&self) -> HashMap<String, Option<Expr>> { - let mut binds = HashMap::new(); - // XXX: actually implement this... - for c in &self.components { - match c.prefix { - Some(ComponentPrefix::Constant) => { - binds.insert(c.name.clone(), Some(Expr::Integer(123))); - } - Some(ComponentPrefix::Parameter) => { - binds.insert(c.name.clone(), Some(Expr::Float(4.56))); - } - _ => (), - } - } - binds - } - - // This crude function finds "unbound" variables: those which are not constants, parameters, or - // the sole element on the LHS of an equation. - // Bugs: - // if a var is on LHS and RHS of same equation - fn get_free_vars(&self) -> HashSet<String> { - // Start with components, and remove constants and parameters - let vars = self.components.iter().filter(|v| match v.prefix { - Some(ComponentPrefix::Constant) | - Some(ComponentPrefix::Parameter) => false, - _ => true, - }); - - // Remove LHS (bound) vars - let mut outputs = vec![]; - for eq in self.equations.iter() { - // TODO: - if let Expr::Ident(ref symb) = eq.lhs { - outputs.push(symb.to_string()); - } - } - let vars = vars.filter(|v| !outputs.contains(&v.name)); - - vars.map(|c| c.name.clone()).collect() - } - // V variables // Q constants (become kwargs) // P bound vars (independent, inputs/passed, become like constants) |