]> SALOME platform Git repositories - modules/visu.git/blob - src/VISU_SWIG/visu_cache.py
Salome HOME
87c6e26967b2f6aec9eb342dde0e0113b550702c
[modules/visu.git] / src / VISU_SWIG / visu_cache.py
1 #  -*- coding: iso-8859-1 -*-
2 #  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
3 #
4 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
5 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 #
7 #  This library is free software; you can redistribute it and/or
8 #  modify it under the terms of the GNU Lesser General Public
9 #  License as published by the Free Software Foundation; either
10 #  version 2.1 of the License.
11 #
12 #  This library is distributed in the hope that it will be useful,
13 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 #  Lesser General Public License for more details.
16 #
17 #  You should have received a copy of the GNU Lesser General Public
18 #  License along with this library; if not, write to the Free Software
19 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
20 #
21 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #
23 import os
24 import time
25 import VISU
26 import SALOMEDS
27 from batchmode_visu import *
28
29 #---------------------------------------------------------------
30 def WalkTroughTimeStamps(theVISUType,
31                          theInput,
32                          theViewManager):
33   aView = theViewManager.Create3DView();
34   aView.SetTitle("To test presentation of %s type" % theVISUType)
35
36   aCache = myVisu.GetColoredPrs3dCache(myVisu.GetCurrentStudy())
37   aHolder = aCache.CreateHolder(theVISUType, theInput)
38
39   if not aHolder:
40     print "It is impossible to create such kind of holder (%s) with the given parameters" % theVISUType
41     print "\ttheMeshName = '%s'" % theInput.myMeshName
42     print "\ttheEntity = %s" % theInput.myEntity
43     print "\ttheFieldName = '%s'" % theInput.myFieldName
44     print "\ttheTimeStampNumber = %s" % theInput.myTimeStampNumber
45     return
46
47   aPrs3d = aHolder.GetDevice()
48
49   if not aHolder.Apply(aPrs3d, theInput, aView):
50     print "It is impossible to create such kind of presentation (%s) with the given parameters" % theVISUType
51     print "\ttheMeshName = '%s'" % theInput.myMeshName
52     print "\ttheEntity = %s" % theInput.myEntity
53     print "\ttheFieldName = '%s'" % theInput.myFieldName
54     print "\ttheTimeStampNumber = %s" % theInput.myTimeStampNumber
55     return
56
57   aView.FitAll()
58
59   aDelay = 0.0
60   aRange = aHolder.GetTimeStampsRange()
61   for anInfo in aRange:
62     print "%d (%s); " % (anInfo.myNumber, anInfo.myTime)
63     theInput.myTimeStampNumber = anInfo.myNumber
64     aHolder.Apply(aPrs3d, theInput, aView)
65     time.sleep(aDelay)
66     pass
67   pass
68
69 #---------------------------------------------------------------
70 PRS3D_TYPE_LIST = []
71 PRS3D_TYPE_LIST.append(VISU.TGAUSSPOINTS)
72 PRS3D_TYPE_LIST.append(VISU.TSCALARMAP)
73 PRS3D_TYPE_LIST.append(VISU.TISOSURFACES)
74 PRS3D_TYPE_LIST.append(VISU.TCUTPLANES)
75 PRS3D_TYPE_LIST.append(VISU.TCUTLINES)
76 PRS3D_TYPE_LIST.append(VISU.TCUTSEGMENT)
77 PRS3D_TYPE_LIST.append(VISU.TPLOT3D)
78 PRS3D_TYPE_LIST.append(VISU.TDEFORMEDSHAPE)
79 PRS3D_TYPE_LIST.append(VISU.TVECTORS)
80 PRS3D_TYPE_LIST.append(VISU.TSTREAMLINES)
81 PRS3D_TYPE_LIST.append(VISU.TSCALARMAPONDEFORMEDSHAPE)
82 PRS3D_TYPE_LIST.append(VISU.TDEFORMEDSHAPEANDSCALARMAP)
83
84
85 #---------------------------------------------------------------
86 aMedFile = "TimeStamps.med"
87 aMedFile = "ResOK_0000.med"
88 aMedFile = os.getenv('DATA_DIR') + '/MedFiles/' + aMedFile
89 aResult = myVisu.ImportFile(aMedFile)
90
91 aMeshName ="dom"
92 anEntity = VISU.NODE
93 aFieldName = "vitesse";
94 aTimeStampNumber = 1
95
96 anInput = VISU.ColoredPrs3dHolder.BasicInput(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber);
97
98 aViewManager = myVisu.GetViewManager();
99
100 WalkTroughTimeStamps(VISU.TSCALARMAP, anInput, aViewManager)
101
102 for aVISUType in PRS3D_TYPE_LIST:
103   WalkTroughTimeStamps(aVISUType, anInput, aViewManager)
104   pass
105
106 anInput.myEntity = VISU.CELL;
107 anInput.myFieldName = "pression";
108 WalkTroughTimeStamps(VISU.TGAUSSPOINTS, anInput, aViewManager)
109
110 #execfile('/data/apo/a.py')