1 from paraview.simple import *
2 from vtk.util import numpy_support
7 raise RuntimeError("Oooops : Assertion failed !")
8 NB_OF_LINES_FOR_1TS = 22
9 cr = ContactReader(registrationName='TEST.rco', FileName='23711_with_time.rco')
10 cr.UpdatePipelineInformation()
11 anim = GetAnimationScene()
13 times = tk.TimestepValues
14 MyAssert(times==[0.0,1.0,2.0])
16 meshViewer = GetActiveView()
18 meshViewer.ViewTime = times[0]
19 meshViewer.Representations[0].UpdatePipeline()
22 ds0 = servermanager.Fetch(cr)
23 MyAssert([ds0.GetPointData().GetArrayName(i) for i in range(ds0.GetPointData().GetNumberOfArrays())]==["Resultante"])
24 MyAssert(ds0.GetNumberOfPoints()%NB_OF_LINES_FOR_1TS == 0)
25 step = int(ds0.GetNumberOfPoints()/NB_OF_LINES_FOR_1TS)
26 ts0 = numpy_support.vtk_to_numpy(ds0.GetPointData().GetAbstractArray(0))[::step]
27 MyAssert(ts0.shape == (NB_OF_LINES_FOR_1TS,3))
30 meshViewer.ViewTime = times[1]
31 meshViewer.Representations[0].UpdatePipeline()
34 ds0 = servermanager.Fetch(cr)
35 ts1 = numpy_support.vtk_to_numpy(ds0.GetPointData().GetAbstractArray(0))[::step]
36 MyAssert(not np.all(ts0==ts1))
37 MyAssert(ts1.shape == (NB_OF_LINES_FOR_1TS,3))
40 meshViewer.ViewTime = times[2]
41 meshViewer.Representations[0].UpdatePipeline()
44 ds0 = servermanager.Fetch(cr)
45 ts2 = numpy_support.vtk_to_numpy(ds0.GetPointData().GetAbstractArray(0))[::step]
46 MyAssert(ts2.shape == (NB_OF_LINES_FOR_1TS-1,3)) # ???? for TS == 2.0 Plot AS is missing !?