types with data for even one field (from available) will be selected.
"""
+ if not hasattr(proxy, 'Entity'):
+ return
+
#all_cell_types = proxy.CellTypes.Available
all_cell_types = proxy.Entity.Available
all_arrays = list(proxy.CellArrays.GetData())
def get_time(proxy, timestamp_nb):
"""Get time value by timestamp number."""
# Check timestamp number
- timestamps = proxy.TimestepValues.GetData()
+ timestamps = []
+
+ if (hasattr(proxy, 'TimestepValues')):
+ timestamps = proxy.TimestepValues.GetData()
+ elif (hasattr(proxy.Input, 'TimestepValues')):
+ timestamps = proxy.Input.TimestepValues.GetData()
+
if ((timestamp_nb - 1) not in xrange(len(timestamps))):
raise ValueError("Timestamp number is out of range: " + str(timestamp_nb))
return gausspnt
+def GaussPointsOnField1(proxy, entity, field_name,
+ timestamp_nb,
+ is_colored=True, color=None,
+ primitive=GaussType.SPHERE,
+ is_proportional=True,
+ max_pixel_size=256,
+ multiplier=None,
+ vector_mode='Magnitude'):
+ """Creates Gauss Points on the given field. Use GaussPoints() Paraview interface.
+
+ Arguments:
+ proxy: the pipeline object, containig data
+ entity: the field entity type from PrsTypeEnum
+ field_name: the field name
+ timestamp_nb: the number of time step (1, 2, ...)
+ is_colored -- defines whether the Gauss Points will be multicolored,
+ using the corresponding data values
+ color: defines the presentation color as [R, G, B] triple. Taken into
+ account only if is_colored is False.
+ primitive: primitive type from GaussType
+ is_proportional: if True, the size of primitives will depends on
+ the gauss point value
+ max_pixel_size: the maximum sizr of the Gauss Points primitive in pixels
+ multiplier: coefficient between data values and the size of primitives
+ If not passed by user, default scale will be computed.
+ vector_mode: the mode of transformation of vector values into
+ scalar values, applicable only if the field contains vector values.
+ Possible modes: 'Magnitude' - vector module;
+ 'X', 'Y', 'Z' - vector components.
+
+ Returns:
+ Gauss Points as representation object.
+
+ """
+ # Get time value
+ time_value = get_time(proxy, timestamp_nb)
+
+ # Set timestamp
+ pv.GetRenderView().ViewTime = time_value
+ proxy.UpdatePipeline(time=time_value)
+
+ # Create Gauss Points object
+ source = pv.GaussPoints(proxy)
+ source.UpdatePipeline()
+
+ # Get Gauss Points representation object
+ gausspnt = pv.GetRepresentation(source)
+
+ # Get lookup table
+ entity_data_info = None
+ point_data_info = source.GetPointDataInformation()
+ if field_name in point_data_info.keys():
+ entity_data_info = point_data_info
+ else:
+ entity_data_info = source.GetCellDataInformation()
+ nb_components = entity_data_info[field_name].GetNumberOfComponents()
+
+ lookup_table = get_lookup_table(field_name, nb_components, vector_mode)
+
+ # Set field range if necessary
+ data_range = get_data_range(proxy, entity,
+ field_name, vector_mode)
+ lookup_table.LockScalarRange = 1
+ lookup_table.RGBPoints = [data_range[0], 0, 0, 1, data_range[1], 1, 0, 0]
+
+ # Set display properties
+ if is_colored:
+ gausspnt.ColorAttributeType = EntityType.get_pvtype(entity)
+ gausspnt.ColorArrayName = field_name
+ else:
+ gausspnt.ColorArrayName = ''
+ if color:
+ gausspnt.DiffuseColor = color
+
+ gausspnt.LookupTable = lookup_table
+
+ # Add scalar bar
+ add_scalar_bar(field_name, nb_components,
+ vector_mode, lookup_table, time_value)
+
+ # Set point sprite representation
+ gausspnt.Representation = 'Point Sprite'
+
+ # Point sprite settings
+ gausspnt.InterpolateScalarsBeforeMapping = 0
+ gausspnt.MaxPixelSize = max_pixel_size
+
+ # Render mode
+ gausspnt.RenderMode = GaussType.get_mode(primitive)
+
+ #if primitive == GaussType.SPRITE:
+ # Set texture
+ # TODO(MZN): replace with pvsimple high-level interface
+ # texture = sm.CreateProxy("textures", "SpriteTexture")
+ # alphamprop = texture.GetProperty("AlphaMethod")
+ # alphamprop.SetElement(0, 2) # Clamp
+ # alphatprop = texture.GetProperty("AlphaThreshold")
+ # alphatprop.SetElement(0, 63)
+ # maxprop = texture.GetProperty("Maximum")
+ # maxprop.SetElement(0, 255)
+ # texture.UpdateVTKObjects()
+
+ # gausspnt.Texture = texture
+ #gausspnt.Texture.AlphaMethod = 'Clamp'
+ #gausspnt.Texture.AlphaThreshold = 63
+ #gausspnt.Texture.Maximum= 255
+
+ # Proportional radius
+ gausspnt.RadiusUseScalarRange = 0
+ gausspnt.RadiusIsProportional = 0
+
+ if is_proportional:
+ mult = multiplier
+ if mult is None:
+ mult = abs(0.1 / data_range[1])
+
+ gausspnt.RadiusScalarRange = data_range
+ gausspnt.RadiusTransferFunctionEnabled = 1
+ gausspnt.RadiusMode = 'Scalar'
+ gausspnt.RadiusArray = ['POINTS', field_name]
+ if nb_components > 1:
+ v_comp = get_vector_component(vector_mode)
+ gausspnt.RadiusVectorComponent = v_comp
+ gausspnt.RadiusTransferFunctionMode = 'Table'
+ gausspnt.RadiusScalarRange = data_range
+ gausspnt.RadiusUseScalarRange = 1
+ gausspnt.RadiusIsProportional = 1
+ gausspnt.RadiusProportionalFactor = mult
+ else:
+ gausspnt.RadiusTransferFunctionEnabled = 0
+ gausspnt.RadiusMode = 'Constant'
+ gausspnt.RadiusArray = ['POINTS', 'Constant Radius']
+
+ return gausspnt
def StreamLinesOnField(proxy, entity, field_name, timestamp_nb,
direction='BOTH', is_colored=False, color=None,
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/3D_viewer/B1 case
+
+from paravistest import *
+from presentations import *
+from pvsimple import *
+import paravis
+
+import math
+
+# 1. First viewer creation
+view1 = GetRenderView()
+
+# 2. Second viewer creation
+view2 = CreateRenderView()
+
+# 3. Change view size
+size1 = view1.ViewSize
+size2 = view2.ViewSize
+
+w = size1[0] + size2[0]
+w1 = math.trunc(w * 0.7)
+w2 = w - w1
+
+view1.ViewSize = [w1, size1[1]]
+view2.ViewSize = [w2, size2[1]]
+
+# 4. Change view position
+h = view1.ViewSize[1]
+view1.ViewSize = [h//2, w]
+view2.ViewSize = [h//2, w]
+view1.ViewPosition = [0, h//2]
+view1.ViewPosition = [0, 0]
+
+Render(view1)
+Render(view2)
A8
A9
B0
+ B1
B2
)
SET(TIMEOUT 10000)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/animation/A1 case
+# Test animation API
+
+import sys
+import os
+from paravistest import *
+from presentations import *
+from pvsimple import *
+import paravis
+
+my_paravis = paravis.myParavis
+
+# 1. TimeStamps.med import
+print 'Importing "TimeStamps.med"................',
+file_path = datadir + "TimeStamps.med"
+my_paravis.ImportFile(file_path)
+med_reader = GetActiveSource()
+if med_reader is None:
+ print "FAILED"
+else:
+ print "OK"
+
+# 2. CutLines creation
+print "Creating Cut Lines........................",
+med_field = "vitesse"
+cutlines = CutLinesOnField(med_reader, EntityType.NODE, med_field, 1,
+ nb_lines = 20,
+ orientation1=Orientation.XY, orientation2=Orientation.ZX)
+if cutlines is None:
+ print "FAILED"
+else:
+ print "OK"
+
+# 3. Display CutLines
+print "Getting a Viewer.........................",
+view = GetRenderView()
+if view is None:
+ print "FAILED"
+else:
+ print "OK"
+cutlines.Visibility = 1
+Render(view=view)
+cutlines.Visibility = 0
+Render(view=view)
+display_only(cutlines, view=view)
+reset_view(view=view)
+
+# 4. Animation
+print "Get Animation scene.....................",
+scene = GetAnimationScene()
+if scene is None:
+ print "FAILED"
+else:
+ print "OK"
+
+print "Duration default... ", scene.Duration
+scene.Duration = -10
+scene.Duration = 120
+scene.Duration = 0
+scene.Duration = 30
+print "Duration ... ", scene.Duration
+
+print "Loop ... ", scene.Loop
+scene.Loop = 1
+print "Loop ... ", scene.Loop
+scene.Loop = 0
+print "Loop ... ", scene.Loop
+
+print "AnimationTime ... ", scene.AnimationTime
+
+scene.Play()
+
+scene.GoToFirst()
+scene.GoToNext()
+scene.GoToNext()
+
+print "AnimationTime ... ", scene.AnimationTime
+
+scene.GoToPrevious()
+scene.GoToLast()
+
+scene.Stop()
+
+print "AnimationTime ... ", scene.AnimationTime
+
+scene.AnimationTime = -1
+scene.AnimationTime = scene.TimeKeeper.TimestepValues[1]
+scene.AnimationTime = scene.TimeKeeper.TimestepValues[0]
+
+nb_frames = scene.NumberOfFrames
+print "NumberOfFrames ... ", nb_frames
+
IF (PYTHON_EXECUTABLE)
FOREACH ( tfile
A0
+ A1
A2
A4
A7
SUBDIRS(Util
2D_viewer
- 3D_viewer
- ScalarMap
- DeformedShape
- ScalarMap_On_DeformedShape
- CutPlanes
- CutLines
- Vectors
+ 3D_viewer
+ ScalarMap
+ DeformedShape
+ ScalarMap_On_DeformedShape
+ CutPlanes
+ CutLines
+ Vectors
Plot3D
IsoSurfaces
MeshPresentation
Animation
- GaussPoints
- StreamLines
- SWIG_scripts
- Tables
+ GaussPoints
+ StreamLines
+ SWIG_scripts
+ Tables
+ ImportMedField
+ united
+ bugs
+ imps
+ dump_study
)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/GaussPoints/C8 case
+# Create Gauss Points on the field of the MED file
+
+import os
+import sys
+
+from paravistest import datadir, pictureext, get_picture_dir
+from presentations import *
+import paravis
+import pvsimple
+
+
+# Directory for saving snapshots
+picturedir = get_picture_dir(sys.argv[1], "GaussPoints/C8")
+if not picturedir.endswith(os.sep):
+ picturedir += os.sep
+
+# MED file
+file_name = datadir + "ir.resu.med"
+field_name = "gravit_VARI_ELGA"
+timestamp_nb = 1
+
+paravis.myParavis.ImportFile(file_name)
+med_reader = pvsimple.GetActiveSource()
+if med_reader is None:
+ raise RuntimeError("File wasn't imported!!!")
+
+pvsimple.Show()
+
+# Create Gauss Points presentation
+view = pvsimple.GetRenderView()
+time = get_time(med_reader, timestamp_nb)
+
+prs = GaussPointsOnField1(med_reader, EntityType.CELL, field_name, timestamp_nb)
+if prs is None:
+ raise RuntimeError, "Created presentation is None!!!"
+
+# Display presentation and get snapshot
+pic_name = picturedir + field_name + "_" + str(time) + "_GAUSSPOINTS." + pictureext
+process_prs_for_test(prs, view, pic_name)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/GaussPoints/C9 case
+# Create Gauss Points on the field of the MED file
+
+import os
+import sys
+
+from paravistest import datadir, pictureext, get_picture_dir
+from presentations import *
+import paravis
+import pvsimple
+
+
+# Directory for saving snapshots
+picturedir = get_picture_dir(sys.argv[1], "GaussPoints/C9")
+if not picturedir.endswith(os.sep):
+ picturedir += os.sep
+
+# MED file
+file_name = datadir + "petit.rmed"
+field_name = "RESPIL_SIEF_ELGA"
+timestamp_nb = 1
+
+paravis.myParavis.ImportFile(file_name)
+med_reader = pvsimple.GetActiveSource()
+if med_reader is None:
+ raise RuntimeError("File wasn't imported!!!")
+
+# Create Gauss Points presentation
+view = pvsimple.GetRenderView()
+time = get_time(med_reader, timestamp_nb)
+
+prs = GaussPointsOnField1(med_reader, EntityType.CELL, field_name, timestamp_nb, multiplier=4E-9)
+if prs is None:
+ raise RuntimeError, "Created presentation is None!!!"
+
+# Display presentation and get snapshot
+pic_name = picturedir + field_name + "_" + str(time) + "_GAUSSPOINTS." + pictureext
+process_prs_for_test(prs, view, pic_name)
+
+
C5
C6
C7
+ C8
+ C9
)
SET(TIMEOUT 10000)
ADD_TEST(GAUSSPOINTS_${tfile} ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/VisuPrs/Util/paravistesthelper.py ${TIMEOUT} ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/ImportMedField/A0 case
+# Import MED file; create presentations for the given fields.
+
+from paravistest import datadir, Import_Med_Field
+import paravis
+
+med_file = datadir + "ResOK_0000.med"
+field_names = ["temperature", "vitesse", "pression"]
+prs_list = [ [1,2,3,4,8], range(1,10), [0,1,2,3,4,8] ]
+
+Import_Med_Field(paravis.myParavis, med_file, field_names, 1, prs_list)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/ImportMedField/A1 case
+# Import MED file; create presentations for the given fields.
+
+from paravistest import datadir, Import_Med_Field
+import paravis
+
+med_file = datadir + "TimeStamps.med"
+field_names = ["pression", "temperature", "vitesse"]
+prs_list = [ [0,1,2,3,4,8], [1,2,3,4,8], range(1,10) ]
+
+Import_Med_Field(paravis.myParavis, med_file, field_names, 1, prs_list)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/ImportMedField/A2 case
+# Import MED file; create presentations for the given fields.
+
+from paravistest import datadir, Import_Med_Field
+import paravis
+
+med_file = datadir + "carre_en_quad4_import22.med"
+field_names = ["fieldcelldouble", "fieldnodedouble", "fieldnodedouble", "fieldnodedouble", "fieldnodeint"]
+prs_list = [ range(10), [1,2,3,4,8], [1,2,3,4,8], [1,2,3,4,8], [1,2,3,4,8] ]
+
+Import_Med_Field(paravis.myParavis, med_file, field_names, 1, prs_list)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/ImportMedField/A3 case
+# Import MED file; create presentations for the given fields.
+
+from paravistest import datadir, Import_Med_Field
+import paravis
+
+med_file = datadir + "carre_en_quad4_seg2.med"
+field_names = ["fieldcelldouble", "fieldnodedouble", "fieldnodedouble", "fieldnodedouble", "fieldnodeint"]
+prs_list = [ range(10), [1,2,3,4,8], [1,2,3,4,8], [1,2,3,4,8], [1,2,3,4,8] ]
+
+Import_Med_Field(paravis.myParavis, med_file, field_names, 1, prs_list)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/ImportMedField/A4 case
+# Import MED file; create presentations for the given fields.
+
+from paravistest import datadir, Import_Med_Field
+import paravis
+
+med_file = datadir + "test_hydro_darcy1a_out.med"
+field_names = ["DarcyVelocity","Head"]
+prs_list = [ range(10), [0,1,2,3,4,8] ]
+
+Import_Med_Field(paravis.myParavis, med_file, field_names, 1, prs_list)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/ImportMedField/A5 case
+# Import MED file; create presentations for the given fields.
+
+from paravistest import datadir, Import_Med_Field
+import paravis
+
+med_file = datadir + "clo2.med"
+field_names = ["PRESSION", "TAUX_DE_VIDE", "VITESSE"]
+prs_list = [ [0,1,2,3,4,8], [1,2,3,4,8], range(1,10) ]
+
+Import_Med_Field(paravis.myParavis, med_file, field_names, 1, prs_list)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/ImportMedField/A6 case
+# Import MED file; create presentations for the given fields.
+
+from paravistest import datadir, Import_Med_Field
+import paravis
+
+med_file = datadir + "cube_hexa8_import22.med"
+field_names = ["fieldcelldouble", "fieldnodedouble", "fieldnodedouble", "fieldnodedouble", "fieldnodeint"]
+prs_list = [ range(10), [1,2,3,4,8], [1,2,3,4,8], [1,2,3,4,8], [1,2,3,4,8] ]
+
+Import_Med_Field(paravis.myParavis, med_file, field_names, 1, prs_list)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/ImportMedField/A7 case
+# Import MED file; create presentations for the given fields.
+
+from paravistest import datadir, Import_Med_Field
+import paravis
+
+med_file = datadir + "cube_hexa8_quad4_import22.med"
+field_names = ["fieldcelldouble", "fieldnodedouble", "fieldnodedouble", "fieldnodedouble", "fieldnodeint"]
+prs_list = [ range(10), [1,2,3,4,8], [1,2,3,4,8], [1,2,3,4,8], [1,2,3,4,8] ]
+
+Import_Med_Field(paravis.myParavis, med_file, field_names, 1, prs_list)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/ImportMedField/A8 case
+# Import MED file; create presentations for the given fields.
+
+from paravistest import datadir, Import_Med_Field
+import paravis
+
+med_file = datadir + "fra1.med"
+field_names = ["TAUX_DE_VIDE", "VITESSE"]
+prs_list = [ [1,2,3,4,8], range(1,10) ]
+
+Import_Med_Field(paravis.myParavis, med_file, field_names, 1, prs_list)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/ImportMedField/A9 case
+# Import MED file; create presentations for the given fields.
+
+from paravistest import datadir, Import_Med_Field
+import paravis
+
+med_file = datadir + "maill.0.med"
+field_names = ["REQT_GD_________________________", "RESUTRQUDEPL____________________", "RESUTRQUERRE_ELGA_NORE__________", "RESUTRQUSIEF_ELGA_DEPL__________", "RESUTRQUSIGM_ELNO_DEPL__________"]
+prs_list = [ range(1,10), range(1,10), range(10), range(10), range(10)])
+
+Import_Med_Field(paravis.myParavis, med_file, field_names, 1, prs_list)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/ImportMedField/B0 case
+# Import MED file; create presentations for the given fields.
+
+from paravistest import datadir, Import_Med_Field
+import paravis
+
+med_file = datadir + "maill.0_volumes.med"
+field_names = ["RETH____FLUX_NOEU_TEMP__________", "RETH____TEMP____________________"]
+prs_list = [ range(1,10), [1,2,3,4,8] ]
+
+Import_Med_Field(paravis.myParavis, med_file, field_names, 1, prs_list)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/ImportMedField/B1 case
+# Import MED file; create presentations for the given fields.
+
+from paravistest import datadir, Import_Med_Field
+import paravis
+
+med_file = datadir + "maill.1.med"
+field_names = ["RETH____FLUX_NOEU_TEMP__________", "RETH____TEMP____________________"]
+prs_list = [ range(1,10), [1,2,3,4,8] ]
+
+Import_Med_Field(paravis.myParavis, med_file, field_names, 1, prs_list)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/ImportMedField/B2 case
+# Import MED file; create presentations for the given fields.
+
+from paravistest import datadir, Import_Med_Field
+import paravis
+
+med_file = datadir + "maill.2.med"
+field_names = ["RETH____FLUX_NOEU_TEMP__________","RETH____TEMP____________________"]
+prs_list = [ range(1,10), [1,2,3,4,8] ]
+
+Import_Med_Field(paravis.myParavis, med_file, field_names, 1, prs_list)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/ImportMedField/B3 case
+# Import MED file; create presentations for the given fields.
+
+from paravistest import datadir, Import_Med_Field
+import paravis
+
+med_file = datadir + "zzzz121b.med"
+field_names = ["RESUZERODEPL____________________", "RESUZEROERRE_ELGA_NORE__________", "RESUZEROSIEF_ELGA_DEPL__________", "RESUZEROSIGM_ELNO_DEPL__________"]
+prs_list = [ [0,1,5,6,7], [0,1,5,6,7], [0,1,5,6,7], [0,1,5,6,7,9] ]
+
+Import_Med_Field(paravis.myParavis, med_file, field_names, 1, prs_list)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/ImportMedField/B4 case
+# Import MED file; create presentations for the given fields.
+
+from paravistest import datadir, Import_Med_Field
+import paravis
+
+med_file = datadir + "pointe_4fields.med"
+field_names = ["fieldcelldoublescalar", "fieldcelldoublevector", "fieldnodedouble", "fieldnodedouble", "fieldnodedouble", "fieldnodeint"]
+prs_list = [ [0,1,2,3,4,8], range(10), [1,2,3,4,8], [1,2,3,4,8], [1,2,3,4,8], [1,2,3,4,8] ]
+
+Import_Med_Field(paravis.myParavis, med_file, field_names, 1, prs_list)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/ImportMedField/B5 case
+# Import MED file; create presentations for the given fields.
+
+from paravistest import datadir, Import_Med_Field
+import paravis
+
+med_file = datadir + "pointe.med"
+field_names = ["fieldcelldoublescalar", "fieldcelldoublevector", "fieldnodedouble", "fieldnodedouble", "fieldnodedouble", "fieldnodeint"]
+prs_list = [ [0,1,2,3,4,8], range(10), [1,2,3,4,8], [1,2,3,4,8], [1,2,3,4,8], [1,2,3,4,8] ]
+
+Import_Med_Field(paravis.myParavis, med_file, field_names, 1, prs_list)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/ImportMedField/B6 case
+# Import MED file; create presentations for the given fields.
+
+from paravistest import datadir, Import_Med_Field
+import paravis
+
+med_file = datadir + "polygones.med"
+field_names = ["bord_:_distorsion","bord_:_familles","bord_:_non-ortho"]
+prs_list = [ [0,1,2,3,4,8], [0,1,2,3,4,8], [0,1,2,3,4,8] ]
+
+Import_Med_Field(paravis.myParavis, med_file, field_names, 1, prs_list)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/ImportMedField/B7 case
+# Import MED file; create presentations for the given fields.
+
+from paravistest import datadir, Import_Med_Field
+import paravis
+
+med_file = datadir + "recoll_bord.med"
+field_names = ["bord_:_distorsion","bord_:_familles","bord_:_non-ortho"]
+prs_list = [ [0,1,2,3,4,8], [0,1,2,3,4,8], [0,1,2,3,4,8] ]
+
+Import_Med_Field(paravis.myParavis, med_file, field_names, 1, prs_list)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/ImportMedField/B8 case
+# Import MED file; create presentations for the given fields.
+
+from paravistest import datadir, Import_Med_Field
+import paravis
+
+med_file = datadir + "resu.2.med"
+field_names = ["RETH____FLUX_NOEU_TEMP__________","RETH____TEMP____________________"]
+prs_list = [ range(1,10), [1,2,3,4,8] ]
+
+Import_Med_Field(paravis.myParavis, med_file, field_names, 1, prs_list)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/ImportMedField/B9 case
+# Import MED file; create presentations for the given fields.
+
+from paravistest import datadir, Import_Med_Field
+import paravis
+
+med_file = datadir + "test_2D.med"
+field_names = ["champ","field_v","field_v_p"]
+prs_list = [ [0,1,2,3,4,8], [0,1,2,3,4,8], [0,1,2,3,4,8] ]
+
+Import_Med_Field(paravis.myParavis, med_file, field_names, 1, prs_list)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/ImportMedField/C0 case
+# Import MED file; create presentations for the given fields.
+
+from paravistest import datadir, Import_Med_Field
+import paravis
+
+med_file = datadir + "homard_ASTER_OSF_MEDV2.1.5_1_v2.1.med"
+field_names = ["REMEZEROERRE_ELGA_NORE__________", "RETHZEROTEMP____________________"]
+prs_list = [ [0,1], [1] ]
+
+Import_Med_Field(paravis.myParavis, med_file, field_names, 1, prs_list)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/ImportMedField/C1 case
+# Import MED file; create presentations for the given fields.
+
+from paravistest import datadir, Import_Med_Field
+import paravis
+
+med_file = datadir + "homard_ASTER_OSF_MEDV2.1.5_1.med2.2.med"
+field_names = ["REMEUN__ERRE_ELGA_NORE__________", "RETHUN__TEMP____________________"]
+prs_list = [ [0,1], [1] ]
+
+Import_Med_Field(paravis.myParavis, med_file, field_names, 1, prs_list)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/ImportMedField/C2 case
+# Import MED file; create presentations for the given fields.
+
+from paravistest import datadir, Import_Med_Field
+import paravis
+
+med_file = datadir + "homard_ASTER_OSF_MEDV2.1.5_1.med2.3.med"
+field_names = ["REMEZEROERRE_ELGA_NORE__________", "RETHZEROTEMP____________________"]
+prs_list = [ [0,1], [1] ]
+
+Import_Med_Field(paravis.myParavis, med_file, field_names, 1, prs_list)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+IF (PYTHON_EXECUTABLE)
+ FOREACH ( tfile
+ A0
+ A1
+ A2
+ A3
+ A4
+ A5
+ A6
+ A7
+ A8
+ A9
+ B0
+ B1
+ B2
+ B3
+ B4
+ B5
+ B6
+ B7
+ B8
+ B9
+ C0
+ C1
+ C2
+ )
+ SET(TIMEOUT 10000)
+ ADD_TEST(IMPORTMEDFIELD_${tfile} ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/test/VisuPrs/Util/paravistesthelper.py ${TIMEOUT} ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py ${PARAVIS_TEST_OUTPUT_DIR})
+ SET_TESTS_PROPERTIES(IMPORTMEDFIELD_${tfile} PROPERTIES FAIL_REGULAR_EXPRESSION "FAILED" TIMEOUT ${TIMEOUT})
+ ENDFOREACH( tfile )
+ENDIF (PYTHON_EXECUTABLE)
--- /dev/null
+
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/SWIG_scripts/B4 case
+
+import sys
+import os
+
+from paravistest import datadir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+
+# Import MED file
+med_file_path = datadir + "pointe.med"
+my_paravis.ImportFile(med_file_path)
+med_reader = pvsimple.GetActiveSource()
+
+if med_reader is None:
+ raise RuntimeError, "MED file was not imported successfully."
+
+# Create presentations
+try:
+ if os.access(med_file_path, os.R_OK) :
+ if os.access(med_file_path, os.W_OK) :
+ mesh_name = "maa1"
+ entity = EntityType.NODE
+ field_name = "fieldnodedouble"
+ timestamp_id = 1
+
+ scalarmap = ScalarMapOnField(med_reader, entity, field_name, timestamp_id)
+ if get_nb_components(med_reader, entity, field_name) > 1:
+ vectors = VectorsOnField(med_reader, entity, field_name, timestamp_id)
+ cutplanes = CutPlanesOnField(med_reader, entity, field_name, timestamp_id)
+
+ mesh = MeshOnEntity(med_reader, mesh_name, entity)
+ else:
+ print "We have no permission to rewrite medFile"
+ else:
+ print "We have no permission to read medFile, it will not be opened";
+except:
+ print sys.exc_type
+ print sys.exc_value
+ print sys.exc_traceback
+
+
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/SWIG_scripts/C6 case
+# Import a table from file and show it in 2D viewer
+
+from paravistest import tablesdir
+from presentations import *
+import paravis
+import pvsimple
+
+
+# 1. Import tables from file
+file_path = tablesdir + "tables_test.xls"
+table_reader = pvsimple.TableReader(FileName=file_path)
+if table_reader is None:
+ print "FAILED to import tables from tables_test.xls file."
+
+# 2. Create curves viewer
+cur_view = pvsimple.GetRenderView()
+if cur_view:
+ pvsimple.Delete(cur_view)
+xy_view = pvsimple.CreateXYPlotView()
+
+# 3. Display curves in the viewer
+table_reader.TableNumber = 1
+xy_rep = pvsimple.Show(table_reader)
+xy_rep.AttributeType = 'Row Data'
+xy_rep.UseIndexForXAxis = 0
+xy_rep.XArrayName = 'toto 1 [s]'
+xy_rep.SeriesVisibility = [xy_rep.XArrayName, '0']
+xy_rep.SeriesVisibility = ['vtkOriginalIndices', '0']
+pvsimple.Render(xy_view)
+
# Reset view
reset_view(view=view)
-
# Write image
# Directory for saving snapshots
A9
B0
B1
+ B4
B5
B6
B7
B8
B9
C3
+ C6
C7
)
SET(TIMEOUT 10000)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/ScalarMap/B3 case
+# Test ScalarMap interface methods.
+
+from paravistest import datadir
+import presentations
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+
+# 1. Import MED file
+
+print 'Importing "fra.med"...',
+file_path = datadir + "fra.med"
+my_paravis.ImportFile(file_path)
+med_reader = pvsimple.GetActiveSource()
+
+if med_reader is None:
+ print "FAILED"
+else:
+ print "OK"
+
+# 2. Create ScalarMap
+field_name = 'TAUX_DE_VIDE'
+entity = presentations.EntityType.NODE
+myMeshName='LE VOLUME'
+
+scalarmap = presentations.ScalarMapOnField(med_reader, entity, field_name, 1)
+if scalarmap is None:
+ print "FAILED"
+
+# 3. Scalar mode
+lookup_table = scalarmap.LookupTable
+print "Vector mode .....", lookup_table.VectorMode
+print "Vector component .....", lookup_table.VectorComponent
+
+lookup_table.VectorMode = 'Component'
+lookup_table.VectorComponent = 0
+
+scalarmap.LookupTable = lookup_table
+
+print "Vector mode .....", scalarmap.LookupTable.VectorMode
+print "Vector component .....", scalarmap.LookupTable.VectorComponent
+
+# 4. Scaling mode
+scalarmap.LookupTable.UseLogScale = 1
+print "Use logarithmic scaling ....", scalarmap.LookupTable.UseLogScale
+
+scalarmap.LookupTable.UseLogScale = 0
+print "Use logarithmic scaling ....", scalarmap.LookupTable.UseLogScale
+
+# 5. Scalar range
+print "Set scalar range min=12 < max=120 ...",
+rmin = 12
+rmax = 120
+scalarmap.LookupTable.RGBPoints[0] = rmin
+scalarmap.LookupTable.RGBPoints[4] = rmax
+print "min = ", scalarmap.LookupTable.RGBPoints[0]," : max = ",scalarmap.LookupTable.RGBPoints[4]
+
+print "Set scalar range min=max=12 ...",
+rmin = 120
+rmax = rmin
+scalarmap.LookupTable.RGBPoints[0] = rmin
+scalarmap.LookupTable.RGBPoints[4] = rmax
+print "min = ", scalarmap.LookupTable.RGBPoints[0]," : max = ",scalarmap.LookupTable.RGBPoints[4]
+
+print "Set scalar range min=120 > max=15 ...",
+rmin = 120
+rmax = 15
+scalarmap.LookupTable.RGBPoints[0] = rmin
+scalarmap.LookupTable.RGBPoints[4] = rmax
+print "min = ", scalarmap.LookupTable.RGBPoints[0]," : max = ",scalarmap.LookupTable.RGBPoints[4]
+
+# 6. Bar orientation
+bar = presentations.get_bar()
+
+print "Set bar orientation = 'Horizontal'"
+bar.Orientation = 'Horizontal'
+print "Bar orientation ....", bar.Orientation
+
+print "Set bar orientation = 'Vertical'"
+bar.Orientation = 'Vertical'
+print "Bar orientation ....", bar.Orientation
+
+# 7. Position of scalar bar
+print "Default position ....", bar.Position
+
+print "Set left down corner position"
+bar.Position = [0, 0]
+print "Position =", bar.Position
+
+print "Set position outside of the screen"
+bar.Position = [-1, -1]
+print "Position =", bar.Position
+
+# 8. Size of scalar bar
+print "Default Height=", bar.Position2[1]," : Width=", bar.Position2[0]
+
+print "Set positive Height and Width"
+h = 0.4
+w = 0.2
+bar.Position2 = [w, h]
+print "Size =", bar.Position2
+
+print "Set negative Height and Width"
+h = -0.4
+w = -0.2
+bar.Position2 = [w, h]
+print "Size =", bar.Position2
+
+# 9. Number of colors
+print "Default number of colors = ", scalarmap.LookupTable.NumberOfTableValues
+
+scalarmap.LookupTable.Discretize = 1
+
+print "Set negative number of colors"
+nb_colors = -128
+scalarmap.LookupTable.NumberOfTableValues = nb_colors
+print "Number of colors =", scalarmap.LookupTable.NumberOfTableValues
+
+print "Set zero number of colors"
+nb_colors = 0
+scalarmap.LookupTable.NumberOfTableValues = nb_colors
+print "Number of colors =", scalarmap.LookupTable.NumberOfTableValues
+
+print "Set positive number of colors"
+nb_colors = 256
+scalarmap.LookupTable.NumberOfTableValues = nb_colors
+print "Number of colors =", scalarmap.LookupTable.NumberOfTableValues
+
+# 10. Number of labels
+print "Default number of labels = ", bar.NumberOfLabels
+
+print "Set negative number of labels"
+nb_labels = -10
+bar.NumberOfLabels = nb_labels
+print "Number of labels=", bar.NumberOfLabels
+
+print "Set zero number of labels"
+nb_labels = 0
+bar.NumberOfLabels = nb_labels
+print "Number of labels=", bar.NumberOfLabels
+
+print "Set positive number of labels"
+nb_labels = 10
+bar.NumberOfLabels = nb_labels
+print "Number of labels=", bar.NumberOfLabels
+
+# 11. Scalar bar title
+print 'Default Title ="', bar.Title, '"'
+
+print "Set not null title"
+title = "Scalar Bar Title"
+bar.Title = title
+print ' Title ="', bar.Title, '"'
+
+print "Set title from spaces"
+title=' '
+bar.Title = title
+print ' Title ="', bar.Title, '"'
print " --------------------------------- "
print "\nCreatePrsForFile..."
CreatePrsForFile(myParavis, file, [PrsTypeEnum.STREAMLINES], picturedir, pictureext)
+
+import time
+time.sleep(10000)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/StreamLines/B3 case
+# Create Stream Lines for all fields of each MED file from the given MED files list
+
+import sys
+
+from paravistest import datadir, pictureext, get_picture_dir
+from presentations import CreatePrsForFile, PrsTypeEnum
+import paravis
+
+myParavis = paravis.myParavis
+
+# Directory for saving snapshots
+picturedir = get_picture_dir(sys.argv[1], "StreamLines/B3")
+
+# Create presentations
+files = ["fra", "TimeStamps", "pointe", "Fields_group3D", "Hexa8", "Penta6", "Quad4", "Tetra4", "Tria3", "clo", "carre_en_quad4_seg2", "carre_en_quad4_seg2_fields", "cube_hexa8_quad4"]
+
+for item in files:
+ file = datadir + item + ".med"
+ print " --------------------------------- "
+ print "file ", file
+ print "\nCreatePrsForFile..."
+ print "BREAKPOINT_1"
+ CreatePrsForFile(myParavis, file, [PrsTypeEnum.STREAMLINES], picturedir, pictureext)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/StreamLines/B4 case
+# StreamTracer filter properties
+
+from paravistest import datadir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+
+# 1. Import MED file
+print 'Import "ResOK_0000.med"...............',
+file_path = datadir + "ResOK_0000.med"
+my_paravis.ImportFile(file_path)
+med_reader = pvsimple.GetActiveSource()
+if med_reader is None:
+ print "FAILED"
+else:
+ print "OK"
+
+# 2. Creating StreamLines
+print "Creating Stream Lines.....",
+streamlines = StreamLinesOnField(med_reader, EntityType.NODE, 'vitesse', 1)
+if streamlines is None:
+ print "FAILED"
+else:
+ print "OK"
+
+# 3. StreamLines parameters
+stream_tracer = pvsimple.GetActiveSource()
+
+print "Initial Step Length: ", stream_tracer.InitialStepLength
+print "Integration Direction: ", stream_tracer.IntegrationDirection
+print "Integration Step Unit: ", stream_tracer.IntegrationStepUnit
+print "Integrator Type: ", stream_tracer.IntegratorType
+print "Interpolator Type: ", stream_tracer.InterpolatorType
+print "Maximum Error: ", stream_tracer.MaximumError
+print "Minimum Step Length: ", stream_tracer.MinimumStepLength
+print "Maximum Step Length: ", stream_tracer.MaximumStepLength
+print "Maximum Steps: ", stream_tracer.MaximumSteps
+print "Maximum Streamline Length: ", stream_tracer.MaximumStreamlineLength
+print "Seed Type: ", type(stream_tracer.SeedType)
+print "Center: ", stream_tracer.SeedType.Center
+print "Number Of Points: ", stream_tracer.SeedType.NumberOfPoints
+print "Radius: ", stream_tracer.SeedType.Radius
B0
B1
B2
+ B3
+ B4
E0
E1
E2
F7
F8
F9
+ G0
)
SET(TIMEOUT 10000)
ADD_TEST(STREAMLINES_${tfile} ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/VisuPrs/Util/paravistesthelper.py ${TIMEOUT} ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py)
--- /dev/null
+
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/StreamLines/G0 case
+# StreamTracer filter properties
+
+from paravistest import datadir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+
+# 1. Import MED file
+file_path = datadir + "new_case.rmed"
+my_paravis.ImportFile(file_path)
+med_reader = pvsimple.GetActiveSource()
+if med_reader is None:
+ raise RuntimeError, "new_case.rmed was not imported!!!"
+
+# 2. Creation of a set of "StreamLines" presentations, based on time stamps of "RESU_DEPL" field
+streamlines = StreamLinesOnField(med_reader, EntityType.NODE, 'RESU_DEPL', 1)
+if streamlines is None:
+ raise RuntimeError, "Presentation is None!!!"
+
+import time
+time.sleep(10000)
+
import salome
+
# Auxiliary variables
# Data directory
datadir = samples_dir + "/MedFiles/"
tablesdir = samples_dir + "/Tables/"
-# Graphica files extension
+# Graphics files extension
pictureext = os.getenv("PIC_EXT")
if pictureext == None:
pictureext = "png"
return is_good
+def compare_lists(value, et_value, check_error=0, eps=1e-04):
+ """
+ Compare two lists: the same length and equality of corresponding items
+ param value - list to be compared
+ param et_value - etalon list
+ param check_error - flag to catch exception if errors>0
+ check_error=0 no exception, check_error !=0 catch exception
+ param eps - defines tolerance for comparison
+ return error - number of errors
+ """
+
+ error=0
+ length = len(value)
+ et_length = len(et_value)
+ if length != et_length:
+ print "ERROR!!! There is different number of items in created ", length, " and etalon ", et_length, " lists!!!"
+ error=error+1
+ else:
+ for i in range(et_length):
+ if abs(et_value[i]) > 1:
+ MAX = abs(eps*et_value[i])
+ else:
+ MAX = eps
+ if abs(et_value[i] - value[i])> MAX:
+ print "ERROR!!!", i, "-th item", value[i], " is not equal to etalon item", et_value[i], "!!!"
+ error=error+1
+ if check_error and error > 0:
+ raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."
+ return error
+
+
def setShaded(view, shading):
"""Utility function to set shaded mode in view"""
if shading == 0:
view.LightDiffuseColor = [0, 0, 0]
+def TimeStampId(proxy):
+ """Return tuple for the given MED proxy: (mesh_name, {field_name: [entity, timestamp_id]})
+ Originally defined in KERNEL_TEST/Tools/CommonFunctions file.
+ """
+ import presentations
+ mesh_name = presentations.get_mesh_names(proxy).pop()
+ iterations = {}
+
+ # get list of field names
+ fields_on_points = list(proxy.PointArrays)
+ fields_on_cells = list(proxy.CellArrays)
+ all_fields = fields_on_points + fields_on_cells
+
+ # get timestamps
+ timestamps = proxy.TimestepValues.GetData()
+ timestamp_nb = len(timestamps)
+
+ for field in all_fields:
+ entity = None
+ if fields_on_points.count(field) > 0:
+ entity = presentations.EntityType.NODE
+ elif fields_on_cells.count(field) > 0:
+ entity = presentations.EntityType.CELL
+
+ iterations[field] = [entity, timestamp_nb]
+
+ return mesh_name, iterations
+
+
+def Import_Med_Field(paravis, file, field_names, check_errors=0, prs=[]):
+ """Builds presentations on the given fields of the MED file.
+ Originally defined in VISU_TEST/Grids/visu/ImportMedField/begin file.
+
+ Arguments:
+ paravis : PARAVIS instance
+ file_name : the full path to med file
+ field_names : the list of field names (for ex: ["pression","temperature","vitesse"])
+ prs : [[0,1,...], [], []]; empty list (sublist(s)) is ignored
+ 0-VISU.TGAUSSPOINTS
+ 1-VISU.TSCALARMAP
+ 2-VISU.TISOSURFACE
+ 3-VISU.TCUTPLANES
+ 4-VISU.TCUTLINES
+ 5-VISU.TDEFORMEDSHAPE
+ 6-VISU.TVECTORS
+ 7-VISU.TSTREAMLINES
+ 8-VISU.TPLOT3D
+ 9-VISU.TSCALARMAPONDEFORMEDSHAPE
+ """
+ import presentations
+
+ nb_errors = 0
+
+ print "File: ", file
+
+ # check the file accessibility
+ if not os.access(file, os.F_OK):
+ msg = "File " + file + " does not exist!!!"
+ raise RuntimeError, msg
+
+ # import MED file
+ paravis.ImportFile(file)
+ proxy = presentations.pv.GetActiveSource()
+ if proxy is None:
+ raise RuntimeError, "ERROR!!! Can't import file!!!"
+
+ for i in range(len(field_names)):
+ print "Name of the field: ", field_names[i]
+
+ if len(prs) != 0:
+ if len(prs[i]) != 0:
+ mesh_name, iterations = TimeStampId(proxy)
+
+ if iterations.has_key(field_names[i]):
+ entity = iterations[field_names[i]][0]
+ iteration = iterations[field_names[i]][1]
+ else:
+ msg="There is no information about TimeStampId of the " + field_names[i] + " field!!!"
+ raise RuntimeError, msg
+
+ err = nb_errors
+
+ for type in prs[i]:
+ if type==0:
+ if presentations.GaussPointsOnField(proxy, entity, field_names[i], iteration) is None:
+ print "ERROR!!! Created GaussPoints presentation is None!!!"; nb_errors+=1
+ if type==1:
+ if presentations.ScalarMapOnField(proxy, entity, field_names[i], iteration) is None:
+ print "ERROR!!! Created ScalarMap presentation is None!!!"; nb_errors+=1
+ if type==2:
+ if presentations.IsoSurfacesOnField(proxy, entity, field_names[i], iteration) is None:
+ print "ERROR!!! Created IsoSurfaces presentation is None!!!"; nb_errors+=1
+ if type==3:
+ if presentations.CutPlanesOnField(proxy, entity, field_names[i], iteration) is None:
+ print "ERROR!!! Created CutPlanes presentation is None!!!"; nb_errors+=1
+ if type==4:
+ if presentations.CutLinesOnField(proxy, entity, field_names[i], iteration) is None:
+ print "ERROR!!! Created CutLines presentation is None!!!"; nb_errors+=1
+ if type==5:
+ if presentations.DeformedShapeOnField(proxy, entity, field_names[i], iteration) is None:
+ print "ERROR!!! Created DeformedShape presentation is None!!!"; nb_errors+=1
+ if type==6:
+ if presentations.VectorsOnField(proxy, entity, field_names[i], iteration) is None:
+ print "ERROR!!! Created Vectors presentation is None!!!"; nb_errors+=1
+ if type==7:
+ if presentations.StreamLinesOnField(proxy, entity, field_names[i], iteration) is None:
+ print "ERROR!!! Created StreamLines presentation is None!!!"; nb_errors+=1
+ if type==8:
+ if presentations.Plot3DOnField(proxy, entity, field_names[i], iteration) is None:
+ print "ERROR!!! Created Plot3D presentation is None!!!"; nb_errors+=1
+ if type==9:
+ if presentations.DeformedShapeAndScalarMapOnField(proxy, entity, field_names[i], iteration) is None:
+ print "ERROR!!! Created ScalarMapOnDeformedShape presentation is None!!!"; nb_errors+=1
+
+ # check if number of errors has increased
+ if err == nb_errors:
+ print "Presentation(s) creation...OK"
+
+ if nb_errors > 0 and check_errors:
+ raise RuntimeError, "There are some errors were occured!!! For more information see ERRORs above..."
+ else:
+ return nb_errors
+
+def delete_with_inputs(obj):
+ """Deletes the given object with all its inputs"""
+ import pvsimple
+
+ obj_to_delete = obj
+ while obj_to_delete is not None:
+ tmp_obj = obj_to_delete
+ obj_to_delete = None
+ if hasattr(tmp_obj, 'Input'):
+ obj_to_delete = tmp_obj.Input
+
+ pvsimple.Delete(tmp_obj)
+
# Run Salome
salome_session = SalomeSession()
salome.salome_init()
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/bugs/A0 case
+
+import sys
+import os
+from paravistest import datadir, pictureext, get_picture_dir
+import presentations
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+picturedir = get_picture_dir(sys.argv[1], "bugs/A0")
+
+# 1. Import MED file
+print 'Importing "hydro_sea_alv.med"...',
+file_path = datadir + "hydro_sea_alv.med"
+my_paravis.ImportFile(file_path)
+med_reader = pvsimple.GetActiveSource()
+
+if med_reader is None:
+ print "FAILED"
+else:
+ print "OK"
+
+# 2. Create cut lines on "Head" field
+mesh_name = "maillage_migr3d"
+field_name = "Head"
+cell_entity = presentations.EntityType.CELL
+timestamps = med_reader.TimestepValues.GetData()
+
+for ts in xrange(1, len(timestamps) + 1):
+ print "Timestamp: ", ts
+ cutlines = presentations.CutLinesOnField(med_reader, cell_entity, field_name, ts,
+ orientation1=presentations.Orientation.ZX,
+ orientation2=presentations.Orientation.YZ)
+ pic_name = mesh_name + "_" + str(cell_entity) + "_" + field_name + "_" + str(ts) + "_TCUTLINES." + pictureext
+ pic_path = os.path.join(picturedir, pic_name)
+ print pic_path
+ presentations.process_prs_for_test(cutlines, pvsimple.GetRenderView(), pic_path)
+ nb_lines = len(cutlines.Input.SliceOffsetValues)
+ print "Number of lines = ", nb_lines
+
+
+
+
+
+
+
+
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/bugs/A1 case
+
+import sys
+import os
+import time
+from paravistest import datadir, pictureext, get_picture_dir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+picturedir = get_picture_dir(sys.argv[1], "bugs/A1")
+
+med_file_path = datadir + "fra1.med"
+pic_path = os.path.join(picturedir, "A1." + pictureext)
+
+# 1. Import MED file
+my_paravis.ImportFile(med_file_path)
+med_reader = pvsimple.GetActiveSource()
+
+# 2. Create mesh
+mesh = MeshOnEntity(med_reader, "LE_VOLUME", EntityType.CELL)
+mesh.Representation = 'Surface With Edges'
+
+# 3. Display mesh and make snapshot
+view = pvsimple.GetRenderView()
+
+display_only(mesh, view)
+reset_view(view)
+
+view.CameraViewUp = [0,1,0]
+view.CameraPosition = [0, 42, -200]
+view.CameraFocalPoint = [25, 0, 5]
+view.CameraParallelScale = 1
+
+view.ResetCamera()
+
+pvsimple.Render(view)
+
+print "Picure file name is " + pic_path
+pv.WriteImage(pic_path, view=view, Magnification=1)
+time.sleep(1)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/bugs/A2 case
+
+import sys
+import os
+import time
+from paravistest import datadir, pictureext, get_picture_dir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+picturedir = get_picture_dir(sys.argv[1], "bugs/A2")
+
+med_file_path = datadir + "carre_MIXTE_0000_v3.0.6.med"
+pic_path = os.path.join(picturedir, "A2." + pictureext)
+
+print "BREAKPOINT_1"
+# 1. Import MED file
+print 'Importing "carre_MIXTE_0000.med"...',
+my_paravis.ImportFile(med_file_path)
+med_reader = pvsimple.GetActiveSource()
+
+if med_reader is None:
+ print "FAILED"
+else:
+ print "OK"
+
+# 2. Create mesh
+print "Creating MeshOnEntity..............",
+mesh = MeshOnEntity(med_reader, "dom", EntityType.CELL)
+
+if mesh is None:
+ print "FAILED"
+else:
+ mesh.Representation = 'Surface With Edges'
+ print "OK"
+
+# 3. Display mesh and make snapshot
+view = pvsimple.GetRenderView()
+
+display_only(mesh, view)
+reset_view(view)
+
+view.CameraViewUp = [0, 0, 1]
+view.CameraPosition = [50, 180, 0]
+view.CameraFocalPoint = [0.2, 0, 0.5]
+view.CameraParallelScale = 0.1
+
+#view.ResetCamera()
+
+pvsimple.Render(view)
+
+print "Picure file name is " + pic_path
+pv.WriteImage(pic_path, view=view, Magnification=1)
+time.sleep(1)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/bugs/A3 case
+
+import time
+from paravistest import datadir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+
+# 1. Import MED file
+med_file_path = datadir + "hexa_28320_ELEM.med"
+my_paravis.ImportFile(med_file_path)
+med_reader = pvsimple.GetActiveSource()
+
+# 2. Create vectors
+vectors = VectorsOnField(med_reader, EntityType.CELL, "vitesse_elem_dom_pb1", 2) # 1e-05
+
+display_only(vectors)
+reset_view()
+time.sleep(1)
+
+vectors.Input.SetScaleFactor = 0.005
+display_only(vectors)
+reset_view()
+time.sleep(1)
+
+
+vectors.Input.SetScaleFactor = 0.002
+display_only(vectors)
+reset_view()
+time.sleep(1)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/bugs/A4 case
+
+import time
+from paravistest import datadir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+
+# 1. Import MED file
+med_file_path = datadir + "carre_ELEM_0000.med"
+my_paravis.ImportFile(med_file_path)
+med_reader = pvsimple.GetActiveSource()
+
+# 2. Create vectors
+vectors = VectorsOnField(med_reader, EntityType.CELL, "vitesse", 1) # 0
+vectors.Input.GlyphType = "Line"
+
+display_only(vectors)
+reset_view()
+
+time.sleep(1)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/bugs/A5 case
+
+import os
+import salome
+
+from paravistest import datadir, pictureext, get_picture_dir
+from presentations import *
+import paravis
+import pvsimple
+
+myStudy = salome.myStudy
+myStudyManager = salome.myStudyManager
+
+data_file = datadir + "TimeStamps.med"
+
+tmp_dir = os.getenv("TmpDir")
+if tmp_dir == None:
+ tmp_dir = "/tmp"
+
+save_file = tmp_dir + "/TimeStamps_save.hdf"
+print "Save to file ", save_file
+
+paravis.myParavis.ImportFile(data_file)
+myStudyManager.SaveAs(save_file, myStudy, 0)
+myStudyManager.Close(myStudy)
+openedStudy = myStudyManager.Open(data_file)
+myStudyManager.Close(openedStudy)
+
+os.remove(save_file)
+
+print "OK"
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/bugs/A6 case
+
+import sys
+import os
+from paravistest import datadir, pictureext, get_picture_dir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+picturedir = get_picture_dir(sys.argv[1], "bugs/A6")
+
+med_file_path = datadir + "fra.med"
+
+# 1. Import MED file
+print 'Importing "fra.med"....',
+my_paravis.ImportFile(med_file_path)
+med_reader = pvsimple.GetActiveSource()
+
+if med_reader is None:
+ raise RuntimeError, "Error"
+else:
+ print "OK"
+
+# 2. Create mesh
+mesh_names = get_mesh_names(med_reader)
+for mesh_name in mesh_names:
+ print "Mesh name: ", mesh_name
+ mesh = MeshOnEntity(med_reader, mesh_name, EntityType.CELL)
+ if mesh is None:
+ raise RuntimeError, "Error"
+
+ mesh.Representation = 'Wireframe'
+
+ pic_path = os.path.join(picturedir, mesh_name + "_Cell." + pictureext)
+ pic_path = re.sub("\s+","_", pic_path)
+ print "Save picture ", pic_path
+ process_prs_for_test(mesh, pvsimple.GetRenderView(), pic_path)
+
+
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/bugs/A7 case
+
+import sys
+from paravistest import datadir, pictureext, get_picture_dir
+from presentations import CreatePrsForFile, PrsTypeEnum
+import paravis
+
+my_paravis = paravis.myParavis
+picturedir = get_picture_dir(sys.argv[1], "bugs/A7")
+
+med_file_path = datadir + "hexa_28320_ELEM.med"
+CreatePrsForFile(my_paravis, med_file_path, [PrsTypeEnum.MESH], picturedir, pictureext)
+CreatePrsForFile(my_paravis, med_file_path, [PrsTypeEnum.SCALARMAP], picturedir, pictureext)
+CreatePrsForFile(my_paravis, med_file_path, [PrsTypeEnum.CUTPLANES], picturedir, pictureext)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/bugs/A9 case
+
+import os
+import sys
+
+from paravistest import datadir, get_picture_dir, pictureext
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+
+picturedir = get_picture_dir(sys.argv[1], "bugs/A9")
+
+# 1. Step1: Import MED file
+print "**** Step1: Importing MED file"
+
+print 'Import "sortie_med_volumique.med"...............',
+file_path = datadir + "sortie_med_volumique_v3.0.6.med"
+my_paravis.ImportFile(file_path)
+med_reader = pvsimple.GetActiveSource()
+
+if med_reader is None:
+ print "FAILED"
+else:
+ print "OK"
+
+print 'Get view........................................',
+view = pvsimple.GetRenderView()
+if view is None:
+ print "FAILED"
+else:
+ reset_view(view)
+ print "OK"
+
+mesh_name = 'Volume_fluide'
+cell_entity = EntityType.CELL
+node_entity = EntityType.NODE
+
+# 2. Step2: Displaying mesh
+errors = 0
+
+print "**** Step2: Display mesh"
+print "BREAKPOINT_1"
+
+# Creation of Mesh presentation on nodes
+print "Creating Mesh presentation on nodes......."
+mesh = MeshOnEntity(med_reader, mesh_name, node_entity)
+if mesh is None:
+ print "ERROR!!! Mesh presentation on nodes creation FAILED!!!"
+ errors += 1
+else:
+ picture_path = os.path.join(picturedir, "MeshPresentation_OnNodes." + pictureext)
+ process_prs_for_test(mesh, view, picture_path)
+ print "OK"
+
+# Creation of Mesh presentation on cells
+print "Creating Mesh presentation on cells......."
+mesh = MeshOnEntity(med_reader, mesh_name, cell_entity)
+if mesh is None:
+ print "ERROR!!! Mesh presentation on cells creation FAILED!!!"
+ errors += 1
+else:
+ picture_path = os.path.join(picturedir, "MeshPresentation_OnCells." + pictureext)
+ process_prs_for_test(mesh, view, picture_path)
+ print "OK"
+
+# 3. Step3: Displaying scalar field 'Dissip'
+print "**** Step3: Display scalar field 'Dissip'"
+
+entity = cell_entity
+
+# Scalar Map creation
+print "Creating Scalar Map.......",
+scalarmap = ScalarMapOnField(med_reader, entity, 'Dissip', 1)
+
+if scalarmap is None:
+ print "ERROR!!! Scalar Map creation FAILED!!!"
+ errors += 1
+else:
+ picture_path = os.path.join(picturedir, "ScalarMap_Dissip." + pictureext)
+ process_prs_for_test(scalarmap, view, picture_path)
+ print "OK"
+
+# Iso Surfaces creation
+print "Creating Iso Surfaces.......",
+isosurfaces = IsoSurfacesOnField(med_reader, entity, 'Dissip', 1)
+
+if isosurfaces is None:
+ print "ERROR!!! Iso Surfaces creation FAILED!!!"
+ errors += 1
+else:
+ picture_path = os.path.join(picturedir, "IsoSurfaces_Dissip." + pictureext)
+ process_prs_for_test(isosurfaces, view, picture_path)
+ print "OK"
+
+# Gauss Points creation
+print "Creating Gauss Points.......",
+gausspoints = GaussPointsOnField(med_reader, entity, 'Dissip', 1)
+
+if gausspoints is None:
+ print "ERROR!!! Gauss Points creation FAILED!!!"
+ errors += 1
+else:
+ picture_path = os.path.join(picturedir, "GaussPoints_Dissip." + pictureext)
+ process_prs_for_test(isosurfaces, view, picture_path)
+ print "OK"
+
+# 4. Step4: Displaying vectoriel field 'VitesseX'
+entity = cell_entity
+
+print "**** Step5: Display vectoriel field 'VitesseX'"
+# Deformed Shape creation
+print "Creating Deformed Shape.......",
+
+defshape = DeformedShapeOnField(med_reader, entity, 'VitesseX', 1)
+if defshape is None:
+ print "ERROR!!! Deformed Shape creation FAILED!!!"
+ errors += 1
+else:
+ picture_path = os.path.join(picturedir, "DeformedShape_VitesseX." + pictureext)
+ process_prs_for_test(defshape, view, picture_path)
+ print "OK"
+
+# Vectors creation
+print "Creating Vectors.......",
+vectors = VectorsOnField(med_reader, entity, 'VitesseX', 1)
+
+if vectors is None:
+ print "ERROR!!! Vectors creation FAILED!!!"
+ errors += 1
+else:
+ picture_path = os.path.join(picturedir, "Vectors_VitesseX." + pictureext)
+ process_prs_for_test(vectors, view, picture_path)
+ print "OK"
+
+# Scalar Map On Deformed Shape creation
+print "Creating Scalar Map On Deformed Shape.......",
+smapondefshape = DeformedShapeAndScalarMapOnField(med_reader, entity, 'VitesseX', 1)
+
+if smapondefshape is None:
+ print "ERROR!!! ScalarMapOnDeformedShape creation failed!!!"
+ errors += 1
+else:
+ picture_path = os.path.join(picturedir, "ScalMapOnDefShape_VitesseX." + pictureext)
+ process_prs_for_test(smapondefshape, view, picture_path)
+ print "OK"
+
+if errors == 1:
+ raise RuntimeError, "There is an error was occured... For more info see ERROR message above.."
+elif errors > 1:
+ raise RuntimeError, "There are some errors were occured... For more info see ERRORs messages above.."
+print "BREAKPOINT_2"
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/bugs1/B1 case
+
+
+import sys
+from paravistest import datadir, pictureext, get_picture_dir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+picturedir = get_picture_dir(sys.argv[1], "bugs/B1")
+
+# 1. Import MED file
+med_file_path = datadir + "resultat.01.med"
+
+print 'Importing "resultat.01.med"....',
+my_paravis.ImportFile(med_file_path)
+med_reader = pvsimple.GetActiveSource()
+
+if med_reader is None:
+ raise RuntimeError, "resultat.01.med was not imported!!!"
+else:
+ print "OK"
+
+# 2. Creation of presentation of each group
+groups_on_cells = get_group_names(med_reader, "MAILLAGE_01_001", EntityType.CELL, wo_nogroups=True)
+groups_on_nodes = get_group_names(med_reader, "MAILLAGE_01_001", EntityType.NODE, wo_nogroups=True)
+
+groups = groups_on_cells + groups_on_nodes
+
+errors = 0
+i = 0
+for group in groups:
+ i += 1
+ shor_name = group.split('/')[-1]
+ print "group: ", shor_name
+ prs = MeshOnGroup(med_reader, group)
+
+ if prs is None :
+ print "FAILED!!! Created presentation is None!!!"
+ errors += 1
+ else :
+ print "Presentation was created!"
+ pic_path = os.path.join(picturedir, shor_name.strip().split("_")[0]+str(i)+"."+pictureext)
+ process_prs_for_test(prs, pvsimple.GetRenderView(), pic_path)
+
+
+# check errors
+if errors == 1:
+ raise RuntimeError, "There is an error was occured... For more info see ERROR message above.."
+elif errors > 1:
+ raise RuntimeError, "There are some errors were occured... For more info see ERRORs messages above.."
+
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/bugs2/C3 case
+
+from paravistest import datadir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+
+# 1. Import MED file
+med_file_path = datadir + "MEDfileForStructuredMesh.med"
+
+print 'Importing "MEDfileForStructuredMesh.med"....',
+my_paravis.ImportFile(med_file_path)
+med_reader = pvsimple.GetActiveSource()
+
+if med_reader is None:
+ print "FAILED"
+else:
+ print "OK"
+
+errors = 0
+
+# 2. Creation of the mesh presentations for the "AssemblyMesh" mesh
+mesh_name = "AssemblyMesh"
+
+for entity in [EntityType.NODE, EntityType.CELL]:
+ if MeshOnEntity(med_reader, mesh_name, entity) is None:
+ print "Entity:", str(entity)
+ print "ERROR!!! Mesh presentation for \""+mesh_name+"\" wasn't created!!!"
+ errors += 1
+
+# 3. Creation of the mesh presentations for the "CoreMesh" mesh
+mesh_name = "CoreMesh"
+
+for entity in [EntityType.NODE, EntityType.CELL]:
+ if MeshOnEntity(med_reader, mesh_name, entity) is None:
+ print "Entity:", str(entity)
+ print "ERROR!!! Mesh presentation for \""+mesh_name+"\" wasn't created!!!"
+ errors += 1
+
+if errors > 0:
+ raise RuntimeError, "Some errors were occured during execution... See ERRORs above for details!"
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/bugs2/C4 case
+
+import sys
+import os
+from paravistest import datadir, pictureext, get_picture_dir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+picturedir = get_picture_dir(sys.argv[1], "bugs/C4")
+
+# 1. Import MED file
+med_file_path = datadir + "forma01f.resu.med"
+
+print 'Importing "forma01f.resu.med"....',
+my_paravis.ImportFile(med_file_path)
+med_reader = pvsimple.GetActiveSource()
+
+if med_reader is None:
+ print "FAILED"
+else:
+ print "OK"
+
+# 2. Creation of ScalarMap On DeformedShape presentation
+scales=[None, 0, 1e-05]
+fields=["RESU1_DEPL", "RESU1_SIGM_ELNO_DEPL"]
+entities=[EntityType.NODE, EntityType.CELL]
+entities_str=["NODE", "CELL"]
+
+view = pvsimple.GetRenderView()
+
+for scale in scales:
+ for i in range(len(fields)):
+ print "Field: ", fields[i], "; Scale: ", scale
+ presentation = None
+ try:
+ presentation = DeformedShapeAndScalarMapOnField(med_reader, entities[i], fields[i], 1)
+ except ValueError as e:
+ print "Error:", e
+
+ if presentation is not None:
+ if scale is not None:
+ presentation.Input.ScaleFactor = scale
+ # save picture
+ pic_path = os.path.join(picturedir, "MAIL_" + entities_str[i] + "_" + fields[i] + "_" + str(scale) + "_." + pictureext)
+ process_prs_for_test(presentation, view, pic_path)
+ else:
+ print "FAILED! Created presentation is None!!!"
+
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/bugs2/C5 case
+
+import sys
+import os
+import time
+from paravistest import datadir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+
+medPath = datadir
+
+class DisplayManager:
+ """
+ Create 3D presentations on entities on a given med file and mesh
+ """
+ def __init__(self, medFile=None, meshName=None, myEntity=None):
+ if ( medFile is not None and meshName is not None and myEntity is not None):
+ self.loadData(medFile, meshName, myEntity)
+ else:
+ self.medFile = None
+ self.meshName = None
+ self.myData = None
+ self.myMesh = None
+ self.myEntity = None
+
+ def loadData(self, medFile, meshName=None, myEntity=EntityType.NODE):
+ self.medFile = medFile
+ my_paravis.ImportFile(medFile)
+ self.myData = pvsimple.GetActiveSource()
+ self.myEntity = myEntity
+ if meshName is not None:
+ self.setMesh(meshName)
+
+ def getData(self):
+ return self.myData
+
+ def checkData(self):
+ if ( self.myData is None or self.myMesh is None ):
+ return False
+ return True
+
+ def setMesh(self,meshName):
+ self.meshName = meshName
+ self.myMesh = MeshOnEntity(self.myData,
+ self.meshName,
+ self.myEntity)
+ self.myMesh.Representation = 'Surface'
+
+ def DisplayMap(self, aView, aMap, title, aDelay=0):
+ if aMap is None:
+ print "Null scalar map is created"
+ display_only(aMap, aView)
+ reset_view(aView)
+ time.sleep(aDelay)
+
+ def ScalarMap(self, aView, fieldName, iteration, title , delay=0):
+ if not self.checkData(): return
+ aMap = ScalarMapOnField(self.myData, self.myEntity, fieldName, iteration)
+ self.DisplayMap(aView, aMap, title, delay)
+
+ def DeformedShape(self, aView, fieldName, iteration, title , delay=0):
+ if not self.checkData(): return
+ aMap = DeformedShapeOnField(self.myData, self.myEntity, fieldName, iteration)
+ if aMap is not None:
+ aMap.ColorArrayName = fieldName
+ self.DisplayMap(aView, aMap, title, delay)
+
+ def Vectors(self, aView, fieldName, iteration, title , delay=0):
+ if not self.checkData(): return
+ aMap = VectorsOnField(self.myData, self.myEntity, fieldName, iteration)
+ if aMap is not None:
+ aMap.ColorArrayName = fieldName
+ self.DisplayMap(aView, aMap, title, delay)
+
+ def IsoSurfaces(self, aView, fieldName, iteration, title , delay=0):
+ if not self.checkData(): return
+ aMap = IsoSurfacesOnField(self.myData, self.myEntity, fieldName, iteration)
+ self.DisplayMap(aView, aMap, title, delay)
+
+ def Animation(self, aView, theObj, theDuration, NbOfLoops, title, aPath=""):
+
+ path = None
+ if aPath is not "":
+ print "Define save path"
+ path = aPath
+
+ scene = pvsimple.AnimateReader(theObj, aView, path)
+
+ print "Start Animation"
+
+ scene.Duration = theDuration
+ NbOfFrames = len(scene.TimeKeeper.TimestepValues)
+ NbOfIter = NbOfFrames-1
+
+ reset_view(view=aView)
+
+ ind = 0
+ while ind < NbOfLoops:
+ scene.Play()
+ ind = ind + 1
+
+ print "Stop Animation"
+ scene.Stop()
+
+ return scene
+
+ def XYPlot(self, myView, txtFile, theTableName, theDelay, theColor):
+ table = TableReader(FileName=txtFile)
+
+ # >>> Create curve
+ myView = CreateXYPlotView()
+ myCurve = Show(table, view = myView)
+
+def createView():
+ aView=pvsimple.GetRenderView()
+ return aView
+
+
+theEntity = EntityType.CELL
+theMedFile = "TETRA_domaine_fluide.med"
+theMedFile = os.path.join(medPath,theMedFile)
+theMeshName = "Domaine_fluide"
+theFieldName = "TempC"
+theDuration = 20
+NbOfLoops = 4
+#thePath = os.getenv("TMP_DIR")
+thePrefix = "TestPngFromAnim"
+thePath = os.path.join("/tmp", thePrefix)
+thePath += ".png"
+
+displayMng = DisplayManager()
+displayMng.loadData(theMedFile,theMeshName,theEntity)
+ScalarMapOnField(displayMng.getData(), theEntity, theFieldName, 1)
+
+myView = createView()
+displayMng.Animation(myView, displayMng.getData(), theDuration, NbOfLoops, "", thePath)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/bugs2/C6 case
+
+import sys
+import os
+from paravistest import datadir, pictureext, get_picture_dir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+picturedir = get_picture_dir(sys.argv[1], "bugs/C6")
+
+# 1. Import MED file
+med_file_path = datadir + "relachement_brutal_sans_dudg_gauss.med"
+
+print 'Importing "relachement_brutal_sans_dudg_gauss.med"....',
+my_paravis.ImportFile(med_file_path)
+med_reader = pvsimple.GetActiveSource()
+
+if med_reader is None:
+ raise RuntimeError, "File wasn't imported!!!"
+else:
+ print "OK"
+
+# 2. Creation of GaussPoints presentations
+mesh_name = "Maillage"
+field_name = "Result_EQUI_ELGA_SIGM"
+timestamp_list = range(1, 5)
+
+for timestamp in timestamp_list:
+ print "Creation of the GaussPoints presentation.. Field: ", field_name, "; Timestamp: ", timestamp
+ gauss_points = GaussPointsOnField1(med_reader, EntityType.CELL, field_name, timestamp)
+ if gauss_points is None:
+ raise RuntimeError, "Created presentation is None!!!"
+ pic_path = os.path.join(picturedir, "GaussPoints_" + mesh_name + "_" + field_name + "_" + str(timestamp) + "." + pictureext)
+ process_prs_for_test(gauss_points, pvsimple.GetRenderView(), pic_path)
+
+
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/bugs2/C7 case
+
+import os
+import sys
+from paravistest import datadir, pictureext, get_picture_dir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+picturedir = get_picture_dir(sys.argv[1], "bugs/C7")
+
+# 1. Import MED file
+med_file_path = datadir + "Bug583-Quadratique.resu.med"
+
+print 'Importing "Bug583-Quadratique.resu.med"....',
+my_paravis.ImportFile(med_file_path)
+med_reader = pvsimple.GetActiveSource()
+
+if med_reader is None:
+ raise RuntimeError, "File wasn't imported!!!"
+else:
+ print "OK"
+
+# 2. Creation of GaussPoints presentations
+mesh_name = "MAIL"
+field_names = ["RESU_EQUI_ELNO_SIGM", "RESU_SIEF_ELGA_DEPL", "RESU_SIEF_ELNO_ELGA", "RESU_SIGM_ELNO_DEPL"]
+
+view = pvsimple.GetRenderView()
+
+print "BREAKPOINT_1"
+error = 0
+
+for field in field_names:
+ print "Creation of the GaussPoints presentation.. Field: ", field, "; Iteration: 1"
+ presentation = GaussPointsOnField1(med_reader, EntityType.CELL, field, 1)
+ if presentation is None:
+ print "ERROR!!! GaussPoints presentation wasn't created for the ", field, " field!!!"
+ error += 1
+ else:
+ pic_path = os.path.join(picturedir, "GaussPoints_" + mesh_name + "_" + field + "." + pictureext)
+ process_prs_for_test(presentation, view, pic_path)
+
+if not error:
+ print "BREAKPOINT_2"
+else:
+ raise RuntimeError, "There are some errors were occured... For more info see ERRORs above..."
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/bugs2/C8 case
+
+from paravistest import tablesdir
+from presentations import *
+import paravis
+import pvsimple
+
+# 1. Import table from file
+file_path = tablesdir + "tables_test.xls"
+
+print 'Import tables_test.xls ....',
+file_path = tablesdir + "tables_test.xls"
+table_reader = pvsimple.TableReader(FileName=file_path)
+table_reader.UpdatePipeline()
+if table_reader is None:
+ print "FAILED"
+else:
+ print "OK"
+
+# 2. Show curves
+cur_view = pvsimple.GetRenderView()
+if cur_view:
+ pvsimple.Delete(cur_view)
+
+xy_view = pvsimple.CreateXYPlotView()
+xy_view.ChartTitle = "The viewer for Curves from the Table"
+
+
+print 'Get available tables .....'
+available_tables = table_reader.GetPropertyValue("AvailableTables")
+if (available_tables is None) or (len(available_tables) == 0):
+ print "FAILED"
+else:
+ print available_tables
+
+for table in available_tables:
+ table_reader.TableNumber = available_tables.GetData().index(table)
+
+ xy_rep = pvsimple.Show()
+ xy_rep.AttributeType = 'Row Data'
+ xy_rep.UseIndexForXAxis = 0
+ xy_rep.SeriesVisibility = ['0', '0']
+
+ pvsimple.Render()
+
+
+
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/bugs2/C9 case
+
+from paravistest import datadir, pictureext, get_picture_dir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+
+# 1. Import MED file
+med_file_path = datadir + "TimeStamps.med"
+
+my_paravis.ImportFile(med_file_path)
+med_reader = pvsimple.GetActiveSource()
+
+if med_reader is None:
+ raise RuntimeError, "TimeStamps.med was not imported!!!"
+
+# 2. Creation of presentations
+mesh_on_cells = MeshOnEntity(med_reader, "dom", EntityType.CELL)
+if mesh_on_cells is None :
+ raise RuntimeError, "Mesh presentation is None!!!"
+
+view = pvsimple.GetRenderView()
+display_only(mesh_on_cells, view)
+reset_view(view)
+
+mesh_on_cells.Representation = 'Wireframe'
+
+scalar_map = ScalarMapOnField(med_reader, EntityType.NODE, "vitesse", 1)
+if scalar_map is None :
+ raise RuntimeError, "ScalarMap presentation is None!!!"
+
+scalar_map.Visibility = 1
+pvsimple.Render()
+
+pvsimple.Delete(scalar_map)
+pvsimple.Render()
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+IF (PYTHON_EXECUTABLE)
+ FOREACH ( tfile
+ A0
+ A1
+ A2
+ A3
+ A4
+ A5
+ A6
+ A7
+ A9
+ B1
+ C3
+ C4
+ C5
+ C6
+ C7
+ C8
+ C9
+ D0
+ D1
+ D3
+ D5
+ D6
+ D7
+ E0
+ )
+ SET(TIMEOUT 10000)
+ ADD_TEST(BUGS_${tfile} ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/test/VisuPrs/Util/paravistesthelper.py ${TIMEOUT} ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py ${PARAVIS_TEST_OUTPUT_DIR})
+ SET_TESTS_PROPERTIES(BUGS_${tfile} PROPERTIES FAIL_REGULAR_EXPRESSION "FAILED" TIMEOUT ${TIMEOUT})
+ ENDFOREACH( tfile )
+ENDIF (PYTHON_EXECUTABLE)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/bugs3/D0 case
+
+import sys
+import os
+import time
+from paravistest import datadir, pictureext, get_picture_dir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+picturedir = get_picture_dir(sys.argv[1], "bugs/D0")
+
+# Aux method
+def get_group_full_name(source, group_name):
+ result_name = group_name
+
+ full_names = source.Groups.Available
+ for name in full_names:
+ if name.endswith(group_name):
+ result_name = name
+ break
+
+ return result_name
+
+# 1. Import of the "Bug619-result_calcul_OCC.med" file
+med_file_path = datadir + "Bug619-result_calcul_OCC.med"
+
+my_paravis.ImportFile(med_file_path)
+med_reader = pvsimple.GetActiveSource()
+
+if med_reader is None:
+ raise RuntimeError, "Bug619-result_calcul_OCC.med was not imported!!!"
+
+# 2. Creation of ScalarMap:
+# iteration1: on the "TU_3D_G1" group
+# iteration2: on the "TU_3D_D1" group
+view = pvsimple.GetRenderView()
+field_name = "MECASTATEQUI_ELNO_SIGM"
+
+groups = ['TU_3D_G1', 'TU_3D_D1']
+
+for group_name in groups:
+ extract_group = pvsimple.ExtractGroup(med_reader)
+ extract_group.Groups = [get_group_full_name(med_reader, group_name)]
+ extract_group.UpdatePipeline()
+
+ scalar_map = ScalarMapOnField(extract_group, EntityType.CELL, field_name, 1)
+ if scalar_map is None :
+ raise RuntimeError, "ScalarMap presentation on '" + group_name + "' group is None!!!"
+
+ pic_path = os.path.join(picturedir, "npal18711_" + group_name + "." + pictureext)
+ process_prs_for_test(scalar_map, view, pic_path)
+
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/bugs3/D1 case
+
+import sys
+import os
+from paravistest import datadir, pictureext, get_picture_dir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+picturedir = get_picture_dir(sys.argv[1], "bugs/D1")
+
+# 1. Import of the "Bug829_resu_mode.med" file at first time
+med_file_path = datadir + "Bug829_resu_mode.med"
+my_paravis.ImportFile(med_file_path)
+med_reader1 = pvsimple.GetActiveSource()
+if med_reader1 is None:
+ raise RuntimeError, "Bug829_resu_mode.med was not imported!!!"
+
+# 2. Creation of a set of "DeformedShape and ScalarMap" presentations, based on time stamps of "MODES_DEPL" field
+errors=0
+sizes=[]
+
+for i in range(1,11):
+ presentation = DeformedShapeAndScalarMapOnField(med_reader1, EntityType.NODE, "MODES_DEPL", i)
+ if presentation is None :
+ raise RuntimeError, "Presentation is None!!!"
+
+ pic_path = os.path.join(picturedir, "npal19999_1_time_stamp_" + str(i) + "." + pictureext)
+ process_prs_for_test(presentation, pvsimple.GetRenderView(), pic_path)
+
+ sizes.append(os.path.getsize(pic_path))
+
+if abs(max(sizes)-min(sizes)) > 0.01*max(sizes):
+ print "WARNING!!! Pictures have different sizes!!!"
+ errors += 1
+ for i in range(1,11):
+ picture_name = "npal19999_1_time_stamp_" + str(i) + "." + pictureext
+ print "Picture: " + picture_name + "; size: " + str(sizes[i-1])
+ raise RuntimeError
+
+# 3. Import of the "Bug829_resu_mode.med" file at second time
+my_paravis.ImportFile(med_file_path)
+med_reader2 = pvsimple.GetActiveSource()
+if med_reader2 is None:
+ raise RuntimeError, "Bug829_resu_mode.med was not imported second time!!!"
+
+# 4. Creation of a set of "DeformedShape and ScalarMap" presentations, based on time stamps of "MODES_DEPL" field
+errors = 0
+sizes=[]
+
+for i in range(1,11):
+ presentation = DeformedShapeAndScalarMapOnField(med_reader2, EntityType.NODE, "MODES_DEPL", 11-i)
+ if presentation is None :
+ raise RuntimeError, "Presentation is None!!!"
+
+ pic_path = os.path.join(picturedir, "npal19999_2_time_stamp_" + str(i) + "." + pictureext)
+ process_prs_for_test(presentation, pvsimple.GetRenderView(), pic_path)
+
+ sizes.append(os.path.getsize(pic_path))
+
+if abs(max(sizes)-min(sizes)) > 0.01*max(sizes):
+ print "WARNING!!! Pictures have different sizes!!!"
+ errors += 1
+ for i in range(1,11):
+ picture_name = "npal19999_2_time_stamp_" + str(i) + "." + pictureext
+ print "Picture: " + picture_name + "; size: " + str(sizes[i-1])
+ raise RuntimeError
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/bugs3/D3 case
+
+from paravistest import datadir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+
+# 1. Import of the "LinearStaticsSTA9.resu.med" file
+med_file_path = datadir + "LinearStaticsSTA9.resu.med"
+my_paravis.ImportFile(med_file_path)
+med_reader = pvsimple.GetActiveSource()
+if med_reader is None:
+ raise RuntimeError, "LinearStaticsSTA9.resu.med was not imported!!!"
+
+view = pvsimple.GetRenderView()
+
+# Creation of colored "DeformedShape" presentations, based on time stamps of "RESU_DEPL" field
+presentation = DeformedShapeOnField(med_reader, EntityType.NODE, 'RESU_DEPL', 1, is_colored=True)
+if presentation is None :
+ raise RuntimeError, "DeformedShapeOnField Presentation is None!!!"
+
+display_only(presentation, view)
+reset_view(view)
+
+# Creation of colored "Vectors" presentations, based on time stamps of "RESU_DEPL" field
+presentation = VectorsOnField(med_reader, EntityType.NODE, 'RESU_DEPL', 1, is_colored=True)
+if presentation is None :
+ raise RuntimeError, "Vectors Presentation is None!!!"
+
+display_only(presentation, view)
+reset_view(view)
+
+# Creation of colored "DeformedShapeAndScalarMap" presentations, based on time stamps of "RESU_DEPL" field
+presentation = DeformedShapeAndScalarMapOnField(med_reader, EntityType.NODE, 'RESU_DEPL', 1)
+if presentation is None :
+ raise RuntimeError, "DeformedShapeAndScalarMap Presentation is None!!!"
+
+display_only(presentation, view)
+reset_view(view)
+
+# Creation of colored "CutPlanes" presentations, based on time stamps of "RESU_DEPL" field
+presentation = CutPlanesOnField(med_reader, EntityType.NODE, 'RESU_DEPL', 1)
+if presentation is None :
+ raise RuntimeError, "CutPlanes Presentation is None!!!"
+
+display_only(presentation, view)
+reset_view(view)
+
+
--- /dev/null
+from paravistest import tablesdir
+from presentations import *
+import paravis
+import pvsimple
+
+# Import table from file
+print 'Import file with tables....',
+file_path = tablesdir + "tables_test.xls"
+table_reader = pvsimple.TableReader(FileName=file_path)
+
+if table_reader is None:
+ print "FAILED"
+else:
+ table_reader.UpdatePipeline()
+ print "OK"
+
+# Display
+table_to_3d = pvsimple.TableTo3D(table_reader)
+prs = pvsimple.Show()
+#prs.ColorArrayName = 'Table'
+
+available_tables = table_reader.GetPropertyValue("AvailableTables")
+tables_count = len(available_tables)
+for table_nb in range(0, tables_count):
+ table_reader.TableNumber = table_nb
+
+ field_name = 'Table'
+ vector_mode = 'Magnitude'
+ nb_components = 1
+
+ # Get lookup table
+ lookup_table = get_lookup_table(field_name, nb_components, vector_mode)
+ lookup_table.LockScalarRange = 0
+
+ # Set properties
+ prs.ColorAttributeType = EntityType.get_pvtype(EntityType.NODE)
+ prs.ColorArrayName = field_name
+ prs.LookupTable = lookup_table
+
+ # Add scalar bar
+ bar = add_scalar_bar(available_tables[table_nb], nb_components, vector_mode,
+ lookup_table, "")
+
+ reset_view()
+ pvsimple.Delete(bar)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/bugs3/D6 case
+
+from paravistest import datadir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+
+# 1. Import MED file
+med_file_path = datadir + "fra.med"
+
+my_paravis.ImportFile(med_file_path)
+med_reader = pvsimple.GetActiveSource()
+
+# 2. Creation of CutSegment presentations, based on time stamps of "VITESSE" field
+point1 = [0.0, 0.0, 0.0]
+point2 = [0.4, 0.05, 1.0]
+cut_segment1 = CutSegmentOnField(med_reader, EntityType.NODE, "VITESSE", 1,
+ point1, point2)
+if cut_segment1 == None:
+ raise RuntimeError, "ERROR!!! The first CutSegment presentation is not built!"
+
+# 3. Creation of CutSegment presentations, based on time stamps of "TAUX_DE_VIDE" field
+point1 = [0, 0, 1]
+point2 = [0.2055, 0.0685, 0.541]
+cut_segment2 = CutSegmentOnField(med_reader, EntityType.NODE, "TAUX_DE_VIDE", 1,
+ point1, point2)
+if cut_segment2 == None:
+ raise RuntimeError, "ERROR!!! The second CutSegment presentation is not built!"
+
+# 4. Creation of Table based on CutSegment presentation
+
+# TODO: it's possible to display CutSegment (PlotOverLine in terms of ParaViS) presentation
+# as a table in GUI, but it seems that there is no possibility to create table view
+# (spreadsheet view in terms of ParaViS) from in Python script
+
+# 5. Creation of curve based on Table
+xy_view = pv.CreateXYPlotView()
+
+curve1 = pv.Show(cut_segment1.Input, xy_view)
+if curve1 == None:
+ raise RuntimeError, " ERROR!!! Curve based on the first CutSegment is not built!"
+
+curve2 = pv.Show(cut_segment2.Input, xy_view)
+if curve2 == None:
+ raise RuntimeError, " ERROR!!! Curve based on the second CutSegment is not built!"
+
+curves = [curve1, curve2]
+for c in curves:
+ c.AttributeType = 'Point Data'
+ c.UseIndexForXAxis = 0
+ c.XArrayName = 'arc_length'
+
+pvsimple.SetActiveSource(cut_segment1.Input)
+set_visible_lines(curve1, ['VITESSE (Magnitude)'])
+
+pvsimple.SetActiveSource(cut_segment2.Input)
+set_visible_lines(curve2, ['TAUX_DE_VIDE'])
+
+pvsimple.ResetCamera(xy_view)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/bugs3/D7 case
+
+import sys
+import os
+from paravistest import datadir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+
+# 1. MED file import
+print 'Importing "Fields_group3D.med"........',
+
+med_file_path = datadir + "Fields_group3D.med"
+my_paravis.ImportFile(med_file_path)
+med_reader = pvsimple.GetActiveSource()
+if med_reader is None:
+ print "FAILED"
+else:
+ print "OK"
+
+print 'Get view..............................',
+view = pvsimple.GetRenderView()
+if view is None:
+ print "FAILED"
+else:
+ print "OK"
+
+# 2. Displaying scalar field
+print "Creating Scalar Map.......",
+
+scalarmap = ScalarMapOnField(med_reader, EntityType.CELL, 'scalar_field', 1)
+if scalarmap is None:
+ print "FAILED"
+else:
+ print "OK"
+
+med_reader.Groups = ['GROUP/mailles_MED/OnCell/box_1']
+
+display_only(scalarmap, view)
+reset_view(view)
+
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/bugs4/E0 case
+
+import time
+from paravistest import datadir
+from presentations import *
+import paravis
+import pvsimple
+
+sleep_delay = 1
+my_paravis = paravis.myParavis
+
+# 1. MED file import
+print 'Import "ResOK_0000.med"...............',
+med_file_path = datadir + "ResOK_0000.med"
+my_paravis.ImportFile(med_file_path)
+med_reader = pvsimple.GetActiveSource()
+if med_reader is None:
+ raise RuntimeError, "ResOK_0000.med was not imported!!!"
+else:
+ print "OK"
+
+# TODO: in the original VISU script the timestamp id was equal to 2,
+# but in PARAVIS it's inly one timestamp accessible
+timestamp_id = 1
+
+# 2. Create Scalar Map
+field_name = 'vitesse'
+
+print "Creating Scalar Map......."
+scmap1 = ScalarMapOnField(med_reader, EntityType.NODE, field_name, timestamp_id)
+if scmap1 is None :
+ raise RuntimeError, "ScalarMap presentation is None!!!"
+else:
+ print "OK"
+
+display_only(scmap1)
+reset_view()
+
+print "WIREFRAME sur scmap1"
+scmap1.Representation = 'Wireframe'
+time.sleep(sleep_delay)
+
+print "POINT sur scmap1"
+scmap1.Representation = 'Points'
+time.sleep(sleep_delay)
+
+print "SURFACEFRAME sur scmap1"
+scmap1.Representation = 'Surface With Edges'
+time.sleep(sleep_delay)
+
+# 3. Create Deformed Shape And Scalar Map
+print "Creating DeformedShapeAndScalarMap......."
+scmap2 = DeformedShapeAndScalarMapOnField(med_reader, EntityType.NODE, field_name, timestamp_id)
+if scmap2 is None :
+ raise RuntimeError, "DeformedShapeAndScalarMapOnField presentation is None!!!"
+else:
+ print "OK"
+
+scmap2.Input.ScaleFactor = 1.0
+
+display_only(scmap2)
+reset_view()
+
+print "WIREFRAME sur scmap2"
+scmap2.Representation = 'Wireframe'
+time.sleep(sleep_delay)
+
+print "POINT sur scmap2"
+scmap2.Representation = 'Points'
+time.sleep(sleep_delay)
+
+print "SURFACEFRAME sur scmap2"
+scmap2.Representation = 'Surface With Edges'
+time.sleep(sleep_delay)
+
+# 4.Create Deformed Shape
+print "Creating DeformedShape........"
+scmap3 = DeformedShapeOnField(med_reader, EntityType.NODE, field_name, timestamp_id)
+if scmap3 is None :
+ raise RuntimeError, "DeformedShapeOnField presentation is None!!!"
+else:
+ print "OK"
+
+print "WIREFRAME sur scmap3"
+scmap3.Representation = 'Wireframe'
+time.sleep(sleep_delay)
+
+print "POINT sur scmap3"
+scmap3.Representation = 'Points'
+time.sleep(sleep_delay)
+
+print "SURFACEFRAME sur scmap3"
+scmap3.Representation = 'Surface With Edges'
+time.sleep(sleep_delay)
+
+scmap2.Input.ScaleFactor = 1.0
+
+# show colored:
+scmap3.ColorAttributeType = EntityType.get_pvtype(EntityType.NODE)
+scmap3.ColorArrayName = field_name
+
+display_only(scmap3)
+reset_view()
+
+
+
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/dump_study/A0 case
+
+from paravistest import datadir, delete_with_inputs
+from presentations import *
+import paravis
+from pvsimple import *
+
+my_paravis = paravis.myParavis
+
+settings = {"Offset": [0.0001, 0.0002, 0], "ScalarMode": ("Component", 2), "Position": [0.1, 0.2], "Size": [0.15, 0.25], "Discretize": 1, "NbColors": 44, "NbLabels": 22, "Title": "My presentation", "UseLogScale": 1, "Orientation": 'Horizontal'}
+
+# 1. TimeStamps.med import
+file_path = datadir + "TimeStamps.med"
+my_paravis.ImportFile(file_path)
+med_reader = GetActiveSource()
+if med_reader is None :
+ raise RuntimeError, "TimeStamps.med wasn't imported..."
+
+# 2. ScalarMap creation
+med_field = "vitesse"
+
+scalarmap = ScalarMapOnField(med_reader, EntityType.NODE, med_field, 1)
+
+# apply settings
+scalarmap.Position = settings["Offset"]
+scalarmap.LookupTable.VectorMode = settings["ScalarMode"][0]
+scalarmap.LookupTable.VectorComponent = settings["ScalarMode"][1]
+scalarmap.LookupTable.Discretize = settings["Discretize"]
+scalarmap.LookupTable.NumberOfTableValues = settings["NbColors"]
+scalarmap.LookupTable.UseLogScale = settings["UseLogScale"]
+
+bar = get_bar()
+bar.Position = settings["Position"]
+bar.Position2 = settings["Size"]
+bar.NumberOfLabels = settings["NbLabels"]
+bar.Title = settings["Title"]
+bar.Orientation = settings["Orientation"]
+
+# 3. Dump Study
+path_to_save = os.path.join(os.getenv("HOME"), "ScalarMap.py")
+SaveTrace( path_to_save )
+
+# 4. Delete the created objects, recreate the view
+delete_with_inputs(scalarmap)
+Delete(GetActiveView())
+view = CreateRenderView()
+
+# 5. Execution of the created script
+execfile(path_to_save)
+
+# 6. Checking of the settings done before dump
+recreated_bar = view.Representations[0]
+recreated_scalarmap = view.Representations[1]
+
+errors = 0
+tolerance = 1e-05
+
+# Offset
+offset = recreated_scalarmap.Position
+for i in range(len(settings["Offset"])):
+ if abs(offset[i] - settings["Offset"][i]) > tolerance:
+ print "ERROR!!! Offset value with ", i, " index is incorrect: ", offset[i], " instead of ", settings["Offset"][i]
+ errors += 1
+
+# Scalar mode
+vector_mode = recreated_scalarmap.LookupTable.VectorMode
+vector_component = recreated_scalarmap.LookupTable.VectorComponent
+
+if vector_mode != settings["ScalarMode"][0]:
+ print "ERROR!!! Vector mode value is incorrect: ", vector_mode, " instead of ", settings["ScalarMode"][0]
+ errors += 1
+if vector_component != settings["ScalarMode"][1]:
+ print "ERROR!!! Vector component value is incorrect: ", vector_component, " instead of ", settings["ScalarMode"][1]
+ errors += 1
+
+# Position of scalar bar
+pos_x = recreated_bar.Position[0]
+pos_y = recreated_bar.Position[1]
+
+if abs(pos_x - settings["Position"][0]) > tolerance:
+ print "ERROR!!! X coordinate of position of scalar bar is incorrect: ", pos_x, " instead of ", settings["Position"][0]
+ errors += 1
+if abs(pos_y - settings["Position"][1]) > tolerance:
+ print "ERROR!!! Y coordinate of position of scalar bar is incorrect: ", pos_y, " instead of ", settings["Position"][1]
+ errors += 1
+
+# Size of scalar bar
+width = recreated_bar.Position2[0]
+height = recreated_bar.Position2[1]
+
+if abs(width - settings["Size"][0]) > tolerance:
+ print "ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0]
+ errors += 1
+if abs(height - settings["Size"][1]) > tolerance:
+ print "ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1]
+ errors += 1
+
+# Discretize
+discretize = recreated_scalarmap.LookupTable.Discretize
+if discretize != settings["Discretize"]:
+ print "ERROR!!! Discretize property is incorrect: ", discretize, " instead of ", settings["Discretize"]
+ errors += 1
+
+# Number of colors
+nb_colors = recreated_scalarmap.LookupTable.NumberOfTableValues
+if nb_colors != settings["NbColors"]:
+ print "ERROR!!! Number of colors of scalar bar is incorrect: ", nb_colors, " instead of ", settings["NbColors"]
+ errors += 1
+
+# Number of labels
+nb_labels = recreated_bar.NumberOfLabels
+if nb_labels != settings["NbLabels"]:
+ print "ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"]
+ errors += 1
+
+# Title
+title = recreated_bar.Title
+if title != settings["Title"]:
+ print "ERROR!!! Title of presentation is incorrect: ", title, " instead of ", settings["Title"]
+ errors += 1
+
+# Scaling
+use_log_scale = recreated_scalarmap.LookupTable.UseLogScale
+if use_log_scale != settings["UseLogScale"]:
+ print "ERROR!!! Scaling of presentation is incorrect: ", use_log_scale, " instead of ", settings["UseLogScale"]
+ errors += 1
+
+# Bar Orientation
+orientation = recreated_bar.Orientation
+if orientation != settings["Orientation"]:
+ print "ERROR!!! Orientation of scalar bar is incorrect: ", orientation, " instead of ", settings["Orientation"]
+ errors += 1
+
+if errors > 0:
+ raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."
+
+
+
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/dump_study/A1 case
+
+from paravistest import datadir, delete_with_inputs
+from presentations import *
+import paravis
+from pvsimple import *
+
+my_paravis = paravis.myParavis
+
+settings = {"Offset": [0.0001, 0.0002, 0], "ScalarMode": ("Component", 2), "Position": [0.1, 0.2], "Size": [0.15, 0.25], "Discretize": 1, "NbColors": 44, "NbLabels": 22, "Title": "My presentation", "UseLogScale": 1, "Orientation": 'Horizontal', "NbSurfaces": 444}
+
+# 1. TimeStamps.med import
+file_path = datadir + "TimeStamps.med"
+my_paravis.ImportFile(file_path)
+med_reader = GetActiveSource()
+if med_reader is None :
+ raise RuntimeError, "TimeStamps.med wasn't imported..."
+
+# 2. IsoSurfaces creation
+med_field = "vitesse"
+
+isosurfaces = IsoSurfacesOnField(med_reader, EntityType.NODE, med_field, 1)
+
+# apply settings
+isosurfaces.Position = settings["Offset"]
+isosurfaces.LookupTable.VectorMode = settings["ScalarMode"][0]
+isosurfaces.LookupTable.VectorComponent = settings["ScalarMode"][1]
+isosurfaces.LookupTable.Discretize = settings["Discretize"]
+isosurfaces.LookupTable.NumberOfTableValues = settings["NbColors"]
+isosurfaces.LookupTable.UseLogScale = settings["UseLogScale"]
+
+contour_filter = isosurfaces.Input
+rgb_points = isosurfaces.LookupTable.RGBPoints
+scalar_range = [rgb_points[0], rgb_points[4]]
+surfaces = get_contours(scalar_range, settings["NbSurfaces"])
+contour_filter.Isosurfaces = surfaces
+
+bar = get_bar()
+bar.Position = settings["Position"]
+bar.Position2 = settings["Size"]
+bar.NumberOfLabels = settings["NbLabels"]
+bar.Title = settings["Title"]
+bar.Orientation = settings["Orientation"]
+
+# 3. Dump Study
+path_to_save = os.path.join(os.getenv("HOME"), "IsoSurfaces.py")
+SaveTrace( path_to_save )
+
+# 4. Delete the created objects, recreate the view
+delete_with_inputs(isosurfaces)
+Delete(GetActiveView())
+view = CreateRenderView()
+
+# 5. Execution of the created script
+execfile(path_to_save)
+
+# 6. Checking of the settings done before dump
+recreated_bar = view.Representations[0]
+recreated_isosurfaces = view.Representations[1]
+
+errors = 0
+tolerance = 1e-05
+
+# Offset
+offset = recreated_isosurfaces.Position
+for i in range(len(settings["Offset"])):
+ if abs(offset[i] - settings["Offset"][i]) > tolerance:
+ print "ERROR!!! Offset value with ", i, " index is incorrect: ", offset[i], " instead of ", settings["Offset"][i]
+ errors += 1
+
+# Scalar mode
+vector_mode = recreated_isosurfaces.LookupTable.VectorMode
+vector_component = recreated_isosurfaces.LookupTable.VectorComponent
+
+if vector_mode != settings["ScalarMode"][0]:
+ print "ERROR!!! Vector mode value is incorrect: ", vector_mode, " instead of ", settings["ScalarMode"][0]
+ errors += 1
+if vector_component != settings["ScalarMode"][1]:
+ print "ERROR!!! Vector component value is incorrect: ", vector_component, " instead of ", settings["ScalarMode"][1]
+ errors += 1
+
+# Position of scalar bar
+pos_x = recreated_bar.Position[0]
+pos_y = recreated_bar.Position[1]
+
+if abs(pos_x - settings["Position"][0]) > tolerance:
+ print "ERROR!!! X coordinate of position of scalar bar is incorrect: ", pos_x, " instead of ", settings["Position"][0]
+ errors += 1
+if abs(pos_y - settings["Position"][1]) > tolerance:
+ print "ERROR!!! Y coordinate of position of scalar bar is incorrect: ", pos_y, " instead of ", settings["Position"][1]
+ errors += 1
+
+# Size of scalar bar
+width = recreated_bar.Position2[0]
+height = recreated_bar.Position2[1]
+
+if abs(width - settings["Size"][0]) > tolerance:
+ print "ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0]
+ errors += 1
+if abs(height - settings["Size"][1]) > tolerance:
+ print "ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1]
+ errors += 1
+
+# Discretize
+discretize = recreated_isosurfaces.LookupTable.Discretize
+if discretize != settings["Discretize"]:
+ print "ERROR!!! Discretize property is incorrect: ", discretize, " instead of ", settings["Discretize"]
+ errors += 1
+
+# Number of colors
+nb_colors = recreated_isosurfaces.LookupTable.NumberOfTableValues
+if nb_colors != settings["NbColors"]:
+ print "ERROR!!! Number of colors of scalar bar is incorrect: ", nb_colors, " instead of ", settings["NbColors"]
+ errors += 1
+
+# Number of labels
+nb_labels = recreated_bar.NumberOfLabels
+if nb_labels != settings["NbLabels"]:
+ print "ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"]
+ errors += 1
+
+# Title
+title = recreated_bar.Title
+if title != settings["Title"]:
+ print "ERROR!!! Title of presentation is incorrect: ", title, " instead of ", settings["Title"]
+ errors += 1
+
+# Scaling
+use_log_scale = recreated_isosurfaces.LookupTable.UseLogScale
+if use_log_scale != settings["UseLogScale"]:
+ print "ERROR!!! Scaling of presentation is incorrect: ", use_log_scale, " instead of ", settings["UseLogScale"]
+ errors += 1
+
+# Bar Orientation
+orientation = recreated_bar.Orientation
+if orientation != settings["Orientation"]:
+ print "ERROR!!! Orientation of scalar bar is incorrect: ", orientation, " instead of ", settings["Orientation"]
+ errors += 1
+
+# NbSurfaces
+nb_surfaces = len(recreated_isosurfaces.Input.Isosurfaces)
+if nb_surfaces != settings["NbSurfaces"]:
+ print "ERROR!!! Number of surfaces of presentation is incorrect: ", nb_surfaces, " instead of ", settings["NbSurfaces"]
+ errors += 1
+
+if errors > 0:
+ raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/dump_study/A2 case
+
+from paravistest import datadir, delete_with_inputs
+from presentations import *
+import paravis
+from pvsimple import *
+
+my_paravis = paravis.myParavis
+
+settings = {"Offset": [0.0001, 0.0002, 0], "ScalarMode": ("Component", 2), "Position": [0.1, 0.2], "Size": [0.15, 0.25], "Discretize": 1, "NbColors": 44, "NbLabels": 22, "Title": "My presentation", "UseLogScale": 1, "Orientation": 'Horizontal'}
+
+# 1. TimeStamps.med import
+file_path = datadir + "TimeStamps.med"
+my_paravis.ImportFile(file_path)
+med_reader = GetActiveSource()
+if med_reader is None :
+ raise RuntimeError, "TimeStamps.med wasn't imported..."
+
+# 2. CutPlanes creation
+med_field = "vitesse"
+
+cutplanes = CutPlanesOnField(med_reader, EntityType.NODE, med_field, 1)
+
+# apply settings
+cutplanes.Position = settings["Offset"]
+cutplanes.LookupTable.VectorMode = settings["ScalarMode"][0]
+cutplanes.LookupTable.VectorComponent = settings["ScalarMode"][1]
+cutplanes.LookupTable.Discretize = settings["Discretize"]
+cutplanes.LookupTable.NumberOfTableValues = settings["NbColors"]
+cutplanes.LookupTable.UseLogScale = settings["UseLogScale"]
+
+normal = get_normal_by_orientation(Orientation.YZ, radians(33), radians(44))
+bounds = get_bounds(med_reader)
+pos = get_positions(2, normal, bounds, 0.1)
+pos[1] = 0.5
+cutplanes.Input.SliceType.Normal = normal
+cutplanes.Input.SliceOffsetValues = pos
+
+bar = get_bar()
+bar.Position = settings["Position"]
+bar.Position2 = settings["Size"]
+bar.NumberOfLabels = settings["NbLabels"]
+bar.Title = settings["Title"]
+bar.Orientation = settings["Orientation"]
+
+# 3. Dump Study
+path_to_save = os.path.join(os.getenv("HOME"), "CutPlanes.py")
+SaveTrace( path_to_save )
+
+# 4. Delete the created objects, recreate the view
+delete_with_inputs(cutplanes)
+Delete(GetActiveView())
+view = CreateRenderView()
+
+# 5. Execution of the created script
+execfile(path_to_save)
+
+# 6. Checking of the settings done before dump
+recreated_bar = view.Representations[0]
+recreated_cutplanes = view.Representations[1]
+
+errors = 0
+tolerance = 1e-05
+
+# Offset
+offset = recreated_cutplanes.Position
+for i in range(len(settings["Offset"])):
+ if abs(offset[i] - settings["Offset"][i]) > tolerance:
+ print "ERROR!!! Offset value with ", i, " index is incorrect: ", offset[i], " instead of ", settings["Offset"][i]
+ errors += 1
+
+# Scalar mode
+vector_mode = recreated_cutplanes.LookupTable.VectorMode
+vector_component = recreated_cutplanes.LookupTable.VectorComponent
+
+if vector_mode != settings["ScalarMode"][0]:
+ print "ERROR!!! Vector mode value is incorrect: ", vector_mode, " instead of ", settings["ScalarMode"][0]
+ errors += 1
+if vector_component != settings["ScalarMode"][1]:
+ print "ERROR!!! Vector component value is incorrect: ", vector_component, " instead of ", settings["ScalarMode"][1]
+ errors += 1
+
+# Position of scalar bar
+pos_x = recreated_bar.Position[0]
+pos_y = recreated_bar.Position[1]
+
+if abs(pos_x - settings["Position"][0]) > tolerance:
+ print "ERROR!!! X coordinate of position of scalar bar is incorrect: ", pos_x, " instead of ", settings["Position"][0]
+ errors += 1
+if abs(pos_y - settings["Position"][1]) > tolerance:
+ print "ERROR!!! Y coordinate of position of scalar bar is incorrect: ", pos_y, " instead of ", settings["Position"][1]
+ errors += 1
+
+# Size of scalar bar
+width = recreated_bar.Position2[0]
+height = recreated_bar.Position2[1]
+
+if abs(width - settings["Size"][0]) > tolerance:
+ print "ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0]
+ errors += 1
+if abs(height - settings["Size"][1]) > tolerance:
+ print "ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1]
+ errors += 1
+
+# Discretize
+discretize = recreated_cutplanes.LookupTable.Discretize
+if discretize != settings["Discretize"]:
+ print "ERROR!!! Discretize property is incorrect: ", discretize, " instead of ", settings["Discretize"]
+ errors += 1
+
+# Number of colors
+nb_colors = recreated_cutplanes.LookupTable.NumberOfTableValues
+if nb_colors != settings["NbColors"]:
+ print "ERROR!!! Number of colors of scalar bar is incorrect: ", nb_colors, " instead of ", settings["NbColors"]
+ errors += 1
+
+# Number of labels
+nb_labels = recreated_bar.NumberOfLabels
+if nb_labels != settings["NbLabels"]:
+ print "ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"]
+ errors += 1
+
+# Title
+title = recreated_bar.Title
+if title != settings["Title"]:
+ print "ERROR!!! Title of presentation is incorrect: ", title, " instead of ", settings["Title"]
+ errors += 1
+
+# Scaling
+use_log_scale = recreated_cutplanes.LookupTable.UseLogScale
+if use_log_scale != settings["UseLogScale"]:
+ print "ERROR!!! Scaling of presentation is incorrect: ", use_log_scale, " instead of ", settings["UseLogScale"]
+ errors += 1
+
+# Bar Orientation
+orientation = recreated_bar.Orientation
+if orientation != settings["Orientation"]:
+ print "ERROR!!! Orientation of scalar bar is incorrect: ", orientation, " instead of ", settings["Orientation"]
+ errors += 1
+
+# Normal
+cur_normal = list(recreated_cutplanes.Input.SliceType.Normal)
+if cur_normal != normal:
+ print "ERROR!!! Normal of cut planes is incorrect: ", cur_normal, " instead of ", normal
+ errors += 1
+
+# Position
+cur_pos = list(recreated_cutplanes.Input.SliceOffsetValues)
+if cur_pos != pos:
+ print "ERROR!!! Positions of cut planes is incorrect: ", cur_pos, " instead of ", pos
+ errors += 1
+
+if errors > 0:
+ raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/dump_study/A3 case
+
+from paravistest import datadir, delete_with_inputs
+from presentations import *
+import paravis
+from pvsimple import *
+
+my_paravis = paravis.myParavis
+
+settings = {"Offset": [0.0001, 0.0002, 0], "ScalarMode": ("Component", 2), "Position": [0.1, 0.2], "Size": [0.15, 0.25], "Discretize": 1, "NbColors": 44, "NbLabels": 22, "Title": "My presentation", "UseLogScale": 1, "Orientation": 'Horizontal', "Scale": 0.333, "ColorArray": "", "ColorComponents": [0.111, 0.222, 0.333]}
+
+# 1. TimeStamps.med import
+file_path = datadir + "TimeStamps.med"
+my_paravis.ImportFile(file_path)
+med_reader = GetActiveSource()
+if med_reader is None :
+ raise RuntimeError, "TimeStamps.med wasn't imported..."
+
+# 2. DeformedShape creation
+med_field = "vitesse"
+
+deformedshape = DeformedShapeOnField(med_reader, EntityType.NODE, med_field, 1)
+
+# apply settings
+deformedshape.Position = settings["Offset"]
+deformedshape.LookupTable.VectorMode = settings["ScalarMode"][0]
+deformedshape.LookupTable.VectorComponent = settings["ScalarMode"][1]
+deformedshape.LookupTable.Discretize = settings["Discretize"]
+deformedshape.LookupTable.NumberOfTableValues = settings["NbColors"]
+deformedshape.LookupTable.UseLogScale = settings["UseLogScale"]
+
+deformedshape.Input.ScaleFactor = settings["Scale"]
+deformedshape.ColorArrayName = ''
+deformedshape.AmbientColor = settings["ColorComponents"]
+
+bar = get_bar()
+bar.Position = settings["Position"]
+bar.Position2 = settings["Size"]
+bar.NumberOfLabels = settings["NbLabels"]
+bar.Title = settings["Title"]
+bar.Orientation = settings["Orientation"]
+
+# 3. Dump Study
+path_to_save = os.path.join(os.getenv("HOME"), "DeformedShape.py")
+SaveTrace( path_to_save )
+
+# 4. Delete the created objects, recreate the view
+delete_with_inputs(deformedshape)
+Delete(GetActiveView())
+view = CreateRenderView()
+
+# 5. Execution of the created script
+execfile(path_to_save)
+
+# 6. Checking of the settings done before dump
+recreated_bar = view.Representations[0]
+recreated_deformedshape = view.Representations[1]
+
+errors = 0
+tolerance = 1e-05
+
+# Offset
+offset = recreated_deformedshape.Position
+for i in range(len(settings["Offset"])):
+ if abs(offset[i] - settings["Offset"][i]) > tolerance:
+ print "ERROR!!! Offset value with ", i, " index is incorrect: ", offset[i], " instead of ", settings["Offset"][i]
+ errors += 1
+
+# Scalar mode
+vector_mode = recreated_deformedshape.LookupTable.VectorMode
+vector_component = recreated_deformedshape.LookupTable.VectorComponent
+
+if vector_mode != settings["ScalarMode"][0]:
+ print "ERROR!!! Vector mode value is incorrect: ", vector_mode, " instead of ", settings["ScalarMode"][0]
+ errors += 1
+if vector_component != settings["ScalarMode"][1]:
+ print "ERROR!!! Vector component value is incorrect: ", vector_component, " instead of ", settings["ScalarMode"][1]
+ errors += 1
+
+# Position of scalar bar
+pos_x = recreated_bar.Position[0]
+pos_y = recreated_bar.Position[1]
+
+if abs(pos_x - settings["Position"][0]) > tolerance:
+ print "ERROR!!! X coordinate of position of scalar bar is incorrect: ", pos_x, " instead of ", settings["Position"][0]
+ errors += 1
+if abs(pos_y - settings["Position"][1]) > tolerance:
+ print "ERROR!!! Y coordinate of position of scalar bar is incorrect: ", pos_y, " instead of ", settings["Position"][1]
+ errors += 1
+
+# Size of scalar bar
+width = recreated_bar.Position2[0]
+height = recreated_bar.Position2[1]
+
+if abs(width - settings["Size"][0]) > tolerance:
+ print "ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0]
+ errors += 1
+if abs(height - settings["Size"][1]) > tolerance:
+ print "ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1]
+ errors += 1
+
+# Discretize
+discretize = recreated_deformedshape.LookupTable.Discretize
+if discretize != settings["Discretize"]:
+ print "ERROR!!! Discretize property is incorrect: ", discretize, " instead of ", settings["Discretize"]
+ errors += 1
+
+# Number of colors
+nb_colors = recreated_deformedshape.LookupTable.NumberOfTableValues
+if nb_colors != settings["NbColors"]:
+ print "ERROR!!! Number of colors of scalar bar is incorrect: ", nb_colors, " instead of ", settings["NbColors"]
+ errors += 1
+
+# Number of labels
+nb_labels = recreated_bar.NumberOfLabels
+if nb_labels != settings["NbLabels"]:
+ print "ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"]
+ errors += 1
+
+# Title
+title = recreated_bar.Title
+if title != settings["Title"]:
+ print "ERROR!!! Title of presentation is incorrect: ", title, " instead of ", settings["Title"]
+ errors += 1
+
+# Scaling
+use_log_scale = recreated_deformedshape.LookupTable.UseLogScale
+if use_log_scale != settings["UseLogScale"]:
+ print "ERROR!!! Scaling of presentation is incorrect: ", use_log_scale, " instead of ", settings["UseLogScale"]
+ errors += 1
+
+# Bar Orientation
+orientation = recreated_bar.Orientation
+if orientation != settings["Orientation"]:
+ print "ERROR!!! Orientation of scalar bar is incorrect: ", orientation, " instead of ", settings["Orientation"]
+ errors += 1
+
+# Scale factor
+scale = recreated_deformedshape.Input.ScaleFactor
+if abs(scale - settings["Scale"]) > tolerance:
+ print "ERROR!!! Scale of presentation is incorrect: ", scale, " instead of ", settings["Scale"]
+ errors += 1
+
+# Color array name
+array_name = recreated_deformedshape.ColorArrayName
+if array_name != settings["ColorArray"]:
+ print "ERROR!!! Color array name of presentation is incorrect: ", array_name, " instead of ", settings["arrayName"]
+ errors += 1
+
+# Color
+color = list(recreated_deformedshape.AmbientColor)
+if color != settings["ColorComponents"]:
+ print "ERROR!!! Color of presentation is incorrect: ", color, " instead of ", settings["ColorComponents"]
+ errors += 1
+
+if errors > 0:
+ raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/dump_study/A4 case
+
+from paravistest import datadir, delete_with_inputs
+from presentations import *
+import paravis
+from pvsimple import *
+
+my_paravis = paravis.myParavis
+
+settings = {"Offset": [0.0001, 0.0002, 0], "ScalarMode": ("Component", 1), "Position": [0.1, 0.2], "Size": [0.15, 0.25], "Discretize": 1, "NbColors": 44, "NbLabels": 22, "Title": "My presentation"}
+
+# 1. TimeStamps.med import
+file_path = datadir + "TimeStamps.med"
+my_paravis.ImportFile(file_path)
+med_reader = GetActiveSource()
+if med_reader is None :
+ raise RuntimeError, "TimeStamps.med wasn't imported..."
+
+# 2. GaussPoints creation
+med_field = "pression"
+
+gausspoints = GaussPointsOnField(med_reader, EntityType.CELL, med_field, 1)
+
+# apply settings
+gausspoints.Position = settings["Offset"]
+gausspoints.LookupTable.VectorMode = settings["ScalarMode"][0]
+gausspoints.LookupTable.VectorComponent = settings["ScalarMode"][1]
+gausspoints.LookupTable.Discretize = settings["Discretize"]
+gausspoints.LookupTable.NumberOfTableValues = settings["NbColors"]
+
+bar = get_bar()
+bar.Position = settings["Position"]
+bar.Position2 = settings["Size"]
+bar.NumberOfLabels = settings["NbLabels"]
+bar.Title = settings["Title"]
+
+# 3. Dump Study
+path_to_save = os.path.join(os.getenv("HOME"), "GaussPoints.py")
+SaveTrace( path_to_save )
+
+# 4. Delete the created objects, recreate the view
+delete_with_inputs(gausspoints)
+Delete(GetActiveView())
+view = CreateRenderView()
+
+# 5. Execution of the created script
+execfile(path_to_save)
+
+# 6. Checking of the settings done before dump
+recreated_bar = view.Representations[0]
+recreated_gausspoints = view.Representations[1]
+
+errors = 0
+tolerance = 1e-05
+
+# Offset
+offset = recreated_gausspoints.Position
+for i in range(len(settings["Offset"])):
+ if abs(offset[i] - settings["Offset"][i]) > tolerance:
+ print "ERROR!!! Offset value with ", i, " index is incorrect: ", offset[i], " instead of ", settings["Offset"][i]
+ errors += 1
+
+# Scalar mode
+vector_mode = recreated_gausspoints.LookupTable.VectorMode
+vector_component = recreated_gausspoints.LookupTable.VectorComponent
+
+if vector_mode != settings["ScalarMode"][0]:
+ print "ERROR!!! Vector mode value is incorrect: ", vector_mode, " instead of ", settings["ScalarMode"][0]
+ errors += 1
+if vector_component != settings["ScalarMode"][1]:
+ print "ERROR!!! Vector component value is incorrect: ", vector_component, " instead of ", settings["ScalarMode"][1]
+ errors += 1
+
+# Position of scalar bar
+pos_x = recreated_bar.Position[0]
+pos_y = recreated_bar.Position[1]
+
+if abs(pos_x - settings["Position"][0]) > tolerance:
+ print "ERROR!!! X coordinate of position of scalar bar is incorrect: ", pos_x, " instead of ", settings["Position"][0]
+ errors += 1
+if abs(pos_y - settings["Position"][1]) > tolerance:
+ print "ERROR!!! Y coordinate of position of scalar bar is incorrect: ", pos_y, " instead of ", settings["Position"][1]
+ errors += 1
+
+# Size of scalar bar
+width = recreated_bar.Position2[0]
+height = recreated_bar.Position2[1]
+
+if abs(width - settings["Size"][0]) > tolerance:
+ print "ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0]
+ errors += 1
+if abs(height - settings["Size"][1]) > tolerance:
+ print "ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1]
+ errors += 1
+
+# Discretize
+discretize = recreated_gausspoints.LookupTable.Discretize
+if discretize != settings["Discretize"]:
+ print "ERROR!!! Discretize property is incorrect: ", discretize, " instead of ", settings["Discretize"]
+ errors += 1
+
+# Number of colors
+nb_colors = recreated_gausspoints.LookupTable.NumberOfTableValues
+if nb_colors != settings["NbColors"]:
+ print "ERROR!!! Number of colors of scalar bar is incorrect: ", nb_colors, " instead of ", settings["NbColors"]
+ errors += 1
+
+# Number of labels
+nb_labels = recreated_bar.NumberOfLabels
+if nb_labels != settings["NbLabels"]:
+ print "ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"]
+ errors += 1
+
+# Title
+title = recreated_bar.Title
+if title != settings["Title"]:
+ print "ERROR!!! Title of presentation is incorrect: ", title, " instead of ", settings["Title"]
+ errors += 1
+
+if errors > 0:
+ raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/dump_study/A5 case
+
+from paravistest import datadir, delete_with_inputs
+from presentations import *
+import paravis
+from pvsimple import *
+
+my_paravis = paravis.myParavis
+
+settings = {"Offset": [0.0001, 0.0002, 0], "ScalarMode": ("Component", 2), "Position": [0.1, 0.2], "Size": [0.15, 0.25], "Discretize": 1, "NbColors": 44, "NbLabels": 22, "Title": "My presentation", "UseLogScale": 1, "Orientation": 'Horizontal', "ScaleFactor": 0.25, "NbContours": 4}
+
+# 1. TimeStamps.med import
+file_path = datadir + "fra.med"
+my_paravis.ImportFile(file_path)
+med_reader = GetActiveSource()
+if med_reader is None :
+ raise RuntimeError, "TimeStamps.med wasn't imported..."
+
+# 2. Plot3D creation
+med_field = "VITESSE"
+
+plot3d = Plot3DOnField(med_reader, EntityType.NODE, med_field, 1, is_contour=True)
+
+# apply settings
+plot3d.Position = settings["Offset"]
+plot3d.LookupTable.VectorMode = settings["ScalarMode"][0]
+plot3d.LookupTable.VectorComponent = settings["ScalarMode"][1]
+plot3d.LookupTable.Discretize = settings["Discretize"]
+plot3d.LookupTable.NumberOfTableValues = settings["NbColors"]
+plot3d.LookupTable.UseLogScale = settings["UseLogScale"]
+
+slice_filter = plot3d.Input.Input.Input.Input
+normal = get_normal_by_orientation(Orientation.ZX, radians(22), radians(33))
+bounds = get_bounds(med_reader)
+pos = get_positions(1, normal, bounds, 0.11)
+slice_filter.SliceType.Normal = normal
+slice_filter.SliceOffsetValues = pos
+
+plot3d.Input.Input.ScaleFactor = settings["ScaleFactor"]
+
+contour_filter = plot3d.Input
+rgb_points = plot3d.LookupTable.RGBPoints
+scalar_range = [rgb_points[0], rgb_points[4]]
+surfaces = get_contours(scalar_range, settings["NbContours"])
+contour_filter.Isosurfaces = surfaces
+
+bar = get_bar()
+bar.Position = settings["Position"]
+bar.Position2 = settings["Size"]
+bar.NumberOfLabels = settings["NbLabels"]
+bar.Title = settings["Title"]
+bar.Orientation = settings["Orientation"]
+
+# 3. Dump Study
+path_to_save = os.path.join(os.getenv("HOME"), "Plot3D.py")
+SaveTrace( path_to_save )
+
+# 4. Delete the created objects, recreate the view
+delete_with_inputs(plot3d)
+Delete(GetActiveView())
+view = CreateRenderView()
+
+# 5. Execution of the created script
+execfile(path_to_save)
+
+# 6. Checking of the settings done before dump
+recreated_bar = view.Representations[0]
+recreated_plot3d = view.Representations[1]
+
+errors = 0
+tolerance = 1e-05
+
+# Offset
+offset = recreated_plot3d.Position
+for i in range(len(settings["Offset"])):
+ if abs(offset[i] - settings["Offset"][i]) > tolerance:
+ print "ERROR!!! Offset value with ", i, " index is incorrect: ", offset[i], " instead of ", settings["Offset"][i]
+ errors += 1
+
+# Scalar mode
+vector_mode = recreated_plot3d.LookupTable.VectorMode
+vector_component = recreated_plot3d.LookupTable.VectorComponent
+
+if vector_mode != settings["ScalarMode"][0]:
+ print "ERROR!!! Vector mode value is incorrect: ", vector_mode, " instead of ", settings["ScalarMode"][0]
+ errors += 1
+if vector_component != settings["ScalarMode"][1]:
+ print "ERROR!!! Vector component value is incorrect: ", vector_component, " instead of ", settings["ScalarMode"][1]
+ errors += 1
+
+# Position of scalar bar
+pos_x = recreated_bar.Position[0]
+pos_y = recreated_bar.Position[1]
+
+if abs(pos_x - settings["Position"][0]) > tolerance:
+ print "ERROR!!! X coordinate of position of scalar bar is incorrect: ", pos_x, " instead of ", settings["Position"][0]
+ errors += 1
+if abs(pos_y - settings["Position"][1]) > tolerance:
+ print "ERROR!!! Y coordinate of position of scalar bar is incorrect: ", pos_y, " instead of ", settings["Position"][1]
+ errors += 1
+
+# Size of scalar bar
+width = recreated_bar.Position2[0]
+height = recreated_bar.Position2[1]
+
+if abs(width - settings["Size"][0]) > tolerance:
+ print "ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0]
+ errors += 1
+if abs(height - settings["Size"][1]) > tolerance:
+ print "ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1]
+ errors += 1
+
+# Discretize
+discretize = recreated_plot3d.LookupTable.Discretize
+if discretize != settings["Discretize"]:
+ print "ERROR!!! Discretize property is incorrect: ", discretize, " instead of ", settings["Discretize"]
+ errors += 1
+
+# Number of colors
+nb_colors = recreated_plot3d.LookupTable.NumberOfTableValues
+if nb_colors != settings["NbColors"]:
+ print "ERROR!!! Number of colors of scalar bar is incorrect: ", nb_colors, " instead of ", settings["NbColors"]
+ errors += 1
+
+# Number of labels
+nb_labels = recreated_bar.NumberOfLabels
+if nb_labels != settings["NbLabels"]:
+ print "ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"]
+ errors += 1
+
+# Title
+title = recreated_bar.Title
+if title != settings["Title"]:
+ print "ERROR!!! Title of presentation is incorrect: ", title, " instead of ", settings["Title"]
+ errors += 1
+
+# Scaling
+use_log_scale = recreated_plot3d.LookupTable.UseLogScale
+if use_log_scale != settings["UseLogScale"]:
+ print "ERROR!!! Scaling of presentation is incorrect: ", use_log_scale, " instead of ", settings["UseLogScale"]
+ errors += 1
+
+# Bar Orientation
+orientation = recreated_bar.Orientation
+if orientation != settings["Orientation"]:
+ print "ERROR!!! Orientation of scalar bar is incorrect: ", orientation, " instead of ", settings["Orientation"]
+ errors += 1
+
+# Scale Factor
+scale_factor = recreated_plot3d.Input.Input.ScaleFactor
+if abs(scale_factor - settings["ScaleFactor"]) > tolerance:
+ print "ERROR!!! Scale factor of presentation is incorrect: ", scale_factor, " instead of ", settings["ScaleFactor"]
+ errors += 1
+
+# Cutting plane
+cur_slice_filter = recreated_plot3d.Input.Input.Input.Input
+
+cur_normal = list(cur_slice_filter.SliceType.Normal)
+if cur_normal != normal:
+ print "ERROR!!! Normal of the cutting plane is incorrect: ", cur_normal, " instead of ", normal
+ errors += 1
+
+cur_pos = list(cur_slice_filter.SliceOffsetValues)
+if cur_pos != pos:
+ print "ERROR!!! Position of the cuttting plane is incorrect: ", cur_pos, " instead of ", pos
+ errors += 1
+
+# Contours
+cur_surfaces = list(recreated_plot3d.Input.Isosurfaces)
+if cur_surfaces != surfaces:
+ print "ERROR!!! Contours is incorrect: ", cur_surfaces, " instead of ", surfaces
+ errors += 1
+
+if errors > 0:
+ raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/dump_study/A6 case
+
+from paravistest import datadir, delete_with_inputs
+from presentations import *
+import paravis
+from pvsimple import *
+
+my_paravis = paravis.myParavis
+
+settings = {"Offset": [0.0001, 0.0002, 0], "ScalarMode": ("Component", 2), "Position": [0.1, 0.2], "Size": [0.15, 0.25], "Discretize": 1, "NbColors": 44, "NbLabels": 22, "Title": "My presentation", "UseLogScale": 1, "Orientation": 'Horizontal', "Scale": 0.12929}
+
+# 1. TimeStamps.med import
+file_path = datadir + "TimeStamps.med"
+my_paravis.ImportFile(file_path)
+med_reader = GetActiveSource()
+if med_reader is None:
+ raise RuntimeError, "TimeStamps.med wasn't imported..."
+
+# 2. ScalarMapOnDeformedShape creation
+med_field = "vitesse"
+
+prs = DeformedShapeAndScalarMapOnField(med_reader, EntityType.NODE, med_field, 1)
+
+# apply settings
+prs.Position = settings["Offset"]
+prs.LookupTable.VectorMode = settings["ScalarMode"][0]
+prs.LookupTable.VectorComponent = settings["ScalarMode"][1]
+prs.LookupTable.Discretize = settings["Discretize"]
+prs.LookupTable.NumberOfTableValues = settings["NbColors"]
+prs.LookupTable.UseLogScale = settings["UseLogScale"]
+
+prs.Input.ScaleFactor = settings["Scale"]
+range_min = prs.LookupTable.RGBPoints[0]
+range_max = prs.LookupTable.RGBPoints[4]
+
+bar = get_bar()
+bar.Position = settings["Position"]
+bar.Position2 = settings["Size"]
+bar.NumberOfLabels = settings["NbLabels"]
+bar.Title = settings["Title"]
+bar.Orientation = settings["Orientation"]
+
+# 3. Dump Study
+path_to_save = os.path.join(os.getenv("HOME"), "ScalarMapOnDeformedShape.py")
+SaveTrace( path_to_save )
+
+# 4. Delete the created objects, recreate the view
+delete_with_inputs(prs)
+Delete(GetActiveView())
+view = CreateRenderView()
+
+# 5. Execution of the created script
+execfile(path_to_save)
+
+# 6. Checking of the settings done before dump
+recreated_bar = view.Representations[0]
+recreated_prs = view.Representations[1]
+
+errors = 0
+tolerance = 1e-05
+
+# Offset
+offset = recreated_prs.Position
+for i in range(len(settings["Offset"])):
+ if abs(offset[i] - settings["Offset"][i]) > tolerance:
+ print "ERROR!!! Offset value with ", i, " index is incorrect: ", offset[i], " instead of ", settings["Offset"][i]
+ errors += 1
+
+# Scalar mode
+vector_mode = recreated_prs.LookupTable.VectorMode
+vector_component = recreated_prs.LookupTable.VectorComponent
+
+if vector_mode != settings["ScalarMode"][0]:
+ print "ERROR!!! Vector mode value is incorrect: ", vector_mode, " instead of ", settings["ScalarMode"][0]
+ errors += 1
+if vector_component != settings["ScalarMode"][1]:
+ print "ERROR!!! Vector component value is incorrect: ", vector_component, " instead of ", settings["ScalarMode"][1]
+ errors += 1
+
+# Position of scalar bar
+pos_x = recreated_bar.Position[0]
+pos_y = recreated_bar.Position[1]
+
+if abs(pos_x - settings["Position"][0]) > tolerance:
+ print "ERROR!!! X coordinate of position of scalar bar is incorrect: ", pos_x, " instead of ", settings["Position"][0]
+ errors += 1
+if abs(pos_y - settings["Position"][1]) > tolerance:
+ print "ERROR!!! Y coordinate of position of scalar bar is incorrect: ", pos_y, " instead of ", settings["Position"][1]
+ errors += 1
+
+# Size of scalar bar
+width = recreated_bar.Position2[0]
+height = recreated_bar.Position2[1]
+
+if abs(width - settings["Size"][0]) > tolerance:
+ print "ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0]
+ errors += 1
+if abs(height - settings["Size"][1]) > tolerance:
+ print "ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1]
+ errors += 1
+
+# Discretize
+discretize = recreated_prs.LookupTable.Discretize
+if discretize != settings["Discretize"]:
+ print "ERROR!!! Discretize property is incorrect: ", discretize, " instead of ", settings["Discretize"]
+ errors += 1
+
+# Number of colors
+nb_colors = recreated_prs.LookupTable.NumberOfTableValues
+if nb_colors != settings["NbColors"]:
+ print "ERROR!!! Number of colors of scalar bar is incorrect: ", nb_colors, " instead of ", settings["NbColors"]
+ errors += 1
+
+# Number of labels
+nb_labels = recreated_bar.NumberOfLabels
+if nb_labels != settings["NbLabels"]:
+ print "ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"]
+ errors += 1
+
+# Title
+title = recreated_bar.Title
+if title != settings["Title"]:
+ print "ERROR!!! Title of presentation is incorrect: ", title, " instead of ", settings["Title"]
+ errors += 1
+
+# Scaling
+use_log_scale = recreated_prs.LookupTable.UseLogScale
+if use_log_scale != settings["UseLogScale"]:
+ print "ERROR!!! Scaling of presentation is incorrect: ", use_log_scale, " instead of ", settings["UseLogScale"]
+ errors += 1
+
+# Bar Orientation
+orientation = recreated_bar.Orientation
+if orientation != settings["Orientation"]:
+ print "ERROR!!! Orientation of scalar bar is incorrect: ", orientation, " instead of ", settings["Orientation"]
+ errors += 1
+
+# Range
+cur_range_min = recreated_prs.LookupTable.RGBPoints[0]
+cur_range_max = recreated_prs.LookupTable.RGBPoints[4]
+
+if abs(cur_range_min - range_min) > tolerance:
+ print "ERROR!!! Minimum value of range of presentation is incorrect: ", cur_range_min, " instead of ", range_min
+ errors += 1
+
+if abs(cur_range_max - range_max) > tolerance:
+ print "ERROR!!! Maximum value of range of presentation is incorrect: ", cur_range_max, " instead of ", range_max
+ errors += 1
+
+# Scale factor
+scale = recreated_prs.Input.ScaleFactor
+if abs(scale - settings["Scale"]) > tolerance:
+ print "ERROR!!! Scale of presentation is incorrect: ", scale, " instead of ", settings["Scale"]
+ errors += 1
+
+if errors > 0:
+ raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/dump_study/A7 case
+
+from paravistest import datadir, delete_with_inputs
+from presentations import *
+import paravis
+from pvsimple import *
+
+my_paravis = paravis.myParavis
+
+# StreamLines settings
+settings = {'name': 'myStreamLines',
+ 'IntegrationDirection': 'FORWARD',
+ 'InitialStepLength': 0.009,
+ 'IntegrationStepUnit': 'Length',
+ 'IntegratorType': 'Runge-Kutta 4-5',
+ 'MaximumError': 1.45e-06,
+ 'MinimumStepLength': 0.0079917,
+ 'MaximumStepLength': 0.008,
+ 'MaximumSteps': 475,
+ 'MaximumStreamlineLength': 1.185,
+ 'SeedType.Center': [0.1088, 0.03254, 0.431],
+ 'SeedType.NumberOfPoints': 33,
+ 'SeedType.Radius': 0.0035}
+
+# errors counter
+errors = 0
+
+# 1. TimeStamps.med import
+file_path = datadir + "TimeStamps.med"
+my_paravis.ImportFile(file_path)
+med_reader = GetActiveSource()
+if med_reader is None :
+ raise RuntimeError, "TimeStamps.med wasn't imported..."
+
+# 2. StreamLines creation
+field_name = "vitesse"
+
+source = MergeBlocks(med_reader)
+calc = get_add_component_calc(source, EntityType.NODE, field_name)
+vector_array = calc.ResultArrayName
+calc.UpdatePipeline()
+source = calc
+stream = pv.StreamTracer(source)
+
+# 3. Apply settings
+RenameSource(settings['name'], stream)
+stream.IntegrationDirection = settings['IntegrationDirection']
+stream.InitialStepLength = settings['InitialStepLength']
+stream.IntegrationStepUnit = settings['IntegrationStepUnit']
+stream.IntegratorType = settings['IntegratorType']
+stream.MaximumError = settings['MaximumError']
+stream.MinimumStepLength = settings['MinimumStepLength']
+stream.MaximumStepLength = settings['MaximumStepLength']
+stream.MaximumSteps = settings['MaximumSteps']
+stream.MaximumStreamlineLength = settings['MaximumStreamlineLength']
+stream.SeedType.Center = settings['SeedType.Center']
+stream.SeedType.NumberOfPoints = settings['SeedType.NumberOfPoints']
+stream.SeedType.Radius = settings['SeedType.Radius']
+
+# 4. Dump Study
+path_to_save = os.path.join(os.getenv("HOME"), "StreamLines.py")
+SaveTrace( path_to_save )
+
+# 4. Delete the created objects
+delete_with_inputs(stream)
+
+# 5. Execution of the created script
+execfile(path_to_save)
+
+# 6. Find the recreated StreamTracer object
+recreated_stream = FindSource(settings['name'])
+if recreated_stream is None:
+ raise RuntimeError, "There is no StreamLines in the study (must be created by executed python script)!!!"
+
+print settings['name'] + " was found!!!"
+
+# 7. Check settings
+
+# IntegrationDirection
+param = stream.IntegrationDirection
+if param != settings['IntegrationDirection']:
+ print "ERROR!!! IntegrationDirection of presentation is incorrect: ", param, " instead of ", settings["IntegrationDirection"]
+ errors += 1
+
+# InitialStepLength
+param = stream.InitialStepLength
+if param != settings['InitialStepLength']:
+ print "ERROR!!! InitialStepLength of presentation is incorrect: ", param, " instead of ", settings["InitialStepLength"]
+ errors += 1
+
+# IntegrationStepUnit
+param = stream.IntegrationStepUnit
+if param != settings['IntegrationStepUnit']:
+ print "ERROR!!! IntegrationStepUnit of presentation is incorrect: ", param, " instead of ", settings["IntegrationStepUnit"]
+ errors += 1
+
+# IntegratorType
+param = stream.IntegratorType
+if param != settings['IntegratorType']:
+ print "ERROR!!! IntegratorType of presentation is incorrect: ", param, " instead of ", settings["IntegratorType"]
+ errors += 1
+
+# MaximumError
+param = stream.MaximumError
+if param != settings['MaximumError']:
+ print "ERROR!!! MaximumError of presentation is incorrect: ", param, " instead of ", settings["MaximumError"]
+ errors += 1
+
+# MinimumStepLength
+param = stream.MinimumStepLength
+if param != settings['MinimumStepLength']:
+ print "ERROR!!! MinimumStepLength of presentation is incorrect: ", param, " instead of ", settings["MinimumStepLength"]
+ errors += 1
+
+# MaximumStepLength
+param = stream.MaximumStepLength
+if param != settings['MaximumStepLength']:
+ print "ERROR!!! MaximumStepLength of presentation is incorrect: ", param, " instead of ", settings["MaximumStepLength"]
+ errors += 1
+
+# MaximumSteps
+param = stream.MaximumSteps
+if param != settings['MaximumSteps']:
+ print "ERROR!!! MaximumSteps of presentation is incorrect: ", param, " instead of ", settings["MaximumSteps"]
+ errors += 1
+
+# MaximumStreamlineLength
+param = stream.MaximumStreamlineLength
+if param != settings['MaximumStreamlineLength']:
+ print "ERROR!!! MaximumStreamlineLength of presentation is incorrect: ", param, " instead of ", settings["MaximumStreamlineLength"]
+ errors += 1
+
+# SeedType.Center
+param = list(stream.SeedType.Center)
+if param != settings['SeedType.Center']:
+ print "ERROR!!! SeedType.Center of presentation is incorrect: ", param, " instead of ", settings["SeedType.Center"]
+ errors += 1
+
+# SeedType.NumberOfPoints
+param = stream.SeedType.NumberOfPoints
+if param != settings['SeedType.NumberOfPoints']:
+ print "ERROR!!! SeedType.NumberOfPoints of presentation is incorrect: ", param, " instead of ", settings["SeedType.NumberOfPoints"]
+ errors += 1
+
+# SeedType.Radius
+param = stream.SeedType.Radius
+if param != settings['SeedType.Radius']:
+ print "ERROR!!! SeedType.Radius of presentation is incorrect: ", param, " instead of ", settings["SeedType.Radius"]
+ errors += 1
+
+if errors > 0:
+ raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/dump_study/A3 case
+
+from paravistest import datadir, delete_with_inputs
+from presentations import *
+import paravis
+from pvsimple import *
+
+my_paravis = paravis.myParavis
+
+settings = {"Offset": [0.0001, 0.0002, 0], "ScalarMode": ("Component", 2), "Position": [0.1, 0.2], "Size": [0.15, 0.25], "Discretize": 1, "NbColors": 44, "NbLabels": 22, "Title": "My presentation", "UseLogScale": 1, "Orientation": 'Horizontal', "Scale": 0.333, "ColorArray": "", "ColorComponents": [0.111, 0.222, 0.333], "LineWidth": 2, "GlyphType": 'Cone', "GlyphPos": [-0.5, 0.0, 0.0]}
+
+# 1. TimeStamps.med import
+file_path = datadir + "TimeStamps.med"
+my_paravis.ImportFile(file_path)
+med_reader = GetActiveSource()
+if med_reader is None :
+ raise RuntimeError, "TimeStamps.med wasn't imported..."
+
+# 2. Vectors creation
+med_field = "vitesse"
+
+vectors = VectorsOnField(med_reader, EntityType.NODE, med_field, 1)
+
+# apply settings
+vectors.Position = settings["Offset"]
+vectors.LookupTable.VectorMode = settings["ScalarMode"][0]
+vectors.LookupTable.VectorComponent = settings["ScalarMode"][1]
+vectors.LookupTable.Discretize = settings["Discretize"]
+vectors.LookupTable.NumberOfTableValues = settings["NbColors"]
+vectors.LookupTable.UseLogScale = settings["UseLogScale"]
+
+vectors.Input.SetScaleFactor = settings["Scale"]
+vectors.ColorArrayName = ''
+vectors.AmbientColor = settings["ColorComponents"]
+
+vectors.LineWidth = settings["LineWidth"]
+vectors.Input.GlyphType = settings["GlyphType"]
+vectors.Input.GlyphType.Center = settings["GlyphPos"]
+
+bar = get_bar()
+bar.Position = settings["Position"]
+bar.Position2 = settings["Size"]
+bar.NumberOfLabels = settings["NbLabels"]
+bar.Title = settings["Title"]
+bar.Orientation = settings["Orientation"]
+
+cone_glyth_type = type(vectors.Input.GlyphType)
+
+# 3. Dump Study
+path_to_save = os.path.join(os.getenv("HOME"), "Vectors.py")
+SaveTrace( path_to_save )
+
+# 4. Delete the created objects, recreate the view
+delete_with_inputs(vectors)
+Delete(GetActiveView())
+view = CreateRenderView()
+
+# 5. Execution of the created script
+execfile(path_to_save)
+
+# 6. Checking of the settings done before dump
+recreated_bar = view.Representations[0]
+recreated_vectors = view.Representations[1]
+
+errors = 0
+tolerance = 1e-05
+
+# Offset
+offset = recreated_vectors.Position
+for i in range(len(settings["Offset"])):
+ if abs(offset[i] - settings["Offset"][i]) > tolerance:
+ print "ERROR!!! Offset value with ", i, " index is incorrect: ", offset[i], " instead of ", settings["Offset"][i]
+ errors += 1
+
+# Scalar mode
+vector_mode = recreated_vectors.LookupTable.VectorMode
+vector_component = recreated_vectors.LookupTable.VectorComponent
+
+if vector_mode != settings["ScalarMode"][0]:
+ print "ERROR!!! Vector mode value is incorrect: ", vector_mode, " instead of ", settings["ScalarMode"][0]
+ errors += 1
+if vector_component != settings["ScalarMode"][1]:
+ print "ERROR!!! Vector component value is incorrect: ", vector_component, " instead of ", settings["ScalarMode"][1]
+ errors += 1
+
+# Position of scalar bar
+pos_x = recreated_bar.Position[0]
+pos_y = recreated_bar.Position[1]
+
+if abs(pos_x - settings["Position"][0]) > tolerance:
+ print "ERROR!!! X coordinate of position of scalar bar is incorrect: ", pos_x, " instead of ", settings["Position"][0]
+ errors += 1
+if abs(pos_y - settings["Position"][1]) > tolerance:
+ print "ERROR!!! Y coordinate of position of scalar bar is incorrect: ", pos_y, " instead of ", settings["Position"][1]
+ errors += 1
+
+# Size of scalar bar
+width = recreated_bar.Position2[0]
+height = recreated_bar.Position2[1]
+
+if abs(width - settings["Size"][0]) > tolerance:
+ print "ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0]
+ errors += 1
+if abs(height - settings["Size"][1]) > tolerance:
+ print "ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1]
+ errors += 1
+
+# Discretize
+discretize = recreated_vectors.LookupTable.Discretize
+if discretize != settings["Discretize"]:
+ print "ERROR!!! Discretize property is incorrect: ", discretize, " instead of ", settings["Discretize"]
+ errors += 1
+
+# Number of colors
+nb_colors = recreated_vectors.LookupTable.NumberOfTableValues
+if nb_colors != settings["NbColors"]:
+ print "ERROR!!! Number of colors of scalar bar is incorrect: ", nb_colors, " instead of ", settings["NbColors"]
+ errors += 1
+
+# Number of labels
+nb_labels = recreated_bar.NumberOfLabels
+if nb_labels != settings["NbLabels"]:
+ print "ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"]
+ errors += 1
+
+# Title
+title = recreated_bar.Title
+if title != settings["Title"]:
+ print "ERROR!!! Title of presentation is incorrect: ", title, " instead of ", settings["Title"]
+ errors += 1
+
+# Scaling
+use_log_scale = recreated_vectors.LookupTable.UseLogScale
+if use_log_scale != settings["UseLogScale"]:
+ print "ERROR!!! Scaling of presentation is incorrect: ", use_log_scale, " instead of ", settings["UseLogScale"]
+ errors += 1
+
+# Bar Orientation
+orientation = recreated_bar.Orientation
+if orientation != settings["Orientation"]:
+ print "ERROR!!! Orientation of scalar bar is incorrect: ", orientation, " instead of ", settings["Orientation"]
+ errors += 1
+
+# Scale factor
+scale = recreated_vectors.Input.SetScaleFactor
+if abs(scale - settings["Scale"]) > tolerance:
+ print "ERROR!!! Scale of presentation is incorrect: ", scale, " instead of ", settings["Scale"]
+ errors += 1
+
+# Color array name
+array_name = recreated_vectors.ColorArrayName
+if array_name != settings["ColorArray"]:
+ print "ERROR!!! Color array name of presentation is incorrect: ", array_name, " instead of ", settings["arrayName"]
+ errors += 1
+
+# Color
+color = list(recreated_vectors.AmbientColor)
+if color != settings["ColorComponents"]:
+ print "ERROR!!! Color of presentation is incorrect: ", color, " instead of ", settings["ColorComponents"]
+ errors += 1
+
+# Line width
+line_width = recreated_vectors.LineWidth
+if abs(line_width - settings["LineWidth"]) > tolerance:
+ print "ERROR!!! Line width of presentation is incorrect: ", line_width, " instead of ", settings["LineWidth"]
+ errors += 1
+
+# Glyph type
+glyph_type = type(recreated_vectors.Input.GlyphType)
+if glyph_type != cone_glyth_type:
+ print "ERROR!!! Glyph type is incorrect: ", glyph_type, " instead of ", cone_glyth_type
+ errors += 1
+
+# Glyph position
+glyph_position = list(recreated_vectors.Input.GlyphType.Center)
+if glyph_position != settings["GlyphPos"]:
+ print "ERROR!!! Glyph position is incorrect: ", glyph_position, " instead of ", settings["GlyphPos"]
+ errors += 1
+
+if errors > 0:
+ raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/dump_study/A2 case
+
+from paravistest import datadir, delete_with_inputs
+from presentations import *
+import paravis
+from pvsimple import *
+
+my_paravis = paravis.myParavis
+
+settings = {"Offset": [0.0001, 0.0002, 0], "ScalarMode": ("Component", 2), "Position": [0.1, 0.2], "Size": [0.15, 0.25], "Discretize": 1, "NbColors": 44, "NbLabels": 22, "Title": "My presentation", "UseLogScale": 1, "Orientation": 'Horizontal', "Orientation_BasePlane": [Orientation.ZX, 22, 33], "Orientation_CuttingPlanes": [Orientation.YZ, 44, 55], "Displacement": 0.1, "Displacement2": 0.2, "BasePlane_Position": 0.1, "NbLines": 3}
+
+# 1. TimeStamps.med import
+file_path = datadir + "TimeStamps.med"
+my_paravis.ImportFile(file_path)
+med_reader = GetActiveSource()
+if med_reader is None :
+ raise RuntimeError, "TimeStamps.med wasn't imported..."
+
+# 2. CutLines creation
+med_field = "vitesse"
+
+nb_lines = settings["NbLines"]
+orient1 = settings["Orientation_BasePlane"][0]
+base_ang1 = settings["Orientation_BasePlane"][1]
+base_ang2 = settings["Orientation_BasePlane"][2]
+orient2 = settings["Orientation_CuttingPlanes"][0]
+cut_ang1 = settings["Orientation_CuttingPlanes"][1]
+cut_ang2 = settings["Orientation_CuttingPlanes"][2]
+d1 = settings["Displacement"]
+d2 = settings["Displacement2"]
+
+cutlines = CutLinesOnField(med_reader, EntityType.NODE, med_field, 1, nb_lines, orient1, base_ang1, base_ang2, orient2, cut_ang1, cut_ang2, d1, d2)
+
+# apply settings
+cutlines.Position = settings["Offset"]
+cutlines.LookupTable.VectorMode = settings["ScalarMode"][0]
+cutlines.LookupTable.VectorComponent = settings["ScalarMode"][1]
+cutlines.LookupTable.Discretize = settings["Discretize"]
+cutlines.LookupTable.NumberOfTableValues = settings["NbColors"]
+cutlines.LookupTable.UseLogScale = settings["UseLogScale"]
+
+cutlines.Input.Input.SliceOffsetValues[0] = settings["BasePlane_Position"]
+
+normal1 = list(cutlines.Input.Input.SliceType.Normal)
+pos1 = list(cutlines.Input.Input.SliceOffsetValues)
+normal2 = list(cutlines.Input.SliceType.Normal)
+pos2 = list(cutlines.Input.SliceOffsetValues)
+
+bar = get_bar()
+bar.Position = settings["Position"]
+bar.Position2 = settings["Size"]
+bar.NumberOfLabels = settings["NbLabels"]
+bar.Title = settings["Title"]
+bar.Orientation = settings["Orientation"]
+
+# 3. Dump Study
+path_to_save = os.path.join(os.getenv("HOME"), "CutLines.py")
+SaveTrace( path_to_save )
+
+# 4. Delete the created objects, recreate the view
+delete_with_inputs(cutlines)
+Delete(GetActiveView())
+view = CreateRenderView()
+
+# 5. Execution of the created script
+execfile(path_to_save)
+
+# 6. Checking of the settings done before dump
+recreated_bar = view.Representations[0]
+recreated_cutlines = view.Representations[1]
+
+errors = 0
+tolerance = 1e-05
+
+# Offset
+offset = recreated_cutlines.Position
+for i in range(len(settings["Offset"])):
+ if abs(offset[i] - settings["Offset"][i]) > tolerance:
+ print "ERROR!!! Offset value with ", i, " index is incorrect: ", offset[i], " instead of ", settings["Offset"][i]
+ errors += 1
+
+# Scalar mode
+vector_mode = recreated_cutlines.LookupTable.VectorMode
+vector_component = recreated_cutlines.LookupTable.VectorComponent
+
+if vector_mode != settings["ScalarMode"][0]:
+ print "ERROR!!! Vector mode value is incorrect: ", vector_mode, " instead of ", settings["ScalarMode"][0]
+ errors += 1
+if vector_component != settings["ScalarMode"][1]:
+ print "ERROR!!! Vector component value is incorrect: ", vector_component, " instead of ", settings["ScalarMode"][1]
+ errors += 1
+
+# Position of scalar bar
+pos_x = recreated_bar.Position[0]
+pos_y = recreated_bar.Position[1]
+
+if abs(pos_x - settings["Position"][0]) > tolerance:
+ print "ERROR!!! X coordinate of position of scalar bar is incorrect: ", pos_x, " instead of ", settings["Position"][0]
+ errors += 1
+if abs(pos_y - settings["Position"][1]) > tolerance:
+ print "ERROR!!! Y coordinate of position of scalar bar is incorrect: ", pos_y, " instead of ", settings["Position"][1]
+ errors += 1
+
+# Size of scalar bar
+width = recreated_bar.Position2[0]
+height = recreated_bar.Position2[1]
+
+if abs(width - settings["Size"][0]) > tolerance:
+ print "ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0]
+ errors += 1
+if abs(height - settings["Size"][1]) > tolerance:
+ print "ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1]
+ errors += 1
+
+# Discretize
+discretize = recreated_cutlines.LookupTable.Discretize
+if discretize != settings["Discretize"]:
+ print "ERROR!!! Discretize property is incorrect: ", discretize, " instead of ", settings["Discretize"]
+ errors += 1
+
+# Number of colors
+nb_colors = recreated_cutlines.LookupTable.NumberOfTableValues
+if nb_colors != settings["NbColors"]:
+ print "ERROR!!! Number of colors of scalar bar is incorrect: ", nb_colors, " instead of ", settings["NbColors"]
+ errors += 1
+
+# Number of labels
+nb_labels = recreated_bar.NumberOfLabels
+if nb_labels != settings["NbLabels"]:
+ print "ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"]
+ errors += 1
+
+# Title
+title = recreated_bar.Title
+if title != settings["Title"]:
+ print "ERROR!!! Title of presentation is incorrect: ", title, " instead of ", settings["Title"]
+ errors += 1
+
+# Scaling
+use_log_scale = recreated_cutlines.LookupTable.UseLogScale
+if use_log_scale != settings["UseLogScale"]:
+ print "ERROR!!! Scaling of presentation is incorrect: ", use_log_scale, " instead of ", settings["UseLogScale"]
+ errors += 1
+
+# Bar Orientation
+orientation = recreated_bar.Orientation
+if orientation != settings["Orientation"]:
+ print "ERROR!!! Orientation of scalar bar is incorrect: ", orientation, " instead of ", settings["Orientation"]
+ errors += 1
+
+# Base Plane Normal
+cur_normal = list(recreated_cutlines.Input.Input.SliceType.Normal)
+if cur_normal != normal1:
+ print "ERROR!!! Normal of base plane is incorrect: ", cur_normal, " instead of ", normal1
+ errors += 1
+
+# Base Plane Position
+cur_pos = list(recreated_cutlines.Input.Input.SliceOffsetValues)
+if cur_pos != pos1:
+ print "ERROR!!! Position of base plane is incorrect: ", cur_pos, " instead of ", pos1
+ errors += 1
+
+# Base Plane Normal
+cur_normal = list(recreated_cutlines.Input.SliceType.Normal)
+if cur_normal != normal2:
+ print "ERROR!!! Normal of cutting planes is incorrect: ", cur_normal, " instead of ", normal2
+ errors += 1
+
+# Cutting Planes Position
+cur_pos = list(recreated_cutlines.Input.SliceOffsetValues)
+if cur_pos != pos2:
+ print "ERROR!!! Positions of cutting planes are incorrect: ", cur_pos, " instead of ", pos2
+ errors += 1
+
+if errors > 0:
+ raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/dump_study/B0 case
+
+from paravistest import datadir
+from presentations import *
+import paravis
+from pvsimple import *
+
+my_paravis = paravis.myParavis
+
+# 1. TimeStamps.med import
+file_path = datadir + "TimeStamps.med"
+my_paravis.ImportFile(file_path)
+med_reader = GetActiveSource()
+if med_reader is None :
+ raise RuntimeError, "TimeStamps.med wasn't imported..."
+
+# 2. Presentations creation
+errors = 0
+prs_names = ["ScalarMap", "IsoSurfaces", "CutPlanes", "CutLines", "DeformedShape", "Vectors", "StreamLines", "Plot3D", "DeformedShapeAndScalarMap", "GaussPoints"]
+prs_list = []
+
+med_field = "vitesse"
+
+for name in prs_names:
+ print "Creation of ", name, " presentation..."
+ if name == "GaussPoints":
+ prs = GaussPointsOnField(med_reader, EntityType.CELL, "pression", 1)
+ pass
+ else:
+ prs = eval(name + "OnField(med_reader, EntityType.NODE, med_field, 1)")
+ if prs is None:
+ print "ERROR!!! ", name," presentation wasn't created..."
+ errors += 1
+ else:
+ RenameSource(name, prs.Input)
+ prs_list.append(prs)
+
+# 3. Dump Study
+path_to_save = os.path.join(os.getenv("HOME"), "AllPresentations.py")
+SaveTrace( path_to_save )
+
+# 4. Delete the created objects, recreate the view
+source_list = GetSources().values()
+for source in source_list:
+ Delete(source)
+
+Delete(GetActiveView())
+view = CreateRenderView()
+
+# 5. Execution of the created script
+execfile(path_to_save)
+
+# 6. Check the restored objects
+for name in prs_names:
+ source = FindSource(name)
+ if source is None:
+ print "There is no ", name, " in the study (must be created by executed python script)!!!"
+ errors += 1
+ else:
+ print name + " was found..."
+
+if errors > 0:
+ raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."
+
+
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/dump_study/B1 case
+
+from paravistest import tablesdir
+from presentations import *
+import paravis
+from pvsimple import *
+
+my_paravis = paravis.myParavis
+
+# Import table from file
+xls_file = tablesdir + "tables_test.xls"
+table_reader = TableReader(FileName=xls_file)
+if table_reader is None:
+ raise RuntimeError, "Table was not imported..."
+
+table_reader.UpdatePipeline()
+RenameSource("tables_test.xls", table_reader)
+
+# 2. Dump Study
+path_to_save = os.path.join(os.getenv("HOME"), "table.py")
+SaveTrace(path_to_save)
+
+# 3. Delete the created objects
+Delete(table_reader)
+
+# 4. Execution of the created script
+execfile(path_to_save)
+
+# 5. Check the restored table
+restored_obj = FindSource("tables_test.xls")
+if restored_obj is None:
+ raise RuntimeError, "There is no tables_test.xls table in the study (must be created by executed python script)!!!"
+
+available_tables = restored_obj.GetPropertyValue("AvailableTables")
+
+tables = ["Table:0", "Table toto 1", "sinus"]
+errors = 0
+count_not=0
+
+for name in tables:
+ if name not in available_tables:
+ count_not += 1
+ print "ERROR!!! Table with ", name, " name was not found"
+ errors += 1
+ else:
+ print "\"" + name + "\" table was found..."
+
+if count_not > 0:
+ print "ERROR!!! "+str(count_not)+" table(s) was(were) not found!!!"
+ errors += 1
+if errors > 0:
+ raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."
+
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/dump_study/B3 case
+
+import paravistest
+from presentations import *
+import paravis
+from pvsimple import *
+
+my_paravis = paravis.myParavis
+
+# 1. Table creation
+title = "My Table"
+errors = 0
+
+table_title = "My Table"
+
+# define script for table creation
+table_script = """
+import math
+
+
+# Get table output
+table = self.GetTableOutput()
+
+# Create first column
+col1 = vtk.vtkDoubleArray()
+col1.SetName('First Column')
+col1.InsertNextValue(1.11)
+col1.InsertNextValue(4.44)
+table.AddColumn(col1)
+
+# Create second column
+col2 = vtk.vtkDoubleArray()
+col2.SetName('Second Column')
+col2.InsertNextValue(2.22)
+col2.InsertNextValue(5.55)
+table.AddColumn(col2)
+
+# Create third column
+col3 = vtk.vtkDoubleArray()
+col3.SetName('Third Column')
+col3.InsertNextValue(3.33)
+col3.InsertNextValue(6.66)
+table.AddColumn(col3)
+"""
+
+# creating programmable source for the table
+table = ProgrammableSource()
+table.OutputDataSetType = 'vtkTable'
+table.Script = table_script
+RenameSource(title, table)
+table.UpdatePipeline()
+
+orig_script = table.Script
+
+# 2. Dump Study
+path_to_save = os.path.join(os.getenv("HOME"), "table.py")
+SaveTrace(path_to_save)
+
+# 3. Delete the table
+Delete(table)
+
+# 4. Execution of the created script
+execfile(path_to_save)
+
+# 5. Check the restored table
+table = FindSource(title)
+if table is None:
+ raise RuntimeError, "There is no table in the study (must be created by executed python script)!!!"
+
+if table.Script != orig_script:
+ print "ERROR!!! The script value is incorrect:"
+ print table.Script
+ errors += 1
+
+if errors > 0:
+ raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/dump_study/B4 case
+
+import paravistest
+from presentations import *
+import paravis
+from pvsimple import *
+
+my_paravis = paravis.myParavis
+
+# 1. Table creation
+title = "My Table"
+errors = 0
+
+table_title = "My Table"
+
+# define script for table creation
+table_script = """
+import math
+
+
+# Get table output
+table = self.GetTableOutput()
+
+# Create first column
+col1 = vtk.vtkIntArray()
+col1.SetName('First Column')
+col1.InsertNextValue(1)
+col1.InsertNextValue(4)
+table.AddColumn(col1)
+
+# Create second column
+col2 = vtk.vtkDoubleArray()
+col2.SetName('Second Column')
+col2.InsertNextValue(2)
+col2.InsertNextValue(5)
+table.AddColumn(col2)
+
+# Create third column
+col3 = vtk.vtkDoubleArray()
+col3.SetName('Third Column')
+col3.InsertNextValue(3)
+col3.InsertNextValue(6)
+table.AddColumn(col3)
+"""
+
+# creating programmable source for the table
+table = ProgrammableSource()
+table.OutputDataSetType = 'vtkTable'
+table.Script = table_script
+RenameSource(title, table)
+table.UpdatePipeline()
+
+orig_script = table.Script
+
+# 2. Dump Study
+path_to_save = os.path.join(os.getenv("HOME"), "table.py")
+SaveTrace(path_to_save)
+
+# 3. Delete the table
+Delete(table)
+
+# 4. Execution of the created script
+execfile(path_to_save)
+
+# 5. Check the restored table
+table = FindSource(title)
+if table is None:
+ raise RuntimeError, "There is no table in the study (must be created by executed python script)!!!"
+
+if table.Script != orig_script:
+ print "ERROR!!! The script value is incorrect:"
+ print table.Script
+ errors += 1
+
+if errors > 0:
+ raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/dump_study/B5 case
+
+import os
+import sys
+import salome
+
+class SalomeSession(object):
+ def __init__(self):
+ import runSalome
+ import sys
+ sys.argv += ["--show-desktop=1"]
+ sys.argv += ["--splash=0"]
+ sys.argv += ["--modules=MED,VISU,PARAVIS"]
+ clt, d = runSalome.main()
+ port = d['port']
+ self.port = port
+ return
+ pass
+
+
+# 1. Opening saved study
+
+# run Salome
+salome_session = SalomeSession()
+salome.salome_init()
+
+file_name = os.path.join(os.path.dirname(sys.argv[0]), "test1.hdf")
+opened_study = salome.myStudyManager.Open(file_name)
+salome.myStudy = opened_study
+
+# 2. Load PARAVIS module
+import paravis
+
+# 3. Find IsoSurfaces
+from pvsimple import *
+obj = FindSource('IsoSurfaces')
+if obj is None:
+ print "FAILED: can't find IsoSurfaces!!!"
+
+# 4. Remove med reader object and all other sources
+for obj in GetSources().values():
+ Delete(obj)
+
+# 5. Check results
+obj = FindSource('ScalarMap')
+if obj is not None:
+ print "FAILED: ScalarMap was not deleted!!!"
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+IF (PYTHON_EXECUTABLE)
+ FOREACH ( tfile
+ A0
+ A1
+ A2
+ A3
+ A4
+ A5
+ A6
+ A7
+ A8
+ A9
+ B0
+ B1
+ B3
+ B4
+ B5
+ )
+ SET(TIMEOUT 10000)
+ ADD_TEST(DUMPSTUDY_${tfile} ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/test/VisuPrs/Util/paravistesthelper.py ${TIMEOUT} ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py ${PARAVIS_TEST_OUTPUT_DIR})
+ SET_TESTS_PROPERTIES(DUMPSTUDY_${tfile} PROPERTIES FAIL_REGULAR_EXPRESSION "FAILED" TIMEOUT ${TIMEOUT})
+ ENDFOREACH( tfile )
+ENDIF (PYTHON_EXECUTABLE)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/imps/A1 case
+
+import sys
+import os
+from paravistest import datadir, pictureext, get_picture_dir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+picturedir = get_picture_dir(sys.argv[1], "imps/A1")
+
+
+def set_prs_colored(prs, proxy, entity, field_name, vector_mode, timestamp_nb):
+ # Get time value
+ time_value = get_time(proxy, timestamp_nb)
+
+ # Check vector mode
+ nb_components = get_nb_components(proxy, entity, field_name)
+ check_vector_mode(vector_mode, nb_components)
+
+ # Get lookup table
+ lookup_table = get_lookup_table(field_name, nb_components, vector_mode)
+
+ # Set field range
+ data_range = get_data_range(proxy, entity,
+ field_name, vector_mode)
+ lookup_table.LockScalarRange = 1
+ lookup_table.RGBPoints = [data_range[0], 0, 0, 1, data_range[1], 1, 0, 0]
+
+ # Set properties
+ prs.ColorAttributeType = EntityType.get_pvtype(entity)
+ prs.ColorArrayName = field_name
+ prs.LookupTable = lookup_table
+
+ # Add scalar bar
+ add_scalar_bar(field_name, nb_components,
+ vector_mode, lookup_table, time_value)
+
+
+# 1. Import of the "Penta6.med" file
+print 'Import "Penta6.med" file........',
+file_path = datadir + "Penta6.med"
+my_paravis.ImportFile(file_path)
+med_reader = pvsimple.GetActiveSource()
+if med_reader is None:
+ raise RuntimeError, "Penta6.med was not imported!!!"
+else:
+ print "OK"
+
+view = pvsimple.GetRenderView()
+
+# 2. Creation of "CutPlanes" presentation, based on time stamp of "scalar field" field
+print 'Creation of "CutPlanes" presentation, based on time stamp of "scalar field" field....'
+cutplanes = CutPlanesOnField(med_reader, EntityType.CELL, "scalar_field", 1)
+if cutplanes is None :
+ raise RuntimeError, "Presentation is None!!!"
+else:
+ print "OK"
+
+print "Setting of deformation:"
+warp_vector = pvsimple.WarpByVector(cutplanes.Input)
+warp_vector.Vectors = ["vectoriel_field"]
+warp_vector.ScaleFactor = 5.0
+
+print "Got scale : ", warp_vector.ScaleFactor
+print "Got field name: ", warp_vector.Vectors
+
+presentation = pvsimple.GetRepresentation(warp_vector)
+set_prs_colored(presentation, med_reader, EntityType.CELL, "scalar_field", 'Magnitude', 1)
+
+pic_path = os.path.join(picturedir, "deformed_cut_planes_scalar" + "." + pictureext)
+process_prs_for_test(presentation, view, pic_path)
+
+# 3. Creation of "CutPlanes" presentation, based on time stamp of "vectoriel field" field
+print 'Creation of "CutPlanes" presentation, based on time stamp of "vectoriel field" field....'
+cutplanes = CutPlanesOnField(med_reader, EntityType.CELL, "vectoriel_field", 1)
+
+if cutplanes is None :
+ raise RuntimeError, "Presentation is None!!!"
+else:
+ print "OK"
+
+print "Setting of deformation:"
+warp_vector = pvsimple.WarpByVector(cutplanes.Input)
+warp_vector.Vectors = ["vectoriel_field"]
+warp_vector.ScaleFactor = 5.0
+
+print "Got scale : ", warp_vector.ScaleFactor
+print "Got field name: ", warp_vector.Vectors
+
+presentation = pvsimple.GetRepresentation(warp_vector)
+set_prs_colored(presentation, med_reader, EntityType.CELL, "vectoriel_field", 'Magnitude', 1)
+
+pic_path = os.path.join(picturedir, "deformed_cut_planes_vectorial" + "." + pictureext)
+process_prs_for_test(presentation, view, pic_path)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/imps/A2 case
+
+import time
+from paravistest import datadir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+sleep_delay = 2
+
+med_file = "pointe.med"
+entity = EntityType.NODE
+field_name = "fieldnodedouble";
+timestamp = 1
+
+# 1. Import MED file
+print 'Import "pointe.med"....................',
+med_file_path = datadir + med_file
+my_paravis.ImportFile(med_file_path)
+med_reader = pvsimple.GetActiveSource()
+
+if med_reader is None:
+ print "FAILED"
+else:
+ print "OK"
+
+# 2. Create Scalar Map
+print "Build Scalar Map presentation"
+scalar_map = ScalarMapOnField(med_reader, entity, field_name, timestamp)
+
+display_only(scalar_map)
+reset_view()
+time.sleep(sleep_delay)
+
+# 3. Set representation type to Point
+print "Set representation type to Point"
+scalar_map.Representation = 'Points'
+pvsimple.Render()
+time.sleep(sleep_delay)
+
+# 4. Set representation type to Point Sprite
+print "Set Point Sprite representation"
+scalar_map.Representation = 'Point Sprite'
+
+data_range = get_data_range(med_reader, entity,
+ field_name, 'Magnitude')
+mult = abs(0.1 / data_range[1])
+scalar_map.RadiusScalarRange = data_range
+scalar_map.RadiusTransferFunctionEnabled = 1
+scalar_map.RadiusMode = 'Scalar'
+scalar_map.RadiusArray = ['POINTS', field_name]
+scalar_map.RadiusTransferFunctionMode = 'Table'
+scalar_map.RadiusScalarRange = data_range
+scalar_map.RadiusUseScalarRange = 1
+scalar_map.RadiusIsProportional = 1
+scalar_map.RadiusProportionalFactor = mult
+
+pvsimple.Render()
+
+
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/imps/A3 case
+
+from paravistest import datadir, compare_lists
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+error =0
+
+# Import MED file
+file_path = datadir + "fra.med"
+my_paravis.ImportFile(file_path)
+med_reader = pvsimple.GetActiveSource()
+
+if med_reader is None:
+ print "Error!!! med file is not imported"
+ error = error+1
+
+# Create Scalar Map
+scalarmap = ScalarMapOnField(med_reader, EntityType.NODE, 'TAUX_DE_VIDE', 1);
+if scalarmap is None:
+ print "Error!!! ScalarMap is not created"
+ error = error+1
+display_only(scalarmap)
+
+# Check Scalar bar default properties
+bar = get_bar()
+if bar.Orientation != 'Vertical':
+ print "Error!!! Default Scalar Bar Orientation is wrong - not vertical but ", scalarmap.Orientation
+ error = error+1
+
+error = error + compare_lists(bar.Position, [0.87, 0.25])
+error = error + compare_lists(bar.Position2, [0.13, 0.5])
+
+if error > 0:
+ raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/imps/A4 case
+
+from paravistest import datadir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+error = 0
+
+# Import MED file
+med_file_path = datadir + "fra.med"
+my_paravis.ImportFile(med_file_path)
+med_reader = pvsimple.GetActiveSource()
+
+if med_reader is None:
+ print "Error!!! med file is not imported"
+ error = error+1
+
+# Create Mesh
+mesh_name = 'LE_VOLUME'
+cell_entity = EntityType.CELL
+mesh = MeshOnEntity(med_reader, mesh_name, cell_entity)
+if mesh is None:
+ print "Error!!! Mesh is not created"
+ error = error+1
+
+mesh.Visibility = 1
+reset_view()
+
+# Use shrink filter
+mesh_shrinked = pvsimple.Shrink(med_reader)
+mesh_shrinked.ShrinkFactor = 0.75
+mesh_shrinked = pvsimple.GetRepresentation(mesh_shrinked)
+
+if mesh_shrinked is None:
+ print "Error!!! Mesh is not shrinked"
+ error = error+1
+
+# Create Scalar Map
+scalarmap = ScalarMapOnField(med_reader, EntityType.NODE, 'TAUX_DE_VIDE', 1);
+if scalarmap is None:
+ print "Error!!! ScalarMap is not created"
+ error = error+1
+display_only(scalarmap)
+
+if error > 0:
+ raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/imps/A6 case
+
+from paravistest import datadir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+error =0
+
+# Import MED file
+file_path = datadir + "Bug891_Box.resu.med"
+my_paravis.ImportFile(file_path)
+med_reader = pvsimple.GetActiveSource()
+
+if med_reader is None:
+ print "Error!!! med file is not imported"
+ error = error+1
+
+# Create Scalar Map
+scalarmap = ScalarMapOnField(med_reader, EntityType.NODE, 'RESUMECAEQUI_ELGA_SIGM', 1)
+if scalarmap is None:
+ print "Error!!! ScalarMap is not created"
+ error = error+1
+
+scalarmap.Visibility = 1
+reset_view()
+
+if error > 0:
+ raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."
+
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/imps/A9 case
+
+from time import sleep
+
+from paravistest import tablesdir
+from presentations import *
+import paravis
+import pvsimple
+
+# Import CSV table
+file_path = tablesdir + "testCsvTable.csv"
+table = pvsimple.CSVReader(FileName=file_path)
+
+# Show
+view = pvsimple.CreateXYPlotView()
+
+xy_rep = pvsimple.Show(table)
+xy_rep.AttributeType = 'Row Data'
+xy_rep.UseIndexForXAxis = 0
+xy_rep.XArrayName = 'x'
+xy_rep.SeriesVisibility = ['x', '0']
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/imps/B1 case
+
+from paravistest import datadir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+
+# Import MED file
+file_path = datadir + "fra.med"
+my_paravis.ImportFile(file_path)
+med_reader = pvsimple.GetActiveSource()
+
+entity = EntityType.NODE
+field_name = "VITESSE"
+timestamp_id = 1
+
+# Create Scalar Map
+scalarmap = ScalarMapOnField(med_reader, entity, field_name, timestamp_id)
+
+scalarmap.Visibility = 1
+reset_view()
+
+# Set representation type to Point Sprite
+scalarmap.Representation = 'Point Sprite'
+
+# Set texture
+scalarmap.RenderMode = 'Texture'
+scalarmap.Texture = [os.path.join(datadir, "Textures", "texture1.dat")]
+
+pvsimple.Render()
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/imps/B2 case
+
+from paravistest import datadir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+
+# 1. Import MED file
+print 'Import "ResOK_0000.med"...............',
+
+file_path = datadir + "ResOK_0000.med"
+my_paravis.ImportFile(file_path)
+med_reader = pvsimple.GetActiveSource()
+
+if med_reader is None:
+ raise RuntimeError, "import failed"
+else:
+ print "OK"
+
+# 2. Get some information on the MED file
+fields_on_nodes = med_reader.PointArrays
+print "Field names on NODE: ", fields_on_nodes
+is_ok = len(fields_on_nodes) == 2 and ("temperature" in fields_on_nodes) and ("vitesse" in fields_on_nodes)
+if not is_ok:
+ raise RuntimeError, "=> Error in PointArrays property"
+
+fields_on_cells = med_reader.CellArrays
+print "Field names on CELL: ", fields_on_cells
+is_ok = len(fields_on_cells) == 1 and ("pression" in fields_on_cells)
+if not is_ok:
+ raise RuntimeError, "=> Error in CellArrays property"
+
+timestamps = med_reader.TimestepValues.GetData()
+print "timestamps: ", timestamps
+if timestamps != [17.030882013694594]:
+ raise RuntimeError, "=> Wrong TimestepValues property value"
+
+
+
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+IF (PYTHON_EXECUTABLE)
+ FOREACH ( tfile
+ A1
+ A2
+ A3
+ A4
+ A6
+ A9
+ B1
+ B2
+ )
+ SET(TIMEOUT 10000)
+ ADD_TEST(IMPS_${tfile} ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/test/VisuPrs/Util/paravistesthelper.py ${TIMEOUT} ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py ${PARAVIS_TEST_OUTPUT_DIR})
+ SET_TESTS_PROPERTIES(IMPS_${tfile} PROPERTIES FAIL_REGULAR_EXPRESSION "FAILED" TIMEOUT ${TIMEOUT})
+ ENDFOREACH( tfile )
+ENDIF (PYTHON_EXECUTABLE)
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/united/A1 case
+
+from paravistest import datadir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+
+# 1. Import MED file
+print "**** Step1: Import MED file"
+
+print 'Import "ResOK_0000.med"...',
+file_path = datadir + "ResOK_0000.med"
+my_paravis.ImportFile(file_path)
+med_reader = pvsimple.GetActiveSource()
+
+if med_reader is None:
+ print "FAILED"
+else:
+ print "OK"
+
+print 'Get view...................',
+view = pvsimple.GetRenderView()
+if view is None:
+ print "FAILED"
+else:
+ reset_view(view)
+ print "OK"
+
+cell_entity = EntityType.CELL
+node_entity = EntityType.NODE
+
+# 2. Displaying vector field
+print "**** Step2: Displaying vector field"
+
+print "Creating Scalar Map.......",
+scalarmap = ScalarMapOnField(med_reader, node_entity, 'vitesse', 1)
+if scalarmap is None:
+ print "FAILED"
+else:
+ bar = get_bar()
+ bar.Orientation = 'Horizontal'
+ bar.Position = [0.1, 0.1]
+ bar.Position2 = [0.1, 0.25]
+ bar.AspectRatio = 3
+
+ display_only(scalarmap, view)
+ print "OK"
+
+reset_view(view)
+
+print "Creating Stream Lines.....",
+streamlines = StreamLinesOnField(med_reader, node_entity, 'vitesse', 1)
+if streamlines is None:
+ print "FAILED"
+else:
+ display_only(streamlines, view)
+ print "OK"
+
+print "Creating Vectors..........",
+vectors = VectorsOnField(med_reader, node_entity, 'vitesse', 1)
+if vectors is None:
+ print "FAILED"
+else:
+ display_only(vectors, view)
+ print "OK"
+
+print "Creating Iso Surfaces.....",
+isosurfaces = IsoSurfacesOnField(med_reader, node_entity, 'vitesse', 1)
+contour_filter = pvsimple.GetActiveSource()
+if isosurfaces is None:
+ print "FAILED"
+else:
+ display_only(isosurfaces, view)
+ print "OK"
+
+print "Creating Cut Planes.......",
+cutplanes = CutPlanesOnField(med_reader, node_entity, 'vitesse', 1,
+ nb_planes=30, orientation=Orientation.YZ)
+if cutplanes is None:
+ print "FAILED"
+else:
+ display_only(cutplanes, view)
+ print "OK"
+
+# 3. Another MED file import
+print "**** Step3: Import another MED file"
+
+print 'Import "Fields_group3D.med"...............',
+file_path = datadir + "Fields_group3D.med"
+my_paravis.ImportFile(file_path)
+med_reader1 = pvsimple.GetActiveSource()
+
+if med_reader1 is None:
+ print "FAILED"
+else:
+ print "OK"
+
+# 4. Displaying scalar field
+print "**** Step4: Displaying scalar field"
+
+print "Creating Scalar Map.......",
+scalarmap1 = ScalarMapOnField(med_reader1, cell_entity, 'scalar_field', 1)
+if scalarmap1 is None:
+ print "FAILED"
+else:
+ display_only(scalarmap1, view)
+ print "OK"
+
+reset_view(view)
+
+print "Creating Iso Surfaces.....",
+isosurfaces1 = IsoSurfacesOnField(med_reader1, cell_entity, 'scalar_field', 1)
+if isosurfaces1 is None:
+ print "FAILED"
+else:
+ display_only(isosurfaces1, view)
+ print "OK"
+
+print "Creating Cut Planes.......",
+cutplanes1 = CutPlanesOnField(med_reader1, cell_entity, 'scalar_field', 1,
+ orientation=Orientation.YZ)
+if cutplanes1 is None:
+ print "FAILED"
+else:
+ slice_filter = pvsimple.GetActiveSource()
+ slice_filter.SliceType.Normal = [1.0, 0.0, 0.0]
+ display_only(cutplanes1, view)
+ print "OK"
+
+# 5. Object browser popup
+
+print "**** Step5: Object browser popup"
+
+mesh_name = 'mailles_MED'
+
+print "Creating mesh.............",
+mesh = MeshOnEntity(med_reader1, mesh_name, cell_entity)
+if mesh is None:
+ print "FAILED"
+else:
+ display_only(mesh, view)
+ print "OK"
+
+print "Changing type of presentation of mesh:"
+mesh.Representation = 'Wireframe'
+pvsimple.Render()
+prs_type = mesh.Representation
+print "Presentation type..", prs_type
+
+mesh.Representation = 'Points'
+pvsimple.Render()
+prs_type = mesh.Representation
+print "Presentation type..", prs_type
+
+mesh.Representation = 'Surface'
+pvsimple.Render()
+prs_type = mesh.Representation
+print "Presentation type..", prs_type
+
+shrink = pvsimple.Shrink(med_reader1)
+mesh_shrinked = pvsimple.GetRepresentation(shrink)
+display_only(mesh_shrinked, view)
+
+print "Changing color of mesh....",
+color = [0, 0, 1]
+mesh.DiffuseColor = color
+display_only(mesh, view)
+print "OK"
+
+print "Changing first IsoSurfaces",
+display_only(isosurfaces, view)
+reset_view(view)
+rgb_points = isosurfaces.LookupTable.RGBPoints
+scalar_range = [rgb_points[0], rgb_points[4]]
+surfaces = get_contours(scalar_range, 25)
+contour_filter.Isosurfaces = surfaces
+pvsimple.Render(view=view)
+print "OK"
+
+print "Hide IsoSurfaces..........",
+isosurfaces.Visibility = 0
+pvsimple.Render(view=view)
+print "OK"
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/united/A2 case
+
+from paravistest import datadir
+from presentations import *
+import paravis
+import pvsimple
+from math import radians
+
+my_paravis = paravis.myParavis
+
+cell_entity = EntityType.CELL
+node_entity = EntityType.NODE
+
+# 1. Import MED file
+print "**** Step1: Import MED file"
+
+print 'Import "fra.med"....................',
+file_path = datadir + "fra.med"
+my_paravis.ImportFile(file_path)
+med_reader = pvsimple.GetActiveSource()
+
+if med_reader is None:
+ print "FAILED"
+else:
+ print "OK"
+
+view = pvsimple.GetRenderView()
+
+field_name = 'VITESSE'
+print "Creating Cut Planes.................",
+orient = Orientation.YZ
+cutplanes = CutPlanesOnField(med_reader, node_entity, field_name, 1, orientation=orient)
+if cutplanes is None:
+ print "FAILED"
+else:
+ display_only(cutplanes, view)
+ print "OK"
+
+slice_filter = pvsimple.GetActiveSource()
+
+# 2. Changing view
+print "**** Step2: Changing view"
+
+print "Fit All.............................",
+reset_view(view)
+print "OK"
+
+print "Rotate..............................",
+x_angle = 0
+y_angle = 0
+
+nb_planes = len(slice_filter.SliceOffsetValues)
+
+for i in xrange(1, 50):
+ y_angle = y_angle + 0.05
+ normal = get_normal_by_orientation(orient, x_angle, radians(y_angle))
+ slice_filter.SliceType.Normal = normal
+ pvsimple.Render()
+
+for i in xrange(1,50):
+ y_angle = y_angle - 0.05
+ normal = get_normal_by_orientation(orient, x_angle, radians(y_angle))
+ slice_filter.SliceType.Normal = normal
+ pvsimple.Render()
+
+print "OK"
+
+print "View Point (FRONT)..................",
+view.CameraViewUp = [0.0, 0.0, 1.0]
+view.CameraPosition = [2.4453961849843453, 0.03425, 0.541]
+pvsimple.Render()
+print "OK"
+
+print "View Point (BACK)...................",
+view.CameraPosition = [-2.0343961849843457, 0.03425, 0.541]
+pvsimple.Render()
+print "OK"
+
+print "View Point (TOP)....................",
+view.CameraViewUp = [0.0, 1.0, 0.0]
+view.CameraPosition = [0.2055, 0.03425, 2.7808961849843454]
+pvsimple.Render()
+print "OK"
+
+print "View Point (BOTTOM).................",
+view.CameraPosition = [0.2055, 0.03425, -1.6988961849843456]
+pvsimple.Render()
+print "OK"
+
+print "View Point (LEFT)...................",
+view.CameraViewUp = [0.0, 0.0, 1.0]
+view.CameraPosition = [0.2055, -2.2056461849843454, 0.541]
+pvsimple.Render()
+print "OK"
+
+print "View Point (RIGHT) .................",
+view.CameraPosition = [0.2055, 2.2741461849843456, 0.541]
+pvsimple.Render()
+print "OK"
+
+print "Restore View........................",
+reset_view(view)
+print "OK"
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/united/A4 case
+
+from paravistest import datadir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+
+cell_entity = EntityType.CELL
+node_entity = EntityType.NODE
+
+# 1. Import MED file
+print "**** Step1: Import MED file"
+
+print 'Import "Hexa8.med"....................',
+file_path = datadir + "Hexa8.med"
+my_paravis.ImportFile(file_path)
+med_reader1 = pvsimple.GetActiveSource()
+
+if med_reader1 is None:
+ print "FAILED"
+else:
+ print "OK"
+
+mesh_name1 = 'Maillage_MED_HEXA8'
+scalar_field = 'scalar_field'
+vectoriel_field = 'vectoriel_field'
+view = pvsimple.GetRenderView()
+
+print "Creating Scalar Map...................",
+scalarmap1 = ScalarMapOnField(med_reader1, cell_entity, scalar_field, 1)
+if scalarmap1 is None:
+ print "FAILED"
+else:
+ display_only(scalarmap1, view)
+ reset_view(view)
+ print "OK"
+
+print "Creating Vectors......................",
+vectors1 = VectorsOnField(med_reader1, cell_entity, vectoriel_field, 1)
+if vectors1 is None:
+ print "FAILED"
+else:
+ print "OK"
+
+print "Creating Deformed Shape...............",
+defshape1 = DeformedShapeOnField(med_reader1, cell_entity, vectoriel_field, 1)
+if defshape1 is None:
+ print "FAILED"
+else:
+ print "OK"
+
+print "Creating mesh.........................",
+mesh1 = MeshOnEntity(med_reader1, mesh_name1, cell_entity)
+if mesh1 is None:
+ print "FAILED"
+else:
+ mesh1.Representation = 'Wireframe'
+ display_only(mesh1, view)
+ reset_view(view)
+ print "OK"
+
+print "Displaying vectors....................",
+display_only(vectors1, view)
+print "OK"
+
+print "Displaying Deformed Shape.............",
+display_only(defshape1, view)
+print "OK"
+
+print "Set scale factor of Deformed Shape...",
+warp_vector = defshape1.Input
+warp_vector.ScaleFactor = 10
+print "OK"
+
+print "Displaying changed Deformed Shape.....",
+display_only(defshape1, view)
+print "OK"
+
+print "Editing Vectors.......................",
+glyph = vectors1.Input
+glyph.SetScaleFactor = 2
+vectors1.LineWidth = 2
+glyph.GlyphType.Center = [0.5, 0.0, 0.0] # TAIL position
+print "OK"
+
+print "Displaying changed Vectors............",
+vectors1.Visibility = 1
+pvsimple.Render()
+print "OK"
+
+hide_all(view)
+
+# 2. Second MED file import
+
+print 'Importing file "cube_hexa8_quad4.med".',
+file_path = datadir + "cube_hexa8_quad4.med"
+mesh_name2 = 'CUBE_EN_HEXA8_QUAD4'
+my_paravis.ImportFile(file_path)
+med_reader2 = pvsimple.GetActiveSource()
+
+if med_reader2 is None:
+ print "FAILED"
+else:
+ print "OK"
+
+print "Creating mesh.........................",
+mesh2 = MeshOnEntity(med_reader2, mesh_name2, cell_entity)
+if mesh2 is None:
+ print "FAILED"
+else:
+ display_only(mesh2, view)
+ print "OK"
+
+print "Setting wireframe repr. of mesh.......",
+mesh2.Representation = 'Wireframe'
+print "OK"
+
+print "Creating Vectors......................",
+vectors2 = VectorsOnField(med_reader2, cell_entity, "fieldcelldouble", 1)
+if vectors1 is None:
+ print "FAILED"
+else:
+ glyph2 = vectors2.Input
+ glyph2.SetScaleFactor = 0.2
+ vectors2.LineWidth = 2
+ glyph2.GlyphType.Center = [0.5, 0.0, 0.0] # TAIL position
+ print "OK"
+
+
+
+print "Displaying Vectors (with mesh)........",
+vectors2.Visibility = 1
+pvsimple.Render()
+print "OK"
+
+hide_all(view)
+
+# 3. Third MED file import
+
+print 'Importing file "Penta6.med"...........',
+file_path = datadir + "Penta6.med"
+my_paravis.ImportFile(file_path)
+med_reader3 = pvsimple.GetActiveSource()
+
+if med_reader3 is None:
+ print "FAILED"
+else:
+ print "OK"
+
+print "Creating Cut Planes...................",
+cutplanes1 = CutPlanesOnField(med_reader3, cell_entity, scalar_field, 1)
+if cutplanes1 is None:
+ print "FAILED"
+else:
+ display_only(cutplanes1, view)
+ reset_view(view)
+ print "OK"
+
+print "Creating Deformed Shape...............",
+defshape2 = DeformedShapeOnField(med_reader3, cell_entity, vectoriel_field, 1)
+if defshape2 is None:
+ print "FAILED"
+else:
+ print "OK"
+
+print "Creating Vectors......................",
+vectors3 = VectorsOnField(med_reader3, cell_entity, vectoriel_field, 1)
+if vectors3 is None:
+ print "FAILED"
+else:
+ print "OK"
+
+print "Creating Iso Surfaces.....",
+isosurfaces1 = IsoSurfacesOnField(med_reader3, cell_entity, vectoriel_field, 1)
+if isosurfaces1 is None:
+ print "FAILED"
+else:
+ print "OK"
+
+print "Displaying Vectors (l.w.=2, s.f.=1.5).",
+glyph3 = vectors3.Input
+glyph3.SetScaleFactor = 1.5
+vectors3.LineWidth = 2
+display_only(vectors3, view)
+print "OK"
+
+print "Displaying Deformed Shape.............",
+defshape2.Visibility = 1
+pvsimple.Render()
+print "OK"
+
+print "Displaying Iso Surfaces...............",
+isosurfaces1.Visibility = 1
+pvsimple.Render()
+print "OK"
+
+hide_all(view)
+
+# 4. Import Quad4,Tetra4 and Tria3 MED files
+
+print 'Importing "Quad4.med".................',
+file_path = datadir + "Quad4.med"
+my_paravis.ImportFile(file_path)
+med_reader4 = pvsimple.GetActiveSource()
+
+if med_reader4 is None:
+ print "FAILED"
+else:
+ print "OK"
+
+mesh_name4 = 'Maillage MED_QUAD4'
+
+print "Creating Iso Surfaces.................",
+isosurfaces2 = IsoSurfacesOnField(med_reader4, cell_entity, scalar_field, 1)
+if isosurfaces2 is None:
+ print "FAILED"
+else:
+ print "OK"
+
+print "Creating Cut Planes...................",
+cutplanes2 = CutPlanesOnField(med_reader4, cell_entity, scalar_field, 1,
+ orientation=Orientation.YZ)
+if cutplanes2 is None:
+ print "FAILED"
+else:
+ print "OK"
+
+print "Creating Deformed Shape...............",
+defshape3 = DeformedShapeOnField(med_reader4, cell_entity, vectoriel_field, 1, scale_factor=10)
+if defshape3 is None:
+ print "FAILED"
+else:
+ print "OK"
+
+print "Creating Vectors......................",
+vectors4 = VectorsOnField(med_reader4, cell_entity, vectoriel_field, 1)
+if vectors4 is None:
+ print "FAILED"
+else:
+ print "OK"
+
+print "Displaying Iso Surfaces, Def. Shape and Vectors.",
+display_only(isosurfaces2, view)
+defshape3.Visibility = 1
+vectors4.Visibility = 1
+pvsimple.Render()
+print "OK"
+
+print 'Importing "Tetra4.med"................',
+file_path = datadir + "Tetra4.med"
+my_paravis.ImportFile(file_path)
+med_reader5 = pvsimple.GetActiveSource()
+
+if med_reader5 is None:
+ print "FAILED"
+else:
+ print "OK"
+
+mesh_name5 = 'Maillage MED_TETRA4'
+
+print "Creating Scalar Map...................",
+scalarmap2 = ScalarMapOnField(med_reader5, cell_entity, scalar_field, 1)
+if scalarmap2 is None:
+ print "FAILED"
+else:
+ print "OK"
+
+print "Creating Vectors......................",
+vectors5 = VectorsOnField(med_reader5, cell_entity, vectoriel_field, 1)
+if vectors5 is None:
+ print "FAILED"
+else:
+ print "OK"
+
+vectors5.LineWidth = 3
+vectors5.Input.SetScaleFactor = 2
+
+print "Displaying Scalar Map and Vectoes.....",
+hide_all(view)
+display_only(scalarmap2, view)
+vectors5.Visibility = 1
+reset_view(view)
+print "OK"
+
+print 'Importing "Tria3.med".................',
+file_path = datadir + "Tria3.med"
+my_paravis.ImportFile(file_path)
+med_reader6 = pvsimple.GetActiveSource()
+
+if med_reader6 is None:
+ print "FAILED"
+else:
+ print "OK"
+
+mesh_name6 = 'Maillage MED_TRIA3'
+
+print "Creating Scalar Map...................",
+scalarmap3 = ScalarMapOnField(med_reader6, cell_entity, scalar_field, 1)
+if scalarmap3 is None:
+ print "FAILED"
+else:
+ display_only(scalarmap3, view)
+ print "OK"
+
+reset_view(view)
+
+print "Creating Iso Surfaces.................",
+isosurfaces3 = IsoSurfacesOnField(med_reader6, cell_entity, scalar_field, 1)
+if isosurfaces3 is None:
+ print "FAILED"
+else:
+ display_only(isosurfaces3, view)
+ print "OK"
+
+reset_view(view)
+
+print "Creating Deformed Shape...............",
+defshape4 = DeformedShapeOnField(med_reader6, cell_entity, vectoriel_field, 1)
+if defshape4 is None:
+ print "FAILED"
+else:
+ display_only(defshape4, view)
+ print "OK"
+
+reset_view(view)
+
+print "Creating Vectors......................",
+vectors6 = VectorsOnField(med_reader6, cell_entity, vectoriel_field, 1)
+if vectors6 is None:
+ print "FAILED"
+else:
+ glyph = vectors6.Input
+ glyph.GlyphType.Center = [0.5, 0.0, 0.0] # TAIL position
+ vectors6.LineWidth = 2
+ glyph.SetScaleFactor = 1
+ display_only(vectors6, view)
+ print "OK"
+
+reset_view(view)
+
+print "Displaying only Def. Shape and Vectors",
+display_only(defshape4, view)
+vectors6.Visibility = 1
+pvsimple.Render()
+print "OK"
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/united/A5 case
+
+from paravistest import datadir
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+
+cell_entity = EntityType.CELL
+node_entity = EntityType.NODE
+
+# 1. Import MED file
+print "**** Step1: Import MED file"
+
+print 'Import "ResOK_0000.med"...............',
+file_path = datadir + "ResOK_0000.med"
+my_paravis.ImportFile(file_path)
+med_reader = pvsimple.GetActiveSource()
+
+if med_reader is None:
+ print "FAILED"
+else:
+ print "OK"
+
+mesh_name = 'dom'
+
+# 2. Creating mesh
+print "**** Step2: Mesh creation"
+
+print "Creating mesh.............",
+mesh = MeshOnEntity(med_reader, mesh_name, cell_entity)
+if mesh is None:
+ print "FAILED"
+else:
+ print "OK"
+
+# 3. Changing type of presentation of mesh
+print "**** Step3: Changing type of presentation of mesh"
+
+view = pvsimple.GetRenderView()
+display_only(mesh, view)
+reset_view(view)
+
+mesh.Representation = 'Wireframe'
+pvsimple.Render()
+prs_type = mesh.Representation
+print "Presentation type..", prs_type
+
+mesh.Representation = 'Points'
+pvsimple.Render()
+prs_type = mesh.Representation
+print "Presentation type..", prs_type
+
+# make shrink, in PARAVIS it's not a representation type: use shrink filter
+shrink = pvsimple.Shrink(med_reader)
+mesh_shrinked = pvsimple.GetRepresentation(shrink)
+display_only(mesh_shrinked, view)
+
+display_only(mesh, view)
+mesh.Representation = 'Surface With Edges'
+pvsimple.Render()
+prs_type = mesh.Representation
+print "Presentation type..", prs_type
+
+# 4. Changing Cell color of mesh
+print "**** Step4: Changing Cell color of mesh"
+
+color = mesh.DiffuseColor
+print "Mesh Cell color in RGB....(", color[0], ",", color[1], ",", color[2], ")"
+
+color = [0, 0, 1]
+mesh.DiffuseColor = color
+color = mesh.DiffuseColor
+print "Mesh Cell color in RGB....(", color[0], ",", color[1], ",", color[2], ")"
+pvsimple.Render()
+
+# 5. Changing Node color of mesh
+print "**** Step4: Changing Node color of mesh"
+
+color = mesh.AmbientColor
+print "Mesh Node color in RGB....(", color[0], ",", color[1], ",", color[2], ")"
+
+color = [0, 1, 0]
+mesh.AmbientColor = color
+color = mesh.AmbientColor
+print "Mesh Node color in RGB....(", color[0], ",", color[1], ",", color[2], ")"
+pvsimple.Render()
+
+## Note: no special property for edge color in PARAVIS; skip link color changing ( SetLinkColor()/GetLinkColor() methods )
+
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+# This case corresponds to: /visu/united1/B0 case
+
+from paravistest import datadir, compare_lists
+from presentations import *
+import paravis
+import pvsimple
+
+my_paravis = paravis.myParavis
+
+error=0
+
+# 1. Import MED file
+file_path = datadir + "TimeStamps.med"
+my_paravis.ImportFile(file_path)
+med_reader = pvsimple.GetActiveSource()
+
+if med_reader is None:
+ print "FAILED"
+else:
+ print "OK"
+
+# 2. Create scalar map on deformed shape
+smondefshape = DeformedShapeAndScalarMapOnField(med_reader, EntityType.NODE, 'vitesse', 1)
+if smondefshape is None:
+ print "FAILED"
+else:
+ print "OK"
+
+# 3. Make compare
+
+# Offset
+smondefshape.Position = [0, 0, 0]
+error = error + compare_lists(smondefshape.Position, [0,0,0])
+
+# Scalar mode
+smondefshape.LookupTable.VectorMode = 'Magnitude'
+if smondefshape.LookupTable.VectorMode != 'Magnitude':
+ print "ScalarMode is wrong..."
+ error=error+1
+
+# Scalar bar Position
+bar = get_bar()
+bar.Position = [0.01, 0.01]
+error = error + compare_lists(bar.Position, [0.01, 0.01])
+
+# Scalar bar size
+bar.Position2 = [0.05, 0.5]
+error = error + compare_lists(bar.Position2, [0.05, 0.5])
+
+# Number of colors and labels
+smondefshape.LookupTable.NumberOfTableValues = 4
+bar.NumberOfLabels = 5
+
+nb_colors = smondefshape.LookupTable.NumberOfTableValues
+nb_labels = bar.NumberOfLabels
+error = error + compare_lists([nb_colors, nb_labels], [4, 5])
+
+# Title
+bar.Title = 'Pression, Pa'
+bar.ComponentTitle = "Comp."
+
+if bar.Title != 'Pression, Pa':
+ print "Title is wrong..."
+ error=error+1
+
+if bar.ComponentTitle!= 'Comp.':
+ print "Component title is wrong..."
+ error=error+1
+
+# Scaling
+smondefshape.LookupTable.UseLogScale = 0
+if smondefshape.LookupTable.UseLogScale != 0:
+ print "Error!!! Scaling is wrong"
+ error=error+1
+
+# Bar orientation
+bar.Orientation = 'Horizontal'
+if bar.Orientation != 'Horizontal':
+ print "ERROR!!! Scalar Bar orientation is wrong..."
+ error=error+1
+
+# Scale factor
+smondefshape.Input.ScaleFactor = 0.15
+error = error + compare_lists([smondefshape.Input.ScaleFactor], [0.15])
+
+
+if error > 0:
+ raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."
--- /dev/null
+# Copyright (C) 2010-2013 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.
+#
+# 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
+#
+
+IF (PYTHON_EXECUTABLE)
+ FOREACH ( tfile
+ A1
+ A2
+ A4
+ A5
+ B0
+ )
+ SET(TIMEOUT 10000)
+ ADD_TEST(UNITED_${tfile} ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/test/VisuPrs/Util/paravistesthelper.py ${TIMEOUT} ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py ${PARAVIS_TEST_OUTPUT_DIR})
+ SET_TESTS_PROPERTIES(UNITED_${tfile} PROPERTIES FAIL_REGULAR_EXPRESSION "FAILED" TIMEOUT ${TIMEOUT})
+ ENDFOREACH( tfile )
+ENDIF (PYTHON_EXECUTABLE)