pyissm.model.classes.toolkits

class pyissm.model.classes.toolkits(other=None)

Bases: manage_state

Toolkits parameters class for ISSM.

This class encapsulates toolkit configuration parameters for the ISSM (Ice Sheet System Model) framework. Toolkits define solver options and configurations for different types of analyses, including linear solvers, preconditioners, and other computational tools used in ISSM simulations.

Parameters:

other (any, optional) – Any other class object that contains common fields to inherit from. If values in other differ from default values, they will override the default values.

DefaultToolkit

Default toolkit configuration (automatically set based on available libraries like MUMPS, GSL, PETSc).

Type:

dict

RecoveryAnalysis

Toolkit configuration for recovery mode analysis (same as DefaultToolkit by default).

Type:

dict

__init__(self, other=None)

Initializes the toolkits parameters, optionally inheriting from another instance.

__repr__(self)

Returns a detailed string representation of the toolkits parameters.

__str__(self)

Returns a short string identifying the class.

Examples

md.toolkits = pyissm.model.classes.toolkits() # Toolkit configurations are automatically set based on available libraries # Additional analysis-specific toolkits can be added as needed

__init__(other=None)

Initialize the instance with optional field inheritance.

Parameters:

other (object, optional) – Another instance to inherit field values from. If provided, any fields in the current instance that differ from the default values and exist in ‘other’ will be replaced with the values from ‘other’.

Notes

The inheritance process:

  1. Iterates through all attributes of the current instance

  2. Checks if the same attribute exists in the ‘other’ instance

  3. Compares field values using _fields_equal()

  4. If different, replaces the current value with the ‘other’ value

This enables the common ISSM pattern where classes can inherit configurations from existing instances while maintaining their default values for unspecified fields.

Methods

__init__([other])

Initialize the instance with optional field inheritance.

check_consistency(md, solution, analyses)

Check consistency of the [toolkits.toolkits] parameters.

issm_enum_string()

Default ISSM C++ enum string used during marshalling.

write_toolkits_file(filename)

Build a PETSc compatible options file from the toolkits model field.

check_consistency(md, solution, analyses)

Check consistency of the [toolkits.toolkits] parameters.

Parameters:
  • md (pyissm.model.Model) – The model object to check.

  • solution (str) – The solution name to check.

  • analyses (list of str) – List of analyses to check consistency for.

Returns:

md – The model object with any consistency errors noted.

Return type:

pyissm.model.Model

write_toolkits_file(filename)

Build a PETSc compatible options file from the toolkits model field.

This method creates a PETSc compatible options file from the current toolkits configuration. The generated file can be used with both ‘petsc’ and ‘issm’ toolkit types for solver configuration in ISSM simulations.

Parameters:

filename (str) – Path and name of the output file to write the toolkit options to.

Raises:
  • IOError – If the specified file cannot be opened for writing.

  • TypeError – If any option value is not a supported type (bool, int, float, or str).

Examples

>>> md.toolkits.write_toolkits_file('solver_options.toolkits')