[Paraview] Python Scripting Memory Overload

David E DeMarle dave.demarle at kitware.com
Wed Dec 19 16:36:50 EST 2012


Not sure why it isn't garbage collecting for you, but you might try
moving the entire pipeline setup out of the loop and then inside the
loop just call the two set filenames to modify the existing pipeline
before calling Write().

David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909


On Wed, Dec 19, 2012 at 4:25 PM, Sebastian <sebastiansturm at web.de> wrote:
> Hello Karl,
>
> thank you for your message. I am using Paraview 3.14.1 (64bit).
>
> This is what my script looks like:
>
> # SETTINGS
> directory_pvtu    = '/scratch/mesh3mm_SEM/'
> directory_csv     = '/scratch/mesh3mm_SEM/Z085_velocity_data/'
> file_number_start = 373527
> file_number_end   = 640332
> file_interval     = 693
> file_name_pvtu    = 'mesh3mm_SEM###file_number###.pvtu'
> file_name_csv     = 'mesh3mm_SEM###file_number###.csv'
>
> print 'Script started!'
>
> try: paraview.simple
> except: from paraview.simple import *
>
> while file_number_start <= file_number_end :
>
>   current_file_name_pvtu = file_name_pvtu.replace('###file_number###',
> str(file_number_start))
>   current_file = XMLPartitionedUnstructuredGridReader( FileName=[directory_pvtu
> + current_file_name_pvtu] )
>
>   current_file.PointArrayStatus = ['Velocity']
>
>   SetActiveSource(current_file)
>
>   Slice1 = Slice( SliceType = 'Plane' )
>   Slice1.SliceOffsetValues = [0.0]
>   Slice1.SliceType.Origin = [0.0, 0.0, 0.136711]
>   Slice1.SliceType.Normal = [0.0, 0.0, 1.0]
>
>   SetActiveSource(Slice1)
>
>   Slice2 = Slice( SliceType = 'Plane' )
>   Slice2.SliceOffsetValues = [0.0]
>   Slice2.SliceType.Origin = [0.0, 0.227757, 0.0]
>   Slice2.SliceType.Normal = [0.0, 1.0, 0.0]
>
>   UpdatePipeline()
>   current_file_name_csv = file_name_csv.replace('###file_number###',
> str(file_number_start))
>   writer = CreateWriter(directory_csv + current_file_name_csv, Slice2)
>   writer.FieldAssociation = 'Points'
>   writer.UpdatePipeline()
>   del writer
>
>   Delete(Slice2)
>   Delete(Slice1)
>   Delete(current_file)
>
>   files_to_go = (file_number_end-file_number_start)/file_interval
>   if files_to_go == 1:
>     case_word = 'file'
>   else:
>     case_word = 'files'
>   print current_file_name_csv + ' created, ' + str(files_to_go) + ' more ' +
> case_word + ' to go!'
>
>   file_number_start += file_interval
>
> print 'Script finished!'
>
> Best,
> Sebastian
>
> _______________________________________________
> 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
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview


More information about the ParaView mailing list