<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">from core.modules.vistrails_module import Module, ModuleError
from core.bundles import py_import
Scientific = py_import('Scientific', {'linux-ubuntu':'python-scientific',
                                      'linux-fedora':'ScientificPython'})
from Scientific.IO import NetCDF
numpy = py_import('numpy', {'linux-ubuntu':'python-numpy',
                            'linux-fedora':'numpy'})
import vtk
import datetime

from SelfeBase import SelfeData

class Readers(object):
    namespace='IO'

class SelfeArrayReader(Readers, Module):
    name = 'Selfe Array Reader'

    def compute(self):
        fn = self.getInputFromPort("Filename")
        ar_name = self.getInputFromPort("Array Name")
        f = NetCDF.NetCDFFile(fn, 'r')
        ar = numpy.array(f.variables[ar_name])
        f.close()
        out = self.create_instance_of_type('edu.utah.sci.vistrails.numpyscipy', 'Numpy Array', 'numpy|array')
        out.set_array(ar)
        self.setResult("Output", out)

    @classmethod
    def register(cls,reg,basic):
        reg.add_module(cls, name=cls.name, namespace=cls.namespace)
        reg.add_input_port(cls, "Filename", (basic.String, 'Filename'))
        reg.add_input_port(cls, "Array Name", (basic.String, 'Array name'))
        reg.add_output_port(cls, "Output", (reg.get_module_by_name('edu.utah.sci.vistrails.numpyscipy', 'Numpy Array', 'numpy|array'), 'Output Array'))

class StationReader(Readers, Module):
    name = 'Station Data Reader'

    def read_day(self, lines):
