diff --git a/PRIVATE b/PRIVATE index 72c581038..7d48d8158 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 72c58103860e127d37ccf3a06827331de29406ca +Subproject commit 7d48d8158c1b2c0ab8bdd1c5d2baa3d020ae006d diff --git a/python/damask/_result.py b/python/damask/_result.py index 1fa376f63..0f69c4c5f 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -99,8 +99,10 @@ class Result: self.version_major = f.attrs['DADF5_version_major'] self.version_minor = f.attrs['DADF5_version_minor'] - if self.version_major != 0 or not 12 <= self.version_minor <= 13: + if self.version_major != 0 or not 12 <= self.version_minor <= 14: raise TypeError(f'Unsupported DADF5 version {self.version_major}.{self.version_minor}') + if self.version_major == 0 and self.version_minor < 14: + self.export_setup = None self.structured = 'cells' in f['geometry'].attrs.keys() @@ -1395,7 +1397,7 @@ class Result: def export_XDMF(self,output='*'): """ - Write XDMF file to directly visualize data in DADF5 file. + Write XDMF file to directly visualize data from DADF5 file. The XDMF format is only supported for structured grids with single phase and single constituent. @@ -1748,3 +1750,29 @@ class Result: if flatten: r = util.dict_flatten(r) return None if (type(r) == dict and r == {}) else r + + + def export_setup(self,output='*',overwrite=False): + """ + Export configuration files. + + Parameters + ---------- + output : (list of) str, optional + Names of the datasets to export to the file. + Defaults to '*', in which case all datasets are exported. + overwrite : boolean, optional + Overwrite existing configuration files. + Defaults to False. + + """ + with h5py.File(self.fname,'r') as f_in: + for out in _match(output,f_in['setup'].keys()): + description = f_in['/'.join(('setup',out))].attrs['description'] + if not h5py3: description = description.decode() + if not Path(out).exists() or overwrite: + with open(out,'w') as f_out: + f_out.write(f_in['/'.join(('setup',out))][()].decode()) + print(f"exported {description} to '{out}'") + else: + print(f"'{out}' exists, {description} not exported") diff --git a/src/parallelization.f90 b/src/parallelization.f90 index 31da0f969..a5e89561c 100644 --- a/src/parallelization.f90 +++ b/src/parallelization.f90 @@ -25,11 +25,11 @@ module parallelization worldsize = 1 !< MPI worldsize (/=1 for MPI simulations only) #ifndef PETSC -public :: parallelization_broadcast_str +public :: parallelization_bcast_str contains subroutine parallelization_bcast_str(string) - character(len=*), allocatable, intent(inout) :: string + character(len=:), allocatable, intent(inout) :: string end subroutine parallelization_bcast_str #else diff --git a/src/results.f90 b/src/results.f90 index 8b04800ef..9c4507938 100644 --- a/src/results.f90 +++ b/src/results.f90 @@ -74,7 +74,7 @@ subroutine results_init(restart) if(.not. restart) then resultsFile = HDF5_openFile(getSolverJobName()//'.hdf5','w') call results_addAttribute('DADF5_version_major',0) - call results_addAttribute('DADF5_version_minor',13) + call results_addAttribute('DADF5_version_minor',14) call get_command_argument(0,commandLine) call results_addAttribute('creator',trim(commandLine)//' '//DAMASKVERSION) call results_addAttribute('created',now())