[Paraview] Python Scripting Memory Overload

Sebastian sebastiansturm at web.de
Wed Dec 19 16:25:45 EST 2012


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



More information about the ParaView mailing list