Thomas,

It can be done, but working at the server manager level is dreadfully painful - 
primarily because you can't just Get/Set values on objects, but have to pass 
everything through proxy objects. (The nice thing about the python wrapping is 
that this is very cleanly implemented so you can just manipulate objects and 
the client server/proxy level is hidden below).

When the coprocessing library was added - I wanted to play with it, but without 
the python interface, so I created a simple demo which does everything at the 
server manager level in C++. You won't quite find the answer to your question 
here, but it will get you 75% of the way. I manually instantiate the pvserver 
manager stuff and then access it via proxies (whereas you want to communicate 
with an existing pvserver). 
git://git.cscs.ch/coprocessing.git
has a project that you might want to play with. It is very simple - creates a 
3D Gaussian image distributed over N procs and animates it over time.
Option USE_PARAVIEW_COPROCESSING - when on, it links to the coprocessing libs 
and generates images in parallel using my own customized C++ pipeline interface 
to the server manager
if USE_PARAVIEW_COPROCESSING_PYTHON is also enabled - does exactly the same - 
but uses the python pipeline as provided by the default coprocessing library. 
Unfortunately, this seems to be broken (or at least useless, because when you 
save a coprocessing python state out from the gui to use in your coprocessing 
runs, so many unwanted variables are dumped out at the same time, that it takes 
longer to edit the python files and remove the ones that break it, than it 
would to just write it by hand).

There are some hardcoded paths in the code you will want to edit (to the python 
script for example), and the OFFSCREEN_RENDER flag can be defined as 1 or 0 
depending on whether you want to see the animation appear. Leave it onscreen 
for testing.

I wanted to tidy this demo up and get the pythong stuff working cleanly. The 
raw C++ stuff works fine, but the python script needs cleaning up. At some 
point I wanted to poke around in the coprocessing plugin and see if the crud 
could be removed from the trace/state files. Maybe someone from kitware is 
reading this and can comment...

ttfn

JB



-----Original Message-----
From: paraview-boun...@paraview.org [mailto:paraview-boun...@paraview.org] On 
Behalf Of Thomas Kipling
Sent: 14 December 2010 15:53
To: paraview@paraview.org
Subject: [Paraview] low level C++ example how to communicate with pvserver

Hi!

Is it possible to use Paraview as kind of a visualization library? Without Qt 
GUI and without python interpreter?

I am looking for a C++ code example which demonstrates how to
* connect to an (already running) pvserver instance
* add a sphere source (or any other source)
* render the sphere
* grab the rendered image as byte array

My biggest problem is how to initialize the application and how to connect to a 
pvserver on port 11111. The applications in 
ParaView/Examples/CustomApplications 

all implement a Qt GUI. The batch processing application pvbatch.cxx executes a 
python script from a file, but it doesn't show how I can work with 
ServerManager 

objects in the C++ code. The book "ParaView Guide" suggests the use of 
vtkSMApplication to initialize the connection to a pvserver, but I can't seem 
to 

connect successfully.

Do you have examples that demonstrate the above four steps (or some of them) at 
a rather basic level?
(I mentioned "without python interpreter". What I mean is that the 
visualization 

should be defined using methods of ServerManager objects, not through 
interpreted python code. It is no problem, if another python interpreter is 
running in the background to process the client-server communication.)

Regards,
Thomas



_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

Reply via email to