#         print "len(lines) = ", len(lines)
#         if len(lines) &lt;= 1:
#             return None
        start_date = datetime.datetime(1996,1,1)
        td = datetime.timedelta(days=1)
        
        header = lines.pop(0).split()
        timestep = float(header[0].strip())

        corie_date = int(timestep) * td
        corie_date += start_date
        td = datetime.timedelta(hours=1)
        hrs = timestep - float(int(timestep))
        hrs = int(hrs * 24.)
        corie_date += hrs * td
        
        mean_depth = float(header[1].strip())
        elevation = float(header[2].strip())
        num_lvls = int(header[3].strip())

        depth_values = []
        salt_values = []
        temp_values = []
        diffusion_values = []
        U_values = []
        V_values = []
        W_values = []
        for i in range(num_lvls):
            l = lines.pop(0).split()
            depth = float(l[0].strip())
            salinity = float(l[1].strip())
            temp = float(l[2].strip())
            diffusion = float(l[3].strip())
            depth_values.append(depth)
            salt_values.append(salinity)
            temp_values.append(temp)
            diffusion_values.append(diffusion)

        for i in range(num_lvls):
            l = lines.pop(0).split()
            depth = float(l[0].strip())
            U = float(l[1].strip())
            V = float(l[2].strip())
            W = float(l[3].strip())

            U_values.append(U)
            V_values.append(V)
            W_values.append(W)

        return (corie_date, mean_depth, elevation, num_lvls, depth_values, salt_values, temp_values, diffusion_values, U_values, V_values, W_values)
        
    def compute(self):
        f = self.forceGetInputFromPort("File", None)
        fn = self.forceGetInputFromPort("Filename", None)
        if f != None:
            fn = f.name

        try:
            fid = open(fn, 'r')
            buf = fid.read()
            fid.close()

        except:
            raise ModuleError(self, 'Cannot read file:  ' + fn)

        scalar_name = self.getInputFromPort("Scalar Request")
        lines = buf.split('\n')
        timesteps = {}
        num_lvls = 0
        while len(lines) &gt;= num_lvls:
            day = self.read_day(lines)
            num_lvls = day[3]
            day_dict = {}
            day_dict['depth'] = day[4]
            day_dict['salt'] = day[5]
            day_dict['temp'] = day[6]
            day_dict['diffusion'] = day[7]
            day_dict['U'] = day[8]
            day_dict['V'] = day[9]
            day_dict['W'] = day[10]
            day_dict['mean_depth'] = day[1]
            day_dict['elevation'] = day[2]
            timesteps[day[0]] = day_dict

        print "File read:  Forming output arrays"

        day_list = timesteps.keys()
        day_list.sort()
        day_ar = numpy.array(day_list)

        ar_size = (len(day_list), num_lvls)
        depth_ar = numpy.zeros(ar_size)
        salt_ar = numpy.zeros(ar_size)
        temp_ar = numpy.zeros(ar_size)
        diff_ar = numpy.zeros(ar_size)
        u_ar = numpy.zeros(ar_size)
        v_ar = numpy.zeros(ar_size)
        w_ar = numpy.zeros(ar_size)
        mean_depth_ar = numpy.zeros(len(day_list))
        elevation_ar = numpy.zeros(len(day_list))
        scalar_ar = numpy.zeros(ar_size)

        time_index = 0
        for t in day_list:
            timestep = timesteps[t]
            depth = timestep['depth']
            salt = timestep['salt']
            temp = timestep['temp']
            diff = timestep['diffusion']
            u = timestep['U']
            v = timestep['V']
            w = timestep['W']
            mean_depth = timestep['mean_depth']
            elevation = timestep['elevation']
            scalar = timestep[scalar_name]
            
            depth_ar[time_index, :] = numpy.array(depth)
            salt_ar[time_index, :] = numpy.array(salt)
            temp_ar[time_index, :] = numpy.array(temp)
            diff_ar[time_index, :] = numpy.array(diff)
            u_ar[time_index, :] = numpy.array(u)
            v_ar[time_index, :] = numpy.array(v)
            w_ar[time_index, :] = numpy.array(w)
            scalar_ar[time_index, :] = numpy.array(scalar)
            mean_depth_ar[time_index] = mean_depth
            elevation_ar[time_index] = elevation                

            time_index += 1

        out_time = self.create_instance_of_type('edu.utah.sci.vistrails.numpyscipy',
                                                'Numpy Array', 'numpy|array')
        out_depth = self.create_instance_of_type('edu.utah.sci.vistrails.numpyscipy',
                                                 'Numpy Array', 'numpy|array')
        out_salt = self.create_instance_of_type('edu.utah.sci.vistrails.numpyscipy',
                                                'Numpy Array', 'numpy|array')
        out_temp = self.create_instance_of_type('edu.utah.sci.vistrails.numpyscipy',
                                                'Numpy Array', 'numpy|array')
        out_diff = self.create_instance_of_type('edu.utah.sci.vistrails.numpyscipy',
                                                'Numpy Array', 'numpy|array')
        out_u = self.create_instance_of_type('edu.utah.sci.vistrails.numpyscipy',
                                             'Numpy Array', 'numpy|array')
        out_v = self.create_instance_of_type('edu.utah.sci.vistrails.numpyscipy',
                                             'Numpy Array', 'numpy|array')
        out_w = self.create_instance_of_type('edu.utah.sci.vistrails.numpyscipy',
                                             'Numpy Array', 'numpy|array')
        out_mean = self.create_instance_of_type('edu.utah.sci.vistrails.numpyscipy',
                                                'Numpy Array', 'numpy|array')
        out_elev = self.create_instance_of_type('edu.utah.sci.vistrails.numpyscipy',
                                                'Numpy Array', 'numpy|array')
        out_scalars = self.create_instance_of_type('edu.utah.sci.vistrails.numpyscipy',
                                                'Numpy Array', 'numpy|array')

        out_time.set_array(day_ar)
        out_depth.set_array(depth_ar)
        out_salt.set_array(salt_ar)
        out_temp.set_array(temp_ar)
        out_diff.set_array(diff_ar)
        out_u.set_array(u_ar)
        out_v.set_array(v_ar)
        out_w.set_array(w_ar)
        out_mean.set_array(mean_depth_ar)
        out_elev.set_array(elevation_ar)
        out_scalars.set_array(scalar_ar)
        
        self.setResult("Time", out_time)
        self.setResult("Output Depth", out_depth)
        self.setResult("Output Salt", out_salt)
        self.setResult("Output Temperature", out_temp)
        self.setResult("Output Diffusion", out_diff)
        self.setResult("Output U", out_u)
        self.setResult("Output V", out_v)
        self.setResult("Output W", out_w)
        self.setResult("Output Mean Depth", out_mean)
        self.setResult("Output Elevation", out_elev)
        self.setResult("Output Scalars", out_scalars)
        
    @classmethod
    def register(cls, reg, basic):
        reg.add_module(cls, name=cls.name, namespace=cls.namespace)
        reg.add_input_port(cls, "File", (basic.File, 'Input File'))
        reg.add_input_port(cls, "Filename", (basic.String, 'Input Filename'))
        reg.add_input_port(cls, "Scalar Request", (basic.String, 'Requested Scalars'))
        reg.add_output_port(cls, "Time", (reg.get_module_by_name('edu.utah.sci.vistrails.numpyscipy', 'Numpy Array', 'numpy|array'), 'Output Time'))
        reg.add_output_port(cls, "Output Depth", (reg.get_module_by_name('edu.utah.sci.vistrails.numpyscipy', 'Numpy Array', 'numpy|array'), 'Output Depth'))
        reg.add_output_port(cls, "Output Salt", (reg.get_module_by_name('edu.utah.sci.vistrails.numpyscipy', 'Numpy Array', 'numpy|array'), 'Output Salt'))
        reg.add_output_port(cls, "Output Temperature", (reg.get_module_by_name('edu.utah.sci.vistrails.numpyscipy', 'Numpy Array', 'numpy|array'), 'Output Temperature'))
        reg.add_output_port(cls, "Output Diffusion", (reg.get_module_by_name('edu.utah.sci.vistrails.numpyscipy', 'Numpy Array', 'numpy|array'), 'Output Diffusion'))
        reg.add_output_port(cls, "Output U", (reg.get_module_by_name('edu.utah.sci.vistrails.numpyscipy', 'Numpy Array', 'numpy|array'), 'Output U'))
        reg.add_output_port(cls, "Output V", (reg.get_module_by_name('edu.utah.sci.vistrails.numpyscipy', 'Numpy Array', 'numpy|array'), 'Output V'))
        reg.add_output_port(cls, "Output W", (reg.get_module_by_name('edu.utah.sci.vistrails.numpyscipy', 'Numpy Array', 'numpy|array'), 'Output W'))
        reg.add_output_port(cls, "Output Scalars", (reg.get_module_by_name('edu.utah.sci.vistrails.numpyscipy', 'Numpy Array', 'numpy|array'), 'Output Scalars'))
        reg.add_output_port(cls, "Output Mean Depth", (reg.get_module_by_name('edu.utah.sci.vistrails.numpyscipy', 'Numpy Array', 'numpy|array'), 'Output mean Depth'))
        reg.add_output_port(cls, "Output Elevation", (reg.get_module_by_name('edu.utah.sci.vistrails.numpyscipy', 'Numpy Array', 'numpy|array'), 'Output Elevation'))

