From: Anthony Geay Date: Tue, 29 Dec 2015 08:43:13 +0000 (+0100) Subject: Non regression test for ExtractCellType filter (coming from Threshold PV filter)... X-Git-Tag: V7_8_0a1~11 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5f1e84825f2fddd153c8cca6ed09422639691317;hp=8c5def602357fd6609e769f5da8e8dbdacd28aa6;p=modules%2Fparavis.git Non regression test for ExtractCellType filter (coming from Threshold PV filter) corrected in PV5. --- diff --git a/src/Plugins/MEDReader/Test/Baselines/testMEDReader19.png b/src/Plugins/MEDReader/Test/Baselines/testMEDReader19.png new file mode 100644 index 00000000..f05519f4 Binary files /dev/null and b/src/Plugins/MEDReader/Test/Baselines/testMEDReader19.png differ 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() +"""