Hi Andy, You could find example dataset in the following link,
[ https://kovan.itu.edu.tr/index.php/s/6RKZuW5rXGS57dR | https://kovan.itu.edu.tr/index.php/s/6RKZuW5rXGS57dR ] to work with IndeX volume rendering plugin, i add three grid point ghost region to the tiles in this case but it demonstrated whole extent problem. To write data I am using standard allinputsgrid.py and for volume rendering i am using attached co-processing script (this version creates a band around tiles when I use with standard volume rendering methods of ParaView, i think it is related with three grid ghost point). Regards, --ufuk On 20.03.2018 17:10, Andy Bauer wrote: Hi Ufuk, If the files are small, could you send them? I'll investigate some. Also, sending your Catalyst Python script may help clue me into what's going wrong. Best, Andy On Mon, Mar 19, 2018 at 4:06 PM, Ufuk Turuncoglu < [ mailto:u.utku.turunco...@be.itu.edu.tr | u.utku.turunco...@be.itu.edu.tr ] > wrote: BQ_BEGIN Thanks for your valuable comments. Yes, for each model component has two grid 2d and 3d and they are coming from different channels. It is working under 5.4.1 but i'll check the bug and try to fix my version until 5.5 released. BTW, even if I set whole extend (to test it I hardcoded it) in the place that you indicate, the piece and whole extent is same in the files. Regards, --ufuk From: "Andy Bauer" < [ mailto:andy.ba...@kitware.com | andy.ba...@kitware.com ] > To: "Ufuk Utku Turuncoglu (BE)" < [ mailto:u.utku.turunco...@be.itu.edu.tr | u.utku.turunco...@be.itu.edu.tr ] > Cc: "paraview" < [ mailto:parav...@paraview.org | parav...@paraview.org ] > Sent: Monday, March 19, 2018 3:51:51 PM Subject: Re: [Paraview] structured to unstructured when using multiblocks filter Hi Ufuk, It looks like you're already using multi-channel input as you're adding since you have " g_coprocessorData-> AddInput (strarr[i]); " unless that's always just called once. We're just trying to clarify the "inputs" by naming them channels -- I'm not sure it makes it easier to understand but it makes it easier to talk about with others that understand that concept in Catalyst. Setting whole extent would look like the following at line 129 in adaptor.cpp: if (vtkDataSet* grid = vtkDataSet::SafeDownCast (g_coprocessorData-> GetInputDescriptionByName (name)-> GetGrid ())) { ParaViewCoProcessing::ClearFieldDataFromGrid (grid); g_coprocessorData-> GetInputDescriptionByName (name)-> SetWholeExtent(ilow, ihigh, jlow, jhigh, klow, khigh); } else { Here, *low and *high are global values. For example, for a 1D case if each process has 5 points and you have 3 mpi processes ilow=jlow=jhigh=klow=khigh=0 and ihigh=12. The vtkStructuredGrid::SetExtent() would look like: proc 0: 0, 4, 0, 0, 0, 0 proc 1: 4, 8, 0, 0, 0, 0 proc 2: 8, 12, 0, 0, 0, 0 This looks like you're doing it properly in grid.cpp though but I didn't set the SetWholeExtent() in adaptor.cpp and I'm guessing that's what's missing. The multi-channel input should work in 5.4.1 but I found a bug that's been fixed in the upcoming 5.5 that was affecting Live. See [ https://gitlab.kitware.com/paraview/paraview/merge_requests/2212 | https://gitlab.kitware.com/paraview/paraview/merge_requests/2212 ] for details on that. It's fairly small so you can probably backport that to your 5.4.1 build if you're more comfortable using 5.4.1. Cheers, Andy On Mon, Mar 19, 2018 at 7:50 AM, Ufuk Utku Turuncoglu (BE) < [ mailto:u.utku.turunco...@be.itu.edu.tr | u.utku.turunco...@be.itu.edu.tr ] > wrote: BQ_BEGIN Hi Andy, Thanks for your help. Yes, each tile has its own grid information. The problem is that if i set whole extent in the adaptor side and write data to disk using allinputsgridwrite.py, the whole extent is same with piece extent. I am not sure what is going on in the background when live visualization activated. If you want to look at it for possible problem, the code is in following link (adaptor.cpp and grid.cpp), [ https://github.com/uturuncoglu/RegESM/tree/master/cop | https://github.com/uturuncoglu/RegESM/tree/master/cop ] The second option is also worth to try but first i need to look at the example. BTW, i am using 5.4.1. Do you think that the multi-channel input also works with 5.4.1? How it is handled by Catalyst in live mode? Do i have multiple visualization pipeline? Regards, --ufuk On 19.03.2018 13:36, Andy Bauer wrote: BQ_BEGIN Hi Ufuk, Currently a multipiece data set always has to be nested under a multiblock dataset. This definitely seems like an unreasonable limitation on a structured grid under a multipiece dataset but I suspect we just haven't had the resources to put into making this work properly. My suggestion would be to try just having your Catalyst adaptor provide a structured grid directly, assuming you only have one grid per mpi process, and then try volume rendering like that. If you do this though, make sure to set the whole extent with vtkCPInputDataDescription::SetWholeExtent(). A thought here -- instead of changing your adaptor to generate the structured grid directly instead of a multipiece dataset, maybe create a second "channel" through a second vtkCPInputDataDescription that provides just a structured grid. This way you can provide both dataset types as needed instead of having to modify code back and forth, recompile, etc. to get different functionality. See the Examples/Catalyst/CxxMultiChannelInputExample in the 5.5 source code for some more details on this. I can't remember if you were using the editions or just the full ParaView Catalyst build but in 5.5 there will be a volume rendering Catalyst addition. Note that the multiblock/multipiece hierarchy will be undergoing a significant change in the near future. Best, Andy On Sun, Mar 18, 2018 at 1:21 PM, Ufuk Turuncoglu < [ mailto:u.utku.turunco...@be.itu.edu.tr | u.utku.turunco...@be.itu.edu.tr ] > wrote: BQ_BEGIN Hi, I am using MPI parallel code under Catalyst co-processing. In this case, i am defining data by creating multi-block dataset and putting multi-piece dataset into the first block (0). In this case, each piece is defined as structured grid. The problem is that, to create volume rendering, i need to use MergeBlocks filter under ParaView but it changes data type from structured grid to unstructured one. I just wonder that is there any way to merge blocks without changing type? Programmable filter etc.? Another workaround could be defining dataset without using multi block under co-processing adaptor code. So, is it possible to represent multi-piece data under co-processing without putting it into multi-bloack dataset. Regards, --ufuk _______________________________________________ Powered by [ http://www.kitware.com/ | www.kitware.com ] Visit other Kitware open-source projects at [ http://www.kitware.com/opensource/opensource.html | http://www.kitware.com/opensource/opensource.html ] Please keep messages on-topic and check the ParaView Wiki at: [ http://paraview.org/Wiki/ParaView | http://paraview.org/Wiki/ParaView ] Search the list archives at: [ http://markmail.org/search/?q=ParaView | http://markmail.org/search/?q=ParaView ] Follow this link to subscribe/unsubscribe: [ https://public.kitware.com/mailman/listinfo/paraview | https://public.kitware.com/mailman/listinfo/paraview ] BQ_END BQ_END BQ_END BQ_END
from paraview.simple import * from paraview import coprocessing #-------------------------------------------------------------- # Code generated from cpstate.py to create the CoProcessor. # ParaView 5.4.1 64 bits #-------------------------------------------------------------- # Global screenshot output options imageFileNamePadding=0 rescale_lookuptable=False # ----------------------- CoProcessor definition ----------------------- def CreateCoProcessor(): def _CreatePipeline(coprocessor, datadescription): class Pipeline: # state file generated using paraview version 5.4.1 # ---------------------------------------------------------------- # setup views used in the visualization # ---------------------------------------------------------------- #### disable automatic camera reset on 'Show' paraview.simple._DisableFirstRenderCameraReset() # Create a new 'Render View' renderView1 = CreateView('RenderView') renderView1.ViewSize = [1052, 553] renderView1.AxesGrid = 'GridAxes3DActor' renderView1.OrientationAxesVisibility = 0 renderView1.CenterOfRotation = [-79.8833484649658, 23.4833153486252, 2.5] renderView1.StereoType = 0 renderView1.CameraPosition = [-117.58828819180437, 1.6033359766697366, 29.74480567823462] renderView1.CameraFocalPoint = [-86.81736370165578, 22.276925749066322, 6.371768534259115] renderView1.CameraViewUp = [0.19616921186573635, 0.5918856272090386, 0.7817858048208212] renderView1.CameraParallelScale = 24.350784207407408 renderView1.Background = [0.32, 0.34, 0.43] # init the 'GridAxes3DActor' selected for 'AxesGrid' renderView1.AxesGrid.Visibility = 1 renderView1.AxesGrid.XTitle = 'Longitude' renderView1.AxesGrid.YTitle = 'Latitude' renderView1.AxesGrid.ZTitle = 'Height' renderView1.AxesGrid.XTitleBold = 1 renderView1.AxesGrid.YTitleBold = 1 renderView1.AxesGrid.ZTitleBold = 1 renderView1.AxesGrid.XLabelBold = 1 renderView1.AxesGrid.YLabelBold = 1 renderView1.AxesGrid.ZLabelBold = 1 # 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='image_%t.png', freq=1, fittoscreen=0, magnification=2, width=1052, height=553, cinema={}) renderView1.ViewTime = datadescription.GetTime() # ---------------------------------------------------------------- # setup the data processing pipelines # ---------------------------------------------------------------- # create a new 'Legacy VTK Reader' coastlinevtk = LegacyVTKReader(FileNames=['/RS/users/turuncu/BENCH/COP_LR/input/hr/coastline.vtk']) # create a new 'Legacy VTK Reader' topovtk = LegacyVTKReader(FileNames=['/RS/users/turuncu/BENCH/COP_LR/input/hr/topo.vtk']) # create a new 'Threshold' threshold4 = Threshold(Input=topovtk) threshold4.Scalars = ['POINTS', 'Elevation'] threshold4.ThresholdRange = [0.0, 4567.0] # create a new 'Warp By Scalar' warpByScalar1 = WarpByScalar(Input=threshold4) warpByScalar1.Scalars = ['POINTS', 'Elevation'] warpByScalar1.ScaleFactor = 0.0001 # create a new 'XML MultiBlock Data Reader' # create a producer from a simulation input atm_input3d_vtm = coprocessor.CreateProducer(datadescription, 'atm_input3d') # create a new 'Transform' transform1 = Transform(Input=atm_input3d_vtm) transform1.Transform = 'Transform' # init the 'Transform' selected for 'Transform' transform1.Transform.Scale = [1.0, 1.0, 0.0005] # create a new 'Extract Subset' extractSubset2 = ExtractSubset(Input=transform1) extractSubset2.VOI = [35, 133, 28, 167, 0, 25] # create a new 'Merge Blocks' mergeBlocks4 = MergeBlocks(Input=extractSubset2) mergeBlocks4.MergePoints = 0 # ---------------------------------------------------------------- # setup color maps and opacity mapes used in the visualization # note: the Get..() functions create a new object, if needed # ---------------------------------------------------------------- # get color transfer function/color map for 'qlev' qlevLUT = GetColorTransferFunction('qlev') qlevLUT.RGBPoints = [0.0316461119590127, 0.0, 0.0, 0.0, 1.01235859503475, 1.0, 1.0, 1.0] qlevLUT.ColorSpace = 'RGB' qlevLUT.NanColor = [1.0, 0.0, 0.0] qlevLUT.ScalarRangeInitialized = 1.0 # get opacity transfer function/opacity map for 'qlev' qlevPWF = GetOpacityTransferFunction('qlev') qlevPWF.Points = [0.0316461119590127, 0.0, 0.5, 0.0, 0.852593476966581, 0.0197368431836367, 0.5, 0.0, 0.97297377360907, 0.151315793395042, 0.5, 0.0, 1.01235859503475, 0.5, 0.5, 0.0] qlevPWF.ScalarRangeInitialized = 1 # get color transfer function/color map for 'Elevation' elevationLUT = GetColorTransferFunction('Elevation') elevationLUT.RGBPoints = [-8615.0, 0.0, 0.0, 0.2, -8179.80581, 0.0, 0.0, 1.0, -194.813, 0.0, 1.0, 1.0, -193.896666666666, 0.0, 0.4, 0.2, 1031.88243333333, 0.952941, 0.847059, 0.415686, 3498.01033333333, 0.419577, 0.184253, 0.00648508, 3751.87132, 0.983413, 0.9561, 0.955749, 5130.0, 1.0, 1.0, 1.0] elevationLUT.ColorSpace = 'HSV' elevationLUT.ScalarRangeInitialized = 1.0 # get opacity transfer function/opacity map for 'Elevation' elevationPWF = GetOpacityTransferFunction('Elevation') elevationPWF.Points = [-8615.0, 0.0, 0.5, 0.0, 5130.0, 1.0, 0.5, 0.0] elevationPWF.ScalarRangeInitialized = 1 # ---------------------------------------------------------------- # setup the visualization in view 'renderView1' # ---------------------------------------------------------------- # show data from warpByScalar1 warpByScalar1Display = Show(warpByScalar1, renderView1) # trace defaults for the display properties. warpByScalar1Display.Representation = 'Surface' warpByScalar1Display.ColorArrayName = ['POINTS', 'Elevation'] warpByScalar1Display.LookupTable = elevationLUT warpByScalar1Display.OSPRayScaleArray = 'Elevation' warpByScalar1Display.OSPRayScaleFunction = 'PiecewiseFunction' warpByScalar1Display.SelectOrientationVectors = 'Elevation' warpByScalar1Display.ScaleFactor = 3.65 warpByScalar1Display.SelectScaleArray = 'Elevation' warpByScalar1Display.GlyphType = 'Arrow' warpByScalar1Display.DataAxesGrid = 'GridAxesRepresentation' warpByScalar1Display.PolarAxes = 'PolarAxesRepresentation' warpByScalar1Display.ScalarOpacityFunction = elevationPWF warpByScalar1Display.ScalarOpacityUnitDistance = 0.695096673571398 warpByScalar1Display.GaussianRadius = 1.825 warpByScalar1Display.SetScaleArray = ['POINTS', 'Elevation'] warpByScalar1Display.ScaleTransferFunction = 'PiecewiseFunction' warpByScalar1Display.OpacityArray = ['POINTS', 'Elevation'] warpByScalar1Display.OpacityTransferFunction = 'PiecewiseFunction' # show data from coastlinevtk coastlinevtkDisplay = Show(coastlinevtk, renderView1) # trace defaults for the display properties. coastlinevtkDisplay.Representation = 'Surface' coastlinevtkDisplay.ColorArrayName = [None, ''] coastlinevtkDisplay.OSPRayScaleFunction = 'PiecewiseFunction' coastlinevtkDisplay.SelectOrientationVectors = 'None' coastlinevtkDisplay.ScaleFactor = 3.66528625488281 coastlinevtkDisplay.SelectScaleArray = 'None' coastlinevtkDisplay.GlyphType = 'Arrow' coastlinevtkDisplay.DataAxesGrid = 'GridAxesRepresentation' coastlinevtkDisplay.PolarAxes = 'PolarAxesRepresentation' coastlinevtkDisplay.GaussianRadius = 1.83264312744141 coastlinevtkDisplay.SetScaleArray = [None, ''] coastlinevtkDisplay.ScaleTransferFunction = 'PiecewiseFunction' coastlinevtkDisplay.OpacityArray = [None, ''] coastlinevtkDisplay.OpacityTransferFunction = 'PiecewiseFunction' # show data from mergeBlocks4 mergeBlocks4Display = Show(mergeBlocks4, renderView1) # trace defaults for the display properties. mergeBlocks4Display.Representation = 'Volume' mergeBlocks4Display.ColorArrayName = ['POINTS', 'qlev'] mergeBlocks4Display.LookupTable = qlevLUT mergeBlocks4Display.Opacity = 0.0 mergeBlocks4Display.OSPRayScaleArray = 'cldfrc' mergeBlocks4Display.OSPRayScaleFunction = 'PiecewiseFunction' mergeBlocks4Display.SelectOrientationVectors = 'None' mergeBlocks4Display.ScaleFactor = 3.72393652874019 mergeBlocks4Display.SelectScaleArray = 'None' mergeBlocks4Display.GlyphType = 'Arrow' mergeBlocks4Display.DataAxesGrid = 'GridAxesRepresentation' mergeBlocks4Display.PolarAxes = 'PolarAxesRepresentation' mergeBlocks4Display.ScalarOpacityFunction = qlevPWF mergeBlocks4Display.ScalarOpacityUnitDistance = 0.15 mergeBlocks4Display.GaussianRadius = 1.86196826437009 mergeBlocks4Display.SetScaleArray = ['POINTS', 'cldfrc'] mergeBlocks4Display.ScaleTransferFunction = 'PiecewiseFunction' mergeBlocks4Display.OpacityArray = ['POINTS', 'cldfrc'] mergeBlocks4Display.OpacityTransferFunction = 'PiecewiseFunction' # init the 'PolarAxesRepresentation' selected for 'PolarAxes' mergeBlocks4Display.PolarAxes.PolarAxisVisibility = 0 mergeBlocks4Display.PolarAxes.RadialAxesVisibility = 0 mergeBlocks4Display.PolarAxes.PolarArcsVisibility = 0 mergeBlocks4Display.PolarAxes.AutoSubdividePolarAxis = 0 mergeBlocks4Display.PolarAxes.MaximumAngle = 0.0 mergeBlocks4Display.PolarAxes.PolarAxisTitleVisibility = 0 mergeBlocks4Display.PolarAxes.PolarLabelVisibility = 0 mergeBlocks4Display.PolarAxes.RadialLabelVisibility = 0 # ---------------------------------------------------------------- # finally, restore active source SetActiveSource(warpByScalar1) # ---------------------------------------------------------------- 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 = {'atm_input3d': [1, 1, 1, 1]} coprocessor.SetUpdateFrequencies(freqs) 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) coprocessor.EnableLiveVisualization(True, 1) # ---------------------- Data Selection method ---------------------- def RequestDataDescription(datadescription): "Callback to populate the request for current timestep" global coprocessor if datadescription.GetForceOutput() == True: # We are just going to request all fields and meshes from the simulation # code/adaptor. for i in range(datadescription.GetNumberOfInputDescriptions()): datadescription.GetInputDescription(i).AllFieldsOn() datadescription.GetInputDescription(i).GenerateMeshOn() return # 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)
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: https://public.kitware.com/mailman/listinfo/paraview