#-------------------------------------------------------------- # Global timestep output options timeStepToStartOutputAt=0 forceOutputAtFirstCall=False # Global screenshot output options imageFileNamePadding=0 rescale_lookuptable=False # Whether or not to request specific arrays from the adaptor. requestSpecificArrays=False # a root directory under which all Catalyst output goes rootDirectory='.../select-arrays-1.cdb' # makes a cinema D index table make_cinema_table=True #-------------------------------------------------------------- # Code generated from cpstate.py to create the CoProcessor. # paraview version 5.7.0-RC2-2-g4e8805e1b9 #-------------------------------------------------------------- from paraview.simple import * from paraview import coprocessing # ----------------------- CoProcessor definition ----------------------- def CreateCoProcessor(): def _CreatePipeline(coprocessor, datadescription): class Pipeline: # state file generated using paraview version 5.7.0-RC2-2-g4e8805e1b9 # ---------------------------------------------------------------- # setup views used in the visualization # ---------------------------------------------------------------- # trace generated using paraview version 5.7.0-RC2-2-g4e8805e1b9 # # To ensure correct image size when batch processing, please search # for and uncomment the line `# renderView*.ViewSize = [*,*]` #### disable automatic camera reset on 'Show' paraview.simple._DisableFirstRenderCameraReset() # Create a new 'Render View' renderView1 = CreateView('RenderView') renderView1.ViewSize = [1724, 2208] renderView1.AxesGrid = 'GridAxes3DActor' renderView1.StereoType = 'Crystal Eyes' renderView1.CameraPosition = [0.0, 0.0, 84.58093602808789] renderView1.CameraFocalDisk = 1.0 renderView1.CameraParallelScale = 22.18311011085894 renderView1.Background = [0.32, 0.34, 0.43] # 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(renderView1, filename='RenderView1_%t.png', freq=1, fittoscreen=0, magnification=1, width=1724, height=2208, cinema={'tracking': {'object': 'None'}, 'composite': True, 'initial': {'eye': [0, 0, 84.5809], 'at': [0, 0, 0], 'up': [0, 1, 0]}, 'camera': 'static', 'floatValues': True, 'noValues': False}, compression=0) renderView1.ViewTime = datadescription.GetTime() SetActiveView(None) # ---------------------------------------------------------------- # setup view layouts # ---------------------------------------------------------------- # create new layout object 'Layout #1' layout1 = CreateLayout(name='Layout #1') layout1.AssignView(0, renderView1) # ---------------------------------------------------------------- # restore active view SetActiveView(renderView1) # ---------------------------------------------------------------- # ---------------------------------------------------------------- # setup the data processing pipelines # ---------------------------------------------------------------- # create a new 'XML Image Data Reader' # create a producer from a simulation input waveletdatavti = coprocessor.CreateProducer(datadescription, 'wavelet-data.vti') # ---------------------------------------------------------------- # setup the visualization in view 'renderView1' # ---------------------------------------------------------------- # show data from waveletdatavti waveletdatavtiDisplay = Show(waveletdatavti, renderView1) # trace defaults for the display properties. waveletdatavtiDisplay.Representation = 'Outline' waveletdatavtiDisplay.ColorArrayName = ['POINTS', ''] waveletdatavtiDisplay.OSPRayScaleArray = 'RTData' waveletdatavtiDisplay.OSPRayScaleFunction = 'PiecewiseFunction' waveletdatavtiDisplay.SelectOrientationVectors = 'None' waveletdatavtiDisplay.ScaleFactor = 2.0 waveletdatavtiDisplay.SelectScaleArray = 'RTData' waveletdatavtiDisplay.GlyphType = 'Arrow' waveletdatavtiDisplay.GlyphTableIndexArray = 'RTData' waveletdatavtiDisplay.GaussianRadius = 0.1 waveletdatavtiDisplay.SetScaleArray = ['POINTS', 'RTData'] waveletdatavtiDisplay.ScaleTransferFunction = 'PiecewiseFunction' waveletdatavtiDisplay.OpacityArray = ['POINTS', 'RTData'] waveletdatavtiDisplay.OpacityTransferFunction = 'PiecewiseFunction' waveletdatavtiDisplay.DataAxesGrid = 'GridAxesRepresentation' waveletdatavtiDisplay.PolarAxes = 'PolarAxesRepresentation' waveletdatavtiDisplay.ScalarOpacityUnitDistance = 1.7320508075688774 waveletdatavtiDisplay.IsosurfaceValues = [157.0909652709961] waveletdatavtiDisplay.Slice = 10 # init the 'PiecewiseFunction' selected for 'ScaleTransferFunction' waveletdatavtiDisplay.ScaleTransferFunction.Points = [37.35310363769531, 0.0, 0.5, 0.0, 276.8288269042969, 1.0, 0.5, 0.0] # init the 'PiecewiseFunction' selected for 'OpacityTransferFunction' waveletdatavtiDisplay.OpacityTransferFunction.Points = [37.35310363769531, 0.0, 0.5, 0.0, 276.8288269042969, 1.0, 0.5, 0.0] # ---------------------------------------------------------------- # finally, restore active source SetActiveSource(waveletdatavti) # ---------------------------------------------------------------- return Pipeline() class CoProcessor(coprocessing.CoProcessor): def CreatePipeline(self, datadescription): self.Pipeline = _CreatePipeline(self, datadescription) coprocessor = CoProcessor() # these are the frequencies at which the coprocessor updates. freqs = {'wavelet-data.vti': [1]} coprocessor.SetUpdateFrequencies(freqs) if requestSpecificArrays: arrays = [['RTData', 0]] coprocessor.SetRequestedArrays('wavelet-data.vti', arrays) coprocessor.SetInitialOutputOptions(timeStepToStartOutputAt,forceOutputAtFirstCall) if rootDirectory: coprocessor.SetRootDirectory(rootDirectory) if make_cinema_table: coprocessor.EnableCinemaDTable() return coprocessor #-------------------------------------------------------------- # Global variable that will hold the pipeline for each timestep # Creating the CoProcessor object, doesn't actually create the ParaView pipeline. # It will be automatically setup when coprocessor.UpdateProducers() is called the # first time. coprocessor = CreateCoProcessor() #-------------------------------------------------------------- # Enable Live-Visualizaton with ParaView and the update frequency coprocessor.EnableLiveVisualization(False, 1) # ---------------------- Data Selection method ---------------------- def RequestDataDescription(datadescription): "Callback to populate the request for current timestep" global coprocessor # setup requests for all inputs based on the requirements of the # pipeline. coprocessor.LoadRequestedData(datadescription) # ------------------------ Processing method ------------------------ def DoCoProcessing(datadescription): "Callback to do co-processing for current timestep" global coprocessor # Update the coprocessor by providing it the newly generated simulation data. # If the pipeline hasn't been setup yet, this will setup the pipeline. coprocessor.UpdateProducers(datadescription) # Write output data, if appropriate. coprocessor.WriteData(datadescription); # Write image capture (Last arg: rescale lookup table), if appropriate. coprocessor.WriteImages(datadescription, rescale_lookuptable=rescale_lookuptable, image_quality=0, padding_amount=imageFileNamePadding) # Live Visualization, if enabled. coprocessor.DoLiveVisualization(datadescription, "localhost", 22222)