Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge dev into main #171

Merged
merged 48 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
b335ccc
Add a github workflow that prevents PRs to main that is not comming f…
AlvaroCubi Apr 26, 2024
2dbf3ef
Fix to position of additional cylindrical surface used to limit torus…
teade Apr 26, 2024
d87a241
camel case for all classes (#95)
shimwell Apr 26, 2024
35c8210
Snake case variables (PR 1 of several) (#98)
shimwell Apr 26, 2024
77c9ac1
using is to compare with bool (#99)
shimwell Apr 26, 2024
12ec904
Add comments to Geometry.py and booleanFunction.py files (#101)
psauvan Apr 26, 2024
bf061fa
Specific imports instead of wild card (#100)
shimwell Apr 26, 2024
d8ba484
solve issue #75 in getTransMatrix function (#103)
psauvan Apr 27, 2024
8e2fd7f
Changes in users initialization (#102)
psauvan Apr 28, 2024
bb0365d
Adding formatter to CI to keep code in PEP8 (#104)
shimwell Apr 30, 2024
cf94454
f strings instead of .format (#106)
shimwell Apr 30, 2024
ff9cdb3
Snake case variables (PR 2 of several) (#105)
shimwell Apr 30, 2024
c61442b
Quicker tests for ci (#109)
shimwell Apr 30, 2024
1a3fc5e
added draft template (#97)
shimwell Apr 30, 2024
f63259a
Removing unused code (#107)
shimwell Apr 30, 2024
30b46ea
Testing writing inputs for more MC codes (#108)
shimwell Apr 30, 2024
302e51e
Snake case functions (#115)
shimwell May 1, 2024
956000d
duplicate import openmc (#116)
alberto743 May 1, 2024
1970ce7
Sphinx based docs with CI action to build and hosted on gh-pages (#119)
shimwell May 2, 2024
27293c1
Add issue templates (#112)
alexvalentine94 May 3, 2024
280bcfe
Trigger docs build on push only (#126)
shimwell May 3, 2024
2585d36
added missing = sign (#130)
shimwell May 8, 2024
7bee7a3
added missing package (#135)
shimwell May 8, 2024
6ffff58
replaced print statements with log (#133)
shimwell May 8, 2024
34c7aee
Fixing logger commands (#137)
shimwell May 8, 2024
6e083e7
removal of Options as global variable (#138)
shimwell May 9, 2024
0abbe2c
removal of Tolerances as global variable (#139)
shimwell May 10, 2024
6cd7d28
Numerical format to normal class (#141)
shimwell May 10, 2024
17d4500
Improving docs install section (#145)
shimwell May 10, 2024
68a0fd4
testing the setting of all class arguments (#147)
shimwell May 13, 2024
daff329
Adding getters setters type checking to Options, Tolerances, NumericF…
shimwell May 13, 2024
287142e
Add settings class (#149)
shimwell May 14, 2024
3c5f2db
Adding export csg method (#150)
shimwell May 14, 2024
372317e
Adding support for json config file (#152)
shimwell May 14, 2024
de20ef9
Adding command line tool including documentation and testing (#155)
shimwell May 14, 2024
58abcb9
removed duplication between readme and docs (#156)
shimwell May 14, 2024
d7953ce
Moving code from __init__ file to core.py (#157)
shimwell May 14, 2024
882fc7f
Fixing issue 154 (#158)
shimwell May 14, 2024
a5be6f5
added missing args bug (#159)
shimwell May 14, 2024
c502d10
added description of solid being decomposed (#161)
shimwell May 14, 2024
0a3c544
Context managers for writing try 2 (#160)
shimwell May 14, 2024
4a9ad24
Creating folder if needed (#162)
shimwell May 15, 2024
3da2897
setting line length to 128 (#163)
shimwell May 15, 2024
6daf2e3
Lower case folder names and files (#165)
shimwell May 15, 2024
276ffb9
openmc_py and openmc_xml lower case (#166)
shimwell May 15, 2024
73bcf1e
Added type checking on export csg (#167)
shimwell May 15, 2024
723a797
Merge branch 'main' into dev
AlvaroCubi May 16, 2024
4b9af24
Adding windows install instructions (#169)
shimwell May 16, 2024
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
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[Feature request] - title of the issue"
labels: enhancement
assignees: ''

---

# Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is.

# Describe the solution you'd like
A clear and concise description of what you want to happen.

# Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

# Additional context
Add any other context or screenshots about the feature request here.
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/improve_documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Improve documentation
about: Help us improve our documentation
title: "[DOC] - title of the issue"
labels: documentation
assignees: ''

---

# What were you looking for
Please try to describe in a concise way which kind of information you were looking for and where were you looking.

# Is the information available in the doc but not where you would expect?
let us know if you ended up finding the information you were looking for in another (unexpected) section of the doc.

# Is information completely lacking or partial?
please specify if you are asking for better explanation/clarification of the text or if the information is completely lacking.

# Where would you insert the missing information?
describe here where you would put the information.

# Additional context
you can use this space to give any other additional information that you think would be useful to solve the issue.
17 changes: 17 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
If you are a first-time contributor to GEOUNED, please read our contributing guidelines:
https://github.com/GEOUNED-org/GEOUNED/blob/main/CONTRIBUTING.md

# Description

Please include a summary of the changes and motivation for the changes

# Fixes issue

Please link to any issues that this PR fixes

# Checklist

- [ ] I'm making a PR from a feature branch on my fork into GEOUNED-org/GEOUNED/dev branch
- [ ] I have followed [PEP8 style guide]([url](https://peps.python.org/pep-0008/)) for Python or run a formatter such as [black]([url](https://github.com/psf/black)) or [ruff format]([url](https://github.com/astral-sh/ruff)) on my code
- [ ] I have made corresponding changes to the documentation
- [ ] I have added tests that prove my fix is effective or that my feature works
12 changes: 12 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Lint

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: psf/black@stable
with:
version: "24.4.2"
14 changes: 12 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ on:
branches:
- dev
- main
paths-ignore:
- "**.md"
- "**.txt"
- "**.cff"
- 'docs/**'
- '.gitignore'
push:
branches:
- main
Expand Down Expand Up @@ -44,13 +50,17 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install .
geouned_cadtocsg --help
python -c 'import geouned'
python -c 'from geouned import GEOUNED'
python -c 'from geouned import CadToCsg'
python -c 'from geouned.GEOReverse import reverse'
python -m pip install .[tests]

- name: testing GEOUNED functionality
run: python -m pytest -v tests/test_convert.py
run: |
python -m pytest -v tests/test_convert.py
geouned_cadtocsg -i tests/config_complete_defaults.json
geouned_cadtocsg -i tests/config_non_defaults.json

- name: install openmc
if: ${{ matrix.os == 'ubuntu-latest'}}
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: documentation

on:
pull_request:
branches:
- dev
- main
push:
branches:
- main
- dev

permissions:
contents: write

jobs:
testing:
name: Documentation
runs-on: "ubuntu-latest"
defaults:
run:
shell: bash -el {0}
strategy:
matrix:
python-version: ["3.11"]
steps:
- name: checkout actions
uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
channels: conda-forge

- name: install dependencies
run: conda install -c conda-forge freecad -y

- name: install package
run: |
pip install --upgrade pip
pip install .[docs]
- name: Sphinx build
run: |
sphinx-build docs _build
- name: Deploy to GitHub Pages
if: github.event_name == 'push'
uses: peaceiris/actions-gh-pages@v4
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: _build/
force_orphan: true
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Upload Python Package
name: PyPI Python Package

on:
release:
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,16 @@ cython_debug/
# testing folder
tests_outputs/

# debug output folders
fuzzySurfaces
Suspicious_solids/
Warning_Solids_definition.txt

.vscode
**/__pycache__

# documentation
_build
docs/source/_build/**
docs/build/**
docs/source/_autosummary/*
Expand Down
78 changes: 5 additions & 73 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,82 +1,14 @@
[![CI testing](https://github.com/GEOUNED-org/GEOUNED/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/GEOUNED-org/GEOUNED/actions/workflows/ci.yml)
[![Upload Python Package](https://github.com/GEOUNED-org/GEOUNED/actions/workflows/python-publish.yml/badge.svg)](https://github.com/GEOUNED-org/GEOUNED/actions/workflows/python-publish.yml)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black)
[![documentation](https://github.com/GEOUNED-org/GEOUNED/actions/workflows/documentation.yml/badge.svg)](https://github.com/GEOUNED-org/GEOUNED/actions/workflows/documentation.yml)


# GEOUNED
A tool to convert from CAD to CSG & CSG to CAD for Monte Carlo transport codes (MCNP & OpenMC).
This repository contains the implementation of the algorithm presented in the paper [GEOUNED: A new conversion tool from CAD to Monte Carlo geometry](https://doi.org/10.1016/j.net.2024.01.052).

## Installation

Install directly from the repository (for python versions > 3.7 => FreeCAD >= 0.19 ):

```bash
pip install git+https://github.com/GEOUNED-code/GEOUNED.git
```

Otherwise, the source code included in the ~src/ folder can be directly downloaded and properly reached by path variable as follows:

```python
import sys
GEO_path='the path in your local computer'
sys.path.append('GEO_path')
```

the same should be made for FreeCAD libraries. You can also define appropriately the PYTHONPATH variable for both modules.

If you are using FreeCAD in windows there is included a python distribution within FreeCAD distribution (by default located in C:\Program Files\FreeCAD 0.XX\bin\).
In that case you can install directly de module using:

```bash
C:\Program Files\FreeCAD 0.XX\bin\python.exe -m pip install git+https://github.com/GEOUNED-code/GEOUNED.git
```
using this option you have directly access to both FreeCAD and GEOUNED python modules.
Furthermore, using this python compatibilities problems between different versions of python are avoided (some dynamic libraries of FreeCAD depends on the version of python used during the built process).

## How to use

The code is used via python scripting.

The first step is to call the python modules of both FreeCAD and GEOUNED (this can be avoided if you have installed GEOUNED as commented in the previous section and using the python distributed with FreeCAD).

```python
import sys
GEO_path='the path in your local computer, the complete or relative path to the ~src/ folder'
FreeCAD_path='path of FreeCAD python modules'
sys.path.append(GEO_path)
sys.path.append(FreeCAD_path)
```
The second step is to call or GEOUNED for CAD to CSG conversion or GEOReverse for CSG to CAD.

From CAD to CSG:

```python
from geouned import GEOUNED
inifile='Name of config file for forward conversion'
GEO = GEOUNED(inifile)
GEO.SetOptions()
GEO.Start()
```
From CSG to CAD (so far only for MCNP):

```python
from GEOReverse.reverse import reverse
inifile='Name of config file for reverse conversion'
reverse(inifile)
```
In the ~scripts/ folder you can find a script (geouned for linux or geouned.py for windows) to call both modules directly by command line as follows:

windows (forward and reverse):
```bash
/~>python geouned.py file_config_name
/~>python geouned.py -r file_config_name
```

linux (forward and reverse):
```bash
/~>geouned file_config_name
/~>geouned -r file_config_name
```

Detailed descriptions of all options of the config files (forward and reverse) are given in the manual located in ~docs/ folder.
See the [online documentation](https://geouned-org.github.io/GEOUNED/index.html) for installation, usage and API reference.

## Citation

Expand Down
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
67 changes: 67 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys

sys.path.insert(0, os.path.abspath("../../src"))

# -- Project information -----------------------------------------------------

project = "GEOUNED"
copyright = "2024, UNED"
author = "Juan-Pablo Catalan and Patrick Sauvan"

# The full version, including alpha/beta/rc tags
release = "1.0.1"


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx_autodoc_typehints",
"sphinx.ext.coverage",
"sphinx.ext.napoleon",
"sphinx.ext.doctest",
"sphinx.ext.viewcode",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]

html_context = {
"display_github": True,
}
# html_favicon = "favicon.ico"
4 changes: 4 additions & 0 deletions docs/developer_guide.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Developer guide
===============

TOOD
File renamed without changes.
20 changes: 20 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.. GEOUNED documentation master file, created by
sphinx-quickstart on Tue Apr 30 09:47:11 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

GEOUNED
=======

GEOUNED converts CAD to Constructive Solid Geometry (CSG) formats for use in
Monte Carlo transport codes.
Supported codes include OpenMC, PHITS, Serpent and MCNP.

.. toctree::
:maxdepth: 3

install/index
usage/index
python_api
methodology
developer_guide
Loading