Skip to content

Commit

Permalink
#19 remove diffsl example
Browse files Browse the repository at this point in the history
  • Loading branch information
martinjrobins committed Apr 4, 2024
1 parent d4d82f5 commit cc1afd9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
17 changes: 1 addition & 16 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,10 @@
//!
//! DiffSL is a domain-specific language for specifying differential equations <https://github.com/martinjrobins/diffsl>. It uses the LLVM compiler framwork
//! to compile the equations to efficient machine code and uses the EnzymeAD library to compute the jacobian. You can use DiffSL with DiffSol by enabling one of the `diffsl-llvm*` features
//! corresponding to the version of LLVM you have installed.
//! corresponding to the version of LLVM you have installed, and using the [OdeBuilder::build_diffsl] method.
//!
//! For more information on the DiffSL language, see the [DiffSL documentation](https://martinjrobins.github.io/diffsl/)
//!
//! ```rust
//! #[cfg(feature = "diffsl-llvm14")]
//! {
//! use diffsol::{OdeBuilder, Bdf, OdeSolverMethod};
//! let code = "
//! u { y = 1 }
//! F { -y }
//! out { y }
//! ";
//! let problem = OdeBuilder::new().build_diffsl(code).unwrap();
//! let mut solver = Bdf::default();
//! let _y = solver.solve(&problem, 1.0).unwrap();
//! }
//! ```
//!
//! ## Custom ODE problems
//!
//! The [OdeBuilder] struct can be used to create an ODE problem from a set of closures.
Expand Down
13 changes: 13 additions & 0 deletions src/ode_solver/diffsl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,19 @@ mod tests {

use super::DiffSl;

#[test]
fn diffsl_expontential_decay() {
// TODO: put this example into the docs once https://github.com/rust-lang/cargo/pull/13490 makes it to stable
let code = "
u { y = 1 }
F { -y }
out { y }
";
let problem = OdeBuilder::new().build_diffsl(code).unwrap();
let mut solver = Bdf::default();
let _y = solver.solve(&problem, 1.0).unwrap();
}

#[test]
fn diffsl_logistic_growth() {
let text = "
Expand Down

0 comments on commit cc1afd9

Please sign in to comment.