WRApplication
External kratos "application" for multiscale time integration.
python_scripts.utilities.xdmf Namespace Reference

Classes

class  HDF5CoordinateDataItem
 

Functions

def TryOpenH5File (name, mode=None, driver=None, **kwds)
 A context manager wrapper for the opened file. More...
 
def RenumberConnectivitiesForXdmf (filename_or_list_of_filenames, h5path_to_mesh)
 Renumber mesh connectivities for XDMF. More...
 
None GetListOfSpatialGrids ("list[list[str]]" spatial_grids_list, h5py.Group h5_model_part, str current_path)
 
def CreateXdmfSpatialGrid (h5_model_part)
 Return an XDMF Grid object corresponding to a mesh in an HDF5 file. More...
 
def Has_dtype (item)
 
def XdmfNodalResults (h5_results)
 Return a list of XDMF Attribute objects for nodal results in an HDF5 file. More...
 
def XdmfNodalFlags (h5_results)
 Return a list of XDMF Attribute objects for nodal flags in an HDF5 file. More...
 
def XdmfElementResults (h5_results)
 Return a list of XDMF Attribute objects for element results in an HDF5 file. More...
 
def XdmfElementFlags (h5_results)
 Return a list of XDMF Attribute objects for element flags in an HDF5 file. More...
 
def XdmfElementGaussPointValues (h5_results)
 Return a list of XDMF Attribute objects for element integration point values in an HDF5 file. More...
 
def XdmfConditionResults (h5_results)
 Return a list of XDMF Attribute objects for element results in an HDF5 file. More...
 
def XdmfConditionFlags (h5_results)
 Return a list of XDMF Attribute objects for element flags in an HDF5 file. More...
 
def XdmfConditionGaussPointValues (h5_results)
 Return a list of XDMF Attribute objects for element integration point values in an HDF5 file. More...
 
def XdmfResults (h5py.Group h5_results)
 Return a list of XDMF Attribute objects for results in an HDF5 file. More...
 
def TimeLabel (file_path)
 Return the time string from the file name. More...
 
def TimeFromFileName (file_path)
 Return the time value for the file name. More...
 
def FindMatchingFiles (pattern)
 Return a list of HDF5 files matching the given file name pattern. More...
 
def GetSortedListOfFiles (pattern)
 Return sorted file list based on the time stamp. More...
 
def GetStep (value, patterns)
 
def GetMatchingGroupNames (output_dict, value, patterns, pattern_with_wildcards)
 
def WriteMultifileTemporalAnalysisToXdmf (ospath, h5path_to_mesh, h5path_to_results)
 Write XDMF metadata for a temporal analysis from multiple HDF5 files. More...
 
def CreateXdmfTemporalGridFromSinglefile (h5_file_name, h5path_pattern_to_mesh, h5path_pattern_to_results, bool require_results=False)
 Return an XDMF Grid object for a list of temporal results in a single HDF5 file. More...
 
def WriteSinglefileTemporalAnalysisToXdmf (h5_file_name, h5path_pattern_to_mesh, h5path_pattern_to_results, bool require_results=False)
 Write XDMF metadata for a temporal analysis from single HDF5 file. More...
 

Variables

string warn_msg = "h5py module was not found!"
 

Function Documentation

◆ CreateXdmfSpatialGrid()

def python_scripts.utilities.xdmf.CreateXdmfSpatialGrid (   h5_model_part)

Return an XDMF Grid object corresponding to a mesh in an HDF5 file.

    Keyword arguments:
    h5_model_part -- the HDF5 group containing the model part

    Expects:
    - element connectivities in h5_model_part["Xdmf/Elements/<element-name>"].
    Each connectivities has attributes "Dimension" and "NumberOfNodes".  For
    example, "Element2D3N" has "Dimension" 2 and "NumberOfNodes" 3.  The
    connectivities differ from the normal mdpa connectivities in that they
    directly index the array of nodal coordinates.  Currently there is
    no other way to post-process the mesh with Xdmf.

    See:
    - core.operations.ModelPartOutput,
    - core.operations.PartitionedModelPartOutput,
    - RenumberConnectivitiesForXdmf.

◆ CreateXdmfTemporalGridFromSinglefile()

def python_scripts.utilities.xdmf.CreateXdmfTemporalGridFromSinglefile (   h5_file_name,
  h5path_pattern_to_mesh,
  h5path_pattern_to_results,
bool   require_results = False 
)

