cmake_minimum_required(VERSION 3.8)
project(ElectromagnetismStreamTraceur)
-find_package(ParaView REQUIRED)
-include(GNUInstallDirs)
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
+IF(PARAVISADDONS_COMMON_BUILD_TESTS)
+ ADD_SUBDIRECTORY(Test)
+ENDIF(PARAVISADDONS_COMMON_BUILD_TESTS)
+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
set("_paraview_plugin_default_${CMAKE_PROJECT_NAME}" ON)
--- /dev/null
+# 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_StreamLines_0_src
+ test_maxwell_StreamLines_0.py
+ )
+
+SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
+
+ADD_TEST(ElectromagnetismStreamTraceur python test_maxwell_StreamLines_0.py)
+SET_TESTS_PROPERTIES(ElectromagnetismStreamTraceur PROPERTIES ENVIRONMENT "${tests_env}")
+
+# Application tests
+
+SET(TEST_INSTALL_DIRECTORY ${PARAVISADDONS_COMMON_INSTALL_TESTS}/ElectromagnetismStreamTraceur)
+INSTALL(FILES ${test_maxwell_StreamLines_0_src} DESTINATION ${TEST_INSTALL_DIRECTORY})
+
+INSTALL(FILES CTestTestfileInstall.cmake
+ DESTINATION ${TEST_INSTALL_DIRECTORY}
+ RENAME CTestTestfile.cmake)
--- /dev/null
+# 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_StreamLines_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()
--- /dev/null
+from paraview.simple import *
+from medcoupling import *
+#### disable automatic camera reset on 'Show'
+paraview.simple._DisableFirstRenderCameraReset()
+
+def MyAssert(clue):
+ if not clue:
+ raise RuntimeError("Assertion failed !")
+
+fname = "maxwell_streamline.med"
+
+arr = DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10])
+m = MEDCouplingCMesh()
+m.setCoords(arr,arr,arr)
+m = m.buildUnstructured()
+
+m.changeSpaceDimension(3,0.)
+m.setName("mesh")
+f = MEDCouplingFieldDouble(ON_CELLS)
+f.setMesh(m)
+f.setName("field")
+arrf = DataArrayDouble(10*10*10,3)
+arrf[:,0] = 1 ; arrf[:,1] = 0 ; arrf[:,2] = 0
+f.setArray( arrf )
+f.getArray().setInfoOnComponents(["X","Y","Z"])
+f.checkConsistencyLight()
+f.write(fname)
+f2 = f.deepCopy()
+arrf2 = DataArrayDouble(10*10*10,3)
+arrf2[:,0] = 0 ; arrf2[:,1] = 1 ; arrf2[:,2] = 0
+f2.setArray( arrf2 )
+f2.setName("field2")
+WriteFieldUsingAlreadyWrittenMesh(fname,f2)
+
+testmed = MEDReader(FileName=fname)
+testmed.AllArrays = ['TS0/mesh/ComSup0/field@@][@@P0', 'TS0/mesh/ComSup0/field2@@][@@P0', 'TS0/mesh/ComSup0/mesh@@][@@P0']
+testmed.AllTimeSteps = ['0000']
+streamTraceur1 = LigneDeChamp(Input=testmed,SeedType='Point Cloud')
+streamTraceur1.SeedType.Radius = 1
+streamTraceur1.SeedType.Center = [ 7.23,7.26,3.42 ]
+streamTraceur1.Vectors = ['CELLS', "field"]
+streamTraceur1.UpdatePipeline()
+ds0 = servermanager.Fetch(streamTraceur1)
+MyAssert(ds0.GetNumberOfCells()==200)