4 个稳定版本

3.1.0 2024年4月5日
3.0.1 2024年2月20日
3.0.0 2024年2月2日
2.5.0 2023年2月23日

#248 in 科学

Download history 1/week @ 2024-04-22 8/week @ 2024-05-20

每月259次下载

LGPL-3.0-or-later

21KB
437

Rust 语言对 C++ 库 preCICE 的绑定

此包为 C++ 库 preCICE 提供 Rust 语言绑定。请注意,绑定版本号的前两位表示绑定支持的 preCICE 版本,最后一位表示绑定的版本。例如:2.5.02.5.2 的绑定表示与 preCICE 2.5.x 兼容的绑定版本 02

用户文档

请参阅 preCICE 文档 了解如何安装和使用 Rust 绑定。

所需依赖项

preCICE:有关构建和安装的信息,请参阅 preCICE 文档

pkg-config:能够找到 preCICE 的 pkg-config 的有效安装

cargo:cargo 的有效安装

从注册表安装包

$ cargo add precice@3

从 git 仓库安装包

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

用法

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

有关更多详细信息,请参阅 examples/ 下的 solverdummy。

贡献者

依赖项

~0.5–2.1MB
~32K SLoC