Skip to content

Commit

Permalink
fixed wrong passing of options and unused varaible errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Sfonxu committed Oct 23, 2024
1 parent 4e75a12 commit 3de40ab
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions docs/markdown/pympdata_landing.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,10 @@ stepper = Stepper(pyargs(...
<summary>Rust code (click to expand)</summary>

```Rust
let stepper_arg = vec![("options", options), ("grid", PyTuple::new_bound(py, nx_ny).into_any())].into_py_dict_bound(py);
let stepper_ = py.import_bound("PyMPDATA")?.getattr("Stepper")?;
let stepper = stepper_.call((), Some(&stepper_arg))?;
let n_dims: i32 = 2;
let stepper_arg = PyDict::new_bound(py);
PyDictMethods::set_item(&stepper_arg, "options", &options);
PyDictMethods::set_item(&stepper_arg, "n_dims", &n_dims);
```
</details>

Expand Down Expand Up @@ -400,10 +401,10 @@ stepper = Stepper(pyargs(...
<summary>Rust code (click to expand)</summary>

```Rust
let n_dims: i32 = 2;
let stepper_arg_alternative = PyDict::new_bound(py);
PyDictMethods::set_item(&stepper_arg_alternative, "options", &options);
PyDictMethods::set_item(&stepper_arg_alternative, "n_dims", &n_dims);
let stepper_arg_alternative = vec![("options", &options), ("grid", PyTuple::new_bound(py, nx_ny).into_any())].into_py_dict_bound(py);
let stepper_ = py.import_bound("PyMPDATA")?.getattr("Stepper")?;
let stepper = stepper_.call((), Some(&stepper_arg))?;
//or stepper_arg_alternative
```
</details>

Expand Down Expand Up @@ -487,10 +488,10 @@ state = solver.advectee.get();

```Rust
let solver_ = py.import_bound("PyMPDATA")?.getattr("Solver")?;
let mut solver = solver_.call((), Some(&vec![("stepper", stepper), ("advectee", advectee), ("advector", advector)].into_py_dict_bound(py)))?;
let state_0 = solver.getattr("advectee")?.getattr("get")?.call0()?.getattr("copy")?.call0()?;
let solver = solver_.call((), Some(&vec![("stepper", stepper), ("advectee", advectee), ("advector", advector)].into_py_dict_bound(py)))?;
let _state_0 = solver.getattr("advectee")?.getattr("get")?.call0()?.getattr("copy")?.call0()?;
solver.getattr("advance")?.call((), Some(&vec![("n_steps", 75)].into_py_dict_bound(py)))?;
let state = solver.getattr("advectee")?.getattr("get")?.call0()?;
let _state = solver.getattr("advectee")?.getattr("get")?.call0()?;
Ok(())
})
}
Expand Down

0 comments on commit 3de40ab

Please sign in to comment.