Reader type plugin, read as vtkRectilinearGrid
This commit is contained in:
parent
b23a2e3df5
commit
ca86863d6d
1 changed files with 22 additions and 3 deletions
|
|
@ -5,10 +5,10 @@ from vtkmodules.util.vtkAlgorithm import VTKPythonAlgorithmBase
|
|||
from vtkmodules.numpy_interface import dataset_adapter as dsa
|
||||
|
||||
# new module for ParaView-specific decorators.
|
||||
from paraview.util.vtkAlgorithm import smproxy, smproperty, smdomain
|
||||
from paraview.util.vtkAlgorithm import smproxy, smproperty, smdomain, smhint
|
||||
|
||||
# to add a source, instead of a filter, use the `smproxy.source` decorator.
|
||||
@smproxy.source(label="POSTECH Turbulent Combustion DNS Reader")
|
||||
@smproxy.reader(filename_patterns="fort.*", file_description="Turbulent Combustion DNS data", label="POSTECH Turbulent Combustion DNS Reader")
|
||||
class PythonDnsDataReader(VTKPythonAlgorithmBase):
|
||||
"""This is dummy VTKPythonAlgorithmBase subclass that
|
||||
simply puts out a Superquadric poly data using a vtkSuperquadricSource
|
||||
|
|
@ -18,13 +18,32 @@ class PythonDnsDataReader(VTKPythonAlgorithmBase):
|
|||
nInputPorts=0,
|
||||
nOutputPorts=1,
|
||||
outputType='vtkRectilinearGrid')
|
||||
self._filename = None
|
||||
|
||||
@smproperty.stringvector(name="FileName")
|
||||
@smdomain.filelist()
|
||||
# @smhint.filechooser(filename_patterns="fort.*", file_description="Numpy CSV files")
|
||||
def SetFileName(self, name):
|
||||
"""Specify filename for the file to read."""
|
||||
if self._filename != name:
|
||||
self._filename = name
|
||||
self._ndata = None
|
||||
self._timesteps = None
|
||||
self.Modified()
|
||||
|
||||
|
||||
def RequestData(self, request, inInfo, outInfo):
|
||||
import vtk
|
||||
from vtkmodules.vtkCommonDataModel import vtkRectilinearGrid
|
||||
output = vtkRectilinearGrid.GetData(outInfo, 0)
|
||||
|
||||
filename = 'E:/cygwin64/home/ignis/jupyter_notebook_home/FSD-IC1-IC4/IC4-samples/fort.15550'
|
||||
if self._filename is None:
|
||||
# Note, exceptions are totally fine!
|
||||
raise RuntimeError("No filename specified")
|
||||
|
||||
print(self._filename)
|
||||
|
||||
filename = self._filename
|
||||
t, nx, ny, nz, U, V, W, Y0, Y1 = self._read_data(filename)
|
||||
|
||||
u = U.ravel()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue