Merge branch 'increase-geom-test-coverage' into 'development'

Increase geom test coverage

See merge request damask/DAMASK!204
This commit is contained in:
Franz Roters 2020-08-25 14:40:42 +02:00
commit cdc9f07838
36 changed files with 728 additions and 219 deletions

View File

@ -10,7 +10,7 @@ import matplotlib.pyplot as plt
from matplotlib import cm from matplotlib import cm
from PIL import Image from PIL import Image
import damask from . import util
from . import Table from . import Table
_eps = 216./24389. _eps = 216./24389.
@ -280,7 +280,7 @@ class Colormap(mpl.colors.ListedColormap):
colors+=[i]+c colors+=[i]+c
out = [{ out = [{
'Creator':f'damask.Colormap v{damask.version}', 'Creator':util.version_date('Colormap'),
'ColorSpace':'RGB', 'ColorSpace':'RGB',
'Name':colormap.name, 'Name':colormap.name,
'DefaultMap':True, 'DefaultMap':True,
@ -296,7 +296,7 @@ class Colormap(mpl.colors.ListedColormap):
def _export_ASCII(colormap,fhandle=None): def _export_ASCII(colormap,fhandle=None):
"""Write colormap to ASCII table.""" """Write colormap to ASCII table."""
labels = {'RGBA':4} if colormap.colors.shape[1] == 4 else {'RGB': 3} 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: if fhandle is None:
with open(colormap.name.replace(' ','_')+'.txt', 'w') as f: with open(colormap.name.replace(' ','_')+'.txt', 'w') as f:

View File

@ -1,7 +1,7 @@
import sys import sys
import copy import copy
from io import StringIO
import multiprocessing import multiprocessing
from io import StringIO
from functools import partial from functools import partial
import numpy as np import numpy as np
@ -48,8 +48,8 @@ class Geom:
f'grid a b c: {util.srepr(self.get_grid ()," x ")}', f'grid a b c: {util.srepr(self.get_grid ()," x ")}',
f'size x y z: {util.srepr(self.get_size ()," x ")}', f'size x y z: {util.srepr(self.get_size ()," x ")}',
f'origin x y z: {util.srepr(self.get_origin()," ")}', f'origin x y z: {util.srepr(self.get_origin()," ")}',
f'# microstructures: {self.N_microstructure}', f'# materialpoints: {self.N_microstructure}',
f'max microstructure: {np.nanmax(self.microstructure)}', f'max materialpoint: {np.nanmax(self.microstructure)}',
]) ])
@ -188,10 +188,7 @@ class Geom:
physical size of the microstructure in meter. physical size of the microstructure in meter.
""" """
if size is None: if size is not None:
grid = np.asarray(self.microstructure.shape)
self.size = grid/np.max(grid)
else:
if len(size) != 3 or any(np.array(size) <= 0): if len(size) != 3 or any(np.array(size) <= 0):
raise ValueError(f'Invalid size {size}') raise ValueError(f'Invalid size {size}')
else: else:
@ -272,16 +269,6 @@ class Geom:
return self.comments[:] 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 @staticmethod
def from_file(fname): def from_file(fname):
""" """
@ -346,31 +333,23 @@ class Geom:
@staticmethod @staticmethod
def from_vtk(fname): def from_vtr(fname):
""" """
Read a geom from a VTK file. Read a VTK rectilinear grid.
Parameters Parameters
---------- ----------
fname : str or file handle fname : str or or pathlib.Path
Geometry file to read. Geometry file to read.
Valid extension is .vtr, it will be appended if not given.
""" """
g = VTK.from_file(fname).geom v = VTK.from_file(fname if str(fname).endswith('.vtr') else str(fname)+'.vtr')
N_cells = g.GetNumberOfCells() grid = np.array(v.geom.GetDimensions())-1
microstructure = np.zeros(N_cells) bbox = np.array(v.geom.GetBounds()).reshape(3,2).T
grid = np.array(g.GetDimensions())-1
bbox = np.array(g.GetBounds()).reshape(3,2).T
size = bbox[1] - bbox[0] size = bbox[1] - bbox[0]
celldata = g.GetCellData() return Geom(v.get('materialpoint').reshape(grid,order='F'),size,bbox[0])
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])
@staticmethod @staticmethod
@ -419,8 +398,8 @@ class Geom:
else: else:
microstructure = microstructure.reshape(grid) microstructure = microstructure.reshape(grid)
#ToDo: comments = 'geom.py:from_Laguerre_tessellation v{}'.format(version) creator = util.version_date('Geom','from_Laguerre_tessellation')
return Geom(microstructure+1,size,homogenization=1) return Geom(microstructure+1,size,homogenization=1,comments=creator)
@staticmethod @staticmethod
@ -444,8 +423,8 @@ class Geom:
KDTree = spatial.cKDTree(seeds,boxsize=size) if periodic else spatial.cKDTree(seeds) KDTree = spatial.cKDTree(seeds,boxsize=size) if periodic else spatial.cKDTree(seeds)
devNull,microstructure = KDTree.query(coords) devNull,microstructure = KDTree.query(coords)
#ToDo: comments = 'geom.py:from_Voronoi_tessellation v{}'.format(version) creator = util.version_date('Geom','from_Voronoi_tessellation')
return Geom(microstructure.reshape(grid)+1,size,homogenization=1) return Geom(microstructure.reshape(grid)+1,size,homogenization=1,comments=creator)
def to_file(self,fname,pack=None): def to_file(self,fname,pack=None):
@ -460,7 +439,12 @@ class Geom:
Compress geometry with 'x of y' and 'a to b'. Compress geometry with 'x of y' and 'a to b'.
""" """
header = self.get_header() 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() grid = self.get_grid()
if pack is None: if pack is None:
@ -492,7 +476,7 @@ class Geom:
reps += 1 reps += 1
else: else:
if compressType is None: if compressType is None:
f.write('\n'.join(self.get_header())+'\n') f.write('\n'.join(header)+'\n')
elif compressType == '.': elif compressType == '.':
f.write(f'{former}\n') f.write(f'{former}\n')
elif compressType == 'to': elif compressType == 'to':
@ -514,21 +498,22 @@ class Geom:
f.write(f'{reps} of {former}\n') 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 Parameters
---------- ----------
fname : str, optional 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 = 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: if fname:
v.write(fname) v.write(fname if str(fname).endswith('.vtr') else str(fname)+'.vtr')
else: else:
sys.stdout.write(v.__repr__()) 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) 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) 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) return self.update(ms)
@ -607,9 +593,7 @@ class Geom:
""" """
valid = {'x','y','z'} valid = {'x','y','z'}
if not all(isinstance(d, str) for d in directions): if not set(directions).issubset(valid):
raise TypeError('Directions are not of type str.')
elif not set(directions).issubset(valid):
raise ValueError(f'Invalid direction {set(directions).difference(valid)} specified.') raise ValueError(f'Invalid direction {set(directions).difference(valid)} specified.')
limits = [None,None] if reflect else [-2,0] limits = [None,None] if reflect else [-2,0]
@ -622,11 +606,11 @@ class Geom:
if 'x' in directions: if 'x' in directions:
ms = np.concatenate([ms,ms[limits[0]:limits[1]:-1,:,:]],0) 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) return self.update(ms,rescale=True)
def scale(self,grid): def scale(self,grid,periodic=True):
""" """
Scale microstructure to new grid. Scale microstructure to new grid.
@ -634,22 +618,24 @@ class Geom:
---------- ----------
grid : numpy.ndarray of shape (3) grid : numpy.ndarray of shape (3)
Number of grid points in x,y,z direction. 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( return self.update(
ndimage.interpolation.zoom( ndimage.interpolation.zoom(
self.microstructure, self.microstructure,
grid/self.get_grid(), grid/self.get_grid(),
output=self.microstructure.dtype, output=self.microstructure.dtype,
order=0, order=0,
mode='nearest', mode=('wrap' if periodic else 'nearest'),
prefilter=False 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. Smooth microstructure by selecting most frequent index within given stencil at each location.
@ -657,11 +643,10 @@ class Geom:
---------- ----------
stencil : int, optional stencil : int, optional
Size of smoothing stencil. 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 selection : list, optional
Field values that can be altered. Defaults to all. 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): def mostFrequent(arr,selection=None):
@ -672,12 +657,12 @@ class Geom:
else: else:
return me 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( return self.update(ndimage.filters.generic_filter(
self.microstructure, self.microstructure,
mostFrequent, mostFrequent,
size=(stencil if selection is None else stencil//2*2+1,)*3, 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), extra_keywords=dict(selection=selection),
).astype(self.microstructure.dtype) ).astype(self.microstructure.dtype)
) )
@ -689,7 +674,7 @@ class Geom:
for i, oldID in enumerate(np.unique(self.microstructure)): for i, oldID in enumerate(np.unique(self.microstructure)):
renumbered = np.where(self.microstructure == oldID, i+1, renumbered) 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) 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 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) 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, np.nanmax(self.microstructure)+1 if fill is None else fill,
dtype) 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)) UR = np.clip( offset+grid, 0,np.minimum(self.grid, grid+offset))
ll = np.clip(-offset, 0,np.minimum( grid,self.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)) 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]] 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) 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): for from_ms,to_ms in zip(from_microstructure,to_microstructure):
substituted[self.microstructure==from_ms] = to_ms 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) return self.update(substituted)
@ -823,5 +808,5 @@ class Geom:
extra_keywords={'trigger':trigger}) extra_keywords={'trigger':trigger})
microstructure = np.ma.MaskedArray(self.microstructure + offset_, np.logical_not(mask)) 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) return self.update(microstructure)

