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

Attempt at python f2py wrapping #627

Draft
wants to merge 20 commits into
base: develop
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### ignore EGSnrc configuration generated files
egs_home/
egs_homebin/
egsnrc_mp/
mortjob.mortran
*.mortlst
Expand Down
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/ambv/black
rev: 19.10b0
hooks:
- id: black
language_version: python3.7
- repo: https://github.com/SimonBiggs/nbstripout
rev: 0a4fa37151ce3c2fb522bf64469224c831a41773
hooks:
- id: nbstripout
5 changes: 5 additions & 0 deletions HEN_HOUSE/python/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
egsnrc.f
*.pyc
__pycache__
dist
.ipynb_checkpoints
53 changes: 53 additions & 0 deletions HEN_HOUSE/python/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
###############################################################################
#
# Copyright (C) 2020 Simon Biggs
# Copyright (C) 2015 National Research Council Canada
#
# This file is part of EGSnrc.
#
# EGSnrc is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# EGSnrc is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
# more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with EGSnrc. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
#
# Author: Iwan Kawrakow, 2003
#
# Contributors: Frederic Tessier, Simon Biggs
#
###############################################################################

include $(EGS_CONFIG)

export PYTHON_BUILD = cpython-37m-x86_64-linux-gnu
export COMPILED_FILE = egsnrc/_egsnrc.$(PYTHON_BUILD).so

all : $(COMPILED_FILE)

SOURCES = \
$(EGS_SOURCEDIR)egsnrc.macros \
$(MACHINE_MACROS) \
$(RANDOM).macros \
./user-stubs.mortran \
$(RANDOM).mortran \
$(EGS_SOURCEDIR)nrcaux.mortran \
$(MACHINE_MORTRAN) \
./egs_utilities.mortran \
$(EGS_SOURCEDIR)egsnrc.mortran

egsnrc/_egsnrc.%.so :
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use PYTHON_BUILD here

$(MORTRAN_EXE) -s -d $(MORTRAN_DATA) -f $(SOURCES) $< -o7 ./egsnrc/egsnrc.f -o8 egsnrc.mortlst
poetry run python -m numpy.f2py -c ./egsnrc/egsnrc.f -m _egsnrc --debug-capi --debug
mv _egsnrc.$(PYTHON_BUILD).so $@

clean :
rm $(COMPILED_FILE)
Loading