From 5f1e84825f2fddd153c8cca6ed09422639691317 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Tue, 29 Dec 2015 09:43:13 +0100 Subject: [PATCH] Non regression test for ExtractCellType filter (coming from Threshold PV filter) corrected in PV5. --- .../Test/Baselines/testMEDReader19.png | Bin 0 -> 1666 bytes src/Plugins/MEDReader/Test/CMakeLists.txt | 2 +- src/Plugins/MEDReader/Test/testMEDReader19.py | 90 ++++++++++++++++++ 3 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 src/Plugins/MEDReader/Test/Baselines/testMEDReader19.png create mode 100644 src/Plugins/MEDReader/Test/testMEDReader19.py diff --git a/src/Plugins/MEDReader/Test/Baselines/testMEDReader19.png b/src/Plugins/MEDReader/Test/Baselines/testMEDReader19.png new file mode 100644 index 0000000000000000000000000000000000000000..f05519f4d0849dd45d9a0d96e7bc18a2b77de07e GIT binary patch literal 1666 zcmeAS@N?(olHy`uVBq!ia0y~yV4MKL985qF{<{ljGcd4udb&71=f!H}~JAXm7 z4@=LSHm^4<-V&A1=5VlgC1b-*0UZVB4Gla8nT%MtPmFR#!+`$jpl5b4b3upr?BBu4 zf2!ASpTFGg+0i!E6b`WoiV+TN35=3WqnrT?gEQt4&*ksORP+AXp6AE=hq?TH&T$ET z`To!S`Equ3`+m>)CAgucnCIHw>g1k}UvFQ~Ot>%8T>AUl`Rv!C9}d4cx1sEN^KWqm z>&@KPUcR)jlvG!L{G}vIdl8u<;uz_#gRlBE6tQj)9>?^+HWId_cy}gCk zU$515#_zV$k1yXI+{z@DRwjMz>Dsp!CmZJF9+wE0UkB9m^yasx67kn(uXI#Mz9xO` z;MQA}R>yX4emni~ESh)>eC)oa&Exl{=+v@Et t8+6>Y>oXOSuBAsX{3gOL^e=fITX(zoRUcO6kOS5&44$rjF6*2UngHYx96ta6 literal 0 HcmV?d00001 diff --git a/src/Plugins/MEDReader/Test/CMakeLists.txt b/src/Plugins/MEDReader/Test/CMakeLists.txt index 77e434f5..5f9c1c69 100644 --- a/src/Plugins/MEDReader/Test/CMakeLists.txt +++ b/src/Plugins/MEDReader/Test/CMakeLists.txt @@ -17,7 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -SET(TEST_NUMBERS 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18) +SET(TEST_NUMBERS 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19) SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/MEDReader) diff --git a/src/Plugins/MEDReader/Test/testMEDReader19.py b/src/Plugins/MEDReader/Test/testMEDReader19.py new file mode 100644 index 00000000..1181adf9 --- /dev/null +++ b/src/Plugins/MEDReader/Test/testMEDReader19.py @@ -0,0 +1,90 @@ +from MEDLoader import * + +""" This is a non regression bug revealed during training session. The bug is linked to the native Threshold VTK filter. Corrected with PV version >= 4.4. (KW10658) +There is still a problem when both image comparison and Fetch are enable together.""" + +fname="testMEDReader19.med" +imgName="testMEDReader19.png" +meshName="mesh" +mm=MEDFileUMesh() +coo=DataArrayDouble([(-0.3,-0.3),(0.2,-0.3),(0.7,-0.3),(-0.3,0.2),(0.2,0.2),(0.7,0.2),(-0.3,0.7),(0.2,0.7),(0.7,0.7)]) +conn0=[[NORM_TRI3,1,4,2],[NORM_TRI3,4,5,2],[NORM_QUAD4,0,3,4,1],[NORM_QUAD4,6,7,4,3],[NORM_QUAD4,7,8,5,4]] +conn1=[[NORM_SEG2,4,5],[NORM_SEG2,5,2],[NORM_SEG2,1,0],[NORM_SEG2,6,7]] +m0=MEDCouplingUMesh() ; m0.setCoords(coo) ; m0.setMeshDimension(2) ; m0.allocateCells(0) +for c in conn0: + m0.insertNextCell(c[0],c[1:]) +mm[0]=m0 +m1=MEDCouplingUMesh() ; m1.setCoords(coo) ; m1.setMeshDimension(1) ; m1.allocateCells(0) +for c in conn1: + m1.insertNextCell(c[0],c[1:]) +mm[-1]=m1 +mm.setName(meshName) +mm.write(fname,2) +# +#### import the simple module from the paraview +from paraview.simple import * +#### disable automatic camera reset on 'Show' +paraview.simple._DisableFirstRenderCameraReset() + +# create a new 'MED Reader' +testMEDReader19med = MEDReader(FileName=fname) +testMEDReader19med.AllArrays = ['TS0/mesh/ComSup0/mesh@@][@@P0'] +testMEDReader19med.AllTimeSteps = ['0000'] +# Properties modified on testMEDReader19med +testMEDReader19med.AllArrays = ['TS0/mesh/ComSup0/mesh@@][@@P0'] + +# get active view +renderView1 = GetActiveViewOrCreate('RenderView') + +# reset view to fit data +renderView1.ResetCamera() + +#changing interaction mode based on data extents +renderView1.InteractionMode = '2D' +renderView1.CameraPosition = [0.2, 0.2, 10000.0] +renderView1.CameraFocalPoint = [0.2, 0.2, 0.0] +testMEDReader19med.UpdatePipeline() +# create a new 'Extract Cell Type' +extractCellType1 = ExtractCellType(Input=testMEDReader19med) +extractCellType1.AllGeoTypes = [] + +# Properties modified on extractCellType1 +extractCellType1.AllGeoTypes = ['TRI3'] + +# show data in view +extractCellType1Display = Show(extractCellType1, renderView1) +# trace defaults for the display properties. +extractCellType1Display.ColorArrayName = [None, ''] +extractCellType1Display.ScalarOpacityUnitDistance = 0.5 +extractCellType1Display.OpacityArray = [None, ''] +extractCellType1Display.RadiusArray = [None, ''] +extractCellType1Display.RadiusRange = [0.2, 0.7] +extractCellType1Display.ConstantRadius = 0.7 +extractCellType1Display.PointSpriteDefaultsInitialized = 1 +extractCellType1Display.SelectInputVectors = [None, ''] +extractCellType1Display.WriteLog = '' + + +renderView1.InteractionMode = '2D' +renderView1.CameraPosition = [0.2, 0.2, 10000.0] +renderView1.CameraFocalPoint = [0.2, 0.2, 0.0] +renderView1.CameraParallelScale = 0.7071067811865476 + +res=servermanager.Fetch(extractCellType1,0) +assert(res.GetBlock(0).GetNumberOfCells()==2) # problem was here in PV4.3.1 + +"""# compare with baseline image # Waiting KW return to uncomment this part because SIGSEGV in PV5. +import os +import sys +try: + baselineIndex = sys.argv.index('-B')+1 + baselinePath = sys.argv[baselineIndex] +except: + print "Could not get baseline directory. Test failed." + exit(1) +baseline_file = os.path.join(baselinePath, imgName) +import vtk.test.Testing +vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() +vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, threshold=25) +vtk.test.Testing.interact() +""" -- 2.39.2