How to use the petsc.PETSc.Options function in petsc

To help you get started, we’ve selected a few petsc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github firedrakeproject / firedrake / firedrake / solving_utils.py View on Github external
def update_parameters(obj, petsc_obj):
    """Update parameters on a petsc object

    :arg obj: An object with a parameters dict (mapping to petsc options).
    :arg petsc_obj: The PETSc object to set parameters on."""
    # Skip if parameters haven't changed
    if hasattr(obj, '_set_parameters') and obj.parameters == obj._set_parameters:
        return
    opts = PETSc.Options(obj._opt_prefix)
    for k, v in obj.parameters.iteritems():
        if type(v) is bool:
            if v:
                opts[k] = None
        else:
            opts[k] = v
    petsc_obj.setFromOptions()
    obj._set_parameters = obj.parameters.copy()

petsc

PETSc: Portable, Extensible Toolkit for Scientific Computation

BSD-2-Clause
Latest version published 24 days ago

Package Health Score

60 / 100
Full package analysis