class Pipeline:

            # Define source of pipeline
            grid = coprocessor.CreateProducer(datadescription, "input")

            if (write_full_output == True):
                fullWriter = pvs.XMLPUnstructuredGridWriter(
                    Input=grid, DataMode="Appended", CompressorType="ZLib")
                coprocessor.RegisterWriter(fullWriter,
                                           filename='full_output_%t.pvtu',
                                           freq=1)

            # Create a spherical slice
            slice = pvs.Slice(Input=grid)
            slice.SliceType = 'Sphere'
            slice.Triangulatetheslice = 0
            slice.SliceOffsetValues = [0.0]
            slice.SliceType.Radius = sphere_radius

            # Create writer for this data and register it with the pipeline
            sliceWriter = pvs.XMLPPolyDataWriter(Input=slice,
                                                 DataMode="Appended",
                                                 CompressorType="ZLib")
            coprocessor.RegisterWriter(sliceWriter,
                                       filename='spherical_slice_%t.pvtp',
                                       freq=1)
        class Pipeline:

            # Define source of pipeline
            grid = coprocessor.CreateProducer(datadescription, "input")

            if (write_full_output == True):
                fullWriter = pvs.XMLPUnstructuredGridWriter(
                    Input=grid, DataMode="Appended", CompressorType="ZLib")
                coprocessor.RegisterWriter(fullWriter,
                                           filename='full_output_%t.pvtu',
                                           freq=1)

            # Determine grid bounds
            gridBounds = grid.GetClientSideObject().GetOutputDataObject(
                0).GetBounds()

            # Plane slice at the desired longitude
            slice = pvs.Slice(Input=grid)
            slice.SliceType = 'Plane'
            slice.Triangulatetheslice = 0
            slice.SliceOffsetValues = [0.0]
            slice.SliceType.Origin = [
                longitude / 180.0 * math.pi, 0, gridBounds[4]
            ]
            slice.SliceType.Normal = [1, 0, 0]

            # Create new writer
            sliceWriter = pvs.XMLPPolyDataWriter(Input=slice,
                                                 DataMode="Appended",
                                                 CompressorType="ZLib")
            coprocessor.RegisterWriter(sliceWriter,
                                       filename='meridional_slice_%t.pvtp',
                                       freq=1)
    class Pipeline:

      # Define source of pipeline
      grid = coprocessor.CreateProducer( datadescription, "input" )

      # Create writer for this data and register it with the pipeline
      parallelWriter = pvs.XMLPUnstructuredGridWriter(Input=grid)
      coprocessor.RegisterWriter(parallelWriter, filename='field_%t.pvtu', freq=1)
        class Pipeline:

            # Define source of pipeline
            grid = coprocessor.CreateProducer(datadescription, "input")

            if (write_full_output == True):
                fullWriter = pvs.XMLPUnstructuredGridWriter(
                    Input=grid, DataMode="Appended", CompressorType="ZLib")
                coprocessor.RegisterWriter(fullWriter,
                                           filename='full_output_%t.pvtu',
                                           freq=1)

            # Create a spherical slice
            slice = pvs.Slice(Input=grid)
            slice.SliceType = 'Sphere'
            slice.Triangulatetheslice = 0
            slice.SliceOffsetValues = [0.0]
            slice.SliceType.Radius = sphere_radius

            # Generate ghost cells - needed by CellDatatoPointData filter
            ghosts = pvs.GhostCellsGenerator(Input=grid)
            ghosts.BuildIfRequired = 0
            ghosts.MinimumNumberOfGhostLevels = 1

            # Convert cell data to point data, which is required for good contour results
            # Request "piece invariance" to ensure consistent values at
            # partition boundaries.
            #
            # CAUTION: THIS FILTER AVERAGES DATA FROM ALL CELLS SURROUNDING A POINT,
            #          WHICH REDUCES ACCURACY
            cell2point = pvs.CellDatatoPointData(Input=ghosts)

            # Create contours
            # Note that the "tube" filter can be used to highlight contours if needed.
            contours = pvs.Contour(Input=cell2point)
            contours.Isosurfaces = contour_values
            contours.ContourBy = ['POINTS', 'rho']
            contours.PointMergeMethod = 'Uniform Binning'

            # Create writers for slice and contour data and register them with the pipeline
            # Note that slice and contours generate separate datasets, so they need to be
            # written to separate files.
            sliceWriter = pvs.XMLPPolyDataWriter(Input=slice,
                                                 DataMode="Appended",
                                                 CompressorType="ZLib")
            coprocessor.RegisterWriter(sliceWriter,
                                       filename='spherical_slice_%t.pvtp',
                                       freq=1)

            # Create a new render view
            renderView = pvs.CreateView('RenderView')
            renderView.ViewSize = [1500, 768]
            renderView.AxesGrid = 'GridAxes3DActor'
            renderView.StereoType = 0
            renderView.CameraPosition = [0.0, 1.0, 0.3]
            renderView.CameraViewUp = [0.0, 0.0, 1.0]
            renderView.CameraParallelScale = 1.0
            renderView.Background = [0.32, 0.34, 0.43]
            renderView.ViewTime = datadescription.GetTime()

            # Register the view with coprocessor
            # and provide it with information such as the filename to use,
            # how frequently to write the images, etc.
            coprocessor.RegisterView(renderView,
                                     filename='contours_%t.png',
                                     freq=1,
                                     fittoscreen=1,
                                     magnification=1,
                                     width=1500,
                                     height=768,
                                     cinema={})

            # Create colour transfer function for field
            LUT = pvs.GetColorTransferFunction('rho')
            LUT.RGBPoints = [
                dataRange[0], 0.23, 0.30, 0.75, 0.5 * sum(dataRange), 0.87,
                0.87, 0.87, dataRange[1], 0.71, 0.016, 0.15
            ]
            LUT.ScalarRangeInitialized = 1.0

            # Show surface and colour by field value (which is cell data) using lookup table
            sphereDisplay = pvs.Show(slice, renderView)
            sphereDisplay.Representation = 'Surface'
            sphereDisplay.ColorArrayName = ['CELLS', 'rho']
            sphereDisplay.LookupTable = LUT

            # Show coastlines
            contourDisplay = pvs.Show(contours, renderView)
            contourDisplay.Representation = 'Surface'
            contourDisplay.ColorArrayName = [None, '']
            contourDisplay.OSPRayScaleArray = 'theta '
            contourDisplay.OSPRayScaleFunction = 'PiecewiseFunction'
            contourDisplay.SelectOrientationVectors = 'None'
            contourDisplay.ScaleFactor = 1193042.2418936265
            contourDisplay.SelectScaleArray = 'None'
            contourDisplay.GlyphType = 'Arrow'
            contourDisplay.GlyphTableIndexArray = 'None'
            contourDisplay.DataAxesGrid = 'GridAxesRepresentation'
            contourDisplay.PolarAxes = 'PolarAxesRepresentation'
            contourDisplay.GaussianRadius = 596521.1209468133
            contourDisplay.SetScaleArray = ['POINTS', 'theta ']
            contourDisplay.ScaleTransferFunction = 'PiecewiseFunction'
            contourDisplay.OpacityArray = ['POINTS', 'theta ']
            contourDisplay.OpacityTransferFunction = 'PiecewiseFunction'
