Skip to content

Commit

Permalink
Purge most uses of firedrake_configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
JDBetteridge committed Nov 1, 2024
1 parent 848307a commit 9ca612d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 26 deletions.
5 changes: 3 additions & 2 deletions firedrake/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from pyop2.datatypes import IntType # noqa: F401
from pyop2.datatypes import as_ctypes # noqa: F401
from pyop2.mpi import MPI
from firedrake_configuration import get_config
from firedrake.petsc import get_petsc_variables


# MPI key value for storing a per communicator universal identifier
FIREDRAKE_UID = MPI.Comm.Create_keyval()
Expand All @@ -16,7 +17,7 @@
ScalarType_c = as_cstr(ScalarType)
IntType_c = as_cstr(IntType)

complex_mode = get_config()["options"].get("complex", False)
complex_mode = (get_petsc_variables()["PETSC_SCALAR"].lower() == "complex")

# Remove this (and update test suite) when Slate supports complex mode.
SLATE_SUPPORTS_COMPLEX = False
Expand Down
4 changes: 0 additions & 4 deletions tests/output/test_config_exist.py

This file was deleted.

3 changes: 0 additions & 3 deletions tests/regression/test_manifolds.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import firedrake_configuration
from firedrake import *
import pytest
import numpy as np

config = firedrake_configuration.get_config()


# This test solves a mixed formulation of the Poisson equation with
# inhomogeneous Neumann boundary conditions such that the exact
Expand Down
3 changes: 0 additions & 3 deletions tests/regression/test_project_interp_KMV.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import firedrake_configuration
import pytest
import numpy as np
from firedrake import *
from firedrake.__future__ import *
import finat

config = firedrake_configuration.get_config()


@pytest.fixture(params=["square", "cube"])
def mesh_type(request):
Expand Down
17 changes: 3 additions & 14 deletions tests/test_0init.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest
import os
from firedrake import *
from pathlib import Path


# See https://pytest-xdist.readthedocs.io/en/stable/how-to.html#identifying-the-worker-process-during-a-test
Expand All @@ -26,19 +27,7 @@ def test_pyop2_custom_init():
op2.configuration.reset()


def test_int_type():
import firedrake_configuration
from firedrake.utils import IntType

expected = firedrake_configuration.get_config()["options"]["petsc_int_type"]
actual = {4: "int32", 8: "int64"}[IntType.itemsize]

assert expected == actual


def test_pyop2_cache_dir_set_correctly():
from firedrake_configuration import get_config

config = get_config()
cache_dir = os.path.join(config["options"]["cache_dir"], "pyop2")
root = Path(os.environ.get("VIRTUAL_ENV", "~"))
cache_dir = os.environ.get("PYOP2_CACHE_DIR", str(root.joinpath("pyop2")))
assert op2.configuration["cache_dir"] == cache_dir

0 comments on commit 9ca612d

Please sign in to comment.