# ============
OPTION(SALOME_BUILD_DOC "Generate SALOME GUI documentation" ON)
OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON)
-OPTION(SALOME_PARAVIS_ALL_TEST "Add all tests for Salome PARAVIS module" OFF)
+OPTION(SALOME_PARAVIS_ALL_TEST "Add all tests for Salome PARAVIS module" ON)
OPTION(SALOME_PARAVIS_BUILD_PLUGINS "Build PARAVIS plugins (MEDReader, etc ...)" ON)
OPTION(SALOME_PARAVIS_BUILD_CORBA_PLUGINS "Build PARAVIS CORBA plugins (ParaMEDCorba -- this requires the SALOME MED module)" ON)
OPTION(SALOME_PARAVIS_USE_GEOM_SOURCE "Import a GEOMETRY object to PARAVIS via its Corba IOR" OFF)
group_name = full_group_name.split('/')[1]
return group_name
-
def get_group_entity(full_group_name):
"""Return entity type of the group by its full name."""
aList = full_group_name.split('/')
stream.Vectors = ['POINTS', vector_array]
stream.IntegrationDirection = direction
stream.IntegratorType = 'Runge-Kutta 2'
+ stream.SeedType = 'High Resolution Line Source'
stream.UpdatePipeline()
# Get Stream Lines representation object
GaussPoints
StreamLines
SWIG_scripts
- Tables
+# Tables table reader is not used anymore and CSVReader
+# doesn't suport txt and xls formats, so switch off Tables tests
ImportMedField
united
bugs
SET(BASE_TESTS A0 B0 E0 F1 G0)
SET(ALL_TESTS A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 B0 B1 B2
E0 E1 E2 E3 E4 E5 E6 E7 E8 E9
- F1 F2 F3 F4 F5 F6 F7 F8 F9 G0 G1 G2)
+ F1 F2 F3 F4 F5 F6 F8 F9 G0 G1 G2)
# For make test
IF(SALOME_PARAVIS_ALL_TEST)
SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES ENVIRONMENT "${tests_env}")
ENDFOREACH()
+# Increase timeout for specific tests
+SET_TESTS_PROPERTIES(CUTLINES_F4 PROPERTIES TIMEOUT 5000)
+
# Application tests
SET(APPLICATION_TESTS ${ALL_TESTS})
SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/VisuPrs/CutLines)
+++ /dev/null
-# Copyright (C) 2010-2015 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, or (at your option) any later version.
-#
-# 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/CutLines/F7 case
-# Create Cut Lines for all data of the given MED file
-
-import sys
-from paravistest import datadir, pictureext, get_picture_dir
-from presentations import CreatePrsForFile, PrsTypeEnum
-
-# Directory for saving snapshots
-picturedir = get_picture_dir("CutLines/F7")
-
-file = datadir + "occ4050.med"
-print " --------------------------------- "
-print "file ", file
-print " --------------------------------- "
-print "CreatePrsForFile..."
-CreatePrsForFile(file, [PrsTypeEnum.CUTLINES], picturedir, pictureext)
SET(BASE_TESTS A0 B0 E0 F1 G0)
SET(ALL_TESTS A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 B0 B1 B2 B3
E0 E1 E2 E3 E4 E5 E6 E7 E8 E9
- F1 F2 F3 F4 F5 F6 F7 F8 F9 G0 G1 G2)
+ F1 F2 F3 F4 F5 F6 F8 F9 G0 G1 G2)
# For make test
IF(SALOME_PARAVIS_ALL_TEST)
+++ /dev/null
-# Copyright (C) 2010-2015 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, or (at your option) any later version.
-#
-# 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/CutPlanes/F7 case
-# Create Cut Planes for all data of the given MED file
-
-import sys
-from paravistest import datadir, pictureext, get_picture_dir
-from presentations import CreatePrsForFile, PrsTypeEnum
-
-# Directory for saving snapshots
-picturedir = get_picture_dir("CutPlanes/F7")
-
-file = datadir + "occ4050.med"
-print " --------------------------------- "
-print "file ", file
-print " --------------------------------- "
-print "CreatePrsForFile..."
-CreatePrsForFile(file, [PrsTypeEnum.CUTPLANES], picturedir, pictureext)
SET(BASE_TESTS A0 B0 E0 F1)
SET(ALL_TESTS A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 B0 B1 B2 B3 B4
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 F1 F2 F3 F4 F5 F6 F7 F8 F9)
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 F1 F2 F3 F4 F5 F6 F8 F9)
# For make test
IF(SALOME_PARAVIS_ALL_TEST)
+++ /dev/null
-# Copyright (C) 2010-2015 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, or (at your option) any later version.
-#
-# 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/DeformedShape/F7 case
-# Create Deformed Shape for all data of the given MED file
-
-import sys
-from paravistest import datadir, pictureext, get_picture_dir
-from presentations import CreatePrsForFile, PrsTypeEnum
-
-# Directory for saving snapshots
-picturedir = get_picture_dir("DeformedShape/F7")
-
-file = datadir + "occ4050.med"
-print " --------------------------------- "
-print "file ", file
-print " --------------------------------- "
-print "CreatePrsForFile..."
-CreatePrsForFile(file, [PrsTypeEnum.DEFORMEDSHAPE], picturedir, pictureext)
+++ /dev/null
-# Copyright (C) 2010-2015 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, or (at your option) any later version.
-#
-# 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/C5 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 GaussPointsOnField, EntityType, get_time, process_prs_for_test
-import pvsimple
-
-# Directory for saving snapshots
-picturedir = get_picture_dir("GaussPoints/C5")
-if not picturedir.endswith(os.sep):
- picturedir += os.sep
-
-# MED file
-file_name = datadir + "occ4050.med"
-field_name = "champ_reel"
-timestamp_nb = -1 # last timestamp
-
-pvsimple.OpenDataFile(file_name)
-med_reader = pvsimple.GetActiveSource()
-if med_reader is None:
- raise RuntimeError("File wasn't imported!!!")
-
-# Create Gauss Points presentation
-print "BREAKPOINT_1"
-
-prs = GaussPointsOnField(med_reader, EntityType.CELL, field_name, timestamp_nb)
-if prs is None:
- raise RuntimeError, "Created presentation is None!!!"
-
-print "BREAKPOINT_2"
-
-# Display presentation and get snapshot
-view = pvsimple.GetRenderView()
-time = get_time(med_reader, timestamp_nb)
-
-pic_name = picturedir + field_name + "_" + str(time) + "_GAUSSPOINTS." + pictureext
-process_prs_for_test(prs, view, pic_name)
SET(BASE_TESTS A2 B0 C0)
SET(ALL_TESTS A0 A1 A3 A4 A5 A6 A7 A9 B0 B1 B2 B3 B4 B5 B6 B7 B8 B9
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9)
+ C0 C1 C2 C3 C4 C6 C7 C8 C9)
# For make test
IF(SALOME_PARAVIS_ALL_TEST)
+++ /dev/null
-# Copyright (C) 2010-2015 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, or (at your option) any later version.
-#
-# 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
-
-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(med_file, field_names, 1, prs_list)
#
SET(BASE_TESTS A0 B0 C0)
-SET(ALL_TESTS A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 C0 C1 C2)
+SET(ALL_TESTS A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 B0 B1 B2 B4 B5 B6 B7 B8 B9 C0 C1 C2)
# For make test
IF(SALOME_PARAVIS_ALL_TEST)
SET(BASE_TESTS A0 B0 E1 F1)
SET(ALL_TESTS A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 B0 B1 B2
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 F1 F2 F3 F4 F5 F6 F7 F8 F9 G0 G1 G2)
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 F1 F2 F3 F4 F5 F6 F8 F9 G0 G1 G2)
# For make test
IF(SALOME_PARAVIS_ALL_TEST)
+++ /dev/null
-# Copyright (C) 2010-2015 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, or (at your option) any later version.
-#
-# 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/IsoSurfaces/F7 case
-# Create Iso Surface for all data of the given MED file
-
-import sys
-from paravistest import datadir, pictureext, get_picture_dir
-from presentations import CreatePrsForFile, PrsTypeEnum
-
-# Directory for saving snapshots
-picturedir = get_picture_dir("IsoSurfaces/F7")
-
-file = datadir + "occ4050.med"
-print " --------------------------------- "
-print "file ", file
-print " --------------------------------- "
-print "CreatePrsForFile..."
-CreatePrsForFile(file, [PrsTypeEnum.ISOSURFACES], picturedir, pictureext)
SET(BASE_TESTS A0 B0 E2 F2 G3 H1 I0 J0 K1 L0)
SET(ALL_TESTS A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 B0 B1 B2 E0 E1 E2 E3 E4 E5 E6 E7 E8 E9
- F1 F2 F3 F4 F5 F6 F7 F8 F9 G0 G1 G3 G4 G5 G6 G7 G8 G9
+ F1 F2 F3 F4 F5 F6 F8 F9 G0 G1 G3 G4 G5 G6 G7 G8 G9
H0 H1 H2 H3 H4 H5 H6 H7 H8 H9 I0 I1 I2 I3 I4 I5 I6 I7 I8 I9
J0 J1 J2 J3 J4 J5 J6 J7 J8 J9 K0 K1 K2 K3 K4 K5 K6 K7 K8 K9 L0 L1)
+++ /dev/null
-# Copyright (C) 2010-2015 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, or (at your option) any later version.
-#
-# 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/MeshPresentation/F7 case
-# Create Mesh Presentation for all data of the given MED file
-
-import sys
-from paravistest import datadir, pictureext, get_picture_dir
-from presentations import CreatePrsForFile, PrsTypeEnum
-
-# Directory for saving snapshots
-picturedir = get_picture_dir("MeshPresentation/F7")
-
-file = datadir + "occ4050.med"
-print " --------------------------------- "
-print "file ", file
-print " --------------------------------- "
-print "CreatePrsForFile..."
-CreatePrsForFile(file, [PrsTypeEnum.MESH], picturedir, pictureext)
SET(BASE_TESTS A1 B0 E0 F1 G0)
SET(ALL_TESTS A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 B0 B1 B2 E0 E1 E2 E3 E4 E5 E6 E7 E8 E9
- F1 F2 F3 F4 F5 F6 F7 F8 F9 G0 G1 G2)
+ F1 F2 F3 F4 F5 F6 F8 F9 G0 G1 G2)
# For make test
IF(SALOME_PARAVIS_ALL_TEST)
+++ /dev/null
-# Copyright (C) 2010-2015 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, or (at your option) any later version.
-#
-# 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/Plot3D/F7 case
-# Create Plot3D for all data of the given MED file
-
-import sys
-from paravistest import datadir, pictureext, get_picture_dir
-from presentations import CreatePrsForFile, PrsTypeEnum
-
-# Directory for saving snapshots
-picturedir = get_picture_dir("Plot3D/F7")
-
-file = datadir + "occ4050.med"
-print " --------------------------------- "
-print "file ", file
-print " --------------------------------- "
-print "CreatePrsForFile..."
-CreatePrsForFile(file, [PrsTypeEnum.PLOT3D], picturedir, pictureext)
pvsimple.Delete(cur_view)
xy_view = pvsimple.CreateXYPlotView()
xy_view.ChartTitle = 'Very useful data'
-xy_view.AxisTitle = ['[ Wt ]', 'Frequency [ Hz ]']
+xy_view.BottomAxisTitle = '[ Wt ]'
+xy_view.LeftAxisTitle = 'Frequency [ Hz ]'
xy_rep = pvsimple.Show(ps)
xy_rep.AttributeType = 'Row Data'
# Load MED reader plugin
pv_root_dir = os.getenv("PARAVIS_ROOT_DIR")
-pvs.LoadPlugin(pv_root_dir + "/lib/paraview/libMedReaderPlugin.so")
+pvs.LoadPlugin(pv_root_dir + "/lib/paraview/libMEDReaderPlugin.so")
# Import MED file
med_file = datadir + "pointe.med"
xy_view1 = pvsimple.CreateXYPlotView()
xy_view1.ChartTitle = 'TEST table of real'
-xy_view1.AxisTitle = ['[ Wt ]', 'Row 0 [ Hz ]']
+xy_view1.BottomAxisTitle = '[ Wt ]'
+xy_view1.LeftAxisTitle = 'Row 0 [ Hz ]'
# Display curves for the table of real
tr_rep = pvsimple.Show(ps_tr)
# Create another chart line view
xy_view2 = pvsimple.CreateXYPlotView()
xy_view2.ChartTitle = 'TEST table of integer'
-xy_view2.AxisTitle = ['', 'FR [ m/h ]']
+xy_view2.LeftAxisTitle = 'FR [ m/h ]'
# Display curves for the table of integer
ti_rep = pvsimple.Show(ps_ti, xy_view2)
xy_view.ChartTitle = "Change the title from python"
pvsimple.Render(xy_view)
-axis_title = xy_view.AxisTitle
-xy_view.AxisTitle[0] = "Y axis"
-xy_view.AxisTitle[1] = "X axis"
+xy_view.LeftAxisTitle = "Y axis"
+xy_view.BottomAxisTitle = "X axis"
pvsimple.Render(xy_view)
xy_view.ShowLegend = 0
# 1. Import tables from file
file_path = tablesdir + "tables_test.xls"
-table_reader = pvsimple.TableReader(FileName=file_path)
+table_reader = pvsimple.CSVReader(FileName=file_path)
if table_reader is None:
print "FAILED to import tables from tables_test.xls file."
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
# Get lookup table
lookup_table = get_lookup_table(table_name, nb_components, vector_mode)
-lookup_table.LockScalarRange = 0
+if hasattr(lookup_table,"LockDataRange"):
+ lookup_table.LockDataRange = 0
+elif hasattr(lookup_table,"LockScalarRange"):
+ lookup_table.LockScalarRange = 0
+else:
+ raise RuntimeError("Object %s has no 'LockDataRange' or 'LockScalarRange' attribute!"%(lookup_table))
# Set properties
pointmap3d.ColorArrayName = (EntityType.get_pvtype(entity), table_name)
SET(BASE_TESTS A1 B0 E0 F3 G0)
SET(ALL_TESTS A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 B0 B1 B2 B3 E0 E1 E2 E3 E4 E5 E6 E7 E8 E9
- F1 F2 F3 F4 F5 F6 F7 F8 F9 G0 G1 G2)
+ F1 F2 F3 F4 F5 F6 F8 F9 G0 G1 G2)
# For make test
IF(SALOME_PARAVIS_ALL_TEST)
+++ /dev/null
-# Copyright (C) 2010-2015 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, or (at your option) any later version.
-#
-# 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/F7 case
-# Create Scalar Map for all data of the given MED file
-
-import sys
-from paravistest import datadir, pictureext, get_picture_dir
-from presentations import CreatePrsForFile, PrsTypeEnum
-
-# Directory for saving snapshots
-picturedir = get_picture_dir("ScalarMap/F7")
-
-file = datadir + "occ4050.med"
-print " --------------------------------- "
-print "file ", file
-print " --------------------------------- "
-print "CreatePrsForFile..."
-CreatePrsForFile(file, [PrsTypeEnum.SCALARMAP], picturedir, pictureext)
import sys
import os
-from paravistest import datadir, pictureext, get_picture_dir
+from paravistest import datadir, pictureext, get_picture_dir, get_png_picture_resolution
from pvsimple import GetActiveSource, GetRenderView, Render, OpenDataFile
from presentations import ScalarMapOnField, hide_all, EntityType, PrsTypeEnum,reset_view,process_prs_for_test
aView = GetRenderView()
+import time
+
aFieldEntity = EntityType.NODE
aFieldName = "MODES___DEPL____________________"
#create list to store picture files sizes
-sizes=[]
+sizesw=[]
+sizesh=[]
#create Scalar Map presentations for 10 timestamps
for i in range(1,11):
hide_all(aView, True)
# Show and record the presentation
process_prs_for_test(aPrs, aView, pic_name)
- sizes.append(os.path.getsize(pic_name))
+ (w,h) = get_png_picture_resolution(pic_name)
+ sizesw.append(w)
+ sizesh.append(h)
+
+# check sizes of pictures: width
+if abs(max(sizesw)-min(sizesw)) > 0:
+ print "<b>ERROR!!! Pictures have different width !!!</b>";
+ for i in range(1,11):
+ picture_name = "time_stamp_"+str(i)+"."+pictureext
+ print "Picture: "+picture_name+"; width : "+str(sizesw[i-1])
+ raise RuntimeError
-# check sizes of pictures
-if abs(max(sizes)-min(sizes)) > 0.01*max(sizes):
- print "<b>WARNING!!! Pictures have different sizes!!!</b>";
+# check sizes of pictures: height
+if abs(max(sizesh)-min(sizesh)) > 0:
+ print "<b>WARNING!!! Pictures have different height !!!</b>";
for i in range(1,11):
picture_name = "time_stamp_"+str(i)+"."+pictureext
- print "Picture: "+picture_name+"; size: "+str(sizes[i-1])
+ print "Picture: "+picture_name+"; height : "+str(sizesh[i-1])
raise RuntimeError
+
SET(BASE_TESTS A0 B0 E0 F2)
SET(ALL_TESTS A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 B0 B1 B2 B3 E0 E1 E2 E3 E4 E5 E6 E7 E8 E9
- F1 F2 F3 F4 F5 F6 F7 F8)
+ F1 F2 F3 F4 F5 F6 F8)
# For make test
IF(SALOME_PARAVIS_ALL_TEST)
+++ /dev/null
-# Copyright (C) 2010-2015 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, or (at your option) any later version.
-#
-# 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_On_DeformedShape/F7 case
-# Create Scalar Map on Deformed Shape for all data of the given MED file
-
-import sys
-from paravistest import datadir, pictureext, get_picture_dir
-from presentations import CreatePrsForFile, PrsTypeEnum
-
-# Directory for saving snapshots
-picturedir = get_picture_dir("ScalarMap_On_DeformedShape/F7")
-
-file = datadir + "occ4050.med"
-print " --------------------------------- "
-print "file ", file
-print " --------------------------------- "
-print "CreatePrsForFile..."
-CreatePrsForFile(file, [PrsTypeEnum.DEFORMEDSHAPESCALARMAP], picturedir, pictureext)
from presentations import CreatePrsForFile, PrsTypeEnum
# Directory for saving snapshots
-picturedir = get_picture_dir(sys.argv[1], "StreamLines/B3")
+picturedir = get_picture_dir("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"]
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
+print "Point1: ", stream_tracer.SeedType.Point1
+print "Point2: ", stream_tracer.SeedType.Point2
+# print "Center: ", stream_tracer.SeedType.Center
+# print "Number Of Points: ", stream_tracer.SeedType.NumberOfPoints
+# print "Radius: ", stream_tracer.SeedType.Radius
SET(BASE_TESTS A1 B2 E0 F2)
SET(ALL_TESTS A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 B0 B1 B2 B3 B4
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 F1 F2 F3 F4 F5 F6 F7 F8 F9 G0)
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 F1 F2 F3 F4 F5 F6 F8 F9 G0)
# For make test
IF(SALOME_PARAVIS_ALL_TEST)
+++ /dev/null
-# Copyright (C) 2010-2015 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, or (at your option) any later version.
-#
-# 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/F7 case
-# Create Stream Lines for all fields of the the given MED file
-
-import sys
-
-from paravistest import datadir, pictureext, get_picture_dir
-from presentations import CreatePrsForFile, PrsTypeEnum
-
-# Directory for saving snapshots
-picturedir = get_picture_dir("StreamLines/F7")
-
-file = datadir + "occ4050.med"
-print " --------------------------------- "
-print "file ", file
-print " --------------------------------- "
-print "\nCreatePrsForFile..."
-CreatePrsForFile(file, [PrsTypeEnum.STREAMLINES], picturedir, pictureext)
print "BREAKPOINT_1"
for i in range(1, 11):
- prs = StreamLinesOnField(med_reader, EntityType.NODE, "MODES_DEPL", i)
+ prs = StreamLinesOnField(med_reader, EntityType.NODE, "MODES___DEPL____________________", i)
if prs is None:
raise RuntimeError("Presentation on timestamp {0} is None!!!".
format(i))
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)
+streamlines = StreamLinesOnField(med_reader, EntityType.NODE, 'RESU____DEPL____________________', 1)
if streamlines is None:
raise RuntimeError, "Presentation is None!!!"
import tempfile
import getpass
from datetime import date
+import struct
# Auxiliary variables
obj_to_delete = tmp_obj.Input
pvsimple.Delete(tmp_obj)
+
+def get_png_picture_resolution(infile):
+ """Returns size (width, height) of the PNG image"""
+ f = open(infile, 'rb')
+ data = f.read(24)
+ f.close()
+ if not (data[:8] == '\211PNG\r\n\032\n'and (data[12:16] == 'IHDR')):
+ raise RuntimeError("File '%s' is not PNG image"%(infile))
+
+ w, h = struct.unpack('>LL', data[16:24])
+ width = int(w)
+ height = int(h)
+ return (width,height)
+
+def save_trace(afile,atrace):
+ """Saves atrace in afile"""
+ f = open(afile, 'w')
+ f.write(atrace)
+ f.close()
SET(BASE_TESTS A0 B1 E0 F1)
SET(ALL_TESTS A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 B0 B1 B2 B3 E0 E1 E2 E3 E4 E5 E6 E7 E8 E9
- F1 F2 F3 F4 F5 F6 F7 F8 F9)
+ F1 F2 F3 F4 F5 F6 F8 F9)
# For make test
IF(SALOME_PARAVIS_ALL_TEST)
+++ /dev/null
-# Copyright (C) 2010-2015 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, or (at your option) any later version.
-#
-# 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/Vectors/F7 case
-# Create Vectors for all data of the given MED file
-
-import sys
-from paravistest import datadir, pictureext, get_picture_dir
-from presentations import CreatePrsForFile, PrsTypeEnum
-
-# Directory for saving snapshots
-picturedir = get_picture_dir("Vectors/F7")
-
-file = datadir + "occ4050.med"
-print " --------------------------------- "
-print "file ", file
-print " --------------------------------- "
-print "CreatePrsForFile..."
-CreatePrsForFile(file, [PrsTypeEnum.VECTORS], picturedir, pictureext)
+++ /dev/null
-# Copyright (C) 2010-2015 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, or (at your option) any later version.
-#
-# 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 pvsimple
-
-picturedir = get_picture_dir("bugs/C4")
-
-# 1. Import MED file
-med_file_path = datadir + "forma01f.resu.med"
-
-print 'Importing "forma01f.resu.med"....',
-pvsimple.OpenDataFile(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!!!"
-
#
SET(BASE_TESTS A0 B1 C3 D0 E0)
-SET(ALL_TESTS 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(ALL_TESTS A0 A1 A2 A3 A4 A5 A6 A7 A9 B1 C3 C5 C6 C7 C9
+ D1 D3 D6 D7 E0)
# For make test
IF(SALOME_PARAVIS_ALL_TEST)
+++ /dev/null
-# Copyright (C) 2010-2015 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, or (at your option) any later version.
-#
-# 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 pvsimple
-
-picturedir = get_picture_dir("bugs/D0")
-
-# Aux method
-def get_group_full_name(source, group_name):
- result_name = group_name
-
- #full_names = source.Groups.Available
- full_names = get_group_names(source)
- for name in full_names:
- if name.endswith(group_name):
- result_name = name
- break
-
- return result_name
-
-#
-# NB! An 'Unknown exception' is raised, when a user try to open
-# "Bug619-result_calcul_OCC.med" file in MED module via 'Add Data Source' functionality.
-# Refer to LastTest.log file for more information.
-# TODO: check MedReader pb.
-#
-# 1. Import of the "Bug619-result_calcul_OCC.med" file
-med_file_path = datadir + "Bug619-result_calcul_OCC.med"
-
-pvsimple.OpenDataFile(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.AllGroups = [get_group_full_name(extract_group, 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)
import sys
import os
-from paravistest import datadir, pictureext, get_picture_dir
+from paravistest import datadir, pictureext, get_picture_dir, get_png_picture_resolution
from presentations import *
import pvsimple
# 2. Creation of a set of "DeformedShape and ScalarMap" presentations, based on time stamps of "MODES_DEPL" field
errors=0
-sizes=[]
+sizew=[]
+sizeh=[]
for i in range(1,11):
presentation = DeformedShapeAndScalarMapOnField(med_reader1, EntityType.NODE, "MODES___DEPL____________________", i)
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))
+ (h,w) = get_png_picture_resolution(pic_path)
+ sizew.append(w)
+ sizeh.append(h)
-if abs(max(sizes)-min(sizes)) > 0.01*max(sizes):
- print "WARNING!!! Pictures have different sizes!!!"
+if abs(max(sizeh)-min(sizeh)) > 0.01*max(sizeh):
+ print "WARNING!!! Pictures have different height !!!"
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])
+ picture_name = "npal19999_2_time_stamp_" + str(i) + "." + pictureext
+ print "Picture: " + picture_name + "; height : " + str(sizeh[i-1])
+ raise RuntimeError
+
+if abs(max(sizew)-min(sizew)) > 0.01*max(sizew):
+ print "WARNING!!! Pictures have different width !!!"
+ errors += 1
+ for i in range(1,11):
+ picture_name = "npal19999_2_time_stamp_" + str(i) + "." + pictureext
+ print "Picture: " + picture_name + "; width : " + str(sizew[i-1])
raise RuntimeError
# 3. Import of the "Bug829_resu_mode.med" file at second time
# 4. Creation of a set of "DeformedShape and ScalarMap" presentations, based on time stamps of "MODES_DEPL" field
errors = 0
-sizes=[]
+sizew=[]
+sizeh=[]
for i in range(1,11):
presentation = DeformedShapeAndScalarMapOnField(med_reader2, EntityType.NODE, "MODES___DEPL____________________", 11-i)
pic_path = os.path.join(picturedir, "npal19999_2_time_stamp_" + str(i) + "." + pictureext)
process_prs_for_test(presentation, pvsimple.GetRenderView(), pic_path)
+ (h,w) = get_png_picture_resolution(pic_path)
+ sizew.append(w)
+ sizeh.append(h)
- sizes.append(os.path.getsize(pic_path))
+if abs(max(sizeh)-min(sizeh)) > 0.01*max(sizeh):
+ print "WARNING!!! Pictures have different height !!!"
+ errors += 1
+ for i in range(1,11):
+ picture_name = "npal19999_2_time_stamp_" + str(i) + "." + pictureext
+ print "Picture: " + picture_name + "; height : " + str(sizeh[i-1])
+ raise RuntimeError
-if abs(max(sizes)-min(sizes)) > 0.01*max(sizes):
- print "WARNING!!! Pictures have different sizes!!!"
+if abs(max(sizew)-min(sizew)) > 0.01*max(sizew):
+ print "WARNING!!! Pictures have different width !!!"
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])
+ print "Picture: " + picture_name + "; width : " + str(sizew[i-1])
raise RuntimeError
+
# Get lookup table
lookup_table = get_lookup_table(field_name, nb_components, vector_mode)
- lookup_table.LockScalarRange = 0
+ if hasattr(lookup_table,"LockDataRange"):
+ lookup_table.LockDataRange = 0
+ elif hasattr(lookup_table,"LockScalarRange"):
+ lookup_table.LockScalarRange = 0
+ else:
+ raise RuntimeError("Object %s has no 'LockDataRange' or 'LockScalarRange' attribute!"%(lookup_table))
# Set properties
prs.ColorArrayName = (EntityType.get_pvtype(EntityType.NODE), field_name)
from paravistest import datadir, delete_with_inputs
from presentations import *
from pvsimple import *
+from paravistest import save_trace
+from paraview import smtrace
+
+GetActiveViewOrCreate('RenderView')
+
+config = smtrace.start_trace()
+config.SetFullyTraceSupplementalProxies(True)
+config.SetPropertiesToTraceOnCreate(config.RECORD_ALL_PROPERTIES)
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'}
bar.Title = settings["Title"]
bar.Orientation = settings["Orientation"]
+text = smtrace.stop_trace()
# 3. Dump Study
path_to_save = os.path.join(os.getenv("HOME"), "ScalarMap.py")
-SaveTrace( path_to_save )
+save_trace( path_to_save, text )
# 4. Delete the created objects, recreate the view
delete_with_inputs(scalarmap)
# Set field range
data_range = get_data_range(proxy, entity,
field_name, vector_mode)
- lookup_table.LockScalarRange = 1
+ if hasattr(lookup_table,"LockDataRange"):
+ lookup_table.LockDataRange = 1
+ elif hasattr(lookup_table,"LockScalarRange"):
+ lookup_table.LockScalarRange = 1
+ else:
+ raise RuntimeError("Object %s has no 'LockDataRange' or 'LockScalarRange' attribute!"%(lookup_table))
lookup_table.RGBPoints = [data_range[0], 0, 0, 1, data_range[1], 1, 0, 0]
# Set properties