Skip to content

Commit cc1afd9

Browse files
committed
#19 remove diffsl example
1 parent d4d82f5 commit cc1afd9

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

src/lib.rs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,25 +53,10 @@
5353
//!
5454
//! DiffSL is a domain-specific language for specifying differential equations <https://github.com/martinjrobins/diffsl>. It uses the LLVM compiler framwork
5555
//! 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
56-
//! corresponding to the version of LLVM you have installed.
56+
//! corresponding to the version of LLVM you have installed, and using the [OdeBuilder::build_diffsl] method.
5757
//!
5858
//! For more information on the DiffSL language, see the [DiffSL documentation](https://martinjrobins.github.io/diffsl/)
5959
//!
60-
//! ```rust
61-
//! #[cfg(feature = "diffsl-llvm14")]
62-
//! {
63-
//! use diffsol::{OdeBuilder, Bdf, OdeSolverMethod};
64-
//! let code = "
65-
//! u { y = 1 }
66-
//! F { -y }
67-
//! out { y }
68-
//! ";
69-
//! let problem = OdeBuilder::new().build_diffsl(code).unwrap();
70-
//! let mut solver = Bdf::default();
71-
//! let _y = solver.solve(&problem, 1.0).unwrap();
72-
//! }
73-
//! ```
74-
//!
7560
//! ## Custom ODE problems
7661
//!
7762
//! The [OdeBuilder] struct can be used to create an ODE problem from a set of closures.

src/ode_solver/diffsl.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,19 @@ mod tests {
220220

221221
use super::DiffSl;
222222

223+
#[test]
224+
fn diffsl_expontential_decay() {
225+
// TODO: put this example into the docs once https://github.com/rust-lang/cargo/pull/13490 makes it to stable
226+
let code = "
227+
u { y = 1 }
228+
F { -y }
229+
out { y }
230+
";
231+
let problem = OdeBuilder::new().build_diffsl(code).unwrap();
232+
let mut solver = Bdf::default();
233+
let _y = solver.solve(&problem, 1.0).unwrap();
234+
}
235+
223236
#[test]
224237
fn diffsl_logistic_growth() {
225238
let text = "

0 commit comments

Comments
 (0)