From c29e3650f384a4944786562a077e855012a666bc Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 30 Oct 2020 22:24:27 +0100 Subject: [PATCH 1/7] don't squeeze into scalar --- python/damask/_configmaterial.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/damask/_configmaterial.py b/python/damask/_configmaterial.py index 0f8d4efa1..febeca64c 100644 --- a/python/damask/_configmaterial.py +++ b/python/damask/_configmaterial.py @@ -69,8 +69,8 @@ class ConfigMaterial(Config): _,idx = np.unique(np.hstack(list({**constituents_,**kwargs_}.values())),return_index=True,axis=0) idx = np.sort(idx) - constituents_ = {k:v[idx].squeeze() for k,v in constituents_.items()} - kwargs_ = {k:v[idx].squeeze() for k,v in kwargs_.items()} + constituents_ = {k:np.atleast_1d(v[idx].squeeze()) for k,v in constituents_.items()} + kwargs_ = {k:np.atleast_1d(v[idx].squeeze()) for k,v in kwargs_.items()} return ConfigMaterial().material_add(constituents_,**kwargs_) From aecf2f539e6c941c2c380b7eac3276102879059d Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 30 Oct 2020 22:26:02 +0100 Subject: [PATCH 2/7] allow one homogenization quite useless ... --- python/damask/_configmaterial.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/damask/_configmaterial.py b/python/damask/_configmaterial.py index febeca64c..ed45f2662 100644 --- a/python/damask/_configmaterial.py +++ b/python/damask/_configmaterial.py @@ -268,6 +268,7 @@ class ConfigMaterial(Config): @staticmethod def _constituents(N=1,**kwargs): """Construct list of constituents.""" + N_material=1 for v in kwargs.values(): if hasattr(v,'__len__') and not isinstance(v,str): N_material = len(v) From cf740a279e811dab52b27e3e746d2e8aeb39af9b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 31 Oct 2020 09:56:43 +0100 Subject: [PATCH 3/7] combine constant with varying data --- python/tests/test_ConfigMaterial.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/tests/test_ConfigMaterial.py b/python/tests/test_ConfigMaterial.py index d0bcd2a56..0f2b6a90c 100644 --- a/python/tests/test_ConfigMaterial.py +++ b/python/tests/test_ConfigMaterial.py @@ -87,3 +87,7 @@ class TestConfigMaterial: c = m['constituents'][0] assert m['c'] == 1 and c['b'] == 0 and c['a'] == [i,1] + def test__constituents(self): + c = ConfigMaterial._constituents(c=1,v=[2,3]) + assert c[0][0]['c'] == c[1][0]['c'] == 1 + assert c[0][0]['v'] == c[1][0]['v'] -1 ==2 From 7df3563ced9290bd277bcebfaca60d7e0550bbe0 Mon Sep 17 00:00:00 2001 From: Test User Date: Sat, 31 Oct 2020 11:30:09 +0100 Subject: [PATCH 4/7] [skip ci] updated version information after successful test of v3.0.0-alpha-609-g657d7b06b --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 002deaea7..9d16c2ea2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v3.0.0-alpha-594-g46e5023f8 +v3.0.0-alpha-609-g657d7b06b From 67f69fc8a5cd46f8338c85454a2aaf0b5493c7f6 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 31 Oct 2020 17:23:58 +0100 Subject: [PATCH 5/7] data is consecutive --- python/damask/_geom.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/python/damask/_geom.py b/python/damask/_geom.py index 48f022805..d3b375bf6 100644 --- a/python/damask/_geom.py +++ b/python/damask/_geom.py @@ -266,13 +266,9 @@ class Geom: labels_ = [labels] if isinstance(labels,str) else labels unique,unique_inverse = np.unique(np.hstack([table.get(l) for l in labels_]),return_inverse=True,axis=0) - if len(unique) == grid.prod(): - ma = np.arange(grid.prod()) - else: - from_ma = pd.unique(unique_inverse) - sort_idx = np.argsort(from_ma) - idx = np.searchsorted(from_ma,unique_inverse,sorter = sort_idx) - ma = np.arange(from_ma.size)[sort_idx][idx] + + ma = np.arange(grid.prod()) if len(unique) == grid.prod() else \ + np.arange(unique.size)[np.argsort(pd.unique(unique_inverse))][unique_inverse] return Geom(ma.reshape(grid,order='F'),size,origin,util.execution_stamp('Geom','from_table')) From d89fad61359d1b7ca3071672a31e721d33fb4382 Mon Sep 17 00:00:00 2001 From: Vitesh Shah Date: Sat, 31 Oct 2020 19:32:49 +0100 Subject: [PATCH 6/7] Store value of MSC_VERSION in variable of same name --- env/DAMASK.csh | 2 +- .../apply_DAMASK_modifications.py | 32 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/env/DAMASK.csh b/env/DAMASK.csh index 5529eac23..cc61449d2 100644 --- a/env/DAMASK.csh +++ b/env/DAMASK.csh @@ -51,4 +51,4 @@ else setenv PYTHONPATH $DAMASK_ROOT/python:$PYTHONPATH endif setenv MSC_ROOT -setenv MARC_VERSION +setenv MSC_VERSION diff --git a/installation/mods_MarcMentat/apply_DAMASK_modifications.py b/installation/mods_MarcMentat/apply_DAMASK_modifications.py index 51f5e2312..407c33558 100755 --- a/installation/mods_MarcMentat/apply_DAMASK_modifications.py +++ b/installation/mods_MarcMentat/apply_DAMASK_modifications.py @@ -7,15 +7,15 @@ from pathlib import Path import damask -marc_version = float(damask.environment.options['MSC_VERSION']) -if int(marc_version) == marc_version: - marc_version = int(marc_version) +msc_version = float(damask.environment.options['MSC_VERSION']) +if int(msc_version) == msc_version: + msc_version = int(msc_version) msc_root = Path(damask.environment.options['MSC_ROOT']) damask_root = damask.environment.root_dir parser = argparse.ArgumentParser( description='Apply DAMASK modification to MSC.Marc/Mentat', - epilog = f'MSC_ROOT={msc_root} and MSC_VERSION={marc_version} (from {damask_root}/env/CONFIG)') + epilog = f'MSC_ROOT={msc_root} and MSC_VERSION={msc_version} (from {damask_root}/env/CONFIG)') parser.add_argument('--editor', dest='editor', metavar='string', default='vi', help='Name of the editor for MSC.Mentat (executable)') @@ -24,7 +24,7 @@ def copy_and_replace(in_file,dst): with open(in_file) as f: content = f.read() content = content.replace('%INSTALLDIR%',str(msc_root)) - content = content.replace('%VERSION%',str(marc_version)) + content = content.replace('%VERSION%',str(msc_version)) content = content.replace('%EDITOR%', parser.parse_args().editor) with open(dst/Path(in_file).name,'w') as f: f.write(content) @@ -32,36 +32,36 @@ def copy_and_replace(in_file,dst): print('adapting Marc tools...\n') -src = damask_root/f'installation/mods_MarcMentat/{marc_version}/Marc_tools' -dst = msc_root/f'marc{marc_version}/tools' +src = damask_root/f'installation/mods_MarcMentat/{msc_version}/Marc_tools' +dst = msc_root/f'marc{msc_version}/tools' for in_file in glob.glob(str(src/'*damask*')) + [str(src/'include_linux64')]: copy_and_replace(in_file,dst) print('adapting Mentat scripts and menus...\n') -src = damask_root/f'installation/mods_MarcMentat/{marc_version}/Mentat_bin' -dst = msc_root/f'mentat{marc_version}/bin' +src = damask_root/f'installation/mods_MarcMentat/{msc_version}/Mentat_bin' +dst = msc_root/f'mentat{msc_version}/bin' for in_file in glob.glob(str(src/'*[!.original]')): copy_and_replace(in_file,dst) -src = damask_root/f'installation/mods_MarcMentat/{marc_version}/Mentat_menus' -dst = msc_root/f'mentat{marc_version}/menus' +src = damask_root/f'installation/mods_MarcMentat/{msc_version}/Mentat_menus' +dst = msc_root/f'mentat{msc_version}/menus' for in_file in glob.glob(str(src/'job_run.ms')): copy_and_replace(in_file,dst) print('compiling Mentat menu binaries...') -executable = str(msc_root/f'mentat{marc_version}/bin/mentat') -menu_file = str(msc_root/f'mentat{marc_version}/menus/linux64/main.msb') +executable = str(msc_root/f'mentat{msc_version}/bin/mentat') +menu_file = str(msc_root/f'mentat{msc_version}/menus/linux64/main.msb') os.system(f'xvfb-run {executable} -compile {menu_file}') print('setting file access rights...\n') -for pattern in [msc_root/f'marc{marc_version}/tools/*damask*', - msc_root/f'mentat{marc_version}/bin/submit?', - msc_root/f'mentat{marc_version}/bin/kill?']: +for pattern in [msc_root/f'marc{msc_version}/tools/*damask*', + msc_root/f'mentat{msc_version}/bin/submit?', + msc_root/f'mentat{msc_version}/bin/kill?']: for f in glob.glob(str(pattern)): os.chmod(f,0o755) From a15304f8b721b06bdadead6a0d9ca3a2711a0095 Mon Sep 17 00:00:00 2001 From: Test User Date: Sun, 1 Nov 2020 05:09:32 +0100 Subject: [PATCH 7/7] [skip ci] updated version information after successful test of v3.0.0-alpha-615-gfce116aa8 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 9d16c2ea2..ee4230d4f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v3.0.0-alpha-609-g657d7b06b +v3.0.0-alpha-615-gfce116aa8