From 366de2bd481ed3e5e7d366138c5a6d5362d1420f Mon Sep 17 00:00:00 2001 From: michael Date: Sun, 31 Jan 2021 01:00:10 +0100 Subject: [PATCH] Managed versions 5.6 and 5.8 of ParaView --- CDMATH/postprocessing/PV_routines.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/CDMATH/postprocessing/PV_routines.py b/CDMATH/postprocessing/PV_routines.py index 944a374..e682483 100755 --- a/CDMATH/postprocessing/PV_routines.py +++ b/CDMATH/postprocessing/PV_routines.py @@ -16,7 +16,14 @@ def Extract_PV_data_over_line_to_txt_file(inputFileName, outputFileName, PlotOverLine1.Source.Point2 = point2 PlotOverLine1.Source.Resolution = resolution writer = pvs.CreateWriter(outputFileName, PlotOverLine1) - writer.FieldAssociation = "Point Data" # or "Cell Data" + + ParaViewVersion = pvs.GetParaViewVersion() + + if(ParaViewVersion <5.8) : + writer.FieldAssociation = "Points" # or "Cell Data" + else: + writer.FieldAssociation = "Point Data" # or "Cells" + writer.UpdatePipeline() def Extract_PV_data_over_line_to_numpyArray(inputFileName, point1, point2, resolution): @@ -54,7 +61,14 @@ def Slice_PV_data_to_txt_file(inputFileName, CellCenters1 = pvs.CellCenters() writer = pvs.CreateWriter(outputFileName, CellCenters1) writer.Precision=resolution - writer.FieldAssociation = "Point Data" # or "Cell Data" + + ParaViewVersion = pvs.GetParaViewVersion() + + if(ParaViewVersion <5.8) : + writer.FieldAssociation = "Points" # or "Cell Data" + else: + writer.FieldAssociation = "Point Data" # or "Cells" + writer.UpdatePipeline() def Slice_PV_field_data_to_numpyArray(field, -- 2.39.2