message in case of unstructured grids and more constituents

This commit is contained in:
Vitesh Shah 2023-11-24 07:45:54 +01:00
parent fb823c81e7
commit 30b546f2dd
2 changed files with 7 additions and 3 deletions

View File

@ -13,6 +13,7 @@ from collections import defaultdict
from collections.abc import Iterable from collections.abc import Iterable
from typing import Optional, Union, Callable, Any, Sequence, Literal, Dict, List, Tuple from typing import Optional, Union, Callable, Any, Sequence, Literal, Dict, List, Tuple
import h5py
import numpy as np import numpy as np
from numpy import ma from numpy import ma
@ -1975,6 +1976,9 @@ class Result:
Directory to save DREAM3D files. Will be created if non-existent. Directory to save DREAM3D files. Will be created if non-existent.
""" """
if self.N_constituents != 1 or not self.structured:
raise TypeError('DREAM3D output requires structured grid with single constituent.')
N_digits = int(np.floor(np.log10(max(1,self.incs[-1]))))+1 N_digits = int(np.floor(np.log10(max(1,self.incs[-1]))))+1
Crystal_structure_types = {'Hexagonal': 0, 'Cubic': 1, 'Triclinic': 4, 'Monoclinic': 5, 'Orthorhombic': 6, 'Tetrogonal': 8} Crystal_structure_types = {'Hexagonal': 0, 'Cubic': 1, 'Triclinic': 4, 'Monoclinic': 5, 'Orthorhombic': 6, 'Tetrogonal': 8}
@ -2007,7 +2011,7 @@ class Result:
# Dream3D handles euler angles better # Dream3D handles euler angles better
except ValueError: except ValueError:
print("Orientation data is not present") print("Orientation data is not present")
exit() # need to check if such a statement would really work. exit()
phase_ID_array[at_cell_ph[c][label]] = count + 1 phase_ID_array[at_cell_ph[c][label]] = count + 1