From 03816ea2f4bf6ce47b2df83b505cc6bce12871fe Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Fri, 19 Sep 2014 16:37:50 +0200 Subject: [PATCH] A non regression test focused on bug EDF8761 --- src/Plugins/MEDReader/Test/CMakeLists.txt | 2 + src/Plugins/MEDReader/Test/testMEDReader13.py | 80 +++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 src/Plugins/MEDReader/Test/testMEDReader13.py diff --git a/src/Plugins/MEDReader/Test/CMakeLists.txt b/src/Plugins/MEDReader/Test/CMakeLists.txt index 986cc390..e1bc7776 100644 --- a/src/Plugins/MEDReader/Test/CMakeLists.txt +++ b/src/Plugins/MEDReader/Test/CMakeLists.txt @@ -44,3 +44,5 @@ ADD_TEST(testMEDReader11 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/testME SET_TESTS_PROPERTIES(testMEDReader11 PROPERTIES ENVIRONMENT "${tests_env}") ADD_TEST(testMEDReader12 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/testMEDReader12.py) SET_TESTS_PROPERTIES(testMEDReader12 PROPERTIES ENVIRONMENT "${tests_env}") +ADD_TEST(testMEDReader13 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/testMEDReader13.py) +SET_TESTS_PROPERTIES(testMEDReader13 PROPERTIES ENVIRONMENT "${tests_env}") diff --git a/src/Plugins/MEDReader/Test/testMEDReader13.py b/src/Plugins/MEDReader/Test/testMEDReader13.py new file mode 100644 index 00000000..f67fb52b --- /dev/null +++ b/src/Plugins/MEDReader/Test/testMEDReader13.py @@ -0,0 +1,80 @@ +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# Author : Anthony Geay + +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""" + +fname="testMEDReader13.med" +outImgName="testMEDReader13.png" +# + +m=MEDCouplingUMesh("mesh",2) +m.setCoords(DataArrayDouble([0.,0.,0.,1.,0.,0.,2.,0.,0.,1.,1.,0.],4,3)) +m.allocateCells() +m.insertNextCell(NORM_TRI3,[0,1,3]) ; m.insertNextCell(NORM_TRI3,[1,2,3]) +f=MEDCouplingFieldDouble(ON_GAUSS_NE) ; f.setName("fieldELNO") ; f.setMesh(m) +arr=DataArrayDouble([0.2,1.1,0.7,0.5,-0.3,0.4]) +f.setArray(DataArrayDouble.Meld(4*[arr])) +f.checkCoherency() +MEDLoader.WriteField(fname,f,True) + +################### MED write is done -> Go to MEDReader + +from paraview.simple import * + +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] +RenderView1.CameraClippingRange = [4.276554101433921, 4.384547891874171] + +ELNOMesh3 = ELNOMesh(Input=testMEDReader13_med) + +DataRepresentation2 = Show() +DataRepresentation2.ConstantRadius = 1.9999333620071411 +DataRepresentation2.EdgeColor = [0.0, 0.0, 0.5000076295109483] +DataRepresentation2.PointSpriteDefaultsInitialized = 1 +DataRepresentation2.SelectionPointFieldDataArrayName = 'fieldELNO' +DataRepresentation2.SelectionCellFieldDataArrayName = 'FamilyIdCell' +DataRepresentation2.SelectInputVectors = ['POINTS', 'fieldELNO_Vector'] +DataRepresentation2.ScalarOpacityUnitDistance = 1.7746382108908556 +DataRepresentation2.Texture = [] +DataRepresentation2.SelectUncertaintyArray = ['POINTS', 'fieldELNO'] +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] ) + +Render() +RenderView1.ViewSize =[300,300] +WriteImage(outImgName) -- 2.39.2