From 185c5981dbf61968193eb61cba91abbac09cc51d Mon Sep 17 00:00:00 2001 From: abn Date: Mon, 9 May 2016 10:32:28 +0200 Subject: [PATCH] Tests: minor fixes: + Make MEDCOUPLING_WITH_FILE_EXAMPLES and MEDCOUPLING_BUILD_TESTS compatible. + Fix test MEDLoaderCouplingTrainingSession --- resources/CMakeLists.txt | 139 ++---------------- .../Swig/MEDLoaderCouplingTrainingSession.py | 9 +- 2 files changed, 15 insertions(+), 133 deletions(-) diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index 123694c88..b93e5bc95 100644 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -25,122 +25,9 @@ SET(MED_test_fig_files ) SET(MED_other_FILES - #boitenew.cnc - #boitenew.inp - #boitenew.xyz - #Case1.cnc - #Case1.inp - #Case1.xyz - #cube.cnc - #cube.inp - #cube.xyz - #test3.cnc - #test3.inp - #test3.xyz - #titi.cnc - #titi.inp - #titi.xyz - #carre_en_quad4.med - #carre_en_quad4_seg2.med - #cas_defaut_domaine_fluide.med - #ChampsDarcy.med - #cube_hexa8.med - #cube_hexa8_quad4.med - #darcy_1.1_res.med - #darcy_1.3_resCASTEM.med - #darcy_1.3_resPORFLOW.med - #darcy_1.3_resTRACES.med - #darcy2_Castem_EFMH.med - #darcy2_Castem_qua_EFMH.med - #darcy2_Castem_qua_VF.med - #Darcy3_3D_H_10x10x10_2.med - #Darcy3_3D_H_10x10x10.sauve - #dx200_dy1_avec_2couches.sauve - #elle_2D_QT_10x10.sauve - #elle_2D_QT_2x2.sauve - #elle_2D_QT_40x40.sauve - #elle_2D_QT_4x4.sauve - #elle_3D_HPr_10x10x10_2.med - #elle_3D_HPr_10x10x10.sauve - #elle_3D_HPr_2x2x2_2.med - #elle_3D_HPr_2x2x2.sauve - #elle_3D_HPr_4x4x4_2.med - #elle_3D_HPr_4x4x4.sauve - #extendedtransport53_triangles.med - #geomMesh_nomorereadable21.med - #geomMesh22.med - #H_CastCast_EFMH_I129_COUPLEX1.med - #H_CastCast_VF_I129_COUPLEX1.med - #H_CastCast_VF_Se79_COUPLEX1.med - #H_CastPorf_I129_COUPLEX1.med - #H_CastPorf_Se79_COUPLEX1.med - #H_PorfCast_EFMH_I129_COUPLEX1.med - #H_PorfCast_EFMH_Se79_COUPLEX1.med - #H_PorfPorf_I129_COUPLEX1.med - #H_Traces_I129_COUPLEX1.med - #H_Traces_Se79_COUPLEX1.med - # inclusion_2d_raf.sauve - # inclusion_2d.sauve - # mail_ktest1-3-hexa.sauve - # mail_ktest1-3-tetra.sauve - # mail_ktest3-1.sauve - # mail_ktest3-2.sauve - # maill.00.med - # maill.00_nofield.med - # maill.00_nomesh.med - # maill.00_without_seg2.med - # maill.0.med - # maillage_5_5_5.med - # maillage_andra2_100elts.sauve - # maillage_cas2_2d.sauve - # maillage_cas4_234elts.sauve - # maillage_CHEMVAL_100elts.sauve - # maillage_CHEMVAL_40elts.sauve - # maillage_chemvalIV_cas1_100elts.sauve - # maillage_chemvalIV_cas1_40elts.med - # maillage_chemvalIV_cas1_40elts.sauve - # maillage_UniSegFam.med - # mail_test1-1-qua.sauve - # mail_test1-1-tri.sauve - # mail_test1-2-qua.sauve - # mail_test1-2-tri.sauve - # mail-test1-4-1.sauve - # mail-test1-4-2.sauve - # mesh_nomorereadable21.med - # mesh.med - # Mistrat.med - #Old_ChampsDarcy.med - #Old_darcy_1.1_res.med - #Old_darcy_1.3_resCASTEM.med - #Old_darcy_1.3_resPORFLOW.med - #Old_darcy_1.3_resTRACES.med - #Old_darcy2_Castem_EFMH.med - #Old_darcy2_Castem_qua_EFMH.med - #Old_darcy2_Castem_qua_VF.med - #Old_H_CastCast_EFMH_I129_COUPLEX1.med - #Old_H_CastCast_VF_I129_COUPLEX1.med - #Old_H_CastCast_VF_Se79_COUPLEX1.med - #Old_H_CastPorf_I129_COUPLEX1.med - #Old_H_CastPorf_Se79_COUPLEX1.med - #Old_H_PorfCast_EFMH_I129_COUPLEX1.med - #Old_H_PorfCast_EFMH_Se79_COUPLEX1.med - #Old_H_PorfPorf_I129_COUPLEX1.med - #Old_H_PorfPorf_Se79_COUPLEX1.med - #Old_H_Traces_I129_COUPLEX1.med - #Old_H_Traces_Se79_COUPLEX1.med - #Old_maillage_chemvalIV_cas1_40elts.med - #pointe_nomorereadable21.med pointe.med poly3D.med - #polyedres.med polygones.med - #recoll_bord.med - #test19.med - # test_2D.med - # trio_2D.med - # TimeStamps.med - # zzzz121b.med - # zzzz121b_without_tr6.med UnitTetra.med GeneralTetra.med NudgedSimpler.med @@ -165,7 +52,6 @@ SET(MED_other_FILES GenTetra2.med TrickyTetra1.med LargeUnitTetra.med - # LargeInconsistentTetra.med DividedUnitTetraSimpler.med DividedUnitTetra.med NudgedDividedUnitTetra.med @@ -195,17 +81,9 @@ SET(MED_other_FILES square2_split square2_split1.med square2_split2.med - # testStructCart3D.med Mesh3D_10_2d1.med Mesh3D_10_2d2.med Mesh3D_11.med - # blow5_ascii.case - # blow5_ascii.geo - # blow5_ascii_cd_displacement - # blow5_ascii_cd_thickness - # blow5_ascii_pd_displacement - # blow5_ascii_pd_thickness - #test_2D.sauve allPillesTest.sauv BDC-714.sauv portico_3subs.sauv @@ -215,15 +93,18 @@ SET(MED_other_FILES SET(MED_RESOURCES_FILES ${MED_test_fig_files}) IF(NOT MEDCOUPLING_MICROMED) - IF(MEDCOUPLING_WITH_FILE_EXAMPLES) FOREACH(resfile ${MED_other_FILES}) - LIST(APPEND MED_RESOURCES_FILES ${resfile}) + LIST(APPEND MED_RESOURCES_FILES ${resfile}) ENDFOREACH() - ENDIF() ENDIF() -FOREACH(resfile ${MED_RESOURCES_FILES}) - CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/${resfile}" "${CMAKE_CURRENT_BINARY_DIR}/${resfile}" COPYONLY) -ENDFOREACH(resfile) +# MEDFiles are always copied to build dir (for tests) but not always for install +IF(MEDCOUPLING_BUILD_TESTS) + FOREACH(resfile ${MED_RESOURCES_FILES}) + CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/${resfile}" "${CMAKE_CURRENT_BINARY_DIR}/${resfile}" COPYONLY) + ENDFOREACH(resfile) +ENDIF() -INSTALL(FILES ${MED_RESOURCES_FILES} DESTINATION ${MEDCOUPLING_INSTALL_RES_DATA}) +IF(MEDCOUPLING_WITH_FILE_EXAMPLES) + INSTALL(FILES ${MED_RESOURCES_FILES} DESTINATION ${MEDCOUPLING_INSTALL_RES_DATA}) +ENDIF() diff --git a/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py b/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py index 9088bbad4..e301dd71a 100644 --- a/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py +++ b/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py @@ -481,12 +481,13 @@ from numpy import * from math import acos med_root_dir=os.getenv("MEDCOUPLING_ROOT_DIR") +agitateur_file = "" if med_root_dir: agitateur_file = os.path.join(os.getenv("MEDCOUPLING_ROOT_DIR"),"share","resources","med","agitateur.med") - if not os.path.exists(agitateur_file): - current_dir = os.path.dirname(os.path.realpath(__file__)) - agitateur_file=os.path.join(current_dir, "..", "..", "..", "resources","agitateur.med") - pass +if not os.path.exists(agitateur_file): + current_dir = os.path.dirname(os.path.realpath(__file__)) + agitateur_file=os.path.join(current_dir, "..", "..", "..", "resources","agitateur.med") +pass data=MEDFileData(agitateur_file) ts=data.getFields()[0].getTimeSteps() print ts -- 2.39.2