[Paraview] Unreclaimed memory in coprocessing? (PV 3.12.0 and git-master)

Takuya OSHIMA oshima at eng.niigata-u.ac.jp
Thu Jan 12 09:22:59 EST 2012


Andy, John,

Thanks for looking into this and all the input. After a bit of looking
around I gave up trying to track down the real cause of the
leaks. Instead, I modified my coprpcessing Python script not to
recreate and delete the pipeline objects each time DoCoProcessing() is
called (attached slices.py) but to re-use them (attached slices2.py,
you might try diff -bu slices.py slices2.py).

As can be seen from the respective profiling results slices.png and
slices2.png, no noticeable leak is observed for slices2.py. This is
not a fundamental solution but could be a workaround for the moment.

Takuya OSHIMA, Ph.D.
Faculty of Engineering, Niigata University
8050 Ikarashi-Ninocho, Nishi-ku, Niigata, 950-2181, JAPAN

From: "Biddiscombe, John A." <biddisco at cscs.ch>
Subject: RE: [Paraview] Unreclaimed memory in coprocessing? (PV 3.12.0 and git-master)
Date: Wed, 11 Jan 2012 11:07:51 +0000

> Andy
> 
>     obj = servermanager.misc.GlobalMapperProperties()
>     obj.GlobalImmediateModeRendering = 1
> 
> I added this at the start of
> 
> def DoCoProcessing(datadescription):
> 
> but it does not seem to have made any difference.
> 
> JB
> 
> 
> 
> From: Andy Bauer [mailto:andy.bauer at kitware.com]
> Sent: 11 January 2012 02:39
> To: Takuya OSHIMA
> Cc: Biddiscombe, John A.; paraview at paraview.org
> Subject: Re: [Paraview] Unreclaimed memory in coprocessing? (PV 3.12.0 and git-master)
> 
> I did some more testing and determined that with my script that there aren't any vtkObjects that aren't cleaned up after each call to the coprocessing library with your surfaceRep.py script.  Basicaly I kept a counter in vtkObject that incremented for each constructor call and decremented for each destructor call.  At the end of every call I had the same amount of vtkObjects.
> 
> After that I tried using valgrind to see if I could track it down any further.  While there was some memory leaks reported, the amount didn't increase with the number of times the coprocessing pipeline was executed.  Curiously though, valgrind did list an increase in the amount of memory that was leaked.  It seemed like there were quite a few PyObjects that weren't getting deleted properly though and maybe getting rid of them properly would help.  It may also be that memory fragmentation is a problem since rather large arrays are probably being allocated to for the field data as well as the opengl arrays (turning on immediate mode rendering would help with that but I'm not sure how to do that through the python but maybe someone else does).
> 
> Andy
> On Tue, Jan 10, 2012 at 12:36 PM, Andy Bauer <andy.bauer at kitware.com<mailto:andy.bauer at kitware.com>> wrote:
> I ran the problem out for more time steps and am now seeing the same trend.  Hopefully it won't take too much effort to track this down.
> 
> Andy
> 
> On Tue, Jan 10, 2012 at 12:09 PM, Andy Bauer <andy.bauer at kitware.com<mailto:andy.bauer at kitware.com>> wrote:
> Hi,
> 
> I'm trying to replicate it and with my scripts I'm getting the attached memory usage.  I'm not seeing it though I may not be measuring memory very well or letting it play out long enough.  I'll keep looking but it's possible that you're not deleting your created data object that is getting passed into the coprocessing library.  That would be my first recommendation to check.  You may want to turn on debug leaks if you haven't in your paraview build.
> 
> By the way, I generated that graph with the attached scripts.
> 
> Andy
> 
> 2012/1/10 Takuya OSHIMA <oshima at eng.niigata-u.ac.jp<mailto:oshima at eng.niigata-u.ac.jp>>
> Hi John,
> 
> What I observed on a Mac and a Linux box with 8 processor parallel
> runs (around 400MB per process) were quite similar to your memory
> profiling but with a bit larger growth rate of 1-2% and 2-3% per
> coprocessing execution respectively (somehow it was bigger on Linux).
> I'll see if I can do similar profiling.
> 
> Takuya OSHIMA, Ph.D.
> Faculty of Engineering, Niigata University
> 8050 Ikarashi-Ninocho, Nishi-ku, Niigata, 950-2181, JAPAN
> From: "Biddiscombe, John A." <biddisco at cscs.ch<mailto:biddisco at cscs.ch>>
> Subject: RE: [Paraview] Unreclaimed memory in coprocessing? (PV 3.12.0 and git-master)
> Date: Tue, 10 Jan 2012 14:51:41 +0000
> 
>> Takuya
>>
>> Running a test of coprocessing on a very small simulation using just 2 cores
>> on the desktop, I am seeing what looks like a very small leak. Over about 30
>> iterations, it's of the order of 30MB, so might not be real (need to test on a
>> bigger domain to see if it grows faster), but the trend looks credible. I'll
>> see if I can pinpoint where the loss is occurring.
>>
>> JB
>>
>> [cid]
>>
>> -----Original Message-----
>> From: paraview-bounces at paraview.org<mailto:paraview-bounces at paraview.org> [mailto:paraview-bounces at paraview.org<mailto:paraview-bounces at paraview.org>] On
>> Behalf Of Takuya OSHIMA
>> Sent: 10 January 2012 15:11
>> To: paraview at paraview.org<mailto:paraview at paraview.org>
>> Subject: Re: [Paraview] Unreclaimed memory in coprocessing? (PV 3.12.0 and
>> git-master)
>>
>> Attached in the previous mail is a sample Python coprocessing script that
>> exhibits the problem (written by the coprocessing script generator of
>> git-master as of today).
>>
>> Takuya
>>
>> Takuya OSHIMA, Ph.D.
>>
>> Faculty of Engineering, Niigata University
>>
>> 8050 Ikarashi-Ninocho, Nishi-ku, Niigata, 950-2181, JAPAN
>>
>> From: Takuya OSHIMA <oshima at eng.niigata-u.ac.jp<mailto:oshima at eng.niigata-u.ac.jp>>
>>
>> Subject: Unreclaimed memory in coprocessing? (PV 3.12.0 and git-master)
>>
>> Date: Tue, 10 Jan 2012 23:08:21 +0900 (JST)
>>
>> > Hi,
>>
>> >
>>
>> > I am having a problem where the memory usage of my simulation program
>>
>> > which links with the PV coprocessing library grows until it gets
>>
>> > killed by the operating system.
>>
>> >
>>
>> > I have the following piece of code for triggering coprocessing and if
>>
>> > I watch the memory usage with the ps/top commands it grows only at the
>>
>> > timestep where this->Processor->CoProcess() is called. My simulation
>>
>> > program uses vtkImageData as underlying data structure so no data
>>
>> > format adaptation (that may involve allocating extra memory for data
>>
>> > copy) is performed.
>>
>> >
>>
>> >   this->DataDescription->SetTimeData(this->TimeInfo->GetTimeValue(),
>>
>> >       this->TimeInfo->GetTIter());
>>
>> >   if (this->Processor->RequestDataDescription(this->DataDescription))
>>
>> >     {
>>
>> >     vtkCPInputDataDescription *idd
>>
>> >         = this->DataDescription->GetInputDescriptionByName("input");
>>
>> >     // obtain vtkImageData to coprocess from my simulation program
>>
>> >     vtkImageData *grid = this->TimeInfo->GetGrid();
>>
>> >     idd->SetWholeExtent(grid->GetWholeExtent());
>>
>> >     idd->SetGrid(grid);
>>
>> >     // now call the coprocessing library
>>
>> >     this->Processor->CoProcess(this->DataDescription);
>>
>> >     }
>>
>> >
>>
>> > Besides, the Apple's "leaks" tool shows no meaningful leaks which
>>
>> > makes me wonder if e.g. there are un-unregistered proxies than simply
>>
>> > unmatched New()/Delete() or new/delete pairs.
>>
>> >
>>
>> > The problem is same for PV 3.12.0 and the git master as of today.
>>
>> > Is anybody else having the problem? Any ideas?
>>
>> >
>>
>> > Thanks,
>>
>> > Takuya
>>
>> >
>>
>> > Takuya OSHIMA, Ph.D.
>>
>> > Faculty of Engineering, Niigata University
>>
>> > 8050 Ikarashi-Ninocho, Nishi-ku, Niigata, 950-2181, JAPAN
>>
>> _______________________________________________
>>
>> Powered by www.kitware.com<http://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<http://paraview.org/Wiki/ParaView>
>>
>> Follow this link to subscribe/unsubscribe:
>>
>> http://www.paraview.org/mailman/listinfo/paraview
>>
>> *
>>
> _______________________________________________
> Powered by www.kitware.com<http://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
> 
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
> 
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: slices.py
Type: application/octet-stream
Size: 24396 bytes
Desc: not available
URL: <http://www.paraview.org/pipermail/paraview/attachments/20120112/0a1ca0b7/attachment-0001.obj>
-------------- next part --------------