class SelfeReader(Readers, Module):
    name = 'Selfe Grid Reader'
    
    def compute(self):
        fn = self.getInputFromPort("Filename")
        f = NetCDF.NetCDFFile(fn, 'r')
        x = numpy.array(f.variables['x'])
        y = numpy.array(f.variables['y'])
        plane_connectivity = numpy.array(f.variables['nm'])
        allz = numpy.array(f.variables['z'])

        zmod = self.forceGetInputFromPort("Z Scaling")
        if zmod == None:
            zmod = 1.

        ts = self.getInputFromPort("Timestep")
        if ts &gt;= allz.shape[0]:
            ts = 0

        z = allz[ts].squeeze()
        vtkout = vtk.vtkUnstructuredGrid()
        
        # Just for memory sake, we should get rid of as much as we can...
        del allz
        
        i = 0
        vtk_pts = vtk.vtkPoints()
        for depth in range(z.shape[0]):
            print "depth " + str(depth) + " being populated"
            for node in range(x.shape[0]):
                ix = x[node]
                iy = y[node]
                iz = z[depth, node] * zmod
#                iz = float(depth* 40000)
                vtk_pts.InsertNextPoint(ix, iy, iz)
                i += 1
        
        print "Adding " + str(i) + " points to vtkUnstructuredGrid"
        vtkout.SetPoints(vtk_pts)
        print "Points added successfully..."
        
        # the points array is now populated...
        # let's do the connectivity now...each plane's
        # connectivity is defined in the plane_connectivity array
        num_tris = plane_connectivity.shape[1]
        n_depth = z.shape[0]
        n_slabs = n_depth - 1
        n_pts = x.shape[0]
        
        del x
        del y
        del z

        for i in range(n_slabs):
            top_offset = i * n_pts
            bot_offset = (i+1) * n_pts
            print "Forming prisms for slab " + str(i)
            for t in range(num_tris):
                tri = plane_connectivity[:,t].squeeze()
                lst = vtk.vtkIdList()
                lst.InsertNextId(tri[0]-1+top_offset)
                lst.InsertNextId(tri[1]-1+top_offset)
                lst.InsertNextId(tri[2]-1+top_offset)
                lst.InsertNextId(tri[0]-1+bot_offset)
                lst.InsertNextId(tri[1]-1+bot_offset)
                lst.InsertNextId(tri[2]-1+bot_offset)
                vtkout.InsertNextCell(13, lst)


        scalars = self.forceGetInputFromPort("Scalars")
        if scalars != None:
            try:
                s = numpy.array(f.variables[scalars])
            except:
                raise ModuleError("Could not find array named:  " + scalars)

            s = s[ts].squeeze().flatten()
            s_ar = vtk.vtkFloatArray()
            s_ar.SetName(scalars)
            for i in range(s.shape[0]):
                s_ar.InsertNextValue(s[i])

            s_ar.SetName(scalars)
            vtkout.GetPointData().SetScalars(s_ar)
            
        
        out = self.create_instance_of_type('edu.utah.sci.vistrails.vtk', 'vtkUnstructuredGrid')
        out.vtkInstance = vtkout
        self.setResult("Output Mesh", out)

    @classmethod
    def register(cls, reg, basic):
        reg.add_module(cls, namespace=cls.namespace, name=cls.name)
        reg.add_input_port(cls, "Filename", (basic.String, 'Filename'))
        reg.add_input_port(cls, "Timestep", (basic.Integer, 'Timestep'))
        reg.add_input_port(cls, "Z Scaling", (basic.Float, 'Z scale factor'))
        reg.add_input_port(cls, "Scalars", (basic.String, 'Scalar field'))
        reg.add_output_port(cls, "Output Mesh", (reg.get_module_by_name('edu.utah.sci.vistrails.vtk','vtkUnstructuredGrid'), 'Output Mesh'))

