Salome HOME
initial commit from paravisaddons
[tools/paravisaddons_common.git] / src / ElectromagnetismStreamTraceur / scripts / test_stream.py
1 # Copyright (C) 2021  CEA/DEN, EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 from paraview.simple import *
21 #### disable automatic camera reset on 'Show'
22 paraview.simple._DisableFirstRenderCameraReset()
23
24 def MyAssert(clue):
25     if not clue:
26         raise RuntimeError("Assertion failed !")
27
28 testmed = MEDReader(FileName='test.med')
29 testmed.AllArrays = ['TS0/mesh/ComSup0/field@@][@@P0', 'TS0/mesh/ComSup0/field2@@][@@P0', 'TS0/mesh/ComSup0/mesh@@][@@P0']
30 testmed.AllTimeSteps = ['0000']
31 streamTraceur1 = LigneDeChamp(Input=testmed,SeedType='Point Source')
32 streamTraceur1.SeedType.Radius = 1
33 streamTraceur1.SeedType.Center = [ 7.23,7.26,3.42 ]
34 streamTraceur1.Vectors = ['CELLS', "field"] #OrientationArray
35 streamTraceur1.UpdatePipeline()
36 ds0 = servermanager.Fetch(streamTraceur1)
37 MyAssert(ds0.GetNumberOfCells()==200)