try: paraview.simple
except: from paraview.simple import *

RenderView1 = None

def RequestDataDescription(datadescription):
    "Callback to populate the request for current timestep"
    if datadescription.GetForceOutput() == True:
        for i in range(datadescription.GetNumberOfInputDescriptions()):
            datadescription.GetInputDescription(i).AllFieldsOn()
            datadescription.GetInputDescription(i).GenerateMeshOn()
        return

    timestep = datadescription.GetTimeStep()

    input_name = 'input'
    if (timestep % 1 == 0) :
        datadescription.GetInputDescriptionByName(input_name).AllFieldsOn()
        datadescription.GetInputDescriptionByName(input_name).GenerateMeshOn()
    else:
        datadescription.GetInputDescriptionByName(input_name).AllFieldsOff()
        datadescription.GetInputDescriptionByName(input_name).GenerateMeshOff()


def DoCoProcessing(datadescription):
    "Callback to do co-processing for current timestep"
    cp_writers = []
    timestep = datadescription.GetTimeStep()

    global RenderView1
    if RenderView1 == None:
        RenderView1 = CreateRenderView()
        RenderView1.LightSpecularColor = [1.0, 1.0, 1.0]
        RenderView1.InteractionMode = '3D'
        RenderView1.UseTexturedBackground = 0
        RenderView1.UseLight = 1
        RenderView1.CameraPosition = [239.53592055563902, -259.58248057091453, 301.48521029784831]
        RenderView1.FillLightKFRatio = 3.0
        RenderView1.Background2 = [0.0, 0.0, 0.16500000000000001]
        RenderView1.FillLightAzimuth = -10.0
        RenderView1.LODResolution = 50.0
        RenderView1.BackgroundTexture = []
        RenderView1.HeadPose = [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]
        RenderView1.KeyLightAzimuth = 10.0
        RenderView1.StencilCapable = 1
        RenderView1.LightIntensity = 1.0
        RenderView1.CameraFocalPoint = [75.0, 0.0, 33.5]
        RenderView1.ImageReductionFactor = 2
        RenderView1.CameraViewAngle = 30.0
        RenderView1.CameraParallelScale = 186.9652374105946
        RenderView1.EyeAngle = 2.0
        RenderView1.HeadLightKHRatio = 3.0
        RenderView1.StereoRender = 0
        RenderView1.KeyLightIntensity = 0.75
        RenderView1.BackLightAzimuth = 110.0
        RenderView1.OrientationAxesInteractivity = 0
        RenderView1.UseInteractiveRenderingForSceenshots = 0
        RenderView1.UseOffscreenRendering = 0
        RenderView1.Background = [0.31999694819562063, 0.34000152590218968, 0.42999923704890519]
        RenderView1.UseOffscreenRenderingForScreenshots = 0
        RenderView1.NonInteractiveRenderDelay = 2
        RenderView1.CenterOfRotation = [75.0, 0.0, 33.5]
        RenderView1.CameraParallelProjection = 0
        RenderView1.CompressorConfig = 'vtkSquirtCompressor 0 3'
        RenderView1.HeadLightWarmth = 0.5
        RenderView1.MaximumNumberOfPeels = 4
        RenderView1.LightDiffuseColor = [1.0, 1.0, 1.0]
        RenderView1.StereoType = 'Red-Blue'
        RenderView1.DepthPeeling = 1
        RenderView1.BackLightKBRatio = 3.5
        RenderView1.StereoCapableWindow = 1
        RenderView1.CameraViewUp = [-0.37231751660351298, 0.54188388842043378, 0.75348624294046929]
        RenderView1.LightType = 'HeadLight'
        RenderView1.LightAmbientColor = [1.0, 1.0, 1.0]
        RenderView1.WandPose = [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]
        RenderView1.RemoteRenderThreshold = 3.0
        RenderView1.KeyLightElevation = 50.0
        RenderView1.CenterAxesVisibility = 0
        RenderView1.MaintainLuminance = 0
        RenderView1.StillRenderImageReductionFactor = 1
        RenderView1.BackLightWarmth = 0.5
        RenderView1.FillLightElevation = -75.0
        RenderView1.MultiSamples = 0
        RenderView1.FillLightWarmth = 0.40000000000000002
        RenderView1.AlphaBitPlanes = 1
        RenderView1.LightSwitch = 0
        RenderView1.OrientationAxesVisibility = 1
        RenderView1.CameraClippingRange = [90.143354405536911, 808.56574671816043]
        RenderView1.BackLightElevation = 0.0
        RenderView1.ViewTime = 0.0
        RenderView1.OrientationAxesOutlineColor = [1.0, 1.0, 1.0]
        RenderView1.LODThreshold = 0.0
        RenderView1.CollectGeometryThreshold = 100.0
        RenderView1.UseGradientBackground = 0
        RenderView1.KeyLightWarmth = 0.59999999999999998
        RenderView1.OrientationAxesLabelColor = [1.0, 1.0, 1.0]
    
        p_0_pvti = CreateProducer( datadescription, "input" )
    
        Slice1 = Slice( guiName="Slice1", SliceOffsetValues=[0.0], SliceType="Plane" )
        Slice1.SliceType.Offset = 0.0
        Slice1.SliceType.Origin = [0.0, 0.0, 0.0]
        Slice1.SliceType.Normal = [1.0, 0.0, 0.0]
    
        SetActiveSource(p_0_pvti)
        Slice2 = Slice( guiName="Slice2", SliceOffsetValues=[0.0], SliceType="Plane" )
        Slice2.SliceType.Offset = 0.0
        Slice2.SliceType.Origin = [75.0, 0.0, 33.5]
        Slice2.SliceType.Normal = [0.0, 1.0, 0.0]
    
        a1_p_PiecewiseFunction = CreatePiecewiseFunction( Points=[0.0, 0.0, 1.0, 1.0] )
    
        a1_p_PVLookupTable = GetLookupTableForArray( "p", 1, Discretize=1, RGBPoints=[0.0, 0.23000000000000001, 0.29899999999999999, 0.754, 0.99388855763637696, 0.70599999999999996, 0.016, 0.14999999999999999], UseLogScale=0, VectorComponent=0, NanColor=[0.25, 0.0, 0.0], NumberOfTableValues=256, ColorSpace='Diverging', VectorMode='Magnitude', HSVWrap=0, ScalarRangeInitialized=1.0, LockScalarRange=0 )
    
        SetActiveSource(p_0_pvti)
        DataRepresentation1 = Show()
        DataRepresentation1.CubeAxesZAxisVisibility = 1
        DataRepresentation1.SelectionPointLabelColor = [0.5, 0.5, 0.5]
        DataRepresentation1.SelectionPointFieldDataArrayName = 'vtkOriginalPointIds'
        DataRepresentation1.SuppressLOD = 0
        DataRepresentation1.CubeAxesXGridLines = 0
        DataRepresentation1.CubeAxesYAxisTickVisibility = 1
        DataRepresentation1.Position = [0.0, 0.0, 0.0]
        DataRepresentation1.BackfaceRepresentation = 'Follow Frontface'
        DataRepresentation1.SelectionOpacity = 1.0
        DataRepresentation1.SelectionPointLabelShadow = 0
        DataRepresentation1.CubeAxesYGridLines = 0
        DataRepresentation1.OrientationMode = 'Direction'
        DataRepresentation1.Source.TipResolution = 6
        DataRepresentation1.ScaleMode = 'No Data Scaling Off'
        DataRepresentation1.Diffuse = 1.0
        DataRepresentation1.SelectionUseOutline = 0
        DataRepresentation1.CubeAxesZTitle = 'Z-Axis'
        DataRepresentation1.Specular = 0.10000000000000001
        DataRepresentation1.BlendMode = 'Composite'
        DataRepresentation1.SelectionVisibility = 1
        DataRepresentation1.InterpolateScalarsBeforeMapping = 1
        DataRepresentation1.CubeAxesZAxisTickVisibility = 1
        DataRepresentation1.Origin = [0.0, 0.0, 0.0]
        DataRepresentation1.CubeAxesVisibility = 0
        DataRepresentation1.Scale = [1.0, 1.0, 1.0]
        DataRepresentation1.SelectionCellLabelJustification = 'Left'
        DataRepresentation1.DiffuseColor = [1.0, 1.0, 1.0]
        DataRepresentation1.Shade = 0
        DataRepresentation1.SelectionCellLabelOpacity = 1.0
        DataRepresentation1.CubeAxesInertia = 1
        DataRepresentation1.Source = "Arrow"
        DataRepresentation1.Source.Invert = 0
        DataRepresentation1.Masking = 0
        DataRepresentation1.Opacity = 1.0
        DataRepresentation1.LineWidth = 1.0
        DataRepresentation1.MeshVisibility = 0
        DataRepresentation1.Visibility = 1
        DataRepresentation1.SelectionCellLabelFontSize = 18
        DataRepresentation1.CubeAxesCornerOffset = 0.0
        DataRepresentation1.SelectionPointLabelJustification = 'Left'
        DataRepresentation1.SelectionPointLabelVisibility = 0
        DataRepresentation1.SelectOrientationVectors = ''
        DataRepresentation1.CubeAxesTickLocation = 'Inside'
        DataRepresentation1.BackfaceDiffuseColor = [1.0, 1.0, 1.0]
        DataRepresentation1.CubeAxesYAxisVisibility = 1
        DataRepresentation1.SelectionPointLabelFontFamily = 'Arial'
        DataRepresentation1.Source.ShaftResolution = 6
        DataRepresentation1.LockSampleDistanceToInputSpacing = 1
        DataRepresentation1.CubeAxesFlyMode = 'Closest Triad'
        DataRepresentation1.SelectScaleArray = ''
        DataRepresentation1.CubeAxesYTitle = 'Y-Axis'
        DataRepresentation1.ColorAttributeType = 'POINT_DATA'
        DataRepresentation1.SpecularPower = 100.0
        DataRepresentation1.Texture = []
        DataRepresentation1.SelectionCellLabelShadow = 0
        DataRepresentation1.AmbientColor = [1.0, 1.0, 1.0]
        DataRepresentation1.Slice = 0
        DataRepresentation1.MapScalars = 1
        DataRepresentation1.PointSize = 2.0
        DataRepresentation1.Source.TipLength = 0.34999999999999998
        DataRepresentation1.SelectionCellLabelFormat = ''
        DataRepresentation1.Scaling = 0
        DataRepresentation1.StaticMode = 0
        DataRepresentation1.SelectionCellLabelColor = [0.0, 1.0, 0.0]
        DataRepresentation1.SliceMode = 'XY Plane'
        DataRepresentation1.Source.TipRadius = 0.10000000000000001
        DataRepresentation1.EdgeColor = [0.0, 0.0, 0.50196078431372548]
        DataRepresentation1.CubeAxesXAxisTickVisibility = 1
        DataRepresentation1.SelectionCellLabelVisibility = 0
        DataRepresentation1.NonlinearSubdivisionLevel = 1
        DataRepresentation1.CubeAxesColor = [1.0, 1.0, 1.0]
        DataRepresentation1.Representation = 'Outline'
        DataRepresentation1.CustomBounds = [0.0, 1.0, 0.0, 1.0, 0.0, 1.0]
        DataRepresentation1.Orientation = [0.0, 0.0, 0.0]
        DataRepresentation1.CubeAxesXTitle = 'X-Axis'
        DataRepresentation1.ScalarOpacityUnitDistance = 1.1244556452205368
        DataRepresentation1.BackfaceOpacity = 1.0
        DataRepresentation1.SelectionPointLabelFontSize = 18
        DataRepresentation1.SelectionCellFieldDataArrayName = 'vtkOriginalCellIds'
        DataRepresentation1.SelectionColor = [1.0, 0.0, 1.0]
        DataRepresentation1.Ambient = 0.0
        DataRepresentation1.CubeAxesXAxisMinorTickVisibility = 1
        DataRepresentation1.ScaleFactor = 1.0
        DataRepresentation1.BackfaceAmbientColor = [1.0, 1.0, 1.0]
        DataRepresentation1.AutoAdjustSampleDistances = 1
        DataRepresentation1.Source.ShaftRadius = 0.029999999999999999
        DataRepresentation1.ScalarOpacityFunction = []
        DataRepresentation1.SelectMaskArray = ''
        DataRepresentation1.SelectionLineWidth = 2.0
        DataRepresentation1.CubeAxesZAxisMinorTickVisibility = 1
        DataRepresentation1.CubeAxesXAxisVisibility = 1
        DataRepresentation1.Interpolation = 'Gouraud'
        DataRepresentation1.SelectMapper = 'Fixed point'
        DataRepresentation1.SelectionCellLabelFontFamily = 'Arial'
        DataRepresentation1.SelectionCellLabelItalic = 0
        DataRepresentation1.CubeAxesYAxisMinorTickVisibility = 1
        DataRepresentation1.CubeAxesZGridLines = 0
        DataRepresentation1.SelectionPointLabelFormat = ''
        DataRepresentation1.SelectionPointLabelOpacity = 1.0
        DataRepresentation1.Pickable = 1
        DataRepresentation1.CustomBoundsActive = [0, 0, 0]
        DataRepresentation1.SampleDistance = 1.0
        DataRepresentation1.SelectionRepresentation = 'Wireframe'
        DataRepresentation1.SelectionPointLabelBold = 0
        DataRepresentation1.ColorArrayName = ''
        DataRepresentation1.SelectionPointLabelItalic = 0
        DataRepresentation1.AllowSpecularHighlightingWithScalarColoring = 0
        DataRepresentation1.SpecularColor = [1.0, 1.0, 1.0]
        DataRepresentation1.LookupTable = []
        DataRepresentation1.SelectionPointSize = 5.0
        DataRepresentation1.SelectionCellLabelBold = 0
        DataRepresentation1.Orient = 0
    
        SetActiveSource(Slice1)
        DataRepresentation2 = Show()
        DataRepresentation2.CubeAxesZAxisVisibility = 1
        DataRepresentation2.SelectionPointLabelColor = [0.5, 0.5, 0.5]
        DataRepresentation2.SelectionPointFieldDataArrayName = 'vtkOriginalPointIds'
        DataRepresentation2.SuppressLOD = 0
        DataRepresentation2.CubeAxesXGridLines = 0
        DataRepresentation2.CubeAxesYAxisTickVisibility = 1
        DataRepresentation2.Position = [0.0, 0.0, 0.0]
        DataRepresentation2.BackfaceRepresentation = 'Follow Frontface'
        DataRepresentation2.SelectionOpacity = 1.0
        DataRepresentation2.SelectionPointLabelShadow = 0
        DataRepresentation2.CubeAxesYGridLines = 0
        DataRepresentation2.OrientationMode = 'Direction'
        DataRepresentation2.Source.TipResolution = 6
        DataRepresentation2.ScaleMode = 'No Data Scaling Off'
        DataRepresentation2.Diffuse = 1.0
        DataRepresentation2.SelectionUseOutline = 0
        DataRepresentation2.CubeAxesZTitle = 'Z-Axis'
        DataRepresentation2.Specular = 0.10000000000000001
        DataRepresentation2.SelectionVisibility = 1
        DataRepresentation2.InterpolateScalarsBeforeMapping = 1
        DataRepresentation2.CubeAxesZAxisTickVisibility = 1
        DataRepresentation2.Origin = [0.0, 0.0, 0.0]
        DataRepresentation2.CubeAxesVisibility = 0
        DataRepresentation2.Scale = [1.0, 1.0, 1.0]
        DataRepresentation2.SelectionCellLabelJustification = 'Left'
        DataRepresentation2.DiffuseColor = [1.0, 1.0, 1.0]
        DataRepresentation2.SelectionCellLabelOpacity = 1.0
        DataRepresentation2.Source = "Arrow"
        DataRepresentation2.Source.Invert = 0
        DataRepresentation2.Masking = 0
        DataRepresentation2.Opacity = 1.0
        DataRepresentation2.LineWidth = 1.0
        DataRepresentation2.MeshVisibility = 0
        DataRepresentation2.Visibility = 1
        DataRepresentation2.SelectionCellLabelFontSize = 18
        DataRepresentation2.CubeAxesCornerOffset = 0.0
        DataRepresentation2.SelectionPointLabelJustification = 'Left'
        DataRepresentation2.SelectionPointLabelVisibility = 0
        DataRepresentation2.SelectOrientationVectors = ''
        DataRepresentation2.CubeAxesTickLocation = 'Inside'
        DataRepresentation2.BackfaceDiffuseColor = [1.0, 1.0, 1.0]
        DataRepresentation2.CubeAxesYAxisVisibility = 1
        DataRepresentation2.SelectionPointLabelFontFamily = 'Arial'
        DataRepresentation2.Source.ShaftResolution = 6
        DataRepresentation2.CubeAxesFlyMode = 'Closest Triad'
        DataRepresentation2.SelectScaleArray = ''
        DataRepresentation2.CubeAxesYTitle = 'Y-Axis'
        DataRepresentation2.ColorAttributeType = 'CELL_DATA'
        DataRepresentation2.SpecularPower = 100.0
        DataRepresentation2.Texture = []
        DataRepresentation2.SelectionCellLabelShadow = 0
        DataRepresentation2.AmbientColor = [1.0, 1.0, 1.0]
        DataRepresentation2.MapScalars = 1
        DataRepresentation2.PointSize = 2.0
        DataRepresentation2.Source.TipLength = 0.34999999999999998
        DataRepresentation2.SelectionCellLabelFormat = ''
        DataRepresentation2.Scaling = 0
        DataRepresentation2.StaticMode = 0
        DataRepresentation2.SelectionCellLabelColor = [0.0, 1.0, 0.0]
        DataRepresentation2.Source.TipRadius = 0.10000000000000001
        DataRepresentation2.EdgeColor = [0.0, 0.0, 0.50000762951094835]
        DataRepresentation2.CubeAxesXAxisTickVisibility = 1
        DataRepresentation2.SelectionCellLabelVisibility = 0
        DataRepresentation2.NonlinearSubdivisionLevel = 1
        DataRepresentation2.CubeAxesColor = [1.0, 1.0, 1.0]
        DataRepresentation2.Representation = 'Surface'
        DataRepresentation2.CustomBounds = [0.0, 1.0, 0.0, 1.0, 0.0, 1.0]
        DataRepresentation2.CubeAxesXAxisMinorTickVisibility = 1
        DataRepresentation2.Orientation = [0.0, 0.0, 0.0]
        DataRepresentation2.CubeAxesXTitle = 'X-Axis'
        DataRepresentation2.CubeAxesInertia = 1
        DataRepresentation2.BackfaceOpacity = 1.0
        DataRepresentation2.SelectionCellFieldDataArrayName = 'vtkOriginalCellIds'
        DataRepresentation2.SelectionColor = [1.0, 0.0, 1.0]
        DataRepresentation2.Ambient = 0.0
        DataRepresentation2.SelectionPointLabelFontSize = 18
        DataRepresentation2.ScaleFactor = 1.0
        DataRepresentation2.BackfaceAmbientColor = [1.0, 1.0, 1.0]
        DataRepresentation2.Source.ShaftRadius = 0.029999999999999999
        DataRepresentation2.SelectMaskArray = ''
        DataRepresentation2.SelectionLineWidth = 2.0
        DataRepresentation2.CubeAxesZAxisMinorTickVisibility = 1
        DataRepresentation2.CubeAxesXAxisVisibility = 1
        DataRepresentation2.Interpolation = 'Gouraud'
        DataRepresentation2.SelectionCellLabelFontFamily = 'Arial'
        DataRepresentation2.SelectionCellLabelItalic = 0
        DataRepresentation2.CubeAxesYAxisMinorTickVisibility = 1
        DataRepresentation2.CubeAxesZGridLines = 0
        DataRepresentation2.SelectionPointLabelFormat = ''
        DataRepresentation2.SelectionPointLabelOpacity = 1.0
        DataRepresentation2.Pickable = 1
        DataRepresentation2.CustomBoundsActive = [0, 0, 0]
        DataRepresentation2.SelectionRepresentation = 'Wireframe'
        DataRepresentation2.SelectionPointLabelBold = 0
        DataRepresentation2.ColorArrayName = 'p'
        DataRepresentation2.SelectionPointLabelItalic = 0
        DataRepresentation2.AllowSpecularHighlightingWithScalarColoring = 0
        DataRepresentation2.SpecularColor = [1.0, 1.0, 1.0]
        DataRepresentation2.LookupTable = a1_p_PVLookupTable
        DataRepresentation2.SelectionPointSize = 5.0
        DataRepresentation2.SelectionCellLabelBold = 0
        DataRepresentation2.Orient = 0
    
        SetActiveSource(Slice2)
        DataRepresentation3 = Show()
        DataRepresentation3.CubeAxesZAxisVisibility = 1
        DataRepresentation3.SelectionPointLabelColor = [0.5, 0.5, 0.5]
        DataRepresentation3.SelectionPointFieldDataArrayName = 'vtkOriginalPointIds'
        DataRepresentation3.SuppressLOD = 0
        DataRepresentation3.CubeAxesXGridLines = 0
        DataRepresentation3.CubeAxesYAxisTickVisibility = 1
        DataRepresentation3.Position = [0.0, 0.0, 0.0]
        DataRepresentation3.BackfaceRepresentation = 'Follow Frontface'
        DataRepresentation3.SelectionOpacity = 1.0
        DataRepresentation3.SelectionPointLabelShadow = 0
        DataRepresentation3.CubeAxesYGridLines = 0
        DataRepresentation3.OrientationMode = 'Direction'
        DataRepresentation3.Source.TipResolution = 6
        DataRepresentation3.ScaleMode = 'No Data Scaling Off'
        DataRepresentation3.Diffuse = 1.0
        DataRepresentation3.SelectionUseOutline = 0
        DataRepresentation3.CubeAxesZTitle = 'Z-Axis'
        DataRepresentation3.Specular = 0.10000000000000001
        DataRepresentation3.SelectionVisibility = 1
        DataRepresentation3.InterpolateScalarsBeforeMapping = 1
        DataRepresentation3.CubeAxesZAxisTickVisibility = 1
        DataRepresentation3.Origin = [0.0, 0.0, 0.0]
        DataRepresentation3.CubeAxesVisibility = 0
        DataRepresentation3.Scale = [1.0, 1.0, 1.0]
        DataRepresentation3.SelectionCellLabelJustification = 'Left'
        DataRepresentation3.DiffuseColor = [1.0, 1.0, 1.0]
        DataRepresentation3.SelectionCellLabelOpacity = 1.0
        DataRepresentation3.Source = "Arrow"
        DataRepresentation3.Source.Invert = 0
        DataRepresentation3.Masking = 0
        DataRepresentation3.Opacity = 1.0
        DataRepresentation3.LineWidth = 1.0
        DataRepresentation3.MeshVisibility = 0
        DataRepresentation3.Visibility = 1
        DataRepresentation3.SelectionCellLabelFontSize = 18
        DataRepresentation3.CubeAxesCornerOffset = 0.0
        DataRepresentation3.SelectionPointLabelJustification = 'Left'
        DataRepresentation3.SelectionPointLabelVisibility = 0
        DataRepresentation3.SelectOrientationVectors = ''
        DataRepresentation3.CubeAxesTickLocation = 'Inside'
        DataRepresentation3.BackfaceDiffuseColor = [1.0, 1.0, 1.0]
        DataRepresentation3.CubeAxesYAxisVisibility = 1
        DataRepresentation3.SelectionPointLabelFontFamily = 'Arial'
        DataRepresentation3.Source.ShaftResolution = 6
        DataRepresentation3.CubeAxesFlyMode = 'Closest Triad'
        DataRepresentation3.SelectScaleArray = ''
        DataRepresentation3.CubeAxesYTitle = 'Y-Axis'
        DataRepresentation3.ColorAttributeType = 'CELL_DATA'
        DataRepresentation3.SpecularPower = 100.0
        DataRepresentation3.Texture = []
        DataRepresentation3.SelectionCellLabelShadow = 0
        DataRepresentation3.AmbientColor = [1.0, 1.0, 1.0]
        DataRepresentation3.MapScalars = 1
        DataRepresentation3.PointSize = 2.0
        DataRepresentation3.Source.TipLength = 0.34999999999999998
        DataRepresentation3.SelectionCellLabelFormat = ''
        DataRepresentation3.Scaling = 0
        DataRepresentation3.StaticMode = 0
        DataRepresentation3.SelectionCellLabelColor = [0.0, 1.0, 0.0]
        DataRepresentation3.Source.TipRadius = 0.10000000000000001
        DataRepresentation3.EdgeColor = [0.0, 0.0, 0.50000762951094835]
        DataRepresentation3.CubeAxesXAxisTickVisibility = 1
        DataRepresentation3.SelectionCellLabelVisibility = 0
        DataRepresentation3.NonlinearSubdivisionLevel = 1
        DataRepresentation3.CubeAxesColor = [1.0, 1.0, 1.0]
        DataRepresentation3.Representation = 'Surface'
        DataRepresentation3.CustomBounds = [0.0, 1.0, 0.0, 1.0, 0.0, 1.0]
        DataRepresentation3.CubeAxesXAxisMinorTickVisibility = 1
        DataRepresentation3.Orientation = [0.0, 0.0, 0.0]
        DataRepresentation3.CubeAxesXTitle = 'X-Axis'
        DataRepresentation3.CubeAxesInertia = 1
        DataRepresentation3.BackfaceOpacity = 1.0
        DataRepresentation3.SelectionCellFieldDataArrayName = 'vtkOriginalCellIds'
        DataRepresentation3.SelectionColor = [1.0, 0.0, 1.0]
        DataRepresentation3.Ambient = 0.0
        DataRepresentation3.SelectionPointLabelFontSize = 18
        DataRepresentation3.ScaleFactor = 1.0
        DataRepresentation3.BackfaceAmbientColor = [1.0, 1.0, 1.0]
        DataRepresentation3.Source.ShaftRadius = 0.029999999999999999
        DataRepresentation3.SelectMaskArray = ''
        DataRepresentation3.SelectionLineWidth = 2.0
        DataRepresentation3.CubeAxesZAxisMinorTickVisibility = 1
        DataRepresentation3.CubeAxesXAxisVisibility = 1
        DataRepresentation3.Interpolation = 'Gouraud'
        DataRepresentation3.SelectionCellLabelFontFamily = 'Arial'
        DataRepresentation3.SelectionCellLabelItalic = 0
        DataRepresentation3.CubeAxesYAxisMinorTickVisibility = 1
        DataRepresentation3.CubeAxesZGridLines = 0
        DataRepresentation3.SelectionPointLabelFormat = ''
        DataRepresentation3.SelectionPointLabelOpacity = 1.0
        DataRepresentation3.Pickable = 1
        DataRepresentation3.CustomBoundsActive = [0, 0, 0]
        DataRepresentation3.SelectionRepresentation = 'Wireframe'
        DataRepresentation3.SelectionPointLabelBold = 0
        DataRepresentation3.ColorArrayName = 'p'
        DataRepresentation3.SelectionPointLabelItalic = 0
        DataRepresentation3.AllowSpecularHighlightingWithScalarColoring = 0
        DataRepresentation3.SpecularColor = [1.0, 1.0, 1.0]
        DataRepresentation3.LookupTable = a1_p_PVLookupTable
        DataRepresentation3.SelectionPointSize = 5.0
        DataRepresentation3.SelectionCellLabelBold = 0
        DataRepresentation3.Orient = 0
    else:
        RenderView1.ViewTime = datadescription.GetTime()
        RenderView1.StillRender()

    for writer in cp_writers:
        if timestep % writer.cpFrequency == 0 or datadescription.GetForceOutput() == True:
            writer.FileName = writer.cpFileName.replace("%t", str(timestep))
            writer.UpdatePipeline()

    if timestep % 1 == 0 or datadescription.GetForceOutput() == True:
        views = servermanager.GetRenderViews()
        views += servermanager.GetContextViews()
        imagefilename = "Images/image_%t.png"
        for view in range(len(views)):
            fname = imagefilename.replace("%v", str(view))
            fname = fname.replace("%t", str(timestep))
            WriteImage(fname, views[view])

    ## explicitly delete the proxies -- we do it this way to avoid problems with prototypes
    #tobedeleted = GetNextProxyToDelete()
    #while tobedeleted != None:
    #    Delete(tobedeleted)
    #    tobedeleted = GetNextProxyToDelete()