class GridPakReader(Readers, Module):
    name = 'Gridpak Reader'
    def compute(self):
        fn = self.getInputFromPort("Filename")
        f = NetCDF.NetCDFFile(fn, 'r')

        grid_x = 'x_rho'
        grid_y = 'y_rho'
        grid_z = 'z_rho'

        grid_name = self.forceGetInputFromPort("Grid Name")
        if grid_name:
            grid_x = 'x_' + grid_name
            grid_y = 'y_' + grid_name
            grid_z = 'z_' + grid_name
        
        x = numpy.array(f.variables[grid_x])
        y = numpy.array(f.variables[grid_y])
        z = numpy.array(f.variables[grid_z])
        h = numpy.array(f.variables['h'])

        f.close()

        zmod = self.forceGetInputFromPort("Z Scaling")
        if zmod == None:
            zmod = 1.

        vtkout = self.create_instance_of_type('edu.utah.sci.vistrails.vtk', 'vtkStructuredGrid')
        vtkout.vtkInstance = vtk.vtkStructuredGrid()
        pts = vtk.vtkPoints()

        for k in range(z.shape[2]):
            for j in range(z.shape[1]):
                for i in range(z.shape[0]):
                    x_coord = x[i,j]
                    y_coord = y[i,j]
#                    z_coord = h[i,j] / z.shape[2] * float(k)
                    z_coord = z[i,j,k] * float(zmod)
                    
                    pts.InsertNextPoint(x_coord, y_coord, z_coord * zmod)

        print z.shape
        vtkout.vtkInstance.SetDimensions(z.shape)
        
        vtkout.vtkInstance.SetPoints(pts)
        self.setResult("Output Mesh", vtkout)

    @classmethod
    def register(cls, reg, basic):
        reg.add_module(cls, namespace=cls.namespace, name=cls.name)
        reg.add_input_port(cls, "Filename", (basic.String, 'Filename'))
        reg.add_input_port(cls, "Z Scaling", (basic.Float, 'Z scale factor'))
        reg.add_input_port(cls, "Grid Name", (basic.String, 'Grid name'), True)
        reg.add_output_port(cls, "Output Mesh", (reg.get_module_by_name('edu.utah.sci.vistrails.vtk','vtkStructuredGrid'), 'Output Mesh'))
        