Return an XDMF Grid object for a list of temporal results in a single HDF5 file.

    Keyword arguments:
    h5_file_name -- the HDF5 file to be parsed
    h5path_pattern_to_mesh -- the internal HDF5 file path pattern to the mesh [ only <step> flag is supported ]
    h5path_pattern_to_results -- the internal HDF5 file path pattern to the results [ only <step> flag is supported ]

    Expects:
    - In prefixes, <step> flag is used maximum of one time only
    - If single mesh description is found, it is considered as single mesh temporal output

◆ FindMatchingFiles()

def python_scripts.utilities.xdmf.FindMatchingFiles (   pattern)

Return a list of HDF5 files matching the given file name pattern.

    For example, "./sim/kratos" matches:
    - ./sim/kratos.h5
    - ./sim/kratos-0.0000.h5
    - ./sim/kratos-0.2000.h5
    - etc.

◆ GetListOfSpatialGrids()

None python_scripts.utilities.xdmf.GetListOfSpatialGrids ( "list[list[str]]"  spatial_grids_list,
h5py.Group  h5_model_part,
str  current_path 
)

◆ GetMatchingGroupNames()

def python_scripts.utilities.xdmf.GetMatchingGroupNames (   output_dict,
  value,
  patterns,
  pattern_with_wildcards 
)

◆ GetSortedListOfFiles()

def python_scripts.utilities.xdmf.GetSortedListOfFiles (   pattern)

Return sorted file list based on the time stamp.

    see @FindMatchingFiles

◆ GetStep()

def python_scripts.utilities.xdmf.GetStep (   value,
  patterns 
)

◆ Has_dtype()

def python_scripts.utilities.xdmf.Has_dtype (   item)

◆ RenumberConnectivitiesForXdmf()

def python_scripts.utilities.xdmf.RenumberConnectivitiesForXdmf (   filename_or_list_of_filenames,
  h5path_to_mesh 
)

Renumber mesh connectivities for XDMF.

    Keyword arguments:
    filename_or_list_of_filenames -- the HDF5 file(s) to renumber
    h5path_to_mesh -- the internal HDF5 file path to the mesh

    The mesh connectivities must be renumbered for XDMF by the node's array
    index rather than its ID.  The renumbered connectivities are stored in
    HDF5 and referenced by the XDMF Grid.  If a file cannot be opened, it is
    skipped.

    See:
    - XdmfConnectivitiesWriterProcess.

◆ TimeFromFileName()

def python_scripts.utilities.xdmf.TimeFromFileName (   file_path)

Return the time value for the file name.

    If the file name contains no time value, zero time value is assumed.

◆ TimeLabel()

def python_scripts.utilities.xdmf.TimeLabel (   file_path)

Return the time string from the file name.

    E.g.:
    'kratos-123.h5' -> '123'
    'kratos-1.2.h5' -> '1.2'
    'kratos-1.2e+00.h5' -> '1.2e+00'

    Returns empty string if not found.

◆ TryOpenH5File()

def python_scripts.utilities.xdmf.TryOpenH5File (   name,
  mode = None,
  driver = None,
**  kwds 
)

A context manager wrapper for the opened file.

    In case the file cannot be opened, yield None rather than raise an
    exception.  This can be the case if the file is already opened.

◆ WriteMultifileTemporalAnalysisToXdmf()

def python_scripts.utilities.xdmf.WriteMultifileTemporalAnalysisToXdmf (   ospath,
  h5path_to_mesh,
  h5path_to_results 
)

Write XDMF metadata for a temporal analysis from multiple HDF5 files.

    Keyword arguments:
    ospath -- path to one of the HDF5 files or the corresponding XDMF output file.
    h5path_to_mesh -- the internal HDF5 file path to the mesh
    h5path_to_results -- the internal HDF5 file path to the results

◆ WriteSinglefileTemporalAnalysisToXdmf()

def python_scripts.utilities.xdmf.WriteSinglefileTemporalAnalysisToXdmf (   h5_file_name,
  h5path_pattern_to_mesh,
  h5path_pattern_to_results,
bool   require_results = False 
)

Write XDMF metadata for a temporal analysis from single HDF5 file.

    Keyword arguments:
    h5_file_name -- hdf5 filename
    h5path_pattern_to_mesh -- the internal HDF5 file path pattern to the mesh [ only <step> flag is supported ]
    h5path_to_results -- the internal HDF5 file path pattern to the results [ only <step> flag is supported ]

◆ XdmfConditionFlags()

def python_scripts.utilities.xdmf.XdmfConditionFlags (   h5_results)

Return a list of XDMF Attribute objects for element flags in an HDF5 file.

    Keyword arguments:
    h5_flags -- the HDF5 group containing the flags

    Checks for flags stored by variable name in:
    - h5_flags["ConditionFlagValues/<flag-name>"]

    If no flags are found, returns an empty list.

    See:
    - core.operations.ConditionFlagValueOutput.

◆ XdmfConditionGaussPointValues()

def python_scripts.utilities.xdmf.XdmfConditionGaussPointValues (   h5_results)

Return a list of XDMF Attribute objects for element integration point values in an HDF5 file.

    Keyword arguments:
    h5_results -- the HDF5 group containing the results

    Checks for results stored by variable name in:
    - h5_results["ConditionGaussPointValues/<variable>"]

    If no results are found, returns an empty list.

    See:
    - core.operations.ConditionGaussPointOutput.

◆ XdmfConditionResults()

def python_scripts.utilities.xdmf.XdmfConditionResults (   h5_results)

Return a list of XDMF Attribute objects for element results in an HDF5 file.

    Keyword arguments:
    h5_results -- the HDF5 group containing the results

    Checks for results stored by variable name in:
    - h5_results["ConditionDataValues/<variable>"]

    If no results are found, returns an empty list.

    See:
    - core.operations.ConditionDataValueOutput.

◆ XdmfElementFlags()

def python_scripts.utilities.xdmf.XdmfElementFlags (   h5_results)

Return a list of XDMF Attribute objects for element flags in an HDF5 file.

    Keyword arguments:
    h5_flags -- the HDF5 group containing the flags

    Checks for flags stored by variable name in:
    - h5_flags["ElementFlagValues/<flag-name>"]

    If no flags are found, returns an empty list.

    See:
    - core.operations.ElementFlagValueOutput.

◆ XdmfElementGaussPointValues()

def python_scripts.utilities.xdmf.XdmfElementGaussPointValues (   h5_results)

Return a list of XDMF Attribute objects for element integration point values in an HDF5 file.

    Keyword arguments:
    h5_results -- the HDF5 group containing the results

    Checks for results stored by variable name in:
    - h5_results["ElementGaussPointValues/<variable>"]

    If no results are found, returns an empty list.

    See:
    - core.operations.ElementGaussPointOutput.

◆ XdmfElementResults()

def python_scripts.utilities.xdmf.XdmfElementResults (   h5_results)

Return a list of XDMF Attribute objects for element results in an HDF5 file.

    Keyword arguments:
    h5_results -- the HDF5 group containing the results

    Checks for results stored by variable name in:
    - h5_results["ElementDataValues/<variable>"]

    If no results are found, returns an empty list.

    See:
    - core.operations.ElementDataValueOutput.

◆ XdmfNodalFlags()

def python_scripts.utilities.xdmf.XdmfNodalFlags (   h5_results)

Return a list of XDMF Attribute objects for nodal flags in an HDF5 file.

    Keyword arguments:
    h5_results -- the HDF5 group containing the flags

    Checks for flags stored in data sets by variable name in:
    - h5_flags["NodalFlagValues/<flag-name>"]

    Expects:
    - each flag variable occurs only once

    If no flags are found, returns an empty list.

    See:
    - core.operations.NodalFlagsValueOutput.

◆ XdmfNodalResults()

def python_scripts.utilities.xdmf.XdmfNodalResults (   h5_results)

Return a list of XDMF Attribute objects for nodal results in an HDF5 file.

    Keyword arguments:
    h5_results -- the HDF5 group containing the results

    Checks for results stored in data sets by variable name in:
    - h5_results["NodalSolutionStepData/<variable-name>"]
    - h5_results["NodalDataValues/<variable-name>"]

    Expects:
    - each result variable occurs only once

    If no results are found, returns an empty list.

    See:
    - core.operations.NodalSolutionStepDataOutput,
    - core.operations.NodalDataValueOutput.

◆ XdmfResults()

def python_scripts.utilities.xdmf.XdmfResults ( h5py.Group  h5_results)

Return a list of XDMF Attribute objects for results in an HDF5 file.

    Keyword arguments:
    h5_results -- the HDF5 group containing the results

Variable Documentation

◆ warn_msg

string warn_msg = "h5py module was not found!"