From cd2603b6aa6988c4d1d40eea1f2170b5ffd225b5 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Fri, 19 Jul 2019 10:21:35 +0200 Subject: [PATCH] [EDF19821] : tests are writing tmp file into /tmp --- src/Plugins/MEDReader/Test/CMakeLists.txt | 2 +- src/Plugins/MEDReader/Test/MEDReaderHelper.py | 43 +++ src/Plugins/MEDReader/Test/testMEDReader0.py | 229 +++++++------- src/Plugins/MEDReader/Test/testMEDReader1.py | 77 ++--- src/Plugins/MEDReader/Test/testMEDReader10.py | 200 ++++++------ src/Plugins/MEDReader/Test/testMEDReader13.py | 144 ++++----- src/Plugins/MEDReader/Test/testMEDReader14.py | 289 +++++++++--------- src/Plugins/MEDReader/Test/testMEDReader15.py | 121 ++++---- src/Plugins/MEDReader/Test/testMEDReader16.py | 166 +++++----- src/Plugins/MEDReader/Test/testMEDReader17.py | 96 +++--- src/Plugins/MEDReader/Test/testMEDReader18.py | 72 +++-- src/Plugins/MEDReader/Test/testMEDReader19.py | 142 ++++----- src/Plugins/MEDReader/Test/testMEDReader2.py | 179 +++++------ src/Plugins/MEDReader/Test/testMEDReader20.py | 250 +++++++-------- src/Plugins/MEDReader/Test/testMEDReader21.py | 286 ++++++++--------- src/Plugins/MEDReader/Test/testMEDReader3.py | 240 +++++++-------- src/Plugins/MEDReader/Test/testMEDReader4.py | 162 +++++----- src/Plugins/MEDReader/Test/testMEDReader5.py | 188 ++++++------ src/Plugins/MEDReader/Test/testMEDReader6.py | 164 +++++----- src/Plugins/MEDReader/Test/testMEDReader7.py | 171 ++++++----- src/Plugins/MEDReader/Test/testMEDReader8.py | 188 ++++++------ src/Plugins/MEDReader/Test/testMEDReader9.py | 72 +++-- 22 files changed, 1813 insertions(+), 1668 deletions(-) create mode 100644 src/Plugins/MEDReader/Test/MEDReaderHelper.py diff --git a/src/Plugins/MEDReader/Test/CMakeLists.txt b/src/Plugins/MEDReader/Test/CMakeLists.txt index b71c7094..1b1426a0 100644 --- a/src/Plugins/MEDReader/Test/CMakeLists.txt +++ b/src/Plugins/MEDReader/Test/CMakeLists.txt @@ -116,4 +116,4 @@ ENDFOREACH() INSTALL(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} RENAME CTestTestfile.cmake) -INSTALL(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY}) +INSTALL(FILES tests.set MEDReaderHelper.py DESTINATION ${TEST_INSTALL_DIRECTORY}) diff --git a/src/Plugins/MEDReader/Test/MEDReaderHelper.py b/src/Plugins/MEDReader/Test/MEDReaderHelper.py new file mode 100644 index 00000000..7d970f0f --- /dev/null +++ b/src/Plugins/MEDReader/Test/MEDReaderHelper.py @@ -0,0 +1,43 @@ +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2019 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, or (at your option) any later version. +# +# 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 (EDF R&D) + +def WriteInTmpDir(func): + def decoratedFunc(*args,**kwargs): + import tempfile,os + ret = None + with tempfile.TemporaryDirectory() as tmpdirname: + os.chdir(tmpdirname) + ret = func(*args,**kwargs) + pass + return ret + return decoratedFunc + +def RetriveBaseLine(imgFile): + import os,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, imgFile) + return os.path.abspath(baseline_file) + diff --git a/src/Plugins/MEDReader/Test/testMEDReader0.py b/src/Plugins/MEDReader/Test/testMEDReader0.py index 090b066c..a8af4345 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader0.py +++ b/src/Plugins/MEDReader/Test/testMEDReader0.py @@ -22,120 +22,125 @@ import os import sys -from MEDLoader import * - -fname="testMEDReader0.med" -outImgName="testMEDReader0.png" -######### -mz=MEDCoupling1SGTUMesh("mesh",NORM_QUAD9) -mz.setNodalConnectivity(DataArrayInt([0,6,37,12,76,112,113,82,205,12,37,38,13,113,114,115,83,206,13,38,9,1,115,116,79,84,207,6,7,39,37,77,117,118,112,208,37,39,40,38,118,119,120,114,209,38,40,10,9,120,121,80,116,210,7,8,41,39,78,122,123,117,211,39,41,42,40,123,124,125,119,212,40,42,11,10,125,126,81,121,213,1,9,43,17,79,127,128,88,214,17,43,44,18,128,129,130,89,215,18,44,14,2,130,131,85,90,216,9,10,45,43,80,132,133,127,217,43,45,46,44,133,134,135,129,218,44,46,15,14,135,136,86,131,219,10,11,47,45,81,137,138,132,220,45,47,48,46,138,139,140,134,221,46,48,16,15,140,141,87,136,222,1,9,49,22,79,142,143,94,223,22,49,50,23,143,144,145,95,224,23,50,51,24,145,146,147,96,225,24,51,52,25,147,148,149,97,226,25,52,53,26,149,150,151,98,227,26,53,19,3,151,152,91,99,228,9,10,54,49,80,153,154,142,229,49,54,55,50,154,155,156,144,230,50,55,56,51,156,157,158,146,231,51,56,57,52,158,159,160,148,232,52,57,58,53,160,161,162,150,233,53,58,20,19,162,163,92,152,234,10,11,59,54,81,164,165,153,235,54,59,60,55,165,166,167,155,236,55,60,61,56,167,168,169,157,237,56,61,62,57,169,170,171,159,238,57,62,63,58,171,172,173,161,239,58,63,21,20,173,174,93,163,240,4,27,64,30,100,175,176,103,241,30,64,65,31,176,177,178,104,242,31,65,19,3,178,179,91,105,243,27,28,66,64,101,180,181,175,244,64,66,67,65,181,182,183,177,245,65,67,20,19,183,184,92,179,246,28,29,68,66,102,185,186,180,247,66,68,69,67,186,187,188,182,248,67,69,21,20,188,189,93,184,249,3,19,70,35,91,190,191,109,250,35,70,71,36,191,192,193,110,251,36,71,32,5,193,194,106,111,252,19,20,72,70,92,195,196,190,253,70,72,73,71,196,197,198,192,254,71,73,33,32,198,199,107,194,255,20,21,74,72,93,200,201,195,256,72,74,75,73,201,202,203,197,257,73,75,34,33,203,204,108,199,258])) -coords=DataArrayDouble([-0.04,0.015,0.,0.,0.015,0.,0.04,0.015,0.,0.,0.105,0.,-0.04,0.105,0.,0.04,0.105,0.,-0.04,0.015,0.015,-0.04,0.015,0.03,-0.04,0.015,0.045,0.,0.015,0.015,0.,0.015,0.03,0.,0.015,0.045,-0.026666666666666665,0.015,0.,-0.013333333333333329,0.015,0.,0.04,0.015,0.015,0.04,0.015,0.03,0.04,0.015,0.045,0.013333333333333336,0.015,0.,0.026666666666666672,0.015,0.,0.,0.105,0.015,0.,0.105,0.03,0.,0.105,0.045,0.,0.03,0.,0.,0.045,0.,0.,0.06,0.,0.,0.075,0.,0.,0.09,0.,-0.04,0.105,0.015,-0.04,0.105,0.03,-0.04,0.105,0.045,-0.026666666666666665,0.105,0.,-0.013333333333333329,0.105,0.,0.04,0.105,0.015,0.04,0.105,0.03,0.04,0.105,0.045,0.013333333333333336,0.105,0.,0.026666666666666672,0.105,0.,-0.026666666666666665,0.015,0.015,-0.013333333333333326,0.015,0.015,-0.026666666666666665,0.015,0.03,-0.013333333333333326,0.015,0.03,-0.026666666666666665,0.015,0.045,-0.013333333333333329,0.015,0.045,0.013333333333333338,0.015,0.015,0.026666666666666675,0.015,0.015,0.013333333333333338,0.015,0.03,0.026666666666666675,0.015,0.03,0.013333333333333336,0.015,0.045,0.026666666666666672,0.015,0.045,0.,0.03,0.015,0.,0.045,0.015,0.,0.06,0.015,0.,0.07500000000000001,0.015,0.,0.09,0.015,0.,0.03,0.03,0.,0.045,0.03,0.,0.06,0.03,0.,0.075,0.03,0.,0.09,0.03,0.,0.03,0.045,0.,0.045,0.045,0.,0.06,0.045,0.,0.075,0.045,0.,0.09,0.045,-0.026666666666666665,0.105,0.015,-0.013333333333333326,0.105,0.015,-0.026666666666666665,0.105,0.03,-0.013333333333333326,0.105,0.03,-0.026666666666666665,0.105,0.045,-0.013333333333333329,0.105,0.045,0.013333333333333338,0.105,0.015,0.026666666666666675,0.105,0.015,0.013333333333333338,0.105,0.03,0.026666666666666675,0.105,0.03,0.013333333333333336,0.105,0.045,0.026666666666666672,0.105,0.045,-0.04,0.015,0.0075,-0.04,0.015,0.0225,-0.04,0.015,0.0375,0.,0.015,0.0075,0.,0.015,0.0225,0.,0.015,0.0375,-0.03333333333333333,0.015,0.,-0.02,0.015,0.,-0.0066666666666666645,0.015,0.,0.04,0.015,0.0075,0.04,0.015,0.0225,0.04,0.015,0.0375,0.006666666666666668,0.015,0.,0.02,0.015,0.,0.03333333333333334,0.015,0.,0.,0.105,0.0075,0.,0.105,0.0225,0.,0.105,0.0375,0.,0.0225,0.,0.,0.0375,0.,0.,0.0525,0.,0.,0.0675,0.,0.,0.0825,0.,0.,0.0975,0.,-0.04,0.105,0.0075,-0.04,0.105,0.0225,-0.04,0.105,0.0375,-0.03333333333333333,0.105,0.,-0.02,0.105,0.,-0.0066666666666666645,0.105,0.,0.04,0.105,0.0075,0.04,0.105,0.0225,0.04,0.105,0.0375,0.006666666666666668,0.105,0.,0.02,0.105,0.,0.03333333333333334,0.105,0.,-0.03333333333333333,0.015,0.015,-0.026666666666666665,0.015,0.0075,-0.02,0.015,0.015,-0.013333333333333327,0.015,0.0075,-0.006666666666666663,0.015,0.015,-0.03333333333333333,0.015,0.03,-0.026666666666666665,0.015,0.0225,-0.02,0.015,0.03,-0.013333333333333326,0.015,0.0225,-0.006666666666666663,0.015,0.03,-0.03333333333333333,0.015,0.045,-0.026666666666666665,0.015,0.0375,-0.02,0.015,0.045,-0.013333333333333327,0.015,0.0375,-0.0066666666666666645,0.015,0.045,0.006666666666666669,0.015,0.015,0.013333333333333336,0.015,0.0075,0.020000000000000007,0.015,0.015,0.026666666666666672,0.015,0.0075,0.03333333333333334,0.015,0.015,0.006666666666666669,0.015,0.03,0.013333333333333338,0.015,0.0225,0.02,0.015,0.03,0.026666666666666675,0.015,0.0225,0.03333333333333334,0.015,0.03,0.006666666666666668,0.015,0.045,0.013333333333333336,0.015,0.0375,0.02,0.015,0.045,0.026666666666666672,0.015,0.0375,0.03333333333333334,0.015,0.045,0.,0.0225,0.015,0.,0.03,0.0075,0.,0.0375,0.015,0.,0.045,0.0075,0.,0.0525,0.015,0.,0.06,0.0075,0.,0.0675,0.015,0.,0.07500000000000001,0.0075,0.,0.0825,0.015,0.,0.09,0.0075,0.,0.0975,0.015,0.,0.0225,0.03,0.,0.03,0.0225,0.,0.0375,0.03,0.,0.045,0.0225,0.,0.0525,0.03,0.,0.06,0.0225,0.,0.0675,0.03,0.,0.07500000000000001,0.0225,0.,0.08249999999999999,0.03,0.,0.09,0.0225,0.,0.0975,0.03,0.,0.0225,0.045,0.,0.03,0.0375,0.,0.0375,0.045,0.,0.045,0.0375,0.,0.0525,0.045,0.,0.06,0.0375,0.,0.0675,0.045,0.,0.075,0.0375,0.,0.08249999999999999,0.045,0.,0.09,0.0375,0.,0.0975,0.045,-0.03333333333333333,0.105,0.015,-0.026666666666666665,0.105,0.0075,-0.02,0.105,0.015,-0.013333333333333327,0.105,0.0075,-0.006666666666666663,0.105,0.015,-0.03333333333333333,0.105,0.03,-0.026666666666666665,0.105,0.0225,-0.02,0.105,0.03,-0.013333333333333326,0.105,0.0225,-0.006666666666666663,0.105,0.03,-0.03333333333333333,0.105,0.045,-0.026666666666666665,0.105,0.0375,-0.02,0.105,0.045,-0.013333333333333327,0.105,0.0375,-0.0066666666666666645,0.105,0.045,0.006666666666666669,0.105,0.015,0.013333333333333336,0.105,0.0075,0.020000000000000007,0.105,0.015,0.026666666666666672,0.105,0.0075,0.03333333333333334,0.105,0.015,0.006666666666666669,0.105,0.03,0.013333333333333338,0.105,0.0225,0.020000000000000007,0.105,0.03,0.026666666666666675,0.105,0.0225,0.03333333333333334,0.105,0.03,0.006666666666666668,0.105,0.045,0.013333333333333336,0.105,0.0375,0.02,0.105,0.045,0.026666666666666672,0.105,0.0375,0.03333333333333334,0.105,0.045,-0.03333333333333333,0.015,0.0075,-0.02,0.015,0.0075,-0.006666666666666664,0.015,0.0075,-0.03333333333333333,0.015,0.0225,-0.02,0.015,0.0225,-0.006666666666666663,0.015,0.0225,-0.03333333333333333,0.015,0.0375,-0.02,0.015,0.0375,-0.006666666666666662,0.015,0.0375,0.006666666666666668,0.015,0.0075,0.02,0.015,0.0075,0.03333333333333334,0.015,0.0075,0.006666666666666669,0.015,0.0225,0.020000000000000007,0.015,0.0225,0.03333333333333334,0.015,0.0225,0.006666666666666668,0.015,0.0375,0.02,0.015,0.0375,0.03333333333333334,0.015,0.0375,0.,0.0225,0.0075,0.,0.0375,0.0075,0.,0.0525,0.0075,0.,0.0675,0.0075,0.,0.0825,0.0075,0.,0.0975,0.0075,0.,0.0225,0.0225,0.,0.0375,0.0225,0.,0.0525,0.0225,0.,0.0675,0.0225,0.,0.0825,0.0225,0.,0.0975,0.0225,0.,0.0225,0.0375,0.,0.0375,0.0375,0.,0.0525,0.0375,0.,0.0675,0.0375,0.,0.08249999999999999,0.0375,0.,0.0975,0.0375,-0.03333333333333333,0.105,0.0075,-0.02,0.105,0.0075,-0.006666666666666664,0.105,0.0075,-0.03333333333333333,0.105,0.0225,-0.02,0.105,0.0225,-0.006666666666666663,0.105,0.0225,-0.03333333333333333,0.105,0.0375,-0.02,0.105,0.0375,-0.006666666666666662,0.105,0.0375,0.006666666666666668,0.105,0.0075,0.02,0.105,0.0075,0.03333333333333334,0.105,0.0075,0.006666666666666669,0.105,0.0225,0.020000000000000007,0.105,0.0225,0.03333333333333334,0.105,0.0225,0.006666666666666668,0.105,0.0375,0.02,0.105,0.0375,0.03333333333333334,0.105,0.0375],259,3) -coords.setInfoOnComponents(['X [INCONNUE]','Y [INCONNUE]','Z [INCONNUE]']) -mz.setCoords(coords) -mz=mz.buildUnstructured() -# -arr0=DataArrayDouble() -vals0=9*[-3593.,85220.,-15343.,-438.,11985.,-15343.,2716.,-61248.,-15343.,5488.,101072.,-16250.,549.,13186.,-16250.,-4389.,-74699.,-16250.,9988.,101646.,-17156.,1537.,14386.,-17156.,-6913.,-72874.,-17156.,22178.,120238.,-19521.,2342.,14222.,-19521.,-17493.,-91793.,-19521.,37737.,139840.,-21887.,3147.,14059.,-21887.,-31443.,-111722.,-21887.,34350.,140668.,-18690.,3714.,16214.,-18690.,-26922.,-108238.,-18690.,34563.,153494.,-15493.,4281.,18370.,-15493.,-26000.,-116753.,-15493.,2147.,115356.,-15418.,1921.,15178.,-15418.,1695.,-84999.,-15418.,12408.,118616.,-17470.,2131.,14700.,-17470.,-8144.,-89215.,-17470.,15624.,100983.,-16718.,2286.,15441.,-16718.,-11050.,-70101.,-16718.,19381.,102680.,-17191.,2505.,16813.,-17191.,-14370.,-69054.,-17191.,22911.,103615.,-17665.,2725.,18184.,-17665.,-17461.,-67245.,-17665.,32377.,125140.,-20005.,4011.,17741.,-20005.,-24353.,-89657.,-20005.,43183.,147067.,-22345.,5298.,17297.,-22345.,-32586.,-112472.,-22345.,41570.,144664.,-22105.,4896.,15874.,-22105.,-31778.,-112915.,-22105.,40070.,142637.,-21866.,4493.,14451.,-21866.,-31083.,-113734.,-21866.,25367.,121066.,-19292.,3390.,14946.,-19292.,-18587.,-91173.,-19292.,28901.,123199.,-19648.,3701.,16343.,-19648.,-21499.,-90512.,-19648.,23716.,103481.,-17470.,2234.,18509.,-17470.,-19247.,-66463.,-17470.,22561.,104808.,-17142.,1238.,20732.,-17142.,-20084.,-63343.,-17142.,21499.,106443.,-16813.,242.,22956.,-16813.,-21014.,-60531.,-16813.,32906.,133441.,-20775.,3873.,26633.,-20775.,-25158.,-80173.,-20775.,45801.,160885.,-24737.,7505.,30311.,-24737.,-30791.,-100262.,-24737.,44184.,154705.,-23601.,5922.,24329.,-23601.,-32340.,-106046.,-23601.,42566.,148521.,-22465.,4338.,18347.,-22465.,-33888.,-111825.,-22465.,32545.,125822.,-19968.,3286.,18428.,-19968.,-25972.,-88965.,-19968.,32703.,129556.,-20371.,3580.,22531.,-20371.,-25542.,-84493.,-20371.,-580.,50781.,-14878.,-188.,10419.,-14878.,203.,-29941.,-14878.,974.,53486.,-13087.,-197.,11696.,-13087.,-1370.,-30094.,-13087.,2154.,54941.,-11297.,-206.,12972.,-11297.,-2567.,-28996.,-11297.,4921.,72039.,-13221.,709.,13770.,-13221.,-3503.,-44499.,-13221.,6472.,88772.,-15144.,1624.,14567.,-15144.,-3223.,-59637.,-15144.,4104.,85353.,-15580.,600.,13047.,-15580.,-2903.,-59258.,-15580.,1258.,80341.,-16016.,-423.,11526.,-16016.,-2105.,-57288.,-16016.,-822.,65212.,-15447.,-306.,10973.,-15447.,210.,-43266.,-15447.,2262.,69336.,-14334.,201.,12371.,-14334.,-1859.,-44593.,-14334.,4047.,55415.,-11562.,137.,13264.,-11562.,-3772.,-28887.,-11562.,6455.,56737.,-11164.,80.,14219.,-11164.,-6294.,-28298.,-11164.,8701.,57516.,-10766.,23.,15175.,-10766.,-8653.,-27166.,-10766.,12843.,74210.,-13196.,662.,16118.,-13196.,-11519.,-41972.,-13196.,17837.,91160.,-15627.,1300.,17062.,-15627.,-15237.,-57034.,-15627.,14573.,90279.,-15674.,1166.,15841.,-15674.,-12240.,-58596.,-15674.,11497.,90026.,-15722.,1033.,14619.,-15722.,-9431.,-60786.,-15722.,7014.,72493.,-13642.,585.,13941.,-13642.,-5844.,-44609.,-13642.,9922.,73330.,-13419.,623.,15030.,-13419.,-8675.,-43270.,-13419.,9608.,58062.,-10666.,-408.,15882.,-10666.,-10425.,-26297.,-10666.,10622.,58358.,-9978.,-497.,16431.,-9978.,-11617.,-25496.,-9978.,11722.,58941.,-9290.,-587.,16979.,-9290.,-12896.,-24981.,-9290.,14386.,76411.,-12130.,-417.,19190.,-12130.,-15221.,-38029.,-12130.,18009.,94168.,-14969.,-248.,21401.,-14969.,-18505.,-51365.,-14969.,19049.,93091.,-15325.,999.,19998.,-15325.,-17050.,-53095.,-15325.,20242.,92527.,-15681.,2246.,18594.,-15681.,-15748.,-55338.,-15681.,14435.,75147.,-13174.,919.,17238.,-13174.,-12597.,-40670.,-13174.,14351.,75579.,-12652.,250.,18214.,-12652.,-13849.,-39150.,-12652.0] -arr0.setValues(vals0,1458,3) -arr0.setInfoOnComponents(['SIXX','SIYY','SIYZ']) -f0z=MEDCouplingFieldDouble(ON_GAUSS_PT) -f0z.setMesh(mz) -f0z.setArray(arr0) -f0z.setGaussLocalizationOnType(NORM_QUAD9,[-1,-1,1,-1,1,1,-1,1,0,-1,1,0,0,1,-1,0,0,0],[-0.774597,-0.774597,0.774597,-0.774597,0.774597,0.774597,-0.774597,0.774597,0,-0.774597,0.774597,0,0,0.774597,-0.774597,0,0,0,-0.774597,-0.774597,0.774597,-0.774597,0.774597,0.774597,-0.774597,0.774597,0,-0.774597,0.774597,0,0,0.774597,-0.774597,0,0,0,-0.774597,-0.774597,0.774597,-0.774597,0.774597,0.774597,-0.774597,0.774597,0,-0.774597,0.774597,0,0,0.774597,-0.774597,0,0,0],[0.308642,0.308642,0.308642,0.308642,0.493827,0.493827,0.493827,0.493827,0.790123,0.308642,0.308642,0.308642,0.308642,0.493827,0.493827,0.493827,0.493827,0.790123,0.308642,0.308642,0.308642,0.308642,0.493827,0.493827,0.493827,0.493827,0.790123]) -f0z.setName("SolutionSIEF_ELGA") -f0z.checkConsistencyLight() -ff0z=MEDFileField1TS() -ff0z.setFieldNoProfileSBT(f0z) -# -arr1=DataArrayDouble([158663.,171562.,32597.,37341.,118998.,128979.,88846.,94935.,28786.,32250.,67038.,71287.,102742.,108939.,32907.,37716.,0.,0.,138922.,155768.,41391.,47731.,114491.,128395.,94101.,100197.,31445.,35939.,67322.,71913.,94031.,103701.,34833.,39475.,0.,0.,142412.,160086.,42700.,49041.,113826.,128551.,92705.,102386.,34032.,38580.,61698.,69417.,96177.,104283.,38223.,40570.,0.,0.,87935.,89674.,30482.,34419.,66325.,69150.,53964.,55380.,28306.,32157.,37909.,40395.,53662.,55355.,22264.,24611.,0.,0.,94013.,100457.,31768.,36134.,68065.,73681.,53358.,55305.,23341.,26188.,32996.,35203.,52496.,56792.,23849.,26556.,0.,0.,92797.,102692.,33656.,38268.,61244.,68735.,52594.,56740.,24539.,27146.,29157.,33011.,52853.,57683.,25671.,28315.,0.,0.,53581.,55745.,27972.,31820.,37174.,39935.,29236.,31416.,22475.,25354.,20531.,23672.,25557.,26298.,15741.,17492.,0.,0.,53385.,55725.,23224.,25998.,32556.,35093.,25809.,26619.,16518.,18338.,18447.,21219.,23343.,26173.,16948.,19353.,0.,0.,52384.,56725.,24293.,26951.,29491.,33373.,23510.,26382.,17117.,19543.,19649.,22252.,26670.,30680.,19554.,22512.,0.,0.,158781.,178651.,54413.,62227.,103151.,116693.,96177.,104283.,38223.,40570.,56254.,64331.,92705.,102386.,34032.,38580.,0.,0.,142873.,161033.,43285.,49854.,113088.,127440.,94031.,103701.,34833.,39475.,61888.,69552.,94101.,100197.,31445.,35939.,0.,0.,132908.,149284.,42933.,49391.,109280.,123481.,102742.,108939.,32907.,37716.,75662.,80547.,88846.,94935.,28786.,32250.,0.,0.,96505.,105010.,37990.,40710.,56669.,64741.,52853.,57683.,25671.,28315.,26824.,30727.,52594.,56740.,24539.,27146.,0.,0.,92360.,101577.,33582.,37900.,61559.,69237.,52496.,56792.,23849.,26556.,29094.,32746.,53358.,55305.,23341.,26188.,0.,0.,95615.,101326.,31440.,36083.,69356.,73116.,53662.,55355.,22264.,24611.,31957.,34376.,53964.,55380.,28306.,32157.,0.,0.,53029.,58077.,25636.,28363.,27182.,31122.,26670.,30680.,19554.,22512.,20758.,22139.,23510.,26382.,17117.,19543.,0.,0.,52348.,56723.,23922.,26648.,29286.,32993.,23343.,26173.,16948.,19353.,19615.,22178.,25809.,26619.,16518.,18338.,0.,0.,53623.,55229.,22321.,24800.,32700.,34971.,25557.,26298.,15741.,17492.,18986.,21836.,29236.,31416.,22475.,25354.,0.,0.,64897.,69997.,64897.,69997.,64897.,69997.,81086.,90448.,81086.,90448.,81086.,90448.,85289.,98323.,85289.,98323.,0.,0.,71712.,82585.,71712.,82585.,71712.,82585.,83868.,96651.,83868.,96651.,83868.,96651.,86266.,99505.,86266.,99505.,0.,0.,77671.,89574.,77671.,89574.,77671.,89574.,86057.,99277.,86057.,99277.,86057.,99277.,86664.,99373.,86664.,99373.,0.,0.,80105.,91799.,80105.,91799.,80105.,91799.,86589.,99313.,86589.,99313.,86589.,99313.,85997.,97609.,85997.,97609.,0.,0.,79826.,90350.,79826.,90350.,79826.,90350.,86438.,98180.,86438.,98180.,86438.,98180.,85995.,95152.,85995.,95152.,0.,0.,75137.,82756.,75137.,82756.,75137.,82756.,88617.,98610.,88617.,98610.,88617.,98610.,79961.,83623.,79961.,83623.,0.,0.,79241.,88756.,79241.,88756.,79241.,88756.,84552.,97374.,84552.,97374.,84552.,97374.,93024.,107413.,93024.,107413.,0.,0.,85301.,98315.,85301.,98315.,85301.,98315.,92453.,106752.,92453.,106752.,92453.,106752.,93783.,108035.,93783.,108035.,0.,0.,86813.,100152.,86813.,100152.,86813.,100152.,93530.,107737.,93530.,107737.,93530.,107737.,92512.,106099.,92512.,106099.,0.,0.,87195.,100044.,87195.,100044.,87195.,100044.,92527.,106109.,92527.,106109.,92527.,106109.,90156.,102760.,90156.,102760.,0.,0.,87342.,99233.,87342.,99233.,87342.,99233.,90384.,103001.,90384.,103001.,90384.,103001.,85458.,96494.,85458.,96494.,0.,0.,90428.,100728.,90428.,100728.,90428.,100728.,85454.,96396.,85454.,96396.,85454.,96396.,70692.,78323.,70692.,78323.,0.,0.,84617.,97440.,84617.,97440.,84617.,97440.,83973.,96607.,83973.,96607.,83973.,96607.,92886.,106795.,92886.,106795.,0.,0.,92294.,106564.,92294.,106564.,92294.,106564.,92515.,106364.,92515.,106364.,92515.,106364.,94158.,108033.,94158.,108033.,0.,0.,93639.,107861.,93639.,107861.,93639.,107861.,93950.,107796.,93950.,107796.,93950.,107796.,91874.,105168.,91874.,105168.,0.,0.,92701.,106313.,92701.,106313.,92701.,106313.,91869.,105167.,91869.,105167.,91869.,105167.,87044.,99369.,87044.,99369.,0.,0.,90450.,103104.,90450.,103104.,90450.,103104.,87236.,99605.,87236.,99605.,87236.,99605.,78375.,89211.,78375.,89211.,0.,0.,84833.,95787.,84833.,95787.,84833.,95787.,78665.,89521.,78665.,89521.,78665.,89521.,63448.,71985.,63448.,71985.,0.,0.,9194.,10306.,41521.,44441.,79431.,85178.,8946.,9792.,22335.,23886.,51736.,54740.,7726.,8300.,30477.,32533.,0.,0.,25028.,27404.,28235.,31471.,75379.,84132.,7236.,8309.,29539.,31536.,54052.,58395.,22577.,23370.,39152.,41429.,0.,0.,37235.,42691.,35353.,38183.,100490.,111738.,23433.,25843.,36759.,39109.,53411.,59694.,57437.,65025.,61345.,68878.,0.,0.,6377.,6683.,22457.,23448.,49503.,50751.,10380.,10835.,19266.,19610.,28417.,28750.,20732.,22044.,26521.,27276.,0.,0.,10131.,11681.,28482.,29670.,52601.,56753.,20722.,21728.,25680.,25959.,30780.,31657.,32161.,33290.,33096.,34633.,0.,0.,21380.,22651.,37121.,39923.,54598.,60751.,34744.,36379.,35111.,37417.,35939.,39080.,46708.,51426.,44384.,48624.,0.,0.,10952.,11418.,19643.,20167.,28488.,29118.,20182.,20242.,18359.,18431.,16718.,16900.,24621.,25169.,20737.,21234.,0.,0.,20251.,21309.,25725.,26026.,31355.,32256.,24539.,25102.,20991.,21593.,17889.,18639.,31588.,32417.,27170.,29235.,0.,0.,33431.,35174.,34427.,36736.,35916.,38926.,31741.,32451.,27148.,29040.,23993.,27214.,38993.,40689.,36596.,40772.,0.,0.,41907.,48128.,77947.,87844.,152033.,169876.,57437.,65025.,61345.,68878.,74154.,85533.,23433.,25843.,36759.,39109.,0.,0.,33932.,38310.,36200.,40713.,99297.,111743.,22577.,23370.,39152.,41429.,57432.,62292.,7236.,8309.,29539.,31536.,0.,0.,22968.,26297.,27645.,30092.,72463.,80413.,7726.,8300.,30477.,32533.,57469.,61055.,8946.,9792.,22335.,23886.,0.,0.,48710.,53918.,59260.,65402.,77350.,87781.,46708.,51426.,44384.,48624.,50354.,58143.,34744.,36379.,35111.,37417.,0.,0.,20908.,22670.,38133.,39669.,56332.,59453.,32161.,33290.,33096.,34633.,34367.,36793.,20722.,21728.,25680.,25959.,0.,0.,7404.,8010.,30073.,32272.,55210.,58955.,20732.,22044.,26521.,27276.,32434.,32943.,10380.,10835.,19266.,19610.,0.,0.,45425.,49667.,44460.,48383.,51014.,58851.,38993.,40689.,36596.,40772.,38865.,44837.,31741.,32451.,27148.,29040.,0.,0.,31595.,32602.,33322.,34837.,35379.,37698.,31588.,32417.,27170.,29235.,24035.,27311.,24539.,25102.,20991.,21593.,0.,0.,19475.,20577.,25384.,25965.,31447.,32050.,24621.,25169.,20737.,21234.,17759.,18414.,20182.,20242.,18359.,18431.,0.,0.],486,2) -arr1.setInfoOnComponents(['VMIS','TRESCA']) -f1z=MEDCouplingFieldDouble(ON_GAUSS_NE) ; f1z.setName("SolutionSIEQ_ELNO") -f1z.setArray(arr1) -f1z.setMesh(mz) -f1z.checkConsistencyLight() -ff1z=MEDFileField1TS() -ff1z.setFieldNoProfileSBT(f1z) -# -arr2=DataArrayDouble([4.938269266683534e-28,-6.232001151245993e-28,1.0602290566170399e-27,4.029857051193646e-29,-1.1103217240985741e-27,-1.5536615528327828e-27,1.5241233363338648e-28,-3.015674201798923e-30,-1.02980203874559e-30,2.72351596604712e-29,-1.1888246600739933e-29,-2.69937196846485e-29,-4.7437993223547586e-07,1.3496193329105202e-07,-7.295395086913946e-07,7.054959528904149e-08,-8.433644218153947e-07,-1.3140517414252605e-08,-4.6699282590396373e-07,-4.307881601165781e-21,-7.181557182928824e-07,-8.028640214851634e-21,-8.231757491716489e-07,-1.2311604671716488e-20,6.500213859021137e-28,-5.36425415550288e-29,2.082592789783471e-28,1.3252863207712998e-28,-4.743799322354692e-07,-1.3496193329105909e-07,-7.295395086913853e-07,-7.054959528905818e-08,-8.433644218153849e-07,1.3140517414226876e-08,6.058451752097371e-28,5.632466863278024e-28,2.208810534618833e-28,2.2876966251409342e-28,-6.120655339318954e-07,1.623023866978208e-20,-7.136250920460284e-07,4.359903572644498e-20,-6.995066975751433e-07,7.373674095935513e-20,0.0,1.4598897976731362e-43,0.0,5.997557427310217e-43,0.0,1.156071233067974e-43,0.0,6.726232628759122e-44,0.0,1.0089348943138683e-43,-4.76082153061813e-07,1.7635130038063272e-07,-7.252650834474581e-07,1.797684522608815e-07,-7.726301925249592e-07,1.3593814652780474e-07,1.28713440720985e-28,8.66262871593868e-30,-1.7918024758329104e-28,1.9633850833341234e-29,-4.7608215306193535e-07,-1.7635130038060178e-07,-7.252650834476241e-07,-1.797684522607695e-07,-7.726301925251186e-07,-1.3593814652760442e-07,-3.0106055763582786e-29,-3.568658720396775e-29,-2.2739766223848432e-29,-1.6603258665331888e-29,-4.741010514018535e-07,5.448590612379579e-08,-4.701818411901992e-07,1.6663000490694165e-08,-7.453102534678627e-07,2.7357217239441644e-08,-7.279540615613018e-07,3.4371113890668217e-09,-8.579330208754989e-07,-2.6008405171390205e-08,-8.357526525453042e-07,-2.5729239758795502e-08,-4.701818411901952e-07,-1.6663000490702818e-08,-4.741010514018457e-07,-5.448590612380402e-08,-7.279540615612966e-07,-3.4371113890835274e-09,-7.45310253467852e-07,-2.7357217239458564e-08,-8.357526525452993e-07,2.572923975877074e-08,-8.579330208754882e-07,2.6008405171364682e-08,0.0,-3.689838846534034e-21,0.0,-3.4057248282497575e-21,0.0,-2.389474304570763e-21,0.0,1.1849907150798524e-21,0.0,7.728930340233592e-21,0.0,-9.409753747161713e-21,0.0,-9.27355993916331e-21,0.0,-5.9005465375222355e-21,0.0,3.45820724462685e-21,0.0,2.0021147143626658e-20,0.0,-1.6042705688202718e-20,0.0,-1.541762360721681e-20,0.0,-8.827856096357078e-21,0.0,6.3984676397065826e-21,0.0,3.396409774956617e-20,-5.21059344905059e-07,1.0785416831218214e-07,-5.942832234061152e-07,1.1284412735292002e-07,-7.291198556954883e-07,1.5975182005082218e-07,-7.29419534669376e-07,1.4146009988497262e-07,-7.536819640264805e-07,1.388363757438669e-07,-7.212688685979149e-07,1.1197909398607218e-07,-5.94283223406162e-07,-1.1284412735287996e-07,-5.210593449051535e-07,-1.0785416831213956e-07,-7.294195346694393e-07,-1.4146009988486582e-07,-7.291198556956173e-07,-1.5975182005070884e-07,-7.212688685979762e-07,-1.1197909398589052e-07,-7.536819640266044e-07,-1.3883637574367513e-07,-2.8576578578864835e-07,1.301140611795876e-07,-6.228581335977658e-07,1.1144407150470386e-07,-8.014360278229913e-07,2.882237382538957e-08,-2.6588034168431343e-07,-2.345549761149889e-21,-6.148909793824232e-07,-5.981322827533954e-21,-7.85277352863385e-07,-1.0225807644204478e-20,3.1049565229499025e-27,-4.196740015775783e-28,-2.887230913108903e-28,-4.403551231441193e-28,4.812051521848172e-29,3.851635443793833e-28,-2.857657857886445e-07,-1.301140611795897e-07,-6.228581335977572e-07,-1.1144407150471579e-07,-8.01436027822981e-07,-2.8822373825410947e-08,-1.5635223141480454e-27,-9.802651538976083e-29,3.278505922098525e-27,-6.797558254135845e-28,4.1020767071492614e-27,5.932234007262009e-28,-4.410314084022777e-07,7.268022452197178e-21,-6.915240267186082e-07,2.9979998916103056e-20,-7.135613152026231e-07,5.968769864060137e-20,0.0,1.793662034335766e-43,0.0,1.793662034335766e-43,0.0,8.96831017167883e-43,0.0,-5.6519283938616335e-43,0.0,1.0761972206014595e-42,0.0,9.269247757898544e-43,-2.627131752301911e-07,1.3274214899302934e-07,-6.329945799890571e-07,1.9265484727832687e-07,-7.677771910976133e-07,1.6184720841148966e-07,1.5146129380243427e-28,-5.494056542378401e-29,1.0988346067719275e-50,3.891714187734575e-29,2.524354896707238e-28,1.6407579324035087e-28,-2.62713175230267e-07,-1.3274214899303003e-07,-6.329945799892127e-07,-1.9265484727825895e-07,-7.677771910977852e-07,-1.6184720841133102e-07,-1.5146129380243427e-28,6.686637000472881e-29,-1.5146129380243427e-28,5.412840523535707e-29,5.048709949123486e-29,-1.0255191767873153e-29,-4.801584184334589e-07,9.447106112382042e-08,-2.646155245804423e-07,4.165624981437424e-08,-4.7283844479037397e-07,3.112099903692373e-08,-2.656912190102633e-07,1.2633757629192664e-08,-4.6803908104000066e-07,8.091752496288301e-09,-7.484767456103177e-07,4.8063930505815753e-08,-6.342336387597463e-07,4.783223809223803e-08,-7.371756425756432e-07,1.2491484933343017e-08,-6.217198644652372e-07,1.3160740615455145e-08,-7.210619794360716e-07,-6.140998451021678e-11,-8.616398069136549e-07,-2.0279767975595878e-08,-8.174867338143947e-07,1.761743718501197e-09,-8.474965025861739e-07,-2.8360688201075687e-08,-7.969390370704656e-07,-1.0156396041453297e-08,-8.26809188564297e-07,-1.6608029814857525e-08,-4.6803908103999843e-07,-8.091752496296909e-09,-2.6569121901026077e-07,-1.2633757629197396e-08,-4.72838444790368e-07,-3.112099903693232e-08,-2.6461552458043755e-07,-4.165624981437841e-08,-4.801584184334501e-07,-9.447106112382803e-08,-7.210619794360687e-07,6.140998449395655e-11,-6.217198644652322e-07,-1.3160740615467643e-08,-7.37175642575635e-07,-1.2491484933360037e-08,-6.342336387597367e-07,-4.783223809225061e-08,-7.484767456103061e-07,-4.8063930505832595e-08,-8.268091885642944e-07,1.6608029814832955e-08,-7.969390370704601e-07,1.015639604143253e-08,-8.474965025861654e-07,2.836068820105083e-08,-8.174867338143834e-07,-1.7617437185225845e-09,-8.616398069136434e-07,2.02797679755703e-08,0.0,-3.435877556189529e-21,0.0,-1.3776771401529971e-21,0.0,-3.403994495899553e-21,0.0,-1.3185754926235634e-21,0.0,-2.7680254878980847e-21,0.0,-1.1103673324958778e-21,0.0,-9.900107724251277e-22,0.0,4.77602156134974e-22,0.0,3.959146546409973e-21,0.0,3.776411006916986e-21,0.0,1.2124392797414627e-20,0.0,-8.731709783191639e-21,0.0,-6.144329300702704e-21,0.0,-8.89968038381516e-21,0.0,-5.404653063609732e-21,0.0,-7.547524363424233e-21,0.0,-3.3206893791145496e-21,0.0,-1.6246546029348425e-21,0.0,1.9854969588545943e-21,0.0,1.1317236337409485e-20,0.0,1.3983874347413824e-20,0.0,3.098996503833694e-20,0.0,-1.407865292807831e-20,0.0,-1.1626000835692668e-20,0.0,-1.533412146384094e-20,0.0,-1.1018823571603408e-20,0.0,-1.2512374860235445e-20,0.0,-6.514267779823197e-21,0.0,-2.4719015385819347e-21,0.0,4.858859984935085e-21,0.0,1.881348220188166e-20,0.0,2.740874292245713e-20,0.0,5.211376231395407e-20,-4.864225626157067e-07,1.3296728230814142e-07,-3.076586015279749e-07,6.740802636874205e-08,-5.594534933091086e-07,1.1066583698276748e-07,-3.841186138586638e-07,7.559745482599735e-08,-6.098267681100678e-07,9.875238991849593e-08,-7.2970765755297e-07,1.669225383108583e-07,-6.573316628421653e-07,1.465581454371536e-07,-7.316181481946474e-07,1.5542337568784254e-07,-6.912676702186072e-07,1.3829023572925456e-07,-7.20589385417476e-07,9.666451163676767e-08,-7.723884127434406e-07,1.3857930563622999e-07,-7.569169347428396e-07,1.547516335925935e-07,-7.383025429990218e-07,1.3271074092312e-07,-7.350854918831709e-07,1.2994146610617741e-07,-7.0646090437235e-07,6.938656131041383e-08,-6.098267681100908e-07,-9.875238991845998e-08,-3.841186138586908e-07,-7.559745482597872e-08,-5.594534933091803e-07,-1.1066583698272561e-07,-3.0765860152803245e-07,-6.740802636872275e-08,-4.864225626158294e-07,-1.329672823081032e-07,-7.20589385417508e-07,-9.666451163666813e-08,-6.912676702186662e-07,-1.3829023572918171e-07,-7.316181481947439e-07,-1.5542337568773118e-07,-6.573316628422832e-07,-1.4655814543707692e-07,-7.297076575531353e-07,-1.6692253831074535e-07,-7.064609043723808e-07,-6.938656131024667e-08,-7.350854918832338e-07,-1.2994146610603196e-07,-7.383025429991161e-07,-1.3271074092293177e-07,-7.56916934742969e-07,-1.5475163359243975e-07,-7.723884127435972e-07,-1.3857930563603445e-07,-2.6225523866596743e-07,7.368618860781533e-08,-2.6483901297419715e-07,2.3043552983380804e-08,-2.6569368384400127e-07,6.351605004005378e-09,-6.372294401265312e-07,7.723333950374213e-08,-6.279151194946851e-07,2.6473214771574048e-08,-6.169026138715963e-07,5.559932643680484e-09,-8.206671947434617e-07,1.419786412636469e-08,-8.077626999789484e-07,-6.830966026358984e-09,-7.886512424652054e-07,-7.805683188152915e-09,-2.6569368384400005e-07,-6.351605004010108e-09,-2.648390129741935e-07,-2.3043552983385364e-08,-2.622552386659623e-07,-7.36861886078186e-08,-6.169026138715935e-07,-5.559932643692688e-09,-6.279151194946777e-07,-2.647321477158676e-08,-6.372294401265209e-07,-7.723333950375434e-08,-7.886512424652024e-07,7.805683188132495e-09,-8.077626999789395e-07,6.830966026337777e-09,-8.2066719474345e-07,-1.4197864126386033e-08,0.0,-1.528080794868089e-21,0.0,-1.5426894495622164e-21,0.0,-1.1495211961775125e-21,0.0,-4.441807280413718e-22,0.0,1.9784166326767865e-21,0.0,5.420802477152069e-21,0.0,-6.12858914756041e-21,0.0,-6.197208509921192e-21,0.0,-4.895012827081806e-21,0.0,-1.2104071985400557e-21,0.0,7.207223659623184e-21,0.0,2.1139789648778443e-20,0.0,-1.178112680978544e-20,0.0,-1.2361618534325795e-20,0.0,-9.332953007651742e-21,0.0,-2.4549106998298197e-21,0.0,1.5192320364423287e-20,0.0,4.128606459003346e-20,-2.6179012371741095e-07,8.492155525093568e-08,-3.431936650750607e-07,6.526689580555302e-08,-4.206987870183037e-07,7.275786337707596e-08,-6.39565352471141e-07,1.6214246375922057e-07,-6.76924119958337e-07,1.4588367240696607e-07,-6.94035042843604e-07,1.042901908413762e-07,-7.689004953903582e-07,1.574343097081281e-07,-7.476782438785353e-07,1.489103868358007e-07,-7.209785981316606e-07,8.394206942691553e-08,-4.2069878701831687e-07,-7.275786337705938e-08,-3.431936650751034e-07,-6.52668958055331e-08,-2.617901237174839e-07,-8.492155525092188e-08,-6.940350428436335e-07,-1.0429019084130907e-07,-6.769241199584262e-07,-1.458836724068901e-07,-6.39565352471292e-07,-1.6214246375914686e-07,-7.209785981316918e-07,-8.394206942678136e-08,-7.476782438786325e-07,-1.4891038683565012e-07,-7.68900495390525e-07,-1.574343097079712e-07],259,2) -arr2.setInfoOnComponents(['DRX','DRZ']) -f2z=MEDCouplingFieldDouble(ON_NODES) ; f2z.setName("SolutionDEPL") ; f2z.setArray(arr2) -f2z.setMesh(mz) -f2z.checkConsistencyLight() -ff2z=MEDFileField1TS() -ff2z.setFieldNoProfileSBT(f2z) -# -mm2=MEDFileUMesh() -mm2.setMeshAtLevel(0,mz) -mm2.setFamilyFieldArr(0,DataArrayInt([-1,-1,-1,-1,-1,-1,-1,-1,-1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-4,-4,-4,-4,-4,-4,-4,-4,-4,-5,-5,-5,-5,-5,-5,-5,-5,-5])) -mm2.setFamilyFieldArr(1,DataArrayInt([1,2,3,4,5,6,0,0,0,0,0,0,1,1,0,0,0,3,3,0,0,0,7,7,7,7,7,0,0,0,5,5,0,0,0,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,3,3,3,0,0,0,7,7,7,7,7,7,0,0,0,5,5,5,0,0,0,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])) -for famName,famId in [('FAMILLE_ZERO',0),('ba1_beam',-1),('ba2_beam',-2),('h1',6),('h1_h2_h3',4),('h2',5),('h3',7),('h3_h4_h5',2),('h4',3),('h5',1),('to1_beam',-4),('to2_beam',-5),('web_beam',-3)]: - mm2.setFamilyId(famName,famId) - pass -for grName,famsOnGrp in [('ba1',['ba1_beam']),('ba2',['ba2_beam']),('beam',['ba1_beam','ba2_beam','to1_beam','to2_beam','web_beam']),('h1',['h1','h1_h2_h3']),('h2',['h1_h2_h3','h2']),('h3',['h1_h2_h3','h3','h3_h4_h5']),('h4',['h3_h4_h5','h4']),('h5',['h3_h4_h5','h5']),('to1',['to1_beam']),('to2',['to2_beam']),('web',['web_beam'])]: - mm2.setFamiliesOnGroup(grName,famsOnGrp) - pass -# -mm2.write(fname,2) -ff0z.write(fname,0) -ff1z.write(fname,0) -ff2z.write(fname,0) -################### MED write is done -> Go to MEDReader +from medcoupling import * from paraview.simple import * +from MEDReaderHelper import WriteInTmpDir,RetriveBaseLine -myMedReader=MEDReader(FileName=fname) -keys=myMedReader.GetProperty("FieldsTreeInfo")[::2] -# list all the names of arrays that can be seen (including their spatial discretization) -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 - -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") +def GenerateCase(): + fname="testMEDReader0.med" + ######### + mz=MEDCoupling1SGTUMesh("mesh",NORM_QUAD9) + mz.setNodalConnectivity(DataArrayInt([0,6,37,12,76,112,113,82,205,12,37,38,13,113,114,115,83,206,13,38,9,1,115,116,79,84,207,6,7,39,37,77,117,118,112,208,37,39,40,38,118,119,120,114,209,38,40,10,9,120,121,80,116,210,7,8,41,39,78,122,123,117,211,39,41,42,40,123,124,125,119,212,40,42,11,10,125,126,81,121,213,1,9,43,17,79,127,128,88,214,17,43,44,18,128,129,130,89,215,18,44,14,2,130,131,85,90,216,9,10,45,43,80,132,133,127,217,43,45,46,44,133,134,135,129,218,44,46,15,14,135,136,86,131,219,10,11,47,45,81,137,138,132,220,45,47,48,46,138,139,140,134,221,46,48,16,15,140,141,87,136,222,1,9,49,22,79,142,143,94,223,22,49,50,23,143,144,145,95,224,23,50,51,24,145,146,147,96,225,24,51,52,25,147,148,149,97,226,25,52,53,26,149,150,151,98,227,26,53,19,3,151,152,91,99,228,9,10,54,49,80,153,154,142,229,49,54,55,50,154,155,156,144,230,50,55,56,51,156,157,158,146,231,51,56,57,52,158,159,160,148,232,52,57,58,53,160,161,162,150,233,53,58,20,19,162,163,92,152,234,10,11,59,54,81,164,165,153,235,54,59,60,55,165,166,167,155,236,55,60,61,56,167,168,169,157,237,56,61,62,57,169,170,171,159,238,57,62,63,58,171,172,173,161,239,58,63,21,20,173,174,93,163,240,4,27,64,30,100,175,176,103,241,30,64,65,31,176,177,178,104,242,31,65,19,3,178,179,91,105,243,27,28,66,64,101,180,181,175,244,64,66,67,65,181,182,183,177,245,65,67,20,19,183,184,92,179,246,28,29,68,66,102,185,186,180,247,66,68,69,67,186,187,188,182,248,67,69,21,20,188,189,93,184,249,3,19,70,35,91,190,191,109,250,35,70,71,36,191,192,193,110,251,36,71,32,5,193,194,106,111,252,19,20,72,70,92,195,196,190,253,70,72,73,71,196,197,198,192,254,71,73,33,32,198,199,107,194,255,20,21,74,72,93,200,201,195,256,72,74,75,73,201,202,203,197,257,73,75,34,33,203,204,108,199,258])) + coords=DataArrayDouble([-0.04,0.015,0.,0.,0.015,0.,0.04,0.015,0.,0.,0.105,0.,-0.04,0.105,0.,0.04,0.105,0.,-0.04,0.015,0.015,-0.04,0.015,0.03,-0.04,0.015,0.045,0.,0.015,0.015,0.,0.015,0.03,0.,0.015,0.045,-0.026666666666666665,0.015,0.,-0.013333333333333329,0.015,0.,0.04,0.015,0.015,0.04,0.015,0.03,0.04,0.015,0.045,0.013333333333333336,0.015,0.,0.026666666666666672,0.015,0.,0.,0.105,0.015,0.,0.105,0.03,0.,0.105,0.045,0.,0.03,0.,0.,0.045,0.,0.,0.06,0.,0.,0.075,0.,0.,0.09,0.,-0.04,0.105,0.015,-0.04,0.105,0.03,-0.04,0.105,0.045,-0.026666666666666665,0.105,0.,-0.013333333333333329,0.105,0.,0.04,0.105,0.015,0.04,0.105,0.03,0.04,0.105,0.045,0.013333333333333336,0.105,0.,0.026666666666666672,0.105,0.,-0.026666666666666665,0.015,0.015,-0.013333333333333326,0.015,0.015,-0.026666666666666665,0.015,0.03,-0.013333333333333326,0.015,0.03,-0.026666666666666665,0.015,0.045,-0.013333333333333329,0.015,0.045,0.013333333333333338,0.015,0.015,0.026666666666666675,0.015,0.015,0.013333333333333338,0.015,0.03,0.026666666666666675,0.015,0.03,0.013333333333333336,0.015,0.045,0.026666666666666672,0.015,0.045,0.,0.03,0.015,0.,0.045,0.015,0.,0.06,0.015,0.,0.07500000000000001,0.015,0.,0.09,0.015,0.,0.03,0.03,0.,0.045,0.03,0.,0.06,0.03,0.,0.075,0.03,0.,0.09,0.03,0.,0.03,0.045,0.,0.045,0.045,0.,0.06,0.045,0.,0.075,0.045,0.,0.09,0.045,-0.026666666666666665,0.105,0.015,-0.013333333333333326,0.105,0.015,-0.026666666666666665,0.105,0.03,-0.013333333333333326,0.105,0.03,-0.026666666666666665,0.105,0.045,-0.013333333333333329,0.105,0.045,0.013333333333333338,0.105,0.015,0.026666666666666675,0.105,0.015,0.013333333333333338,0.105,0.03,0.026666666666666675,0.105,0.03,0.013333333333333336,0.105,0.045,0.026666666666666672,0.105,0.045,-0.04,0.015,0.0075,-0.04,0.015,0.0225,-0.04,0.015,0.0375,0.,0.015,0.0075,0.,0.015,0.0225,0.,0.015,0.0375,-0.03333333333333333,0.015,0.,-0.02,0.015,0.,-0.0066666666666666645,0.015,0.,0.04,0.015,0.0075,0.04,0.015,0.0225,0.04,0.015,0.0375,0.006666666666666668,0.015,0.,0.02,0.015,0.,0.03333333333333334,0.015,0.,0.,0.105,0.0075,0.,0.105,0.0225,0.,0.105,0.0375,0.,0.0225,0.,0.,0.0375,0.,0.,0.0525,0.,0.,0.0675,0.,0.,0.0825,0.,0.,0.0975,0.,-0.04,0.105,0.0075,-0.04,0.105,0.0225,-0.04,0.105,0.0375,-0.03333333333333333,0.105,0.,-0.02,0.105,0.,-0.0066666666666666645,0.105,0.,0.04,0.105,0.0075,0.04,0.105,0.0225,0.04,0.105,0.0375,0.006666666666666668,0.105,0.,0.02,0.105,0.,0.03333333333333334,0.105,0.,-0.03333333333333333,0.015,0.015,-0.026666666666666665,0.015,0.0075,-0.02,0.015,0.015,-0.013333333333333327,0.015,0.0075,-0.006666666666666663,0.015,0.015,-0.03333333333333333,0.015,0.03,-0.026666666666666665,0.015,0.0225,-0.02,0.015,0.03,-0.013333333333333326,0.015,0.0225,-0.006666666666666663,0.015,0.03,-0.03333333333333333,0.015,0.045,-0.026666666666666665,0.015,0.0375,-0.02,0.015,0.045,-0.013333333333333327,0.015,0.0375,-0.0066666666666666645,0.015,0.045,0.006666666666666669,0.015,0.015,0.013333333333333336,0.015,0.0075,0.020000000000000007,0.015,0.015,0.026666666666666672,0.015,0.0075,0.03333333333333334,0.015,0.015,0.006666666666666669,0.015,0.03,0.013333333333333338,0.015,0.0225,0.02,0.015,0.03,0.026666666666666675,0.015,0.0225,0.03333333333333334,0.015,0.03,0.006666666666666668,0.015,0.045,0.013333333333333336,0.015,0.0375,0.02,0.015,0.045,0.026666666666666672,0.015,0.0375,0.03333333333333334,0.015,0.045,0.,0.0225,0.015,0.,0.03,0.0075,0.,0.0375,0.015,0.,0.045,0.0075,0.,0.0525,0.015,0.,0.06,0.0075,0.,0.0675,0.015,0.,0.07500000000000001,0.0075,0.,0.0825,0.015,0.,0.09,0.0075,0.,0.0975,0.015,0.,0.0225,0.03,0.,0.03,0.0225,0.,0.0375,0.03,0.,0.045,0.0225,0.,0.0525,0.03,0.,0.06,0.0225,0.,0.0675,0.03,0.,0.07500000000000001,0.0225,0.,0.08249999999999999,0.03,0.,0.09,0.0225,0.,0.0975,0.03,0.,0.0225,0.045,0.,0.03,0.0375,0.,0.0375,0.045,0.,0.045,0.0375,0.,0.0525,0.045,0.,0.06,0.0375,0.,0.0675,0.045,0.,0.075,0.0375,0.,0.08249999999999999,0.045,0.,0.09,0.0375,0.,0.0975,0.045,-0.03333333333333333,0.105,0.015,-0.026666666666666665,0.105,0.0075,-0.02,0.105,0.015,-0.013333333333333327,0.105,0.0075,-0.006666666666666663,0.105,0.015,-0.03333333333333333,0.105,0.03,-0.026666666666666665,0.105,0.0225,-0.02,0.105,0.03,-0.013333333333333326,0.105,0.0225,-0.006666666666666663,0.105,0.03,-0.03333333333333333,0.105,0.045,-0.026666666666666665,0.105,0.0375,-0.02,0.105,0.045,-0.013333333333333327,0.105,0.0375,-0.0066666666666666645,0.105,0.045,0.006666666666666669,0.105,0.015,0.013333333333333336,0.105,0.0075,0.020000000000000007,0.105,0.015,0.026666666666666672,0.105,0.0075,0.03333333333333334,0.105,0.015,0.006666666666666669,0.105,0.03,0.013333333333333338,0.105,0.0225,0.020000000000000007,0.105,0.03,0.026666666666666675,0.105,0.0225,0.03333333333333334,0.105,0.03,0.006666666666666668,0.105,0.045,0.013333333333333336,0.105,0.0375,0.02,0.105,0.045,0.026666666666666672,0.105,0.0375,0.03333333333333334,0.105,0.045,-0.03333333333333333,0.015,0.0075,-0.02,0.015,0.0075,-0.006666666666666664,0.015,0.0075,-0.03333333333333333,0.015,0.0225,-0.02,0.015,0.0225,-0.006666666666666663,0.015,0.0225,-0.03333333333333333,0.015,0.0375,-0.02,0.015,0.0375,-0.006666666666666662,0.015,0.0375,0.006666666666666668,0.015,0.0075,0.02,0.015,0.0075,0.03333333333333334,0.015,0.0075,0.006666666666666669,0.015,0.0225,0.020000000000000007,0.015,0.0225,0.03333333333333334,0.015,0.0225,0.006666666666666668,0.015,0.0375,0.02,0.015,0.0375,0.03333333333333334,0.015,0.0375,0.,0.0225,0.0075,0.,0.0375,0.0075,0.,0.0525,0.0075,0.,0.0675,0.0075,0.,0.0825,0.0075,0.,0.0975,0.0075,0.,0.0225,0.0225,0.,0.0375,0.0225,0.,0.0525,0.0225,0.,0.0675,0.0225,0.,0.0825,0.0225,0.,0.0975,0.0225,0.,0.0225,0.0375,0.,0.0375,0.0375,0.,0.0525,0.0375,0.,0.0675,0.0375,0.,0.08249999999999999,0.0375,0.,0.0975,0.0375,-0.03333333333333333,0.105,0.0075,-0.02,0.105,0.0075,-0.006666666666666664,0.105,0.0075,-0.03333333333333333,0.105,0.0225,-0.02,0.105,0.0225,-0.006666666666666663,0.105,0.0225,-0.03333333333333333,0.105,0.0375,-0.02,0.105,0.0375,-0.006666666666666662,0.105,0.0375,0.006666666666666668,0.105,0.0075,0.02,0.105,0.0075,0.03333333333333334,0.105,0.0075,0.006666666666666669,0.105,0.0225,0.020000000000000007,0.105,0.0225,0.03333333333333334,0.105,0.0225,0.006666666666666668,0.105,0.0375,0.02,0.105,0.0375,0.03333333333333334,0.105,0.0375],259,3) + coords.setInfoOnComponents(['X [INCONNUE]','Y [INCONNUE]','Z [INCONNUE]']) + mz.setCoords(coords) + mz=mz.buildUnstructured() # - 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 + arr0=DataArrayDouble() + vals0=9*[-3593.,85220.,-15343.,-438.,11985.,-15343.,2716.,-61248.,-15343.,5488.,101072.,-16250.,549.,13186.,-16250.,-4389.,-74699.,-16250.,9988.,101646.,-17156.,1537.,14386.,-17156.,-6913.,-72874.,-17156.,22178.,120238.,-19521.,2342.,14222.,-19521.,-17493.,-91793.,-19521.,37737.,139840.,-21887.,3147.,14059.,-21887.,-31443.,-111722.,-21887.,34350.,140668.,-18690.,3714.,16214.,-18690.,-26922.,-108238.,-18690.,34563.,153494.,-15493.,4281.,18370.,-15493.,-26000.,-116753.,-15493.,2147.,115356.,-15418.,1921.,15178.,-15418.,1695.,-84999.,-15418.,12408.,118616.,-17470.,2131.,14700.,-17470.,-8144.,-89215.,-17470.,15624.,100983.,-16718.,2286.,15441.,-16718.,-11050.,-70101.,-16718.,19381.,102680.,-17191.,2505.,16813.,-17191.,-14370.,-69054.,-17191.,22911.,103615.,-17665.,2725.,18184.,-17665.,-17461.,-67245.,-17665.,32377.,125140.,-20005.,4011.,17741.,-20005.,-24353.,-89657.,-20005.,43183.,147067.,-22345.,5298.,17297.,-22345.,-32586.,-112472.,-22345.,41570.,144664.,-22105.,4896.,15874.,-22105.,-31778.,-112915.,-22105.,40070.,142637.,-21866.,4493.,14451.,-21866.,-31083.,-113734.,-21866.,25367.,121066.,-19292.,3390.,14946.,-19292.,-18587.,-91173.,-19292.,28901.,123199.,-19648.,3701.,16343.,-19648.,-21499.,-90512.,-19648.,23716.,103481.,-17470.,2234.,18509.,-17470.,-19247.,-66463.,-17470.,22561.,104808.,-17142.,1238.,20732.,-17142.,-20084.,-63343.,-17142.,21499.,106443.,-16813.,242.,22956.,-16813.,-21014.,-60531.,-16813.,32906.,133441.,-20775.,3873.,26633.,-20775.,-25158.,-80173.,-20775.,45801.,160885.,-24737.,7505.,30311.,-24737.,-30791.,-100262.,-24737.,44184.,154705.,-23601.,5922.,24329.,-23601.,-32340.,-106046.,-23601.,42566.,148521.,-22465.,4338.,18347.,-22465.,-33888.,-111825.,-22465.,32545.,125822.,-19968.,3286.,18428.,-19968.,-25972.,-88965.,-19968.,32703.,129556.,-20371.,3580.,22531.,-20371.,-25542.,-84493.,-20371.,-580.,50781.,-14878.,-188.,10419.,-14878.,203.,-29941.,-14878.,974.,53486.,-13087.,-197.,11696.,-13087.,-1370.,-30094.,-13087.,2154.,54941.,-11297.,-206.,12972.,-11297.,-2567.,-28996.,-11297.,4921.,72039.,-13221.,709.,13770.,-13221.,-3503.,-44499.,-13221.,6472.,88772.,-15144.,1624.,14567.,-15144.,-3223.,-59637.,-15144.,4104.,85353.,-15580.,600.,13047.,-15580.,-2903.,-59258.,-15580.,1258.,80341.,-16016.,-423.,11526.,-16016.,-2105.,-57288.,-16016.,-822.,65212.,-15447.,-306.,10973.,-15447.,210.,-43266.,-15447.,2262.,69336.,-14334.,201.,12371.,-14334.,-1859.,-44593.,-14334.,4047.,55415.,-11562.,137.,13264.,-11562.,-3772.,-28887.,-11562.,6455.,56737.,-11164.,80.,14219.,-11164.,-6294.,-28298.,-11164.,8701.,57516.,-10766.,23.,15175.,-10766.,-8653.,-27166.,-10766.,12843.,74210.,-13196.,662.,16118.,-13196.,-11519.,-41972.,-13196.,17837.,91160.,-15627.,1300.,17062.,-15627.,-15237.,-57034.,-15627.,14573.,90279.,-15674.,1166.,15841.,-15674.,-12240.,-58596.,-15674.,11497.,90026.,-15722.,1033.,14619.,-15722.,-9431.,-60786.,-15722.,7014.,72493.,-13642.,585.,13941.,-13642.,-5844.,-44609.,-13642.,9922.,73330.,-13419.,623.,15030.,-13419.,-8675.,-43270.,-13419.,9608.,58062.,-10666.,-408.,15882.,-10666.,-10425.,-26297.,-10666.,10622.,58358.,-9978.,-497.,16431.,-9978.,-11617.,-25496.,-9978.,11722.,58941.,-9290.,-587.,16979.,-9290.,-12896.,-24981.,-9290.,14386.,76411.,-12130.,-417.,19190.,-12130.,-15221.,-38029.,-12130.,18009.,94168.,-14969.,-248.,21401.,-14969.,-18505.,-51365.,-14969.,19049.,93091.,-15325.,999.,19998.,-15325.,-17050.,-53095.,-15325.,20242.,92527.,-15681.,2246.,18594.,-15681.,-15748.,-55338.,-15681.,14435.,75147.,-13174.,919.,17238.,-13174.,-12597.,-40670.,-13174.,14351.,75579.,-12652.,250.,18214.,-12652.,-13849.,-39150.,-12652.0] + arr0.setValues(vals0,1458,3) + arr0.setInfoOnComponents(['SIXX','SIYY','SIYZ']) + f0z=MEDCouplingFieldDouble(ON_GAUSS_PT) + f0z.setMesh(mz) + f0z.setArray(arr0) + f0z.setGaussLocalizationOnType(NORM_QUAD9,[-1,-1,1,-1,1,1,-1,1,0,-1,1,0,0,1,-1,0,0,0],[-0.774597,-0.774597,0.774597,-0.774597,0.774597,0.774597,-0.774597,0.774597,0,-0.774597,0.774597,0,0,0.774597,-0.774597,0,0,0,-0.774597,-0.774597,0.774597,-0.774597,0.774597,0.774597,-0.774597,0.774597,0,-0.774597,0.774597,0,0,0.774597,-0.774597,0,0,0,-0.774597,-0.774597,0.774597,-0.774597,0.774597,0.774597,-0.774597,0.774597,0,-0.774597,0.774597,0,0,0.774597,-0.774597,0,0,0],[0.308642,0.308642,0.308642,0.308642,0.493827,0.493827,0.493827,0.493827,0.790123,0.308642,0.308642,0.308642,0.308642,0.493827,0.493827,0.493827,0.493827,0.790123,0.308642,0.308642,0.308642,0.308642,0.493827,0.493827,0.493827,0.493827,0.790123]) + f0z.setName("SolutionSIEF_ELGA") + f0z.checkConsistencyLight() + ff0z=MEDFileField1TS() + ff0z.setFieldNoProfileSBT(f0z) # - 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() + arr1=DataArrayDouble([158663.,171562.,32597.,37341.,118998.,128979.,88846.,94935.,28786.,32250.,67038.,71287.,102742.,108939.,32907.,37716.,0.,0.,138922.,155768.,41391.,47731.,114491.,128395.,94101.,100197.,31445.,35939.,67322.,71913.,94031.,103701.,34833.,39475.,0.,0.,142412.,160086.,42700.,49041.,113826.,128551.,92705.,102386.,34032.,38580.,61698.,69417.,96177.,104283.,38223.,40570.,0.,0.,87935.,89674.,30482.,34419.,66325.,69150.,53964.,55380.,28306.,32157.,37909.,40395.,53662.,55355.,22264.,24611.,0.,0.,94013.,100457.,31768.,36134.,68065.,73681.,53358.,55305.,23341.,26188.,32996.,35203.,52496.,56792.,23849.,26556.,0.,0.,92797.,102692.,33656.,38268.,61244.,68735.,52594.,56740.,24539.,27146.,29157.,33011.,52853.,57683.,25671.,28315.,0.,0.,53581.,55745.,27972.,31820.,37174.,39935.,29236.,31416.,22475.,25354.,20531.,23672.,25557.,26298.,15741.,17492.,0.,0.,53385.,55725.,23224.,25998.,32556.,35093.,25809.,26619.,16518.,18338.,18447.,21219.,23343.,26173.,16948.,19353.,0.,0.,52384.,56725.,24293.,26951.,29491.,33373.,23510.,26382.,17117.,19543.,19649.,22252.,26670.,30680.,19554.,22512.,0.,0.,158781.,178651.,54413.,62227.,103151.,116693.,96177.,104283.,38223.,40570.,56254.,64331.,92705.,102386.,34032.,38580.,0.,0.,142873.,161033.,43285.,49854.,113088.,127440.,94031.,103701.,34833.,39475.,61888.,69552.,94101.,100197.,31445.,35939.,0.,0.,132908.,149284.,42933.,49391.,109280.,123481.,102742.,108939.,32907.,37716.,75662.,80547.,88846.,94935.,28786.,32250.,0.,0.,96505.,105010.,37990.,40710.,56669.,64741.,52853.,57683.,25671.,28315.,26824.,30727.,52594.,56740.,24539.,27146.,0.,0.,92360.,101577.,33582.,37900.,61559.,69237.,52496.,56792.,23849.,26556.,29094.,32746.,53358.,55305.,23341.,26188.,0.,0.,95615.,101326.,31440.,36083.,69356.,73116.,53662.,55355.,22264.,24611.,31957.,34376.,53964.,55380.,28306.,32157.,0.,0.,53029.,58077.,25636.,28363.,27182.,31122.,26670.,30680.,19554.,22512.,20758.,22139.,23510.,26382.,17117.,19543.,0.,0.,52348.,56723.,23922.,26648.,29286.,32993.,23343.,26173.,16948.,19353.,19615.,22178.,25809.,26619.,16518.,18338.,0.,0.,53623.,55229.,22321.,24800.,32700.,34971.,25557.,26298.,15741.,17492.,18986.,21836.,29236.,31416.,22475.,25354.,0.,0.,64897.,69997.,64897.,69997.,64897.,69997.,81086.,90448.,81086.,90448.,81086.,90448.,85289.,98323.,85289.,98323.,0.,0.,71712.,82585.,71712.,82585.,71712.,82585.,83868.,96651.,83868.,96651.,83868.,96651.,86266.,99505.,86266.,99505.,0.,0.,77671.,89574.,77671.,89574.,77671.,89574.,86057.,99277.,86057.,99277.,86057.,99277.,86664.,99373.,86664.,99373.,0.,0.,80105.,91799.,80105.,91799.,80105.,91799.,86589.,99313.,86589.,99313.,86589.,99313.,85997.,97609.,85997.,97609.,0.,0.,79826.,90350.,79826.,90350.,79826.,90350.,86438.,98180.,86438.,98180.,86438.,98180.,85995.,95152.,85995.,95152.,0.,0.,75137.,82756.,75137.,82756.,75137.,82756.,88617.,98610.,88617.,98610.,88617.,98610.,79961.,83623.,79961.,83623.,0.,0.,79241.,88756.,79241.,88756.,79241.,88756.,84552.,97374.,84552.,97374.,84552.,97374.,93024.,107413.,93024.,107413.,0.,0.,85301.,98315.,85301.,98315.,85301.,98315.,92453.,106752.,92453.,106752.,92453.,106752.,93783.,108035.,93783.,108035.,0.,0.,86813.,100152.,86813.,100152.,86813.,100152.,93530.,107737.,93530.,107737.,93530.,107737.,92512.,106099.,92512.,106099.,0.,0.,87195.,100044.,87195.,100044.,87195.,100044.,92527.,106109.,92527.,106109.,92527.,106109.,90156.,102760.,90156.,102760.,0.,0.,87342.,99233.,87342.,99233.,87342.,99233.,90384.,103001.,90384.,103001.,90384.,103001.,85458.,96494.,85458.,96494.,0.,0.,90428.,100728.,90428.,100728.,90428.,100728.,85454.,96396.,85454.,96396.,85454.,96396.,70692.,78323.,70692.,78323.,0.,0.,84617.,97440.,84617.,97440.,84617.,97440.,83973.,96607.,83973.,96607.,83973.,96607.,92886.,106795.,92886.,106795.,0.,0.,92294.,106564.,92294.,106564.,92294.,106564.,92515.,106364.,92515.,106364.,92515.,106364.,94158.,108033.,94158.,108033.,0.,0.,93639.,107861.,93639.,107861.,93639.,107861.,93950.,107796.,93950.,107796.,93950.,107796.,91874.,105168.,91874.,105168.,0.,0.,92701.,106313.,92701.,106313.,92701.,106313.,91869.,105167.,91869.,105167.,91869.,105167.,87044.,99369.,87044.,99369.,0.,0.,90450.,103104.,90450.,103104.,90450.,103104.,87236.,99605.,87236.,99605.,87236.,99605.,78375.,89211.,78375.,89211.,0.,0.,84833.,95787.,84833.,95787.,84833.,95787.,78665.,89521.,78665.,89521.,78665.,89521.,63448.,71985.,63448.,71985.,0.,0.,9194.,10306.,41521.,44441.,79431.,85178.,8946.,9792.,22335.,23886.,51736.,54740.,7726.,8300.,30477.,32533.,0.,0.,25028.,27404.,28235.,31471.,75379.,84132.,7236.,8309.,29539.,31536.,54052.,58395.,22577.,23370.,39152.,41429.,0.,0.,37235.,42691.,35353.,38183.,100490.,111738.,23433.,25843.,36759.,39109.,53411.,59694.,57437.,65025.,61345.,68878.,0.,0.,6377.,6683.,22457.,23448.,49503.,50751.,10380.,10835.,19266.,19610.,28417.,28750.,20732.,22044.,26521.,27276.,0.,0.,10131.,11681.,28482.,29670.,52601.,56753.,20722.,21728.,25680.,25959.,30780.,31657.,32161.,33290.,33096.,34633.,0.,0.,21380.,22651.,37121.,39923.,54598.,60751.,34744.,36379.,35111.,37417.,35939.,39080.,46708.,51426.,44384.,48624.,0.,0.,10952.,11418.,19643.,20167.,28488.,29118.,20182.,20242.,18359.,18431.,16718.,16900.,24621.,25169.,20737.,21234.,0.,0.,20251.,21309.,25725.,26026.,31355.,32256.,24539.,25102.,20991.,21593.,17889.,18639.,31588.,32417.,27170.,29235.,0.,0.,33431.,35174.,34427.,36736.,35916.,38926.,31741.,32451.,27148.,29040.,23993.,27214.,38993.,40689.,36596.,40772.,0.,0.,41907.,48128.,77947.,87844.,152033.,169876.,57437.,65025.,61345.,68878.,74154.,85533.,23433.,25843.,36759.,39109.,0.,0.,33932.,38310.,36200.,40713.,99297.,111743.,22577.,23370.,39152.,41429.,57432.,62292.,7236.,8309.,29539.,31536.,0.,0.,22968.,26297.,27645.,30092.,72463.,80413.,7726.,8300.,30477.,32533.,57469.,61055.,8946.,9792.,22335.,23886.,0.,0.,48710.,53918.,59260.,65402.,77350.,87781.,46708.,51426.,44384.,48624.,50354.,58143.,34744.,36379.,35111.,37417.,0.,0.,20908.,22670.,38133.,39669.,56332.,59453.,32161.,33290.,33096.,34633.,34367.,36793.,20722.,21728.,25680.,25959.,0.,0.,7404.,8010.,30073.,32272.,55210.,58955.,20732.,22044.,26521.,27276.,32434.,32943.,10380.,10835.,19266.,19610.,0.,0.,45425.,49667.,44460.,48383.,51014.,58851.,38993.,40689.,36596.,40772.,38865.,44837.,31741.,32451.,27148.,29040.,0.,0.,31595.,32602.,33322.,34837.,35379.,37698.,31588.,32417.,27170.,29235.,24035.,27311.,24539.,25102.,20991.,21593.,0.,0.,19475.,20577.,25384.,25965.,31447.,32050.,24621.,25169.,20737.,21234.,17759.,18414.,20182.,20242.,18359.,18431.,0.,0.],486,2) + arr1.setInfoOnComponents(['VMIS','TRESCA']) + f1z=MEDCouplingFieldDouble(ON_GAUSS_NE) ; f1z.setName("SolutionSIEQ_ELNO") + f1z.setArray(arr1) + f1z.setMesh(mz) + f1z.checkConsistencyLight() + ff1z=MEDFileField1TS() + ff1z.setFieldNoProfileSBT(f1z) + # + arr2=DataArrayDouble([4.938269266683534e-28,-6.232001151245993e-28,1.0602290566170399e-27,4.029857051193646e-29,-1.1103217240985741e-27,-1.5536615528327828e-27,1.5241233363338648e-28,-3.015674201798923e-30,-1.02980203874559e-30,2.72351596604712e-29,-1.1888246600739933e-29,-2.69937196846485e-29,-4.7437993223547586e-07,1.3496193329105202e-07,-7.295395086913946e-07,7.054959528904149e-08,-8.433644218153947e-07,-1.3140517414252605e-08,-4.6699282590396373e-07,-4.307881601165781e-21,-7.181557182928824e-07,-8.028640214851634e-21,-8.231757491716489e-07,-1.2311604671716488e-20,6.500213859021137e-28,-5.36425415550288e-29,2.082592789783471e-28,1.3252863207712998e-28,-4.743799322354692e-07,-1.3496193329105909e-07,-7.295395086913853e-07,-7.054959528905818e-08,-8.433644218153849e-07,1.3140517414226876e-08,6.058451752097371e-28,5.632466863278024e-28,2.208810534618833e-28,2.2876966251409342e-28,-6.120655339318954e-07,1.623023866978208e-20,-7.136250920460284e-07,4.359903572644498e-20,-6.995066975751433e-07,7.373674095935513e-20,0.0,1.4598897976731362e-43,0.0,5.997557427310217e-43,0.0,1.156071233067974e-43,0.0,6.726232628759122e-44,0.0,1.0089348943138683e-43,-4.76082153061813e-07,1.7635130038063272e-07,-7.252650834474581e-07,1.797684522608815e-07,-7.726301925249592e-07,1.3593814652780474e-07,1.28713440720985e-28,8.66262871593868e-30,-1.7918024758329104e-28,1.9633850833341234e-29,-4.7608215306193535e-07,-1.7635130038060178e-07,-7.252650834476241e-07,-1.797684522607695e-07,-7.726301925251186e-07,-1.3593814652760442e-07,-3.0106055763582786e-29,-3.568658720396775e-29,-2.2739766223848432e-29,-1.6603258665331888e-29,-4.741010514018535e-07,5.448590612379579e-08,-4.701818411901992e-07,1.6663000490694165e-08,-7.453102534678627e-07,2.7357217239441644e-08,-7.279540615613018e-07,3.4371113890668217e-09,-8.579330208754989e-07,-2.6008405171390205e-08,-8.357526525453042e-07,-2.5729239758795502e-08,-4.701818411901952e-07,-1.6663000490702818e-08,-4.741010514018457e-07,-5.448590612380402e-08,-7.279540615612966e-07,-3.4371113890835274e-09,-7.45310253467852e-07,-2.7357217239458564e-08,-8.357526525452993e-07,2.572923975877074e-08,-8.579330208754882e-07,2.6008405171364682e-08,0.0,-3.689838846534034e-21,0.0,-3.4057248282497575e-21,0.0,-2.389474304570763e-21,0.0,1.1849907150798524e-21,0.0,7.728930340233592e-21,0.0,-9.409753747161713e-21,0.0,-9.27355993916331e-21,0.0,-5.9005465375222355e-21,0.0,3.45820724462685e-21,0.0,2.0021147143626658e-20,0.0,-1.6042705688202718e-20,0.0,-1.541762360721681e-20,0.0,-8.827856096357078e-21,0.0,6.3984676397065826e-21,0.0,3.396409774956617e-20,-5.21059344905059e-07,1.0785416831218214e-07,-5.942832234061152e-07,1.1284412735292002e-07,-7.291198556954883e-07,1.5975182005082218e-07,-7.29419534669376e-07,1.4146009988497262e-07,-7.536819640264805e-07,1.388363757438669e-07,-7.212688685979149e-07,1.1197909398607218e-07,-5.94283223406162e-07,-1.1284412735287996e-07,-5.210593449051535e-07,-1.0785416831213956e-07,-7.294195346694393e-07,-1.4146009988486582e-07,-7.291198556956173e-07,-1.5975182005070884e-07,-7.212688685979762e-07,-1.1197909398589052e-07,-7.536819640266044e-07,-1.3883637574367513e-07,-2.8576578578864835e-07,1.301140611795876e-07,-6.228581335977658e-07,1.1144407150470386e-07,-8.014360278229913e-07,2.882237382538957e-08,-2.6588034168431343e-07,-2.345549761149889e-21,-6.148909793824232e-07,-5.981322827533954e-21,-7.85277352863385e-07,-1.0225807644204478e-20,3.1049565229499025e-27,-4.196740015775783e-28,-2.887230913108903e-28,-4.403551231441193e-28,4.812051521848172e-29,3.851635443793833e-28,-2.857657857886445e-07,-1.301140611795897e-07,-6.228581335977572e-07,-1.1144407150471579e-07,-8.01436027822981e-07,-2.8822373825410947e-08,-1.5635223141480454e-27,-9.802651538976083e-29,3.278505922098525e-27,-6.797558254135845e-28,4.1020767071492614e-27,5.932234007262009e-28,-4.410314084022777e-07,7.268022452197178e-21,-6.915240267186082e-07,2.9979998916103056e-20,-7.135613152026231e-07,5.968769864060137e-20,0.0,1.793662034335766e-43,0.0,1.793662034335766e-43,0.0,8.96831017167883e-43,0.0,-5.6519283938616335e-43,0.0,1.0761972206014595e-42,0.0,9.269247757898544e-43,-2.627131752301911e-07,1.3274214899302934e-07,-6.329945799890571e-07,1.9265484727832687e-07,-7.677771910976133e-07,1.6184720841148966e-07,1.5146129380243427e-28,-5.494056542378401e-29,1.0988346067719275e-50,3.891714187734575e-29,2.524354896707238e-28,1.6407579324035087e-28,-2.62713175230267e-07,-1.3274214899303003e-07,-6.329945799892127e-07,-1.9265484727825895e-07,-7.677771910977852e-07,-1.6184720841133102e-07,-1.5146129380243427e-28,6.686637000472881e-29,-1.5146129380243427e-28,5.412840523535707e-29,5.048709949123486e-29,-1.0255191767873153e-29,-4.801584184334589e-07,9.447106112382042e-08,-2.646155245804423e-07,4.165624981437424e-08,-4.7283844479037397e-07,3.112099903692373e-08,-2.656912190102633e-07,1.2633757629192664e-08,-4.6803908104000066e-07,8.091752496288301e-09,-7.484767456103177e-07,4.8063930505815753e-08,-6.342336387597463e-07,4.783223809223803e-08,-7.371756425756432e-07,1.2491484933343017e-08,-6.217198644652372e-07,1.3160740615455145e-08,-7.210619794360716e-07,-6.140998451021678e-11,-8.616398069136549e-07,-2.0279767975595878e-08,-8.174867338143947e-07,1.761743718501197e-09,-8.474965025861739e-07,-2.8360688201075687e-08,-7.969390370704656e-07,-1.0156396041453297e-08,-8.26809188564297e-07,-1.6608029814857525e-08,-4.6803908103999843e-07,-8.091752496296909e-09,-2.6569121901026077e-07,-1.2633757629197396e-08,-4.72838444790368e-07,-3.112099903693232e-08,-2.6461552458043755e-07,-4.165624981437841e-08,-4.801584184334501e-07,-9.447106112382803e-08,-7.210619794360687e-07,6.140998449395655e-11,-6.217198644652322e-07,-1.3160740615467643e-08,-7.37175642575635e-07,-1.2491484933360037e-08,-6.342336387597367e-07,-4.783223809225061e-08,-7.484767456103061e-07,-4.8063930505832595e-08,-8.268091885642944e-07,1.6608029814832955e-08,-7.969390370704601e-07,1.015639604143253e-08,-8.474965025861654e-07,2.836068820105083e-08,-8.174867338143834e-07,-1.7617437185225845e-09,-8.616398069136434e-07,2.02797679755703e-08,0.0,-3.435877556189529e-21,0.0,-1.3776771401529971e-21,0.0,-3.403994495899553e-21,0.0,-1.3185754926235634e-21,0.0,-2.7680254878980847e-21,0.0,-1.1103673324958778e-21,0.0,-9.900107724251277e-22,0.0,4.77602156134974e-22,0.0,3.959146546409973e-21,0.0,3.776411006916986e-21,0.0,1.2124392797414627e-20,0.0,-8.731709783191639e-21,0.0,-6.144329300702704e-21,0.0,-8.89968038381516e-21,0.0,-5.404653063609732e-21,0.0,-7.547524363424233e-21,0.0,-3.3206893791145496e-21,0.0,-1.6246546029348425e-21,0.0,1.9854969588545943e-21,0.0,1.1317236337409485e-20,0.0,1.3983874347413824e-20,0.0,3.098996503833694e-20,0.0,-1.407865292807831e-20,0.0,-1.1626000835692668e-20,0.0,-1.533412146384094e-20,0.0,-1.1018823571603408e-20,0.0,-1.2512374860235445e-20,0.0,-6.514267779823197e-21,0.0,-2.4719015385819347e-21,0.0,4.858859984935085e-21,0.0,1.881348220188166e-20,0.0,2.740874292245713e-20,0.0,5.211376231395407e-20,-4.864225626157067e-07,1.3296728230814142e-07,-3.076586015279749e-07,6.740802636874205e-08,-5.594534933091086e-07,1.1066583698276748e-07,-3.841186138586638e-07,7.559745482599735e-08,-6.098267681100678e-07,9.875238991849593e-08,-7.2970765755297e-07,1.669225383108583e-07,-6.573316628421653e-07,1.465581454371536e-07,-7.316181481946474e-07,1.5542337568784254e-07,-6.912676702186072e-07,1.3829023572925456e-07,-7.20589385417476e-07,9.666451163676767e-08,-7.723884127434406e-07,1.3857930563622999e-07,-7.569169347428396e-07,1.547516335925935e-07,-7.383025429990218e-07,1.3271074092312e-07,-7.350854918831709e-07,1.2994146610617741e-07,-7.0646090437235e-07,6.938656131041383e-08,-6.098267681100908e-07,-9.875238991845998e-08,-3.841186138586908e-07,-7.559745482597872e-08,-5.594534933091803e-07,-1.1066583698272561e-07,-3.0765860152803245e-07,-6.740802636872275e-08,-4.864225626158294e-07,-1.329672823081032e-07,-7.20589385417508e-07,-9.666451163666813e-08,-6.912676702186662e-07,-1.3829023572918171e-07,-7.316181481947439e-07,-1.5542337568773118e-07,-6.573316628422832e-07,-1.4655814543707692e-07,-7.297076575531353e-07,-1.6692253831074535e-07,-7.064609043723808e-07,-6.938656131024667e-08,-7.350854918832338e-07,-1.2994146610603196e-07,-7.383025429991161e-07,-1.3271074092293177e-07,-7.56916934742969e-07,-1.5475163359243975e-07,-7.723884127435972e-07,-1.3857930563603445e-07,-2.6225523866596743e-07,7.368618860781533e-08,-2.6483901297419715e-07,2.3043552983380804e-08,-2.6569368384400127e-07,6.351605004005378e-09,-6.372294401265312e-07,7.723333950374213e-08,-6.279151194946851e-07,2.6473214771574048e-08,-6.169026138715963e-07,5.559932643680484e-09,-8.206671947434617e-07,1.419786412636469e-08,-8.077626999789484e-07,-6.830966026358984e-09,-7.886512424652054e-07,-7.805683188152915e-09,-2.6569368384400005e-07,-6.351605004010108e-09,-2.648390129741935e-07,-2.3043552983385364e-08,-2.622552386659623e-07,-7.36861886078186e-08,-6.169026138715935e-07,-5.559932643692688e-09,-6.279151194946777e-07,-2.647321477158676e-08,-6.372294401265209e-07,-7.723333950375434e-08,-7.886512424652024e-07,7.805683188132495e-09,-8.077626999789395e-07,6.830966026337777e-09,-8.2066719474345e-07,-1.4197864126386033e-08,0.0,-1.528080794868089e-21,0.0,-1.5426894495622164e-21,0.0,-1.1495211961775125e-21,0.0,-4.441807280413718e-22,0.0,1.9784166326767865e-21,0.0,5.420802477152069e-21,0.0,-6.12858914756041e-21,0.0,-6.197208509921192e-21,0.0,-4.895012827081806e-21,0.0,-1.2104071985400557e-21,0.0,7.207223659623184e-21,0.0,2.1139789648778443e-20,0.0,-1.178112680978544e-20,0.0,-1.2361618534325795e-20,0.0,-9.332953007651742e-21,0.0,-2.4549106998298197e-21,0.0,1.5192320364423287e-20,0.0,4.128606459003346e-20,-2.6179012371741095e-07,8.492155525093568e-08,-3.431936650750607e-07,6.526689580555302e-08,-4.206987870183037e-07,7.275786337707596e-08,-6.39565352471141e-07,1.6214246375922057e-07,-6.76924119958337e-07,1.4588367240696607e-07,-6.94035042843604e-07,1.042901908413762e-07,-7.689004953903582e-07,1.574343097081281e-07,-7.476782438785353e-07,1.489103868358007e-07,-7.209785981316606e-07,8.394206942691553e-08,-4.2069878701831687e-07,-7.275786337705938e-08,-3.431936650751034e-07,-6.52668958055331e-08,-2.617901237174839e-07,-8.492155525092188e-08,-6.940350428436335e-07,-1.0429019084130907e-07,-6.769241199584262e-07,-1.458836724068901e-07,-6.39565352471292e-07,-1.6214246375914686e-07,-7.209785981316918e-07,-8.394206942678136e-08,-7.476782438786325e-07,-1.4891038683565012e-07,-7.68900495390525e-07,-1.574343097079712e-07],259,2) + arr2.setInfoOnComponents(['DRX','DRZ']) + f2z=MEDCouplingFieldDouble(ON_NODES) ; f2z.setName("SolutionDEPL") ; f2z.setArray(arr2) + f2z.setMesh(mz) + f2z.checkConsistencyLight() + ff2z=MEDFileField1TS() + ff2z.setFieldNoProfileSBT(f2z) + # + mm2=MEDFileUMesh() + mm2.setMeshAtLevel(0,mz) + mm2.setFamilyFieldArr(0,DataArrayInt([-1,-1,-1,-1,-1,-1,-1,-1,-1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-4,-4,-4,-4,-4,-4,-4,-4,-4,-5,-5,-5,-5,-5,-5,-5,-5,-5])) + mm2.setFamilyFieldArr(1,DataArrayInt([1,2,3,4,5,6,0,0,0,0,0,0,1,1,0,0,0,3,3,0,0,0,7,7,7,7,7,0,0,0,5,5,0,0,0,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,3,3,3,0,0,0,7,7,7,7,7,7,0,0,0,5,5,5,0,0,0,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])) + for famName,famId in [('FAMILLE_ZERO',0),('ba1_beam',-1),('ba2_beam',-2),('h1',6),('h1_h2_h3',4),('h2',5),('h3',7),('h3_h4_h5',2),('h4',3),('h5',1),('to1_beam',-4),('to2_beam',-5),('web_beam',-3)]: + mm2.setFamilyId(famName,famId) + pass + for grName,famsOnGrp in [('ba1',['ba1_beam']),('ba2',['ba2_beam']),('beam',['ba1_beam','ba2_beam','to1_beam','to2_beam','web_beam']),('h1',['h1','h1_h2_h3']),('h2',['h1_h2_h3','h2']),('h3',['h1_h2_h3','h3','h3_h4_h5']),('h4',['h3_h4_h5','h4']),('h5',['h3_h4_h5','h5']),('to1',['to1_beam']),('to2',['to2_beam']),('web',['web_beam'])]: + mm2.setFamiliesOnGroup(grName,famsOnGrp) + pass + # + mm2.write(fname,2) + ff0z.write(fname,0) + ff1z.write(fname,0) + ff2z.write(fname,0) + return fname + +@WriteInTmpDir +def test0(baseline_file): + fname = GenerateCase() + ################### MED write is done -> Go to MEDReader - # 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() + myMedReader=MEDReader(FileName=fname) + keys=myMedReader.GetProperty("FieldsTreeInfo")[::2] + # list all the names of arrays that can be seen (including their spatial discretization) + 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 + + 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 + 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 __name__ == "__main__": + outImgName="testMEDReader0.png" + baseline_file = RetriveBaseLine(outImgName) + test0(baseline_file) + pass diff --git a/src/Plugins/MEDReader/Test/testMEDReader1.py b/src/Plugins/MEDReader/Test/testMEDReader1.py index eff91a5f..6c730c2c 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader1.py +++ b/src/Plugins/MEDReader/Test/testMEDReader1.py @@ -19,40 +19,47 @@ # # Author : Anthony Geay -from MEDLoader import * +from medcoupling import * +from MEDReaderHelper import WriteInTmpDir,RetriveBaseLine -""" -This test focused on ELNO. Here a 2 QUAD4 cells and a single ELNO field -is defined. -""" -fname="testMEDReader1.med" +@WriteInTmpDir +def GenerateCase(): + """ + This test focused on ELNO. Here a 2 QUAD4 cells and a single ELNO field + is defined. + """ + fname="testMEDReader1.med" + coords=DataArrayDouble([(0,0,0),(2,1,0),(1,0,0),(1,1,0),(2,0,0),(0,1,0)]) + m=MEDCouplingUMesh("mesh",2) ; m.setCoords(coords) + m.allocateCells() + m.insertNextCell(NORM_QUAD4,[0,5,3,2]) + m.insertNextCell(NORM_QUAD4,[4,2,3,1]) + m.finishInsertingCells() + WriteMesh(fname,m,True) + # + f0=MEDCouplingFieldDouble(ON_GAUSS_NE) ; f0.setMesh(m) ; f0.setTimeUnit("ms") + f0.setTime(1.1,1,1) + f0.setName("myELNOField") + arr=DataArrayDouble([7,5,3,1,5,3,1,7]) ; arr.setInfoOnComponent(0,"Comp0") + f0.setArray(arr) + WriteFieldUsingAlreadyWrittenMesh(fname,f0) + # + f0.setTime(2.2,2,1) + arr=DataArrayDouble([1,7,5,3,7,5,3,1]) ; arr.setInfoOnComponent(0,"Comp0") + f0.setArray(arr) + WriteFieldUsingAlreadyWrittenMesh(fname,f0) + # + f0.setTime(3.3,3,1) + arr=DataArrayDouble([3,1,7,5,1,7,5,3]) ; arr.setInfoOnComponent(0,"Comp0") + f0.setArray(arr) + WriteFieldUsingAlreadyWrittenMesh(fname,f0) + # + f0.setTime(4.4,4,1) + arr=DataArrayDouble([5,3,1,7,3,1,7,5]) ; arr.setInfoOnComponent(0,"Comp0") + f0.setArray(arr) + WriteFieldUsingAlreadyWrittenMesh(fname,f0) -coords=DataArrayDouble([(0,0,0),(2,1,0),(1,0,0),(1,1,0),(2,0,0),(0,1,0)]) -m=MEDCouplingUMesh("mesh",2) ; m.setCoords(coords) -m.allocateCells() -m.insertNextCell(NORM_QUAD4,[0,5,3,2]) -m.insertNextCell(NORM_QUAD4,[4,2,3,1]) -m.finishInsertingCells() -WriteMesh(fname,m,True) -# -f0=MEDCouplingFieldDouble(ON_GAUSS_NE) ; f0.setMesh(m) ; f0.setTimeUnit("ms") -f0.setTime(1.1,1,1) -f0.setName("myELNOField") -arr=DataArrayDouble([7,5,3,1,5,3,1,7]) ; arr.setInfoOnComponent(0,"Comp0") -f0.setArray(arr) -WriteFieldUsingAlreadyWrittenMesh(fname,f0) -# -f0.setTime(2.2,2,1) -arr=DataArrayDouble([1,7,5,3,7,5,3,1]) ; arr.setInfoOnComponent(0,"Comp0") -f0.setArray(arr) -WriteFieldUsingAlreadyWrittenMesh(fname,f0) -# -f0.setTime(3.3,3,1) -arr=DataArrayDouble([3,1,7,5,1,7,5,3]) ; arr.setInfoOnComponent(0,"Comp0") -f0.setArray(arr) -WriteFieldUsingAlreadyWrittenMesh(fname,f0) -# -f0.setTime(4.4,4,1) -arr=DataArrayDouble([5,3,1,7,3,1,7,5]) ; arr.setInfoOnComponent(0,"Comp0") -f0.setArray(arr) -WriteFieldUsingAlreadyWrittenMesh(fname,f0) + +if __name__ == "__main__": + GenerateCase() + pass diff --git a/src/Plugins/MEDReader/Test/testMEDReader10.py b/src/Plugins/MEDReader/Test/testMEDReader10.py index be0a2682..6cd5dc55 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader10.py +++ b/src/Plugins/MEDReader/Test/testMEDReader10.py @@ -22,106 +22,110 @@ import os import sys -from MEDLoader import * +from medcoupling import * +from paraview.simple import * +from MEDReaderHelper import WriteInTmpDir,RetriveBaseLine -""" This test focuses on GenerateVector part. -""" +def GenerateCase(): + """ This test focuses on GenerateVector part. + """ + fname="testMEDReader10.med" + ############## + coo=DataArrayDouble([(0.,0.,0.),(1.,0.,0.),(2.,0.,0.),(3.,0.,0.),(0.,1.,0.),(1.,1.,0.),(2.,1.,0.),(3.,1.,0.),(0.,0.,1.),(1.,0.,1.),(2.,0.,1.),(3.,0.,1.),(0.,1.,1.),(1.,1.,1.),(2.,1.,1.),(3.,1.,1.)]) + m=MEDCouplingUMesh("myMesh",3) ; m.setCoords(coo) + m.allocateCells() + m.insertNextCell(NORM_HEXA8,[0,4,5,1,8,12,13,9]) ; m.insertNextCell(NORM_HEXA8,[1,5,6,2,9,13,14,10]) ; m.insertNextCell(NORM_HEXA8,[2,6,7,3,10,14,15,11]) + f0=MEDCouplingFieldDouble(ON_NODES) ; f0.setName("f0NbComp1") ; f0.setMesh(m) ; + arr=DataArrayDouble(8) ; arr.iota() ; arr=DataArrayDouble.Aggregate(arr,arr+8) ; arr.setInfoOnComponents(["1st"]) + f0.setArray(arr) + f1=MEDCouplingFieldDouble(ON_NODES) ; f1.setName("f1NbComp2") ; f1.setMesh(m) ; + arr=DataArrayDouble([(-1.,-1.),(0.,0.5),(0.,0.5),(1.,-1.),(-1.,1.),(0.,-0.5),(0.,-0.5),(1.,1.)]) ; arr=DataArrayDouble.Aggregate(arr,arr) ; arr.setInfoOnComponents(["1st","2nd"]) + f1.setArray(arr) + f2=MEDCouplingFieldDouble(ON_NODES) ; f2.setName("f2NbComp3") ; f2.setMesh(m) ; + arr=DataArrayDouble([(-1.,-1.,-1.),(0.,0.5,0.),(0.,0.5,0.),(1.,-1.,-1.),(-1.,1.,-1.),(0.,-0.5,0.),(0.,-0.5,0.),(1.,1.,-1)]) ; arr2=arr[:] ; arr2[[0,3,4,7],2]=1. + arr=DataArrayDouble.Aggregate(arr,arr2) ; arr.setInfoOnComponents(["1st","2nd","3rd"]) + f2.setArray(arr) + f3=MEDCouplingFieldDouble(ON_NODES) ; f3.setName("f3NbComp4") ; f3.setMesh(m) ; + arr=DataArrayDouble([(-1.,-1.,-1.),(0.,0.5,0.),(0.,0.5,0.),(1.,-1.,-1.),(-1.,1.,-1.),(0.,-0.5,0.),(0.,-0.5,0.),(1.,1.,-1)]) ; arr2=arr[:] ; arr2[[0,3,4,7],2]=1. + arr=DataArrayDouble.Aggregate(arr,arr2) ; arr3=DataArrayDouble(16) ; arr3.iota() ; arr=DataArrayDouble.Meld([arr,arr3]) + arr.setInfoOnComponents(["1st","2nd","3rd","4th"]) + f3.setArray(arr) + # + WriteMesh(fname,m,True) + WriteFieldUsingAlreadyWrittenMesh(fname,f0) + WriteFieldUsingAlreadyWrittenMesh(fname,f1) + WriteFieldUsingAlreadyWrittenMesh(fname,f2) + WriteFieldUsingAlreadyWrittenMesh(fname,f3) + return fname -fname="testMEDReader10.med" -outImgName="testMEDReader10.png" -############## -coo=DataArrayDouble([(0.,0.,0.),(1.,0.,0.),(2.,0.,0.),(3.,0.,0.),(0.,1.,0.),(1.,1.,0.),(2.,1.,0.),(3.,1.,0.),(0.,0.,1.),(1.,0.,1.),(2.,0.,1.),(3.,0.,1.),(0.,1.,1.),(1.,1.,1.),(2.,1.,1.),(3.,1.,1.)]) -m=MEDCouplingUMesh("myMesh",3) ; m.setCoords(coo) -m.allocateCells() -m.insertNextCell(NORM_HEXA8,[0,4,5,1,8,12,13,9]) ; m.insertNextCell(NORM_HEXA8,[1,5,6,2,9,13,14,10]) ; m.insertNextCell(NORM_HEXA8,[2,6,7,3,10,14,15,11]) -f0=MEDCouplingFieldDouble(ON_NODES) ; f0.setName("f0NbComp1") ; f0.setMesh(m) ; -arr=DataArrayDouble(8) ; arr.iota() ; arr=DataArrayDouble.Aggregate(arr,arr+8) ; arr.setInfoOnComponents(["1st"]) -f0.setArray(arr) -f1=MEDCouplingFieldDouble(ON_NODES) ; f1.setName("f1NbComp2") ; f1.setMesh(m) ; -arr=DataArrayDouble([(-1.,-1.),(0.,0.5),(0.,0.5),(1.,-1.),(-1.,1.),(0.,-0.5),(0.,-0.5),(1.,1.)]) ; arr=DataArrayDouble.Aggregate(arr,arr) ; arr.setInfoOnComponents(["1st","2nd"]) -f1.setArray(arr) -f2=MEDCouplingFieldDouble(ON_NODES) ; f2.setName("f2NbComp3") ; f2.setMesh(m) ; -arr=DataArrayDouble([(-1.,-1.,-1.),(0.,0.5,0.),(0.,0.5,0.),(1.,-1.,-1.),(-1.,1.,-1.),(0.,-0.5,0.),(0.,-0.5,0.),(1.,1.,-1)]) ; arr2=arr[:] ; arr2[[0,3,4,7],2]=1. -arr=DataArrayDouble.Aggregate(arr,arr2) ; arr.setInfoOnComponents(["1st","2nd","3rd"]) -f2.setArray(arr) -f3=MEDCouplingFieldDouble(ON_NODES) ; f3.setName("f3NbComp4") ; f3.setMesh(m) ; -arr=DataArrayDouble([(-1.,-1.,-1.),(0.,0.5,0.),(0.,0.5,0.),(1.,-1.,-1.),(-1.,1.,-1.),(0.,-0.5,0.),(0.,-0.5,0.),(1.,1.,-1)]) ; arr2=arr[:] ; arr2[[0,3,4,7],2]=1. -arr=DataArrayDouble.Aggregate(arr,arr2) ; arr3=DataArrayDouble(16) ; arr3.iota() ; arr=DataArrayDouble.Meld([arr,arr3]) -arr.setInfoOnComponents(["1st","2nd","3rd","4th"]) -f3.setArray(arr) -# -WriteMesh(fname,m,True) -WriteFieldUsingAlreadyWrittenMesh(fname,f0) -WriteFieldUsingAlreadyWrittenMesh(fname,f1) -WriteFieldUsingAlreadyWrittenMesh(fname,f2) -WriteFieldUsingAlreadyWrittenMesh(fname,f3) -################### MED write is done -> Go to MEDReader -from paraview.simple import * -myMedReader=MEDReader(FileName=fname) -keys=myMedReader.GetProperty("FieldsTreeInfo")[::2] -# list all the names of arrays that can be seen (including their spatial discretization) -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 -myMedReader.GenerateVectors=1 +@WriteInTmpDir +def test(baseline_file): + fname = GenerateCase() + ################### MED write is done -> Go to MEDReader + myMedReader=MEDReader(FileName=fname) + keys=myMedReader.GetProperty("FieldsTreeInfo")[::2] + # list all the names of arrays that can be seen (including their spatial discretization) + 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 + myMedReader.GenerateVectors=1 -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() + 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 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() +if __name__ == "__main__": + outImgName="testMEDReader10.png" + baseline_file = RetriveBaseLine(outImgName) + test(baseline_file) + pass diff --git a/src/Plugins/MEDReader/Test/testMEDReader13.py b/src/Plugins/MEDReader/Test/testMEDReader13.py index 78e8bb9b..84925fd5 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader13.py +++ b/src/Plugins/MEDReader/Test/testMEDReader13.py @@ -22,75 +22,77 @@ 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""" - -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.checkConsistencyLight() -WriteField(fname,f,True) - -################### MED write is done -> Go to MEDReader - +from medcoupling import * from paraview.simple import * - -testMEDReader13_med = MEDReader( FileName=fname ) - -testMEDReader13_med.GenerateVectors = 1 -testMEDReader13_med.AllArrays = ['TS0/mesh/ComSup0/fieldELNO@@][@@GSSNE'] - -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() +from MEDReaderHelper import WriteInTmpDir,RetriveBaseLine + +def GenerateCase(): + """ 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" + # + + 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.checkConsistencyLight() + WriteField(fname,f,True) + return fname + +@WriteInTmpDir +def test(baseline_file): + fname = GenerateCase() + ################### MED write is done -> Go to MEDReader + testMEDReader13_med = MEDReader( FileName=fname ) + + testMEDReader13_med.GenerateVectors = 1 + testMEDReader13_med.AllArrays = ['TS0/mesh/ComSup0/fieldELNO@@][@@GSSNE'] + + 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 + 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 __name__ == "__main__": + outImgName="testMEDReader13.png" + baseline_file = RetriveBaseLine(outImgName) + test(baseline_file) + pass diff --git a/src/Plugins/MEDReader/Test/testMEDReader14.py b/src/Plugins/MEDReader/Test/testMEDReader14.py index 84d11abe..e8eca2c1 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader14.py +++ b/src/Plugins/MEDReader/Test/testMEDReader14.py @@ -22,159 +22,160 @@ import os import sys -from MEDLoader import * +from medcoupling import * +from paraview.simple import * +from MEDReaderHelper import WriteInTmpDir,RetriveBaseLine +paraview.simple._DisableFirstRenderCameraReset() -""" This test reproduces precisely the bug EDF8655 (PAL 22677) by cheking that multi loc per geo type in a field is correctly managed. -""" +def GenerateCase(): + """ This test reproduces precisely the bug EDF8655 (PAL 22677) by cheking that multi loc per geo type in a field is correctly managed. + """ -fname="testMEDReader14.med" -outImgName="testMEDReader14.png" + fname="testMEDReader14.med" -arr0=DataArrayDouble(7) ; arr0.iota() -arr1=DataArrayDouble(5) ; arr1.iota() -c=MEDCouplingCMesh() -c.setCoords(arr0,arr1) -m=c.build1SGTUnstructured() -pfl=DataArrayInt([5,10,11,16,17,23]) -m0=m[pfl.buildComplement(24)] -m1=m[pfl] ; m1.simplexize(0) -m=MEDCouplingUMesh.MergeUMeshesOnSameCoords(m1.buildUnstructured(),m0.buildUnstructured()) -m.setName("Mesh") -m1=MEDCoupling1SGTUMesh(m.getName(),NORM_SEG2) -m1.setCoords(m.getCoords()) -m1.allocateCells() -for i in [[28,21],[21,14],[14,7],[7,0]]: - m1.insertNextCell(i) - pass -for i in range(6): - m1.insertNextCell([i,i+1]) - pass -for i in [[6,13],[13,20],[20,27],[27,34]]: - m1.insertNextCell(i) - pass -for i in range(6,0,-1): - m1.insertNextCell([28+i,28+i-1]) - pass -# -mm=MEDFileUMesh() -mm.setMeshAtLevel(0,m) -mm.setMeshAtLevel(-1,m1) -mm.write(fname,2) -# -pfl0=DataArrayInt([0,1,2,3]) ; pfl0.setName("PFL000") -pfl1=DataArrayInt([4,5,6,7,8,9]) ; pfl1.setName("PFL001") -pfl2=DataArrayInt([10,11,12,13]) ; pfl2.setName("PFL002") -pfl3=DataArrayInt([13,14,15,16,19,20,23,24,26,27,28,29]) ; pfl3.setName("PFL003") -# -fieldName0="zeField0" -fieldName1="zeField1" -fieldName2="zeField2" -fs0=MEDFileFieldMultiTS() -fs1=MEDFileFieldMultiTS() -fs2=MEDFileFieldMultiTS() -for i in range(5): - f=MEDFileField1TS() - zePfl0=DataArrayInt.Aggregate(DataArrayInt.Range(0,12,1),pfl3,0) ; zePfl0.setName("PFL") - fNode=MEDCouplingFieldDouble(ON_GAUSS_PT) ; fNode.setTime(float(i),i,0) - tmp=m[zePfl0] - fNode.setName(fieldName0) ; fNode.setMesh(tmp) - fNode.setGaussLocalizationOnCells(DataArrayInt.Range(0,12,1),[0.,0.,1.,0.,0.,1.],[0.1,0.1,0.8,0.1,0.1,0.8],3*[0.16666666666666666]) - fNode.setGaussLocalizationOnCells(DataArrayInt.Range(12,24,1),[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[-0.577350,-0.577350,0.577350,-0.577350,0.577350,0.577350,-0.577350,0.577350],4*[1.]) - arr=DataArrayDouble(2*(12*3+12*4)) ; arr.iota(0+1000*i) ; arr.rearrange(2) - fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_2 [m]","Com2_2 [s^2]"]) ; fNode.checkConsistencyLight() - fNode.setName(fieldName0) - f.setFieldProfile(fNode,mm,0,zePfl0) - # - zePfl1=DataArrayInt.Range(0,14,1) ; zePfl1.setName("PFL") - fNode=MEDCouplingFieldDouble(ON_GAUSS_PT) ; fNode.setTime(float(i),i,0) - tmp=m1[zePfl1] + arr0=DataArrayDouble(7) ; arr0.iota() + arr1=DataArrayDouble(5) ; arr1.iota() + c=MEDCouplingCMesh() + c.setCoords(arr0,arr1) + m=c.build1SGTUnstructured() + pfl=DataArrayInt([5,10,11,16,17,23]) + m0=m[pfl.buildComplement(24)] + m1=m[pfl] ; m1.simplexize(0) + m=MEDCouplingUMesh.MergeUMeshesOnSameCoords(m1.buildUnstructured(),m0.buildUnstructured()) + m.setName("Mesh") + m1=MEDCoupling1SGTUMesh(m.getName(),NORM_SEG2) + m1.setCoords(m.getCoords()) + m1.allocateCells() + for i in [[28,21],[21,14],[14,7],[7,0]]: + m1.insertNextCell(i) + pass + for i in range(6): + m1.insertNextCell([i,i+1]) + pass + for i in [[6,13],[13,20],[20,27],[27,34]]: + m1.insertNextCell(i) + pass + for i in range(6,0,-1): + m1.insertNextCell([28+i,28+i-1]) + pass # - fNode.setName(fieldName0) ; fNode.setMesh(tmp) - fNode.setGaussLocalizationOnCells(DataArrayInt.Range(0,4,1),[-1.,1.],[-0.33333333333333337,0.33333333333333337],[1.,1.]) - fNode.setGaussLocalizationOnCells(DataArrayInt.Range(4,10,1),[-1.,1.],[-0.5,0.,0.5],[1.,1.,1.]) - fNode.setGaussLocalizationOnCells(DataArrayInt.Range(10,14,1),[-1.,1.],[-0.6,-0.2,0.2,0.6],[1.,1.,1.,1.]) - arr=DataArrayDouble(2*(4*2+6*3+4*4)) ; arr.iota(100+1000*i) ; arr.rearrange(2) - fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_2 [m]","Com2_2 [s^2]"]) ; fNode.checkConsistencyLight() - fNode.setName(fieldName0) - f.setFieldProfile(fNode,mm,-1,zePfl1) - fs0.pushBackTimeStep(f) + mm=MEDFileUMesh() + mm.setMeshAtLevel(0,m) + mm.setMeshAtLevel(-1,m1) + mm.write(fname,2) # - f=MEDFileField1TS() - zePfl2=DataArrayInt.Range(10,20,1) ; zePfl2.setName("PFL2") - fNode=MEDCouplingFieldDouble(ON_GAUSS_PT) ; fNode.setTime(float(i),i,0) - tmp=m1[zePfl2] - fNode.setName(fieldName1) ; fNode.setMesh(tmp) - fNode.setGaussLocalizationOnCells(DataArrayInt.Range(0,4,1),[-1.,1.],[-0.6,-0.2,0.2,0.6],[1.,1.,1.,1.]) - fNode.setGaussLocalizationOnCells(DataArrayInt.Range(4,10,1),[-1.,1.],[-0.6666666666666667,-0.33333333333333337,0.,0.33333333333333337,0.6666666666666667],[1.,1.,1.,1.,1.]) - arr=DataArrayDouble(2*(4*4+6*5)) ; arr.iota(500+1000*i) ; arr.rearrange(2) - fNode.setArray(arr) ; arr.setInfoOnComponents(["C1 [m]","C2 [s^2]"]) ; fNode.checkConsistencyLight() - f.setFieldProfile(fNode,mm,-1,zePfl2) - fs1.pushBackTimeStep(f) + pfl0=DataArrayInt([0,1,2,3]) ; pfl0.setName("PFL000") + pfl1=DataArrayInt([4,5,6,7,8,9]) ; pfl1.setName("PFL001") + pfl2=DataArrayInt([10,11,12,13]) ; pfl2.setName("PFL002") + pfl3=DataArrayInt([13,14,15,16,19,20,23,24,26,27,28,29]) ; pfl3.setName("PFL003") # - f=MEDFileField1TS() - zePfl3=DataArrayInt([6,10,11,12,13,17,18,19,20,24,25,26,27,34]) ; zePfl3.setName("PFL3") - fNode=MEDCouplingFieldDouble(ON_NODES) ; fNode.setTime(float(i),i,0) - fNode.setName(fieldName2) - arr=DataArrayDouble(2*14) ; arr.iota(700+1000*i) ; arr.rearrange(2) - fNode.setArray(arr) ; arr.setInfoOnComponents(["C3 [kg]","C4 [m^2]"]) - f.setFieldProfile(fNode,mm,0,zePfl3) - fs2.pushBackTimeStep(f) - pass -fs0.write(fname,0) -fs1.write(fname,0) -fs2.write(fname,0) + fieldName0="zeField0" + fieldName1="zeField1" + fieldName2="zeField2" + fs0=MEDFileFieldMultiTS() + fs1=MEDFileFieldMultiTS() + fs2=MEDFileFieldMultiTS() + for i in range(5): + f=MEDFileField1TS() + zePfl0=DataArrayInt.Aggregate(DataArrayInt.Range(0,12,1),pfl3,0) ; zePfl0.setName("PFL") + fNode=MEDCouplingFieldDouble(ON_GAUSS_PT) ; fNode.setTime(float(i),i,0) + tmp=m[zePfl0] + fNode.setName(fieldName0) ; fNode.setMesh(tmp) + fNode.setGaussLocalizationOnCells(DataArrayInt.Range(0,12,1),[0.,0.,1.,0.,0.,1.],[0.1,0.1,0.8,0.1,0.1,0.8],3*[0.16666666666666666]) + fNode.setGaussLocalizationOnCells(DataArrayInt.Range(12,24,1),[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[-0.577350,-0.577350,0.577350,-0.577350,0.577350,0.577350,-0.577350,0.577350],4*[1.]) + arr=DataArrayDouble(2*(12*3+12*4)) ; arr.iota(0+1000*i) ; arr.rearrange(2) + fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_2 [m]","Com2_2 [s^2]"]) ; fNode.checkConsistencyLight() + fNode.setName(fieldName0) + f.setFieldProfile(fNode,mm,0,zePfl0) + # + zePfl1=DataArrayInt.Range(0,14,1) ; zePfl1.setName("PFL") + fNode=MEDCouplingFieldDouble(ON_GAUSS_PT) ; fNode.setTime(float(i),i,0) + tmp=m1[zePfl1] + # + fNode.setName(fieldName0) ; fNode.setMesh(tmp) + fNode.setGaussLocalizationOnCells(DataArrayInt.Range(0,4,1),[-1.,1.],[-0.33333333333333337,0.33333333333333337],[1.,1.]) + fNode.setGaussLocalizationOnCells(DataArrayInt.Range(4,10,1),[-1.,1.],[-0.5,0.,0.5],[1.,1.,1.]) + fNode.setGaussLocalizationOnCells(DataArrayInt.Range(10,14,1),[-1.,1.],[-0.6,-0.2,0.2,0.6],[1.,1.,1.,1.]) + arr=DataArrayDouble(2*(4*2+6*3+4*4)) ; arr.iota(100+1000*i) ; arr.rearrange(2) + fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_2 [m]","Com2_2 [s^2]"]) ; fNode.checkConsistencyLight() + fNode.setName(fieldName0) + f.setFieldProfile(fNode,mm,-1,zePfl1) + fs0.pushBackTimeStep(f) + # + f=MEDFileField1TS() + zePfl2=DataArrayInt.Range(10,20,1) ; zePfl2.setName("PFL2") + fNode=MEDCouplingFieldDouble(ON_GAUSS_PT) ; fNode.setTime(float(i),i,0) + tmp=m1[zePfl2] + fNode.setName(fieldName1) ; fNode.setMesh(tmp) + fNode.setGaussLocalizationOnCells(DataArrayInt.Range(0,4,1),[-1.,1.],[-0.6,-0.2,0.2,0.6],[1.,1.,1.,1.]) + fNode.setGaussLocalizationOnCells(DataArrayInt.Range(4,10,1),[-1.,1.],[-0.6666666666666667,-0.33333333333333337,0.,0.33333333333333337,0.6666666666666667],[1.,1.,1.,1.,1.]) + arr=DataArrayDouble(2*(4*4+6*5)) ; arr.iota(500+1000*i) ; arr.rearrange(2) + fNode.setArray(arr) ; arr.setInfoOnComponents(["C1 [m]","C2 [s^2]"]) ; fNode.checkConsistencyLight() + f.setFieldProfile(fNode,mm,-1,zePfl2) + fs1.pushBackTimeStep(f) + # + f=MEDFileField1TS() + zePfl3=DataArrayInt([6,10,11,12,13,17,18,19,20,24,25,26,27,34]) ; zePfl3.setName("PFL3") + fNode=MEDCouplingFieldDouble(ON_NODES) ; fNode.setTime(float(i),i,0) + fNode.setName(fieldName2) + arr=DataArrayDouble(2*14) ; arr.iota(700+1000*i) ; arr.rearrange(2) + fNode.setArray(arr) ; arr.setInfoOnComponents(["C3 [kg]","C4 [m^2]"]) + f.setFieldProfile(fNode,mm,0,zePfl3) + fs2.pushBackTimeStep(f) + pass + fs0.write(fname,0) + fs1.write(fname,0) + fs2.write(fname,0) + return fname -# +@WriteInTmpDir +def test(baseline_file): + fname = GenerateCase() + 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) -from paraview.simple import * + 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 -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) + # -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 - 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 + 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() + +if __name__ == "__main__": + outImgName="testMEDReader14.png" + baseline_file = RetriveBaseLine(outImgName) + test(baseline_file) + pass diff --git a/src/Plugins/MEDReader/Test/testMEDReader15.py b/src/Plugins/MEDReader/Test/testMEDReader15.py index f9680a24..f3ea0e24 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader15.py +++ b/src/Plugins/MEDReader/Test/testMEDReader15.py @@ -22,71 +22,74 @@ import os import sys -from MEDLoader import * +from medcoupling import * +from paraview.simple import * +from MEDReaderHelper import WriteInTmpDir,RetriveBaseLine -""" This test is a non regression test that checks the behaviour of MEDReader when a mesh has the same name than a field. -""" +paraview.simple._DisableFirstRenderCameraReset() -fname="testMEDReader15.med" -outImgName="testMEDReader15.png" +def GenerateCase(): + """ This test is a non regression test that checks the behaviour of MEDReader when a mesh has the same name than a field. + """ -zeName="zeName" -c=DataArrayDouble([(0.,0.,0.),(1.,0.,0.),(0.,1.,0.)]) -m=MEDFileUMesh() -m.setCoords(c) -m.setName(zeName) -m.write(fname,2) -f=MEDCouplingFieldDouble(ON_NODES) -f.setName(zeName) -f.setArray(DataArrayDouble([(-1.,1.,0.),(0.,1.,0.),(1.,1.,0.)])) -tmp=MEDCouplingUMesh.Build0DMeshFromCoords(m.getCoords()) ; tmp.setName(zeName) -f.setMesh(tmp) -WriteFieldUsingAlreadyWrittenMesh(fname,f) -# + fname="testMEDReader15.med" -from paraview.simple import * + zeName="zeName" + c=DataArrayDouble([(0.,0.,0.),(1.,0.,0.),(0.,1.,0.)]) + m=MEDFileUMesh() + m.setCoords(c) + m.setName(zeName) + m.write(fname,2) + f=MEDCouplingFieldDouble(ON_NODES) + f.setName(zeName) + f.setArray(DataArrayDouble([(-1.,1.,0.),(0.,1.,0.),(1.,1.,0.)])) + tmp=MEDCouplingUMesh.Build0DMeshFromCoords(m.getCoords()) ; tmp.setName(zeName) + f.setMesh(tmp) + WriteFieldUsingAlreadyWrittenMesh(fname,f) + return fname -paraview.simple._DisableFirstRenderCameraReset() -reader=MEDReader(FileName=fname) -ExpectedEntries=['TS0/zeName/ComSup0/zeName@@][@@P1','TS0/zeName/ComSup0/MESH@zeName@@][@@P1'] -assert(reader.GetProperty("FieldsTreeInfo")[::2]==ExpectedEntries) +@WriteInTmpDir +def test(baseline_file): + fname = GenerateCase() + reader=MEDReader(FileName=fname) + ExpectedEntries=['TS0/zeName/ComSup0/zeName@@][@@P1','TS0/zeName/ComSup0/MESH@zeName@@][@@P1'] + assert(reader.GetProperty("FieldsTreeInfo")[::2]==ExpectedEntries) -# -glyph1=Glyph(Input=reader,GlyphType='Arrow',ScaleArray='FamilyIdNode',OrientationArray='zeName',GlyphMode='All Points',ScaleFactor=0.1,GlyphTransform='Transform2') + # + glyph1=Glyph(Input=reader,GlyphType='Arrow',ScaleArray='FamilyIdNode',OrientationArray='zeName',GlyphMode='All Points',ScaleFactor=0.1,GlyphTransform='Transform2') -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' + 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 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() +if __name__ == "__main__": + outImgName="testMEDReader15.png" + baseline_file = RetriveBaseLine(outImgName) + test(baseline_file) + pass diff --git a/src/Plugins/MEDReader/Test/testMEDReader16.py b/src/Plugins/MEDReader/Test/testMEDReader16.py index acd78301..cc31f6c7 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader16.py +++ b/src/Plugins/MEDReader/Test/testMEDReader16.py @@ -19,84 +19,96 @@ # # Author : Anthony Geay (EDF R&D) -from MEDLoader import * - -""" This test is a non regression test of EDF8662 : This bug revealed that ELNOfieldToSurface and ELNOfieldToPointGaussian do not behave correctly after the call of ExtractGroup""" - -fname="testMEDReader16.med" - -arr=DataArrayDouble([0,1,2]) -m=MEDCouplingCMesh() ; m.setCoords(arr,arr) ; m=m.buildUnstructured() ; m.setName("Mesh") -mm=MEDFileUMesh() ; mm.setMeshAtLevel(0,m) -grp0=DataArrayInt([0,1]) ; grp0.setName("grp0") -grp1=DataArrayInt([2,3]) ; grp1.setName("grp1") -grp2=DataArrayInt([1,2]) ; grp2.setName("grp2") -grp3=DataArrayInt([0,1,2,3]) ; grp3.setName("grp3") -mm.setGroupsAtLevel(0,[grp0,grp1,grp2,grp3]) -f=MEDCouplingFieldDouble(ON_GAUSS_NE) ; f.setMesh(m) ; f.setName("MyField") ; f.setTime(0.,0,0) -arr2=DataArrayDouble(4*4*2) ; arr2.iota() ; arr2.rearrange(2) ; arr2.setInfoOnComponents(["aa","bbb"]) -f.setArray(arr2) ; arr2+=0.1 ; f.checkConsistencyLight() -mm.write(fname,2) -WriteFieldUsingAlreadyWrittenMesh(fname,f) -# +from medcoupling import * from paraview.simple import * from paraview import servermanager +from MEDReaderHelper import WriteInTmpDir,RetriveBaseLine paraview.simple._DisableFirstRenderCameraReset() -reader=MEDReader(FileName=fname) -ExpectedEntries=['TS0/Mesh/ComSup0/MyField@@][@@GSSNE','TS1/Mesh/ComSup0/Mesh@@][@@P0'] -assert(reader.GetProperty("FieldsTreeInfo")[::2]==ExpectedEntries) -reader.AllArrays=['TS0/Mesh/ComSup0/MyField@@][@@GSSNE'] -ExtractGroup1 = ExtractGroup(Input=reader) -#ExtractGroup1.UpdatePipelineInformation() -ExtractGroup1.AllGroups=["GRP_grp1"] -ELNOfieldToSurface1=ELNOfieldToSurface(Input=ExtractGroup1) -ELNOfieldToPointGaussian1=ELNOfieldToPointGaussian(Input=ExtractGroup1) -ELNOfieldToPointGaussian1.SelectSourceArray=['ELNO@MyField'] -for elt in [ELNOfieldToSurface1,ELNOfieldToPointGaussian1]: - elnoMesh=servermanager.Fetch(ELNOfieldToPointGaussian1,0) - vtkArrToTest=elnoMesh.GetBlock(0).GetPointData().GetArray("MyField") - assert(vtkArrToTest.GetNumberOfTuples()==8) - assert(vtkArrToTest.GetNumberOfComponents()==2) - assert(vtkArrToTest.GetComponentName(0)==arr2.getInfoOnComponent(0)) - assert(vtkArrToTest.GetComponentName(1)==arr2.getInfoOnComponent(1)) - vals=[vtkArrToTest.GetValue(i) for i in range(16)] - assert(arr2[8:].isEqualWithoutConsideringStr(DataArrayDouble(vals,8,2),1e-12)) - pass -# -ExtractGroup1.AllGroups=["GRP_grp2"] -for elt in [ELNOfieldToSurface1,ELNOfieldToPointGaussian1]: - elnoMesh=servermanager.Fetch(ELNOfieldToSurface1) - vtkArrToTest=elnoMesh.GetBlock(0).GetPointData().GetArray("MyField") - assert(vtkArrToTest.GetNumberOfTuples()==8) - assert(vtkArrToTest.GetNumberOfComponents()==2) - assert(vtkArrToTest.GetComponentName(0)==arr2.getInfoOnComponent(0)) - assert(vtkArrToTest.GetComponentName(1)==arr2.getInfoOnComponent(1)) - vals=[vtkArrToTest.GetValue(i) for i in range(16)] - assert(arr2[4:12].isEqualWithoutConsideringStr(DataArrayDouble(vals,8,2),1e-12)) - pass -# important to check that if all the field is present that it is OK (check of the optimization) -ExtractGroup1.AllGroups=["GRP_grp3"] -for elt in [ELNOfieldToSurface1,ELNOfieldToPointGaussian1]: - elnoMesh=servermanager.Fetch(ELNOfieldToSurface1) - vtkArrToTest=elnoMesh.GetBlock(0).GetPointData().GetArray("MyField") - assert(vtkArrToTest.GetNumberOfTuples()==16) - assert(vtkArrToTest.GetNumberOfComponents()==2) - assert(vtkArrToTest.GetComponentName(0)==arr2.getInfoOnComponent(0)) - assert(vtkArrToTest.GetComponentName(1)==arr2.getInfoOnComponent(1)) - vals=[vtkArrToTest.GetValue(i) for i in range(32)] - assert(arr2.isEqualWithoutConsideringStr(DataArrayDouble(vals,16,2),1e-12)) - pass -ELNOfieldToSurface1=ELNOfieldToSurface(Input=reader) -ELNOfieldToPointGaussian1=ELNOfieldToPointGaussian(Input=reader) -ELNOfieldToPointGaussian1.SelectSourceArray=['ELNO@MyField'] -for elt in [ELNOfieldToSurface1,ELNOfieldToPointGaussian1]: - elnoMesh=servermanager.Fetch(ELNOfieldToSurface1) - vtkArrToTest=elnoMesh.GetBlock(0).GetPointData().GetArray("MyField") - assert(vtkArrToTest.GetNumberOfTuples()==16) - assert(vtkArrToTest.GetNumberOfComponents()==2) - assert(vtkArrToTest.GetComponentName(0)==arr2.getInfoOnComponent(0)) - assert(vtkArrToTest.GetComponentName(1)==arr2.getInfoOnComponent(1)) - vals=[vtkArrToTest.GetValue(i) for i in range(32)] - assert(arr2.isEqualWithoutConsideringStr(DataArrayDouble(vals,16,2),1e-12)) - pass + +def GenerateCase(): + """ This test is a non regression test of EDF8662 : This bug revealed that ELNOfieldToSurface and ELNOfieldToPointGaussian do not behave correctly after the call of ExtractGroup""" + + fname="testMEDReader16.med" + + arr=DataArrayDouble([0,1,2]) + m=MEDCouplingCMesh() ; m.setCoords(arr,arr) ; m=m.buildUnstructured() ; m.setName("Mesh") + mm=MEDFileUMesh() ; mm.setMeshAtLevel(0,m) + grp0=DataArrayInt([0,1]) ; grp0.setName("grp0") + grp1=DataArrayInt([2,3]) ; grp1.setName("grp1") + grp2=DataArrayInt([1,2]) ; grp2.setName("grp2") + grp3=DataArrayInt([0,1,2,3]) ; grp3.setName("grp3") + mm.setGroupsAtLevel(0,[grp0,grp1,grp2,grp3]) + f=MEDCouplingFieldDouble(ON_GAUSS_NE) ; f.setMesh(m) ; f.setName("MyField") ; f.setTime(0.,0,0) + arr2=DataArrayDouble(4*4*2) ; arr2.iota() ; arr2.rearrange(2) ; arr2.setInfoOnComponents(["aa","bbb"]) + f.setArray(arr2) ; arr2+=0.1 ; f.checkConsistencyLight() + mm.write(fname,2) + WriteFieldUsingAlreadyWrittenMesh(fname,f) + return fname, arr2 + + +@WriteInTmpDir +def test(): + fname,arr2 = GenerateCase() + # + reader=MEDReader(FileName=fname) + ExpectedEntries=['TS0/Mesh/ComSup0/MyField@@][@@GSSNE','TS1/Mesh/ComSup0/Mesh@@][@@P0'] + assert(reader.GetProperty("FieldsTreeInfo")[::2]==ExpectedEntries) + reader.AllArrays=['TS0/Mesh/ComSup0/MyField@@][@@GSSNE'] + ExtractGroup1 = ExtractGroup(Input=reader) + #ExtractGroup1.UpdatePipelineInformation() + ExtractGroup1.AllGroups=["GRP_grp1"] + ELNOfieldToSurface1=ELNOfieldToSurface(Input=ExtractGroup1) + ELNOfieldToPointGaussian1=ELNOfieldToPointGaussian(Input=ExtractGroup1) + ELNOfieldToPointGaussian1.SelectSourceArray=['ELNO@MyField'] + for elt in [ELNOfieldToSurface1,ELNOfieldToPointGaussian1]: + elnoMesh=servermanager.Fetch(ELNOfieldToPointGaussian1,0) + vtkArrToTest=elnoMesh.GetBlock(0).GetPointData().GetArray("MyField") + assert(vtkArrToTest.GetNumberOfTuples()==8) + assert(vtkArrToTest.GetNumberOfComponents()==2) + assert(vtkArrToTest.GetComponentName(0)==arr2.getInfoOnComponent(0)) + assert(vtkArrToTest.GetComponentName(1)==arr2.getInfoOnComponent(1)) + vals=[vtkArrToTest.GetValue(i) for i in range(16)] + assert(arr2[8:].isEqualWithoutConsideringStr(DataArrayDouble(vals,8,2),1e-12)) + pass + # + ExtractGroup1.AllGroups=["GRP_grp2"] + for elt in [ELNOfieldToSurface1,ELNOfieldToPointGaussian1]: + elnoMesh=servermanager.Fetch(ELNOfieldToSurface1) + vtkArrToTest=elnoMesh.GetBlock(0).GetPointData().GetArray("MyField") + assert(vtkArrToTest.GetNumberOfTuples()==8) + assert(vtkArrToTest.GetNumberOfComponents()==2) + assert(vtkArrToTest.GetComponentName(0)==arr2.getInfoOnComponent(0)) + assert(vtkArrToTest.GetComponentName(1)==arr2.getInfoOnComponent(1)) + vals=[vtkArrToTest.GetValue(i) for i in range(16)] + assert(arr2[4:12].isEqualWithoutConsideringStr(DataArrayDouble(vals,8,2),1e-12)) + pass + # important to check that if all the field is present that it is OK (check of the optimization) + ExtractGroup1.AllGroups=["GRP_grp3"] + for elt in [ELNOfieldToSurface1,ELNOfieldToPointGaussian1]: + elnoMesh=servermanager.Fetch(ELNOfieldToSurface1) + vtkArrToTest=elnoMesh.GetBlock(0).GetPointData().GetArray("MyField") + assert(vtkArrToTest.GetNumberOfTuples()==16) + assert(vtkArrToTest.GetNumberOfComponents()==2) + assert(vtkArrToTest.GetComponentName(0)==arr2.getInfoOnComponent(0)) + assert(vtkArrToTest.GetComponentName(1)==arr2.getInfoOnComponent(1)) + vals=[vtkArrToTest.GetValue(i) for i in range(32)] + assert(arr2.isEqualWithoutConsideringStr(DataArrayDouble(vals,16,2),1e-12)) + pass + ELNOfieldToSurface1=ELNOfieldToSurface(Input=reader) + ELNOfieldToPointGaussian1=ELNOfieldToPointGaussian(Input=reader) + ELNOfieldToPointGaussian1.SelectSourceArray=['ELNO@MyField'] + for elt in [ELNOfieldToSurface1,ELNOfieldToPointGaussian1]: + elnoMesh=servermanager.Fetch(ELNOfieldToSurface1) + vtkArrToTest=elnoMesh.GetBlock(0).GetPointData().GetArray("MyField") + assert(vtkArrToTest.GetNumberOfTuples()==16) + assert(vtkArrToTest.GetNumberOfComponents()==2) + assert(vtkArrToTest.GetComponentName(0)==arr2.getInfoOnComponent(0)) + assert(vtkArrToTest.GetComponentName(1)==arr2.getInfoOnComponent(1)) + vals=[vtkArrToTest.GetValue(i) for i in range(32)] + assert(arr2.isEqualWithoutConsideringStr(DataArrayDouble(vals,16,2),1e-12)) + pass + +if __name__ == "__main__": + test() + pass diff --git a/src/Plugins/MEDReader/Test/testMEDReader17.py b/src/Plugins/MEDReader/Test/testMEDReader17.py index 0268efc3..893ff4e1 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader17.py +++ b/src/Plugins/MEDReader/Test/testMEDReader17.py @@ -19,50 +19,60 @@ # # Author : Anthony Geay (EDF R&D) -from MEDLoader import * - -""" This test is a non regression test of EDF9622.""" - -fname="testMEDReader17.med" - -arr=DataArrayDouble([0,1,2]) -m=MEDCouplingCMesh() ; m.setCoords(arr,arr) ; m=m.buildUnstructured() ; m.setName("Mesh") -mm=MEDFileUMesh() ; mm.setMeshAtLevel(0,m) -grp0=DataArrayInt([0,1]) ; grp0.setName("grp0") -grp1=DataArrayInt([2,3]) ; grp1.setName("grp1") -grp2=DataArrayInt([1,2]) ; grp2.setName("grp2") -grp3=DataArrayInt([0,1,2,3]) ; grp3.setName("grp3") -mm.setGroupsAtLevel(0,[grp0,grp1,grp2,grp3]) -f=MEDCouplingFieldDouble(ON_GAUSS_NE) ; f.setMesh(m) ; f.setName("MyField") ; f.setTime(0.,0,0) -arr2=DataArrayDouble(4*4*2) ; arr2.iota() ; arr2.rearrange(2) ; arr2.setInfoOnComponents(["aa","bbb"]) -f.setArray(arr2) ; arr2+=0.1 ; f.checkConsistencyLight() -mm.write(fname,2) -WriteFieldUsingAlreadyWrittenMesh(fname,f) -# +from medcoupling import * from paraview.simple import * from paraview import servermanager +from MEDReaderHelper import WriteInTmpDir,RetriveBaseLine paraview.simple._DisableFirstRenderCameraReset() -reader=MEDReader(FileName=fname) -ExpectedEntries=['TS0/Mesh/ComSup0/MyField@@][@@GSSNE','TS1/Mesh/ComSup0/Mesh@@][@@P0'] -assert(reader.GetProperty("FieldsTreeInfo")[::2]==ExpectedEntries) -reader.AllArrays=['TS0/Mesh/ComSup0/MyField@@][@@GSSNE'] -ExtractGroup1 = ExtractGroup(Input=reader) -#ExtractGroup1.UpdatePipelineInformation() -ExtractGroup1.AllGroups=["GRP_grp1"] -ELNOfieldToPointGaussian1=ELNOfieldToPointGaussian(Input=ExtractGroup1) -ELNOfieldToPointGaussian1.SelectSourceArray=['ELNO@MyField'] -# -ELNOfieldToPointGaussian1=ELNOfieldToPointGaussian(Input=reader) -ELNOfieldToPointGaussian1.SelectSourceArray=['ELNO@MyField'] -ExtractGroup1 = ExtractGroup(Input=ELNOfieldToPointGaussian1) -#ExtractGroup1.UpdatePipelineInformation() -ExtractGroup1.AllGroups=["GRP_grp1"] -#ExtractGroup1.UpdatePipeline() -res=servermanager.Fetch(ExtractGroup1,0) -assert(res.GetBlock(0).GetNumberOfCells()==8) -vtkArrToTest=res.GetBlock(0).GetPointData().GetArray("MyField") -assert(vtkArrToTest.GetNumberOfComponents()==2) -assert(vtkArrToTest.GetNumberOfTuples()==8) -vals=[vtkArrToTest.GetValue(i) for i in range(16)] -assert(DataArrayDouble([(16.1,17.1),(18.1,19.1),(20.1,21.1),(22.1,23.1),(24.1,25.1),(26.1,27.1),(28.1,29.1),(30.1,31.1)]).isEqual(DataArrayDouble(vals,8,2),1e-12)) + +def GenerateCase(): + """ This test is a non regression test of EDF9622.""" + + fname="testMEDReader17.med" + + arr=DataArrayDouble([0,1,2]) + m=MEDCouplingCMesh() ; m.setCoords(arr,arr) ; m=m.buildUnstructured() ; m.setName("Mesh") + mm=MEDFileUMesh() ; mm.setMeshAtLevel(0,m) + grp0=DataArrayInt([0,1]) ; grp0.setName("grp0") + grp1=DataArrayInt([2,3]) ; grp1.setName("grp1") + grp2=DataArrayInt([1,2]) ; grp2.setName("grp2") + grp3=DataArrayInt([0,1,2,3]) ; grp3.setName("grp3") + mm.setGroupsAtLevel(0,[grp0,grp1,grp2,grp3]) + f=MEDCouplingFieldDouble(ON_GAUSS_NE) ; f.setMesh(m) ; f.setName("MyField") ; f.setTime(0.,0,0) + arr2=DataArrayDouble(4*4*2) ; arr2.iota() ; arr2.rearrange(2) ; arr2.setInfoOnComponents(["aa","bbb"]) + f.setArray(arr2) ; arr2+=0.1 ; f.checkConsistencyLight() + mm.write(fname,2) + WriteFieldUsingAlreadyWrittenMesh(fname,f) + return fname + +@WriteInTmpDir +def test(): + fname = GenerateCase() + # + reader=MEDReader(FileName=fname) + ExpectedEntries=['TS0/Mesh/ComSup0/MyField@@][@@GSSNE','TS1/Mesh/ComSup0/Mesh@@][@@P0'] + assert(reader.GetProperty("FieldsTreeInfo")[::2]==ExpectedEntries) + reader.AllArrays=['TS0/Mesh/ComSup0/MyField@@][@@GSSNE'] + ExtractGroup1 = ExtractGroup(Input=reader) + #ExtractGroup1.UpdatePipelineInformation() + ExtractGroup1.AllGroups=["GRP_grp1"] + ELNOfieldToPointGaussian1=ELNOfieldToPointGaussian(Input=ExtractGroup1) + ELNOfieldToPointGaussian1.SelectSourceArray=['ELNO@MyField'] + # + ELNOfieldToPointGaussian1=ELNOfieldToPointGaussian(Input=reader) + ELNOfieldToPointGaussian1.SelectSourceArray=['ELNO@MyField'] + ExtractGroup1 = ExtractGroup(Input=ELNOfieldToPointGaussian1) + #ExtractGroup1.UpdatePipelineInformation() + ExtractGroup1.AllGroups=["GRP_grp1"] + #ExtractGroup1.UpdatePipeline() + res=servermanager.Fetch(ExtractGroup1,0) + assert(res.GetBlock(0).GetNumberOfCells()==8) + vtkArrToTest=res.GetBlock(0).GetPointData().GetArray("MyField") + assert(vtkArrToTest.GetNumberOfComponents()==2) + assert(vtkArrToTest.GetNumberOfTuples()==8) + vals=[vtkArrToTest.GetValue(i) for i in range(16)] + assert(DataArrayDouble([(16.1,17.1),(18.1,19.1),(20.1,21.1),(22.1,23.1),(24.1,25.1),(26.1,27.1),(28.1,29.1),(30.1,31.1)]).isEqual(DataArrayDouble(vals,8,2),1e-12)) + +if __name__ == "__main__": + test() diff --git a/src/Plugins/MEDReader/Test/testMEDReader18.py b/src/Plugins/MEDReader/Test/testMEDReader18.py index 3937a719..fc668781 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader18.py +++ b/src/Plugins/MEDReader/Test/testMEDReader18.py @@ -19,36 +19,48 @@ # # Author : Anthony Geay (EDF R&D) -# Non regression test for bug EDF11343. Extract group on groups mixing cells entities and node entities. -from MEDLoader import * - -fname="testMEDReader18.med" -arr1=DataArrayDouble(5) ; arr1.iota() -arr2=DataArrayDouble([0,1]) -m=MEDCouplingCMesh() ; m.setCoords(arr1,arr2) -m.setName("mesh") -m=m.buildUnstructured() -# -mm=MEDFileUMesh() -mm[0]=m -# -grp0=DataArrayInt([1,2]) ; grp0.setName("grp0") -grp1=DataArrayInt([3,4,8,9]) ; grp1.setName("grp1") -# -mm.addGroup(0,grp0) -mm.addGroup(1,grp1) -# -mm.write(fname,2) -##### +from medcoupling import * from paraview.simple import * +from MEDReaderHelper import WriteInTmpDir,RetriveBaseLine + +def GenerateCase(): + """Non regression test for bug EDF11343. Extract group on groups mixing cells entities and node entities.""" + fname="testMEDReader18.med" + arr1=DataArrayDouble(5) ; arr1.iota() + arr2=DataArrayDouble([0,1]) + m=MEDCouplingCMesh() ; m.setCoords(arr1,arr2) + m.setName("mesh") + m=m.buildUnstructured() + # + mm=MEDFileUMesh() + mm[0]=m + # + grp0=DataArrayInt([1,2]) ; grp0.setName("grp0") + grp1=DataArrayInt([3,4,8,9]) ; grp1.setName("grp1") + # + mm.addGroup(0,grp0) + mm.addGroup(1,grp1) + # + mm.write(fname,2) + return fname + +@WriteInTmpDir +def test(): + fname = GenerateCase() + reader=MEDReader(FileName=fname) + reader.AllArrays=['TS0/mesh/ComSup0/mesh@@][@@P0'] + ExtractGroup1 = ExtractGroup(Input=reader) + ExtractGroup1.AllGroups=["GRP_grp0","GRP_grp1"] + #ExtractGroup1.UpdatePipelineInformation() + res=servermanager.Fetch(ExtractGroup1,0) + assert(res.GetNumberOfBlocks()==2) + assert(res.GetBlock(1).GetNumberOfCells()==1) + assert(res.GetBlock(0).GetNumberOfCells()==2) + pass + +if __name__ == "__main__": + test() + pass + -reader=MEDReader(FileName=fname) -reader.AllArrays=['TS0/mesh/ComSup0/mesh@@][@@P0'] -ExtractGroup1 = ExtractGroup(Input=reader) -ExtractGroup1.AllGroups=["GRP_grp0","GRP_grp1"] -#ExtractGroup1.UpdatePipelineInformation() -res=servermanager.Fetch(ExtractGroup1,0) -assert(res.GetNumberOfBlocks()==2) -assert(res.GetBlock(1).GetNumberOfCells()==1) -assert(res.GetBlock(0).GetNumberOfCells()==2) diff --git a/src/Plugins/MEDReader/Test/testMEDReader19.py b/src/Plugins/MEDReader/Test/testMEDReader19.py index ac689b70..0b476e1f 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader19.py +++ b/src/Plugins/MEDReader/Test/testMEDReader19.py @@ -22,84 +22,86 @@ 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) -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 medcoupling import * from paraview.simple import * -import vtk.test.Testing # this line must be here. If not SIGSEGV ! KW10658 +from MEDReaderHelper import WriteInTmpDir,RetriveBaseLine +#### import the simple module from the paraview #### 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'] +import vtk.test.Testing # this line must be here. If not SIGSEGV ! KW10658 + +def GenerateCase(): + """ 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" + 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) + return fname + +@WriteInTmpDir +def test(baseline_file): + fname = GenerateCase() + # 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'] + + if '-D' not in sys.argv: + # 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 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() +if __name__ == "__main__": + imgName="testMEDReader19.png" + baseline_file = RetriveBaseLine(imgName) + test(baseline_file) diff --git a/src/Plugins/MEDReader/Test/testMEDReader2.py b/src/Plugins/MEDReader/Test/testMEDReader2.py index 38d5f4c3..5374a13d 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader2.py +++ b/src/Plugins/MEDReader/Test/testMEDReader2.py @@ -22,103 +22,104 @@ import os import sys -from MEDLoader import * - -fname="testMEDReader2.med" -outImgName="testMEDReader2.png" - -""" This use case is a mesh containing a large number of orphan cells (cells having no field lying on them) -""" -######### -arrX=DataArrayDouble(7) ; arrX.iota() -arrY=DataArrayDouble(7) ; arrY.iota() -arrZ=DataArrayDouble(7) ; arrZ.iota() -m=MEDCouplingCMesh() -m.setCoords(arrX,arrY,arrZ) -m=m.buildUnstructured() ; m.setName("mesh") -tmp=m[3*36:4*36] -tmp=tmp.buildDescendingConnectivity()[0] -nodeIds=tmp.findNodesOnPlane([0.,0.,3.],[0.,0.,1.],1e-12) -cellIds=tmp.getCellIdsLyingOnNodes(nodeIds,True) -m1=tmp[cellIds] -mm=MEDFileUMesh() -mm.setMeshAtLevel(0,m) -mm.setMeshAtLevel(-1,m1) -mm.write(fname,2) -# -pfl=DataArrayInt([7,8,9,10,13,14,15,16,19,20,21,22,25,26,27,28]) ; pfl.setName("pfl") -f=MEDCouplingFieldDouble(ON_CELLS) ; f.setName("ACellField") -arr=DataArrayDouble(16) ; arr.iota() -arr2=arr.deepCopy() ; arr2.reverse() -arr=DataArrayDouble.Meld(arr,arr2) ; arr.setInfoOnComponents(["aa","bbb"]) -f.setArray(arr) -f1ts=MEDFileField1TS() -f1ts.setFieldProfile(f,mm,-1,pfl) -f1ts.write(fname,0) +from medcoupling import * +from paraview.simple import * +from MEDReaderHelper import WriteInTmpDir,RetriveBaseLine -################### MED write is done -> Go to MEDReader +def GenerateCase(): + """ This use case is a mesh containing a large number of orphan cells (cells having no field lying on them) + """ + fname="testMEDReader2.med" + ######### + arrX=DataArrayDouble(7) ; arrX.iota() + arrY=DataArrayDouble(7) ; arrY.iota() + arrZ=DataArrayDouble(7) ; arrZ.iota() + m=MEDCouplingCMesh() + m.setCoords(arrX,arrY,arrZ) + m=m.buildUnstructured() ; m.setName("mesh") + tmp=m[3*36:4*36] + tmp=tmp.buildDescendingConnectivity()[0] + nodeIds=tmp.findNodesOnPlane([0.,0.,3.],[0.,0.,1.],1e-12) + cellIds=tmp.getCellIdsLyingOnNodes(nodeIds,True) + m1=tmp[cellIds] + mm=MEDFileUMesh() + mm.setMeshAtLevel(0,m) + mm.setMeshAtLevel(-1,m1) + mm.write(fname,2) + # + pfl=DataArrayInt([7,8,9,10,13,14,15,16,19,20,21,22,25,26,27,28]) ; pfl.setName("pfl") + f=MEDCouplingFieldDouble(ON_CELLS) ; f.setName("ACellField") + arr=DataArrayDouble(16) ; arr.iota() + arr2=arr.deepCopy() ; arr2.reverse() + arr=DataArrayDouble.Meld(arr,arr2) ; arr.setInfoOnComponents(["aa","bbb"]) + f.setArray(arr) + f1ts=MEDFileField1TS() + f1ts.setFieldProfile(f,mm,-1,pfl) + f1ts.write(fname,0) + return fname -from paraview.simple import * +@WriteInTmpDir +def test(baseline_file): + fname = GenerateCase() + ################### MED write is done -> Go to MEDReader + testMEDReader1=MEDReader(FileName=fname) + testMEDReader1.AllArrays=['TS0/mesh/ComSup0/ACellField@@][@@P0'] + testMEDReader2=MEDReader(FileName=fname) + testMEDReader2.AllArrays=['TS0/mesh/ComSup1/mesh@@][@@P0'] + GroupDatasets1=GroupDatasets(Input=[testMEDReader1,testMEDReader2]) -testMEDReader1=MEDReader(FileName=fname) -testMEDReader1.AllArrays=['TS0/mesh/ComSup0/ACellField@@][@@P0'] -testMEDReader2=MEDReader(FileName=fname) -testMEDReader2.AllArrays=['TS0/mesh/ComSup1/mesh@@][@@P0'] -GroupDatasets1=GroupDatasets(Input=[testMEDReader1,testMEDReader2]) + Clip1 = Clip(ClipType="Plane",Input=GroupDatasets1) + Clip1.Scalars=['FamilyIdCell'] + Clip1.ClipType.Origin=[3.0, 3.0, 3.0] + Clip1.Invert=1 + Clip1.ClipType.Normal=[0.9255623174457069, 0.0027407477590518157, 0.378585373233375] + Clip1.Scalars=['CELLS'] -Clip1 = Clip(ClipType="Plane",Input=GroupDatasets1) -Clip1.Scalars=['FamilyIdCell'] -Clip1.ClipType.Origin=[3.0, 3.0, 3.0] -Clip1.Invert=1 -Clip1.ClipType.Normal=[0.9255623174457069, 0.0027407477590518157, 0.378585373233375] -Clip1.Scalars=['CELLS'] + DataRepresentation4 = Show() + DataRepresentation4.EdgeColor = [0.0, 0.0, 0.5000076295109483] + DataRepresentation4.SelectionCellFieldDataArrayName = 'ACellField' + DataRepresentation4.ScalarOpacityUnitDistance = 1.61104723630366 + DataRepresentation4.ExtractedBlockIndex = 2 + DataRepresentation4.ScaleFactor = 0.6000000000000001 + DataRepresentation4.Visibility = 1 + DataRepresentation4.Representation = 'Wireframe' -DataRepresentation4 = Show() -DataRepresentation4.EdgeColor = [0.0, 0.0, 0.5000076295109483] -DataRepresentation4.SelectionCellFieldDataArrayName = 'ACellField' -DataRepresentation4.ScalarOpacityUnitDistance = 1.61104723630366 -DataRepresentation4.ExtractedBlockIndex = 2 -DataRepresentation4.ScaleFactor = 0.6000000000000001 -DataRepresentation4.Visibility = 1 -DataRepresentation4.Representation = 'Wireframe' + ExtractBlock1 = ExtractBlock(Input=Clip1) + ExtractBlock1.BlockIndices=[1, 2] -ExtractBlock1 = ExtractBlock(Input=Clip1) -ExtractBlock1.BlockIndices=[1, 2] + DataRepresentation5 = Show() + DataRepresentation5.EdgeColor = [0.0, 0.0, 0.5000076295109483] + DataRepresentation5.SelectionCellFieldDataArrayName = 'FamilyIdCell' + DataRepresentation5.ScaleFactor = 0.6 + a2_ACellField_PVLookupTable=GetLookupTableForArray( "ACellField", 2, RGBPoints=[10.63014581273465, 0.23, 0.299, 0.754, 15.0, 0.706, 0.016, 0.15], VectorMode='Magnitude', NanColor=[0.25, 0.0, 0.0], ColorSpace='Diverging', ScalarRangeInitialized=1.0, AllowDuplicateScalars=1 ) + a2_ACellField_PiecewiseFunction=CreatePiecewiseFunction( Points=[0.0, 0.0, 0.5, 0.0, 1.0, 1.0, 0.5, 0.0] ) + a2_ACellField_PVLookupTable.ScalarOpacityFunction = a2_ACellField_PiecewiseFunction + DataRepresentation5.ScalarOpacityFunction = a2_ACellField_PiecewiseFunction + DataRepresentation5.LookupTable = a2_ACellField_PVLookupTable + DataRepresentation5.ColorArrayName = ("CELLS", "ACellField") -DataRepresentation5 = Show() -DataRepresentation5.EdgeColor = [0.0, 0.0, 0.5000076295109483] -DataRepresentation5.SelectionCellFieldDataArrayName = 'FamilyIdCell' -DataRepresentation5.ScaleFactor = 0.6 -a2_ACellField_PVLookupTable=GetLookupTableForArray( "ACellField", 2, RGBPoints=[10.63014581273465, 0.23, 0.299, 0.754, 15.0, 0.706, 0.016, 0.15], VectorMode='Magnitude', NanColor=[0.25, 0.0, 0.0], ColorSpace='Diverging', ScalarRangeInitialized=1.0, AllowDuplicateScalars=1 ) -a2_ACellField_PiecewiseFunction=CreatePiecewiseFunction( Points=[0.0, 0.0, 0.5, 0.0, 1.0, 1.0, 0.5, 0.0] ) -a2_ACellField_PVLookupTable.ScalarOpacityFunction = a2_ACellField_PiecewiseFunction -DataRepresentation5.ScalarOpacityFunction = a2_ACellField_PiecewiseFunction -DataRepresentation5.LookupTable = a2_ACellField_PVLookupTable -DataRepresentation5.ColorArrayName = ("CELLS", "ACellField") + 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] -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 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() +if __name__ == "__main__": + outImgName="testMEDReader2.png" + baseline_file = RetriveBaseLine(outImgName) + test(baseline_file) + pass diff --git a/src/Plugins/MEDReader/Test/testMEDReader20.py b/src/Plugins/MEDReader/Test/testMEDReader20.py index 1374c086..b8447ce1 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader20.py +++ b/src/Plugins/MEDReader/Test/testMEDReader20.py @@ -27,130 +27,136 @@ import os import sys -from MEDLoader import * - -fname="testMEDReader20.med" -png="testMEDReader20.png" -nb=10 -arrX=DataArrayDouble(nb+1) ; arrX.iota() -arrY=DataArrayDouble([0.,1.]) -m=MEDCouplingCMesh() ; m.setCoords(arrX,arrY) ; m=m.buildUnstructured(); m.setName("mesh") ; m.simplexize(0) -mm=MEDFileUMesh() ; mm[0]=m -m1=m.computeSkin() ; mm[-1]=m1 -# -f0=DataArrayInt(m1.getNumberOfCells()) ; f0.iota() ; mm.setFamilyFieldArr(-1,f0) -f1=DataArrayInt(m1.getNumberOfNodes()) ; f1.iota() ; mm.setFamilyFieldArr(1,f1) # <- very important the bug can be shown here -# -nbCells=m1.getNumberOfCells() ; nbNodes=m.getNumberOfNodes() -mm.write(fname,2) -for i in range(5): - f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(m) - f.setName("Field") - arr=DataArrayInt(2*nb) ; arr.iota(i) ; arr%=nb ; arr=arr.convertToDblArr() - f.setArray(arr) ; f.setTime(float(i),i,0) - WriteFieldUsingAlreadyWrittenMesh(fname,f) - # - f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(m1) - f.setName("Field") - arr=DataArrayInt(nbCells) ; arr.iota(i) ; arr%=nbCells ; arr=arr.convertToDblArr() - f.setArray(arr) ; f.setTime(float(i),i,0) - WriteFieldUsingAlreadyWrittenMesh(fname,f) - # - f=MEDCouplingFieldDouble(ON_NODES) ; f.setMesh(m) - f.setName("FieldNode") - arr=DataArrayDouble(nbNodes) ; arr[:]=float(i) - f.setArray(arr) ; f.setTime(float(i),i,0) - WriteFieldUsingAlreadyWrittenMesh(fname,f) - pass -##################### +from medcoupling import * from paraview.simple import * +from MEDReaderHelper import WriteInTmpDir,RetriveBaseLine + #### disable automatic camera reset on 'Show' paraview.simple._DisableFirstRenderCameraReset() -# create a new 'MED Reader' -testMEDReader20med = MEDReader(FileName=fname) -testMEDReader20med.AllArrays = ['TS0/mesh/ComSup0/Field@@][@@P0'] -testMEDReader20med.AllTimeSteps = ['0000', '0001', '0002', '0003', '0004'] - -# get animation scene -animationScene1 = GetAnimationScene() - -# update animation scene based on data timesteps -animationScene1.UpdateAnimationUsingDataTimeSteps() - -if '-D' not in sys.argv: - # 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 - - # reset view to fit data - renderView1.ResetCamera() - - #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] - - # set scalar coloring - ColorBy(testMEDReader20medDisplay, ('CELLS', 'Field')) - - # rescale color and/or opacity maps used to include current data range - testMEDReader20medDisplay.RescaleTransferFunctionToDataRange(True) - - # do not show color bar/color legend - testMEDReader20medDisplay.SetScalarBarVisibility(renderView1, False) - - # get color transfer function/color map for 'Field' - fieldLUT = GetColorTransferFunction('Field') - - # get opacity transfer function/opacity map for 'Field' - fieldPWF = GetOpacityTransferFunction('Field') - - animationScene1.GoToNext() # <- very important to see the bug play with time steps... - animationScene1.GoToNext() - animationScene1.GoToNext() - animationScene1.GoToNext() - animationScene1.GoToPrevious() - animationScene1.GoToPrevious() - - # 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 - +def GenerateCase(): + fname="testMEDReader20.med" + nb=10 + arrX=DataArrayDouble(nb+1) ; arrX.iota() + arrY=DataArrayDouble([0.,1.]) + m=MEDCouplingCMesh() ; m.setCoords(arrX,arrY) ; m=m.buildUnstructured(); m.setName("mesh") ; m.simplexize(0) + mm=MEDFileUMesh() ; mm[0]=m + m1=m.computeSkin() ; mm[-1]=m1 # - - 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() + f0=DataArrayInt(m1.getNumberOfCells()) ; f0.iota() ; mm.setFamilyFieldArr(-1,f0) + f1=DataArrayInt(m1.getNumberOfNodes()) ; f1.iota() ; mm.setFamilyFieldArr(1,f1) # <- very important the bug can be shown here + # + nbCells=m1.getNumberOfCells() ; nbNodes=m.getNumberOfNodes() + mm.write(fname,2) + for i in range(5): + f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(m) + f.setName("Field") + arr=DataArrayInt(2*nb) ; arr.iota(i) ; arr%=nb ; arr=arr.convertToDblArr() + f.setArray(arr) ; f.setTime(float(i),i,0) + WriteFieldUsingAlreadyWrittenMesh(fname,f) + # + f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(m1) + f.setName("Field") + arr=DataArrayInt(nbCells) ; arr.iota(i) ; arr%=nbCells ; arr=arr.convertToDblArr() + f.setArray(arr) ; f.setTime(float(i),i,0) + WriteFieldUsingAlreadyWrittenMesh(fname,f) + # + f=MEDCouplingFieldDouble(ON_NODES) ; f.setMesh(m) + f.setName("FieldNode") + arr=DataArrayDouble(nbNodes) ; arr[:]=float(i) + f.setArray(arr) ; f.setTime(float(i),i,0) + WriteFieldUsingAlreadyWrittenMesh(fname,f) + pass + return fname + +@WriteInTmpDir +def test(baseline_file): + fname = GenerateCase() + ##################### + # create a new 'MED Reader' + testMEDReader20med = MEDReader(FileName=fname) + testMEDReader20med.AllArrays = ['TS0/mesh/ComSup0/Field@@][@@P0'] + testMEDReader20med.AllTimeSteps = ['0000', '0001', '0002', '0003', '0004'] + + # get animation scene + animationScene1 = GetAnimationScene() + + # update animation scene based on data timesteps + animationScene1.UpdateAnimationUsingDataTimeSteps() + + if '-D' not in sys.argv: + # 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 + + # reset view to fit data + renderView1.ResetCamera() + + #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] + + # set scalar coloring + ColorBy(testMEDReader20medDisplay, ('CELLS', 'Field')) + + # rescale color and/or opacity maps used to include current data range + testMEDReader20medDisplay.RescaleTransferFunctionToDataRange(True) + + # do not show color bar/color legend + testMEDReader20medDisplay.SetScalarBarVisibility(renderView1, False) + + # get color transfer function/color map for 'Field' + fieldLUT = GetColorTransferFunction('Field') + + # get opacity transfer function/opacity map for 'Field' + fieldPWF = GetOpacityTransferFunction('Field') + + animationScene1.GoToNext() # <- very important to see the bug play with time steps... + animationScene1.GoToNext() + animationScene1.GoToNext() + animationScene1.GoToNext() + animationScene1.GoToPrevious() + animationScene1.GoToPrevious() + + # 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 + + # + + 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 + 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() + pass + +if __name__ == "__main__": + outImgName="testMEDReader20.png" + baseline_file = RetriveBaseLine(outImgName) + test(baseline_file) + pass diff --git a/src/Plugins/MEDReader/Test/testMEDReader21.py b/src/Plugins/MEDReader/Test/testMEDReader21.py index dc6633e3..133fee3d 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader21.py +++ b/src/Plugins/MEDReader/Test/testMEDReader21.py @@ -22,146 +22,150 @@ import os import sys +from medcoupling import * from paraview.simple import * +from MEDReaderHelper import WriteInTmpDir,RetriveBaseLine + +def GenerateCase(): + """ This is a non regression EDF12599""" + fname="testMEDReader21.med" + fieldName="MyField" + meshName="mesh" + m=MEDFileUMesh() + m0=MEDCouplingUMesh(meshName,1) + m0.setCoords(DataArrayDouble([(0.,0.,0),(1.,0.,0.),(2.,0.,0.)])) + m0.allocateCells() + m0.insertNextCell(NORM_SEG2,[0,1]) + m0.insertNextCell(NORM_SEG2,[1,2]) + m[0]=m0 + # + f=MEDCouplingFieldDouble(ON_GAUSS_NE) ; f.setName(fieldName) + f.setMesh(m0) ; f.setArray(DataArrayDouble([1.,7.,3.,2.])) + WriteField(fname,f,True) + return fname, meshName, fieldName + +@WriteInTmpDir +def test(baseline_file): + fname, meshName, fieldName = GenerateCase() + ######## + testTotomed = MEDReader(FileName=fname) + testTotomed.AllArrays = ['TS0/%s/ComSup0/%s@@][@@GSSNE'%(meshName,fieldName)] + testTotomed.AllTimeSteps = ['0000'] + + if '-D' not in sys.argv: + # 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) + + # 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 = [] + glyph1.OrientationArray = ['POINTS', 'No orientation array'] + glyph1.ScaleFactor = 0.15000000000000002 + glyph1.GlyphTransform = 'Transform2' + + # Properties modified on glyph1 + glyph1.GlyphType = 'Sphere' + glyph1.ScaleFactor = 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 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() -from MEDLoader import * - -""" This is a non regression EDF12599""" -fname="testMEDReader21.med" -imgName="testMEDReader21.png" -fieldName="MyField" -meshName="mesh" -m=MEDFileUMesh() -m0=MEDCouplingUMesh(meshName,1) -m0.setCoords(DataArrayDouble([(0.,0.,0),(1.,0.,0.),(2.,0.,0.)])) -m0.allocateCells() -m0.insertNextCell(NORM_SEG2,[0,1]) -m0.insertNextCell(NORM_SEG2,[1,2]) -m[0]=m0 -# -f=MEDCouplingFieldDouble(ON_GAUSS_NE) ; f.setName(fieldName) -f.setMesh(m0) ; f.setArray(DataArrayDouble([1.,7.,3.,2.])) -WriteField(fname,f,True) -######## -testTotomed = MEDReader(FileName=fname) -testTotomed.AllArrays = ['TS0/%s/ComSup0/%s@@][@@GSSNE'%(meshName,fieldName)] -testTotomed.AllTimeSteps = ['0000'] - -if '-D' not in sys.argv: - # 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) - - # 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 = [] - glyph1.OrientationArray = ['POINTS', 'No orientation array'] - glyph1.ScaleFactor = 0.15000000000000002 - glyph1.GlyphTransform = 'Transform2' - - # Properties modified on glyph1 - glyph1.GlyphType = 'Sphere' - glyph1.ScaleFactor = 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() +if __name__ == "__main__": + imgName="testMEDReader21.png" + baseline_file = RetriveBaseLine(imgName) + test(baseline_file) + pass diff --git a/src/Plugins/MEDReader/Test/testMEDReader3.py b/src/Plugins/MEDReader/Test/testMEDReader3.py index 82c1c50b..a3ffac6e 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader3.py +++ b/src/Plugins/MEDReader/Test/testMEDReader3.py @@ -22,125 +22,127 @@ import os import sys -from MEDLoader import * - -fname="testMEDReader3.med" -outImgName="testMEDReader3.png" - -""" This test checks that invalid double time (not in [-1e299:1e299]) - leads MEDReader to takes iteration numbers instead of double time to discriminate timesteps each other - See EDF 1956. -""" -######### - -m=MEDCouplingUMesh("mesh",2) -coords=DataArrayDouble([(0.,0.,0.),(1.,0.,0.),(1.,1.,0.),(0.,1.,0.)],4,3) -m.setCoords(coords) -m.allocateCells() -m.insertNextCell(NORM_QUAD4,[0,3,2,1]) -mm=MEDFileUMesh() -mm.setMeshAtLevel(0,m) -mm.write(fname,2) -fmts=MEDFileFieldMultiTS() -# -f=MEDCouplingFieldDouble(ON_NODES) ; f.setName("ANodeField") -f.setTime(1.7976931348623157e+308,1,1) ; f.setMesh(m) -arr=DataArrayDouble([0.,4.,4.,4.]) ; arr.setInfoOnComponent(0,"aaa") -f.setArray(arr) -f1ts=MEDFileField1TS() -f1ts.setFieldNoProfileSBT(f) -fmts.pushBackTimeStep(f1ts) -# -f.setTime(1.7976931348623157e+308,2,2) -arr=DataArrayDouble([1.,4.,4.,4.]) ; arr.setInfoOnComponent(0,"aaa") -f.setArray(arr) -f1ts=MEDFileField1TS() -f1ts.setFieldNoProfileSBT(f) -fmts.pushBackTimeStep(f1ts) -# -f.setTime(1.7976931348623157e+308,3,3) -arr=DataArrayDouble([2.,4.,4.,4.]) ; arr.setInfoOnComponent(0,"aaa") -f.setArray(arr) -f1ts=MEDFileField1TS() -f1ts.setFieldNoProfileSBT(f) -fmts.pushBackTimeStep(f1ts) -# -f.setTime(1.7976931348623157e+308,4,6) -arr=DataArrayDouble([3.,4.,4.,4.]) ; arr.setInfoOnComponent(0,"aaa") -f.setArray(arr) -f1ts=MEDFileField1TS() -f1ts.setFieldNoProfileSBT(f) -fmts.pushBackTimeStep(f1ts) -# -f.setTime(1.7976931348623157e+308,5,7) -arr=DataArrayDouble([4.,4.,4.,4.]) ; arr.setInfoOnComponent(0,"aaa") -f.setArray(arr) -f1ts=MEDFileField1TS() -f1ts.setFieldNoProfileSBT(f) -fmts.pushBackTimeStep(f1ts) -# -fmts.write(fname,0) - -################### MED write is done -> Go to MEDReader - +from medcoupling import * from paraview.simple import * +from MEDReaderHelper import WriteInTmpDir,RetriveBaseLine -AnimationScene1=GetAnimationScene() -AnimationScene1.PlayMode='Snap To TimeSteps' -AnimationScene1.EndTime = 2.0 -AnimationScene1.AnimationTime = 1.0 -AnimationScene1.StartTime = 1.0 - -testMEDReader3=MEDReader(FileName=fname) -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. - -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() - ### +outImgName="testMEDReader3.png" - # 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() +def GenerateCase(): + """ This test checks that invalid double time (not in [-1e299:1e299]) + leads MEDReader to takes iteration numbers instead of double time to discriminate timesteps each other + See EDF 1956. + """ + fname="testMEDReader3.med" + ######### + m=MEDCouplingUMesh("mesh",2) + coords=DataArrayDouble([(0.,0.,0.),(1.,0.,0.),(1.,1.,0.),(0.,1.,0.)],4,3) + m.setCoords(coords) + m.allocateCells() + m.insertNextCell(NORM_QUAD4,[0,3,2,1]) + mm=MEDFileUMesh() + mm.setMeshAtLevel(0,m) + mm.write(fname,2) + fmts=MEDFileFieldMultiTS() + # + f=MEDCouplingFieldDouble(ON_NODES) ; f.setName("ANodeField") + f.setTime(1.7976931348623157e+308,1,1) ; f.setMesh(m) + arr=DataArrayDouble([0.,4.,4.,4.]) ; arr.setInfoOnComponent(0,"aaa") + f.setArray(arr) + f1ts=MEDFileField1TS() + f1ts.setFieldNoProfileSBT(f) + fmts.pushBackTimeStep(f1ts) + # + f.setTime(1.7976931348623157e+308,2,2) + arr=DataArrayDouble([1.,4.,4.,4.]) ; arr.setInfoOnComponent(0,"aaa") + f.setArray(arr) + f1ts=MEDFileField1TS() + f1ts.setFieldNoProfileSBT(f) + fmts.pushBackTimeStep(f1ts) + # + f.setTime(1.7976931348623157e+308,3,3) + arr=DataArrayDouble([2.,4.,4.,4.]) ; arr.setInfoOnComponent(0,"aaa") + f.setArray(arr) + f1ts=MEDFileField1TS() + f1ts.setFieldNoProfileSBT(f) + fmts.pushBackTimeStep(f1ts) + # + f.setTime(1.7976931348623157e+308,4,6) + arr=DataArrayDouble([3.,4.,4.,4.]) ; arr.setInfoOnComponent(0,"aaa") + f.setArray(arr) + f1ts=MEDFileField1TS() + f1ts.setFieldNoProfileSBT(f) + fmts.pushBackTimeStep(f1ts) + # + f.setTime(1.7976931348623157e+308,5,7) + arr=DataArrayDouble([4.,4.,4.,4.]) ; arr.setInfoOnComponent(0,"aaa") + f.setArray(arr) + f1ts=MEDFileField1TS() + f1ts.setFieldNoProfileSBT(f) + fmts.pushBackTimeStep(f1ts) + # + fmts.write(fname,0) + return fname + +@WriteInTmpDir +def test(baseline_file): + fname = GenerateCase() + ################### MED write is done -> Go to MEDReader + AnimationScene1=GetAnimationScene() + AnimationScene1.PlayMode='Snap To TimeSteps' + AnimationScene1.EndTime = 2.0 + AnimationScene1.AnimationTime = 1.0 + AnimationScene1.StartTime = 1.0 + + testMEDReader3=MEDReader(FileName=fname) + 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. + + 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 + 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 __name__ == "__main__": + outImgName="testMEDReader3.png" + baseline_file = RetriveBaseLine(outImgName) + test(baseline_file) + pass diff --git a/src/Plugins/MEDReader/Test/testMEDReader4.py b/src/Plugins/MEDReader/Test/testMEDReader4.py index d33a923b..4253bb39 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader4.py +++ b/src/Plugins/MEDReader/Test/testMEDReader4.py @@ -22,93 +22,97 @@ import os import sys -from MEDLoader import * +from medcoupling import * +from paraview.simple import * +from MEDReaderHelper import WriteInTmpDir,RetriveBaseLine -""" This test checks that umeshes with no names work properly. -""" +def GenerateCase(): + """ This test checks that umeshes with no names work properly. + """ -fname="testMEDReader4.med" -outImgName="testMEDReader4.png" -######### -coords=DataArrayDouble([(0.,0.,0.),(1.,0.,0.),(2.,0.,0.),(3.,0.,0.),(0.,1.,0.),(1.,1.,0.),(2.,1.,0.),(3.,1.,0.),(0.,2.,0.),(1.,2.,0.),(2.,2.,0.),(3.,2.,0.),(0.,3.,0.),(1.,3.,0.),(2.,3.,0.),(3.,3.,0.)]) -m0=MEDCouplingUMesh("mesh",2) -m0.allocateCells() -m0.setCoords(coords) -## -mm=MEDFileUMesh() -mm.setMeshAtLevel(0,m0) -mm.setFamilyFieldArr(1,DataArrayInt([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])) -# -f1ts0=MEDFileField1TS() -f1ts1=MEDFileField1TS() -# -f0=MEDCouplingFieldDouble(ON_NODES) ; f0.setMesh(m0) ; f0.setName("f0NoPfl") -arr0=DataArrayDouble([0.,1.,2.,3.,1.,1.5,2.2,3.1,2.,2.2,3.,3.1,3.,3.1,3.5,4.]) -f0.setArray(arr0) -f0.checkConsistencyLight() -f1ts0.setFieldNoProfileSBT(f0) -# -pfl1=DataArrayInt([0,1,2,3,4,5,6,8,9,12]) ; pfl1.setName("pfl1") -f1=MEDCouplingFieldDouble(ON_NODES) ; f1.setName("f1Pfl") -arr1=DataArrayDouble([3.,2.,1.,0.,2.,1.5,0.,1.,0.,0.2]) -f1.setArray(arr1) -f1ts1.setFieldProfile(f1,mm,0,pfl1) -# -fs=MEDFileFields() -fmts0=MEDFileFieldMultiTS() -fmts0.pushBackTimeStep(f1ts0) -fmts1=MEDFileFieldMultiTS() -fmts1.pushBackTimeStep(f1ts1) -fs.pushField(fmts0) ; fs.pushField(fmts1) -mm.write(fname,2) -fs.write(fname,0) + fname="testMEDReader4.med" + ######### + coords=DataArrayDouble([(0.,0.,0.),(1.,0.,0.),(2.,0.,0.),(3.,0.,0.),(0.,1.,0.),(1.,1.,0.),(2.,1.,0.),(3.,1.,0.),(0.,2.,0.),(1.,2.,0.),(2.,2.,0.),(3.,2.,0.),(0.,3.,0.),(1.,3.,0.),(2.,3.,0.),(3.,3.,0.)]) + m0=MEDCouplingUMesh("mesh",2) + m0.allocateCells() + m0.setCoords(coords) + ## + mm=MEDFileUMesh() + mm.setMeshAtLevel(0,m0) + mm.setFamilyFieldArr(1,DataArrayInt([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])) + # + f1ts0=MEDFileField1TS() + f1ts1=MEDFileField1TS() + # + f0=MEDCouplingFieldDouble(ON_NODES) ; f0.setMesh(m0) ; f0.setName("f0NoPfl") + arr0=DataArrayDouble([0.,1.,2.,3.,1.,1.5,2.2,3.1,2.,2.2,3.,3.1,3.,3.1,3.5,4.]) + f0.setArray(arr0) + f0.checkConsistencyLight() + f1ts0.setFieldNoProfileSBT(f0) + # + pfl1=DataArrayInt([0,1,2,3,4,5,6,8,9,12]) ; pfl1.setName("pfl1") + f1=MEDCouplingFieldDouble(ON_NODES) ; f1.setName("f1Pfl") + arr1=DataArrayDouble([3.,2.,1.,0.,2.,1.5,0.,1.,0.,0.2]) + f1.setArray(arr1) + f1ts1.setFieldProfile(f1,mm,0,pfl1) + # + fs=MEDFileFields() + fmts0=MEDFileFieldMultiTS() + fmts0.pushBackTimeStep(f1ts0) + fmts1=MEDFileFieldMultiTS() + fmts1.pushBackTimeStep(f1ts1) + fs.pushField(fmts0) ; fs.pushField(fmts1) + mm.write(fname,2) + fs.write(fname,0) + return fname + +@WriteInTmpDir +def test(baseline_file): ################### MED write is done -> Go to MEDReader + fname = GenerateCase() -from paraview.simple import * + testMEDReader4_med=MEDReader(FileName=fname) -testMEDReader4_med=MEDReader(FileName=fname) + testMEDReader4_med.AllArrays=['TS0/mesh/ComSup0/f0NoPfl@@][@@P1','TS0/mesh/ComSup0/mesh@@][@@P1'] + #testMEDReader4_med.AllTimeSteps=['0000'] -testMEDReader4_med.AllArrays=['TS0/mesh/ComSup0/f0NoPfl@@][@@P1','TS0/mesh/ComSup0/mesh@@][@@P1'] -#testMEDReader4_med.AllTimeSteps=['0000'] + Glyph1=Glyph(Input=testMEDReader4_med,GlyphType='Sphere') + Glyph1.ScaleArray=['POINTS','No scale array']#f0NoPflN + Glyph1.ScaleFactor=0.3 + Glyph1.OrientationArray = ['POINTS', 'No orientation array'] + Glyph1.GlyphTransform="Transform2" + Glyph1.GlyphMode = 'All Points' -Glyph1=Glyph(Input=testMEDReader4_med,GlyphType='Sphere') -Glyph1.ScaleArray=['POINTS','No scale array']#f0NoPflN -Glyph1.ScaleFactor=0.3 -Glyph1.OrientationArray = ['POINTS', 'No orientation array'] -Glyph1.GlyphTransform="Transform2" -Glyph1.GlyphMode = 'All Points' + DataRepresentation1 = Show() + DataRepresentation1.EdgeColor = [0.0, 0.0, 0.5000076295109483] + DataRepresentation1.SelectionPointFieldDataArrayName = 'f0NoPfl' + DataRepresentation1.ScaleFactor = 0.3 + DataRepresentation1.ColorArrayName = 'f0NoPfl' + lookupTable = GetLookupTableForArray( "f0NoPfl", 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 ) + 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 -DataRepresentation1 = Show() -DataRepresentation1.EdgeColor = [0.0, 0.0, 0.5000076295109483] -DataRepresentation1.SelectionPointFieldDataArrayName = 'f0NoPfl' -DataRepresentation1.ScaleFactor = 0.3 -DataRepresentation1.ColorArrayName = 'f0NoPfl' -lookupTable = GetLookupTableForArray( "f0NoPfl", 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 ) -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 + 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 -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 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() +if __name__ == "__main__": + outImgName="testMEDReader4.png" + baseline_file = RetriveBaseLine(outImgName) + test(baseline_file) + pass diff --git a/src/Plugins/MEDReader/Test/testMEDReader5.py b/src/Plugins/MEDReader/Test/testMEDReader5.py index 59c54a5d..f278a8e2 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader5.py +++ b/src/Plugins/MEDReader/Test/testMEDReader5.py @@ -22,109 +22,113 @@ import os import sys -from MEDLoader import * - -""" This test is CEA specific one. It generates a .sauv file -that is then read by MEDReader -""" - -fname="testMEDReader5.sauv" -outImgName="testMEDReader5.png" -######### -arr=DataArrayDouble(5) ; arr.iota() -c=MEDCouplingCMesh("mesh") -c.setCoords(arr,arr,arr) -m=c.buildUnstructured() -mbis=m.deepCopy() ; mbis.translate([5,0,0]) ; mbis.tetrahedrize(PLANAR_FACE_5) -m=MEDCouplingUMesh.MergeUMeshes([mbis,m]) ; m.setName(c.getName()) -mm=MEDFileUMesh() -mm.setMeshAtLevel(0,m) -grp0=DataArrayInt.Range(0,m.getNumberOfCells(),2) ; grp0.setName("grp0") -grp1=DataArrayInt.Range(1,m.getNumberOfCells(),2) ; grp1.setName("grp1") -grp2=DataArrayInt.Range(0,m.getNumberOfNodes(),7) ; grp2.setName("grp2") -mm.setGroupsAtLevel(0,[grp0,grp1]) -mm.setGroupsAtLevel(1,[grp2]) -ms=MEDFileMeshes() -ms.pushMesh(mm) -f=MEDCouplingFieldDouble(ON_CELLS) ; f.setName("fCell") ; f.setMesh(m[:10]) -arr=DataArrayDouble(f.getNumberOfTuplesExpected()) ; arr.iota() ; f.setArray(arr) -f2=MEDCouplingFieldDouble(ON_NODES) ; f2.setName("fNode") ; f2.setMesh(m) -arr=DataArrayDouble(f2.getNumberOfTuplesExpected()) ; arr.iota() ; f2.setArray(arr) +from medcoupling import * +from paraview.simple import * +from MEDReaderHelper import WriteInTmpDir,RetriveBaseLine -fs=MEDFileFields() -f1ts=MEDFileField1TS() -#f1ts.setFieldNoProfileSBT(f) -pfl=DataArrayInt(10); pfl.iota() ; pfl.setName("pfl") ; f1ts.setFieldProfile(f,mm,0,pfl) -fmts=MEDFileFieldMultiTS() -fmts.pushBackTimeStep(f1ts) -fs.pushField(fmts) -f1ts=MEDFileField1TS() -f1ts.setFieldNoProfileSBT(f2) -fmts=MEDFileFieldMultiTS() -fmts.pushBackTimeStep(f1ts) -fs.pushField(fmts) +def GenerateCase(): + """ This test is CEA specific one. It generates a .sauv file + that is then read by MEDReader + """ + fname="testMEDReader5.sauv" + ######### + arr=DataArrayDouble(5) ; arr.iota() + c=MEDCouplingCMesh("mesh") + c.setCoords(arr,arr,arr) + m=c.buildUnstructured() + mbis=m.deepCopy() ; mbis.translate([5,0,0]) ; mbis.tetrahedrize(PLANAR_FACE_5) + m=MEDCouplingUMesh.MergeUMeshes([mbis,m]) ; m.setName(c.getName()) + mm=MEDFileUMesh() + mm.setMeshAtLevel(0,m) + grp0=DataArrayInt.Range(0,m.getNumberOfCells(),2) ; grp0.setName("grp0") + grp1=DataArrayInt.Range(1,m.getNumberOfCells(),2) ; grp1.setName("grp1") + grp2=DataArrayInt.Range(0,m.getNumberOfNodes(),7) ; grp2.setName("grp2") + mm.setGroupsAtLevel(0,[grp0,grp1]) + mm.setGroupsAtLevel(1,[grp2]) + ms=MEDFileMeshes() + ms.pushMesh(mm) + f=MEDCouplingFieldDouble(ON_CELLS) ; f.setName("fCell") ; f.setMesh(m[:10]) + arr=DataArrayDouble(f.getNumberOfTuplesExpected()) ; arr.iota() ; f.setArray(arr) + f2=MEDCouplingFieldDouble(ON_NODES) ; f2.setName("fNode") ; f2.setMesh(m) + arr=DataArrayDouble(f2.getNumberOfTuplesExpected()) ; arr.iota() ; f2.setArray(arr) -mfd=MEDFileData() -mfd.setMeshes(ms) -mfd.setFields(fs) -#mfd.write(fname,2) not activated because useless -# -sw=SauvWriter(); -sw.setMEDFileDS(mfd); -sw.write(fname); -del mm,m,c,f,arr -del f1ts -################### MED write is done -> Go to MEDReader -from paraview.simple import * + fs=MEDFileFields() + f1ts=MEDFileField1TS() + #f1ts.setFieldNoProfileSBT(f) + pfl=DataArrayInt(10); pfl.iota() ; pfl.setName("pfl") ; f1ts.setFieldProfile(f,mm,0,pfl) + fmts=MEDFileFieldMultiTS() + fmts.pushBackTimeStep(f1ts) + fs.pushField(fmts) + f1ts=MEDFileField1TS() + f1ts.setFieldNoProfileSBT(f2) + fmts=MEDFileFieldMultiTS() + fmts.pushBackTimeStep(f1ts) + fs.pushField(fmts) -myMedReader=MEDReader(FileName=fname) -myMedReader.AllArrays = ['TS0/mesh/ComSup1/fNode@@][@@P1'] -myMedReader.AllTimeSteps = ['0000'] + mfd=MEDFileData() + mfd.setMeshes(ms) + mfd.setFields(fs) + #mfd.write(fname,2) not activated because useless + # + sw=SauvWriter(); + sw.setMEDFileDS(mfd); + sw.write(fname); + del mm,m,c,f,arr + del f1ts + return fname -Clip1=Clip(ClipType="Plane",Input=myMedReader) -Clip1.Scalars = ['POINTS', 'FamilyIdNode'] -Clip1.ClipType.Origin = [2.0, 2.0, 2.0] -Clip1.ClipType = "Plane" -Clip1.ClipType.Normal = [0.04207410474474753, 0.9319448861971525, 0.3601506612529047] -Clip1.Invert = 1 -DataRepresentation2 = Show() -DataRepresentation2.EdgeColor = [0.0, 0.0, 0.5000076295109483] -DataRepresentation2.ScalarOpacityUnitDistance = 1.5768745057161244 -DataRepresentation2.ExtractedBlockIndex = 1 -DataRepresentation2.ScaleFactor = 0.4 +@WriteInTmpDir +def test(baseline_file): + fname = GenerateCase() + ################### MED write is done -> Go to MEDReader + myMedReader=MEDReader(FileName=fname) + myMedReader.AllArrays = ['TS0/mesh/ComSup1/fNode@@][@@P1'] + myMedReader.AllTimeSteps = ['0000'] -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 + Clip1=Clip(ClipType="Plane",Input=myMedReader) + Clip1.Scalars = ['POINTS', 'FamilyIdNode'] + Clip1.ClipType.Origin = [2.0, 2.0, 2.0] + Clip1.ClipType = "Plane" + Clip1.ClipType.Normal = [0.04207410474474753, 0.9319448861971525, 0.3601506612529047] + Clip1.Invert = 1 - 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() + 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 + + RenderView1.ViewSize=[300,300] + Render() + + # compare with baseline image + 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() +if __name__ == "__main__": + outImgName="testMEDReader5.png" + baseline_file = RetriveBaseLine(outImgName) + test(baseline_file) + pass diff --git a/src/Plugins/MEDReader/Test/testMEDReader6.py b/src/Plugins/MEDReader/Test/testMEDReader6.py index 35325601..159121f4 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader6.py +++ b/src/Plugins/MEDReader/Test/testMEDReader6.py @@ -22,94 +22,98 @@ import os import sys -from MEDLoader import * +from medcoupling import * +from paraview.simple import * +from MEDReaderHelper import WriteInTmpDir,RetriveBaseLine -""" This test generate a GaussPoint field on a mesh with groups. -The aim of this test is to check that the ExtractGroup works well for ELGAfieldToPointGaussian -""" +def GenerateCase(): + """ This test generate a GaussPoint field on a mesh with groups. + The aim of this test is to check that the ExtractGroup works well for ELGAfieldToPointGaussian + """ + fname="testMEDReader6.med" + ######### + arr=DataArrayDouble([(0,0,0),(1,0,0),(2,0,0),(3,0,0),(0,1,0),(1,1,0),(2,1,0),(3,1,0),(0,2,0),(1,2,0),(2,2,0),(3,2,0),(0,3,0),(1,3,0),(2,3,0),(3,3,0)]) + m0=MEDCouplingUMesh("mesh",2) ; m0.setCoords(arr) ; m0.allocateCells() + for elt in [[2,3,6],[3,7,6],[6,9,5],[6,10,9]]: + m0.insertNextCell(NORM_TRI3,elt) + pass + for elt in [[0,4,5,1],[5,6,2,1],[4,8,9,5],[6,10,11,7],[8,12,13,9],[9,13,14,10],[10,14,15,11]]: + m0.insertNextCell(NORM_QUAD4,elt) + pass + mm=MEDFileUMesh() + mm.setMeshAtLevel(0,m0) + grp0=DataArrayInt([0,1,4,5,7,10]) ; grp0.setName("grp0") + mm.setGroupsAtLevel(0,[grp0]) + # + fGauss=MEDCouplingFieldDouble(ON_GAUSS_PT) ; fGauss.setName("fGauss") + fGauss.setMesh(m0) + fGauss.setGaussLocalizationOnType(NORM_TRI3,[0.,0.,1.,0.,0.,1.],[0.1,0.1,0.05,0.9],[0.4,0.6]) + fGauss.setGaussLocalizationOnType(NORM_QUAD4,[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[-0.9,-0.9,0.,0.,0.9,0.9],[0.2,0.3,0.5]) + fGauss.setArray(DataArrayDouble([0.9,1.3,0.22,1.3,1.62,2.21,1.62,2.72,2.95,2.54,2.25,2.16,1.58,1.05,3.13,2.91,2.82,1.41,1.58,1.95,3.59,3.53,3.59,2.82,2.91,3.13,2.25,2.54,2.95])) + fGauss.getArray().setInfoOnComponent(0,"C0") + fGauss.checkConsistencyLight() + # + f1ts=MEDFileField1TS() + f1ts.setFieldNoProfileSBT(fGauss) + # + mm.write(fname,2) + f1ts.write(fname,0) + return fname -fname="testMEDReader6.med" -outImgName="testMEDReader6.png" -######### -arr=DataArrayDouble([(0,0,0),(1,0,0),(2,0,0),(3,0,0),(0,1,0),(1,1,0),(2,1,0),(3,1,0),(0,2,0),(1,2,0),(2,2,0),(3,2,0),(0,3,0),(1,3,0),(2,3,0),(3,3,0)]) -m0=MEDCouplingUMesh("mesh",2) ; m0.setCoords(arr) ; m0.allocateCells() -for elt in [[2,3,6],[3,7,6],[6,9,5],[6,10,9]]: - m0.insertNextCell(NORM_TRI3,elt) - pass -for elt in [[0,4,5,1],[5,6,2,1],[4,8,9,5],[6,10,11,7],[8,12,13,9],[9,13,14,10],[10,14,15,11]]: - m0.insertNextCell(NORM_QUAD4,elt) - pass -mm=MEDFileUMesh() -mm.setMeshAtLevel(0,m0) -grp0=DataArrayInt([0,1,4,5,7,10]) ; grp0.setName("grp0") -mm.setGroupsAtLevel(0,[grp0]) -# -fGauss=MEDCouplingFieldDouble(ON_GAUSS_PT) ; fGauss.setName("fGauss") -fGauss.setMesh(m0) -fGauss.setGaussLocalizationOnType(NORM_TRI3,[0.,0.,1.,0.,0.,1.],[0.1,0.1,0.05,0.9],[0.4,0.6]) -fGauss.setGaussLocalizationOnType(NORM_QUAD4,[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[-0.9,-0.9,0.,0.,0.9,0.9],[0.2,0.3,0.5]) -fGauss.setArray(DataArrayDouble([0.9,1.3,0.22,1.3,1.62,2.21,1.62,2.72,2.95,2.54,2.25,2.16,1.58,1.05,3.13,2.91,2.82,1.41,1.58,1.95,3.59,3.53,3.59,2.82,2.91,3.13,2.25,2.54,2.95])) -fGauss.getArray().setInfoOnComponent(0,"C0") -fGauss.checkConsistencyLight() -# -f1ts=MEDFileField1TS() -f1ts.setFieldNoProfileSBT(fGauss) -# -mm.write(fname,2) -f1ts.write(fname,0) -################### MED write is done -> Go to MEDReader -from paraview.simple import * +@WriteInTmpDir +def test(baseline_file): + fname = GenerateCase() + ################### MED write is done -> Go to MEDReader + + myMedReader=MEDReader(FileName=fname) + myMedReader.AllArrays = ['TS0/mesh/ComSup0/fGauss@@][@@GAUSS'] + myMedReader.AllTimeSteps = ['0000'] -myMedReader=MEDReader(FileName=fname) -myMedReader.AllArrays = ['TS0/mesh/ComSup0/fGauss@@][@@GAUSS'] -myMedReader.AllTimeSteps = ['0000'] + ExtractGroup1 = ExtractGroup(Input=myMedReader) + ExtractGroup1.UpdatePipelineInformation() + ExtractGroup1.AllGroups = ['GRP_grp0'] -ExtractGroup1 = ExtractGroup(Input=myMedReader) -ExtractGroup1.UpdatePipelineInformation() -ExtractGroup1.AllGroups = ['GRP_grp0'] + ELGAfieldToPointGaussian1 = ELGAfieldToPointGaussian(Input=ExtractGroup1) + ELGAfieldToPointGaussian1.SelectSourceArray = ['CELLS','ELGA@0'] -ELGAfieldToPointGaussian1 = ELGAfieldToPointGaussian(Input=ExtractGroup1) -ELGAfieldToPointGaussian1.SelectSourceArray = ['CELLS','ELGA@0'] + Glyph1 = Glyph( Input=ELGAfieldToPointGaussian1, GlyphType="Sphere", GlyphTransform="Transform2" ) + Glyph1.GlyphType = "Sphere" + Glyph1.OrientationArray = ['POINTS', 'No orientation array'] + Glyph1.ScaleFactor = 0.29 -Glyph1 = Glyph( Input=ELGAfieldToPointGaussian1, GlyphType="Sphere", GlyphTransform="Transform2" ) -Glyph1.GlyphType = "Sphere" -Glyph1.OrientationArray = ['POINTS', 'No orientation array'] -Glyph1.ScaleFactor = 0.29 + 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] -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 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() +if __name__ == "__main__": + outImgName="testMEDReader6.png" + baseline_file = RetriveBaseLine(outImgName) + test(baseline_file) + pass diff --git a/src/Plugins/MEDReader/Test/testMEDReader7.py b/src/Plugins/MEDReader/Test/testMEDReader7.py index caa3a0e5..d7f40b13 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader7.py +++ b/src/Plugins/MEDReader/Test/testMEDReader7.py @@ -22,94 +22,99 @@ 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. -In this case only the rank is considered. -""" - -fname="testMEDReader7.med" -outImgName="testMEDReader7.png" -######### -arr=DataArrayDouble([(0,0,0),(1,0,0),(2,0,0),(3,0,0),(0,1,0),(1,1,0),(2,1,0),(3,1,0),(0,2,0),(1,2,0),(2,2,0),(3,2,0),(0,3,0),(1,3,0),(2,3,0),(3,3,0)]) -m0=MEDCouplingUMesh("mesh",2) ; m0.setCoords(arr) ; m0.allocateCells() -for elt in [[2,3,6],[3,7,6],[6,9,5],[6,10,9]]: - m0.insertNextCell(NORM_TRI3,elt) - pass -for elt in [[0,4,5,1],[5,6,2,1],[4,8,9,5],[6,10,11,7],[8,12,13,9],[9,13,14,10],[10,14,15,11]]: - m0.insertNextCell(NORM_QUAD4,elt) - pass -mm=MEDFileUMesh() -mm.setMeshAtLevel(0,m0) -grp0=DataArrayInt([0,1,4,5,7,10]) ; grp0.setName("grp0") -mm.setGroupsAtLevel(0,[grp0]) -fmts=MEDFileFieldMultiTS() -# -fNode=MEDCouplingFieldDouble(ON_NODES) ; fNode.setName("fNode") -fNode.setMesh(m0) -fNode.setArray(DataArrayDouble([3,2,1,0,3.16,2.23,1.41,1,3.6,2.82,2.23,2,4.24,3.6,3.16,3])) -fNode.getArray().setInfoOnComponent(0,"C0") -fNode.setTime(0.5,1,1) -f1ts=MEDFileField1TS() ; f1ts.setFieldNoProfileSBT(fNode) ; fmts.pushBackTimeStep(f1ts) -# -fNode.getArray().reverse() -fNode.setTime(0.5,1,2) -f1ts=MEDFileField1TS() ; f1ts.setFieldNoProfileSBT(fNode) ; fmts.pushBackTimeStep(f1ts) -# -fNode.getArray().reverse() -fNode.setTime(0.5,2,1) -f1ts=MEDFileField1TS() ; f1ts.setFieldNoProfileSBT(fNode) ; fmts.pushBackTimeStep(f1ts) -# -fNode.getArray().reverse() -fNode.setTime(0.5,2,2) -f1ts=MEDFileField1TS() ; f1ts.setFieldNoProfileSBT(fNode) ; fmts.pushBackTimeStep(f1ts) -# -mm.write(fname,2) -fmts.write(fname,0) -################### MED write is done -> Go to MEDReader +from medcoupling import * from paraview.simple import * +from MEDReaderHelper import WriteInTmpDir,RetriveBaseLine + +def GenerateCase(): + """ This test generate a simple multi time field with a very aggressive time steps triplets. Neither dt, nor iteration nor order is considered. + In this case only the rank is considered. + """ + fname="testMEDReader7.med" + ######### + arr=DataArrayDouble([(0,0,0),(1,0,0),(2,0,0),(3,0,0),(0,1,0),(1,1,0),(2,1,0),(3,1,0),(0,2,0),(1,2,0),(2,2,0),(3,2,0),(0,3,0),(1,3,0),(2,3,0),(3,3,0)]) + m0=MEDCouplingUMesh("mesh",2) ; m0.setCoords(arr) ; m0.allocateCells() + for elt in [[2,3,6],[3,7,6],[6,9,5],[6,10,9]]: + m0.insertNextCell(NORM_TRI3,elt) + pass + for elt in [[0,4,5,1],[5,6,2,1],[4,8,9,5],[6,10,11,7],[8,12,13,9],[9,13,14,10],[10,14,15,11]]: + m0.insertNextCell(NORM_QUAD4,elt) + pass + mm=MEDFileUMesh() + mm.setMeshAtLevel(0,m0) + grp0=DataArrayInt([0,1,4,5,7,10]) ; grp0.setName("grp0") + mm.setGroupsAtLevel(0,[grp0]) + fmts=MEDFileFieldMultiTS() + # + fNode=MEDCouplingFieldDouble(ON_NODES) ; fNode.setName("fNode") + fNode.setMesh(m0) + fNode.setArray(DataArrayDouble([3,2,1,0,3.16,2.23,1.41,1,3.6,2.82,2.23,2,4.24,3.6,3.16,3])) + fNode.getArray().setInfoOnComponent(0,"C0") + fNode.setTime(0.5,1,1) + f1ts=MEDFileField1TS() ; f1ts.setFieldNoProfileSBT(fNode) ; fmts.pushBackTimeStep(f1ts) + # + fNode.getArray().reverse() + fNode.setTime(0.5,1,2) + f1ts=MEDFileField1TS() ; f1ts.setFieldNoProfileSBT(fNode) ; fmts.pushBackTimeStep(f1ts) + # + fNode.getArray().reverse() + fNode.setTime(0.5,2,1) + f1ts=MEDFileField1TS() ; f1ts.setFieldNoProfileSBT(fNode) ; fmts.pushBackTimeStep(f1ts) + # + fNode.getArray().reverse() + fNode.setTime(0.5,2,2) + f1ts=MEDFileField1TS() ; f1ts.setFieldNoProfileSBT(fNode) ; fmts.pushBackTimeStep(f1ts) + # + mm.write(fname,2) + fmts.write(fname,0) + return fname + + +@WriteInTmpDir +def test(baseline_file): + fname = GenerateCase() + ################### MED write is done -> Go to MEDReader + myMedReader=MEDReader(FileName=fname) + myMedReader.AllArrays = ['TS0/mesh/ComSup0/fNode@@][@@P1'] + assert(list(myMedReader.TimestepValues)==[0.,1.,2.,3.]) -myMedReader=MEDReader(FileName=fname) -myMedReader.AllArrays = ['TS0/mesh/ComSup0/fNode@@][@@P1'] -assert(list(myMedReader.TimestepValues)==[0.,1.,2.,3.]) + 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] -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 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() +if __name__ == "__main__": + outImgName="testMEDReader7.png" + baseline_file = RetriveBaseLine(outImgName) + test(baseline_file) + pass diff --git a/src/Plugins/MEDReader/Test/testMEDReader8.py b/src/Plugins/MEDReader/Test/testMEDReader8.py index 38fae933..85814275 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader8.py +++ b/src/Plugins/MEDReader/Test/testMEDReader8.py @@ -22,104 +22,110 @@ import os import sys -from MEDLoader import * +from medcoupling import * +from paraview.simple import * +from MEDReaderHelper import WriteInTmpDir,RetriveBaseLine -""" This test is a non regression test. ExtractCellType then ExtractGroup. -""" +def GenerateCase(): + """ This test is a non regression test. ExtractCellType then ExtractGroup. + """ + fname="testMEDReader8.med" + ######### + arr=DataArrayDouble([(0,0,0),(1,0,0),(2,0,0),(3,0,0),(0,1,0),(1,1,0),(2,1,0),(3,1,0),(0,2,0),(1,2,0),(2,2,0),(3,2,0),(0,3,0),(1,3,0),(2,3,0),(3,3,0)]) + m0=MEDCouplingUMesh("mesh",2) ; m0.setCoords(arr) ; m0.allocateCells() + for elt in [[2,3,6],[3,7,6],[6,9,5],[6,10,9]]: + m0.insertNextCell(NORM_TRI3,elt) + pass + for elt in [[0,4,5,1],[5,6,2,1],[4,8,9,5],[6,10,11,7],[8,12,13,9],[9,13,14,10],[10,14,15,11]]: + m0.insertNextCell(NORM_QUAD4,elt) + pass + mm=MEDFileUMesh() + mm.setMeshAtLevel(0,m0) + grp0=DataArrayInt([0,1,2,5]) ; grp0.setName("grp0") + mm.setGroupsAtLevel(0,[grp0]) + fmts=MEDFileFieldMultiTS() + # + fNode=MEDCouplingFieldDouble(ON_NODES) ; fNode.setName("fNode") + fNode.setMesh(m0) + fNode.setArray(DataArrayDouble([3,2,1,0,3.16,2.23,1.41,1,3.6,2.82,2.23,2,4.24,3.6,3.16,3])) + fNode.getArray().setInfoOnComponent(0,"C0") + fNode.setTime(0.5,1,1) + f1ts=MEDFileField1TS() ; f1ts.setFieldNoProfileSBT(fNode) ; fmts.pushBackTimeStep(f1ts) + # + fNode.getArray().reverse() + fNode.setTime(0.5,1,2) + f1ts=MEDFileField1TS() ; f1ts.setFieldNoProfileSBT(fNode) ; fmts.pushBackTimeStep(f1ts) + # + fNode.getArray().reverse() + fNode.setTime(0.5,2,1) + f1ts=MEDFileField1TS() ; f1ts.setFieldNoProfileSBT(fNode) ; fmts.pushBackTimeStep(f1ts) + # + fNode.getArray().reverse() + fNode.setTime(0.5,2,2) + f1ts=MEDFileField1TS() ; f1ts.setFieldNoProfileSBT(fNode) ; fmts.pushBackTimeStep(f1ts) + # + mm.write(fname,2) + fmts.write(fname,0) + return fname -fname="testMEDReader8.med" -outImgName="testMEDReader8.png" -######### -arr=DataArrayDouble([(0,0,0),(1,0,0),(2,0,0),(3,0,0),(0,1,0),(1,1,0),(2,1,0),(3,1,0),(0,2,0),(1,2,0),(2,2,0),(3,2,0),(0,3,0),(1,3,0),(2,3,0),(3,3,0)]) -m0=MEDCouplingUMesh("mesh",2) ; m0.setCoords(arr) ; m0.allocateCells() -for elt in [[2,3,6],[3,7,6],[6,9,5],[6,10,9]]: - m0.insertNextCell(NORM_TRI3,elt) - pass -for elt in [[0,4,5,1],[5,6,2,1],[4,8,9,5],[6,10,11,7],[8,12,13,9],[9,13,14,10],[10,14,15,11]]: - m0.insertNextCell(NORM_QUAD4,elt) - pass -mm=MEDFileUMesh() -mm.setMeshAtLevel(0,m0) -grp0=DataArrayInt([0,1,2,5]) ; grp0.setName("grp0") -mm.setGroupsAtLevel(0,[grp0]) -fmts=MEDFileFieldMultiTS() -# -fNode=MEDCouplingFieldDouble(ON_NODES) ; fNode.setName("fNode") -fNode.setMesh(m0) -fNode.setArray(DataArrayDouble([3,2,1,0,3.16,2.23,1.41,1,3.6,2.82,2.23,2,4.24,3.6,3.16,3])) -fNode.getArray().setInfoOnComponent(0,"C0") -fNode.setTime(0.5,1,1) -f1ts=MEDFileField1TS() ; f1ts.setFieldNoProfileSBT(fNode) ; fmts.pushBackTimeStep(f1ts) -# -fNode.getArray().reverse() -fNode.setTime(0.5,1,2) -f1ts=MEDFileField1TS() ; f1ts.setFieldNoProfileSBT(fNode) ; fmts.pushBackTimeStep(f1ts) -# -fNode.getArray().reverse() -fNode.setTime(0.5,2,1) -f1ts=MEDFileField1TS() ; f1ts.setFieldNoProfileSBT(fNode) ; fmts.pushBackTimeStep(f1ts) -# -fNode.getArray().reverse() -fNode.setTime(0.5,2,2) -f1ts=MEDFileField1TS() ; f1ts.setFieldNoProfileSBT(fNode) ; fmts.pushBackTimeStep(f1ts) -# -mm.write(fname,2) -fmts.write(fname,0) -################### MED write is done -> Go to MEDReader -from paraview.simple import * -myMedReader=MEDReader(FileName=fname) -myMedReader.AllArrays = ['TS0/mesh/ComSup0/fNode@@][@@P1'] -assert(list(myMedReader.TimestepValues)==[0.,1.,2.,3.]) -myMedReader.UpdatePipeline() +@WriteInTmpDir +def test(baseline_file): + fname = GenerateCase() + ################### MED write is done -> Go to MEDReader + + myMedReader=MEDReader(FileName=fname) + myMedReader.AllArrays = ['TS0/mesh/ComSup0/fNode@@][@@P1'] + assert(list(myMedReader.TimestepValues)==[0.,1.,2.,3.]) + myMedReader.UpdatePipeline() + + extractCT=ExtractCellType(Input=myMedReader) + extractCT.UpdatePipelineInformation() + assert(list(extractCT.GetProperty("GeoTypesInfo"))==['TRI3','0','QUAD4','0']) + extractCT.AllGeoTypes=['TRI3'] -extractCT=ExtractCellType(Input=myMedReader) -extractCT.UpdatePipelineInformation() -assert(list(extractCT.GetProperty("GeoTypesInfo"))==['TRI3','0','QUAD4','0']) -extractCT.AllGeoTypes=['TRI3'] + extGrp=ExtractGroup(Input=extractCT) + #extGrp.UpdatePipelineInformation() + assert([x for x in list(extGrp.GetProperty("GroupsFlagsInfo")[::2]) if x[:4]=="GRP_"]==['GRP_grp0']) + extGrp.AllGroups="GRP_grp0" -extGrp=ExtractGroup(Input=extractCT) -#extGrp.UpdatePipelineInformation() -assert([x for x in list(extGrp.GetProperty("GroupsFlagsInfo")[::2]) if x[:4]=="GRP_"]==['GRP_grp0']) -extGrp.AllGroups="GRP_grp0" + 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] -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 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() +if __name__ == "__main__": + outImgName="testMEDReader8.png" + baseline_file = RetriveBaseLine(outImgName) + test(baseline_file) + pass diff --git a/src/Plugins/MEDReader/Test/testMEDReader9.py b/src/Plugins/MEDReader/Test/testMEDReader9.py index 11de0655..4945528f 100644 --- a/src/Plugins/MEDReader/Test/testMEDReader9.py +++ b/src/Plugins/MEDReader/Test/testMEDReader9.py @@ -19,37 +19,45 @@ # # Author : Anthony Geay -from MEDLoader import * - -""" This test is a non regression test. Test that ExtractGroup adapt to the current mesh of MEDReader. A MED file containing 2 fields on a 2 different meshes. -This test checks that the MeshName follows. -""" - -fname="testMEDReader9.med" -######### -m1=MEDCouplingUMesh("m1",2) ; m1.setCoords(DataArrayDouble([(0.,0.),(1.,0.),(0.,1.)])) ; m1.allocateCells() ; m1.insertNextCell(NORM_TRI3,[0,1,2]) -m2=MEDCouplingUMesh("m2",2) ; m2.setCoords(DataArrayDouble([(0.,0.),(1.,0.),(0.,1.),(1.,1.)])) ; m2.allocateCells() ; m2.insertNextCell(NORM_QUAD4,[0,1,3,2]) -mm1=MEDFileUMesh() ; mm2=MEDFileUMesh() -mm1.setMeshAtLevel(0,m1) ; mm2.setMeshAtLevel(0,m2) -ms=MEDFileMeshes() ; ms.pushMesh(mm1) ; ms.pushMesh(mm2) -f1=MEDCouplingFieldDouble(ON_CELLS) ; f1.setName("f1") ; f1.setMesh(m1) ; f1.setArray(DataArrayDouble([1.111])) -f2=MEDCouplingFieldDouble(ON_CELLS) ; f2.setName("f2") ; f2.setMesh(m2) ; f2.setArray(DataArrayDouble([2.2222])) -ff1=MEDFileField1TS() ; ff2=MEDFileField1TS() -ff1.setFieldNoProfileSBT(f1) ; ff2.setFieldNoProfileSBT(f2) -ms.write(fname,2) -ff1.write(fname,0) -ff2.write(fname,0) -################### MED write is done -> Go to MEDReader +from medcoupling import * from paraview.simple import * +from MEDReaderHelper import WriteInTmpDir,RetriveBaseLine + +def GenerateCase(): + """ This test is a non regression test. Test that ExtractGroup adapt to the current mesh of MEDReader. A MED file containing 2 fields on a 2 different meshes. + This test checks that the MeshName follows. + """ + fname="testMEDReader9.med" + ######### + m1=MEDCouplingUMesh("m1",2) ; m1.setCoords(DataArrayDouble([(0.,0.),(1.,0.),(0.,1.)])) ; m1.allocateCells() ; m1.insertNextCell(NORM_TRI3,[0,1,2]) + m2=MEDCouplingUMesh("m2",2) ; m2.setCoords(DataArrayDouble([(0.,0.),(1.,0.),(0.,1.),(1.,1.)])) ; m2.allocateCells() ; m2.insertNextCell(NORM_QUAD4,[0,1,3,2]) + mm1=MEDFileUMesh() ; mm2=MEDFileUMesh() + mm1.setMeshAtLevel(0,m1) ; mm2.setMeshAtLevel(0,m2) + ms=MEDFileMeshes() ; ms.pushMesh(mm1) ; ms.pushMesh(mm2) + f1=MEDCouplingFieldDouble(ON_CELLS) ; f1.setName("f1") ; f1.setMesh(m1) ; f1.setArray(DataArrayDouble([1.111])) + f2=MEDCouplingFieldDouble(ON_CELLS) ; f2.setName("f2") ; f2.setMesh(m2) ; f2.setArray(DataArrayDouble([2.2222])) + ff1=MEDFileField1TS() ; ff2=MEDFileField1TS() + ff1.setFieldNoProfileSBT(f1) ; ff2.setFieldNoProfileSBT(f2) + ms.write(fname,2) + ff1.write(fname,0) + ff2.write(fname,0) + return fname -myMedReader=MEDReader(FileName=fname) -myMedReader.AllArrays=['TS0/m1/ComSup0/f1@@][@@P0'] -#myMedReader.UpdatePipelineInformation() -ExtractGroup1=ExtractGroup(Input=myMedReader) -#ExtractGroup1.UpdatePipelineInformation() -assert(ExtractGroup1.GetProperty("MeshName")[0]=="m1") -myMedReader.AllArrays=['TS0/m2/ComSup0/f2@@][@@P0'] -#myMedReader.UpdatePipeline() -ExtractGroup2=ExtractGroup(Input=myMedReader) -#ExtractGroup2.UpdatePipelineInformation() -assert(ExtractGroup2.GetProperty("MeshName")[0]=="m2") +@WriteInTmpDir +def test(): + fname = GenerateCase() + ################### MED write is done -> Go to MEDReader + myMedReader=MEDReader(FileName=fname) + myMedReader.AllArrays=['TS0/m1/ComSup0/f1@@][@@P0'] + #myMedReader.UpdatePipelineInformation() + ExtractGroup1=ExtractGroup(Input=myMedReader) + #ExtractGroup1.UpdatePipelineInformation() + assert(ExtractGroup1.GetProperty("MeshName")[0]=="m1") + myMedReader.AllArrays=['TS0/m2/ComSup0/f2@@][@@P0'] + #myMedReader.UpdatePipeline() + ExtractGroup2=ExtractGroup(Input=myMedReader) + #ExtractGroup2.UpdatePipelineInformation() + assert(ExtractGroup2.GetProperty("MeshName")[0]=="m2") + +if __name__ == "__main__": + test() -- 2.39.2