geom is written to vtr exlcusively, not to general vtk
base tests on vtr
This commit is contained in:
parent
64e7582e8e
commit
07af7b2f98
|
@ -347,17 +347,18 @@ 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
|
g = VTK.from_file(fname if str(fname).endswith('.vtr') else str(fname)+'.vtr').geom
|
||||||
grid = np.array(g.GetDimensions())-1
|
grid = np.array(g.GetDimensions())-1
|
||||||
bbox = np.array(g.GetBounds()).reshape(3,2).T
|
bbox = np.array(g.GetBounds()).reshape(3,2).T
|
||||||
size = bbox[1] - bbox[0]
|
size = bbox[1] - bbox[0]
|
||||||
|
@ -513,21 +514,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'),'materialpoint')
|
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__())
|
||||||
|
|
||||||
|
@ -642,7 +644,7 @@ class Geom:
|
||||||
grid/self.get_grid(),
|
grid/self.get_grid(),
|
||||||
output=self.microstructure.dtype,
|
output=self.microstructure.dtype,
|
||||||
order=0,
|
order=0,
|
||||||
mode=('wrap' if periodic else 'nearest'),
|
mode=('wrap' if periodic else 'nearest'),
|
||||||
prefilter=False
|
prefilter=False
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -69,23 +69,23 @@ class TestGeom:
|
||||||
new = Geom.from_file(f)
|
new = Geom.from_file(f)
|
||||||
assert geom_equal(new,default)
|
assert geom_equal(new,default)
|
||||||
|
|
||||||
def test_read_write_vtk(self,default,tmpdir):
|
def test_read_write_vtr(self,default,tmpdir):
|
||||||
default.to_vtk(tmpdir/'default')
|
default.to_vtr(tmpdir/'default')
|
||||||
for _ in range(10):
|
for _ in range(10):
|
||||||
time.sleep(.2)
|
time.sleep(.2)
|
||||||
if os.path.exists(tmpdir/'default.vtr'): break
|
if os.path.exists(tmpdir/'default.vtr'): break
|
||||||
|
|
||||||
new = Geom.from_vtk(tmpdir/'default.vtr')
|
new = Geom.from_vtr(tmpdir/'default.vtr')
|
||||||
assert geom_equal(new,default)
|
assert geom_equal(new,default)
|
||||||
|
|
||||||
def test_invalid_vtk(self,tmpdir):
|
def test_invalid_vtr(self,tmpdir):
|
||||||
v = VTK.from_rectilinearGrid(np.random.randint(5,10,3)*2,np.random.random(3) + 1.0)
|
v = VTK.from_rectilinearGrid(np.random.randint(5,10,3)*2,np.random.random(3) + 1.0)
|
||||||
v.write(tmpdir/'no_materialpoint.vtr')
|
v.write(tmpdir/'no_materialpoint.vtr')
|
||||||
for _ in range(10):
|
for _ in range(10):
|
||||||
time.sleep(.2)
|
time.sleep(.2)
|
||||||
if os.path.exists(tmpdir/'no_materialpoint.vtr'): break
|
if os.path.exists(tmpdir/'no_materialpoint.vtr'): break
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
Geom.from_vtk(tmpdir/'no_materialpoint.vtr')
|
Geom.from_vtr(tmpdir/'no_materialpoint.vtr')
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('pack',[True,False])
|
@pytest.mark.parametrize('pack',[True,False])
|
||||||
|
@ -136,13 +136,19 @@ class TestGeom:
|
||||||
assert geom_equal(modified,Geom.from_file(reference))
|
assert geom_equal(modified,Geom.from_file(reference))
|
||||||
|
|
||||||
@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])
|
||||||
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))
|
altered = stencil !=1 and selection is not None
|
||||||
|
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),
|
||||||
|
|
Loading…
Reference in New Issue