Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
members = [
"ndelement",
"ndgrid",
"ndfunctionspace",
]
resolver = "2"

[patch.crates-io]
scotch = { git = "https://github.com/mscroggs/scotch-rs.git", branch = "mscroggs/runtime", optional = true }
ndelement = { path = "ndelement" }
ndgrid = { path = "ndgrid" }
ndfunctionspace = { path = "ndfunctionspace" }
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ method.
[![docs.rs](https://img.shields.io/docsrs/ndelement?label=docs.rs)](https://docs.rs/ndelement/latest/ndelement/)
[![PyPI](https://img.shields.io/pypi/v/ndelement?color=blue&label=PyPI&logo=pypi&logoColor=white)](https://pypi.org/project/ndelement/)

ndelement is an open-source library written in Rust that can be used to create finite elements on 1D, 2D, or 3D reference cells.
ndelement is an open-source Rust library for defining and tabulating finite elements on 1D, 2D, or
3D reference cells.

#### Using ndelement
##### Rust
Expand All @@ -37,15 +38,26 @@ python -m pytest ndelement/python/test
### [ndgrid](ndgrid/)
[![crates.io](https://img.shields.io/crates/v/ndgrid?color=blue)](https://crates.io/crates/ndgrid)

ndgrid is an open-source library written in Rust for handling finite element grids/meshes.
ndgrid is an open-source Rust library for handling finite element grids/meshes.

### Using ndgrid
#### Using ndgrid
You can use the latest release of ndgrid by adding the following to `[dependencies]` section of your Cargo.toml file:

```toml
ndgrid = "0.1.5"
```

### [ndfunctionspace](ndfunctionspace/)

ndfunctionspace is an open-source Rust library for creating finite element DOF maps and function spaces.

#### Using ndfunctionspace
You can use the latest version of ndfunctionspace by adding the following to `[dependencies]` section of your Cargo.toml file:

```toml
ndfunctionspace = { git = "https://github.com/bempp/nd.git" }
```

## Documentation
The latest documentation of the crates in this repo is available at
[bempp.github.io/nd/](https://bempp.github.io/nd/).
Expand Down
2 changes: 1 addition & 1 deletion ndelement/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ bempp-quadrature = { version = "0.1.0" }
itertools = "0.14.*"
mpi = { version = "0.8.0", optional = true }
num = "0.4"
rlst = "0.4"
rlst = "0.5"
serde = { version = "1", features = ["derive"], optional = true }
strum = "0.27"
strum_macros = "0.27"
Expand Down
3 changes: 2 additions & 1 deletion ndelement/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
[![docs.rs](https://img.shields.io/docsrs/ndelement?label=docs.rs)](https://docs.rs/ndelement/latest/ndelement/)
[![PyPI](https://img.shields.io/pypi/v/ndelement?color=blue&label=PyPI&logo=pypi&logoColor=white)](https://pypi.org/project/ndelement/)

ndelement is an open-source library written in Rust that can be used to create finite elements on 1D, 2D, or 3D reference cells.
ndelement is an open-source Rust library for defining and tabulating finite elements on 1D, 2D, or
3D reference cells.

## Using ndelement
### Rust
Expand Down
2 changes: 1 addition & 1 deletion ndelement/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! A library for the definition and tabulation of finite elements in Rust.
//! A library for defining and tabulating finite elements on 1D, 2D, or 3D reference cells.
//!
//! `ndelement` provides definition of many frequently used low and high order finite elements
//! and provides routines for the tabulation of their values.
Expand Down
36 changes: 36 additions & 0 deletions ndelement/src/reference_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,42 @@ pub fn entity_types(cell: ReferenceCellType) -> Vec<Vec<ReferenceCellType>> {
}
}

/// The local indices of the subentities of the reference cell, with each entity type indexed separately
pub fn entity_indices(cell: ReferenceCellType) -> Vec<Vec<usize>> {
match cell {
ReferenceCellType::Point => vec![vec![0], vec![], vec![], vec![]],
ReferenceCellType::Interval => vec![vec![0, 1], vec![0], vec![], vec![]],
ReferenceCellType::Triangle => vec![vec![0, 1, 2], vec![0, 1, 2], vec![0], vec![]],
ReferenceCellType::Quadrilateral => {
vec![vec![0, 1, 2, 3], vec![0, 1, 2, 3], vec![0], vec![]]
}
ReferenceCellType::Tetrahedron => vec![
vec![0, 1, 2, 3],
vec![0, 1, 2, 3, 4, 5],
vec![0, 1, 2, 3],
vec![0],
],
ReferenceCellType::Hexahedron => vec![
vec![0, 1, 2, 3, 4, 5, 6, 7],
vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
vec![0, 1, 2, 3, 4, 5],
vec![0],
],
ReferenceCellType::Prism => vec![
vec![0, 1, 2, 3, 4, 5],
vec![0, 1, 2, 3, 4, 5, 6, 7, 8],
vec![0, 0, 1, 2, 1],
vec![0],
],
ReferenceCellType::Pyramid => vec![
vec![0, 1, 2, 3, 4],
vec![0, 1, 2, 3, 4, 5, 6, 7],
vec![0, 0, 1, 2, 3],
vec![0],
],
}
}

/// The number of subentities of each dimension
pub fn entity_counts(cell: ReferenceCellType) -> Vec<usize> {
match cell {
Expand Down
33 changes: 33 additions & 0 deletions ndfunctionspace/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[features]
strict = []

[package]
name = "ndfunctionspace"
version = "0.0.1-dev"
edition = "2024"
authors = [
"Matthew Scroggs <rust@mscroggs.co.uk>",
]
description = "Finite element function spaces."
license = "BSD-3-Clause"
homepage = "https://github.com/bempp/nd"
repository = "https://github.com/bempp/nd"
readme = "README.md"
keywords = ["numerics"]
categories = ["mathematics", "science"]

[lib]
name = "ndfunctionspace"
crate-type = ["lib", "cdylib"]

[dependencies]
ndelement = { path = "../ndelement" }
ndgrid = { path = "../ndgrid" }
itertools = "0.14.*"

[package.metadata.docs.rs]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
rustdoc-args = [ "--html-in-header", "../katex-header.html" ]

[lints.clippy]
wildcard_imports = "forbid"
29 changes: 29 additions & 0 deletions ndfunctionspace/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2025-, Timo Betcke, Matthew Scroggs
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 changes: 30 additions & 0 deletions ndfunctionspace/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# ndfunctionspace

ndfunctionspace is an open-source Rust library for creating finite element DOF maps and function spaces.

## Using ndfunctionspace
You can use the latest release of ndfunctionspace by adding the following to `[dependencies]` section of your Cargo.toml file:

```toml
ndfunctionspace = { git = "https://github.com/bempp/nd.git" }
```

## Documentation
The latest documentation of nfunctionspace is available at [bempp.github.io/nd/rust/ndfunctionspace](https://bempp.github.io/nd/rust/ndfunctionspace/).

## Testing
The Rust functionality of the library can be tested by running:
```bash
cargo test
```

## Examples
Examples of use can be found in the [examples](examples/) folder.

## Getting help
Errors in should be added to the [nd GitHub issue tracker](https://github.com/bempp/nd/issues).

Questions about use can be asked on the [Bempp Discourse](https://bempp.discourse.group).

## Licence
ndfunctionspace is licensed under a BSD 3-Clause licence.
Loading