예제 #5
0
        class Pipeline:

            # Define source of pipeline
            grid = coprocessor.CreateProducer(datadescription, "input")

            if (write_full_output == True):
                fullWriter = pvs.XMLPUnstructuredGridWriter(
                    Input=grid, DataMode="Appended", CompressorType="ZLib")
                coprocessor.RegisterWriter(fullWriter,
                                           filename='full_output_%t.pvtu',
                                           freq=1)

            # Create a spherical slice
            slice = pvs.Slice(Input=grid)
            slice.SliceType = 'Sphere'
            slice.Triangulatetheslice = 0
            slice.SliceOffsetValues = [0.0]
            slice.SliceType.Radius = sphere_radius

            # Create writer for this data and register it with the pipeline
            sliceWriter = pvs.XMLPPolyDataWriter(Input=slice,
                                                 DataMode="Appended",
                                                 CompressorType="ZLib")
            coprocessor.RegisterWriter(sliceWriter,
                                       filename='spherical_slice_%t.pvtp',
                                       freq=1)

            # Create a new render view
            renderView = pvs.CreateView('RenderView')
            renderView.ViewSize = [1500, 768]
            renderView.AxesGrid = 'GridAxes3DActor'
            renderView.StereoType = 0
            renderView.CameraPosition = [-5, -2, 4]
            renderView.CameraViewUp = [0.5, 0.3, 0.8]
            renderView.CameraParallelScale = 1.7
            renderView.Background = [0.32, 0.34, 0.43]
            renderView.ViewTime = datadescription.GetTime()

            # Register the view with coprocessor
            # and provide it with information such as the filename to use,
            # how frequently to write the images, etc.
            coprocessor.RegisterView(renderView,
                                     filename='spherical_slice_%t.png',
                                     freq=1,
                                     fittoscreen=1,
                                     magnification=1,
                                     width=1500,
                                     height=768,
                                     cinema={})

            # Create colour transfer function for field
            LUT = pvs.GetColorTransferFunction(fieldname)
            LUT.RGBPoints = [
                dataRange[0], 0.23, 0.30, 0.75, 0.5 * sum(dataRange), 0.87,
                0.87, 0.87, dataRange[1], 0.71, 0.016, 0.15
            ]
            LUT.ScalarRangeInitialized = 1.0

            # Show surface and colour by field value (which is cell data) using lookup table
            sphereDisplay = pvs.Show(slice, renderView)
            sphereDisplay.Representation = 'Surface'
            sphereDisplay.ColorArrayName = ['CELLS', fieldname]
            sphereDisplay.LookupTable = LUT
