From ede6ba6c269e30ed57e4e7af703739036ae7c637 Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 31 Oct 2018 15:42:09 +0300 Subject: [PATCH] Avoid 'make test' failure on invalid DISPLAY --- CMakeLists.txt | 3 +- .../DevelopedSurface/Test/CMakeLists.txt | 10 +- src/Plugins/MEDReader/Test/CMakeLists.txt | 7 +- src/Plugins/MEDReader/Test/testMEDReader0.py | 102 ++++---- src/Plugins/MEDReader/Test/testMEDReader10.py | 118 ++++----- src/Plugins/MEDReader/Test/testMEDReader13.py | 94 +++---- src/Plugins/MEDReader/Test/testMEDReader14.py | 87 +++---- src/Plugins/MEDReader/Test/testMEDReader15.py | 72 +++--- src/Plugins/MEDReader/Test/testMEDReader19.py | 82 +++--- src/Plugins/MEDReader/Test/testMEDReader2.py | 50 ++-- src/Plugins/MEDReader/Test/testMEDReader20.py | 132 +++++----- src/Plugins/MEDReader/Test/testMEDReader21.py | 237 +++++++++--------- src/Plugins/MEDReader/Test/testMEDReader3.py | 100 ++++---- src/Plugins/MEDReader/Test/testMEDReader4.py | 48 ++-- src/Plugins/MEDReader/Test/testMEDReader5.py | 66 ++--- src/Plugins/MEDReader/Test/testMEDReader6.py | 70 +++--- src/Plugins/MEDReader/Test/testMEDReader7.py | 76 +++--- src/Plugins/MEDReader/Test/testMEDReader8.py | 76 +++--- 18 files changed, 737 insertions(+), 693 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c87b711..e6ffdbe3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,7 +75,8 @@ SET(BUILD_SHARED_LIBS TRUE) # ============ OPTION(SALOME_BUILD_DOC "Generate SALOME GUI documentation" ON) OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON) -OPTION(SALOME_PARAVIS_ALL_TEST "Add all tests for Salome PARAVIS module" OFF) +CMAKE_DEPENDENT_OPTION(SALOME_PARAVIS_NO_VISU_TESTS "Suppress GUI features testing" OFF + "SALOME_BUILD_TESTS" OFF) OPTION(SALOME_PARAVIS_BUILD_PLUGINS "Build PARAVIS plugins (MEDReader, etc ...)" ON) OPTION(SALOME_PARAVIS_BUILD_CORBA_PLUGINS "Build PARAVIS CORBA plugins (ParaMEDCorba -- this requires the SALOME FIELDS module)" ON) OPTION(SALOME_PARAVIS_USE_GEOM_SOURCE "Import a GEOMETRY object to PARAVIS via its Corba IOR" OFF) diff --git a/src/Plugins/DevelopedSurface/Test/CMakeLists.txt b/src/Plugins/DevelopedSurface/Test/CMakeLists.txt index 0ebbac38..e2fe16c7 100644 --- a/src/Plugins/DevelopedSurface/Test/CMakeLists.txt +++ b/src/Plugins/DevelopedSurface/Test/CMakeLists.txt @@ -8,7 +8,9 @@ ENDIF(NOT EXISTS ${TEMP_DIR}) SET(DEV_SURFACE_TESTS test_dev_surface2 test_dev_surface3) -FOREACH(tfile ${DEV_SURFACE_TESTS}) - ADD_TEST(${tfile} ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py ) - SET_TESTS_PROPERTIES(${tfile} PROPERTIES LABELS "PVS_ADD_ONS") -ENDFOREACH(tfile ${DEV_SURFACE_TESTS}) +IF(NOT SALOME_PARAVIS_NO_VISU_TESTS) + FOREACH(tfile ${DEV_SURFACE_TESTS}) + ADD_TEST(${tfile} ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py ) + SET_TESTS_PROPERTIES(${tfile} PROPERTIES LABELS "PVS_ADD_ONS") + ENDFOREACH(tfile ${DEV_SURFACE_TESTS}) +ENDIF() diff --git a/src/Plugins/MEDReader/Test/CMakeLists.txt b/src/Plugins/MEDReader/Test/CMakeLists.txt index 8c29186f..7d340a6d 100644 --- a/src/Plugins/MEDReader/Test/CMakeLists.txt +++ b/src/Plugins/MEDReader/Test/CMakeLists.txt @@ -89,8 +89,13 @@ ELSE(KW_TESTING_PLATFORM) SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) +SET(OTHER_OPTIONS) +IF(SALOME_PARAVIS_NO_VISU_TESTS) + LIST(APPEND OTHER_OPTIONS "-D") +ENDIF() + FOREACH(tfile ${TEST_NUMBERS}) - ADD_TEST(testMEDReader${tfile} ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/testMEDReader${tfile}.py -B ${BASELINES_DIR} ) + ADD_TEST(testMEDReader${tfile} ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/testMEDReader${tfile}.py -B ${BASELINES_DIR} ${OTHER_OPTIONS}) SET_TESTS_PROPERTIES(testMEDReader${tfile} PROPERTIES ENVIRONMENT "${tests_env}") ENDFOREACH() diff --git a/src/Plugins/MEDReader/Test/testMEDReader0.py b/src/Plugins/MEDReader/Test/testMEDReader0.py index 55a0e422..05e690c9 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader0.py +++ b/src/Plugins/MEDReader/Test/testMEDReader0.py @@ -19,7 +19,11 @@ # # Author : Anthony Geay +import os +import sys + from MEDLoader import * + fname="testMEDReader0.med" outImgName="testMEDReader0.png" ######### @@ -85,53 +89,53 @@ arr_name_with_dis=[elt.split("/")[-1] for elt in keys] # list all the names of arrays (Equal to those in the MED File) arr_name=[elt.split(myMedReader.GetProperty("Separator").GetData())[0] for elt in arr_name_with_dis] myMedReader.AllArrays=keys -RenderView1 = GetRenderView() -ELNOfieldToSurface1=ELNOfieldToSurface(Input=myMedReader) -ExtractGroup1=ExtractGroup(Input=ELNOfieldToSurface1) -#ExtractGroup1.UpdatePipelineInformation() -ExtractGroup1.AllGroups=['GRP_ba2','GRP_to1','GRP_web'] -assert(isinstance(ExtractGroup1.GetProperty("MeshName")[0],str)) -assert(ExtractGroup1.GetProperty("MeshName")[0]=="mesh") -# -DataRepresentation3 = Show() -DataRepresentation3.ScaleFactor = 0.008999999705702066 -DataRepresentation3.EdgeColor = [0.0, 0.0, 0.5000076295109483] -DataRepresentation3.SelectionPointFieldDataArrayName = 'SolutionSIEF_ELNO' -a2_SolutionSIEQ_ELNO_PiecewiseFunction = CreatePiecewiseFunction(Points=[0.0, 0.0, 0.5, 0.0, 1.0, 1.0, 0.5, 0.0]) -#VectorMode='Magnitude' or VectorMode='Component' -a2_SolutionSIEQ_ELNO_PVLookupTable = GetLookupTableForArray("SolutionSIEQ_ELNO",2,RGBPoints=[0.0, 0.23, 0.299, 0.754, 239013.7773476667, 0.706, 0.016, 0.15], VectorMode='Component', VectorComponent=1, NanColor=[0.25, 0.0, 0.0], ColorSpace='Diverging', ScalarRangeInitialized=1.0, AllowDuplicateScalars=1 ) -DataRepresentation3.ScalarOpacityFunction = a2_SolutionSIEQ_ELNO_PiecewiseFunction -DataRepresentation3.ColorArrayName = 'SolutionSIEQ_ELNO' -DataRepresentation3.LookupTable = a2_SolutionSIEQ_ELNO_PVLookupTable -DataRepresentation3.Visibility = 1 -# -ELGAfieldToPointGaussian1=ELGAfieldToPointGaussian(Input=ELNOfieldToSurface1) -ELGAfieldToPointGaussian1.SelectSourceArray=['CELLS','ELGA@0'] -DataRepresentation4 = Show() -DataRepresentation4.ScaleFactor = 0.008999999705702066 -DataRepresentation4.EdgeColor = [0.0, 0.0, 0.5000076295109483] -DataRepresentation4.SelectionPointFieldDataArrayName = 'SolutionSIEF_ELGA' -DataRepresentation4.ColorArrayName = 'SolutionSIEF_ELGA' -######## -RenderView1.CameraViewUp = [-0.19545466285945437, 0.837274140321886, -0.5106559396646081] -RenderView1.CameraPosition = [0.11797550069274401, 0.20119836056342144, 0.20885419432082736] -RenderView1.CameraFocalPoint = [1.0170565790969026e-18, 0.0599999981932342, 0.022500000894069675] -RenderView1.ViewSize =[300,300] -Render() -# compare with baseline image -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, "testMEDReader0.png") -import vtk.test.Testing -from vtk.util.misc import vtkGetTempDir -vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() -vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, - threshold=1) -vtk.test.Testing.interact() +if '-D' not in sys.argv: + RenderView1 = GetRenderView() + ELNOfieldToSurface1=ELNOfieldToSurface(Input=myMedReader) + ExtractGroup1=ExtractGroup(Input=ELNOfieldToSurface1) + #ExtractGroup1.UpdatePipelineInformation() + ExtractGroup1.AllGroups=['GRP_ba2','GRP_to1','GRP_web'] + assert(isinstance(ExtractGroup1.GetProperty("MeshName")[0],str)) + assert(ExtractGroup1.GetProperty("MeshName")[0]=="mesh") + # + DataRepresentation3 = Show() + DataRepresentation3.ScaleFactor = 0.008999999705702066 + DataRepresentation3.EdgeColor = [0.0, 0.0, 0.5000076295109483] + DataRepresentation3.SelectionPointFieldDataArrayName = 'SolutionSIEF_ELNO' + a2_SolutionSIEQ_ELNO_PiecewiseFunction = CreatePiecewiseFunction(Points=[0.0, 0.0, 0.5, 0.0, 1.0, 1.0, 0.5, 0.0]) + #VectorMode='Magnitude' or VectorMode='Component' + a2_SolutionSIEQ_ELNO_PVLookupTable = GetLookupTableForArray("SolutionSIEQ_ELNO",2,RGBPoints=[0.0, 0.23, 0.299, 0.754, 239013.7773476667, 0.706, 0.016, 0.15], VectorMode='Component', VectorComponent=1, NanColor=[0.25, 0.0, 0.0], ColorSpace='Diverging', ScalarRangeInitialized=1.0, AllowDuplicateScalars=1 ) + DataRepresentation3.ScalarOpacityFunction = a2_SolutionSIEQ_ELNO_PiecewiseFunction + DataRepresentation3.ColorArrayName = 'SolutionSIEQ_ELNO' + DataRepresentation3.LookupTable = a2_SolutionSIEQ_ELNO_PVLookupTable + DataRepresentation3.Visibility = 1 + # + ELGAfieldToPointGaussian1=ELGAfieldToPointGaussian(Input=ELNOfieldToSurface1) + ELGAfieldToPointGaussian1.SelectSourceArray=['CELLS','ELGA@0'] + DataRepresentation4 = Show() + DataRepresentation4.ScaleFactor = 0.008999999705702066 + DataRepresentation4.EdgeColor = [0.0, 0.0, 0.5000076295109483] + DataRepresentation4.SelectionPointFieldDataArrayName = 'SolutionSIEF_ELGA' + DataRepresentation4.ColorArrayName = 'SolutionSIEF_ELGA' + ######## + RenderView1.CameraViewUp = [-0.19545466285945437, 0.837274140321886, -0.5106559396646081] + RenderView1.CameraPosition = [0.11797550069274401, 0.20119836056342144, 0.20885419432082736] + RenderView1.CameraFocalPoint = [1.0170565790969026e-18, 0.0599999981932342, 0.022500000894069675] + RenderView1.ViewSize =[300,300] + Render() + + # compare with baseline image + 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, "testMEDReader0.png") + import vtk.test.Testing + from vtk.util.misc import vtkGetTempDir + vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() + vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, + threshold=1) + vtk.test.Testing.interact() diff --git a/src/Plugins/MEDReader/Test/testMEDReader10.py b/src/Plugins/MEDReader/Test/testMEDReader10.py index 832c910f..b74d210c 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader10.py +++ b/src/Plugins/MEDReader/Test/testMEDReader10.py @@ -19,6 +19,9 @@ # # Author : Anthony Geay +import os +import sys + from MEDLoader import * """ This test focuses on GenerateVector part. @@ -64,62 +67,61 @@ arr_name=[elt.split(myMedReader.GetProperty("Separator").GetData())[0] for elt i myMedReader.AllArrays=keys myMedReader.GenerateVectors=1 -RenderView1=GetRenderView() -DataRepresentation1 = Show() -DataRepresentation1.EdgeColor = [0.0, 0.0, 0.5] -DataRepresentation1.SelectionPointFieldDataArrayName='f0NbComp1' -DataRepresentation1.ScalarOpacityUnitDistance = 2.299619191183727 -#DataRepresentation1.ExtractedBlockIndex = 1 -DataRepresentation1.ScaleFactor = 0.3 -RenderView1.CenterOfRotation = [1.5, 0.5, 0.5] -RenderView1.CameraPosition = [1.5, 0.5, 6.907227082229696] -RenderView1.CameraFocalPoint = [1.5, 0.5, 0.5] -RenderView1.CameraParallelScale = 1.6583123951777 -DataRepresentation1.Representation = 'Wireframe' -# -wbv=WarpByVector(Input=myMedReader) -wbv.ScaleFactor=0.1 -wbv.Vectors=['POINTS','f3NbComp4_Vector'] -assert(list(wbv.PointData.keys())==['f0NbComp1','f1NbComp2','f1NbComp2_Vector','f2NbComp3','f3NbComp4','f3NbComp4_Vector']) -# -DataRepresentation2 = Show() -DataRepresentation2.EdgeColor = [0.0, 0.0, 0.5000076295109483] -DataRepresentation2.SelectionPointFieldDataArrayName = 'f0NbComp1' -DataRepresentation2.SelectionCellFieldDataArrayName = 'FamilyIdCell' -DataRepresentation2.ScalarOpacityUnitDistance = 4.546673931685981 -#DataRepresentation2.ExtractedBlockIndex = 1 -DataRepresentation2.ScaleFactor = 0.5 -DataRepresentation1.Visibility = 0 -DataRepresentation1.ColorArrayName = ('POINT_DATA', '') -DataRepresentation1.Visibility = 1 -a4_f3NbComp4_PVLookupTable = GetLookupTableForArray( "f3NbComp4", 4, RGBPoints=[1.118033988749895, 0.23, 0.299, 0.754, 8.108851429645696, 0.865, 0.865, 0.865, 15.0996688705415, 0.706, 0.016, 0.15], VectorMode='Magnitude', NanColor=[0.25, 0.0, 0.0], ColorSpace='Diverging', ScalarRangeInitialized=1.0 ) -a4_f3NbComp4_PiecewiseFunction = CreatePiecewiseFunction( Points=[1.118033988749895, 0.0, 0.5, 0.0, 15.0996688705415, 1.0, 0.5, 0.0] ) -DataRepresentation1.ScalarOpacityFunction = a4_f3NbComp4_PiecewiseFunction -DataRepresentation1.LookupTable = a4_f3NbComp4_PVLookupTable -a4_f3NbComp4_PVLookupTable.ScalarOpacityFunction = a4_f3NbComp4_PiecewiseFunction -DataRepresentation2.ScalarOpacityFunction = a4_f3NbComp4_PiecewiseFunction -DataRepresentation2.ColorArrayName = ('POINT_DATA', 'f3NbComp4') -DataRepresentation2.LookupTable = a4_f3NbComp4_PVLookupTable -RenderView1.CameraViewUp = [0.32310237626907823, -0.28721735329781684, -0.901726702728644] -RenderView1.CameraPosition = [0.17151044563787257, 6.31903262423349, -1.8294921560963984] -RenderView1.CameraFocalPoint = [1.4999999999999996, 0.49999999999999944, 0.4999999999999996] -# -RenderView1.ViewSize =[300,300] -Render() +if '-D' not in sys.argv: + RenderView1=GetRenderView() + DataRepresentation1 = Show() + DataRepresentation1.EdgeColor = [0.0, 0.0, 0.5] + DataRepresentation1.SelectionPointFieldDataArrayName='f0NbComp1' + DataRepresentation1.ScalarOpacityUnitDistance = 2.299619191183727 + #DataRepresentation1.ExtractedBlockIndex = 1 + DataRepresentation1.ScaleFactor = 0.3 + RenderView1.CenterOfRotation = [1.5, 0.5, 0.5] + RenderView1.CameraPosition = [1.5, 0.5, 6.907227082229696] + RenderView1.CameraFocalPoint = [1.5, 0.5, 0.5] + RenderView1.CameraParallelScale = 1.6583123951777 + DataRepresentation1.Representation = 'Wireframe' + # + wbv=WarpByVector(Input=myMedReader) + wbv.ScaleFactor=0.1 + wbv.Vectors=['POINTS','f3NbComp4_Vector'] + assert(list(wbv.PointData.keys())==['f0NbComp1','f1NbComp2','f1NbComp2_Vector','f2NbComp3','f3NbComp4','f3NbComp4_Vector']) + # + DataRepresentation2 = Show() + DataRepresentation2.EdgeColor = [0.0, 0.0, 0.5000076295109483] + DataRepresentation2.SelectionPointFieldDataArrayName = 'f0NbComp1' + DataRepresentation2.SelectionCellFieldDataArrayName = 'FamilyIdCell' + DataRepresentation2.ScalarOpacityUnitDistance = 4.546673931685981 + #DataRepresentation2.ExtractedBlockIndex = 1 + DataRepresentation2.ScaleFactor = 0.5 + DataRepresentation1.Visibility = 0 + DataRepresentation1.ColorArrayName = ('POINT_DATA', '') + DataRepresentation1.Visibility = 1 + a4_f3NbComp4_PVLookupTable = GetLookupTableForArray( "f3NbComp4", 4, RGBPoints=[1.118033988749895, 0.23, 0.299, 0.754, 8.108851429645696, 0.865, 0.865, 0.865, 15.0996688705415, 0.706, 0.016, 0.15], VectorMode='Magnitude', NanColor=[0.25, 0.0, 0.0], ColorSpace='Diverging', ScalarRangeInitialized=1.0 ) + a4_f3NbComp4_PiecewiseFunction = CreatePiecewiseFunction( Points=[1.118033988749895, 0.0, 0.5, 0.0, 15.0996688705415, 1.0, 0.5, 0.0] ) + DataRepresentation1.ScalarOpacityFunction = a4_f3NbComp4_PiecewiseFunction + DataRepresentation1.LookupTable = a4_f3NbComp4_PVLookupTable + a4_f3NbComp4_PVLookupTable.ScalarOpacityFunction = a4_f3NbComp4_PiecewiseFunction + DataRepresentation2.ScalarOpacityFunction = a4_f3NbComp4_PiecewiseFunction + DataRepresentation2.ColorArrayName = ('POINT_DATA', 'f3NbComp4') + DataRepresentation2.LookupTable = a4_f3NbComp4_PVLookupTable + RenderView1.CameraViewUp = [0.32310237626907823, -0.28721735329781684, -0.901726702728644] + RenderView1.CameraPosition = [0.17151044563787257, 6.31903262423349, -1.8294921560963984] + RenderView1.CameraFocalPoint = [1.4999999999999996, 0.49999999999999944, 0.4999999999999996] + # + RenderView1.ViewSize =[300,300] + Render() -# compare with baseline image -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, "testMEDReader10.png") -import vtk.test.Testing -from vtk.util.misc import vtkGetTempDir -vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() -vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, - threshold=1) -vtk.test.Testing.interact() + # compare with baseline image + 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, "testMEDReader10.png") + import vtk.test.Testing + from vtk.util.misc import vtkGetTempDir + vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() + vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, + threshold=1) + vtk.test.Testing.interact() diff --git a/src/Plugins/MEDReader/Test/testMEDReader13.py b/src/Plugins/MEDReader/Test/testMEDReader13.py index 38920c58..b7d21b08 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader13.py +++ b/src/Plugins/MEDReader/Test/testMEDReader13.py @@ -19,6 +19,9 @@ # # Author : Anthony Geay +import os +import sys + from MEDLoader import * """ This test is non regression test to check non regression of EDF 8761. ELNO Mesh filter on vector field with 4 comps cut of using GenerateVectors""" @@ -46,49 +49,48 @@ testMEDReader13_med = MEDReader( FileName=fname ) testMEDReader13_med.GenerateVectors = 1 testMEDReader13_med.AllArrays = ['TS0/mesh/ComSup0/fieldELNO@@][@@GSSNE'] -RenderView1 = GetRenderView() -RenderView1.CameraPosition = [1.0, 0.5, 10000.0] - -RenderView1.CameraPosition = [1.0, 0.5, 4.319751617610021] - -ELNOfieldToSurface3 = ELNOfieldToSurface(Input=testMEDReader13_med) - -DataRepresentation2 = Show() -#DataRepresentation2.ConstantRadius = 1.9999333620071411 -DataRepresentation2.EdgeColor = [0.0, 0.0, 0.5000076295109483] -#DataRepresentation2.PointGaussianDefaultsInitialized = 1 -DataRepresentation2.SelectionPointFieldDataArrayName = 'fieldELNO' -DataRepresentation2.SelectionCellFieldDataArrayName = 'FamilyIdCell' -#DataRepresentation2.SelectInputVectors = ['POINTS', 'fieldELNO_Vector'] -DataRepresentation2.ScalarOpacityUnitDistance = 1.7746382108908556 -DataRepresentation2.Texture = [] -DataRepresentation2.ExtractedBlockIndex = 1 -#DataRepresentation2.RadiusRange = [6.666666740784422e-05, 1.9999333620071411] -DataRepresentation2.ScaleFactor = 0.19998666953397334 - -#DataRepresentation2.RadiusRange = [6.66667e-05, 1.99993] -DataRepresentation2.ColorArrayName = ('POINT_DATA', 'fieldELNO_Vector') - -a3_fieldELNO_Vector_PVLookupTable = GetLookupTableForArray( "fieldELNO_Vector", 3, RGBPoints=[0.3464101615137755, 0.23, 0.299, 0.754, 1.1258330249197703, 0.865, 0.865, 0.865, 1.9052558883257653, 0.706, 0.016, 0.15], VectorMode='Magnitude', NanColor=[0.25, 0.0, 0.0], ColorSpace='Diverging', ScalarRangeInitialized=1.0 ) - -a3_fieldELNO_Vector_PiecewiseFunction = CreatePiecewiseFunction( Points=[0.3464101615137755, 0.0, 0.5, 0.0, 1.9052558883257653, 1.0, 0.5, 0.0] ) - -RenderView1.ViewSize =[300,300] -Render() - -# compare with baseline image -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, "testMEDReader13.png") -import vtk.test.Testing -from vtk.util.misc import vtkGetTempDir -vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() -vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, - threshold=1) -vtk.test.Testing.interact() +if '-D' not in sys.argv: + RenderView1 = GetRenderView() + RenderView1.CameraPosition = [1.0, 0.5, 10000.0] + + RenderView1.CameraPosition = [1.0, 0.5, 4.319751617610021] + + ELNOfieldToSurface3 = ELNOfieldToSurface(Input=testMEDReader13_med) + + DataRepresentation2 = Show() + #DataRepresentation2.ConstantRadius = 1.9999333620071411 + DataRepresentation2.EdgeColor = [0.0, 0.0, 0.5000076295109483] + #DataRepresentation2.PointGaussianDefaultsInitialized = 1 + DataRepresentation2.SelectionPointFieldDataArrayName = 'fieldELNO' + DataRepresentation2.SelectionCellFieldDataArrayName = 'FamilyIdCell' + #DataRepresentation2.SelectInputVectors = ['POINTS', 'fieldELNO_Vector'] + DataRepresentation2.ScalarOpacityUnitDistance = 1.7746382108908556 + DataRepresentation2.Texture = [] + DataRepresentation2.ExtractedBlockIndex = 1 + #DataRepresentation2.RadiusRange = [6.666666740784422e-05, 1.9999333620071411] + DataRepresentation2.ScaleFactor = 0.19998666953397334 + + #DataRepresentation2.RadiusRange = [6.66667e-05, 1.99993] + DataRepresentation2.ColorArrayName = ('POINT_DATA', 'fieldELNO_Vector') + + a3_fieldELNO_Vector_PVLookupTable = GetLookupTableForArray( "fieldELNO_Vector", 3, RGBPoints=[0.3464101615137755, 0.23, 0.299, 0.754, 1.1258330249197703, 0.865, 0.865, 0.865, 1.9052558883257653, 0.706, 0.016, 0.15], VectorMode='Magnitude', NanColor=[0.25, 0.0, 0.0], ColorSpace='Diverging', ScalarRangeInitialized=1.0 ) + + a3_fieldELNO_Vector_PiecewiseFunction = CreatePiecewiseFunction( Points=[0.3464101615137755, 0.0, 0.5, 0.0, 1.9052558883257653, 1.0, 0.5, 0.0] ) + + RenderView1.ViewSize =[300,300] + Render() + + # compare with baseline image + 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, "testMEDReader13.png") + import vtk.test.Testing + from vtk.util.misc import vtkGetTempDir + vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() + vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, + threshold=1) + vtk.test.Testing.interact() diff --git a/src/Plugins/MEDReader/Test/testMEDReader14.py b/src/Plugins/MEDReader/Test/testMEDReader14.py index 4939d172..5253e9ae 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader14.py +++ b/src/Plugins/MEDReader/Test/testMEDReader14.py @@ -19,6 +19,9 @@ # # Author : Anthony Geay (EDF R&D) +import os +import sys + from MEDLoader import * """ This test reproduces precisely the bug EDF8655 (PAL 22677) by cheking that multi loc per geo type in a field is correctly managed. @@ -129,49 +132,49 @@ paraview.simple._DisableFirstRenderCameraReset() reader=MEDReader(FileName=fname) ExpectedEntries=['TS0/Mesh/ComSup0/zeField0_MM0@@][@@GAUSS', 'TS0/Mesh/ComSup1/zeField0_MM1@@][@@GAUSS', 'TS0/Mesh/ComSup2/zeField0_MM2@@][@@GAUSS', 'TS0/Mesh/ComSup2/zeField1_MM0@@][@@GAUSS', 'TS0/Mesh/ComSup3/zeField1_MM1@@][@@GAUSS', 'TS0/Mesh/ComSup4/zeField2@@][@@P1', 'TS1/Mesh/ComSup0/Mesh@@][@@P0'] assert(reader.GetProperty("FieldsTreeInfo")[::2]==ExpectedEntries) -renderView1=GetActiveViewOrCreate('RenderView') -for entry in [[ExpectedEntries[0]],[ExpectedEntries[1]],[ExpectedEntries[2],ExpectedEntries[3]],[ExpectedEntries[4]]]: - reader=MEDReader(FileName=fname) - reader.AllArrays=entry - gaussPoints=ELGAfieldToPointGaussian(Input=reader) - gaussPoints.SelectSourceArray="ELGA@0" - Show(gaussPoints,renderView1) - pass -# +if '-D' not in sys.argv: + renderView1=GetActiveViewOrCreate('RenderView') + for entry in [[ExpectedEntries[0]],[ExpectedEntries[1]],[ExpectedEntries[2],ExpectedEntries[3]],[ExpectedEntries[4]]]: + reader=MEDReader(FileName=fname) + reader.AllArrays=entry + gaussPoints=ELGAfieldToPointGaussian(Input=reader) + gaussPoints.SelectSourceArray="ELGA@0" + Show(gaussPoints,renderView1) + pass -readerNodeField=MEDReader(FileName=fname) -readerNodeField.AllArrays=[ExpectedEntries[5]] -nodeFieldDisplay=Show(readerNodeField,renderView1) -ColorBy(nodeFieldDisplay,('POINTS','zeField2')) -nodeFieldDisplay.RescaleTransferFunctionToDataRange(True) -zeField2LUT=GetColorTransferFunction('zeField2') -zeField2LUT.RGBPoints=[990.6568528002015, 0.231373, 0.298039, 0.752941, 1009.0416245953584, 0.865003, 0.865003, 0.865003, 1027.4263963905153, 0.705882, 0.0156863, 0.14902] -zeField2LUT.ScalarRangeInitialized=1. -# -renderView1.ResetCamera() -renderView1.InteractionMode = '2D' -renderView1.CameraPosition = [3.0, 2.0, 10000.0] -renderView1.CameraFocalPoint = [3.0, 2.0, 0.0] -renderView1.ViewSize =[300,300] -renderView1.GetRenderWindow().DoubleBufferOff() -# + # + + readerNodeField=MEDReader(FileName=fname) + readerNodeField.AllArrays=[ExpectedEntries[5]] + nodeFieldDisplay=Show(readerNodeField,renderView1) + ColorBy(nodeFieldDisplay,('POINTS','zeField2')) + nodeFieldDisplay.RescaleTransferFunctionToDataRange(True) + zeField2LUT=GetColorTransferFunction('zeField2') + zeField2LUT.RGBPoints=[990.6568528002015, 0.231373, 0.298039, 0.752941, 1009.0416245953584, 0.865003, 0.865003, 0.865003, 1027.4263963905153, 0.705882, 0.0156863, 0.14902] + zeField2LUT.ScalarRangeInitialized=1. + # + renderView1.ResetCamera() + renderView1.InteractionMode = '2D' + renderView1.CameraPosition = [3.0, 2.0, 10000.0] + renderView1.CameraFocalPoint = [3.0, 2.0, 0.0] + renderView1.ViewSize =[300,300] + renderView1.GetRenderWindow().DoubleBufferOff() + # -Render() + Render() -# compare with baseline image -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, "testMEDReader14.png") -import vtk.test.Testing -from vtk.util.misc import vtkGetTempDir -vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() -vtk.test.Testing.compareImage(renderView1.GetRenderWindow(), baseline_file, - threshold=1) -vtk.test.Testing.interact() + # compare with baseline image + 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, "testMEDReader14.png") + import vtk.test.Testing + from vtk.util.misc import vtkGetTempDir + vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() + vtk.test.Testing.compareImage(renderView1.GetRenderWindow(), baseline_file, + threshold=1) + vtk.test.Testing.interact() diff --git a/src/Plugins/MEDReader/Test/testMEDReader15.py b/src/Plugins/MEDReader/Test/testMEDReader15.py index 4fca70a0..998b89b0 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader15.py +++ b/src/Plugins/MEDReader/Test/testMEDReader15.py @@ -19,6 +19,9 @@ # # Author : Anthony Geay (EDF R&D) +import os +import sys + from MEDLoader import * """ This test is a non regression test that checks the behaviour of MEDReader when a mesh has the same name than a field. @@ -51,40 +54,39 @@ assert(reader.GetProperty("FieldsTreeInfo")[::2]==ExpectedEntries) # glyph1=Glyph(Input=reader,GlyphType='Arrow',ScaleArray='FamilyIdNode',OrientationArray='zeName',GlyphMode='All Points',MaximumGlyphSize=0.1,GlyphTransform='Transform2') -renderView1=GetActiveViewOrCreate('RenderView') -renderView1.InteractionMode='3D' -zeNameLUT = GetColorTransferFunction('zeName') -zeNameLUT.RGBPoints = [1.0, 0.231373, 0.298039, 0.752941, 1.2071067811865475, 0.865003, 0.865003, 0.865003, 1.4142135623730951, 0.705882, 0.0156863, 0.14902] -zeNameLUT.ScalarRangeInitialized = 1. -zeNameLUT.VectorMode = 'Component' +if '-D' not in sys.argv: + renderView1=GetActiveViewOrCreate('RenderView') + renderView1.InteractionMode='3D' + zeNameLUT = GetColorTransferFunction('zeName') + zeNameLUT.RGBPoints = [1.0, 0.231373, 0.298039, 0.752941, 1.2071067811865475, 0.865003, 0.865003, 0.865003, 1.4142135623730951, 0.705882, 0.0156863, 0.14902] + zeNameLUT.ScalarRangeInitialized = 1. + zeNameLUT.VectorMode = 'Component' -glyph1Display=Show(glyph1,renderView1) -glyph1Display.ColorArrayName = ['POINTS', 'FamilyIdNode'] -glyph1Display.LookupTable = zeNameLUT -# set scalar coloring -ColorBy(glyph1Display, ('POINTS', 'zeName')) -# rescale color and/or opacity maps used to include current data range -glyph1Display.RescaleTransferFunctionToDataRange(True) -# do not show color bar/color legend -glyph1Display.SetScalarBarVisibility(renderView1, False) -# -renderView1.ViewSize =[300,300] -renderView1.GetRenderWindow().DoubleBufferOff() -Render() + glyph1Display=Show(glyph1,renderView1) + glyph1Display.ColorArrayName = ['POINTS', 'FamilyIdNode'] + glyph1Display.LookupTable = zeNameLUT + # set scalar coloring + ColorBy(glyph1Display, ('POINTS', 'zeName')) + # rescale color and/or opacity maps used to include current data range + glyph1Display.RescaleTransferFunctionToDataRange(True) + # do not show color bar/color legend + glyph1Display.SetScalarBarVisibility(renderView1, False) + # + renderView1.ViewSize =[300,300] + renderView1.GetRenderWindow().DoubleBufferOff() + Render() -# compare with baseline image -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, "testMEDReader15.png") -import vtk.test.Testing -from vtk.util.misc import vtkGetTempDir -vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() -vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, - threshold=1) -vtk.test.Testing.interact() + # compare with baseline image + 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, "testMEDReader15.png") + import vtk.test.Testing + from vtk.util.misc import vtkGetTempDir + vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() + vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, + threshold=1) + vtk.test.Testing.interact() diff --git a/src/Plugins/MEDReader/Test/testMEDReader19.py b/src/Plugins/MEDReader/Test/testMEDReader19.py index 6fbe63ec..a69af55e 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader19.py +++ b/src/Plugins/MEDReader/Test/testMEDReader19.py @@ -19,6 +19,9 @@ # # Author : Anthony Geay +import os +import sys + 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) @@ -54,50 +57,49 @@ testMEDReader19med.AllTimeSteps = ['0000'] # Properties modified on testMEDReader19med testMEDReader19med.AllArrays = ['TS0/mesh/ComSup0/mesh@@][@@P0'] -# get active view -renderView1 = GetActiveViewOrCreate('RenderView') +if '-D' not in sys.argv: + # get active view + renderView1 = GetActiveViewOrCreate('RenderView') -# reset view to fit data -renderView1.ResetCamera() + # 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 = [] + #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'] + # 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 + # show data in view + extractCellType1Display = Show(extractCellType1, renderView1) + # trace defaults for the display properties. + extractCellType1Display.ColorArrayName = [None, ''] + extractCellType1Display.ScalarOpacityUnitDistance = 0.5 -renderView1.InteractionMode = '2D' -renderView1.CameraPosition = [0.2, 0.2, 10000.0] -renderView1.CameraFocalPoint = [0.2, 0.2, 0.0] -renderView1.CameraParallelScale = 0.7071067811865476 + 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 + 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 -from vtk.util.misc import vtkGetTempDir -vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() -vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, threshold=1) -vtk.test.Testing.interact() + # compare with baseline image # Waiting KW return to uncomment this part because SIGSEGV in PV5. + 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 + from vtk.util.misc import vtkGetTempDir + vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() + vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, threshold=1) + vtk.test.Testing.interact() diff --git a/src/Plugins/MEDReader/Test/testMEDReader2.py b/src/Plugins/MEDReader/Test/testMEDReader2.py index 1be452a0..faeb7200 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader2.py +++ b/src/Plugins/MEDReader/Test/testMEDReader2.py @@ -19,6 +19,9 @@ # # Author : Anthony Geay +import os +import sys + from MEDLoader import * fname="testMEDReader2.med" @@ -93,30 +96,29 @@ DataRepresentation5.ScalarOpacityFunction = a2_ACellField_PiecewiseFunction DataRepresentation5.LookupTable = a2_ACellField_PVLookupTable DataRepresentation5.ColorArrayName = ("CELLS", "ACellField") -RenderView1 = GetRenderView() -RenderView1.CenterOfRotation = [3.0, 3.0, 3.0] -RenderView1.CameraViewUp = [-0.03886073885859842, 0.48373409998193495, 0.8743518533691291] -RenderView1.CameraPosition = [7.351939549758929, -5.688193007926853, 8.000155023042788] -RenderView1.CameraFocalPoint = [2.9999999999999996, 2.9999999999999987, 2.9999999999999982] +if '-D' not in sys.argv: + RenderView1 = GetRenderView() + RenderView1.CenterOfRotation = [3.0, 3.0, 3.0] + RenderView1.CameraViewUp = [-0.03886073885859842, 0.48373409998193495, 0.8743518533691291] + RenderView1.CameraPosition = [7.351939549758929, -5.688193007926853, 8.000155023042788] + RenderView1.CameraFocalPoint = [2.9999999999999996, 2.9999999999999987, 2.9999999999999982] -RenderView1.ViewSize =[300,300] -Render() + RenderView1.ViewSize =[300,300] + Render() -#WriteImage(outImgName) + #WriteImage(outImgName) -# compare with baseline image -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, "testMEDReader2.png") -import vtk.test.Testing -from vtk.util.misc import vtkGetTempDir -vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() -vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, - threshold=1) -vtk.test.Testing.interact() + # compare with baseline image + 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, "testMEDReader2.png") + import vtk.test.Testing + from vtk.util.misc import vtkGetTempDir + vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() + vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, + threshold=1) + vtk.test.Testing.interact() diff --git a/src/Plugins/MEDReader/Test/testMEDReader20.py b/src/Plugins/MEDReader/Test/testMEDReader20.py index 4ebc315e..4d60c2b7 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader20.py +++ b/src/Plugins/MEDReader/Test/testMEDReader20.py @@ -24,7 +24,11 @@ # Commit of the correction : a4e89b15c2faff6341ab9c3d78abc in PARAVIS # Due to mistake in MEDReader, the family field array on nodes was deleted twice when changing time step +import os +import sys + from MEDLoader import * + fname="testMEDReader20.med" png="testMEDReader20.png" nb=10 @@ -74,79 +78,79 @@ animationScene1 = GetAnimationScene() # update animation scene based on data timesteps animationScene1.UpdateAnimationUsingDataTimeSteps() -# get active view -renderView1 = GetActiveViewOrCreate('RenderView') -# uncomment following to set a specific view size -# renderView1.ViewSize = [610, 477] - -# show data in view -testMEDReader20medDisplay = Show(testMEDReader20med, renderView1) -# trace defaults for the display properties. -testMEDReader20medDisplay.ColorArrayName = [None, ''] -testMEDReader20medDisplay.GlyphType = 'Arrow' -testMEDReader20medDisplay.ScalarOpacityUnitDistance = 4.664739046219201 +if '-D' not in sys.argv: + # get active view + renderView1 = GetActiveViewOrCreate('RenderView') + # uncomment following to set a specific view size + # renderView1.ViewSize = [610, 477] -# reset view to fit data -renderView1.ResetCamera() + # show data in view + testMEDReader20medDisplay = Show(testMEDReader20med, renderView1) + # trace defaults for the display properties. + testMEDReader20medDisplay.ColorArrayName = [None, ''] + testMEDReader20medDisplay.GlyphType = 'Arrow' + testMEDReader20medDisplay.ScalarOpacityUnitDistance = 4.664739046219201 -#changing interaction mode based on data extents -renderView1.InteractionMode = '2D' -renderView1.CameraPosition = [5.0, 0.5, 10000.0] -renderView1.CameraFocalPoint = [5.0, 0.5, 0.0] + # reset view to fit data + renderView1.ResetCamera() -# set scalar coloring -ColorBy(testMEDReader20medDisplay, ('CELLS', 'Field')) + #changing interaction mode based on data extents + renderView1.InteractionMode = '2D' + renderView1.CameraPosition = [5.0, 0.5, 10000.0] + renderView1.CameraFocalPoint = [5.0, 0.5, 0.0] -# rescale color and/or opacity maps used to include current data range -testMEDReader20medDisplay.RescaleTransferFunctionToDataRange(True) + # set scalar coloring + ColorBy(testMEDReader20medDisplay, ('CELLS', 'Field')) -# do not show color bar/color legend -testMEDReader20medDisplay.SetScalarBarVisibility(renderView1, False) + # rescale color and/or opacity maps used to include current data range + testMEDReader20medDisplay.RescaleTransferFunctionToDataRange(True) -# get color transfer function/color map for 'Field' -fieldLUT = GetColorTransferFunction('Field') + # do not show color bar/color legend + testMEDReader20medDisplay.SetScalarBarVisibility(renderView1, False) -# get opacity transfer function/opacity map for 'Field' -fieldPWF = GetOpacityTransferFunction('Field') + # get color transfer function/color map for 'Field' + fieldLUT = GetColorTransferFunction('Field') -animationScene1.GoToNext() # <- very important to see the bug play with time steps... -animationScene1.GoToNext() -animationScene1.GoToNext() -animationScene1.GoToNext() -animationScene1.GoToPrevious() -animationScene1.GoToPrevious() + # get opacity transfer function/opacity map for 'Field' + fieldPWF = GetOpacityTransferFunction('Field') -# current camera placement for renderView1 -renderView1.InteractionMode = '2D' -renderView1.CameraPosition = [5.0, 0.5, 10000.0] -renderView1.CameraFocalPoint = [5.0, 0.5, 0.0] -renderView1.CameraParallelScale = 5.024937810560445 + animationScene1.GoToNext() # <- very important to see the bug play with time steps... + animationScene1.GoToNext() + animationScene1.GoToNext() + animationScene1.GoToNext() + animationScene1.GoToPrevious() + animationScene1.GoToPrevious() -# - -renderView1.ViewSize =[300,300] -Render() -#WriteImage(png) + # current camera placement for renderView1 + renderView1.InteractionMode = '2D' + renderView1.CameraPosition = [5.0, 0.5, 10000.0] + renderView1.CameraFocalPoint = [5.0, 0.5, 0.0] + renderView1.CameraParallelScale = 5.024937810560445 -#### saving camera placements for all active views + # -# current camera placement for renderView1 -renderView1.InteractionMode = '2D' -renderView1.CameraPosition = [5.0, 0.5, 10000.0] -renderView1.CameraFocalPoint = [5.0, 0.5, 0.0] -renderView1.CameraParallelScale = 5.024937810560445 -# compare with baseline image -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,png) -import vtk.test.Testing -from vtk.util.misc import vtkGetTempDir -vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() -vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, threshold=1) -vtk.test.Testing.interact() + renderView1.ViewSize =[300,300] + Render() + #WriteImage(png) + + #### saving camera placements for all active views + + # current camera placement for renderView1 + renderView1.InteractionMode = '2D' + renderView1.CameraPosition = [5.0, 0.5, 10000.0] + renderView1.CameraFocalPoint = [5.0, 0.5, 0.0] + renderView1.CameraParallelScale = 5.024937810560445 + + # compare with baseline image + 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,png) + import vtk.test.Testing + from vtk.util.misc import vtkGetTempDir + vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() + vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, threshold=1) + vtk.test.Testing.interact() diff --git a/src/Plugins/MEDReader/Test/testMEDReader21.py b/src/Plugins/MEDReader/Test/testMEDReader21.py index 187d2720..11898009 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader21.py +++ b/src/Plugins/MEDReader/Test/testMEDReader21.py @@ -19,6 +19,9 @@ # # Author : Anthony Geay (EDF R&D) +import os +import sys + from paraview.simple import * from MEDLoader import * @@ -43,122 +46,122 @@ WriteField(fname,f,True) testTotomed = MEDReader(FileName=fname) testTotomed.AllArrays = ['TS0/%s/ComSup0/%s@@][@@GSSNE'%(meshName,fieldName)] testTotomed.AllTimeSteps = ['0000'] -# get active view -renderView1 = GetActiveViewOrCreate('RenderView') -# uncomment following to set a specific view size -# renderView1.ViewSize = [739, 503] - -# show data in view -testTotomedDisplay = Show(testTotomed, renderView1) -# trace defaults for the display properties. -testTotomedDisplay.ColorArrayName = [None, ''] -testTotomedDisplay.GlyphType = 'Arrow' -testTotomedDisplay.ScalarOpacityUnitDistance = 1.5874010519681994 - -# reset view to fit data -renderView1.ResetCamera() - -#changing interaction mode based on data extents -renderView1.InteractionMode = '2D' -renderView1.CameraPosition = [1.0, 10000.0, 10000.0] -renderView1.CameraFocalPoint = [1.0, 0.0, 0.0] -renderView1.CameraViewUp = [1.0, 1.0, 0.0] - -# set scalar coloring -ColorBy(testTotomedDisplay, ('FIELD', 'vtkBlockColors')) - -# hide color bar/color legend -testTotomedDisplay.SetScalarBarVisibility(renderView1, False) - -# get color transfer function/color map for 'vtkBlockColors' -vtkBlockColorsLUT = GetColorTransferFunction('vtkBlockColors') - -# get opacity transfer function/opacity map for 'vtkBlockColors' -vtkBlockColorsPWF = GetOpacityTransferFunction('vtkBlockColors') - -# create a new 'ELNO Mesh' -eLNOMesh1 = ELNOfieldToSurface(Input=testTotomed) - -# Properties modified on eLNOMesh1 -eLNOMesh1.ShrinkFactor = 0.5 # <- test is here !!!!!!!! - -# show data in view -eLNOMesh1Display = Show(eLNOMesh1, renderView1) -# trace defaults for the display properties. -eLNOMesh1Display.ColorArrayName = [None, ''] -eLNOMesh1Display.GlyphType = 'Arrow' -eLNOMesh1Display.ScalarOpacityUnitDistance = 1.1905507889761495 - -# hide data in view -Hide(testTotomed, renderView1) - -# set scalar coloring -ColorBy(eLNOMesh1Display, ('FIELD', 'vtkBlockColors')) -# show color bar/color legend -eLNOMesh1Display.SetScalarBarVisibility(renderView1, False) +if '-D' not in sys.argv: + # get active view + renderView1 = GetActiveViewOrCreate('RenderView') + # uncomment following to set a specific view size + # renderView1.ViewSize = [739, 503] -# set scalar coloring -ColorBy(eLNOMesh1Display, ('POINTS', 'MyField')) - -# rescale color and/or opacity maps used to include current data range -eLNOMesh1Display.RescaleTransferFunctionToDataRange(True) - -# show color bar/color legend -eLNOMesh1Display.SetScalarBarVisibility(renderView1, False) - -# get color transfer function/color map for 'MyField' -myFieldLUT = GetColorTransferFunction('MyField') - -# get opacity transfer function/opacity map for 'MyField' -myFieldPWF = GetOpacityTransferFunction('MyField') - -# hide color bar/color legend -eLNOMesh1Display.SetScalarBarVisibility(renderView1, False) - -# create a new 'Glyph' -glyph1 = Glyph(Input=eLNOMesh1, - GlyphType='Arrow') -glyph1.ScaleArray = ['POINTS', 'MyField'] -glyph1.OrientationArray = ['POINTS', 'No orientation array'] -glyph1.MaximumGlyphSize = 0.15000000000000002 -glyph1.GlyphTransform = 'Transform2' - -# Properties modified on glyph1 -glyph1.GlyphType = 'Sphere' -glyph1.MaximumGlyphSize = 0.15 - -# show data in view -glyph1Display = Show(glyph1, renderView1) -# trace defaults for the display properties. -glyph1Display.ColorArrayName = ['POINTS', 'MyField'] -glyph1Display.LookupTable = myFieldLUT -glyph1Display.GlyphType = 'Arrow' - -# hide color bar/color legend -glyph1Display.SetScalarBarVisibility(renderView1, False) - -#### saving camera placements for all active views - -# current camera placement for renderView1 -renderView1.InteractionMode = '2D' -renderView1.CameraPosition = [0.9999999999999908, 9999.999999999995, 9999.999999999993] -renderView1.CameraFocalPoint = [1.0, 0.0, 0.0] -renderView1.CameraViewUp = [0.6331899945158901, 0.547298104713038, -0.5472981047130381] -renderView1.CameraParallelScale = 0.6930835077290218 -renderView1.ViewSize = [739,503] - -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 -from vtk.util.misc import vtkGetTempDir -vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() -vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, threshold=1) -vtk.test.Testing.interact() + # show data in view + testTotomedDisplay = Show(testTotomed, renderView1) + # trace defaults for the display properties. + testTotomedDisplay.ColorArrayName = [None, ''] + testTotomedDisplay.GlyphType = 'Arrow' + testTotomedDisplay.ScalarOpacityUnitDistance = 1.5874010519681994 + + # reset view to fit data + renderView1.ResetCamera() + + #changing interaction mode based on data extents + renderView1.InteractionMode = '2D' + renderView1.CameraPosition = [1.0, 10000.0, 10000.0] + renderView1.CameraFocalPoint = [1.0, 0.0, 0.0] + renderView1.CameraViewUp = [1.0, 1.0, 0.0] + + # set scalar coloring + ColorBy(testTotomedDisplay, ('FIELD', 'vtkBlockColors')) + + # hide color bar/color legend + testTotomedDisplay.SetScalarBarVisibility(renderView1, False) + + # get color transfer function/color map for 'vtkBlockColors' + vtkBlockColorsLUT = GetColorTransferFunction('vtkBlockColors') + + # get opacity transfer function/opacity map for 'vtkBlockColors' + vtkBlockColorsPWF = GetOpacityTransferFunction('vtkBlockColors') + + # create a new 'ELNO Mesh' + eLNOMesh1 = ELNOfieldToSurface(Input=testTotomed) + + # Properties modified on eLNOMesh1 + eLNOMesh1.ShrinkFactor = 0.5 # <- test is here !!!!!!!! + + # show data in view + eLNOMesh1Display = Show(eLNOMesh1, renderView1) + # trace defaults for the display properties. + eLNOMesh1Display.ColorArrayName = [None, ''] + eLNOMesh1Display.GlyphType = 'Arrow' + eLNOMesh1Display.ScalarOpacityUnitDistance = 1.1905507889761495 + + # hide data in view + Hide(testTotomed, renderView1) + + # set scalar coloring + ColorBy(eLNOMesh1Display, ('FIELD', 'vtkBlockColors')) + + # show color bar/color legend + eLNOMesh1Display.SetScalarBarVisibility(renderView1, False) + + # set scalar coloring + ColorBy(eLNOMesh1Display, ('POINTS', 'MyField')) + + # rescale color and/or opacity maps used to include current data range + eLNOMesh1Display.RescaleTransferFunctionToDataRange(True) + + # show color bar/color legend + eLNOMesh1Display.SetScalarBarVisibility(renderView1, False) + + # get color transfer function/color map for 'MyField' + myFieldLUT = GetColorTransferFunction('MyField') + + # get opacity transfer function/opacity map for 'MyField' + myFieldPWF = GetOpacityTransferFunction('MyField') + + # hide color bar/color legend + eLNOMesh1Display.SetScalarBarVisibility(renderView1, False) + + # create a new 'Glyph' + glyph1 = Glyph(Input=eLNOMesh1, + GlyphType='Arrow') + glyph1.ScaleArray = ['POINTS', 'MyField'] + glyph1.OrientationArray = ['POINTS', 'No orientation array'] + glyph1.MaximumGlyphSize = 0.15000000000000002 + glyph1.GlyphTransform = 'Transform2' + + # Properties modified on glyph1 + glyph1.GlyphType = 'Sphere' + glyph1.MaximumGlyphSize = 0.15 + + # show data in view + glyph1Display = Show(glyph1, renderView1) + # trace defaults for the display properties. + glyph1Display.ColorArrayName = ['POINTS', 'MyField'] + glyph1Display.LookupTable = myFieldLUT + glyph1Display.GlyphType = 'Arrow' + + # hide color bar/color legend + glyph1Display.SetScalarBarVisibility(renderView1, False) + + #### saving camera placements for all active views + + # current camera placement for renderView1 + renderView1.InteractionMode = '2D' + renderView1.CameraPosition = [0.9999999999999908, 9999.999999999995, 9999.999999999993] + renderView1.CameraFocalPoint = [1.0, 0.0, 0.0] + renderView1.CameraViewUp = [0.6331899945158901, 0.547298104713038, -0.5472981047130381] + renderView1.CameraParallelScale = 0.6930835077290218 + renderView1.ViewSize = [739,503] + + 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 + from vtk.util.misc import vtkGetTempDir + vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() + vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, threshold=1) + vtk.test.Testing.interact() diff --git a/src/Plugins/MEDReader/Test/testMEDReader3.py b/src/Plugins/MEDReader/Test/testMEDReader3.py index d57e2470..2e7c50b7 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader3.py +++ b/src/Plugins/MEDReader/Test/testMEDReader3.py @@ -19,6 +19,9 @@ # # Author : Anthony Geay +import os +import sys + from MEDLoader import * fname="testMEDReader3.med" @@ -93,52 +96,51 @@ testMEDReader3.AllArrays=['TS0/mesh/ComSup0/ANodeField@@][@@P1'] assert(list(testMEDReader3.TimestepValues)==[1.,2.,3.,4.,5.]) ## <- the test is here - double time steps are too big use dt. -RenderView1=GetRenderView() -RenderView1.ViewTime=3.0 -RenderView1.CameraPosition=[0.5,0.5,5.7320508075688776] -RenderView1.ViewSize=[300,300] - -DataRepresentation2=Show() -DataRepresentation2.EdgeColor=[0.0, 0.0, 0.5000076295109483] -DataRepresentation2.SelectionPointFieldDataArrayName='ANodeField' -DataRepresentation2.SelectionCellFieldDataArrayName='FamilyIdCell' -DataRepresentation2.ScalarOpacityUnitDistance=1.4142135623730951 -DataRepresentation2.ExtractedBlockIndex=1 -DataRepresentation2.ScaleFactor=0.1 - -a1_ANodeField_PVLookupTable=GetLookupTableForArray("ANodeField",1,RGBPoints=[0.0,0.23,0.299,0.754,4.0,0.706,0.016,0.15],VectorMode='Magnitude',NanColor=[0.25,0.0,0.0], - ColorSpace='Diverging',ScalarRangeInitialized=1.0,AllowDuplicateScalars=1) -a1_ANodeField_PiecewiseFunction=CreatePiecewiseFunction(Points=[0.0,0.0,0.5,0.0,1.0,1.0,0.5,0.0]) -a1_ANodeField_PVLookupTable.ScalarOpacityFunction=a1_ANodeField_PiecewiseFunction - -DataRepresentation2.ScalarOpacityFunction=a1_ANodeField_PiecewiseFunction -DataRepresentation2.ColorArrayName='ANodeField' -DataRepresentation2.LookupTable=a1_ANodeField_PVLookupTable - -# Triangulate so rendring always the same with different gpu or graphic backend. -extSurf = ExtractSurface(Input=testMEDReader3) -triangulate = Triangulate(Input=extSurf) -Hide(testMEDReader3, RenderView1) -Show(triangulate, RenderView1) -triangulate1Display = GetDisplayProperties(triangulate, view=RenderView1) -ColorBy(triangulate1Display, ('POINTS', 'ANodeField')) - -Render() -### - -# compare with baseline image -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, "testMEDReader3.png") -import vtk.test.Testing -from vtk.util.misc import vtkGetTempDir -vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() -vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, - threshold=1) -vtk.test.Testing.interact() +if '-D' not in sys.argv: + RenderView1=GetRenderView() + RenderView1.ViewTime=3.0 + RenderView1.CameraPosition=[0.5,0.5,5.7320508075688776] + RenderView1.ViewSize=[300,300] + + DataRepresentation2=Show() + DataRepresentation2.EdgeColor=[0.0, 0.0, 0.5000076295109483] + DataRepresentation2.SelectionPointFieldDataArrayName='ANodeField' + DataRepresentation2.SelectionCellFieldDataArrayName='FamilyIdCell' + DataRepresentation2.ScalarOpacityUnitDistance=1.4142135623730951 + DataRepresentation2.ExtractedBlockIndex=1 + DataRepresentation2.ScaleFactor=0.1 + + a1_ANodeField_PVLookupTable=GetLookupTableForArray("ANodeField",1,RGBPoints=[0.0,0.23,0.299,0.754,4.0,0.706,0.016,0.15],VectorMode='Magnitude',NanColor=[0.25,0.0,0.0], + ColorSpace='Diverging',ScalarRangeInitialized=1.0,AllowDuplicateScalars=1) + a1_ANodeField_PiecewiseFunction=CreatePiecewiseFunction(Points=[0.0,0.0,0.5,0.0,1.0,1.0,0.5,0.0]) + a1_ANodeField_PVLookupTable.ScalarOpacityFunction=a1_ANodeField_PiecewiseFunction + + DataRepresentation2.ScalarOpacityFunction=a1_ANodeField_PiecewiseFunction + DataRepresentation2.ColorArrayName='ANodeField' + DataRepresentation2.LookupTable=a1_ANodeField_PVLookupTable + + # Triangulate so rendring always the same with different gpu or graphic backend. + extSurf = ExtractSurface(Input=testMEDReader3) + triangulate = Triangulate(Input=extSurf) + Hide(testMEDReader3, RenderView1) + Show(triangulate, RenderView1) + triangulate1Display = GetDisplayProperties(triangulate, view=RenderView1) + ColorBy(triangulate1Display, ('POINTS', 'ANodeField')) + + Render() + ### + + # compare with baseline image + 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, "testMEDReader3.png") + import vtk.test.Testing + from vtk.util.misc import vtkGetTempDir + vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() + vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, + threshold=1) + vtk.test.Testing.interact() diff --git a/src/Plugins/MEDReader/Test/testMEDReader4.py b/src/Plugins/MEDReader/Test/testMEDReader4.py index bdeb3e95..970f320b 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader4.py +++ b/src/Plugins/MEDReader/Test/testMEDReader4.py @@ -19,6 +19,9 @@ # # Author : Anthony Geay +import os +import sys + from MEDLoader import * """ This test checks that umeshes with no names work properly. @@ -84,28 +87,27 @@ function=CreatePiecewiseFunction(Points=[0.0,0.0,0.5,0.0,1.0,1.0,0.5,0.0] ) lookupTable.ScalarOpacityFunction = function DataRepresentation1.LookupTable = lookupTable -RenderView1 = GetRenderView() -RenderView1.CameraViewUp = [0.06254683966704512, 0.9980420295997885, 0.0] -RenderView1.CameraPosition = [0.8087292125440382, 1.3325993334207897, 12.692130429902462] -RenderView1.CameraFocalPoint = [0.8087292125440382, 1.3325993334207897, 0.0] -RenderView1.CameraParallelScale = 3.712804729456109 +if '-D' not in sys.argv: + RenderView1 = GetRenderView() + RenderView1.CameraViewUp = [0.06254683966704512, 0.9980420295997885, 0.0] + RenderView1.CameraPosition = [0.8087292125440382, 1.3325993334207897, 12.692130429902462] + RenderView1.CameraFocalPoint = [0.8087292125440382, 1.3325993334207897, 0.0] + RenderView1.CameraParallelScale = 3.712804729456109 -RenderView1.ViewSize =[300,300] -Render() + RenderView1.ViewSize =[300,300] + Render() -# compare with baseline image -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, "testMEDReader4.png") -import vtk.test.Testing -from vtk.util.misc import vtkGetTempDir -vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() -vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, - threshold=1) -vtk.test.Testing.interact() + # compare with baseline image + 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, "testMEDReader4.png") + import vtk.test.Testing + from vtk.util.misc import vtkGetTempDir + vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() + vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, + threshold=1) + vtk.test.Testing.interact() diff --git a/src/Plugins/MEDReader/Test/testMEDReader5.py b/src/Plugins/MEDReader/Test/testMEDReader5.py index 98d9c027..613dae7f 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader5.py +++ b/src/Plugins/MEDReader/Test/testMEDReader5.py @@ -19,6 +19,9 @@ # # Author : Anthony Geay +import os +import sys + from MEDLoader import * """ This test is CEA specific one. It generates a .sauv file @@ -91,38 +94,37 @@ DataRepresentation2.ScalarOpacityUnitDistance = 1.5768745057161244 DataRepresentation2.ExtractedBlockIndex = 1 DataRepresentation2.ScaleFactor = 0.4 -RenderView1=GetRenderView() -RenderView1.CenterOfRotation=[2.,2.,2.] -RenderView1.CameraViewUp=[0.24562884954787187,0.6907950752417243,-0.680050463047831] -RenderView1.CameraPosition=[-2.5085697461776486,11.6185941755061,10.14210560568201] -RenderView1.CameraFocalPoint=[2.,2.,2.] -RenderView1.CameraParallelScale=5.071791174723188 +if '-D' not in sys.argv: + RenderView1=GetRenderView() + RenderView1.CenterOfRotation=[2.,2.,2.] + RenderView1.CameraViewUp=[0.24562884954787187,0.6907950752417243,-0.680050463047831] + RenderView1.CameraPosition=[-2.5085697461776486,11.6185941755061,10.14210560568201] + RenderView1.CameraFocalPoint=[2.,2.,2.] + RenderView1.CameraParallelScale=5.071791174723188 -LookupTable=GetLookupTableForArray("fNode",1,RGBPoints=[0.0,0.23,0.299,0.754,55.0,0.706,0.016,0.15],VectorMode='Magnitude',NanColor=[0.25,0.0,0.0],ColorSpace='Diverging',ScalarRangeInitialized=1.0,AllowDuplicateScalars=1) -DataRepresentation2 = Show() -DataRepresentation2.EdgeColor = [0.0, 0.0, 0.5000076295109483] -DataRepresentation2.ScalarOpacityUnitDistance = 1.5768745057161244 -DataRepresentation2.ExtractedBlockIndex = 1 -DataRepresentation2.ScaleFactor = 0.4 -DataRepresentation2.ColorArrayName=('POINTS','fNode') -DataRepresentation2.LookupTable=LookupTable + LookupTable=GetLookupTableForArray("fNode",1,RGBPoints=[0.0,0.23,0.299,0.754,55.0,0.706,0.016,0.15],VectorMode='Magnitude',NanColor=[0.25,0.0,0.0],ColorSpace='Diverging',ScalarRangeInitialized=1.0,AllowDuplicateScalars=1) + DataRepresentation2 = Show() + DataRepresentation2.EdgeColor = [0.0, 0.0, 0.5000076295109483] + DataRepresentation2.ScalarOpacityUnitDistance = 1.5768745057161244 + DataRepresentation2.ExtractedBlockIndex = 1 + DataRepresentation2.ScaleFactor = 0.4 + DataRepresentation2.ColorArrayName=('POINTS','fNode') + DataRepresentation2.LookupTable=LookupTable -RenderView1.ViewSize=[300,300] -Render() + RenderView1.ViewSize=[300,300] + Render() -# compare with baseline image -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, "testMEDReader5.png") -import vtk.test.Testing -from vtk.util.misc import vtkGetTempDir -vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() -vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, - threshold=1) -vtk.test.Testing.interact() + # compare with baseline image + 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, "testMEDReader5.png") + import vtk.test.Testing + from vtk.util.misc import vtkGetTempDir + vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() + vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, + threshold=1) + vtk.test.Testing.interact() diff --git a/src/Plugins/MEDReader/Test/testMEDReader6.py b/src/Plugins/MEDReader/Test/testMEDReader6.py index 2aa3a1f8..98beebe8 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader6.py +++ b/src/Plugins/MEDReader/Test/testMEDReader6.py @@ -19,6 +19,9 @@ # # Author : Anthony Geay +import os +import sys + from MEDLoader import * """ This test generate a GaussPoint field on a mesh with groups. @@ -73,41 +76,40 @@ Glyph1.GlyphType = "Sphere" Glyph1.OrientationArray = ['POINTS', 'No orientation array'] Glyph1.MaximumGlyphSize = 0.29 -RenderView1 = GetRenderView() -RenderView1.CameraFocalPoint = [1.5, 1.5, 0.0] -RenderView1.CameraPosition = [1.5, 1.5, 10000.0] -RenderView1.InteractionMode = '3D' -RenderView1.CameraPosition = [1.5, 1.5, 8.196152422706632] -RenderView1.CameraParallelScale = 2.1213203435596424 -RenderView1.CenterOfRotation = [1.5, 1.5, 0.0] +if '-D' not in sys.argv: + RenderView1 = GetRenderView() + RenderView1.CameraFocalPoint = [1.5, 1.5, 0.0] + RenderView1.CameraPosition = [1.5, 1.5, 10000.0] + RenderView1.InteractionMode = '3D' + RenderView1.CameraPosition = [1.5, 1.5, 8.196152422706632] + RenderView1.CameraParallelScale = 2.1213203435596424 + RenderView1.CenterOfRotation = [1.5, 1.5, 0.0] -DataRepresentation4 = Show() -DataRepresentation4.EdgeColor = [0.0, 0.0, 0.5000076295109483] -DataRepresentation4.SelectionPointFieldDataArrayName = 'fGauss' -DataRepresentation4.ScaleFactor = 0.3182729169726372 + DataRepresentation4 = Show() + DataRepresentation4.EdgeColor = [0.0, 0.0, 0.5000076295109483] + DataRepresentation4.SelectionPointFieldDataArrayName = 'fGauss' + DataRepresentation4.ScaleFactor = 0.3182729169726372 -a1_fGauss_PVLookupTable = GetLookupTableForArray( "fGauss", 1, RGBPoints=[0.22, 0.23, 0.299, 0.754, 2.95, 0.706, 0.016, 0.15], VectorMode='Magnitude', NanColor=[0.25, 0.0, 0.0], ColorSpace='Diverging', ScalarRangeInitialized=1.0, AllowDuplicateScalars=1 ) -a1_fGauss_PiecewiseFunction = CreatePiecewiseFunction( Points=[0.0, 0.0, 0.5, 0.0, 1.0, 1.0, 0.5, 0.0] ) -DataRepresentation4.ColorArrayName = 'fGauss' -DataRepresentation4.LookupTable = a1_fGauss_PVLookupTable -a1_fGauss_PVLookupTable.ScalarOpacityFunction = a1_fGauss_PiecewiseFunction + a1_fGauss_PVLookupTable = GetLookupTableForArray( "fGauss", 1, RGBPoints=[0.22, 0.23, 0.299, 0.754, 2.95, 0.706, 0.016, 0.15], VectorMode='Magnitude', NanColor=[0.25, 0.0, 0.0], ColorSpace='Diverging', ScalarRangeInitialized=1.0, AllowDuplicateScalars=1 ) + a1_fGauss_PiecewiseFunction = CreatePiecewiseFunction( Points=[0.0, 0.0, 0.5, 0.0, 1.0, 1.0, 0.5, 0.0] ) + DataRepresentation4.ColorArrayName = 'fGauss' + DataRepresentation4.LookupTable = a1_fGauss_PVLookupTable + a1_fGauss_PVLookupTable.ScalarOpacityFunction = a1_fGauss_PiecewiseFunction -RenderView1.ViewSize=[300,300] -Render() + RenderView1.ViewSize=[300,300] + Render() -# compare with baseline image -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, "testMEDReader6.png") -import vtk.test.Testing -from vtk.util.misc import vtkGetTempDir -vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() -vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, - threshold=1) -vtk.test.Testing.interact() + # compare with baseline image + 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, "testMEDReader6.png") + import vtk.test.Testing + from vtk.util.misc import vtkGetTempDir + vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() + vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, + threshold=1) + vtk.test.Testing.interact() diff --git a/src/Plugins/MEDReader/Test/testMEDReader7.py b/src/Plugins/MEDReader/Test/testMEDReader7.py index 14afd22e..e7d3b535 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader7.py +++ b/src/Plugins/MEDReader/Test/testMEDReader7.py @@ -19,6 +19,9 @@ # # Author : Anthony Geay +import os +import sys + from MEDLoader import * """ This test generate a simple multi time field with a very aggressive time steps triplets. Neither dt, nor iteration nor order is considered. @@ -70,44 +73,43 @@ myMedReader=MEDReader(FileName=fname) myMedReader.AllArrays = ['TS0/mesh/ComSup0/fNode@@][@@P1'] assert(list(myMedReader.TimestepValues)==[0.,1.,2.,3.]) -RenderView1 = GetRenderView() -RenderView1.CameraFocalPoint = [1.5, 1.5, 0.0] -RenderView1.CameraPosition = [1.5, 1.5, 10000.0] -RenderView1.InteractionMode = '3D' -RenderView1.CameraPosition = [1.5, 1.5, 8.196152422706632] -RenderView1.CameraParallelScale = 2.1213203435596424 -RenderView1.CenterOfRotation = [1.5, 1.5, 0.0] +if '-D' not in sys.argv: + RenderView1 = GetRenderView() + RenderView1.CameraFocalPoint = [1.5, 1.5, 0.0] + RenderView1.CameraPosition = [1.5, 1.5, 10000.0] + RenderView1.InteractionMode = '3D' + RenderView1.CameraPosition = [1.5, 1.5, 8.196152422706632] + RenderView1.CameraParallelScale = 2.1213203435596424 + RenderView1.CenterOfRotation = [1.5, 1.5, 0.0] -DataRepresentation4 = Show() -DataRepresentation4.EdgeColor = [0.0, 0.0, 0.5000076295109483] -DataRepresentation4.SelectionPointFieldDataArrayName = 'fNode' -DataRepresentation4.ScaleFactor = 0.3182729169726372 + DataRepresentation4 = Show() + DataRepresentation4.EdgeColor = [0.0, 0.0, 0.5000076295109483] + DataRepresentation4.SelectionPointFieldDataArrayName = 'fNode' + DataRepresentation4.ScaleFactor = 0.3182729169726372 -a1_fGauss_PVLookupTable = GetLookupTableForArray( "fNode", 1, RGBPoints=[0.22, 0.23, 0.299, 0.754, 2.95, 0.706, 0.016, 0.15], VectorMode='Magnitude', NanColor=[0.25, 0.0, 0.0], ColorSpace='Diverging', ScalarRangeInitialized=1.0, AllowDuplicateScalars=1 ) -a1_fGauss_PiecewiseFunction = CreatePiecewiseFunction( Points=[0.0, 0.0, 0.5, 0.0, 1.0, 1.0, 0.5, 0.0] ) -DataRepresentation4.ColorArrayName = 'fNode' -DataRepresentation4.LookupTable = a1_fGauss_PVLookupTable -a1_fGauss_PVLookupTable.ScalarOpacityFunction = a1_fGauss_PiecewiseFunction + a1_fGauss_PVLookupTable = GetLookupTableForArray( "fNode", 1, RGBPoints=[0.22, 0.23, 0.299, 0.754, 2.95, 0.706, 0.016, 0.15], VectorMode='Magnitude', NanColor=[0.25, 0.0, 0.0], ColorSpace='Diverging', ScalarRangeInitialized=1.0, AllowDuplicateScalars=1 ) + a1_fGauss_PiecewiseFunction = CreatePiecewiseFunction( Points=[0.0, 0.0, 0.5, 0.0, 1.0, 1.0, 0.5, 0.0] ) + DataRepresentation4.ColorArrayName = 'fNode' + DataRepresentation4.LookupTable = a1_fGauss_PVLookupTable + a1_fGauss_PVLookupTable.ScalarOpacityFunction = a1_fGauss_PiecewiseFunction -RenderView1.ViewTime = 1.0 #### Important # red is in right bottom -RenderView1.CacheKey = 1.0 -RenderView1.UseCache = 1 -RenderView1.ViewSize=[300,300] -Render() + RenderView1.ViewTime = 1.0 #### Important # red is in right bottom + RenderView1.CacheKey = 1.0 + RenderView1.UseCache = 1 + RenderView1.ViewSize=[300,300] + Render() -# compare with baseline image -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, "testMEDReader7.png") -import vtk.test.Testing -from vtk.util.misc import vtkGetTempDir -vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() -vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, - threshold=6) -vtk.test.Testing.interact() + # compare with baseline image + 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, "testMEDReader7.png") + import vtk.test.Testing + from vtk.util.misc import vtkGetTempDir + vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() + vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, + threshold=6) + vtk.test.Testing.interact() diff --git a/src/Plugins/MEDReader/Test/testMEDReader8.py b/src/Plugins/MEDReader/Test/testMEDReader8.py index 5d527516..d7502324 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader8.py +++ b/src/Plugins/MEDReader/Test/testMEDReader8.py @@ -19,6 +19,9 @@ # # Author : Anthony Geay +import os +import sys + from MEDLoader import * """ This test is a non regression test. ExtractCellType then ExtractGroup. @@ -80,44 +83,43 @@ extGrp=ExtractGroup(Input=extractCT) assert([x for x in list(extGrp.GetProperty("GroupsFlagsInfo")[::2]) if x[:4]=="GRP_"]==['GRP_grp0']) extGrp.AllGroups="GRP_grp0" -RenderView1 = GetRenderView() -RenderView1.CameraFocalPoint = [1.5, 1.5, 0.0] -RenderView1.CameraPosition = [1.5, 1.5, 10000.0] -RenderView1.InteractionMode = '3D' -RenderView1.CameraPosition = [1.5, 1.5, 8.196152422706632] -RenderView1.CameraParallelScale = 2.1213203435596424 -RenderView1.CenterOfRotation = [1.5, 1.5, 0.0] +if '-D' not in sys.argv: + RenderView1 = GetRenderView() + RenderView1.CameraFocalPoint = [1.5, 1.5, 0.0] + RenderView1.CameraPosition = [1.5, 1.5, 10000.0] + RenderView1.InteractionMode = '3D' + RenderView1.CameraPosition = [1.5, 1.5, 8.196152422706632] + RenderView1.CameraParallelScale = 2.1213203435596424 + RenderView1.CenterOfRotation = [1.5, 1.5, 0.0] -DataRepresentation4 = Show() -DataRepresentation4.EdgeColor = [0.0, 0.0, 0.5000076295109483] -DataRepresentation4.SelectionPointFieldDataArrayName = 'fNode' -DataRepresentation4.ScaleFactor = 0.3182729169726372 + DataRepresentation4 = Show() + DataRepresentation4.EdgeColor = [0.0, 0.0, 0.5000076295109483] + DataRepresentation4.SelectionPointFieldDataArrayName = 'fNode' + DataRepresentation4.ScaleFactor = 0.3182729169726372 -a1_fGauss_PVLookupTable = GetLookupTableForArray( "fNode", 1, RGBPoints=[0.22, 0.23, 0.299, 0.754, 2.95, 0.706, 0.016, 0.15], VectorMode='Magnitude', NanColor=[0.25, 0.0, 0.0], ColorSpace='Diverging', ScalarRangeInitialized=1.0, AllowDuplicateScalars=1 ) -a1_fGauss_PiecewiseFunction = CreatePiecewiseFunction( Points=[0.0, 0.0, 0.5, 0.0, 1.0, 1.0, 0.5, 0.0] ) -DataRepresentation4.ColorArrayName = 'fNode' -DataRepresentation4.LookupTable = a1_fGauss_PVLookupTable -a1_fGauss_PVLookupTable.ScalarOpacityFunction = a1_fGauss_PiecewiseFunction + a1_fGauss_PVLookupTable = GetLookupTableForArray( "fNode", 1, RGBPoints=[0.22, 0.23, 0.299, 0.754, 2.95, 0.706, 0.016, 0.15], VectorMode='Magnitude', NanColor=[0.25, 0.0, 0.0], ColorSpace='Diverging', ScalarRangeInitialized=1.0, AllowDuplicateScalars=1 ) + a1_fGauss_PiecewiseFunction = CreatePiecewiseFunction( Points=[0.0, 0.0, 0.5, 0.0, 1.0, 1.0, 0.5, 0.0] ) + DataRepresentation4.ColorArrayName = 'fNode' + DataRepresentation4.LookupTable = a1_fGauss_PVLookupTable + a1_fGauss_PVLookupTable.ScalarOpacityFunction = a1_fGauss_PiecewiseFunction -RenderView1.ViewTime = 1.0 #### Important # red is in right bottom -RenderView1.CacheKey = 1.0 -RenderView1.UseCache = 1 -RenderView1.ViewSize=[300,300] -Render() + RenderView1.ViewTime = 1.0 #### Important # red is in right bottom + RenderView1.CacheKey = 1.0 + RenderView1.UseCache = 1 + RenderView1.ViewSize=[300,300] + Render() -# compare with baseline image -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, "testMEDReader8.png") -import vtk.test.Testing -from vtk.util.misc import vtkGetTempDir -vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() -vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, - threshold=1) -vtk.test.Testing.interact() + # compare with baseline image + 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, "testMEDReader8.png") + import vtk.test.Testing + from vtk.util.misc import vtkGetTempDir + vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir() + vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file, + threshold=1) + vtk.test.Testing.interact() -- 2.30.2