1a1cbad85SJed Brown# libceed: efficient, extensible discretization 2a1cbad85SJed Brown 3*7ed177dbSJed Brown[](https://github.com/CEED/libCEED/actions/workflows/rust-test-with-style.yml) 4*7ed177dbSJed Brown[](https://docs.rs/libceed) 5*7ed177dbSJed Brown 6*7ed177dbSJed BrownThis crate provides an interface to [libCEED](https://libceed.readthedocs.io), which is a performance-portable library for extensible element-based discretization for partial differential equations and related computational problems. 7*7ed177dbSJed BrownThe formulation is algebraic and intended to be lightweight and easy to incorporate in higher level abstractions. 8*7ed177dbSJed BrownSee the [libCEED user manual](https://libceed.readthedocs.io) for details on [interface concepts](https://libceed.readthedocs.io/en/latest/libCEEDapi/) and extensive examples. 9a1cbad85SJed Brown 10a1cbad85SJed Brown 11a1cbad85SJed Brown 12a1cbad85SJed Brown## Usage 13a1cbad85SJed Brown 14a1cbad85SJed BrownTo call libCEED from a Rust package, the following `Cargo.toml` can be used. 15a1cbad85SJed Brown```toml 16a1cbad85SJed Brown[dependencies] 17d66340f5SJed Brownlibceed = "0.9.0" 18a1cbad85SJed Brown``` 19a1cbad85SJed Brown 20a1cbad85SJed BrownFor a development version of the libCEED Rust bindings, use the following `Cargo.toml`. 21a1cbad85SJed Brown```toml 22a1cbad85SJed Brown[dependencies] 23a1cbad85SJed Brownlibceed = { git = "https://github.com/CEED/libCEED", branch = "main" } 24a1cbad85SJed Brown``` 25a1cbad85SJed Brown 26a1cbad85SJed Brown```rust 27a1cbad85SJed Brownextern crate libceed; 28a1cbad85SJed Brown 2989d15d5fSJeremy L Thompsonfn main() -> libceed::Result<()> { 30a1cbad85SJed Brown let ceed = libceed::Ceed::init("/cpu/self/ref"); 31c68be7a2SJeremy L Thompson let xc = ceed.vector_from_slice(&[0., 0.5, 1.0])?; 32e78171edSJeremy L Thompson let xs = xc.view()?; 33a1cbad85SJed Brown assert_eq!(xs[..], [0., 0.5, 1.0]); 34c68be7a2SJeremy L Thompson Ok(()) 35a1cbad85SJed Brown} 36a1cbad85SJed Brown``` 37a1cbad85SJed Brown 38*7ed177dbSJed BrownThis crate provides modules for each object, but they are usually created from the `Ceed` object as with the vector above. 39*7ed177dbSJed BrownThe resource string passed to `Ceed::init` is used to identify the "backend", which includes algorithmic strategies and hardware such as NVIDIA and AMD GPUs. 40*7ed177dbSJed BrownSee the [libCEED documentation](https://libceed.readthedocs.io/en/latest/gettingstarted/#backends) for more information on available backends. 41a1cbad85SJed Brown 42a1cbad85SJed Brown## Examples 43a1cbad85SJed Brown 44*7ed177dbSJed BrownExamples of libCEED can be found in the [libCEED repository](https://github.com/CEED/libCEED) under the `examples/rust` directory. 45*7ed177dbSJed Brown 46*7ed177dbSJed Brown## Documentation 47*7ed177dbSJed Brown 48*7ed177dbSJed BrownThis crate uses `katexit` to render equations in the documentation. 49*7ed177dbSJed BrownTo build the [documentation](https://docs.rs/libceed) locally with `katexit` enabled, use 50*7ed177dbSJed Brown 51*7ed177dbSJed Brown```bash 52*7ed177dbSJed Browncargo doc --features=katexit 53*7ed177dbSJed Brown``` 54a1cbad85SJed Brown 55a1cbad85SJed Brown## License: BSD-2-Clause 56a1cbad85SJed Brown 57a1cbad85SJed Brown## Contributing 58a1cbad85SJed Brown 59*7ed177dbSJed BrownThe `libceed` crate is developed within the [libCEED repository](https://github.com/CEED/libCEED). 60*7ed177dbSJed BrownSee the [contributing guidelines](https://libceed.readthedocs.io/en/latest/CONTRIBUTING/) for details. 61