Commit 18325c2b authored by Stephan Rave's avatar Stephan Rave
Browse files

[config] remove config check in pymor.tools

parent 4e976f44
......@@ -8,16 +8,19 @@ import tempfile
from contextlib import contextmanager
from .matrices import load_matrix, save_matrix
from pymor.core.config import config
from ...core.exceptions import IOLibsMissing
from pymor.tools.deprecated import Deprecated
if config.HAVE_VTKIO:
from .vtk import read_vtkfile, write_vtk_collection
else:
def read_vtkfile(*args, **kwargs):
raise IOLibsMissing()
write_vtk_collection = read_vtkfile
@Deprecated('pymor.tools.io.vtk.read_vtkfile')
def read_vtkfile(*args, **kwargs):
from .vtk import read_vtkfile
return read_vtkfile(*args, **kwargs)
@Deprecated('pymor.tools.io.vtk.write_vtk_collection')
def write_vtk_collection(*args, **kwargs):
from .vtk import write_vtk_collection
return write_vtk_collection(*args, **kwargs)
@contextmanager
......
......@@ -2,6 +2,10 @@
# Copyright 2013-2021 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (https://opensource.org/licenses/BSD-2-Clause)
from pymor.core.config import require_dependency
require_dependency('VTKIO')
from pathlib import Path
import meshio
......
......@@ -19,7 +19,7 @@ from pymor.tools import formatsrc, timing
from pymor.tools.deprecated import Deprecated
from pymor.tools.floatcmp import almost_less, float_cmp, float_cmp_all
from pymor.tools.formatsrc import print_source
from pymor.tools.io import safe_temporary_filename, change_to_directory, read_vtkfile
from pymor.tools.io import safe_temporary_filename, change_to_directory
from pymor.vectorarrays.numpy import NumpyVectorSpace
from pymortests.base import runmodule
from pymortests.fixtures.grid import hy_rect_or_tria_grid
......@@ -125,6 +125,7 @@ def test_almost_less():
@given(hy_rect_or_tria_grid)
def test_vtkio(grid):
from pymor.discretizers.builtin.grids.vtkio import write_vtk
from pymor.tools.io.vtk import read_vtkfile
steps = 4
for codim, data in enumerate((NumpyVectorSpace.from_numpy(np.ones((steps, grid.size(c))))
for c in range(grid.dim+1))):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment