standard names, no initial capitals
This commit is contained in:
parent
94b10b0621
commit
fb8f12ad70
|
@ -46,7 +46,7 @@ class Result:
|
||||||
self.version_major = f.attrs['DADF5_version_major']
|
self.version_major = f.attrs['DADF5_version_major']
|
||||||
self.version_minor = f.attrs['DADF5_version_minor']
|
self.version_minor = f.attrs['DADF5_version_minor']
|
||||||
|
|
||||||
if self.version_major != 0 or not 7 <= self.version_minor <= 11:
|
if self.version_major != 0 or not 7 <= self.version_minor <= 12:
|
||||||
raise TypeError(f'Unsupported DADF5 version {self.version_major}.{self.version_minor}')
|
raise TypeError(f'Unsupported DADF5 version {self.version_major}.{self.version_minor}')
|
||||||
|
|
||||||
self.structured = 'grid' in f['geometry'].attrs.keys() or \
|
self.structured = 'grid' in f['geometry'].attrs.keys() or \
|
||||||
|
@ -67,8 +67,10 @@ class Result:
|
||||||
|
|
||||||
self.N_materialpoints, self.N_constituents = np.shape(f['mapping/phase'])
|
self.N_materialpoints, self.N_constituents = np.shape(f['mapping/phase'])
|
||||||
|
|
||||||
self.homogenizations = [m.decode() for m in np.unique(f['mapping/homogenization']['Name'])]
|
self.homogenizations = [m.decode() for m in np.unique(f['mapping/homogenization']
|
||||||
self.phases = [c.decode() for c in np.unique(f['mapping/phase']['Name'])]
|
['Name' if self.version_minor < 12 else 'name'])]
|
||||||
|
self.phases = [c.decode() for c in np.unique(f['mapping/phase']
|
||||||
|
['Name' if self.version_minor < 12 else 'name'])]
|
||||||
|
|
||||||
self.out_type_ph = []
|
self.out_type_ph = []
|
||||||
for c in self.phases:
|
for c in self.phases:
|
||||||
|
@ -368,6 +370,9 @@ class Result:
|
||||||
tbl = {} if split else None
|
tbl = {} if split else None
|
||||||
inGeom = {}
|
inGeom = {}
|
||||||
inData = {}
|
inData = {}
|
||||||
|
# compatibility hack
|
||||||
|
name = 'Name' if self.version_minor < 12 else 'name'
|
||||||
|
member = 'Position' if self.version_minor < 12 else 'member'
|
||||||
with h5py.File(self.fname,'r') as f:
|
with h5py.File(self.fname,'r') as f:
|
||||||
for dataset in sets:
|
for dataset in sets:
|
||||||
for group in self.groups_with_datasets(dataset):
|
for group in self.groups_with_datasets(dataset):
|
||||||
|
@ -378,11 +383,11 @@ class Result:
|
||||||
if prop == 'geometry':
|
if prop == 'geometry':
|
||||||
inGeom[key] = inData[key] = np.arange(self.N_materialpoints)
|
inGeom[key] = inData[key] = np.arange(self.N_materialpoints)
|
||||||
elif prop == 'phase':
|
elif prop == 'phase':
|
||||||
inGeom[key] = np.where(f['mapping/phase'][:,constituent]['Name'] == str.encode(name))[0]
|
inGeom[key] = np.where(f['mapping/phase'][:,constituent][name] == str.encode(name))[0]
|
||||||
inData[key] = f['mapping/phase'][inGeom[key],constituent]['Position']
|
inData[key] = f['mapping/phase'][inGeom[key],constituent][member]
|
||||||
elif prop == 'homogenization':
|
elif prop == 'homogenization':
|
||||||
inGeom[key] = np.where(f['mapping/homogenization']['Name'] == str.encode(name))[0]
|
inGeom[key] = np.where(f['mapping/homogenization'][name] == str.encode(name))[0]
|
||||||
inData[key] = f['mapping/homogenization'][inGeom[key].tolist()]['Position']
|
inData[key] = f['mapping/homogenization'][inGeom[key].tolist()][member]
|
||||||
shape = np.shape(f[path])
|
shape = np.shape(f[path])
|
||||||
data = np.full((self.N_materialpoints,) + (shape[1:] if len(shape)>1 else (1,)),
|
data = np.full((self.N_materialpoints,) + (shape[1:] if len(shape)>1 else (1,)),
|
||||||
np.nan,
|
np.nan,
|
||||||
|
@ -529,6 +534,9 @@ class Result:
|
||||||
Defaults to False.
|
Defaults to False.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
# compatibility hack
|
||||||
|
name = 'Name' if self.version_minor < 12 else 'name'
|
||||||
|
member = 'Position' if self.version_minor < 12 else 'member'
|
||||||
with h5py.File(self.fname,'r') as f:
|
with h5py.File(self.fname,'r') as f:
|
||||||
shape = (self.N_materialpoints,) + np.shape(f[path[0]])[1:]
|
shape = (self.N_materialpoints,) + np.shape(f[path[0]])[1:]
|
||||||
if len(shape) == 1: shape = shape +(1,)
|
if len(shape) == 1: shape = shape +(1,)
|
||||||
|
@ -540,17 +548,17 @@ class Result:
|
||||||
dataset = np.array(f[pa])
|
dataset = np.array(f[pa])
|
||||||
continue
|
continue
|
||||||
|
|
||||||
p = np.where(f['mapping/phase'][:,c]['Name'] == str.encode(label))[0]
|
p = np.where(f['mapping/phase'][:,c][name] == str.encode(label))[0]
|
||||||
if len(p)>0:
|
if len(p)>0:
|
||||||
u = (f['mapping/phase']['Position'][p,c])
|
u = (f['mapping/phase'][member][p,c])
|
||||||
a = np.array(f[pa])
|
a = np.array(f[pa])
|
||||||
if len(a.shape) == 1:
|
if len(a.shape) == 1:
|
||||||
a=a.reshape([a.shape[0],1])
|
a=a.reshape([a.shape[0],1])
|
||||||
dataset[p,:] = a[u,:]
|
dataset[p,:] = a[u,:]
|
||||||
|
|
||||||
p = np.where(f['mapping/homogenization']['Name'] == str.encode(label))[0]
|
p = np.where(f['mapping/homogenization'][name] == str.encode(label))[0]
|
||||||
if len(p)>0:
|
if len(p)>0:
|
||||||
u = (f['mapping/homogenization']['Position'][p.tolist()])
|
u = (f['mapping/homogenization'][member][p.tolist()])
|
||||||
a = np.array(f[pa])
|
a = np.array(f[pa])
|
||||||
if len(a.shape) == 1:
|
if len(a.shape) == 1:
|
||||||
a=a.reshape([a.shape[0],1])
|
a=a.reshape([a.shape[0],1])
|
||||||
|
|
|
@ -67,7 +67,7 @@ subroutine results_init(restart)
|
||||||
if(.not. restart) then
|
if(.not. restart) then
|
||||||
resultsFile = HDF5_openFile(getSolverJobName()//'.hdf5','w')
|
resultsFile = HDF5_openFile(getSolverJobName()//'.hdf5','w')
|
||||||
call results_addAttribute('DADF5_version_major',0)
|
call results_addAttribute('DADF5_version_major',0)
|
||||||
call results_addAttribute('DADF5_version_minor',11)
|
call results_addAttribute('DADF5_version_minor',12)
|
||||||
call results_addAttribute('DAMASK_version',DAMASKVERSION)
|
call results_addAttribute('DAMASK_version',DAMASKVERSION)
|
||||||
call get_command(commandLine)
|
call get_command(commandLine)
|
||||||
call results_addAttribute('Call',trim(commandLine))
|
call results_addAttribute('Call',trim(commandLine))
|
||||||
|
@ -524,21 +524,21 @@ subroutine results_mapping_phase(phaseAt,memberAtLocal,label)
|
||||||
|
|
||||||
call h5tcreate_f(H5T_COMPOUND_F, type_size_string + type_size_int, dtype_id, hdferr)
|
call h5tcreate_f(H5T_COMPOUND_F, type_size_string + type_size_int, dtype_id, hdferr)
|
||||||
if(hdferr < 0) error stop 'HDF5 error'
|
if(hdferr < 0) error stop 'HDF5 error'
|
||||||
call h5tinsert_f(dtype_id, "Name", 0_SIZE_T, dt_id,hdferr)
|
call h5tinsert_f(dtype_id, 'name', 0_SIZE_T, dt_id,hdferr)
|
||||||
if(hdferr < 0) error stop 'HDF5 error'
|
if(hdferr < 0) error stop 'HDF5 error'
|
||||||
call h5tinsert_f(dtype_id, "Position", type_size_string, H5T_NATIVE_INTEGER, hdferr)
|
call h5tinsert_f(dtype_id, 'member', type_size_string, H5T_NATIVE_INTEGER, hdferr)
|
||||||
if(hdferr < 0) error stop 'HDF5 error'
|
if(hdferr < 0) error stop 'HDF5 error'
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! create memory types for each component of the compound type
|
! create memory types for each component of the compound type
|
||||||
call h5tcreate_f(H5T_COMPOUND_F, type_size_string, name_id, hdferr)
|
call h5tcreate_f(H5T_COMPOUND_F, type_size_string, name_id, hdferr)
|
||||||
if(hdferr < 0) error stop 'HDF5 error'
|
if(hdferr < 0) error stop 'HDF5 error'
|
||||||
call h5tinsert_f(name_id, "Name", 0_SIZE_T, dt_id, hdferr)
|
call h5tinsert_f(name_id, 'name', 0_SIZE_T, dt_id, hdferr)
|
||||||
if(hdferr < 0) error stop 'HDF5 error'
|
if(hdferr < 0) error stop 'HDF5 error'
|
||||||
|
|
||||||
call h5tcreate_f(H5T_COMPOUND_F, type_size_int, position_id, hdferr)
|
call h5tcreate_f(H5T_COMPOUND_F, type_size_int, position_id, hdferr)
|
||||||
if(hdferr < 0) error stop 'HDF5 error'
|
if(hdferr < 0) error stop 'HDF5 error'
|
||||||
call h5tinsert_f(position_id, "Position", 0_SIZE_T, H5T_NATIVE_INTEGER, hdferr)
|
call h5tinsert_f(position_id, 'member', 0_SIZE_T, H5T_NATIVE_INTEGER, hdferr)
|
||||||
if(hdferr < 0) error stop 'HDF5 error'
|
if(hdferr < 0) error stop 'HDF5 error'
|
||||||
|
|
||||||
call h5tclose_f(dt_id, hdferr)
|
call h5tclose_f(dt_id, hdferr)
|
||||||
|
@ -680,21 +680,21 @@ subroutine results_mapping_homogenization(homogenizationAt,memberAtLocal,label)
|
||||||
|
|
||||||
call h5tcreate_f(H5T_COMPOUND_F, type_size_string + type_size_int, dtype_id, hdferr)
|
call h5tcreate_f(H5T_COMPOUND_F, type_size_string + type_size_int, dtype_id, hdferr)
|
||||||
if(hdferr < 0) error stop 'HDF5 error'
|
if(hdferr < 0) error stop 'HDF5 error'
|
||||||
call h5tinsert_f(dtype_id, "Name", 0_SIZE_T, dt_id,hdferr)
|
call h5tinsert_f(dtype_id, 'name', 0_SIZE_T, dt_id,hdferr)
|
||||||
if(hdferr < 0) error stop 'HDF5 error'
|
if(hdferr < 0) error stop 'HDF5 error'
|
||||||
call h5tinsert_f(dtype_id, "Position", type_size_string, H5T_NATIVE_INTEGER, hdferr)
|
call h5tinsert_f(dtype_id, 'member', type_size_string, H5T_NATIVE_INTEGER, hdferr)
|
||||||
if(hdferr < 0) error stop 'HDF5 error'
|
if(hdferr < 0) error stop 'HDF5 error'
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! create memory types for each component of the compound type
|
! create memory types for each component of the compound type
|
||||||
call h5tcreate_f(H5T_COMPOUND_F, type_size_string, name_id, hdferr)
|
call h5tcreate_f(H5T_COMPOUND_F, type_size_string, name_id, hdferr)
|
||||||
if(hdferr < 0) error stop 'HDF5 error'
|
if(hdferr < 0) error stop 'HDF5 error'
|
||||||
call h5tinsert_f(name_id, "Name", 0_SIZE_T, dt_id, hdferr)
|
call h5tinsert_f(name_id, 'name', 0_SIZE_T, dt_id, hdferr)
|
||||||
if(hdferr < 0) error stop 'HDF5 error'
|
if(hdferr < 0) error stop 'HDF5 error'
|
||||||
|
|
||||||
call h5tcreate_f(H5T_COMPOUND_F, type_size_int, position_id, hdferr)
|
call h5tcreate_f(H5T_COMPOUND_F, type_size_int, position_id, hdferr)
|
||||||
if(hdferr < 0) error stop 'HDF5 error'
|
if(hdferr < 0) error stop 'HDF5 error'
|
||||||
call h5tinsert_f(position_id, "Position", 0_SIZE_T, H5T_NATIVE_INTEGER, hdferr)
|
call h5tinsert_f(position_id, 'member', 0_SIZE_T, H5T_NATIVE_INTEGER, hdferr)
|
||||||
if(hdferr < 0) error stop 'HDF5 error'
|
if(hdferr < 0) error stop 'HDF5 error'
|
||||||
|
|
||||||
call h5tclose_f(dt_id, hdferr)
|
call h5tclose_f(dt_id, hdferr)
|
||||||
|
|
Loading…
Reference in New Issue