Skip to content

Commit

Permalink
Merge pull request #13 from autotwin/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
mrbuche authored Jul 3, 2024
2 parents 1b9a246 + 0dbf7e0 commit 8bec377
Show file tree
Hide file tree
Showing 22 changed files with 510 additions and 126 deletions.
45 changes: 0 additions & 45 deletions .github/workflows/pypi.yml

This file was deleted.

73 changes: 73 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Python
on:
pull_request:
branches: main
release:
types: published
jobs:
test:
if: github.event_name != 'release'
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
runs-on: ${{ matrix.os }}
steps:
- name: checkout
uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.79.0
default: true
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: maturin
run: pip install maturin
- name: build
run: maturin build --release --features python
- name: install
run: pip install --find-links=target/wheels/ automesh[develop]
- name: pycodestyle
run: pycodestyle --verbose .
- name: pytest
run: pytest --verbose .
wheels:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.79.0
default: true
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: maturin
run: pip install maturin
- name: build
run: maturin build --release --features python
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.python-version }}-wheel
path: target/wheels
twine:
needs: wheels
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
- name: check
run: |
mkdir -p wheelhouse/
mv ./*-wheel*/*.whl wheelhouse/
pip install twine
twine check wheelhouse/*.whl
- name: upload
if: github.event_name == 'release'
run: twine upload -u __token__ -p ${{ secrets.PYPI_TOKEN }} wheelhouse/*.whl
47 changes: 47 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Rust
on:
pull_request:
branches: main
release:
types: published
env:
CARGO_TERM_COLOR: always
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
runs-on: ${{ matrix.os }}
steps:
- name: checkout
uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
components: clippy, rustfmt
default: true
toolchain: 1.79.0
- name: build
run: cargo build --release
- name: clippy
run: cargo clippy --release -- -D warnings
- name: doc
run: cargo doc --release
- name: fmt
run: cargo fmt --all -- --check
- name: test
run: cargo test --release
package:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: package
run: cargo package
- name: login
if: github.event_name == 'release'
run: cargo login ${{ secrets.CRATES_IO_TOKEN }}
- name: publish
if: github.event_name == 'release'
run: cargo publish
19 changes: 0 additions & 19 deletions .github/workflows/test.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# ignore virtual environment
.venv/

# Generated by Cargo
# will have compiled files and executables
debug/
Expand All @@ -15,3 +18,5 @@ Cargo.lock

**.whl
*.vscode
**__pycache__
**.pytest_cache
10 changes: 7 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
authors = ["Chad Brian Hovey <chovey@sandia.gov>", "Michael Robert Buche <mrbuche@sandia.gov>"]
categories = ["mathematics", "science"]
description = "automesh"
documentation = "https://github.com/autotwin/automesh"
documentation = "https://docs.rs/automesh"
edition = "2021"
homepage = "https://github.com/autotwin/automesh"
keywords = ["mesh"]
Expand All @@ -12,10 +12,14 @@ repository = "https://github.com/autotwin/automesh"
version = "0.1.2"

[lib]
crate-type = ["cdylib"]
crate-type = ["cdylib", "rlib"]

[dependencies]
pyo3 = {version = "=0.22", features = ["extension-module"]}
numpy = {version = "=0.21", optional = true}
pyo3 = {version = "=0.21", features = ["extension-module"], optional = true}

[features]
python = ["dep:numpy", "dep:pyo3"]

[profile.release]
codegen-units = 1
Expand Down
22 changes: 22 additions & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# README

* [Exodus II file format](exodus.md)


## Discussions

### 2024-07-03

* weekly interval pair programming Wed 1100-1300 EST (0900-1100 MST)
* repo updates
* pre-commit, prevent a local from commiting prior to push
* maturin, PyO3 is the rust package for Python binding in Rust, and muturin is the packager
* iterators are great, https://doc.rust-lang.org/std/iter/trait.Iterator.html

```bash
python -m pip install --upgrade pip
pip install maturin
maturin develop --release --extras dev
# pip install pre-commit # already installed with maturin
pre-commit install
```
128 changes: 128 additions & 0 deletions doc/exodus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Exodus II

## Excerpts from Schoof-1994[^Schoof-1994]:

"EXODUS II is a model developed to store and retrieve data for finite element analyses. It is used for preprocesing (problem definition), postprocessing (results visualization), as well as code to code data transfer. An EXODUS II data file is a random access, machine independent binary file..."

EXODUS II depends on the Network Common Data Form ([NetCDF](https://www.unidata.ucar.edu/software/netcdf/)) library.

NetCDF is a public domain database library that provides low-level data storage. The NetCDF library stores data in eXternal Data Representation (XDR) format, which provides machine independency.

EXODUS II library functions provide a map between finite element data objects and NetCDF dimensions, attributes, and variables.

EXODUS II data objects:

* Initialization Data
* Number of nodes
* Number of elements
* *optional* informational text
* et cetera
* Model - static objects (i.e., objects that do not change over time)
* Nodal coordinates
* Element connectivity
* Node sets
* Side sets
* *optional* Results
* Nodal results
* Element results
* Global results

Note: automesh will use Initialization Data and Model sections; it will not use the Results section.

Quadrilateral | Hexahedral
:---: | :---:
![exodus_quad_node_numbering](fig/exodus_quad_node_numbering.png) | ![exodus_hex_node_numbering](fig/exodus_hex_node_numbering.png)

> Figure 1: EXODUS II node numbering scheme for quadrilateral and hexahedral finite elements.
Quadrilateral | Hexahedral
:---: | :---:
![exodus_quad_sideset_numbering](fig/exodus_quad_sideset_numbering.png) | ![exodus_hex_sideset_numbering](fig/exodus_hex_sideset_numbering.png)

> Figure 2: EXODUS II sideset numbering scheme for quadrilateral and hexahedral finite elements.
## Pattern

```bash
------
Test 1
------
nsd = 2
nelx = nely = 1
y
^
3| 4
*-----*
|4 3|
| (1) |
|1 2|
*-----* --> x
1 2
connectivity
1 2 4 3

------
Test 2
------
nelx = 2
nely = 1
y
^
4| 5 6
*-----*-----*
|4 3|4 3|
| (1) | (2) |
|1 2|1 2|
*-----*-----* --> x
1 2 3
connectivity
1 2 5 4
2 3 6 5

------
Test 3
------
nelx = 3
nely = 1
y
^
5| 6 7 8
*-----*-----*-----*
|4 3|4 3|4 3|
| (1) | (2) | (3) |
|1 2|1 2|1 2|
*-----*-----*-----* --> x
1 2 3 4
connectivity
1 2 6 5
2 3 7 6
3 4 8 7

------
Test 4
------
nelx = 2
nely = 2
y
^
7| 8 9
*-----*-----*
|4 3|4 3|
| (3) | (4) |
|1 2|1 2|
4*-----*-----*6
|4 3|4 3|
| (1) | (2) |
|1 2|1 2|
*-----*-----* --> x
1 2 3
connectivity
1 2 5 4
2 3 6 4
4 6 8 7
5 6 9 8
```

## References

[^Schoof-1994]: Schoof LA, Yarberry VR. EXODUS II: a finite element data model. Sandia National Lab.(SNL-NM), Albuquerque, NM (United States); 1994 Sep 1. [link](https://www.osti.gov/biblio/10102115)
Binary file added doc/fig/exodus_hex_node_numbering.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/fig/exodus_hex_sideset_numbering.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/fig/exodus_quad_node_numbering.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/fig/exodus_quad_sideset_numbering.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8bec377

Please sign in to comment.