ParaViewWeb Manta setting

From KitwarePublic
Jump to navigationJump to search

ParaViewWeb


Introduction

Manta is a RayTracer engine which has been integrated as a plugin in Paraview. To make Manta available for ParaViewWeb, you will have to customize the setting of the PWServer executable to start a pvserver at the same time as the PWServer.

Configure the Web server

To do so, you will need to edit your pw-config.property file and replace the default one or create a new one like we did with the manta keyword.

 pw.executable.path.manta=.../ParaViewWeb-work/exec/manta.sh
 pw.plugins.manta=.../ParaViewWeb-work/plugins

So to use this configuration, the web developer will need to create the Paraview object as follow.

 var paraview = new Paraview("manta session", "sample code to start a manta session", "manta")

Starting scripts

As you will need to encapsulate in a single call the start of the pvserver and PWServer which act as a client against the pvserver, you will need to write a script like the following one. The limitation with the following one, is that only one server can run at a time since the default 11111 port will be used by the pvserver.

 #!/bin/bash
 .../ParaView-build/bin/pvserver &
 .../ParaViewWeb-build/ParaViewAdapter/PWServer --server-hostname=localhost --server-port=11111 --batch-file=.../manta-init.py $1 $2 $3 $4 $5 $6 $7

Moreover, in order to create a manta view, we have to load the plugin and create it from a server side python script which can also be inside a plugin. But what we provide here, is an automatic setting with no plugin involved.

 import paraview
 
 buildDir = '.../ParaView-build/bin'
 
 paraview.simple.LoadPlugin(buildDir+"/libMantaView.so", False)
 paraview.simple.LoadPlugin(buildDir+"/libMantaView.so", True)
 
 paraview.simple.active_objects.view = paraview.simple._create_view("MantaIceTDesktopRenderView")
 paraview.simple.active_objects.view.Threads = 8
 paraview.simple.active_objects.view.ViewSize = [300,300]

Scripts to find free port

The following script return an available network port that can be used by pvserver in a given range.

 #!/bin/bash
 
 for port in {11111..11211}
 do 
   result=`netstat -a | grep LISTENING | grep " $port " | wc -l`
   if [ $result == 0 ]
   then
       echo "$port"
       exit 0
   fi
 done