From: YOANN AUDOUIN Date: Thu, 1 Apr 2021 08:03:34 +0000 (+0200) Subject: [test] Adding test for ElectromagnetismRotation X-Git-Tag: V9_8_0a1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4bef65d2fc696d78b02db59537f2a0c974731377;p=tools%2Fparavisaddons_common.git [test] Adding test for ElectromagnetismRotation --- diff --git a/src/ElectromagnetismRotation/CMakeLists.txt b/src/ElectromagnetismRotation/CMakeLists.txt index 195e2ad..3691db9 100644 --- a/src/ElectromagnetismRotation/CMakeLists.txt +++ b/src/ElectromagnetismRotation/CMakeLists.txt @@ -20,6 +20,10 @@ cmake_minimum_required(VERSION 3.8) project(ElectromagnetismRotation) +IF(PARAVISADDONS_COMMON_BUILD_TESTS) + ADD_SUBDIRECTORY(Test) +ENDIF(PARAVISADDONS_COMMON_BUILD_TESTS) + find_package(ParaView REQUIRED) option(BUILD_SHARED_LIBS "Build shared libraries" ON) diff --git a/src/ElectromagnetismRotation/Test/CMakeLists.txt b/src/ElectromagnetismRotation/Test/CMakeLists.txt new file mode 100644 index 0000000..e5d106f --- /dev/null +++ b/src/ElectromagnetismRotation/Test/CMakeLists.txt @@ -0,0 +1,38 @@ +# Copyright (C) 2012-2020 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 : Yoann Audouin (EDF) + +SET(test_maxwell_rotation_0_src + mesh_benjamin_8_sept_2020.med + test_maxwell_rotation_0.py + ) + +SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) + +ADD_TEST(ElectromagnetismRotation python test_maxwell_rotation_0.py) +SET_TESTS_PROPERTIES(ElectromagnetismRotation PROPERTIES ENVIRONMENT "${tests_env}") + +# Application tests + +SET(TEST_INSTALL_DIRECTORY ${PARAVISADDONS_COMMON_INSTALL_TESTS}/ElectromagnetismRotation) +INSTALL(FILES ${test_maxwell_rotation_0_src} DESTINATION ${TEST_INSTALL_DIRECTORY}) + +INSTALL(FILES CTestTestfileInstall.cmake + DESTINATION ${TEST_INSTALL_DIRECTORY} + RENAME CTestTestfile.cmake) diff --git a/src/ElectromagnetismRotation/Test/CTestTestfileInstall.cmake b/src/ElectromagnetismRotation/Test/CTestTestfileInstall.cmake new file mode 100644 index 0000000..4c2752d --- /dev/null +++ b/src/ElectromagnetismRotation/Test/CTestTestfileInstall.cmake @@ -0,0 +1,31 @@ +# Copyright (C) 2015-2020 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 +# + +SET(TEST_NAMES + test_maxwell_rotation_0 +) + +FOREACH(tfile ${TEST_NAMES}) + SET(TEST_NAME ${COMPONENT_NAME}_${tfile}) + ADD_TEST(${TEST_NAME} python ${tfile}.py) + SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES + LABELS "${COMPONENT_NAME}" + TIMEOUT ${TIMEOUT} + ) +ENDFOREACH() diff --git a/src/ElectromagnetismRotation/Test/mesh_benjamin_8_sept_2020.med b/src/ElectromagnetismRotation/Test/mesh_benjamin_8_sept_2020.med new file mode 100644 index 0000000..7e24154 Binary files /dev/null and b/src/ElectromagnetismRotation/Test/mesh_benjamin_8_sept_2020.med differ diff --git a/src/ElectromagnetismRotation/Test/test_maxwell_rotation_0.py b/src/ElectromagnetismRotation/Test/test_maxwell_rotation_0.py new file mode 100644 index 0000000..80744fc --- /dev/null +++ b/src/ElectromagnetismRotation/Test/test_maxwell_rotation_0.py @@ -0,0 +1,28 @@ +from paraview.simple import * +paraview.simple._DisableFirstRenderCameraReset() +from vtk.util import numpy_support + +def MyAssert(clue): + if not clue: + raise RuntimeError("Assertion failed !") + +fileName="mesh_benjamin_8_sept_2020.med" +testmed = MEDReader(FileName=fileName) +testmed.AllArrays = ['TS0/Mesh_1/ComSup0/B_A@@][@@P0', 'TS0/Mesh_1/ComSup0/B_HsOmega@@][@@P0', 'TS0/Mesh_1/ComSup0/H_A@@][@@P0', 'TS0/Mesh_1/ComSup0/H_HsOmega@@][@@P0'] +testmed.UpdatePipeline() + +animationScene1 = GetAnimationScene() +timeKeeper1 = GetTimeKeeper() +animationScene1.UpdateAnimationUsingDataTimeSteps() + +rog = RotationOfGroup(Input=testmed) +rog.AllGroups = ['GRP_airint_extruded', 'GRP_amortisseurs_extruded', 'GRP_arbre_extruded', 'GRP_inducteurGE_extruded', 'GRP_inducteurGS_extruded', 'GRP_inducteurPE_extruded', 'GRP_inducteurPS_extruded', 'GRP_mvt_extruded', 'GRP_rotor_extruded'] +rog.AngularStep = "180+180" +rog.UpdatePipeline() +ds0 = servermanager.Fetch(rog) +MyAssert(ds0.GetBlock(0).GetNumberOfCells() == 3423) +rog.UpdatePipeline() +animationScene1.GoToNext() +rog.UpdatePipeline() +animationScene1.GoToNext() +rog.UpdatePipeline()