This documentation is intended for SALOME’s developpers or anyone wishing to modify the module itself. If you are looking for user documentation, please launch SALOME, activate the PARAVIS module, and refer to the Help menu there.
PARAVIS is the visualization module of SALOME. The module is a tight integration of the functionalities offered by ParaView in the SALOME architecture. The architecture of the PARAVIS module has been revised end of 2014 to offer a smoother integration with ParaView.
If you are looking for the Doxygen of the C++ code, it can be found here: Doxygen documentation
The PARAVIS module represents the integration of ParaView inside SALOME.
SALOME uses by default the detached server mode of ParaView: the pvserver is launched outside the main Salome process and the ParaVis module, or the PVViewer view (Window -> ParaView view) connects to it.
Following this logic, the PVSERVER CORBA service has a very restrained role. Its only purpose is to:
Hence, we emphazise the fact that the CORBA engine does not provide any access to the objects or the visualisation results themselves. It only serves to establish the link with the pvserver. The latter can then be queried (with the standard ParaView mechanisms) to retrieve those objects.
A typical session looks like this:
start SALOME’s GUI
use the standard ParaView’s API to interact with the server (either from the C++ side, within SALOME’s GUI or from a Python script, using for example the methods provided in the Python module pvsimple).
The picture below summarizes the architecture:
In terms of code structure, the main, all the initialization logic of ParaView is attached to the PVViewer (ParaView’s viewer) located in the GUI module in the src/PVViewer folder. The CORBA engine and the graphical interface of the ParaVis module are located in the ParaVis module of SALOME.
The following functionalities are offered by the PVSERVER and the ParaVis module:
In the ParaVis module, here is the list of code folders:
At the time of writing the PVSERVER CORBA service is sitll hosted by the ParaVis module, but it should move to GUI to be able to compile GUI without any dependency to PARAVIS. At present, this is only a weak dependency in the sense that nothing is needed at link time, but only at run-time.
One can request a ParaView view without activating the ParaVis module itself. For example the MED module now integrates a control visualization which is in fact a ParaView view.
To make this work, a specific type of viewer (PVViewer, short for ParaView viewer) has been created in the GUI module itself. The code is located in src/PVViewer.
This folder contains the following classes:
The folder also contain the adaptor classes needed to make the ParaView native 3D view (a pqTabbedMultiViewWidget) fit into the SUIT model (i.e. the model imposed by SALOME’s GUI architecture to define a new type of view):
ParaView works in a client/server mode. In two words, a server part (the pvserver) takes care of the ‘intensive’ computations (filter, etc ...) and a client part serves to control this server, and obviously visualize the final rendering.
The pvserver represents the main visualisation server, and can be either:
The various types of clients are:
Historically the pvserver was not able to receive the connections from multiple clients, but this has been changed from ParaView 4.0 (or was it 3.98?). Salome now exploits this feature.
In the GUI module of SALOME, the folder src/PVViewer contains all the code needed to activate a minimal ParaView 3D view, without activating the ParaVis module itself. This folder hence deals with:
The PVViewer follows otherwise the standard structure of a Salome’s view (SUIT model).
A special trick is used to make PVGUI_ViewWindow the parent of the pqViewManager widget. It is created initally by pqMainWindowCore with the desktop as a parent, so when it is shown, a PVGUI_ViewWindow instance is passed to its setParent() method. In the destructor PVGUI_ViewWindow::~PVGUI_ViewWindow()``the parent is nullified to avoid deletion of the ``pqViewManager widget (that would break the pqMainWindowCore class).
The initialization of the viewer (see previous section) takes part of instantiating the most important widgets, notably:
All those menus are dynamic in the sense that they are automatically populated when a plugin/a configuration is loaded (this is also they need to be connected so early by the PVViewer_GUIElements class seen before).
In the ParaVis module, the class PVGUI_Module represents the GUI client compliant with the usual architecture of a SALOME GUI module. The implementation is split in three cxx files:
ParaView is a mono-threaded application. It also provides an embedded Python interpreter to make the Python shell work. SALOME on the other hand is multi-threaded, and also provides an embedded Python’s interpreter.
Making the two work together has often been (and still is) a painful job! If you run into this sort of problems, take a look at what the GIL is: Global Interpreter Lock
In Salome, the current setup is to:
The last point is of crucial importance: it basically means that all the GUI events are in a single thread. Even without considering
All the calls to the Python API in the rest of SALOME are (should be!) GIL safe.
The ParaView Python’s trace mechanism has long been a problem, but has fortunately been rationalized thanks to the API of ParaView providing clear methods to control the start/stop (and other options of the trace). This is grouped in the ParaViewCore/ServerManager/Core/vtkSMTrace class and used in the method PVGUI_Module::startTrace().
The modules found in src/PV_SWIG are mostly simple namespace forwards from the original ParaView’s modules (i.e. they redirect to the original modules):
paravisSM is a forward of paraview.servermanager. It is left mostly for backward compatibility (it used to be full of nasty overrides).
Those forward/similarities are naturally intended so that a script written for pure ParaView can easily be ported to ParaVis. The conversion boils down to replacing import paraview.simple by impory pvsimple (with a few other extra details of lesser importance).
The following items should be revised each time an upgrade to a newer ParaView version is done. They are often a copy/paste of ParaView’s source code with a slight amendment to fit SALOME’s requirements.
initialization sequence: currently located in GUI module, PVViewer_ViewManager::ParaViewInitApp(): the following classes should be inspected, and compared with their equivalent in ParaView source code to see if an update is necessary:
PVViewer_ViewManager (GUI module): method ParaviewInitApp(), ParaviewInitBehaviors(), ParaviewLoadConfigurations() and finally ConnectToExternalPVServer() should be re-read. Their precise ordering is used in PVGUI_Module::initialize() and the whole sequence should be compared with what can be found in:
- Applications/ParaView/ParaViewMainWindow.cxx
- CMake/branded_paraview_initializer.cxx.in, and the method Initialize()
PVViewer_Behaviors (GUI module): compare with Qt/ApplicationComponents/pqParaViewBehaviors.cxx
menus and actions: PVGUI_Module_widgets.cxx (ParaVis module) should be compared with Applications/ParaView/ParaViewMainWindow.cxx
toolbars: PVViewer_GUIElements::myBuildToolbars() (GUI module): compare with pqParaViewMenuBuilders::buildToolbars()
dock widgets placement: PVGUI_Module::setupDockWidgets() (ParaVis module): compare with Application/Paraview/ParaviewMainWindow.ui
settings dialog box: PVGUI_ParaViewSettingsPane (ParaVis module) should be compared with Qt/Components/pqSettingsDialog.h
trace mechanism: method PVGUI_Module::startTrace() should be compared with pqTraceReaction::start() in file Qt/ApplicationComponents/pqTraceReaction.h
Trace management
Contrary to ParaView, which can start/stop its trace at any moment, in PARAVIS the trace is activated or deactivated for the whole session.
The trace functionality can be switched on/off in SALOME preferences dialog box, in the PARAVIS tab (main menu | Preferences...). It contains a check box “Deactivate Trace”. By default the trace is activated. Change of check box state makes effect only for next session.
Also, the trace is used for the “Dump Study” functionality. But if the tracing is switched off then the “Dump Study” doesn’t save PARAVIS module trace.
Application options
If it is necessary to define a spcific command line parameter for ParaView application, then it can be defined with the help of the PARAVIEW_OPTIONS environment variable. For example:
export PARAVIEW_OPTIONS=--server=myServer
If it is necessary to define several command line parameters, these parameters have to be separated by the “:” character.
If you are looking for the Doxygen of the C++ code, it can be found here: Doxygen documentation