示例#1
0
 def test_rotate(self,default,update,reference_dir,Eulers):
     modified = default.rotate(Rotation.from_Eulers(Eulers,degrees=True))
     tag = f'Eulers_{util.srepr(Eulers,"-")}'
     reference = reference_dir/f'rotate_{tag}.vtr'
     if update: modified.save(reference)
     assert geom_equal(Geom.load(reference),
                       modified)
示例#2
0
 def test_scale(self,default,update,reference_dir,grid):
     modified = default.scale(grid)
     tag = f'grid_{util.srepr(grid,"-")}'
     reference = reference_dir/f'scale_{tag}.vtr'
     if update: modified.save(reference)
     assert geom_equal(Geom.load(reference),
                       modified)
示例#3
0
 def test_flip(self,default,update,reference_dir,directions):
     modified = default.flip(directions)
     tag = f'directions_{"-".join(directions)}'
     reference = reference_dir/f'flip_{tag}.vtr'
     if update: modified.save(reference)
     assert geom_equal(Geom.load(reference),
                       modified)
示例#4
0
 def test_mirror(self,default,update,reference_dir,directions,reflect):
     modified = default.mirror(directions,reflect)
     tag = f'directions_{"-".join(directions)}+reflect_{reflect}'
     reference = reference_dir/f'mirror_{tag}.vtr'
     if update: modified.save(reference)
     assert geom_equal(Geom.load(reference),
                       modified)
示例#5
0
 def test_clean(self,default,update,reference_dir,stencil,selection,periodic):
     current = default.clean(stencil,selection,periodic)
     reference = reference_dir/f'clean_{stencil}_{"+".join(map(str,[None] if selection is None else selection))}_{periodic}'
     if update and stencil > 1:
         current.save(reference)
     assert geom_equal(Geom.load(reference) if stencil > 1 else default,
                       current
                      )
示例#6
0
 def test_invalid_vtr(self,tmp_path):
     v = VTK.from_rectilinear_grid(np.random.randint(5,10,3)*2,np.random.random(3) + 1.0)
     v.save(tmp_path/'no_materialpoint.vtr')
     with pytest.raises(ValueError):
         Geom.load(tmp_path/'no_materialpoint.vtr')
示例#7
0
 def test_read_write_vtr(self,default,tmp_path):
     default.save(tmp_path/'default')
     new = Geom.load(tmp_path/'default.vtr')
     assert geom_equal(new,default)