View File

@ -3,7 +3,6 @@ import re
import pandas as pd import pandas as pd
import numpy as np import numpy as np
from . import version
from . import util from . import util
class Table: class Table:
@ -49,7 +48,9 @@ class Table:
def _add_comment(self,label,shape,info): def _add_comment(self,label,shape,info):
if info is not None: 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 @staticmethod
@ -135,7 +136,7 @@ class Table:
content = f.readlines() content = f.readlines()
comments = [f'table.py:from_ang v{version}'] comments = [util.version_date('Table','from_ang')]
for line in content: for line in content:
if line.startswith('#'): if line.startswith('#'):
comments.append(line.strip()) comments.append(line.strip())

View File

@ -6,8 +6,10 @@ import numpy as np
import vtk import vtk
from vtk.util.numpy_support import numpy_to_vtk as np_to_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 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 from . import Table
@ -204,7 +206,18 @@ class VTK:
# Check https://blog.kitware.com/ghost-and-blanking-visibility-changes/ for missing data # Check https://blog.kitware.com/ghost-and-blanking-visibility-changes/ for missing data
# Needs support for pd.DataFrame and/or table # Needs support for pd.DataFrame and/or table
def add(self,data,label=None): 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_points = self.geom.GetNumberOfPoints()
N_cells = self.geom.GetNumberOfCells() N_cells = self.geom.GetNumberOfCells()
@ -232,10 +245,77 @@ class VTK:
raise TypeError 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): def __repr__(self):
"""ASCII representation of the VTK data.""" """ASCII representation of the VTK data."""
writer = vtk.vtkDataSetWriter() writer = vtk.vtkDataSetWriter()
writer.SetHeader(f'# damask.VTK v{damask.version}') writer.SetHeader(f'# {util.version_date("VTK")}')
writer.WriteToOutputStringOn() writer.WriteToOutputStringOn()
writer.SetInputData(self.geom) writer.SetInputData(self.geom)
writer.Write() writer.Write()
@ -261,7 +341,7 @@ class VTK:
ren.AddActor(actor) ren.AddActor(actor)
ren.SetBackground(0.2,0.2,0.2) 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 = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(window) iren.SetRenderWindow(window)

