ParaViewWeb Manta setting: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
Line 22: Line 22:


   #!/bin/bash
   #!/bin/bash
  # file: manta.sh
   .../ParaView-build/bin/pvserver &
   .../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
   .../ParaViewWeb-build/ParaViewAdapter/PWServer --server-hostname=localhost --server-port=11111 --batch-file=.../manta-init.py $1 $2 $3 $4 $5 $6 $7
Line 27: Line 28:
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.
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.


  # file: manta-init.py
   import paraview
   import paraview
    
    

Revision as of 13:07, 8 July 2010

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
 # file: manta.sh
 .../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.

 # file: manta-init.py
 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
 # FileName: findPort.sh
 
 for port in {11111..11211}
 do 
   result=`netstat -vatn | grep ":$port " | wc -l`
   if [ $result == 0 ]
   then
       echo "$port"
       exit 0
   fi
 done

The start script with findPort

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