Merge branch 'development' into initial-V_e

This commit is contained in:
Martin Diehl 2022-05-19 17:03:09 +02:00
commit 6b6c2548c5
4 changed files with 13 additions and 7 deletions

View File

@ -1 +1 @@
3.0.0-alpha6-367-g85fa92ee1 3.0.0-alpha6-371-g18d862cdb

View File

@ -370,9 +370,9 @@ class Table:
label : str label : str
Column label. Column label.
data : numpy.ndarray data : numpy.ndarray
Column data. Column data. First dimension needs to match number of rows.
info : str, optional info : str, optional
Human-readable information about the modified data. Human-readable information about the data.
Returns Returns
------- -------

View File

@ -404,10 +404,11 @@ class VTK:
def set(self, def set(self,
label: str = None, label: str = None,
data: Union[np.ndarray, np.ma.MaskedArray] = None, data: Union[np.ndarray, np.ma.MaskedArray] = None,
info: str = None,
*, *,
table: 'Table' = None): table: 'Table' = None):
""" """
Add (or replace existing) point or cell data. Add new or replace existing point or cell data.
Data can either be a numpy.array, which requires a corresponding label, Data can either be a numpy.array, which requires a corresponding label,
or a damask.Table. or a damask.Table.
@ -419,6 +420,8 @@ class VTK:
data : numpy.ndarray or numpy.ma.MaskedArray, optional data : numpy.ndarray or numpy.ma.MaskedArray, optional
Data to add or replace. First array dimension needs to match either Data to add or replace. First array dimension needs to match either
number of cells or number of points. number of cells or number of points.
info : str, optional
Human-readable information about the data.
table: damask.Table, optional table: damask.Table, optional
Data to add or replace. Each table label is individually considered. Data to add or replace. Each table label is individually considered.
Number of rows needs to match either number of cells or number of points. Number of rows needs to match either number of cells or number of points.
@ -465,14 +468,17 @@ class VTK:
_add_array(dup.vtk_data, _add_array(dup.vtk_data,
label, label,
np.where(data.mask,data.fill_value,data) if isinstance(data,np.ma.MaskedArray) else data) np.where(data.mask,data.fill_value,data) if isinstance(data,np.ma.MaskedArray) else data)
if info is not None: dup.comments += f'{label}: {info}'
else: else:
raise ValueError('no label defined for data') raise ValueError('no label defined for data')
elif isinstance(table,Table): elif isinstance(table,Table):
for l in table.labels: for l in table.labels:
_add_array(dup.vtk_data,l,table.get(l)) _add_array(dup.vtk_data,l,table.get(l))
if info is not None: dup.comments += f'{l}: {info}'
else: else:
raise TypeError raise TypeError
return dup return dup

View File

@ -48,7 +48,7 @@ module HDF5_utilities
!> @details for parallel IO, all dimension except for the last need to match !> @details for parallel IO, all dimension except for the last need to match
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
interface HDF5_write interface HDF5_write
#if defined(__GFORTRAN__) && __GNUC__<11 #if defined(__GFORTRAN__)
module procedure HDF5_write_real1 module procedure HDF5_write_real1
module procedure HDF5_write_real2 module procedure HDF5_write_real2
module procedure HDF5_write_real3 module procedure HDF5_write_real3
@ -1214,7 +1214,7 @@ subroutine HDF5_read_int7(dataset,loc_id,datasetName,parallel)
end subroutine HDF5_read_int7 end subroutine HDF5_read_int7
#if defined(__GFORTRAN__) && __GNUC__<11 #if defined(__GFORTRAN__)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief write dataset of type real with 1 dimension !> @brief write dataset of type real with 1 dimension
@ -1631,7 +1631,7 @@ subroutine HDF5_write_str(dataset,loc_id,datasetName)
end subroutine HDF5_write_str end subroutine HDF5_write_str
#if defined(__GFORTRAN__) && __GNUC__<11 #if defined(__GFORTRAN__)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief write dataset of type integer with 1 dimension !> @brief write dataset of type integer with 1 dimension