Merge branch 'misc-improvements' into 'development'
Misc improvements See merge request damask/DAMASK!184
This commit is contained in:
commit
d4f97f8346
|
@ -1,4 +1,4 @@
|
||||||
import multiprocessing
|
import multiprocessing as mp
|
||||||
import re
|
import re
|
||||||
import inspect
|
import inspect
|
||||||
import glob
|
import glob
|
||||||
|
@ -413,17 +413,18 @@ class Result:
|
||||||
for i in self.iterate('increments'):
|
for i in self.iterate('increments'):
|
||||||
message += f'\n{i} ({self.times[self.increments.index(i)]}s)\n'
|
message += f'\n{i} ({self.times[self.increments.index(i)]}s)\n'
|
||||||
for o,p in zip(['constituents','materialpoints'],['con_physics','mat_physics']):
|
for o,p in zip(['constituents','materialpoints'],['con_physics','mat_physics']):
|
||||||
|
message += f' {o[:-1]}\n'
|
||||||
for oo in self.iterate(o):
|
for oo in self.iterate(o):
|
||||||
message += f' {oo}\n'
|
message += f' {oo}\n'
|
||||||
for pp in self.iterate(p):
|
for pp in self.iterate(p):
|
||||||
message += f' {pp}\n'
|
message += f' {pp}\n'
|
||||||
group = '/'.join([i,o[:-1],oo,pp]) # o[:-1]: plural/singular issue
|
group = '/'.join([i,o[:-1],oo,pp]) # o[:-1]: plural/singular issue
|
||||||
for d in f[group].keys():
|
for d in f[group].keys():
|
||||||
try:
|
try:
|
||||||
dataset = f['/'.join([group,d])]
|
dataset = f['/'.join([group,d])]
|
||||||
unit = f" / {dataset.attrs['Unit'].decode()}" if 'Unit' in dataset.attrs else ''
|
unit = f" / {dataset.attrs['Unit'].decode()}" if 'Unit' in dataset.attrs else ''
|
||||||
description = dataset.attrs['Description'].decode()
|
description = dataset.attrs['Description'].decode()
|
||||||
message += f' {d}{unit}: {description}\n'
|
message += f' {d}{unit}: {description}\n'
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
return message
|
return message
|
||||||
|
@ -703,7 +704,6 @@ class Result:
|
||||||
label,p = 'intermediate',1
|
label,p = 'intermediate',1
|
||||||
elif eigenvalue == 'min':
|
elif eigenvalue == 'min':
|
||||||
label,p = 'minimum',0
|
label,p = 'minimum',0
|
||||||
print('p',eigenvalue)
|
|
||||||
return {
|
return {
|
||||||
'data': mechanics.eigenvectors(T_sym['data'])[:,p],
|
'data': mechanics.eigenvectors(T_sym['data'])[:,p],
|
||||||
'label': f"v_{eigenvalue}({T_sym['label']})",
|
'label': f"v_{eigenvalue}({T_sym['label']})",
|
||||||
|
@ -1066,8 +1066,8 @@ class Result:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
num_threads = Environment().options['DAMASK_NUM_THREADS']
|
num_threads = Environment().options['DAMASK_NUM_THREADS']
|
||||||
pool = multiprocessing.Pool(int(num_threads) if num_threads is not None else None)
|
pool = mp.Pool(int(num_threads) if num_threads is not None else None)
|
||||||
lock = multiprocessing.Manager().Lock()
|
lock = mp.Manager().Lock()
|
||||||
|
|
||||||
groups = self.groups_with_datasets(datasets.values())
|
groups = self.groups_with_datasets(datasets.values())
|
||||||
default_arg = partial(self._job,func=func,datasets=datasets,args=args,lock=lock)
|
default_arg = partial(self._job,func=func,datasets=datasets,args=args,lock=lock)
|
||||||
|
@ -1222,7 +1222,7 @@ class Result:
|
||||||
elif mode.lower()=='point':
|
elif mode.lower()=='point':
|
||||||
v = VTK.from_polyData(self.cell_coordinates())
|
v = VTK.from_polyData(self.cell_coordinates())
|
||||||
|
|
||||||
N_digits = int(np.floor(np.log10(int(self.increments[-1][3:]))))+1
|
N_digits = int(np.floor(np.log10(max(1,int(self.increments[-1][3:])))))+1
|
||||||
|
|
||||||
for inc in util.show_progress(self.iterate('increments'),len(self.selection['increments'])):
|
for inc in util.show_progress(self.iterate('increments'),len(self.selection['increments'])):
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,7 @@ class Rotation:
|
||||||
|
|
||||||
|
|
||||||
def broadcast_to(self,shape):
|
def broadcast_to(self,shape):
|
||||||
if isinstance(shape,int): shape = (shape,)
|
if isinstance(shape,(int,np.integer)): shape = (shape,)
|
||||||
if self.shape == ():
|
if self.shape == ():
|
||||||
q = np.broadcast_to(self.quaternion,shape+(4,))
|
q = np.broadcast_to(self.quaternion,shape+(4,))
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import multiprocessing as mp
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
@ -159,8 +160,11 @@ class VTK:
|
||||||
|
|
||||||
return VTK(geom)
|
return VTK(geom)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
def write(self,fname):
|
def _write(writer):
|
||||||
|
"""Wrapper for parallel writing."""
|
||||||
|
writer.Write()
|
||||||
|
def write(self,fname,parallel=True):
|
||||||
"""
|
"""
|
||||||
Write to file.
|
Write to file.
|
||||||
|
|
||||||
|
@ -168,6 +172,8 @@ class VTK:
|
||||||
----------
|
----------
|
||||||
fname : str or pathlib.Path
|
fname : str or pathlib.Path
|
||||||
Filename for writing.
|
Filename for writing.
|
||||||
|
parallel : boolean, optional
|
||||||
|
Write data in parallel background process. Defaults to True.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if isinstance(self.geom,vtk.vtkRectilinearGrid):
|
if isinstance(self.geom,vtk.vtkRectilinearGrid):
|
||||||
|
@ -185,8 +191,11 @@ class VTK:
|
||||||
writer.SetCompressorTypeToZLib()
|
writer.SetCompressorTypeToZLib()
|
||||||
writer.SetDataModeToBinary()
|
writer.SetDataModeToBinary()
|
||||||
writer.SetInputData(self.geom)
|
writer.SetInputData(self.geom)
|
||||||
|
if parallel:
|
||||||
writer.Write()
|
mp_writer = mp.Process(target=self._write,args=(writer,))
|
||||||
|
mp_writer.start()
|
||||||
|
else:
|
||||||
|
writer.Write()
|
||||||
|
|
||||||
|
|
||||||
# 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
|
||||||
|
@ -197,14 +206,21 @@ class VTK:
|
||||||
N_cells = self.geom.GetNumberOfCells()
|
N_cells = self.geom.GetNumberOfCells()
|
||||||
|
|
||||||
if isinstance(data,np.ndarray):
|
if isinstance(data,np.ndarray):
|
||||||
d = np_to_vtk(num_array=data.reshape(data.shape[0],-1),deep=True)
|
|
||||||
if label is None:
|
if label is None:
|
||||||
raise ValueError('No label defined for numpy.ndarray')
|
raise ValueError('No label defined for numpy.ndarray')
|
||||||
|
|
||||||
|
if data.dtype in [np.float64, np.float128]: # avoid large files
|
||||||
|
d = np_to_vtk(num_array=data.astype(np.float32).reshape(data.shape[0],-1),deep=True)
|
||||||
|
else:
|
||||||
|
d = np_to_vtk(num_array=data.reshape(data.shape[0],-1),deep=True)
|
||||||
d.SetName(label)
|
d.SetName(label)
|
||||||
|
|
||||||
if data.shape[0] == N_cells:
|
if data.shape[0] == N_cells:
|
||||||
self.geom.GetCellData().AddArray(d)
|
self.geom.GetCellData().AddArray(d)
|
||||||
elif data.shape[0] == N_points:
|
elif data.shape[0] == N_points:
|
||||||
self.geom.GetPointData().AddArray(d)
|
self.geom.GetPointData().AddArray(d)
|
||||||
|
else:
|
||||||
|
raise ValueError(f'Invalid shape {data.shape[0]}')
|
||||||
elif isinstance(data,pd.DataFrame):
|
elif isinstance(data,pd.DataFrame):
|
||||||
raise NotImplementedError('pd.DataFrame')
|
raise NotImplementedError('pd.DataFrame')
|
||||||
elif isinstance(data,Table):
|
elif isinstance(data,Table):
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
<PolyData>
|
<PolyData>
|
||||||
<Piece NumberOfPoints="10" NumberOfVerts="0" NumberOfLines="0" NumberOfStrips="0" NumberOfPolys="0">
|
<Piece NumberOfPoints="10" NumberOfVerts="0" NumberOfLines="0" NumberOfStrips="0" NumberOfPolys="0">
|
||||||
<PointData>
|
<PointData>
|
||||||
<DataArray type="Float64" Name="coordinates" NumberOfComponents="3" format="binary" RangeMin="0.7453559924999299" RangeMax="2.449489742783178">
|
<DataArray type="Float32" Name="coordinates" NumberOfComponents="3" format="binary" RangeMin="0.7453560147132696" RangeMax="2.449489742783178">
|
||||||
AQAAAACAAADwAAAAagAAAA==eF5jYMAGPuyXOV4IRHvsIfQZe8u+xxZ9j1/sh/Eh9B37IjDj4f5QMLhqD6Gf2odB+Pth6iD0G3sFiLn7ofqg+j/CxOH6IfRX+xCouRYQ+6H0D/sCqH6YuRD6D1wd1B9QmsEBxgcAJsNfhw==
|
AQAAAACAAAB4AAAAVgAAAA==eF5jYICBhv2WfY9tLfuS7Ypk3PeDaCDf7okF3/7Vq1bZrV6lZQ+k94HEgHL2QHovUM7+iUUfiG0LlQdhkH77Ipnj9iB5qFp7kBjQDiBmcADRANsaLXM=
|
||||||
<InformationKey name="L2_NORM_RANGE" location="vtkDataArray" length="2">
|
<InformationKey name="L2_NORM_RANGE" location="vtkDataArray" length="2">
|
||||||
<Value index="0">
|
<Value index="0">
|
||||||
0.7453559925
|
0.74535601471
|
||||||
</Value>
|
</Value>
|
||||||
<Value index="1">
|
<Value index="1">
|
||||||
2.4494897428
|
2.4494897428
|
||||||
|
|
|
@ -3,27 +3,27 @@
|
||||||
<RectilinearGrid WholeExtent="0 5 0 6 0 7">
|
<RectilinearGrid WholeExtent="0 5 0 6 0 7">
|
||||||
<Piece Extent="0 5 0 6 0 7">
|
<Piece Extent="0 5 0 6 0 7">
|
||||||
<PointData>
|
<PointData>
|
||||||
<DataArray type="Float64" Name="node" NumberOfComponents="3" format="binary" RangeMin="0" RangeMax="1.268857754044952">
|
<DataArray type="Float32" Name="node" NumberOfComponents="3" format="binary" RangeMin="0" RangeMax="1.268857765318962">
|
||||||
AQAAAACAAACAHwAAywMAAA==eF51mTGKVUEQRX88izByB8byY0MDlyG4CTfgFswMDWQigw8/Ejr40E7woGkYXqLJW4LDb8qmz71VDDjvWMGhijvd0KeTr8dXn/++f/x59rwIf3j6+untw1PS34S/udez8KgP97r+///w8bwIDx/f34SHD3nU4DXxIS/CVx/2N+GrTxWfUV18PC/C132xvwlf9zV51PDck/mQF+HrfNjfhK/z2cXn273+iI/nRXj4+P4mPHzI1zqSfZEX4eu+2N+Er/uanPXl9buXn+9n5n3lRTjzvvY34cx78Pgee7ye6eN5Ec6804ecefc+NfEhL8KZd+9TE58qPqO6+HhehDPv9CFn3v189mQ+5EU48+7ns4sPefhE7ujjeRHOvNOHnHmnz6gj2Rd5Ec6804ecefc+kbtLkvcLfCb3eb/AZ3Kf90uS9+njOfN+SfI+fch93ulTEx9y5p0+7Gfe6VPFZ1QXH8+Zd+6L/cw799XFZ3ju4uM58875sJ9553x28VlzN308Z94vSd6nD7nPO/d1iI/nzDv3xX7mnfs6Ep/Tafvx8eXnl+R95UU48772N+HMe/D4Hnu8nunjeRHOvNOHnHn3PjXxIS/CmXfvUxOfKj6juvh4XoQz7/QhZ979fPZkPuRFOPPu57OLD3n4RO7o43kRzrzTh5x5p8+oI9kXeRHOvNOHnHn3PnHO3iTvK+f5fkvO9xt8Jmfeg8f32GOcs9PHc57vN8k7fciZd+9TEx9ynu/0YT/Pd/pU8RnVxcdznu/cF/t5vnNfXXyG5y4+nvN853zYz/Od89nFZz1np4/nPN9vknf6kDPv9Bl1iI/nPN+5L/bzfOe+jsTndLr/Gdh+S95XXoQz72t/E868B4/vscfrmT6eF+HMO33ImXfvUxMf8iKcefc+NfGp4jOqi4/nRTjzTh9y5t3PZ0/mQ16EM+9+Prv4kIdP5I4+nhfhzDt9yJl3+ow6kn2RF+HMO33ImXfvE/fqTfK+ct7nt+Q+v8FncuY9eHyPPca9evp4zvv8JnmnDznz7n1q4kPO+zx92M/7PH2q+Izq4uM57/PcF/t5n+e+uvgMz118POd9nvNhP+/znM8uPpE7+njO+/wmeacPOfNOn1GH+HjO+zz3xX7e57mvI/GJ6pL3lfM9rkve1/4mnHkPHr+NPca72PTxnO9xXfK+9jfhzLv3qYkPOd/j6MP+Jpx5p8/6zX2R8z2O+2J/E868r//yPY7zIed7HOfD/iaceadP5I4+nvM9rkve6UPOvNNn1CE+nvM9jvtifxPOvAf/B5cwXsg=
|
AQAAAACAAADADwAAFQMAAA==eF5Vl7GtFEEQBTeG8wgAhxxux8bEOIsYwDu/M0A6D0JofMAmjU0BF5+d7anXjzP+L6NV4l3pj8S29efL77/35ucO//nwS3zeiL99fTM2+3zPd/u6uTc/d3h67EY8PXB50jxpnjRPmifNk/Kcn4Gn+do18NiNeO3StvPfJk/ztUseuxGvXfI8Hg95mp87PD12I54euD5hu0IeuHbpRly74r9mb9+/7nQvru6T6b5uxHSfPH/PdniaqzseuxHTvT1pnjRPmifNk+ZJec7PsF3Ddg3bxY2Y7rZLnubqbrvkgemOZ7bD01zd8diNmO69K2xXyAPTvXeF7QrzzHa3vbtPpvtt7+7Xjbi73/b1/ex4muleHrsRd3c8aZ40T5onzZPmSXm2q512Dds1bBc34u6uXfI001275IG7e3mqXXma6V4euxF3d3aF7Qp54O7OrrBdYZ5t+/npo7oXV/fJdF83YrpPXt/Pjqe5uuOxGzHd25PmSfOkedI8aZ6U5/wM2zVs17Bd3Ijpbrvkaa7utksemO54Zjs8zdUdj92I6d67wnaFPDDde1fYrjDP9Vare7Heeft7f6n7ZHvn7e/9pe54YHvn1R0PXJ40T5onzZPmSfOkPFu91epuu4bt4kZs77z9vWuXPLC98+puu+RZb7W644HtnVd3PHDNCtsV8sD2zqt77wrzbNvn44e6F1f3yXRfN2K6T17fz46nubrjsRsx3duT5knzpHnSPGmelOf8DNs1bNewXdyI6W675Gmu7rZLHpjueGY7PM3VHY/diOneu8J2hTww3XtX2K4wz3yrD3Uv5p0/7J0/1H1yv/OHuuNp5p0/7J0/1B0PXJ40T5onzZPmSfOkPNv1VmvXsF3DdnEj7ndeu+Rp5p3XLnngfucPdcfTzDt/2Dt/qDseuGaF7Qp54H7n2RW2K8xT3xHdi5/67ui+bsR0nzx/zHZ4mqs7HrsR0709aZ40T5onzZPmSXnWb3YNPDDd8cB0t13yNFd32yUPTHc8sx2eZv0/btAdD0z33hW2K+SB6d67wnYV/wMyiXC6
|
||||||
<InformationKey name="L2_NORM_RANGE" location="vtkDataArray" length="2">
|
<InformationKey name="L2_NORM_RANGE" location="vtkDataArray" length="2">
|
||||||
<Value index="0">
|
<Value index="0">
|
||||||
0
|
0
|
||||||
</Value>
|
</Value>
|
||||||
<Value index="1">
|
<Value index="1">
|
||||||
1.268857754
|
1.2688577653
|
||||||
</Value>
|
</Value>
|
||||||
</InformationKey>
|
</InformationKey>
|
||||||
</DataArray>
|
</DataArray>
|
||||||
</PointData>
|
</PointData>
|
||||||
<CellData>
|
<CellData>
|
||||||
<DataArray type="Float64" Name="cell" NumberOfComponents="3" format="binary" RangeMin="0.10871961482881586" RangeMax="1.160792402743735">
|
<DataArray type="Float32" Name="cell" NumberOfComponents="3" format="binary" RangeMin="0.10871961651677305" RangeMax="1.1607924233069467">
|
||||||
AQAAAACAAACwEwAAZQIAAA==eF511r2KFEEYRmHjjY2N9Ao0lQ79yQy8jBVjc29gL0Ezhc1maDBfU0FB3NVgNyqQuged1leZ56sqBpo5HRx4+wS13nn989l6vjzfzm45u/vk9+/NcvL17cuHJx8Lf3D/cD4XfvPq9vmj68vCH19vLwpf/3pvbedT8crjlccrj1ce77vtXBavPF55vPJ45fG+3/hN8crjlccrj1d+vHOb7NyKV368cyte+XrUVZ901YtXftxVL175Ss/f96dX+9MPpedwew6353B7DrdnvXJ71iu3Z73pTa/cnvXK7VlvetMrt2e9cnse79wmO7fildvzeOdWvOlt3FUvXrk9j7vqE+9uWQ/46qL0HG7P4fYcbs/h9qxXbs965fasN73plduzXrk9601veuX2rFduz+Od22TnVrxyex7v3Io3vY276sUrt+dxV33i3f37/vYcbs/h9hxuz+H2rFduz3rl9pynPYfbs165PeuV27NeuT3rlduz3j//22TnVrxyew6353B7DrdnvXJ71iu353uHa8jZl9JzuD2H23O4PYfbs165PeuV27Pe9KZXbs965fasN73plduzXrk9j3duk51b8crtebxzK970Nu6qF6/cnsdd9Yl3tzzdLtbfSs/h9hxuz+H2HG7PeuX2rFduz3rTm165PeuV27Pe9KZXbs965fY83rlNdm7FK7fn8c6teNPbuKtevHJ7HnfVJ97d8uJwDdn/KD2H23O4PYfbc7g965Xbs165PetNb3rl9qxXbs9605teuT3rldvzeOc22bkVr9yexzu34k1v46568crtedzVf/4LDINsdg==
|
AQAAAACAAADYCQAA8QEAAA==eF5N0CGOFlEQAOHVK0nmBnAFgnn/PLsSsZd4CSQIPDfYZN2iUbMePI4DEMR/BbgDNJ2ve1yZSir18P3jeD6O8eruxfj99s0Ff356Kh63v4o/jNsdP/xzb24+Xbg4XBwuDheHe3//s1wcLg4Xh4vT3fZ2k9NNTjc53eRsnuXibJ7l4mye5T4fq1ycr1a5OF+tk3uMb++u9TnY52Cfg30O9pmLfeZin7nxjYt95mKf2932dpN9bjfZ526e5WKfu3mWi33uV6tc7HO/Wif3GO+vry8+B/sc7HOwz8E+c7HPXOwzN75xsc9c7HO7295uss/tJvvczbNc7HM3z3Kxz/1qlYt97lfr5B7/f/kc7HOwz8E+B/vMxT5zsc/c+MbFPnOxz+1ue7vJPreb7HM3z3Kxz908y8U+96tVLva5X62Te4y7xy/1OdjnYJ+DfQ72mYt95mKfufGNi33mYp/b3fZ2k31uN9nnbp7lYp+7eZaLfe5Xq1zsc79aJ/cYjy9/1Odgn4N9DvY52Gcu9pmLfebGNy72mYt9bnfb2032ud1kn7t5lot97uZZLva5X61ysc/9ap3cY1y//qnPwT4H+xzsc7DPXOwzF/vMjW9c7DMX+9zutreb7HO7yT538ywX+9zNs1zsc79a5WKf+1XyX6K10A4=
|
||||||
<InformationKey name="L2_NORM_RANGE" location="vtkDataArray" length="2">
|
<InformationKey name="L2_NORM_RANGE" location="vtkDataArray" length="2">
|
||||||
<Value index="0">
|
<Value index="0">
|
||||||
0.10871961483
|
0.10871961652
|
||||||
</Value>
|
</Value>
|
||||||
<Value index="1">
|
<Value index="1">
|
||||||
1.1607924027
|
1.1607924233
|
||||||
</Value>
|
</Value>
|
||||||
</InformationKey>
|
</InformationKey>
|
||||||
</DataArray>
|
</DataArray>
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
import os
|
||||||
|
import filecmp
|
||||||
|
import time
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
@ -17,7 +21,7 @@ class TestVTK:
|
||||||
origin = np.random.random(3)
|
origin = np.random.random(3)
|
||||||
v = VTK.from_rectilinearGrid(grid,size,origin)
|
v = VTK.from_rectilinearGrid(grid,size,origin)
|
||||||
string = v.__repr__()
|
string = v.__repr__()
|
||||||
v.write(tmp_path/'rectilinearGrid')
|
v.write(tmp_path/'rectilinearGrid',False)
|
||||||
vtr = VTK.from_file(tmp_path/'rectilinearGrid.vtr')
|
vtr = VTK.from_file(tmp_path/'rectilinearGrid.vtr')
|
||||||
with open(tmp_path/'rectilinearGrid.vtk','w') as f:
|
with open(tmp_path/'rectilinearGrid.vtk','w') as f:
|
||||||
f.write(string)
|
f.write(string)
|
||||||
|
@ -25,10 +29,10 @@ class TestVTK:
|
||||||
assert(string == vtr.__repr__() == vtk.__repr__())
|
assert(string == vtr.__repr__() == vtk.__repr__())
|
||||||
|
|
||||||
def test_polyData(self,tmp_path):
|
def test_polyData(self,tmp_path):
|
||||||
points = np.random.rand(3,100)
|
points = np.random.rand(100,3)
|
||||||
v = VTK.from_polyData(points)
|
v = VTK.from_polyData(points)
|
||||||
string = v.__repr__()
|
string = v.__repr__()
|
||||||
v.write(tmp_path/'polyData')
|
v.write(tmp_path/'polyData',False)
|
||||||
vtp = VTK.from_file(tmp_path/'polyData.vtp')
|
vtp = VTK.from_file(tmp_path/'polyData.vtp')
|
||||||
with open(tmp_path/'polyData.vtk','w') as f:
|
with open(tmp_path/'polyData.vtk','w') as f:
|
||||||
f.write(string)
|
f.write(string)
|
||||||
|
@ -47,14 +51,30 @@ class TestVTK:
|
||||||
connectivity = np.random.choice(np.arange(n),n,False).reshape(-1,n)
|
connectivity = np.random.choice(np.arange(n),n,False).reshape(-1,n)
|
||||||
v = VTK.from_unstructuredGrid(nodes,connectivity,cell_type)
|
v = VTK.from_unstructuredGrid(nodes,connectivity,cell_type)
|
||||||
string = v.__repr__()
|
string = v.__repr__()
|
||||||
v.write(tmp_path/'unstructuredGrid')
|
v.write(tmp_path/'unstructuredGrid',False)
|
||||||
vtu = VTK.from_file(tmp_path/'unstructuredGrid.vtu')
|
vtu = VTK.from_file(tmp_path/'unstructuredGrid.vtu')
|
||||||
with open(tmp_path/'unstructuredGrid.vtk','w') as f:
|
with open(tmp_path/'unstructuredGrid.vtk','w') as f:
|
||||||
f.write(string)
|
f.write(string)
|
||||||
vtk = VTK.from_file(tmp_path/'unstructuredGrid.vtk','unstructuredgrid')
|
vtk = VTK.from_file(tmp_path/'unstructuredGrid.vtk','unstructuredgrid')
|
||||||
assert(string == vtu.__repr__() == vtk.__repr__())
|
assert(string == vtu.__repr__() == vtk.__repr__())
|
||||||
|
|
||||||
@pytest.mark.parametrize('name,dataset_type',[('this_file_does_not_exist.vtk',None),
|
|
||||||
|
def test_parallel_out(self,tmp_path):
|
||||||
|
points = np.random.rand(102,3)
|
||||||
|
v = VTK.from_polyData(points)
|
||||||
|
fname_s = tmp_path/'single.vtp'
|
||||||
|
fname_p = tmp_path/'parallel.vtp'
|
||||||
|
v.write(fname_s,False)
|
||||||
|
v.write(fname_p,True)
|
||||||
|
for i in range(10):
|
||||||
|
if os.path.isfile(fname_p) and filecmp.cmp(fname_s,fname_p):
|
||||||
|
assert(True)
|
||||||
|
return
|
||||||
|
time.sleep(.5)
|
||||||
|
assert(False)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('name,dataset_type',[('this_file_does_not_exist.vtk', None),
|
||||||
('this_file_does_not_exist.vtk','vtk'),
|
('this_file_does_not_exist.vtk','vtk'),
|
||||||
('this_file_does_not_exist.vtx', None)])
|
('this_file_does_not_exist.vtx', None)])
|
||||||
def test_invalid_dataset_type(self,dataset_type,name):
|
def test_invalid_dataset_type(self,dataset_type,name):
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
!> @brief Interfacing between the PETSc-based solvers and the material subroutines provided
|
!> @brief Interfacing between the PETSc-based solvers and the material subroutines provided
|
||||||
!! by DAMASK
|
!! by DAMASK
|
||||||
!> @details Interfacing between the PETSc-based solvers and the material subroutines provided
|
!> @details Interfacing between the PETSc-based solvers and the material subroutines provided
|
||||||
!> by DAMASK. Interpretating the command line arguments to get load case, geometry file,
|
!> by DAMASK. Interpreting the command line arguments to get load case, geometry file,
|
||||||
!> and working directory.
|
!> and working directory.
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
#define PETSC_MAJOR 3
|
#define PETSC_MAJOR 3
|
||||||
|
@ -340,7 +340,7 @@ end function getGeometryFile
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief relative path of loadcase from command line arguments
|
!> @brief relative path of load case from command line arguments
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
function getLoadCaseFile(loadCaseParameter)
|
function getLoadCaseFile(loadCaseParameter)
|
||||||
|
|
||||||
|
|
|
@ -375,7 +375,7 @@ subroutine constitutive_init
|
||||||
constitutive_source_maxSizeDotState = 0
|
constitutive_source_maxSizeDotState = 0
|
||||||
PhaseLoop2:do ph = 1,material_Nphase
|
PhaseLoop2:do ph = 1,material_Nphase
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! partition and inititalize state
|
! partition and initialize state
|
||||||
plasticState(ph)%partionedState0 = plasticState(ph)%state0
|
plasticState(ph)%partionedState0 = plasticState(ph)%state0
|
||||||
plasticState(ph)%state = plasticState(ph)%partionedState0
|
plasticState(ph)%state = plasticState(ph)%partionedState0
|
||||||
forall(s = 1:phase_Nsources(ph))
|
forall(s = 1:phase_Nsources(ph))
|
||||||
|
@ -450,7 +450,7 @@ end subroutine constitutive_dependentState
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief contains the constitutive equation for calculating the velocity gradient
|
!> @brief contains the constitutive equation for calculating the velocity gradient
|
||||||
! ToDo: Discuss wheter it makes sense if crystallite handles the configuration conversion, i.e.
|
! ToDo: Discuss whether it makes sense if crystallite handles the configuration conversion, i.e.
|
||||||
! Mp in, dLp_dMp out
|
! Mp in, dLp_dMp out
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine constitutive_LpAndItsTangents(Lp, dLp_dS, dLp_dFi, &
|
subroutine constitutive_LpAndItsTangents(Lp, dLp_dS, dLp_dFi, &
|
||||||
|
@ -660,7 +660,7 @@ end subroutine constitutive_SandItsTangents
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief returns the 2nd Piola-Kirchhoff stress tensor and its tangent with respect to
|
!> @brief returns the 2nd Piola-Kirchhoff stress tensor and its tangent with respect to
|
||||||
!> the elastic and intermeidate deformation gradients using Hookes law
|
!> the elastic and intermediate deformation gradients using Hooke's law
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine constitutive_hooke_SandItsTangents(S, dS_dFe, dS_dFi, &
|
subroutine constitutive_hooke_SandItsTangents(S, dS_dFe, dS_dFi, &
|
||||||
Fe, Fi, ipc, ip, el)
|
Fe, Fi, ipc, ip, el)
|
||||||
|
|
|
@ -37,7 +37,7 @@ submodule(constitutive) plastic_nonlocal
|
||||||
! BEGIN DEPRECATED
|
! BEGIN DEPRECATED
|
||||||
integer, dimension(:,:,:), allocatable :: &
|
integer, dimension(:,:,:), allocatable :: &
|
||||||
iRhoU, & !< state indices for unblocked density
|
iRhoU, & !< state indices for unblocked density
|
||||||
iV, & !< state indices for dislcation velocities
|
iV, & !< state indices for dislocation velocities
|
||||||
iD !< state indices for stable dipole height
|
iD !< state indices for stable dipole height
|
||||||
!END DEPRECATED
|
!END DEPRECATED
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ submodule(homogenization) homogenization_mech_none
|
||||||
contains
|
contains
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief allocates all neccessary fields, reads information from material configuration file
|
!> @brief allocates all necessary fields, reads information from material configuration file
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
module subroutine mech_none_init
|
module subroutine mech_none_init
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ end function kinematics_thermal_expansion_initialStrain
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief contains the constitutive equation for calculating the velocity gradient
|
!> @brief constitutive equation for calculating the velocity gradient
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine kinematics_thermal_expansion_LiAndItsTangent(Li, dLi_dTstar, ipc, ip, el)
|
subroutine kinematics_thermal_expansion_LiAndItsTangent(Li, dLi_dTstar, ipc, ip, el)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
!-------------------------------------------------------------------------------------------------
|
!-------------------------------------------------------------------------------------------------
|
||||||
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
|
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
|
||||||
!> @brief linked list
|
!> @brief Linked list
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
module list
|
module list
|
||||||
use prec
|
use prec
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH
|
!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH
|
||||||
!> @author Luv Sharma, Max-Planck-Institut für Eisenforschung GmbH
|
!> @author Luv Sharma, Max-Planck-Institut für Eisenforschung GmbH
|
||||||
!> @brief material subroutine incoprorating isotropic ductile damage source mechanism
|
!> @brief material subroutine incorporating isotropic ductile damage source mechanism
|
||||||
!> @details to be done
|
!> @details to be done
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
module source_damage_isoDuctile
|
module source_damage_isoDuctile
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
|
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
|
||||||
!> @brief provides wrappers to C routines
|
!> @brief Wrappers to C routines for system operations
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
module system_routines
|
module system_routines
|
||||||
use, intrinsic :: ISO_C_Binding
|
use, intrinsic :: ISO_C_Binding
|
||||||
|
|
|
@ -73,7 +73,7 @@ end subroutine thermal_conduction_init
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief returns heat generation rate
|
!> @brief return heat generation rate
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine thermal_conduction_getSourceAndItsTangent(Tdot, dTdot_dT, T, ip, el)
|
subroutine thermal_conduction_getSourceAndItsTangent(Tdot, dTdot_dT, T, ip, el)
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ end subroutine thermal_conduction_getSourceAndItsTangent
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief returns homogenized thermal conductivity in reference configuration
|
!> @brief return homogenized thermal conductivity in reference configuration
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
function thermal_conduction_getConductivity(ip,el)
|
function thermal_conduction_getConductivity(ip,el)
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ module thermal_isothermal
|
||||||
contains
|
contains
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief allocates all neccessary fields, reads information from material configuration file
|
!> @brief allocates fields, reads information from material configuration file
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine thermal_isothermal_init
|
subroutine thermal_isothermal_init
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue