IOManager

About the IOManager class

The WaveBlocks Project

@author: R. Bourquin @copyright: Copyright (C) 2010, 2011, 2012 R. Bourquin @license: Modified BSD License

Inheritance diagram

Inheritance diagram of IOManager

Class documentation

class WaveBlocks.IOManager

An IOManager class that can save various simulation results into data files. The output files can be processed further for producing e.g. plots.

create_block(blockid=None, groupid='global')

Create a data block with the specified block ID. Each data block can store several chunks of information, and there can be an arbitrary number of data blocks per file.

Parameters:blockid – The ID for the new data block. If not given the blockid will be choosen automatically. The block ID has to be unique.
Returns:The block ID of the created block.
create_file(parameters, filename='simulation_results.hdf5')

Set up a new IOManager instance. The output files are created and opened.

Parameters:
  • parameters – A ParameterProvider instance containing the current simulation parameters. This is only used for determining the size of new data sets.
  • filename – The filename (optionally with filepath) of the file we try to create. If not given the default value from GlobalDefaults is used.
create_group(groupid=None)

Create a data group with the specified group ID. Each data group can contain an arbitrary number of data blocks, and there can be an arbitrary number of data groups per file.

Parameters:groupid – The ID for the new data group. If not given the group ID will be choosen automatically. The group ID has to be unique.
Returns:The group ID of the created group.
finalize()

Close the open output file and reset the internal information.

find_timestep_index(timegridpath, timestep)

Lookup the index for a given timestep.

Note

Assumes the timegrid array is strictly monotone.

get_block_ids(groupid=None, grouped=False)

Return a list containing the IDs for all blocks in the current file structure.

Parameters:
  • groupid – An optional group ID, if given we return only block IDs for blocks which are a member of this group. If it is None we return all block IDs.
  • grouped – If True we group the block IDs by their group into lists. This option is only relevant in case the groupid is not given.
get_group_ids(exclude=[])

Return a list containing the IDs for all groups in the current file structure.

Parameters:exclude – A list of group IDs to exclude. Per default no group is excluded.
get_group_of_block(blockid)

Return the ID of the group a given block belongs to or None if there is no such data block.

Parameters:blockid – The ID of the given block.
get_number_blocks(groupid=None)

Return the number of data blocks in the current file structure.

Parameters:groupid – An optional group ID, if given we count only data blocks which are a member of this group. If it is None we count all data blocks.
get_number_groups()

Return the number of block groups in the current file structure.

must_resize(path, slot, axis=0)

Check if we must resize a given dataset and if yes, resize it.

open_file(filename='simulation_results.hdf5')

Load a given file that contains the results from a former simulation.

Parameters:filename – The filename (optionally with filepath) of the file we try to load. If not given the default value from GlobalDefaults is used.
split_data(data, axis)

Split a multi-dimensional data block into slabs along a given axis.

Parameters:
  • data – The data tensor given.
  • axis – The axis along which to split the data.
Returns:

A list of slices.

Table Of Contents

Previous topic

TimeManager

Next topic

IOM_plugin_energy

This Page