Main Page/ParaView 4.0

From ParaQ Wiki
Jump to navigationJump to search

What are the changes in ParaView 4

vtkSMMessage management

Sample code to invoke method on the VTK object of a Proxy

  vtkSMMessage msg;
  msg.set_global_id( proxy->GetGlobalID() );
  msg.set_location( proxy->GetLocation() );
  msg << pvstream::InvokeRequest() << "MethodName" << arg1 << arg2;
  session.Invoke(&msg);
  vtkSMMessage msg;
  msg.set_global_id( proxy->GetGlobalID() );
  msg.set_location( proxy->GetLocation() );
  msg << pvstream::InvokeRequestNoWarning() << "CanReadFile" << filename;
  session.Invoke(&msg);
  
  if (!msg.GetExtension(InvokeResponse::error))
    {
    int canRead = msg.GetExtension(InvokeResponse::arguments).variant(0).integer(0);
    }
  

XML Proxy definition

The XML is used to define the Proxy API. The new version of ParaView tries to rationalize the proxy definition and management as well as reducing the number of Proxy specific class when custom behavior are needed. In fact, property helper have been fully removed and replaced by using a server-side only class that take care of that property management. Moreover, some proxy need re-initialization after the creation time or after each call. Therefore some post hooks have been added so automatic trigger can be set on a given specific method.

The following XML illustrate those hooks syntax.

  <Proxy name="PVLookupTable"
                post_push="Build"
               class="vtkDiscretizableColorTransferFunction"
               processes="dataserver|renderserver|client" >
   ...
  
  <Proxy name="DistanceRepresentation2D"
                class="vtkDistanceRepresentation2D"
                post_create="InstantiateHandleRepresentation">
   ...

Property helpers

There is no helper anymore...

Old helper name vs New kernel class name Compatible SMProperty type Before After
vtkSMIntArrayInformationHelper

vtkSMDoubleArrayInformationHelper vtkSMStringArrayHelper vtkPMDataArrayProperty

vtkSMStringVectorProperty/vtkStringArray,

vtkSMIntVectorProperty/vtkIntArray, vtkSMStringVectorProperty/vtkDoubleArray

<DoubleVectorProperty 
            name="XXX"
            information_only="1">
     <DoubleArrayInformationHelper/>
</DoubleVectorProperty>
<DoubleVectorProperty 
            name="XXX"
            information_only="1"
            kernel_class="vtkPMDataArrayProperty" /> 
TimeStepsInformationHelper vtkPMTimeStepsProperty vtkSMDoubleVectorProperty
<DoubleVectorProperty 
            name="TimestepValues"
            information_only="1">
     <TimeStepsInformationHelper/>
</DoubleVectorProperty>
<DoubleVectorProperty 
            name="TimestepValues"
            information_only="1"
            kernel_class="vtkPMTimeStepsProperty" />
TimeRangeInformationHelper vtkPMTimeRangeProperty vtkSMDoubleVectorProperty
<DoubleVectorProperty 
            name="TimeRange"
            information_only="1">
     <TimeRangeInformationHelper/>
</DoubleVectorProperty>
<DoubleVectorProperty 
            name="TimeRange"
            information_only="1"
            kernel_class="vtkPMTimeRangeProperty" />
SILInformationHelper vtkPMSILProperty vtkSMStringVectorProperty
<StringVectorProperty 
            name="ElementBlocksInfo"
            information_only="1">
     <SILInformationHelper subtree="Blocks"/>
</DoubleVectorProperty>
<StringVectorProperty 
            name="ElementBlocksInfo"
            information_only="1"
            kernel_class="vtkPMSILProperty"
            subtree="Blocks"
            />
ArraySelectionInformationHelper vtkPMArraySelectionProperty vtkSMStringVectorProperty
<StringVectorProperty name="SelectArrayInfo" information_only="1">
  <ArraySelectionInformationHelper attribute_name="Attribute"/> 
</StringVectorProperty>
<StringVectorProperty
      name="SelectArrayInfo"
      information_only="1"
      kernel_class="vtkPMArraySelectionProperty"
      command="Attribute" />