diff --git a/python/damask/_colormap.py b/python/damask/_colormap.py index ec4000018..e2b317d63 100644 --- a/python/damask/_colormap.py +++ b/python/damask/_colormap.py @@ -10,7 +10,7 @@ import matplotlib.pyplot as plt from matplotlib import cm from PIL import Image -import damask +from . import util from . import Table _eps = 216./24389. @@ -280,7 +280,7 @@ class Colormap(mpl.colors.ListedColormap): colors+=[i]+c out = [{ - 'Creator':f'damask.Colormap v{damask.version}', + 'Creator':util.version_date('Colormap'), 'ColorSpace':'RGB', 'Name':colormap.name, 'DefaultMap':True, @@ -296,7 +296,7 @@ class Colormap(mpl.colors.ListedColormap): def _export_ASCII(colormap,fhandle=None): """Write colormap to ASCII table.""" labels = {'RGBA':4} if colormap.colors.shape[1] == 4 else {'RGB': 3} - t = Table(colormap.colors,labels,f'Creator: damask.Colormap v{damask.version}') + t = Table(colormap.colors,labels,f'Creator: {util.version_date("Colormap")}') if fhandle is None: with open(colormap.name.replace(' ','_')+'.txt', 'w') as f: diff --git a/python/damask/_geom.py b/python/damask/_geom.py index 0f1c35e42..6632eb5ed 100644 --- a/python/damask/_geom.py +++ b/python/damask/_geom.py @@ -1,7 +1,7 @@ import sys import copy -from io import StringIO import multiprocessing +from io import StringIO from functools import partial import numpy as np @@ -45,11 +45,11 @@ class Geom: def __repr__(self): """Basic information on geometry definition.""" return util.srepr([ - f'grid a b c: {util.srepr(self.get_grid ()," x ")}', - f'size x y z: {util.srepr(self.get_size ()," x ")}', - f'origin x y z: {util.srepr(self.get_origin()," ")}', - f'# microstructures: {self.N_microstructure}', - f'max microstructure: {np.nanmax(self.microstructure)}', + f'grid a b c: {util.srepr(self.get_grid ()," x ")}', + f'size x y z: {util.srepr(self.get_size ()," x ")}', + f'origin x y z: {util.srepr(self.get_origin()," ")}', + f'# materialpoints: {self.N_microstructure}', + f'max materialpoint: {np.nanmax(self.microstructure)}', ]) @@ -188,10 +188,7 @@ class Geom: physical size of the microstructure in meter. """ - if size is None: - grid = np.asarray(self.microstructure.shape) - self.size = grid/np.max(grid) - else: + if size is not None: if len(size) != 3 or any(np.array(size) <= 0): raise ValueError(f'Invalid size {size}') else: @@ -272,16 +269,6 @@ class Geom: return self.comments[:] - def get_header(self): - """Return the full header (grid, size, origin, homogenization, comments).""" - header = [f'{len(self.comments)+4} header'] + self.comments - header.append('grid a {} b {} c {}'.format(*self.get_grid())) - header.append('size x {} y {} z {}'.format(*self.get_size())) - header.append('origin x {} y {} z {}'.format(*self.get_origin())) - header.append(f'homogenization {self.get_homogenization()}') - return header - - @staticmethod def from_file(fname): """ @@ -346,31 +333,23 @@ class Geom: @staticmethod - def from_vtk(fname): + def from_vtr(fname): """ - Read a geom from a VTK file. + Read a VTK rectilinear grid. Parameters ---------- - fname : str or file handle + fname : str or or pathlib.Path Geometry file to read. + Valid extension is .vtr, it will be appended if not given. """ - g = VTK.from_file(fname).geom - N_cells = g.GetNumberOfCells() - microstructure = np.zeros(N_cells) - grid = np.array(g.GetDimensions())-1 - bbox = np.array(g.GetBounds()).reshape(3,2).T + v = VTK.from_file(fname if str(fname).endswith('.vtr') else str(fname)+'.vtr') + grid = np.array(v.geom.GetDimensions())-1 + bbox = np.array(v.geom.GetBounds()).reshape(3,2).T size = bbox[1] - bbox[0] - celldata = g.GetCellData() - for a in range(celldata.GetNumberOfArrays()): - if celldata.GetArrayName(a) == 'microstructure': - array = celldata.GetArray(a) - for c in range(N_cells): - microstructure[c] = array.GetValue(c) - - return Geom(microstructure.reshape(grid,order='F'),size,bbox[0]) + return Geom(v.get('materialpoint').reshape(grid,order='F'),size,bbox[0]) @staticmethod @@ -419,8 +398,8 @@ class Geom: else: microstructure = microstructure.reshape(grid) - #ToDo: comments = 'geom.py:from_Laguerre_tessellation v{}'.format(version) - return Geom(microstructure+1,size,homogenization=1) + creator = util.version_date('Geom','from_Laguerre_tessellation') + return Geom(microstructure+1,size,homogenization=1,comments=creator) @staticmethod @@ -444,8 +423,8 @@ class Geom: KDTree = spatial.cKDTree(seeds,boxsize=size) if periodic else spatial.cKDTree(seeds) devNull,microstructure = KDTree.query(coords) - #ToDo: comments = 'geom.py:from_Voronoi_tessellation v{}'.format(version) - return Geom(microstructure.reshape(grid)+1,size,homogenization=1) + creator = util.version_date('Geom','from_Voronoi_tessellation') + return Geom(microstructure.reshape(grid)+1,size,homogenization=1,comments=creator) def to_file(self,fname,pack=None): @@ -460,8 +439,13 @@ class Geom: Compress geometry with 'x of y' and 'a to b'. """ - header = self.get_header() - grid = self.get_grid() + header = [f'{len(self.comments)+4} header'] + self.comments + header.append('grid a {} b {} c {}'.format(*self.get_grid())) + header.append('size x {} y {} z {}'.format(*self.get_size())) + header.append('origin x {} y {} z {}'.format(*self.get_origin())) + header.append(f'homogenization {self.get_homogenization()}') + + grid = self.get_grid() if pack is None: plain = grid.prod()/self.N_microstructure < 250 @@ -492,7 +476,7 @@ class Geom: reps += 1 else: if compressType is None: - f.write('\n'.join(self.get_header())+'\n') + f.write('\n'.join(header)+'\n') elif compressType == '.': f.write(f'{former}\n') elif compressType == 'to': @@ -514,21 +498,22 @@ class Geom: f.write(f'{reps} of {former}\n') - def to_vtk(self,fname=None): + def to_vtr(self,fname=None): """ - Generates vtk file. + Generates vtk rectilinear grid. Parameters ---------- fname : str, optional - Vtk file to write. If no file is given, a string is returned. + Filename to write. If no file is given, a string is returned. + Valid extension is .vtr, it will be appended if not given. """ v = VTK.from_rectilinearGrid(self.grid,self.size,self.origin) - v.add(self.microstructure.flatten(order='F'),'microstructure') + v.add(self.microstructure.flatten(order='F'),'materialpoint') if fname: - v.write(fname) + v.write(fname if str(fname).endswith('.vtr') else str(fname)+'.vtr') else: sys.stdout.write(v.__repr__()) @@ -590,6 +575,7 @@ class Geom: fill_ = np.full_like(self.microstructure,np.nanmax(self.microstructure)+1 if fill is None else fill) ms = np.ma.MaskedArray(fill_,np.logical_not(mask) if inverse else mask) + self.add_comments(util.version_date('Geom','add_primitive')) return self.update(ms) @@ -607,9 +593,7 @@ class Geom: """ valid = {'x','y','z'} - if not all(isinstance(d, str) for d in directions): - raise TypeError('Directions are not of type str.') - elif not set(directions).issubset(valid): + if not set(directions).issubset(valid): raise ValueError(f'Invalid direction {set(directions).difference(valid)} specified.') limits = [None,None] if reflect else [-2,0] @@ -622,11 +606,11 @@ class Geom: if 'x' in directions: ms = np.concatenate([ms,ms[limits[0]:limits[1]:-1,:,:]],0) - #ToDo: self.add_comments('geom.py:mirror v{}'.format(version) + self.add_comments(util.version_date('Geom','mirror')) return self.update(ms,rescale=True) - def scale(self,grid): + def scale(self,grid,periodic=True): """ Scale microstructure to new grid. @@ -634,22 +618,24 @@ class Geom: ---------- grid : numpy.ndarray of shape (3) Number of grid points in x,y,z direction. + periodic : Boolean, optional + Assume geometry to be periodic. Defaults to True. """ - #ToDo: self.add_comments('geom.py:scale v{}'.format(version) + self.add_comments(util.version_date('Geom','scale')) return self.update( ndimage.interpolation.zoom( self.microstructure, grid/self.get_grid(), output=self.microstructure.dtype, order=0, - mode='nearest', + mode=('wrap' if periodic else 'nearest'), prefilter=False ) ) - def clean(self,stencil=3,mode='nearest',selection=None): + def clean(self,stencil=3,selection=None,periodic=True): """ Smooth microstructure by selecting most frequent index within given stencil at each location. @@ -657,11 +643,10 @@ class Geom: ---------- stencil : int, optional Size of smoothing stencil. - mode : string, optional - The mode parameter determines how the input array is extended beyond its boundaries. - Default is 'nearest'. See scipy.ndimage.generic_filter for all options. selection : list, optional Field values that can be altered. Defaults to all. + periodic : Boolean, optional + Assume geometry to be periodic. Defaults to True. """ def mostFrequent(arr,selection=None): @@ -672,12 +657,12 @@ class Geom: else: return me - #ToDo: self.add_comments('geom.py:clean v{}'.format(version) + self.add_comments(util.version_date('Geom','clean')) return self.update(ndimage.filters.generic_filter( self.microstructure, mostFrequent, size=(stencil if selection is None else stencil//2*2+1,)*3, - mode=mode, + mode=('wrap' if periodic else 'nearest'), extra_keywords=dict(selection=selection), ).astype(self.microstructure.dtype) ) @@ -689,7 +674,7 @@ class Geom: for i, oldID in enumerate(np.unique(self.microstructure)): renumbered = np.where(self.microstructure == oldID, i+1, renumbered) - #ToDo: self.add_comments('geom.py:renumber v{}'.format(version) + self.add_comments(util.version_date('Geom','renumber')) return self.update(renumbered) @@ -724,7 +709,7 @@ class Geom: origin = self.origin-(np.asarray(microstructure_in.shape)-self.grid)*.5 * self.size/self.grid - #ToDo: self.add_comments('geom.py:rotate v{}'.format(version) + self.add_comments(util.version_date('Geom','rotate')) return self.update(microstructure_in,origin=origin,rescale=True) @@ -750,14 +735,14 @@ class Geom: np.nanmax(self.microstructure)+1 if fill is None else fill, dtype) - LL = np.clip( offset, 0,np.minimum(self.grid, grid+offset)) # noqa + LL = np.clip( offset, 0,np.minimum(self.grid, grid+offset)) UR = np.clip( offset+grid, 0,np.minimum(self.grid, grid+offset)) ll = np.clip(-offset, 0,np.minimum( grid,self.grid-offset)) ur = np.clip(-offset+self.grid,0,np.minimum( grid,self.grid-offset)) canvas[ll[0]:ur[0],ll[1]:ur[1],ll[2]:ur[2]] = self.microstructure[LL[0]:UR[0],LL[1]:UR[1],LL[2]:UR[2]] - #ToDo: self.add_comments('geom.py:canvas v{}'.format(version) + self.add_comments(util.version_date('Geom','canvas')) return self.update(canvas,origin=self.origin+offset*self.size/self.grid,rescale=True) @@ -777,7 +762,7 @@ class Geom: for from_ms,to_ms in zip(from_microstructure,to_microstructure): substituted[self.microstructure==from_ms] = to_ms - #ToDo: self.add_comments('geom.py:substitute v{}'.format(version) + self.add_comments(util.version_date('Geom','substitute')) return self.update(substituted) @@ -823,5 +808,5 @@ class Geom: extra_keywords={'trigger':trigger}) microstructure = np.ma.MaskedArray(self.microstructure + offset_, np.logical_not(mask)) - #ToDo: self.add_comments('geom.py:vicinity_offset v{}'.format(version) + self.add_comments(util.version_date('Geom','vicinity_offset')) return self.update(microstructure) diff --git a/python/damask/_table.py b/python/damask/_table.py index e8d35c545..b4822bea9 100644 --- a/python/damask/_table.py +++ b/python/damask/_table.py @@ -3,7 +3,6 @@ import re import pandas as pd import numpy as np -from . import version from . import util class Table: @@ -49,7 +48,9 @@ class Table: def _add_comment(self,label,shape,info): if info is not None: - self.comments.append(f'{label}{" "+str(shape) if np.prod(shape,dtype=int) > 1 else ""}: {info}') + specific = f'{label}{" "+str(shape) if np.prod(shape,dtype=int) > 1 else ""}: {info}' + general = util.version_date('Table') + self.comments.append(f'{specific} / {general}') @staticmethod @@ -135,7 +136,7 @@ class Table: content = f.readlines() - comments = [f'table.py:from_ang v{version}'] + comments = [util.version_date('Table','from_ang')] for line in content: if line.startswith('#'): comments.append(line.strip()) diff --git a/python/damask/_vtk.py b/python/damask/_vtk.py index 00aa2f4e9..349e158ca 100644 --- a/python/damask/_vtk.py +++ b/python/damask/_vtk.py @@ -6,8 +6,10 @@ import numpy as np import vtk from vtk.util.numpy_support import numpy_to_vtk as np_to_vtk from vtk.util.numpy_support import numpy_to_vtkIdTypeArray as np_to_vtkIdTypeArray +from vtk.util.numpy_support import vtk_to_numpy as vtk_to_np -import damask +from . import util +from . import environment from . import Table @@ -204,7 +206,18 @@ class VTK: # Check https://blog.kitware.com/ghost-and-blanking-visibility-changes/ for missing data # Needs support for pd.DataFrame and/or table def add(self,data,label=None): - """Add data to either cells or points.""" + """ + Add data to either cells or points. + + Parameters + ---------- + data : numpy.ndarray + Data to add. First dimension need to match either + number of cells or number of points + label : str + Data label. + + """ N_points = self.geom.GetNumberOfPoints() N_cells = self.geom.GetNumberOfCells() @@ -232,10 +245,77 @@ class VTK: raise TypeError + def get(self,label): + """ + Get either cell or point data. + + Cell data takes precedence over point data, i.e. this + function assumes that labels are unique among cell and + point data. + + Parameters + ---------- + label : str + Data label. + + """ + celldata = self.geom.GetCellData() + for a in range(celldata.GetNumberOfArrays()): + if celldata.GetArrayName(a) == label: + return vtk_to_np(celldata.GetArray(a)) + + pointdata = self.geom.GetPointData() + for a in range(celldata.GetNumberOfArrays()): + if pointdata.GetArrayName(a) == label: + return vtk_to_np(pointdata.GetArray(a)) + + raise ValueError(f'array "{label}" not found') + + + def get_comments(self): + """Return the comments.""" + fielddata = self.geom.GetFieldData() + for a in range(fielddata.GetNumberOfArrays()): + if fielddata.GetArrayName(a) == 'comments': + comments = fielddata.GetAbstractArray(a) + return [comments.GetValue(i) for i in range(comments.GetNumberOfValues())] + return [] + + + def set_comments(self,comments): + """ + Set Comments. + + Parameters + ---------- + comments : str or list of str + Comments. + + """ + s = vtk.vtkStringArray() + s.SetName('comments') + for c in [comments] if isinstance(comments,str) else comments: + s.InsertNextValue(c) + self.geom.GetFieldData().AddArray(s) + + + def add_comments(self,comments): + """ + Add Comments. + + Parameters + ---------- + comments : str or list of str + Comments to add. + + """ + self.set_comments(self.get_comments + ([comments] if isinstance(comments,str) else comments)) + + def __repr__(self): """ASCII representation of the VTK data.""" writer = vtk.vtkDataSetWriter() - writer.SetHeader(f'# damask.VTK v{damask.version}') + writer.SetHeader(f'# {util.version_date("VTK")}') writer.WriteToOutputStringOn() writer.SetInputData(self.geom) writer.Write() @@ -261,7 +341,7 @@ class VTK: ren.AddActor(actor) ren.SetBackground(0.2,0.2,0.2) - window.SetSize(damask.environment.screen_size[0],damask.environment.screen_size[1]) + window.SetSize(environment.screen_size[0],environment.screen_size[1]) iren = vtk.vtkRenderWindowInteractor() iren.SetRenderWindow(window) diff --git a/python/damask/solver/_marc.py b/python/damask/solver/_marc.py index 8e96f1b90..12e36f7ed 100644 --- a/python/damask/solver/_marc.py +++ b/python/damask/solver/_marc.py @@ -3,12 +3,12 @@ import shlex import string from pathlib import Path -import damask +from .. import environment class Marc: """Wrapper to run DAMASK with MSCMarc.""" - def __init__(self,version=damask.environment.options['MARC_VERSION']): + def __init__(self,version=environment.options['MARC_VERSION']): """ Create a Marc solver object. @@ -24,7 +24,7 @@ class Marc: @property def library_path(self): - path_MSC = damask.environment.options['MSC_ROOT'] + path_MSC = environment.options['MSC_ROOT'] path_lib = Path(f'{path_MSC}/mentat{self.version}/shlib/linux64') return path_lib if path_lib.is_dir() else None @@ -33,7 +33,7 @@ class Marc: @property def tools_path(self): - path_MSC = damask.environment.options['MSC_ROOT'] + path_MSC = environment.options['MSC_ROOT'] path_tools = Path(f'{path_MSC}/marc{self.version}/tools') return path_tools if path_tools.is_dir() else None @@ -49,7 +49,7 @@ class Marc: ): - usersub = damask.environment.root_dir/'src/DAMASK_marc' + usersub = environment.root_dir/'src/DAMASK_marc' usersub = usersub.parent/(usersub.name + ('.f90' if compile else '.marc')) if not usersub.is_file(): raise FileNotFoundError("DAMASK4Marc ({}) '{}' not found".format(('source' if compile else 'binary'),usersub)) diff --git a/python/damask/util.py b/python/damask/util.py index 733fd0010..f7c40416e 100644 --- a/python/damask/util.py +++ b/python/damask/util.py @@ -9,6 +9,8 @@ from optparse import Option import numpy as np +from . import version + # limit visibility __all__=[ 'srepr', @@ -20,6 +22,7 @@ __all__=[ 'scale_to_coprime', 'return_message', 'extendableOption', + 'version_date' ] #################################################################################################### @@ -175,6 +178,13 @@ def scale_to_coprime(v): return m +def version_date(class_name,function_name=None): + """tbd.""" + _function_name = '' if function_name is None else f'.{function_name}' + now = datetime.datetime.now().astimezone().strftime('%Y-%m-%d %H:%M:%S%z') + return f'damask.{class_name}{_function_name} v{version} ({now})' + + #################################################################################################### # Classes #################################################################################################### diff --git a/python/tests/conftest.py b/python/tests/conftest.py index 87aa9a363..51da90671 100644 --- a/python/tests/conftest.py +++ b/python/tests/conftest.py @@ -1,11 +1,38 @@ from pathlib import Path -import numpy as np +import datetime +import numpy as np import pytest -# Use to monkeypatch damask.version (for comparsion to reference files that contain version information) -def pytest_configure(): - pytest.dummy_version = '99.99.99-9999-pytest' +import damask + + +patched_version = '99.99.99-9999-pytest' +@pytest.fixture +def patch_damask_version(monkeypatch): + """Set damask.version for reproducible tests results.""" + monkeypatch.setattr(damask, 'version', patched_version) + + +patched_date = datetime.datetime(2019, 11, 2, 11, 58, 0) +@pytest.fixture +def patch_datetime_now(monkeypatch): + """Set datetime.datetime.now for reproducible tests results.""" + class mydatetime: + @classmethod + def now(cls): + return patched_date + + monkeypatch.setattr(datetime, 'datetime', mydatetime) + +@pytest.fixture +def version_date(monkeypatch): + """Set damask.util.version_date for reproducible tests results.""" + def version_date(class_name,function_name=None): + _function_name = '' if function_name is None else f'.{function_name}' + return f'damask.{class_name}{_function_name} v{patched_version} ({patched_date})' + + monkeypatch.setattr(damask.util, 'version_date', version_date) def pytest_addoption(parser): diff --git a/python/tests/reference/Colormap/binary.json b/python/tests/reference/Colormap/binary.json index c71d3649b..b8b85f80f 100644 --- a/python/tests/reference/Colormap/binary.json +++ b/python/tests/reference/Colormap/binary.json @@ -1,6 +1,6 @@ [ { - "Creator": "damask.Colormap v99.99.99-9999-pytest", + "Creator": "damask.Colormap v99.99.99-9999-pytest (2019-11-02 11:58:00)", "ColorSpace": "RGB", "Name": "binary", "DefaultMap": true, diff --git a/python/tests/reference/Colormap/binary.txt b/python/tests/reference/Colormap/binary.txt index 976c0202a..ca1d2401f 100644 --- a/python/tests/reference/Colormap/binary.txt +++ b/python/tests/reference/Colormap/binary.txt @@ -1,4 +1,4 @@ -# Creator: damask.Colormap v99.99.99-9999-pytest +# Creator: damask.Colormap v99.99.99-9999-pytest (2019-11-02 11:58:00) 1_RGBA 2_RGBA 3_RGBA 4_RGBA 1.0 1.0 1.0 1.0 0.996078431372549 0.996078431372549 0.996078431372549 1.0 diff --git a/python/tests/reference/Geom/clean.vtr b/python/tests/reference/Geom/clean.vtr new file mode 100644 index 000000000..c76ce3988 --- /dev/null +++ b/python/tests/reference/Geom/clean.vtr @@ -0,0 +1,25 @@ + + + + + + + + + AQAAAACAAAAALQAANQAAAA==eF7t1CECACAMxLBj/380fhYwIyK2spWkmnWgt6b3AF65/avfegAAAAAAAAAAAMy0AfYtC2k= + + + + + AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q== + + + AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4= + + + AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q== + + + + + diff --git a/python/tests/reference/Geom/clean_2_1_False.vtr b/python/tests/reference/Geom/clean_2_1_False.vtr new file mode 100644 index 000000000..c76ce3988 --- /dev/null +++ b/python/tests/reference/Geom/clean_2_1_False.vtr @@ -0,0 +1,25 @@ + + + + + + + + + AQAAAACAAAAALQAANQAAAA==eF7t1CECACAMxLBj/380fhYwIyK2spWkmnWgt6b3AF65/avfegAAAAAAAAAAAMy0AfYtC2k= + + + + + AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q== + + + AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4= + + + AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q== + + + + + diff --git a/python/tests/reference/Geom/clean_2_1_True.vtr b/python/tests/reference/Geom/clean_2_1_True.vtr new file mode 100644 index 000000000..c76ce3988 --- /dev/null +++ b/python/tests/reference/Geom/clean_2_1_True.vtr @@ -0,0 +1,25 @@ + + + + + + + + + AQAAAACAAAAALQAANQAAAA==eF7t1CECACAMxLBj/380fhYwIyK2spWkmnWgt6b3AF65/avfegAAAAAAAAAAAMy0AfYtC2k= + + + + + AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q== + + + AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4= + + + AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q== + + + + + diff --git a/python/tests/reference/Geom/clean_2_2_False.vtr b/python/tests/reference/Geom/clean_2_2_False.vtr new file mode 100644 index 000000000..c2ad86f43 --- /dev/null +++ b/python/tests/reference/Geom/clean_2_2_False.vtr @@ -0,0 +1,25 @@ + + + + + + + + + AQAAAACAAAAALQAAOgAAAA==eF7t1CEOACAMBMHS/z8aXwNJSagYMe6y8jIislgNtTW9d9oD/PL6r6b3AAAAAAAAAAAA4MYGlRYLYA== + + + + + AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q== + + + AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4= + + + AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q== + + + + + diff --git a/python/tests/reference/Geom/clean_2_2_True.vtr b/python/tests/reference/Geom/clean_2_2_True.vtr new file mode 100644 index 000000000..b4d19ebcf --- /dev/null +++ b/python/tests/reference/Geom/clean_2_2_True.vtr @@ -0,0 +1,25 @@ + + + + + + + + + AQAAAACAAAAALQAANwAAAA==eF7t1KERADAMA7Gk+w9dWpYCswiI+R66q6rDzmPa/kj3ALZK/2m6BwAAAAAAAAAAAJMLZrELTQ== + + + + + AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q== + + + AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4= + + + AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q== + + + + + diff --git a/python/tests/reference/Geom/clean_2_None_False.vtr b/python/tests/reference/Geom/clean_2_None_False.vtr new file mode 100644 index 000000000..c76ce3988 --- /dev/null +++ b/python/tests/reference/Geom/clean_2_None_False.vtr @@ -0,0 +1,25 @@ + + + + + + + + + AQAAAACAAAAALQAANQAAAA==eF7t1CECACAMxLBj/380fhYwIyK2spWkmnWgt6b3AF65/avfegAAAAAAAAAAAMy0AfYtC2k= + + + + + AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q== + + + AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4= + + + AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q== + + + + + diff --git a/python/tests/reference/Geom/clean_2_None_True.vtr b/python/tests/reference/Geom/clean_2_None_True.vtr new file mode 100644 index 000000000..fe04087d2 --- /dev/null +++ b/python/tests/reference/Geom/clean_2_None_True.vtr @@ -0,0 +1,25 @@ + + + + + + + + + AQAAAACAAAAALQAAMQAAAA==eF7tzCEOADAMxLDr/v/o8pLSaTMwi1JJCoAvnGHrN7f/AAAAAAAAAAAAeE8DQvkLTQ== + + + + + AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q== + + + AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4= + + + AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q== + + + + + diff --git a/python/tests/reference/Geom/clean_3_1_False.vtr b/python/tests/reference/Geom/clean_3_1_False.vtr new file mode 100644 index 000000000..c76ce3988 --- /dev/null +++ b/python/tests/reference/Geom/clean_3_1_False.vtr @@ -0,0 +1,25 @@ + + + + + + + + + AQAAAACAAAAALQAANQAAAA==eF7t1CECACAMxLBj/380fhYwIyK2spWkmnWgt6b3AF65/avfegAAAAAAAAAAAMy0AfYtC2k= + + + + + AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q== + + + AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4= + + + AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q== + + + + + diff --git a/python/tests/reference/Geom/clean_3_1_True.vtr b/python/tests/reference/Geom/clean_3_1_True.vtr new file mode 100644 index 000000000..c76ce3988 --- /dev/null +++ b/python/tests/reference/Geom/clean_3_1_True.vtr @@ -0,0 +1,25 @@ + + + + + + + + + AQAAAACAAAAALQAANQAAAA==eF7t1CECACAMxLBj/380fhYwIyK2spWkmnWgt6b3AF65/avfegAAAAAAAAAAAMy0AfYtC2k= + + + + + AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q== + + + AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4= + + + AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q== + + + + + diff --git a/python/tests/reference/Geom/clean_3_2_False.vtr b/python/tests/reference/Geom/clean_3_2_False.vtr new file mode 100644 index 000000000..c2ad86f43 --- /dev/null +++ b/python/tests/reference/Geom/clean_3_2_False.vtr @@ -0,0 +1,25 @@ + + + + + + + + + AQAAAACAAAAALQAAOgAAAA==eF7t1CEOACAMBMHS/z8aXwNJSagYMe6y8jIislgNtTW9d9oD/PL6r6b3AAAAAAAAAAAA4MYGlRYLYA== + + + + + AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q== + + + AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4= + + + AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q== + + + + + diff --git a/python/tests/reference/Geom/clean_3_2_True.vtr b/python/tests/reference/Geom/clean_3_2_True.vtr new file mode 100644 index 000000000..b4d19ebcf --- /dev/null +++ b/python/tests/reference/Geom/clean_3_2_True.vtr @@ -0,0 +1,25 @@ + + + + + + + + + AQAAAACAAAAALQAANwAAAA==eF7t1KERADAMA7Gk+w9dWpYCswiI+R66q6rDzmPa/kj3ALZK/2m6BwAAAAAAAAAAAJMLZrELTQ== + + + + + AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q== + + + AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4= + + + AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q== + + + + + diff --git a/python/tests/reference/Geom/clean_3_None_False.vtr b/python/tests/reference/Geom/clean_3_None_False.vtr new file mode 100644 index 000000000..c2ad86f43 --- /dev/null +++ b/python/tests/reference/Geom/clean_3_None_False.vtr @@ -0,0 +1,25 @@ + + + + + + + + + AQAAAACAAAAALQAAOgAAAA==eF7t1CEOACAMBMHS/z8aXwNJSagYMe6y8jIislgNtTW9d9oD/PL6r6b3AAAAAAAAAAAA4MYGlRYLYA== + + + + + AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q== + + + AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4= + + + AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q== + + + + + diff --git a/python/tests/reference/Geom/clean_3_None_True.vtr b/python/tests/reference/Geom/clean_3_None_True.vtr new file mode 100644 index 000000000..b4d19ebcf --- /dev/null +++ b/python/tests/reference/Geom/clean_3_None_True.vtr @@ -0,0 +1,25 @@ + + + + + + + + + AQAAAACAAAAALQAANwAAAA==eF7t1KERADAMA7Gk+w9dWpYCswiI+R66q6rDzmPa/kj3ALZK/2m6BwAAAAAAAAAAAJMLZrELTQ== + + + + + AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q== + + + AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4= + + + AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q== + + + + + diff --git a/python/tests/reference/Geom/clean_4_1_False.vtr b/python/tests/reference/Geom/clean_4_1_False.vtr new file mode 100644 index 000000000..c76ce3988 --- /dev/null +++ b/python/tests/reference/Geom/clean_4_1_False.vtr @@ -0,0 +1,25 @@ + + + + + + + + + AQAAAACAAAAALQAANQAAAA==eF7t1CECACAMxLBj/380fhYwIyK2spWkmnWgt6b3AF65/avfegAAAAAAAAAAAMy0AfYtC2k= + + + + + AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q== + + + AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4= + + + AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q== + + + + + diff --git a/python/tests/reference/Geom/clean_4_1_True.vtr b/python/tests/reference/Geom/clean_4_1_True.vtr new file mode 100644 index 000000000..c76ce3988 --- /dev/null +++ b/python/tests/reference/Geom/clean_4_1_True.vtr @@ -0,0 +1,25 @@ + + + + + + + + + AQAAAACAAAAALQAANQAAAA==eF7t1CECACAMxLBj/380fhYwIyK2spWkmnWgt6b3AF65/avfegAAAAAAAAAAAMy0AfYtC2k= + + + + + AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q== + + + AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4= + + + AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q== + + + + + diff --git a/python/tests/reference/Geom/clean_4_2_False.vtr b/python/tests/reference/Geom/clean_4_2_False.vtr new file mode 100644 index 000000000..7665bdde2 --- /dev/null +++ b/python/tests/reference/Geom/clean_4_2_False.vtr @@ -0,0 +1,25 @@ + + + + + + + + + AQAAAACAAAAALQAANQAAAA==eF7t1CEOACAMBMGj/380Fk+TQjJi7MqtJHVYlypv9wB+0f2+7h4AAAAAAAAAAABM2HWwC1M= + + + + + AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q== + + + AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4= + + + AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q== + + + + + diff --git a/python/tests/reference/Geom/clean_4_2_True.vtr b/python/tests/reference/Geom/clean_4_2_True.vtr new file mode 100644 index 000000000..88a8643d9 --- /dev/null +++ b/python/tests/reference/Geom/clean_4_2_True.vtr @@ -0,0 +1,25 @@ + + + + + + + + + AQAAAACAAAAALQAAJAAAAA==eF7twwEJAAAMBKH7/qWXY6DgqqmqqqqqqqqqqqqqPnhyUwtB + + + + + AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q== + + + AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4= + + + AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q== + + + + + diff --git a/python/tests/reference/Geom/clean_4_None_False.vtr b/python/tests/reference/Geom/clean_4_None_False.vtr new file mode 100644 index 000000000..811d7dc8f --- /dev/null +++ b/python/tests/reference/Geom/clean_4_None_False.vtr @@ -0,0 +1,25 @@ + + + + + + + + + AQAAAACAAAAALQAAOQAAAA==eF7t1CESACAMA8HS/z8aX4OgCGDFuszJZERkMTbU1us9gFO6/+q23moPAAAAAAAAAADAnybPzQto + + + + + AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q== + + + AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4= + + + AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q== + + + + + diff --git a/python/tests/reference/Geom/clean_4_None_True.vtr b/python/tests/reference/Geom/clean_4_None_True.vtr new file mode 100644 index 000000000..88a8643d9 --- /dev/null +++ b/python/tests/reference/Geom/clean_4_None_True.vtr @@ -0,0 +1,25 @@ + + + + + + + + + AQAAAACAAAAALQAAJAAAAA==eF7twwEJAAAMBKH7/qWXY6DgqqmqqqqqqqqqqqqqPnhyUwtB + + + + + AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q== + + + AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4= + + + AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q== + + + + + diff --git a/python/tests/reference/Geom/clean_stencil=1.geom b/python/tests/reference/Geom/clean_stencil=1.geom deleted file mode 100644 index 3e6f6fe9c..000000000 --- a/python/tests/reference/Geom/clean_stencil=1.geom +++ /dev/null @@ -1,25 +0,0 @@ -4 header -grid a 8 b 5 c 4 -size x 8e-06 y 5e-06 z 4e-06 -origin x 0.0 y 0.0 z 0.0 -homogenization 1 - 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 - 2 3 4 5 6 7 8 9 -10 11 12 13 14 15 16 17 -18 19 20 21 22 23 24 25 -26 27 28 29 30 31 32 33 -34 35 36 37 38 39 40 41 - 2 2 2 2 2 2 2 2 - 2 2 2 2 2 2 2 2 - 2 2 2 2 2 2 2 2 - 2 2 2 2 2 2 2 2 - 2 2 2 2 2 2 2 2 - 1 2 3 4 5 6 7 8 - 9 10 11 12 13 14 15 16 -17 18 19 20 21 22 23 24 -25 26 27 28 29 30 31 32 -33 34 35 36 37 38 39 40 diff --git a/python/tests/reference/Geom/clean_stencil=2.geom b/python/tests/reference/Geom/clean_stencil=2.geom deleted file mode 100644 index 14c1fa5e2..000000000 --- a/python/tests/reference/Geom/clean_stencil=2.geom +++ /dev/null @@ -1,25 +0,0 @@ -4 header -grid a 8 b 5 c 4 -size x 8e-06 y 5e-06 z 4e-06 -origin x 0.0 y 0.0 z 0.0 -homogenization 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -2 2 2 2 2 2 2 2 -2 2 2 2 2 2 2 2 -2 2 2 2 2 2 2 2 -2 2 2 2 2 2 2 2 -2 2 2 2 2 2 2 2 -1 2 2 2 2 2 2 2 -2 2 2 2 2 2 2 2 -2 2 2 2 2 2 2 2 -2 2 2 2 2 2 2 2 -2 2 2 2 2 2 2 2 diff --git a/python/tests/reference/Geom/clean_stencil=3.geom b/python/tests/reference/Geom/clean_stencil=3.geom deleted file mode 100644 index 3aea8ffa5..000000000 --- a/python/tests/reference/Geom/clean_stencil=3.geom +++ /dev/null @@ -1,25 +0,0 @@ -4 header -grid a 8 b 5 c 4 -size x 8e-06 y 5e-06 z 4e-06 -origin x 0.0 y 0.0 z 0.0 -homogenization 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -2 2 1 1 1 1 1 1 -2 2 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -2 2 2 2 2 2 2 2 -2 2 2 2 2 2 2 2 -2 2 2 2 2 2 2 2 -2 2 2 2 2 2 2 2 -2 2 2 2 2 2 2 2 -2 2 2 2 2 2 2 2 -2 2 2 2 2 2 2 2 -2 2 2 2 2 2 2 2 -2 2 2 2 2 2 2 2 -2 2 2 2 2 2 2 2 diff --git a/python/tests/reference/Geom/clean_stencil=4.geom b/python/tests/reference/Geom/clean_stencil=4.geom deleted file mode 100644 index 595e04b23..000000000 --- a/python/tests/reference/Geom/clean_stencil=4.geom +++ /dev/null @@ -1,25 +0,0 @@ -4 header -grid a 8 b 5 c 4 -size x 8e-06 y 5e-06 z 4e-06 -origin x 0.0 y 0.0 z 0.0 -homogenization 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -2 2 2 2 1 1 1 1 -2 2 2 2 1 1 1 1 -2 2 2 2 1 1 1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -2 2 2 2 2 2 2 2 -2 2 2 2 2 2 2 2 -2 2 2 2 2 2 2 2 -2 2 2 2 2 2 2 2 -2 2 2 2 2 2 2 2 diff --git a/python/tests/test_Colormap.py b/python/tests/test_Colormap.py index b3309f12b..870ff9761 100644 --- a/python/tests/test_Colormap.py +++ b/python/tests/test_Colormap.py @@ -7,7 +7,6 @@ import pytest from PIL import Image from PIL import ImageChops -import damask from damask import Colormap @pytest.fixture @@ -17,8 +16,11 @@ def reference_dir(reference_dir_base): class TestColormap: - def test_conversion(self): + @pytest.fixture(autouse=True) + def _version_date(self, version_date): + print('patched damask.util.version_date') + def test_conversion(self): specials = np.array([[0.,0.,0.], [1.,0.,0.], [0.,1.,0.], @@ -29,7 +31,6 @@ class TestColormap: [1.,1.,1.] ]) rgbs = np.vstack((specials,np.random.rand(100,3))) - pass # class not integrated for rgb in rgbs: print('rgb',rgb) @@ -150,8 +151,7 @@ class TestColormap: ('GOM','.legend'), ('Gmsh','.msh') ]) - def test_compare_reference(self,format,ext,tmpdir,reference_dir,update,monkeypatch): - monkeypatch.setattr(damask, 'version', pytest.dummy_version) + def test_compare_reference(self,format,ext,tmpdir,reference_dir,update): name = 'binary' c = Colormap.from_predefined(name) if update: diff --git a/python/tests/test_Geom.py b/python/tests/test_Geom.py index 4fb1ae00a..479dd43fc 100644 --- a/python/tests/test_Geom.py +++ b/python/tests/test_Geom.py @@ -1,6 +1,10 @@ +import os +import time + import pytest import numpy as np +from damask import VTK from damask import Geom from damask import Rotation from damask import util @@ -47,31 +51,47 @@ class TestGeom: def test_write_read_str(self,default,tmpdir): - default.to_file(str(tmpdir.join('default.geom'))) - new = Geom.from_file(str(tmpdir.join('default.geom'))) + default.to_file(str(tmpdir/'default.geom')) + new = Geom.from_file(str(tmpdir/'default.geom')) assert geom_equal(new,default) def test_write_read_file(self,default,tmpdir): - with open(tmpdir.join('default.geom'),'w') as f: + with open(tmpdir/'default.geom','w') as f: default.to_file(f) - with open(tmpdir.join('default.geom')) as f: + with open(tmpdir/'default.geom') as f: new = Geom.from_file(f) assert geom_equal(new,default) def test_write_show(self,default,tmpdir): - with open(tmpdir.join('str.geom'),'w') as f: + with open(tmpdir/'str.geom','w') as f: f.write(default.show()) - with open(tmpdir.join('str.geom')) as f: + with open(tmpdir/'str.geom') as f: new = Geom.from_file(f) assert geom_equal(new,default) - def test_export_vtk(self,default,tmpdir): - default.to_vtk(str(tmpdir.join('default'))) + def test_read_write_vtr(self,default,tmpdir): + default.to_vtr(tmpdir/'default') + for _ in range(10): + time.sleep(.2) + if os.path.exists(tmpdir/'default.vtr'): break + + new = Geom.from_vtr(tmpdir/'default.vtr') + assert geom_equal(new,default) + + def test_invalid_vtr(self,tmpdir): + v = VTK.from_rectilinearGrid(np.random.randint(5,10,3)*2,np.random.random(3) + 1.0) + v.write(tmpdir/'no_materialpoint.vtr') + for _ in range(10): + time.sleep(.2) + if os.path.exists(tmpdir/'no_materialpoint.vtr'): break + with pytest.raises(ValueError): + Geom.from_vtr(tmpdir/'no_materialpoint.vtr') + @pytest.mark.parametrize('pack',[True,False]) def test_pack(self,default,tmpdir,pack): - default.to_file(tmpdir.join('default.geom'),pack=pack) - new = Geom.from_file(tmpdir.join('default.geom')) + default.to_file(tmpdir/'default.geom',pack=pack) + new = Geom.from_file(tmpdir/'default.geom') assert geom_equal(new,default) def test_invalid_combination(self,default): @@ -115,14 +135,24 @@ class TestGeom: if update: modified.to_file(reference) assert geom_equal(modified,Geom.from_file(reference)) + @pytest.mark.parametrize('directions',[(1,2,'y'),('a','b','x'),[1]]) + def test_mirror_invalid(self,default,directions): + with pytest.raises(ValueError): + default.mirror(directions) + @pytest.mark.parametrize('stencil',[1,2,3,4]) - def test_clean(self,default,update,reference_dir,stencil): - modified = default.copy() - modified.clean(stencil) - tag = f'stencil={stencil}' - reference = reference_dir/f'clean_{tag}.geom' - if update: modified.to_file(reference) - assert geom_equal(modified,Geom.from_file(reference)) + @pytest.mark.parametrize('selection',[None,1,2]) + @pytest.mark.parametrize('periodic',[True,False]) + def test_clean(self,update,reference_dir,stencil,selection,periodic): + current = Geom.from_vtr((reference_dir/'clean').with_suffix('.vtr')) + current.clean(stencil,None if selection is None else [selection],periodic) + reference = reference_dir/f'clean_{stencil}_{selection}_{periodic}' + if update and stencil !=1: + current.to_vtr(reference) + for _ in range(10): + time.sleep(.2) + if os.path.exists(reference.with_suffix('.vtr')): break + assert geom_equal(current,Geom.from_vtr(reference if stencil !=1 else reference_dir/'clean')) @pytest.mark.parametrize('grid',[ (10,11,10), diff --git a/python/tests/test_Orientation.py b/python/tests/test_Orientation.py index 4987f1f1f..636eeb0c4 100644 --- a/python/tests/test_Orientation.py +++ b/python/tests/test_Orientation.py @@ -4,7 +4,7 @@ from itertools import permutations import pytest import numpy as np -import damask +from damask import Table from damask import Rotation from damask import Orientation from damask import Lattice @@ -68,7 +68,7 @@ class TestOrientation: {'label':'blue', 'RGB':[0,0,1],'direction':[1,1,1]}]) @pytest.mark.parametrize('lattice',['fcc','bcc']) def test_IPF_cubic(self,color,lattice): - cube = damask.Orientation(damask.Rotation(),lattice) + cube = Orientation(Rotation(),lattice) for direction in set(permutations(np.array(color['direction']))): assert np.allclose(cube.IPF_color(np.array(direction)),np.array(color['RGB'])) @@ -104,15 +104,15 @@ class TestOrientation: eu = np.array([o.rotation.as_Eulers(degrees=True) for o in ori.related(model)]) if update: coords = np.array([(1,i+1) for i,x in enumerate(eu)]) - table = damask.Table(eu,{'Eulers':(3,)}) + table = Table(eu,{'Eulers':(3,)}) table.add('pos',coords) table.to_ASCII(reference) - assert np.allclose(eu,damask.Table.from_ASCII(reference).get('Eulers')) + assert np.allclose(eu,Table.from_ASCII(reference).get('Eulers')) @pytest.mark.parametrize('lattice',Lattice.lattices) def test_disorientation360(self,lattice): R_1 = Orientation(Rotation(),lattice) - R_2 = Orientation(damask.Rotation.from_Eulers([360,0,0],degrees=True),lattice) + R_2 = Orientation(Rotation.from_Eulers([360,0,0],degrees=True),lattice) assert np.allclose(R_1.disorientation(R_2).as_matrix(),np.eye(3)) @pytest.mark.parametrize('lattice',Lattice.lattices) @@ -127,6 +127,6 @@ class TestOrientation: def test_from_average(self,lattice): R_1 = Orientation(Rotation.from_random(),lattice) eqs = [r for r in R_1.equivalent] - R_2 = damask.Orientation.from_average(eqs) + R_2 = Orientation.from_average(eqs) assert np.allclose(R_1.rotation.quaternion,R_2.rotation.quaternion) diff --git a/python/tests/test_Result.py b/python/tests/test_Result.py index 53bcdda9d..6000f50f9 100644 --- a/python/tests/test_Result.py +++ b/python/tests/test_Result.py @@ -8,8 +8,9 @@ import pytest import numpy as np import h5py -import damask from damask import Result +from damask import Rotation +from damask import Orientation from damask import mechanics from damask import grid_filters @@ -174,7 +175,7 @@ class TestResult: crystal_structure = default.get_crystal_structure() in_memory = np.empty((qu.shape[0],3),np.uint8) for i,q in enumerate(qu): - o = damask.Orientation(q,crystal_structure).reduced + o = Orientation(q,crystal_structure).reduced in_memory[i] = np.uint8(o.IPF_color(np.array(d))*255) in_file = default.read_dataset(loc['color']) assert np.allclose(in_memory,in_file) @@ -233,7 +234,7 @@ class TestResult: default.add_pole('orientation',pole,polar) loc = {'orientation': default.get_dataset_location('orientation'), 'pole': default.get_dataset_location('p^{}_[1 0 0)'.format(u'rφ' if polar else 'xy'))} - rot = damask.Rotation(default.read_dataset(loc['orientation']).view(np.double)) + rot = Rotation(default.read_dataset(loc['orientation']).view(np.double)) rotated_pole = rot * np.broadcast_to(pole,rot.shape+(3,)) xy = rotated_pole[:,0:2]/(1.+abs(pole[2])) in_memory = xy if not polar else \