precice

Crates.ioprecice
lib.rsprecice
version3.1.0
sourcesrc
created_at2023-02-23 13:44:14.892691
updated_at2024-04-05 13:30:38.890746
descriptionRust bindinds for precice
homepagehttps://precice.org
repositoryhttps://github.com/precice/rust-bindings
max_upload_size
id792767
size51,792
Frédéric Simonis (fsimonis)

documentation

https://precice.org/installation-bindings-rust

README

Rust language bindings for the C++ library preCICE

This package provides rust language bindings for the C++ library preCICE. Note that the first two digits of the version number of the bindings indicate the preCICE version that the bindings support. The last digit represents the version of the bindings. Example: 2.5.0 and 2.5.2 of the bindings represent versions 0 and 2 of the bindings that are compatible with preCICE 2.5.x.

User documentation

Please refer to the preCICE documentation for information on how to install and use the rust bindings.

Required dependencies

preCICE: Refer to the preCICE documentation for information on building and installation.

pkg-config: A working installation of pkg-config, which is able to find preCICE

cargo: A working installation of cargo

Installing the package from the registry

$ cargo add precice@3

Installing the package from the git repository

$ cargo add --git https://github.com/precice/rust-bindings.git --rev v3.0.0 precice

Usage

use precice

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

// get dimensions of a mesh
let meshDims = participant.get_mesh_dimensions("Mesh");
assert!(meshDims == 2);

// 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);

participant.initialize();

See the solverdummy under examples/ for more details.

Contributors

Commit count: 40

cargo fmt