Example #1
0
def send_errors_to_logging():
    """Send all VTK error/warning messages to Python's logging module."""
    error_output = vtk.vtkStringOutputWindow()
    error_win = vtk.vtkOutputWindow()
    error_win.SetInstance(error_output)
    obs = Observer()
    return obs.observe(error_output)
Example #2
0
import glob
import numpy as np
from vtk import (
    vtkDataReader,
    vtkXMLFileReadTester,
    vtkStringOutputWindow,
    vtkOutputWindow,
)
from ogs5py.tools.types import PCS_TYP
from ogs5py.reader.vtkhelper import vtkreader_dict, XMLreader_dict
from ogs5py.tools.output import split_ply_path, split_pnt_path, readpvd_single
from ogs5py.reader.techelper import readtec_single_table, readtec_multi_table
from ogs5py.tools.tools import split_file_path

# redirect VTK error to a string
VTK_ERR = vtkStringOutputWindow()
"""VTK Error output. Accessible with ``VTK_ERR.GetOutput()``"""

VTK_STD_OUT = vtkOutputWindow()
VTK_STD_OUT.SetInstance(VTK_ERR)


###############################################################################
# vtk readers
###############################################################################


def readvtk_single(infile):
    """Read an arbitrary vtk/vtkXML file to a dictionary wtih its data."""
    xml_checker = vtkXMLFileReadTester()
    xml_checker.SetFileName(infile)