View File

@ -3,12 +3,12 @@ import shlex
import string import string
from pathlib import Path from pathlib import Path
import damask from .. import environment
class Marc: class Marc:
"""Wrapper to run DAMASK with MSCMarc.""" """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. Create a Marc solver object.
@ -24,7 +24,7 @@ class Marc:
@property @property
def library_path(self): 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') path_lib = Path(f'{path_MSC}/mentat{self.version}/shlib/linux64')
return path_lib if path_lib.is_dir() else None return path_lib if path_lib.is_dir() else None
@ -33,7 +33,7 @@ class Marc:
@property @property
def tools_path(self): 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') path_tools = Path(f'{path_MSC}/marc{self.version}/tools')
return path_tools if path_tools.is_dir() else None 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')) usersub = usersub.parent/(usersub.name + ('.f90' if compile else '.marc'))
if not usersub.is_file(): if not usersub.is_file():
raise FileNotFoundError("DAMASK4Marc ({}) '{}' not found".format(('source' if compile else 'binary'),usersub)) raise FileNotFoundError("DAMASK4Marc ({}) '{}' not found".format(('source' if compile else 'binary'),usersub))

View File

@ -9,6 +9,8 @@ from optparse import Option
import numpy as np import numpy as np
from . import version
# limit visibility # limit visibility
__all__=[ __all__=[
'srepr', 'srepr',
@ -20,6 +22,7 @@ __all__=[
'scale_to_coprime', 'scale_to_coprime',
'return_message', 'return_message',
'extendableOption', 'extendableOption',
'version_date'
] ]
#################################################################################################### ####################################################################################################
@ -175,6 +178,13 @@ def scale_to_coprime(v):
return m 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 # Classes
#################################################################################################### ####################################################################################################

View File

@ -1,11 +1,38 @@
from pathlib import Path from pathlib import Path
import numpy as np import datetime
import numpy as np
import pytest import pytest
# Use to monkeypatch damask.version (for comparsion to reference files that contain version information) import damask
def pytest_configure():
pytest.dummy_version = '99.99.99-9999-pytest'
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): def pytest_addoption(parser):

View File

@ -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", "ColorSpace": "RGB",
"Name": "binary", "Name": "binary",
"DefaultMap": true, "DefaultMap": true,

View File

@ -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_RGBA 2_RGBA 3_RGBA 4_RGBA
1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
0.996078431372549 0.996078431372549 0.996078431372549 1.0 0.996078431372549 0.996078431372549 0.996078431372549 1.0

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<VTKFile type="RectilinearGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
<RectilinearGrid WholeExtent="0 20 0 18 0 8">
<Piece Extent="0 20 0 18 0 8">
<PointData>
</PointData>
<CellData>
<DataArray type="Int32" Name="materialpoint" format="binary" RangeMin="1" RangeMax="2">
AQAAAACAAAAALQAANQAAAA==eF7t1CECACAMxLBj/380fhYwIyK2spWkmnWgt6b3AF65/avfegAAAAAAAAAAAMy0AfYtC2k=
</DataArray>
</CellData>
<Coordinates>
<DataArray type="Float64" Name="x" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
</DataArray>
<DataArray type="Float64" Name="y" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
</DataArray>
<DataArray type="Float64" Name="z" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
</DataArray>
</Coordinates>
</Piece>
</RectilinearGrid>
</VTKFile>

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<VTKFile type="RectilinearGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
<RectilinearGrid WholeExtent="0 20 0 18 0 8">
<Piece Extent="0 20 0 18 0 8">
<PointData>
</PointData>
<CellData>
<DataArray type="Int32" Name="materialpoint" format="binary" RangeMin="1" RangeMax="2">
AQAAAACAAAAALQAANQAAAA==eF7t1CECACAMxLBj/380fhYwIyK2spWkmnWgt6b3AF65/avfegAAAAAAAAAAAMy0AfYtC2k=
</DataArray>
</CellData>
<Coordinates>
<DataArray type="Float64" Name="x" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
</DataArray>
<DataArray type="Float64" Name="y" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
</DataArray>
<DataArray type="Float64" Name="z" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
</DataArray>
</Coordinates>
</Piece>
</RectilinearGrid>
</VTKFile>

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<VTKFile type="RectilinearGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
<RectilinearGrid WholeExtent="0 20 0 18 0 8">
<Piece Extent="0 20 0 18 0 8">
<PointData>
</PointData>
<CellData>
<DataArray type="Int32" Name="materialpoint" format="binary" RangeMin="1" RangeMax="2">
AQAAAACAAAAALQAANQAAAA==eF7t1CECACAMxLBj/380fhYwIyK2spWkmnWgt6b3AF65/avfegAAAAAAAAAAAMy0AfYtC2k=
</DataArray>
</CellData>
<Coordinates>
<DataArray type="Float64" Name="x" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
</DataArray>
<DataArray type="Float64" Name="y" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
</DataArray>
<DataArray type="Float64" Name="z" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
</DataArray>
</Coordinates>
</Piece>
</RectilinearGrid>
</VTKFile>

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<VTKFile type="RectilinearGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
<RectilinearGrid WholeExtent="0 20 0 18 0 8">
<Piece Extent="0 20 0 18 0 8">
<PointData>
</PointData>
<CellData>
<DataArray type="Int32" Name="materialpoint" format="binary" RangeMin="1" RangeMax="2">
AQAAAACAAAAALQAAOgAAAA==eF7t1CEOACAMBMHS/z8aXwNJSagYMe6y8jIislgNtTW9d9oD/PL6r6b3AAAAAAAAAAAA4MYGlRYLYA==
</DataArray>
</CellData>
<Coordinates>
<DataArray type="Float64" Name="x" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
</DataArray>
<DataArray type="Float64" Name="y" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
</DataArray>
<DataArray type="Float64" Name="z" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
</DataArray>
</Coordinates>
</Piece>
</RectilinearGrid>
</VTKFile>

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<VTKFile type="RectilinearGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
<RectilinearGrid WholeExtent="0 20 0 18 0 8">
<Piece Extent="0 20 0 18 0 8">
<PointData>
</PointData>
<CellData>
<DataArray type="Int32" Name="materialpoint" format="binary" RangeMin="1" RangeMax="2">
AQAAAACAAAAALQAANwAAAA==eF7t1KERADAMA7Gk+w9dWpYCswiI+R66q6rDzmPa/kj3ALZK/2m6BwAAAAAAAAAAAJMLZrELTQ==
</DataArray>
</CellData>
<Coordinates>
<DataArray type="Float64" Name="x" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
</DataArray>
<DataArray type="Float64" Name="y" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
</DataArray>
<DataArray type="Float64" Name="z" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
</DataArray>
</Coordinates>
</Piece>
</RectilinearGrid>
</VTKFile>

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<VTKFile type="RectilinearGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
<RectilinearGrid WholeExtent="0 20 0 18 0 8">
<Piece Extent="0 20 0 18 0 8">
<PointData>
</PointData>
<CellData>
<DataArray type="Int32" Name="materialpoint" format="binary" RangeMin="1" RangeMax="2">
AQAAAACAAAAALQAANQAAAA==eF7t1CECACAMxLBj/380fhYwIyK2spWkmnWgt6b3AF65/avfegAAAAAAAAAAAMy0AfYtC2k=
</DataArray>
</CellData>
<Coordinates>
<DataArray type="Float64" Name="x" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
</DataArray>
<DataArray type="Float64" Name="y" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
</DataArray>
<DataArray type="Float64" Name="z" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
</DataArray>
</Coordinates>
</Piece>
</RectilinearGrid>
</VTKFile>

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<VTKFile type="RectilinearGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
<RectilinearGrid WholeExtent="0 20 0 18 0 8">
<Piece Extent="0 20 0 18 0 8">
<PointData>
</PointData>
<CellData>
<DataArray type="Int32" Name="materialpoint" format="binary" RangeMin="1" RangeMax="2">
AQAAAACAAAAALQAAMQAAAA==eF7tzCEOADAMxLDr/v/o8pLSaTMwi1JJCoAvnGHrN7f/AAAAAAAAAAAAeE8DQvkLTQ==
</DataArray>
</CellData>
<Coordinates>
<DataArray type="Float64" Name="x" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
</DataArray>
<DataArray type="Float64" Name="y" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
</DataArray>
<DataArray type="Float64" Name="z" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
</DataArray>
</Coordinates>
</Piece>
</RectilinearGrid>
</VTKFile>

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<VTKFile type="RectilinearGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
<RectilinearGrid WholeExtent="0 20 0 18 0 8">
<Piece Extent="0 20 0 18 0 8">
<PointData>
</PointData>
<CellData>
<DataArray type="Int32" Name="materialpoint" format="binary" RangeMin="1" RangeMax="2">
AQAAAACAAAAALQAANQAAAA==eF7t1CECACAMxLBj/380fhYwIyK2spWkmnWgt6b3AF65/avfegAAAAAAAAAAAMy0AfYtC2k=
</DataArray>
</CellData>
<Coordinates>
<DataArray type="Float64" Name="x" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
</DataArray>
<DataArray type="Float64" Name="y" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
</DataArray>
<DataArray type="Float64" Name="z" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
</DataArray>
</Coordinates>
</Piece>
</RectilinearGrid>
</VTKFile>

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<VTKFile type="RectilinearGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
<RectilinearGrid WholeExtent="0 20 0 18 0 8">
<Piece Extent="0 20 0 18 0 8">
<PointData>
</PointData>
<CellData>
<DataArray type="Int32" Name="materialpoint" format="binary" RangeMin="1" RangeMax="2">
AQAAAACAAAAALQAANQAAAA==eF7t1CECACAMxLBj/380fhYwIyK2spWkmnWgt6b3AF65/avfegAAAAAAAAAAAMy0AfYtC2k=
</DataArray>
</CellData>
<Coordinates>
<DataArray type="Float64" Name="x" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
</DataArray>
<DataArray type="Float64" Name="y" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
</DataArray>
<DataArray type="Float64" Name="z" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
</DataArray>
</Coordinates>
</Piece>
</RectilinearGrid>
</VTKFile>

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<VTKFile type="RectilinearGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
<RectilinearGrid WholeExtent="0 20 0 18 0 8">
<Piece Extent="0 20 0 18 0 8">
<PointData>
</PointData>
<CellData>
<DataArray type="Int32" Name="materialpoint" format="binary" RangeMin="1" RangeMax="2">
AQAAAACAAAAALQAAOgAAAA==eF7t1CEOACAMBMHS/z8aXwNJSagYMe6y8jIislgNtTW9d9oD/PL6r6b3AAAAAAAAAAAA4MYGlRYLYA==
</DataArray>
</CellData>
<Coordinates>
<DataArray type="Float64" Name="x" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
</DataArray>
<DataArray type="Float64" Name="y" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
</DataArray>
<DataArray type="Float64" Name="z" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
</DataArray>
</Coordinates>
</Piece>
</RectilinearGrid>
</VTKFile>

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<VTKFile type="RectilinearGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
<RectilinearGrid WholeExtent="0 20 0 18 0 8">
<Piece Extent="0 20 0 18 0 8">
<PointData>
</PointData>
<CellData>
<DataArray type="Int32" Name="materialpoint" format="binary" RangeMin="1" RangeMax="2">
AQAAAACAAAAALQAANwAAAA==eF7t1KERADAMA7Gk+w9dWpYCswiI+R66q6rDzmPa/kj3ALZK/2m6BwAAAAAAAAAAAJMLZrELTQ==
</DataArray>
</CellData>
<Coordinates>
<DataArray type="Float64" Name="x" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
</DataArray>
<DataArray type="Float64" Name="y" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
</DataArray>
<DataArray type="Float64" Name="z" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
</DataArray>
</Coordinates>
</Piece>
</RectilinearGrid>
</VTKFile>

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<VTKFile type="RectilinearGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
<RectilinearGrid WholeExtent="0 20 0 18 0 8">
<Piece Extent="0 20 0 18 0 8">
<PointData>
</PointData>
<CellData>
<DataArray type="Int32" Name="materialpoint" format="binary" RangeMin="1" RangeMax="2">
AQAAAACAAAAALQAAOgAAAA==eF7t1CEOACAMBMHS/z8aXwNJSagYMe6y8jIislgNtTW9d9oD/PL6r6b3AAAAAAAAAAAA4MYGlRYLYA==
</DataArray>
</CellData>
<Coordinates>
<DataArray type="Float64" Name="x" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
</DataArray>
<DataArray type="Float64" Name="y" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
</DataArray>
<DataArray type="Float64" Name="z" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
</DataArray>
</Coordinates>
</Piece>
</RectilinearGrid>
</VTKFile>

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<VTKFile type="RectilinearGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
<RectilinearGrid WholeExtent="0 20 0 18 0 8">
<Piece Extent="0 20 0 18 0 8">
<PointData>
</PointData>
<CellData>
<DataArray type="Int32" Name="materialpoint" format="binary" RangeMin="1" RangeMax="2">
AQAAAACAAAAALQAANwAAAA==eF7t1KERADAMA7Gk+w9dWpYCswiI+R66q6rDzmPa/kj3ALZK/2m6BwAAAAAAAAAAAJMLZrELTQ==
</DataArray>
</CellData>
<Coordinates>
<DataArray type="Float64" Name="x" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
</DataArray>
<DataArray type="Float64" Name="y" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
</DataArray>
<DataArray type="Float64" Name="z" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
</DataArray>
</Coordinates>
</Piece>
</RectilinearGrid>
</VTKFile>

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<VTKFile type="RectilinearGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
<RectilinearGrid WholeExtent="0 20 0 18 0 8">
<Piece Extent="0 20 0 18 0 8">
<PointData>
</PointData>
<CellData>
<DataArray type="Int32" Name="materialpoint" format="binary" RangeMin="1" RangeMax="2">
AQAAAACAAAAALQAANQAAAA==eF7t1CECACAMxLBj/380fhYwIyK2spWkmnWgt6b3AF65/avfegAAAAAAAAAAAMy0AfYtC2k=
</DataArray>
</CellData>
<Coordinates>
<DataArray type="Float64" Name="x" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
</DataArray>
<DataArray type="Float64" Name="y" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
</DataArray>
<DataArray type="Float64" Name="z" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
</DataArray>
</Coordinates>
</Piece>
</RectilinearGrid>
</VTKFile>

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<VTKFile type="RectilinearGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
<RectilinearGrid WholeExtent="0 20 0 18 0 8">
<Piece Extent="0 20 0 18 0 8">
<PointData>
</PointData>
<CellData>
<DataArray type="Int32" Name="materialpoint" format="binary" RangeMin="1" RangeMax="2">
AQAAAACAAAAALQAANQAAAA==eF7t1CECACAMxLBj/380fhYwIyK2spWkmnWgt6b3AF65/avfegAAAAAAAAAAAMy0AfYtC2k=
</DataArray>
</CellData>
<Coordinates>
<DataArray type="Float64" Name="x" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
</DataArray>
<DataArray type="Float64" Name="y" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
</DataArray>
<DataArray type="Float64" Name="z" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
</DataArray>
</Coordinates>
</Piece>
</RectilinearGrid>
</VTKFile>

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<VTKFile type="RectilinearGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
<RectilinearGrid WholeExtent="0 20 0 18 0 8">
<Piece Extent="0 20 0 18 0 8">
<PointData>
</PointData>
<CellData>
<DataArray type="Int32" Name="materialpoint" format="binary" RangeMin="1" RangeMax="2">
AQAAAACAAAAALQAANQAAAA==eF7t1CEOACAMBMGj/380Fk+TQjJi7MqtJHVYlypv9wB+0f2+7h4AAAAAAAAAAABM2HWwC1M=
</DataArray>
</CellData>
<Coordinates>
<DataArray type="Float64" Name="x" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
</DataArray>
<DataArray type="Float64" Name="y" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
</DataArray>
<DataArray type="Float64" Name="z" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
</DataArray>
</Coordinates>
</Piece>
</RectilinearGrid>
</VTKFile>

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<VTKFile type="RectilinearGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
<RectilinearGrid WholeExtent="0 20 0 18 0 8">
<Piece Extent="0 20 0 18 0 8">
<PointData>
</PointData>
<CellData>
<DataArray type="Int32" Name="materialpoint" format="binary" RangeMin="1" RangeMax="1">
AQAAAACAAAAALQAAJAAAAA==eF7twwEJAAAMBKH7/qWXY6DgqqmqqqqqqqqqqqqqPnhyUwtB
</DataArray>
</CellData>
<Coordinates>
<DataArray type="Float64" Name="x" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
</DataArray>
<DataArray type="Float64" Name="y" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
</DataArray>
<DataArray type="Float64" Name="z" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
</DataArray>
</Coordinates>
</Piece>
</RectilinearGrid>
</VTKFile>

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<VTKFile type="RectilinearGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
<RectilinearGrid WholeExtent="0 20 0 18 0 8">
<Piece Extent="0 20 0 18 0 8">
<PointData>
</PointData>
<CellData>
<DataArray type="Int32" Name="materialpoint" format="binary" RangeMin="1" RangeMax="2">
AQAAAACAAAAALQAAOQAAAA==eF7t1CESACAMA8HS/z8aX4OgCGDFuszJZERkMTbU1us9gFO6/+q23moPAAAAAAAAAADAnybPzQto
</DataArray>
</CellData>
<Coordinates>
<DataArray type="Float64" Name="x" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
</DataArray>
<DataArray type="Float64" Name="y" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
</DataArray>
<DataArray type="Float64" Name="z" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
</DataArray>
</Coordinates>
</Piece>
</RectilinearGrid>
</VTKFile>

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<VTKFile type="RectilinearGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
<RectilinearGrid WholeExtent="0 20 0 18 0 8">
<Piece Extent="0 20 0 18 0 8">
<PointData>
</PointData>
<CellData>
<DataArray type="Int32" Name="materialpoint" format="binary" RangeMin="1" RangeMax="1">
AQAAAACAAAAALQAAJAAAAA==eF7twwEJAAAMBKH7/qWXY6DgqqmqqqqqqqqqqqqqPnhyUwtB
</DataArray>
</CellData>
<Coordinates>
<DataArray type="Float64" Name="x" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
</DataArray>
<DataArray type="Float64" Name="y" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
</DataArray>
<DataArray type="Float64" Name="z" format="binary" RangeMin="0" RangeMax="1">
AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
</DataArray>
</Coordinates>
</Piece>
</RectilinearGrid>
</VTKFile>

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -7,7 +7,6 @@ import pytest
from PIL import Image from PIL import Image
from PIL import ImageChops from PIL import ImageChops
import damask
from damask import Colormap from damask import Colormap
@pytest.fixture @pytest.fixture
@ -17,8 +16,11 @@ def reference_dir(reference_dir_base):
class TestColormap: 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.], specials = np.array([[0.,0.,0.],
[1.,0.,0.], [1.,0.,0.],
[0.,1.,0.], [0.,1.,0.],
@ -29,7 +31,6 @@ class TestColormap:
[1.,1.,1.] [1.,1.,1.]
]) ])
rgbs = np.vstack((specials,np.random.rand(100,3))) rgbs = np.vstack((specials,np.random.rand(100,3)))
pass # class not integrated
for rgb in rgbs: for rgb in rgbs:
print('rgb',rgb) print('rgb',rgb)
@ -150,8 +151,7 @@ class TestColormap:
('GOM','.legend'), ('GOM','.legend'),
('Gmsh','.msh') ('Gmsh','.msh')
]) ])
def test_compare_reference(self,format,ext,tmpdir,reference_dir,update,monkeypatch): def test_compare_reference(self,format,ext,tmpdir,reference_dir,update):
monkeypatch.setattr(damask, 'version', pytest.dummy_version)
name = 'binary' name = 'binary'
c = Colormap.from_predefined(name) c = Colormap.from_predefined(name)
if update: if update:

View File

@ -1,6 +1,10 @@
import os
import time
import pytest import pytest
import numpy as np import numpy as np
from damask import VTK
from damask import Geom from damask import Geom
from damask import Rotation from damask import Rotation
from damask import util from damask import util
@ -47,31 +51,47 @@ class TestGeom:
def test_write_read_str(self,default,tmpdir): def test_write_read_str(self,default,tmpdir):
default.to_file(str(tmpdir.join('default.geom'))) default.to_file(str(tmpdir/'default.geom'))
new = Geom.from_file(str(tmpdir.join('default.geom'))) new = Geom.from_file(str(tmpdir/'default.geom'))
assert geom_equal(new,default) assert geom_equal(new,default)
def test_write_read_file(self,default,tmpdir): 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) default.to_file(f)
with open(tmpdir.join('default.geom')) as f: with open(tmpdir/'default.geom') as f:
new = Geom.from_file(f) new = Geom.from_file(f)
assert geom_equal(new,default) assert geom_equal(new,default)
def test_write_show(self,default,tmpdir): 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()) f.write(default.show())
with open(tmpdir.join('str.geom')) as f: with open(tmpdir/'str.geom') as f:
new = Geom.from_file(f) new = Geom.from_file(f)
assert geom_equal(new,default) assert geom_equal(new,default)
def test_export_vtk(self,default,tmpdir): def test_read_write_vtr(self,default,tmpdir):
default.to_vtk(str(tmpdir.join('default'))) 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]) @pytest.mark.parametrize('pack',[True,False])
def test_pack(self,default,tmpdir,pack): def test_pack(self,default,tmpdir,pack):
default.to_file(tmpdir.join('default.geom'),pack=pack) default.to_file(tmpdir/'default.geom',pack=pack)
new = Geom.from_file(tmpdir.join('default.geom')) new = Geom.from_file(tmpdir/'default.geom')
assert geom_equal(new,default) assert geom_equal(new,default)
def test_invalid_combination(self,default): def test_invalid_combination(self,default):
@ -115,14 +135,24 @@ class TestGeom:
if update: modified.to_file(reference) if update: modified.to_file(reference)
assert geom_equal(modified,Geom.from_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]) @pytest.mark.parametrize('stencil',[1,2,3,4])
def test_clean(self,default,update,reference_dir,stencil): @pytest.mark.parametrize('selection',[None,1,2])
modified = default.copy() @pytest.mark.parametrize('periodic',[True,False])
modified.clean(stencil) def test_clean(self,update,reference_dir,stencil,selection,periodic):
tag = f'stencil={stencil}' current = Geom.from_vtr((reference_dir/'clean').with_suffix('.vtr'))
reference = reference_dir/f'clean_{tag}.geom' current.clean(stencil,None if selection is None else [selection],periodic)
if update: modified.to_file(reference) reference = reference_dir/f'clean_{stencil}_{selection}_{periodic}'
assert geom_equal(modified,Geom.from_file(reference)) 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',[ @pytest.mark.parametrize('grid',[
(10,11,10), (10,11,10),

View File

@ -4,7 +4,7 @@ from itertools import permutations
import pytest import pytest
import numpy as np import numpy as np
import damask from damask import Table
from damask import Rotation from damask import Rotation
from damask import Orientation from damask import Orientation
from damask import Lattice from damask import Lattice
@ -68,7 +68,7 @@ class TestOrientation:
{'label':'blue', 'RGB':[0,0,1],'direction':[1,1,1]}]) {'label':'blue', 'RGB':[0,0,1],'direction':[1,1,1]}])
@pytest.mark.parametrize('lattice',['fcc','bcc']) @pytest.mark.parametrize('lattice',['fcc','bcc'])
def test_IPF_cubic(self,color,lattice): 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']))): for direction in set(permutations(np.array(color['direction']))):
assert np.allclose(cube.IPF_color(np.array(direction)),np.array(color['RGB'])) 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)]) eu = np.array([o.rotation.as_Eulers(degrees=True) for o in ori.related(model)])
if update: if update:
coords = np.array([(1,i+1) for i,x in enumerate(eu)]) 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.add('pos',coords)
table.to_ASCII(reference) 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) @pytest.mark.parametrize('lattice',Lattice.lattices)
def test_disorientation360(self,lattice): def test_disorientation360(self,lattice):
R_1 = Orientation(Rotation(),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)) assert np.allclose(R_1.disorientation(R_2).as_matrix(),np.eye(3))
@pytest.mark.parametrize('lattice',Lattice.lattices) @pytest.mark.parametrize('lattice',Lattice.lattices)
@ -127,6 +127,6 @@ class TestOrientation:
def test_from_average(self,lattice): def test_from_average(self,lattice):
R_1 = Orientation(Rotation.from_random(),lattice) R_1 = Orientation(Rotation.from_random(),lattice)
eqs = [r for r in R_1.equivalent] 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) assert np.allclose(R_1.rotation.quaternion,R_2.rotation.quaternion)

View File

@ -8,8 +8,9 @@ import pytest
import numpy as np import numpy as np
import h5py import h5py
import damask
from damask import Result from damask import Result
from damask import Rotation
from damask import Orientation
from damask import mechanics from damask import mechanics
from damask import grid_filters from damask import grid_filters
@ -174,7 +175,7 @@ class TestResult:
crystal_structure = default.get_crystal_structure() crystal_structure = default.get_crystal_structure()
in_memory = np.empty((qu.shape[0],3),np.uint8) in_memory = np.empty((qu.shape[0],3),np.uint8)
for i,q in enumerate(qu): 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_memory[i] = np.uint8(o.IPF_color(np.array(d))*255)
in_file = default.read_dataset(loc['color']) in_file = default.read_dataset(loc['color'])
assert np.allclose(in_memory,in_file) assert np.allclose(in_memory,in_file)
@ -233,7 +234,7 @@ class TestResult:
default.add_pole('orientation',pole,polar) default.add_pole('orientation',pole,polar)
loc = {'orientation': default.get_dataset_location('orientation'), loc = {'orientation': default.get_dataset_location('orientation'),
'pole': default.get_dataset_location('p^{}_[1 0 0)'.format(u'' if polar else 'xy'))} 'pole': default.get_dataset_location('p^{}_[1 0 0)'.format(u'' 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,)) rotated_pole = rot * np.broadcast_to(pole,rot.shape+(3,))
xy = rotated_pole[:,0:2]/(1.+abs(pole[2])) xy = rotated_pole[:,0:2]/(1.+abs(pole[2]))
in_memory = xy if not polar else \ in_memory = xy if not polar else \