Beispiel #1
0
    def test_load_DREAM3D(self,ref_path):
        grain = Grid.load_DREAM3D(ref_path/'2phase_irregularGrid.dream3d','FeatureIds')
        point = Grid.load_DREAM3D(ref_path/'2phase_irregularGrid.dream3d')

        assert np.allclose(grain.origin,point.origin) and \
               np.allclose(grain.size,point.size) and \
               (grain.sort().material == point.material+1).all()
Beispiel #2
0
    def test_load_DREAM3D_reference(self,ref_path,update):
        current   = Grid.load_DREAM3D(ref_path/'measured.dream3d')
        reference = Grid.load(ref_path/'measured')
        if update:
            current.save(ref_path/'measured.vtr')

        assert grid_equal(current,reference)
Beispiel #3
0
    def test_load_DREAM3D(self,ref_path,cell_ensemble_data):
        grain_c = ConfigMaterial.load_DREAM3D(ref_path/'2phase_irregularGrid.dream3d','Grain Data',
                  cell_ensemble_data = cell_ensemble_data)
        point_c = ConfigMaterial.load_DREAM3D(ref_path/'2phase_irregularGrid.dream3d',
                  cell_ensemble_data = cell_ensemble_data)

        assert point_c.is_valid and grain_c.is_valid and \
               len(point_c['material'])+1 == len(grain_c['material'])

        grain_m = Grid.load_DREAM3D(ref_path/'2phase_irregularGrid.dream3d','FeatureIds').material.flatten()
        point_m = Grid.load_DREAM3D(ref_path/'2phase_irregularGrid.dream3d').material.flatten()

        for i in np.unique(point_m):
            j = int(grain_m[(point_m==i).nonzero()[0][0]])
            assert np.allclose(point_c['material'][i]['constituents'][0]['O'],
                               grain_c['material'][j]['constituents'][0]['O'])
            assert point_c['material'][i]['constituents'][0]['phase'] == \
                   grain_c['material'][j]['constituents'][0]['phase']