]> SALOME platform Git repositories - tools/paravisaddons_common.git/blob - src/ContactReader/Test/23711_without_time.py
Salome HOME
[EDF23711] : tests of contactreader (*.rco) after implementation of time management
[tools/paravisaddons_common.git] / src / ContactReader / Test / 23711_without_time.py
1 from paraview.simple import *
2 from vtk.util import numpy_support
3 import numpy as np
4
5 def MyAssert(b):
6     if not b:
7         raise RuntimeError("Oooops : Assertion failed !")
8 NB_OF_LINES_FOR_1TS = 65 # not 66 because AB is not for inst == 2.0 !?
9 cr = ContactReader(registrationName='TEST.rco', FileName='23711_without_time.rco')
10 cr.UpdatePipelineInformation()
11 anim = GetAnimationScene()
12 tk = anim.TimeKeeper
13 times = tk.TimestepValues
14 MyAssert(times==[])
15 # time step 0
16 cr.UpdatePipeline()
17 ds0 = servermanager.Fetch(cr)
18 MyAssert([ds0.GetPointData().GetArrayName(i) for i in range(ds0.GetPointData().GetNumberOfArrays())]==["Resultante"])
19 MyAssert(ds0.GetNumberOfPoints()%NB_OF_LINES_FOR_1TS == 0)
20 step = int(ds0.GetNumberOfPoints()/NB_OF_LINES_FOR_1TS)
21 ts0 = numpy_support.vtk_to_numpy(ds0.GetPointData().GetAbstractArray(0))[::step]
22 MyAssert(ts0.shape == (NB_OF_LINES_FOR_1TS,3))