def GetNextProxyToDelete():
    iter = servermanager.vtkSMProxyIterator()
    iter.Begin()
    while not iter.IsAtEnd():
        if iter.GetGroup().find("prototypes") != -1:
            iter.Next()
            continue
        proxy = servermanager._getPyProxy(iter.GetProxy())
        proxygroup = iter.GetGroup()
        if proxygroup != 'timekeeper' and proxy != None and proxygroup.find("pq_helper_proxies") == -1 :
            return proxy
        iter.Next()

    return None

def CreateProducer(datadescription, gridname):
    "Creates a producer proxy for the grid"
    if not datadescription.GetInputDescriptionByName(gridname):
        raise RuntimeError, "Simulation input name '%s' does not exist" % gridname
    grid = datadescription.GetInputDescriptionByName(gridname).GetGrid()
    producer = PVTrivialProducer()
    producer.GetClientSideObject().SetOutput(grid)
    if grid.IsA("vtkImageData") == True or grid.IsA("vtkStructuredGrid") == True or grid.IsA("vtkRectilinearGrid") == True:
        extent = datadescription.GetInputDescriptionByName(gridname).GetWholeExtent()
        producer.WholeExtent= [ extent[0], extent[1], extent[2], extent[3], extent[4], extent[5] ]

    producer.UpdatePipeline()
    return producer


def CreateWriter(proxy_ctor, filename, freq, cp_writers):
    writer = proxy_ctor()
    writer.FileName = filename
    writer.add_attribute("cpFrequency", freq)
    writer.add_attribute("cpFileName", filename)
    cp_writers.append(writer)
    return writer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: slicesProfile.png
Type: image/png
Size: 31580 bytes
Desc: not available
URL: <http://www.paraview.org/pipermail/paraview/attachments/20120112/0a1ca0b7/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: slices2Profile.png
Type: image/png
Size: 33449 bytes
Desc: not available
URL: <http://www.paraview.org/pipermail/paraview/attachments/20120112/0a1ca0b7/attachment-0003.png>


More information about the ParaView mailing list