예제 #6
0
        class Pipeline:

            # Define source of pipeline
            grid = coprocessor.CreateProducer(datadescription, "input")

            if (write_full_output == True):
                fullWriter = pvs.XMLPUnstructuredGridWriter(
                    Input=grid, DataMode="Appended", CompressorType="ZLib")
                coprocessor.RegisterWriter(fullWriter,
                                           filename='full_output_%t.pvtu',
                                           freq=1)

            # Horizontal slice at the bottom
            slice = pvs.Slice(Input=grid)
            slice.SliceType = 'Plane'
            slice.SliceOffsetValues = [0.0]
            slice.SliceType.Origin = [0.0, 0.0, 101.94]
            slice.SliceType.Normal = [0.0, 0.0, 1.0]
            slice.Triangulatetheslice = False

            # Set up spherical projection filter - we need to bridge into the
            # VTK universe and use a VTK transform filter; the ParaView transform filter
            # does not support geo transforms

            # Source projection - simulation data is provided in lon lat rad coordinates
            latlonproj = vtk.vtkGeoProjection()
            latlonproj.SetName('lonlat')
            latlonproj.SetCentralMeridian(0)

            # Target projection - use Mollweide here
            targetproj = vtk.vtkGeoProjection()
            targetproj.SetName('moll')
            targetproj.SetCentralMeridian(0)

            # Set up vtkGeoTransform object that defines the transformation
            transform = vtk.vtkGeoTransform()
            transform.SetSourceProjection(latlonproj)
            transform.SetDestinationProjection(targetproj)

            # Set up VTK transform filter object
            tffilter = vtk.vtkTransformFilter()
            tffilter.SetTransform(transform)
            tffilter.SetInputConnection(
                slice.GetClientSideObject().GetOutputPort(0))

            # Return to ParaView universe by using a simple PassThrough filter to receive
            # output of the VTK transform filter
            passthrough = pvs.PassThrough()
            passthrough.GetClientSideObject().SetInputConnection(
                tffilter.GetOutputPort())

            # Create a new render view
            renderView = pvs.CreateView('RenderView')
            renderView.ViewSize = [1500, 768]
            renderView.AxesGrid = 'GridAxes3DActor'
            renderView.StereoType = 0
            renderView.CameraPosition = [0, 0, 4]
            renderView.CameraParallelScale = 1.7
            renderView.Background = [0.32, 0.34, 0.43]
            renderView.ViewTime = datadescription.GetTime()

            # Register the view with coprocessor
            # and provide it with information such as the filename to use,
            # how frequently to write the images, etc.
            coprocessor.RegisterView(renderView,
                                     filename='spherical_slice_%t.png',
                                     freq=1,
                                     fittoscreen=1,
                                     magnification=1,
                                     width=1500,
                                     height=768,
                                     cinema={})

            # Create colour transfer function for field
            LUT = pvs.GetColorTransferFunction(fieldname)
            LUT.RGBPoints = [
                dataRange[0], 0.23, 0.30, 0.75, 0.5 * sum(dataRange), 0.87,
                0.87, 0.87, dataRange[1], 0.71, 0.016, 0.15
            ]
            LUT.ScalarRangeInitialized = 1.0

            # Show surface and colour by field value (which is cell data) using lookup table
            sphereDisplay = pvs.Show(passthrough, renderView)
            sphereDisplay.Representation = 'Surface'
            sphereDisplay.ColorArrayName = ['CELLS', fieldname]
            sphereDisplay.LookupTable = LUT