Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnaf-tahmid-chowdhury committed May 24, 2024
2 parents 62430be + a5f9f7c commit a64082b
Show file tree
Hide file tree
Showing 6 changed files with 64,796 additions and 106 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
main:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true

- name: Apt dependencies
shell: bash
run: |
sudo apt -y update
sudo apt install -y libgcc-9-dev \
libstdc++-9-dev \
libembree-dev \
python3-dev \
libhdf5-dev \
libeigen3-dev \
cmake
- name: Python dependencies
shell: bash
run: |
pip3 install numpy \
cython==0.29.37 \
scipy \
matplotlib \
h5py \
pytest \
pytest-cov \
codecov
- name: Build MOAB
shell: bash
run: |
cd ~
git clone https://bitbucket.org/fathomteam/moab.git
cd moab
git checkout 5.5.1
mkdir build
cd build
cmake -DENABLE_HDF5=ON -DENABLE_BLASLAPACK=OFF -DENABLE_PYMOAB=ON -DCMAKE_INSTALL_PREFIX=$HOME/opt -DCMAKE_BUILD_TYPE=Release ..
make -j4
make install
cd pymoab
pip3 install .
- name: Install
shell: bash
run: |
pip install .
- name: Test
shell: bash
run: |
pytest -v .
- name: tmate debug
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
*~
*.h5m
__pycache__

# Python distribution
.settings/
dist/
pydagmc.egg-info/

# emacs and vim backups
*~
*.swp

# Source build
build
34 changes: 26 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# PyDAGMC

A convenience interface for examining and reassigning metadata in DAGMC models with PyMOAB.
PyDAGMC is a Python interface for interacting with DAGMC .h5m files through the embedded topological relationships and metadata contained within. These interactions occur through a set of Python classes corresponding to DAGMC’s metadata Group (a grouping of volumes or surfaces), Volume, and Surface groupings in the mesh database. This interface is intended to provide a simple interface for obtaining information about DAGMC models, replacing significant boilerplate code required to perform the same queries with PyMOAB, the Python interface for MOAB itself.

PyDAGMC classes provide the ability to perform basic queries as properties of the class instances. These queries include:

- number of entities contained within a group
- volume and surface relationships
- number of triangles contained underneath any class instance
- triangle connectivity and coordinates underneath any class instance
- movement of volumes or surfaces into and out of groups
- VTK file generation for all triangles contained under any class instance


# Example

Expand All @@ -9,14 +19,20 @@ Code:
```python
import dagmc

groups = dagmc.Group.groups_from_file('dagmc.h5m')
print(groups)
model = dagmc.DAGModel('dagmc.h5m')

group_dict = model.groups_by_name
print(group_dict)

fuel_group = groups['mat:fuel']

v1 = fuel_group.get_volumes()[1]
v1 = fuel_group.volumes_by_id[1]

print(v1)

new_group = dagmc.Group.create(model, name="my_new_group", group_id=10)
print(new_group)

```
Output:

Expand All @@ -37,17 +53,19 @@ Volume IDs:
}

Volume 1, 4092 triangles

Group 10, Name: my_new_group
```

Code:

```python
# move volume 1 from the fuel group to the group "mat:41"
groups['mat:fuel'].remove_set(v1)
groups['mat:41'].add_set(v1)
group_dict['mat:fuel'].remove_set(v1)
group_dict['mat:41'].add_set(v1)

print(groups['mat:fuel'])
print(groups['mat:41'])
print(group_dict['mat:fuel'])
print(group_dict['mat:41'])
```

Output:
Expand Down
Loading

0 comments on commit a64082b

Please sign in to comment.