matflow.param_classes.moose.MooseInputDeck#

class matflow.param_classes.moose.MooseInputDeck(variables=None, **block_dat)#

Bases: ParameterValue

Moose input parametrisation.

Notes

We don’t attempt to parse value types (e.g. floats, ints); everything stays as a string.

Methods

add_variables

Add variables to the input deck.

dump_element_group_to_HDF5_group

Write a list (from an element group) of parameter values to an HDF5 group.

dump_to_HDF5_group

Write this parameter value to an HDF5 group.

from_file

Generate from an existing input file, optionally with updates to the specified paths.

from_string

Generate from a string, like that found in a file.

parse_from_string

Parse the contents of a MOOSE input deck file, returning the both the nested block structure, and any top-level variables.

prepare_JSON_dump

Prepare this parameter value for serialisation as JSON.

save_from_HDF5_group

Extract a parameter value from an HDF5 group.

save_from_JSON

Extract a parameter value from JSON data.

to_dict

Serialise this parameter value as a dictionary.

to_file

Write the input file to disk.

to_string

Transform to a string.

update

Update paths within the input deck with the specified values.

Parameters:

variables (dict | None) –

add_variables(vars)#

Add variables to the input deck.

classmethod dump_element_group_to_HDF5_group(objs, group)#

Write a list (from an element group) of parameter values to an HDF5 group.

Parameters:
  • objs (list[Self]) –

  • group (HDF5Group) –

dump_to_HDF5_group(group)#

Write this parameter value to an HDF5 group.

Parameters:

group (HDF5Group) –

classmethod from_file(path, updates=None)#

Generate from an existing input file, optionally with updates to the specified paths.

Parameters:
classmethod from_string(string, updates=None)#

Generate from a string, like that found in a file.

Parameters:

updates (dict[str | tuple[str], Any] | None) –

static parse_from_string(contents)#

Parse the contents of a MOOSE input deck file, returning the both the nested block structure, and any top-level variables.

Parameters:

contents (str) –

Return type:

tuple[dict[str, Any], dict[str, Any]]

prepare_JSON_dump()#

Prepare this parameter value for serialisation as JSON.

Return type:

dict[str, Any]

classmethod save_from_HDF5_group(group, param_id, workflow)#

Extract a parameter value from an HDF5 group.

Parameters:
  • group (HDF5Group) –

  • param_id (int) –

  • workflow (Workflow) –

classmethod save_from_JSON(data, param_id, workflow)#

Extract a parameter value from JSON data.

Parameters:
to_dict()#

Serialise this parameter value as a dictionary.

Return type:

dict[str, Any]

to_file(path)#

Write the input file to disk.

Parameters:

path (str | Path) –

to_string()#

Transform to a string.

update(upd)#

Update paths within the input deck with the specified values.

Parameters:

upd (dict[str | tuple[str], Any]) –