[Paraview] How to pass array from Server to Client with as 'Information Helper"

Michael Jackson mike.jackson at bluequartz.net
Fri Mar 26 16:36:06 EDT 2010


The problem is down in a generated file on the server side.

   if (!strcmp("GetNeighborList",method) &&  
msg.GetNumberOfArguments(0) == 3)
     {
     vtkClientServerStreamDataArg<int    > temp0(msg, 0, 2);
     if(temp0)
       {
       op->GetNeighborList(temp0);
       return 1;
       }
     }

The problem is that msg.GetNumberOfArguments(0) returns 2 and NOT 3. I  
have no idea of the internals of the msg object to try and figure out  
what is trying to be passed. Is the client sending in a index also? 2  
pointers? no idea.

I'll just assume from this that it is basically impossible to pass an  
array from the server to the Client in an "Information Only" fashion.  
I guess I can encode the values to a string and send that. Seems odd  
to have to encode the data into a string...

If anyone else has a better Idea I would much appreciate it.
___________________________________________________________
Mike Jackson                      www.bluequartz.net
Principal Software Engineer       mike.jackson at bluequartz.net
BlueQuartz Software               Dayton, Ohio


On Mar 26, 2010, at 3:23 PM, Michael Jackson wrote:

> I have a custom reader. Part of the reader is getting a  
> "NeighborList" which is an vtkIntArray object although I have  
> declared the following methods in my "reader" class:
>
>  int* GetNeighborList();
>  void GetNeighborList(int* list);
>  vtkIdType GetNumberOfNeighbors();
>
> And in my ServerManagerXML file I have the following:
>      <IntVectorProperty name="NeighborList"
>        command="GetNeighborList"
>        argument_is_array="1"
>        number_of_elements="0"
>        repeat_command="0"
>        number_of_elements_per_command="1"
>        use_index="0" >
>        <SimpleIntInformationHelper />
>        <Documentation>
>            This property lists the neighbors of the grain
>          </Documentation>
>        </IntVectorProperty>
>
> On the Client side I have the following bit of code to populate a  
> QListWidget:
>
> void pqH5TiDataReaderPanel::updateNeighborList(QListWidget*  
> qListWidget, QString property)
> {
>  vtkSMProperty* smProperty = this->proxy()- 
> >GetProperty(property.toAscii());
>  if (NULL == smProperty)
>  {
>    std::string msg = "SMProperty [int] was NULL for ";
>    msg.append(property.toAscii() );
>    DebugTrace(<< msg.c_str() );
>    return;
>  }
>  vtkSMIntVectorProperty* intProperty
>                    = vtkSMIntVectorProperty::SafeDownCast(smProperty);
>  if (NULL == intProperty)
>  {
>    std::string msg = "Could not SafeDownCase to  
> vtkSMIntVectorProperty for property ";
>    msg.append(property.toAscii() );
>    DebugTrace(<< msg.c_str() );
>    return;
>  }
>  //intProperty->GetArgumentIsArray();
>  int* elements = intProperty->GetElements();
>  int nElements = intProperty->GetNumberOfElements(); //<== ALWAYS 0
>  qListWidget->clear();  // Remove all the content
>
>  for (int i = 0; i < nElements; ++i)
>  {
>    qListWidget->addItem(QString::number(elements[i])); //<==== NEVER  
> GETS HERE
>  }
> }
>
> So, what am I doing wrong? I have tried reading through the relevant  
> sections of the "ParaView Guide" but nothing is really jumping out.  
> Also went looking for examples somewhere in the ParaView source code  
> but came up empty. The ContourWidget is close but it "sends" its  
> array, it never receives one from the server.
>
> Any pointers would be great and much appreciated.
> ___________________________________________________________
> Mike Jackson                      www.bluequartz.net
> Principal Software Engineer       mike.jackson at bluequartz.net
> BlueQuartz Software               Dayton, Ohio
>
>



More information about the ParaView mailing list