From b10c24a3222e5a81c8f4ee6be8158158640076c3 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Sun, 26 Apr 2020 20:49:46 -0500 Subject: [PATCH] Moving vtk import inside of the new write_data_to_vtk method. --- openmc/mesh.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/openmc/mesh.py b/openmc/mesh.py index 344a11b05c..1c934996fd 100644 --- a/openmc/mesh.py +++ b/openmc/mesh.py @@ -12,13 +12,6 @@ from ._xml import get_text from .mixin import IDManagerMixin from .surface import _BOUNDARY_TYPES -try: - import vtk - from vtk.util import numpy_support as vtk_npsup - _VTK = True -except ImportError: - _VTK = False - class MeshBase(IDManagerMixin, ABC): """A mesh that partitions geometry for tallying purposes. @@ -695,8 +688,8 @@ class UnstructuredMesh(MeshBase): volume of the mesh elements """ - if not _VTK: - raise RuntimeError("The VTK Python module is not installed.") + import vtk + from vtk.util import numpy_support as vtk_npsup if self.centroids is None: raise RuntimeError("No centroid information is present on this "