class HGridReader(Readers, Module):
    name = "Horizontal Grid Reader"
    def compute(self):
        f = self.forceGetInputFromPort("File", None)
        fn = self.forceGetInputFromPort("Filename", None)
        if f != None:
            fn = f.name

        fid = None
        try:
            fid = open(fn, 'r')
        except:
            raise ModuleError(self, "Could not open file " + fn)

        buf = fid.read()
        fid.close()

        lines = buf.split('\n')
        # Pop off the first comment line...
        lines.pop(0)
        # Grab the topology
        cells_pts = lines.pop(0).split()
        num_cells = int(cells_pts[0])
        num_verts = int(cells_pts[1])

#        verts = {}
        vtkout = self.create_instance_of_type('edu.utah.sci.vistrails.vtk', 'vtkPolyData')
        vtkout.vtkInstance = vtk.vtkPolyData()
        vtkpts = vtk.vtkPoints()
        vtkpts.SetNumberOfPoints(num_verts)
        min_z = 999999999
        max_z = -999999999

        elevation = vtk.vtkFloatArray()
        elevation.SetNumberOfComponents(1)
        elevation.SetName("elevation")
        elevation.SetNumberOfTuples(num_verts)
        
        for i in range(num_verts):
            vert = lines.pop(0).split()
            vert_id = int(vert[0]) - 1
            vert_x = float(vert[1])
            vert_y = float(vert[2])
            vert_z = float(vert[3])
            elevation.SetValue(i, vert_z*-1.)
            vtkpts.SetPoint(vert_id, vert_x, vert_y, 0.0)

        vtkout.vtkInstance.SetPoints(vtkpts)
        vtkout.vtkInstance.GetPointData().AddArray(elevation)
        vtkout.vtkInstance.GetPointData().SetScalars(elevation)
        
        vtkcells = vtk.vtkCellArray()
        for i in range(num_cells):
            cell = lines.pop(0).split()
            cell_id = int(cell[0])
            cell_type = int(cell[1])
            cell_a = int(cell[2]) - 1
            cell_b = int(cell[3]) - 1
            cell_c = int(cell[4]) - 1
            ids = vtk.vtkIdList()
            ids.InsertNextId(cell_a)
            ids.InsertNextId(cell_b)
            ids.InsertNextId(cell_c)
            vtkcells.InsertNextCell(ids)
#            cells[cell_id] = (cell_a, cell_b, cell_c)
        vtkout.vtkInstance.SetPolys(vtkcells)

        self.setResult("Output Mesh", vtkout)

    @classmethod
    def register(cls, reg, basic):
        reg.add_module(cls, namespace=cls.namespace, name=cls.name)
        reg.add_input_port(cls, "Filename", (basic.String, 'Filename'))
        reg.add_input_port(cls, "File", (basic.File, 'File'))
        reg.add_output_port(cls, "Output Mesh", (reg.get_module_by_name('edu.utah.sci.vistrails.vtk','vtkPolyData'), 'Output Mesh'))

class VGridReader(Readers, Module):
    name = "Vertical Grid Reader"

    def compute(self):
        hgrid = self.getInputFromPort("HGrid")
        vtkhgrid = hgrid.vtkInstance
        
        f = self.forceGetInputFromPort("File", None)
        fn = self.forceGetInputFromPort("Filename", None)
        if f != None:
            fn = f.name

        fid = None
        try:
            fid = open(fn, 'r')
        except:
            raise ModuleError(self, "Could not open file " + fn)

        buf = fid.read()
        fid.close()

        buf = buf.split('\n')
        header = buf.pop(0)
        buf.pop(0)
        header = header.split()
        # Number stored is the number below the free surface
        num_z_levels = int(header[1])
        h_s = numpy.abs(float(header[2])) * -1.
        num_levels = int(header[0]) + 1
        z_levels = {}
        for i in range(num_z_levels):
            line = buf.pop(0)
            line = line.split()
            lvl = int(line[0])
            depth = float(line[1])
            z_levels[lvl] = depth

        s_levels = {}
        buf.pop(0)
        s_header = buf.pop(0)
        s_header = s_header.split()
        h_c = float(s_header[0])
        num_s_levels = num_levels - num_z_levels
        for i in range(num_s_levels):
            line = buf.pop(0)
            line = line.split()
            s_lvl = int(line[0])
            s_val = float(line[1])
            s_levels[s_lvl] = s_val
            
        print "vgrid.in file parsed..."
        out_mesh = vtk.vtkUnstructuredGrid()

        # Start with the Z levels - Bottom up.
        grid_pts = vtk.vtkPoints()
        scalars = vtk.vtkFloatArray()
        hgrid_elev = vtkhgrid.GetPointData().GetScalars("elevation")

        for i in range(num_z_levels):
            z = z_levels[i+1]
            for j in range(vtkhgrid.GetNumberOfPoints()):
                hgridpt = vtkhgrid.GetPoint(j)
                grid_pts.InsertNextPoint(hgridpt[0], hgridpt[1], z)
                if z &gt;= hgrid_elev.GetTuple1(j):
                    scalars.InsertNextTuple1(float(z))
                else:
                    scalars.InsertNextTuple1(float(z))

        print "Mesh populated with Z Levels ... no cells created"
        for i in range(num_s_levels):
            if i == 0:
                continue
            mult = numpy.abs(s_levels[i+1])
            for j in range(vtkhgrid.GetNumberOfPoints()):
                hgridpt = vtkhgrid.GetPoint(j)
                elev = hgrid_elev.GetTuple1(j)
                grid_pts.InsertNextPoint(hgridpt[0], hgridpt[1], elev * mult)
                scalars.InsertNextTuple1(float(elev))

        print "Mesh populated with S Levels ... no cells created"
        # The points are added - now we need to form the cells.
        out_mesh.SetPoints(grid_pts)
        out_mesh.GetPointData().SetScalars(scalars)

        num_cells = vtkhgrid.GetNumberOfCells()
        num_pts_per_lvl = vtkhgrid.GetNumberOfPoints()
        cells = {}
        for c in range(num_cells):
            cur_cell = vtkhgrid.GetCell(c)
            ptlist = [cur_cell.GetPointId(0),
                      cur_cell.GetPointId(1),
                      cur_cell.GetPointId(2)]
            cells[c] = ptlist

        num_slabs = num_levels - 1
        mesh_cell_array = vtk.vtkCellArray()
        for slab in range(num_slabs-1):
            print "Processing slab: ", slab
            offset = num_pts_per_lvl * slab
            top_offset = num_pts_per_lvl * (slab + 1)
            print "Offset, Top Offset:  ", offset, top_offset
            for c in range(num_cells):
                pts = cells[c]
                cell_pts = []
                    
                cell_pts.append(pts[0] + offset)
                cell_pts.append(pts[1] + offset)
                cell_pts.append(pts[2] + offset)
                cell_pts.append(pts[0] + top_offset)
                cell_pts.append(pts[1] + top_offset)
                cell_pts.append(pts[2] + top_offset)

                mesh_cell = vtk.vtkIdList()
                for p in cell_pts:
                    mesh_cell.InsertNextId(p)
                
                mesh_cell_array.InsertNextCell(mesh_cell)

        print "Cells created"
        # The cells are formed - now we need to clip based on the 
        # elevation of each point - use vtkDataSetClipper
        out_mesh.SetCells(vtk.VTK_WEDGE, mesh_cell_array)

        print out_mesh
#        clipper = vtk.vtkClipDataSet()
#        clipper.SetInput(out_mesh)
#        clipper.SetValue(0.0)
#        clipper.GenerateClipScalarsOff()
#        clipper.Update()

        out = self.create_instance_of_type('edu.utah.sci.vistrails.vtk','vtkUnstructuredGrid')
        out.vtkInstance = out_mesh
        self.setResult("Output Mesh", out)
#        self.setResult("Output Mesh", clipper.GetOutput())

    @classmethod
    def register(cls, reg, basic):
        reg.add_module(cls, name=cls.name, namespace=cls.namespace)
        reg.add_input_port(cls, "HGrid", (reg.get_module_by_name('edu.utah.sci.vistrails.vtk','vtkPolyData'), 'Horizontal Mesh'))
        reg.add_input_port(cls, "File", (basic.File, 'VGrid File'))
        reg.add_input_port(cls, "Filename", (basic.String, 'VGrid Filename'))
        reg.add_output_port(cls, "Output Mesh", (reg.get_module_by_name('edu.utah.sci.vistrails.vtk','vtkUnstructuredGrid'), 'Output Mesh'))
</pre></body></html>