-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
191 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
[build-system] | ||
requires = ["setuptools >= 61.0", "forthon", "numpy"] | ||
build-backend = "setuptools.build_meta:__legacy__" | ||
|
||
[project] | ||
#dynamic = ["version"] | ||
version = "8.1.0-beta.0" | ||
name = "uedge" | ||
dependencies = [ | ||
"forthon", | ||
"numpy", | ||
] | ||
requires-python = ">= 3.5" # TODO: verify | ||
authors = [ | ||
{name = "Tom Rognlien"} | ||
] | ||
maintainers = [ | ||
{name = "Bill Meyer", email = "[email protected]"}, | ||
{name = "Andreas Holm", email = "[email protected]"} | ||
] | ||
description = "2D Fluid simulation of plasma and neutrals in magnetic fusion devices" | ||
readme = "README.md" | ||
keywords = [ | ||
"plasma", | ||
"fusion", | ||
"tokamak", | ||
"edge-plasma", | ||
"scrape-off layer", | ||
"multi-fluid" | ||
] | ||
classifiers = [ | ||
"Intended Audience :: Science/Research", | ||
"License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)", | ||
"Operating System :: Unix", | ||
"Operating System :: MacOS :: MacOS X", | ||
"Programming Language :: Fortran", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
"Topic :: Scientific/Engineering :: Physics", | ||
] | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/LLNL/UEDGE/" | ||
#Documentation = "https://readthedocs.org" | ||
Repository = "https://github.com/LLNL/UEDGE.git" | ||
Issues = "https://github.com/LLNL/UEDGE/issues" | ||
#Changelog = "https://github.com/me/spam/blob/master/CHANGELOG.md" | ||
|
||
|
||
|
||
|
||
[project.optional-dependencies] | ||
ueplot = [ | ||
"matplotlib", | ||
"scipy", | ||
"scikit-image" | ||
] | ||
|
||
# TODO: rewrite scripts to be importable | ||
#[project.scripts] | ||
#spam-cli = "spam:main_cli" | ||
|
||
#[tool.setuptools] | ||
#script-files = [ | ||
# "pyscripts/pdb2hdf5", | ||
# "pyscripts/bas2py", | ||
# "pyscripts/hdf52pdb" | ||
#] | ||
#packages = ["uedge"] | ||
#package-dir = {"" = "pyscripts"} | ||
|
||
|
||
|
||
#[tool.setuptools.dynamic] | ||
#version = {attr = "uedge.__version__"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,29 +10,21 @@ | |
from Forthon.compilers import FCompiler | ||
import getopt | ||
import logging | ||
from subprocess import call | ||
import numpy | ||
from setuptools import Extension, setup, Distribution | ||
from setuptools.command.build import build | ||
from setuptools.command.develop import develop | ||
from setuptools.command.egg_info import egg_info | ||
os.environ['PATH'] += os.pathsep + site.USER_BASE + '/bin' | ||
|
||
version='8.1.0-beta.0' | ||
|
||
try: | ||
os.environ['PATH'] += os.pathsep + site.USER_BASE + '/bin' | ||
import setuptools | ||
import distutils | ||
from distutils.core import setup | ||
from distutils.core import Extension | ||
from distutils.dist import Distribution | ||
from distutils.command.build import build | ||
from distutils.command.install import install | ||
from subprocess import call | ||
import numpy | ||
except: | ||
raise SystemExit("Distutils problem") | ||
|
||
optlist, args = getopt.getopt(sys.argv[1:], 'gt:F:', ['parallel', 'petsc', 'omp']) | ||
|
||
optlist, args = getopt.getopt(sys.argv[1:], 'gt:F:', ['parallel', 'omp']) | ||
machine = sys.platform | ||
debug = 0 | ||
fcomp = None | ||
parallel = 0 | ||
petsc = 0 | ||
#petsc = 0 | ||
|
||
for o in optlist: | ||
if o[0] == '-g': | ||
|
@@ -43,19 +35,19 @@ | |
fcomp = o[1] | ||
elif o[0] == '--parallel': | ||
parallel = 1 | ||
elif o[0] == '--petsc': | ||
petsc = 1 | ||
# elif o[0] == '--petsc': | ||
# petsc = 1 | ||
elif o[0] == '--omp': | ||
os.putenv("OMP","1") | ||
|
||
|
||
|
||
if petsc == 1 and os.getenv('PETSC_DIR') == None: | ||
raise SystemExit("PETSc requested but PETSC_DIR not set") | ||
if os.getenv('PETSC_DIR') != None: | ||
petsc = 1 | ||
if petsc == 1 and os.getenv('PETSC_ARCH') == None: | ||
raise SystemExit("PETSc requested but PETSC_ARCH not set") | ||
#if petsc == 1 and os.getenv('PETSC_DIR') == None: | ||
# raise SystemExit("PETSc requested but PETSC_DIR not set") | ||
#if os.getenv('PETSC_DIR') != None: | ||
# petsc = 1 | ||
#if petsc == 1 and os.getenv('PETSC_ARCH') == None: | ||
# raise SystemExit("PETSc requested but PETSC_ARCH not set") | ||
|
||
|
||
sys.argv = ['setup2.py']+args | ||
|
@@ -64,36 +56,53 @@ | |
fcompname=fcomp) | ||
|
||
|
||
class uedgeInstall(build): | ||
def run(self): | ||
install.run(self) | ||
logging.basicConfig(stream=sys.stderr,level=logging.INFO) | ||
log = logging.getLogger() | ||
log.info("test") | ||
#class uedgeInstall(build): | ||
# def run(self): | ||
# install.run(self) | ||
# logging.basicConfig(stream=sys.stderr,level=logging.INFO) | ||
# log = logging.getLogger() | ||
# log.info("test") | ||
|
||
class uedgeBuild(build): | ||
def run(self): | ||
print("Building UEDGE...") | ||
# with python2 everything is put into a single uedgeC.so file | ||
if sys.hexversion < 0x03000000: | ||
raise SystemExit("Python versions < 3 not supported") | ||
else: | ||
if petsc == 0: | ||
status = call(['make', '-f','Makefile.Forthon']) | ||
else: | ||
status = call(['make', '-f', 'Makefile.PETSc']) | ||
if status != 0: raise SystemExit("Build failure") | ||
# if petsc == 0: | ||
status = call(['make', '-f','Makefile.Forthon']) | ||
# else: | ||
# status = call(['make', '-f', 'Makefile.PETSc']) | ||
if status != 0: | ||
raise SystemExit("Build failure") | ||
build.run(self) | ||
|
||
|
||
class uedgeClean(build): | ||
def run(self): | ||
print("Cleaning UEDGE") | ||
if sys.hexversion < 0x03000000: | ||
raise SystemExit("Python versions < 3 not supported") | ||
else: | ||
if petsc == 0: | ||
status = call(['make', '-f', 'Makefile.Forthon', 'clean']) | ||
else: | ||
status = call(['make', '-f', 'Makefile.PETSc', 'clean']) | ||
if status != 0: raise SystemExit("Clean failure") | ||
# if petsc == 0: | ||
status = call(['make', '-f', 'Makefile.Forthon', 'clean']) | ||
# else: | ||
# status = call(['make', '-f', 'Makefile.PETSc', 'clean']) | ||
if status != 0: | ||
raise SystemExit("Clean failure") | ||
|
||
|
||
class CustomDevelopCommand(develop): | ||
def run(self): | ||
print("Develop called") | ||
develop.run(self) | ||
|
||
|
||
class CustomEggInfoCommand(egg_info): | ||
def run(self): | ||
print("EggInfo called") | ||
egg_info.run(self) | ||
|
||
uedgepkgs = ['aph', 'api', 'bbb', 'com', 'flx', 'grd', 'svr', 'wdf', 'ncl'] | ||
|
||
|
@@ -126,27 +135,27 @@ def makeobjects(pkg): | |
library_dirs = fcompiler.libdirs | ||
libraries = fcompiler.libs | ||
|
||
if petsc: | ||
#if petsc: | ||
# PETSC_DIR = '/homes/mccomic/petsc-uedge' | ||
# PETSC_ARCH = 'linux-uedge' | ||
PETSC_DIR = os.getenv('PETSC_DIR') | ||
PETSC_ARCH = os.getenv('PETSC_ARCH') | ||
library_dirs = fcompiler.libdirs + \ | ||
[os.path.join(PETSC_DIR, PETSC_ARCH, 'lib')] | ||
libraries = ['petscts', 'petscsnes', 'petscksp', 'petscdm', 'petscmat', | ||
'petscvec', 'petsc', 'HYPRE', 'mpich', 'lapack', 'blas', 'X11', | ||
'pthread', 'rt', 'stdc++', 'm'] + fcompiler.libs | ||
libraries = ['petsc'] + fcompiler.libs | ||
# PETSC_DIR = os.getenv('PETSC_DIR') | ||
# PETSC_ARCH = os.getenv('PETSC_ARCH') | ||
# library_dirs = fcompiler.libdirs + \ | ||
# [os.path.join(PETSC_DIR, PETSC_ARCH, 'lib')] | ||
# libraries = ['petscts', 'petscsnes', 'petscksp', 'petscdm', 'petscmat', | ||
# 'petscvec', 'petsc', 'HYPRE', 'mpich', 'lapack', 'blas', 'X11', | ||
# 'pthread', 'rt', 'stdc++', 'm'] + fcompiler.libs | ||
# libraries = ['petsc'] + fcompiler.libs | ||
|
||
if parallel: | ||
library_dirs = fcompiler.libdirs + ['/usr/lpp/ppe.poe/lib'] | ||
libraries = fcompiler.libs + ['mpi'] | ||
# uedgeobjects = uedgeobjects + ['/usr/local/mpi/ifc_farg.o'] | ||
|
||
with open('pyscripts/__version__.py','w') as ff: | ||
ff.write("__version__ = '%s'\n"%version) | ||
with open('pyscripts/__src__.py','w') as ff: | ||
ff.write("__src__ = '%s'\n"%os.getcwd()) | ||
#with open('pyscripts/__version__.py','w') as ff: | ||
# ff.write("__version__ = '%s'\n"%version) | ||
#with open('pyscripts/__src__.py','w') as ff: | ||
# ff.write("__src__ = '%s'\n"%os.getcwd()) | ||
|
||
define_macros=[("WITH_NUMERIC", "0"), | ||
("FORTHON_PKGNAME", '\"uedgeC\"'), | ||
|
@@ -161,37 +170,25 @@ def makeobjects(pkg): | |
libraries = ['readline'] + libraries | ||
|
||
|
||
setup(name="uedge", | ||
version=version, | ||
author='Tom Rognlien', | ||
author_email="[email protected]", | ||
maintainer='Bill Meyer', | ||
maintainer_email='[email protected]', | ||
description="2D Fluid simulation of plasma and neutrals in magnetic fusion devices", | ||
platforms="Unix, Windows (cygwin), Mac OSX", | ||
packages=['uedge'], | ||
package_dir={'uedge': 'pyscripts'}, | ||
# include_package_data=True, | ||
scripts=['pyscripts/pdb2hdf5', 'pyscripts/bas2py', 'pyscripts/hdf52pdb'], | ||
ext_modules=[Extension('uedge.uedgeC', | ||
['uedgeC_Forthon.c', | ||
os.path.join(builddir, 'Forthon.c'), | ||
'com/handlers.c', 'com/vector.c','bbb/exmain.c'], | ||
include_dirs=[builddir, numpy.get_include()], | ||
library_dirs=library_dirs, | ||
libraries=libraries, | ||
define_macros=define_macros, | ||
extra_objects=uedgeobjects, | ||
extra_link_args=['-g','-DFORTHON'] + | ||
fcompiler.extra_link_args, | ||
extra_compile_args=fcompiler.extra_compile_args | ||
)], | ||
|
||
cmdclass={'build': uedgeBuild, 'clean': uedgeClean}, | ||
test_suite="pytests", | ||
install_requires=['forthon'], | ||
# note that include_dirs may have to be expanded in the line above | ||
classifiers=['Programming Language :: Python', | ||
'Programming Language :: Python :: 3'] | ||
|
||
) | ||
setup( | ||
ext_modules=[Extension('uedge.uedgeC', | ||
['uedgeC_Forthon.c', | ||
os.path.join(builddir, 'Forthon.c'), | ||
'com/handlers.c', 'com/vector.c','bbb/exmain.c'], | ||
include_dirs=[builddir, numpy.get_include()], | ||
library_dirs=library_dirs, | ||
libraries=libraries, | ||
define_macros=define_macros, | ||
extra_objects=uedgeobjects, | ||
extra_link_args=['-g','-DFORTHON'] + | ||
fcompiler.extra_link_args, | ||
extra_compile_args=fcompiler.extra_compile_args | ||
)], | ||
cmdclass={ | ||
'build': uedgeBuild, | ||
'clean': uedgeClean, | ||
'develop': CustomDevelopCommand, | ||
'egg_info': CustomEggInfoCommand, | ||
}, | ||
# test_suite="pytests", | ||
) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__src__ = '/Users/holm10/Documents/fusion/uedge/src/master' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def version(): | ||
return "8.1.0-beta.0" |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Methods to create a list of files in a directory, and a sub-list containing sspecified suffixes. | ||
|
||
import os | ||
import string | ||
def filelist(path): | ||
return os.listdir(path) | ||
|
||
def filesublist(path,suffix): | ||
sublist = [] | ||
biglist = filelist(path) | ||
for filename in biglist: | ||
filesplit = filename.split(".") | ||
if filesplit[-1] == suffix: | ||
sublist.append(filename) | ||
return sublist | ||
|
||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.