[Paraview] Invoke remote procedure from proxy with argument and return value

Mario Schreiber schreibermario40 at gmail.com
Sun Dec 11 12:01:01 EST 2016


Why is it so complicated to call a procedure and receive a return value on
the client?

I am attaching my attempt (CMakeLists.txt, vtkSquareFun.cxx, vtkSquareFun.h
and TestPlugin.xml, each less than 20 lines of code), which basically
calculates the square of an argument in vtkSquareFun::eval(double x).

When I load this plugin in Paraview and open the Python Shell, I can
evaluate vtkSquareFun::eval() using a detour by first setting the argument
and then getting the result, which is linked to the argument property in
TestPlugin.xml:

fun=servermanager.CreateProxy("test","SquareFun")
fun.GetProperty("Arg").SetElement(0,999)
fun.UpdateVTKObjects()
fun.UpdatePropertyInformation()
fun.GetProperty("Result").GetElement(0)
... showing the correct result 998001.

Why can't I simply run the following?
fun=servermanager.CreateProxy("test","SquareFun")
result=fun.InvokeCommand("eval",[999.0])

Does Paraview really not provide any means of calling a function with
arguments and return value within a single client-server communication? All
these individual message transfers are a bottleneck in our application.
Does the Paraview architecture exclude more universal remote procedure
calls, or do you think that one could just augment the available procedures
with another procedure that can deliver a set of custom return values?

Thanks
Mario


2016-12-07 7:34 GMT+01:00 Mario Schreiber <schreibermario40 at gmail.com>:

> Hello,
> I have a use case, where a vtkObject on the server implements a method like
>
> std::string doSomething(std::string arg);
>
> Now, with a proxy prx on the client for  that class, I would like to call
> the remote procedure similar to
>
> result=prx.InvokeCommand("doSomething",[arg])
>
> Is something like this possible?
> I found a very complicated workaround by first defining the arguments as
> properties, defining the result as information_only property linked to on
> of the args, then calling "UpdateVTKObjects" to push the arguments and
> finally "UpdateInformationProperties" to pull the result. Is there an
> easier solution, possible with a short example?
>
> Thank you
> Mario
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20161211/f5c3a113/attachment.html>
-------------- next part --------------
FIND_PACKAGE(ParaView REQUIRED)
INCLUDE(${PARAVIEW_USE_FILE})

ADD_PARAVIEW_PLUGIN(TestPlugin "1.0"
  SERVER_MANAGER_XML TestPlugin.xml
  SERVER_MANAGER_SOURCES vtkSquareFun.cxx
)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestPlugin.xml
Type: text/xml
Size: 625 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/paraview/attachments/20161211/f5c3a113/attachment.xml>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkSquareFun.cxx
Type: text/x-c++src
Size: 311 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/paraview/attachments/20161211/f5c3a113/attachment.cxx>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkSquareFun.h
Type: text/x-chdr
Size: 421 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/paraview/attachments/20161211/f5c3a113/attachment.h>


More information about the ParaView mailing list