Skip to content

Convert PC Python objects into strings - #46

Draft
connorjward wants to merge 3 commits into
connorjward/appctx-autofrom
connorjward/pcpython-detect
Draft

Convert PC Python objects into strings#46
connorjward wants to merge 3 commits into
connorjward/appctx-autofrom
connorjward/pcpython-detect

Conversation

@connorjward

Copy link
Copy Markdown
Collaborator

Makes it much more pleasant to construct preconditioners.

It really is that easy.

(Tests and Firedrake PR to follow)

Makes it much more pleasant to construct preconditioners.
Comment thread petsctools/options.py
Comment thread petsctools/options.py
@JHopeCollins

Copy link
Copy Markdown
Member

I am very happy with this functionality!

One small request. Can we have a test that non-PC objects also get converted?
Doesn't have to set up a solver or anything, just something like:

class MyPythonSNES:
	pass

def test_python_type_option():
	with petsctools.inserted_options(
		parameters={
			"snes_type": "python",
			"snes_python_type": MyPythonSNES,
		}
	):
		assert PETSc.Options()["snes_python_type"] == f"{__name__}.MyPythonSNES", "Python type name was not substituted into the options dictionary"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants