shell variables are more robust
they will also work if Fortran and python code are installed in different locations.
This commit is contained in:
parent
2cd5d96a90
commit
37de561938
|
@ -87,10 +87,12 @@ if [ ! -z "$PS1" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export OMP_NUM_THREADS
|
export OMP_NUM_THREADS
|
||||||
|
export MSC_ROOT
|
||||||
|
export MSC_VERSION
|
||||||
|
export DAMASK_ROOT
|
||||||
export PYTHONPATH=$DAMASK_ROOT/python:$PYTHONPATH
|
export PYTHONPATH=$DAMASK_ROOT/python:$PYTHONPATH
|
||||||
|
|
||||||
for var in BASE STAT SOLVER BRANCH; do
|
for var in BASE STAT SOLVER BRANCH; do
|
||||||
unset "${var}"
|
unset "${var}"
|
||||||
done
|
done
|
||||||
unset "ENV_ROOT"
|
unset "ENV_ROOT"
|
||||||
unset "DAMASK_ROOT"
|
|
||||||
|
|
|
@ -81,10 +81,12 @@ if [ ! -z "$PS1" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export OMP_NUM_THREADS
|
export OMP_NUM_THREADS
|
||||||
|
export MSC_ROOT
|
||||||
|
export MSC_VERSION
|
||||||
|
export DAMASK_ROOT
|
||||||
export PYTHONPATH=$DAMASK_ROOT/python:$PYTHONPATH
|
export PYTHONPATH=$DAMASK_ROOT/python:$PYTHONPATH
|
||||||
|
|
||||||
for var in SOLVER BRANCH; do
|
for var in SOLVER BRANCH; do
|
||||||
unset "${var}"
|
unset "${var}"
|
||||||
done
|
done
|
||||||
unset "ENV_ROOT"
|
unset "ENV_ROOT"
|
||||||
unset "DAMASK_ROOT"
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ msc_version = float(damask.environment.options['MSC_VERSION'])
|
||||||
if int(msc_version) == msc_version:
|
if int(msc_version) == msc_version:
|
||||||
msc_version = int(msc_version)
|
msc_version = int(msc_version)
|
||||||
msc_root = Path(damask.environment.options['MSC_ROOT'])
|
msc_root = Path(damask.environment.options['MSC_ROOT'])
|
||||||
damask_root = damask.environment.root_dir
|
damask_root = damask.environment.options['DAMASK_ROOT']
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description='Apply DAMASK modification to MSC.Marc/Mentat',
|
description='Apply DAMASK modification to MSC.Marc/Mentat',
|
||||||
|
|
|
@ -26,13 +26,7 @@ class Environment:
|
||||||
@property
|
@property
|
||||||
def options(self):
|
def options(self):
|
||||||
options = {}
|
options = {}
|
||||||
for item in ['MSC_ROOT', 'MSC_VERSION']:
|
for item in ['DAMASK_ROOT', 'MSC_ROOT', 'MSC_VERSION']:
|
||||||
options[item] = os.environ[item] if item in os.environ else None
|
options[item] = os.environ[item] if item in os.environ else None
|
||||||
|
|
||||||
return options
|
return options
|
||||||
|
|
||||||
|
|
||||||
@property
|
|
||||||
def root_dir(self):
|
|
||||||
"""Return DAMASK root path."""
|
|
||||||
return Path(__file__).parents[2]
|
|
||||||
|
|
|
@ -180,7 +180,7 @@ class Test:
|
||||||
|
|
||||||
def fileInRoot(self,dir,file):
|
def fileInRoot(self,dir,file):
|
||||||
"""Path to a file in the root directory of DAMASK."""
|
"""Path to a file in the root directory of DAMASK."""
|
||||||
return str(damask.environment.root_dir/dir/file)
|
return str(damask.environment.options['DAMASK_ROOT']/dir/file)
|
||||||
|
|
||||||
|
|
||||||
def fileInReference(self,file):
|
def fileInReference(self,file):
|
||||||
|
|
|
@ -54,7 +54,7 @@ class Marc:
|
||||||
optimization = '',
|
optimization = '',
|
||||||
):
|
):
|
||||||
|
|
||||||
usersub = environment.root_dir/'src/DAMASK_marc'
|
usersub = environment.options['DAMASK_ROOT']/'src/DAMASK_marc'
|
||||||
usersub = usersub.parent/(usersub.name + ('.f90' if compile else '.marc'))
|
usersub = usersub.parent/(usersub.name + ('.f90' if compile else '.marc'))
|
||||||
if not usersub.is_file():
|
if not usersub.is_file():
|
||||||
raise FileNotFoundError(f'subroutine ({"source" if compile else "binary"}) "{usersub}" not found')
|
raise FileNotFoundError(f'subroutine ({"source" if compile else "binary"}) "{usersub}" not found')
|
||||||
|
|
Loading…
Reference in New Issue