Crate libceed

source ·
Expand description

libceed: efficient, extensible discretization

GitHub Actions Documentation

This crate provides an interface to libCEED, which is a performance-portable library for extensible element-based discretization for partial differential equations and related computational problems. The formulation is algebraic and intended to be lightweight and easy to incorporate in higher level abstractions. See the libCEED user manual for details on interface concepts and extensive examples.

libCEED operator decomposition


To call libCEED from a Rust package, the following Cargo.toml can be used.

libceed = "0.12.0"

For a development version of the libCEED Rust bindings, use the following Cargo.toml.

libceed = { git = "", branch = "main" }
extern crate libceed;

fn main() -> libceed::Result<()> {
    let ceed = libceed::Ceed::init("/cpu/self/ref");
    let xc = ceed.vector_from_slice(&[0., 0.5, 1.0])?;
    let xs = xc.view()?;
    assert_eq!(xs[..], [0., 0.5, 1.0]);

This crate provides modules for each object, but they are usually created from the Ceed object as with the vector above. The resource string passed to Ceed::init is used to identify the “backend”, which includes algorithmic strategies and hardware such as NVIDIA and AMD GPUs. See the libCEED documentation for more information on available backends.


Examples of libCEED can be found in the libCEED repository under the examples/rust directory.


This crate uses katexit to render equations in the documentation. To build the documentation locally with katexit enabled, use

cargo doc --features=katexit

License: BSD-2-Clause


The libceed crate is developed within the libCEED repository. See the contributing guidelines for details.


  • A Ceed Basis defines the discrete finite element basis and associated quadrature rule.
  • A Ceed ElemRestriction decomposes elements and groups the degrees of freedom (dofs) according to the different elements they belong to.
  • A Ceed Operator defines the finite/spectral element operator associated to a Ceed QFunction. A Ceed Operator connects Ceed ElemRestrictions, Ceed Bases, and Ceed QFunctions.
  • A Ceed QFunction represents the spatial terms of the point-wise functions describing the physics at the quadrature points.
  • A Ceed Vector constitutes the main data structure and serves as input/output for Ceed Operators.


  • A Ceed is a library context representing control of a logical hardware resource.
  • libCEED error messages - returning an Error without painc!ing indicates the function call failed but the data is not corrupted


  • Type of basis shape to create non-tensor H1 element basis
  • Basis evaluation mode
  • Many Ceed interfaces take or return pointers to memory. This enum is used to specify where the memory being provided or requested must reside.
  • Denotes type of vector norm to be computed
  • Type of quadrature; also used for location of nodes
  • Denotes whether a linear transformation or its transpose should be applied


Type Aliases