Skip to content

Commit

Permalink
Update example
Browse files Browse the repository at this point in the history
  • Loading branch information
fsimonis committed Jan 15, 2024
1 parent 2395450 commit fe82e50
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,25 @@ $ cargo add --git https://github.com/precice/rust-bindings.git --rev v2.5.0 prec
## Usage

```rust
use precice

// create a solver interface
let mut interface = precice::new("SolverOne", "config.xml", 0, 1);
let mut participant = precice::Participant::new("Solver", "config.xml", 0, 1);

// call const members
let dims = interface.get_dimensions();
// get dimensions of a mesh
let meshDims = participant.get_mesh_dimensions("Mesh");
assert!(meshDims == 2);

// non-const members require the object to be pinned in memory
let dims = interface.pin_mut().initialize();
// define coordinates
let coords = Vec::from([1., 1., 2., 2., 3., 3., 4., 4.]);
let mut vertices = vec![0_i32; 4]
participant.set_mesh_vertices("Mesh", &coords, &mut vertices);

// action constants are directly part of precice
precice::action_write_iteration_checkpoint()
participant.initialize();
```

See the solverdummy under `examples/` for more details.

## Contributors

* [Frédéric Simonis](https://github.com/fsimonis)

0 comments on commit fe82e50

Please sign in to comment.