]> SALOME platform Git repositories - tools/paravisaddons_common.git/commitdiff
Salome HOME
[test] Adding test for ElectromagnetismRotation
authorYOANN AUDOUIN <B61570@dsp0919998.atlas.edf.fr>
Thu, 1 Apr 2021 08:03:34 +0000 (10:03 +0200)
committerYOANN AUDOUIN <B61570@dsp0919998.atlas.edf.fr>
Wed, 12 May 2021 12:05:10 +0000 (14:05 +0200)
src/ElectromagnetismRotation/CMakeLists.txt
src/ElectromagnetismRotation/Test/CMakeLists.txt [new file with mode: 0644]
src/ElectromagnetismRotation/Test/CTestTestfileInstall.cmake [new file with mode: 0644]
src/ElectromagnetismRotation/Test/mesh_benjamin_8_sept_2020.med [new file with mode: 0644]
src/ElectromagnetismRotation/Test/test_maxwell_rotation_0.py [new file with mode: 0644]

index 195e2ad47e7ea66c0e47af2ebe13c6c5cd9bc43c..3691db99ecbd8d8e6a0aa36d44c183a0ab040459 100644 (file)
 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 (file)
index 0000000..e5d106f
--- /dev/null
@@ -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 (file)
index 0000000..4c2752d
--- /dev/null
@@ -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 (file)
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 (file)
index 0000000..80744fc
--- /dev/null
@@ -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()