[Paraview-developers] SOADataArray Templates and Catalyst fail to work

Staufer, Max Max.Staufer at Rolls-Royce.com
Wed Sep 7 11:16:39 EDT 2016


Hi Dave,


  I think I messed up my example, the one below is the correct one, sorry about that.
Using the SetNumberOfTuples method, actually leads to a direct crash, and did not find any reason
why it should be necessary, because on the simulation side the pointers are correctly pointing to the data.
Only on the Client side there is a problem.
I left the MaxId update to the default, the question here would be, what value should it be.
If I turn it on, the Maxid of the SOADataArray rises to 3*size of the component array + 1, which is sort of what I would expect.
Is that the correct value?
Secondly, by updating the Maxid, I got the data transfer correct for the first processor but not for the other ones.

Any thoughts

-----------------
extern "C" void addvectorfieldsoa_(float* vector0,float* vector1,float* vector2, char* name) {

   vtkCPInputDataDescription* idd = vtkCPPythonAdaptorAPI::GetCoProcessorData()->GetInputDescriptionByName("input");

     vtkUnstructuredGrid* VTKgrid = vtkUnstructuredGrid::SafeDownCast(idd->GetGrid());

     if (!VTKgrid) {
       vtkGenericWarningMacro("No adaptor grid to attach field data to.");
       return;
     }

     if (idd->IsFieldNeeded(name)) {
       vtkSOADataArrayTemplate<float>* field =
             vtkSOADataArrayTemplate<float>::SafeDownCast(VTKgrid->GetCellData()->GetArray(name));

       if (!field) {
         // vector array
         vtkSOADataArrayTemplate<float>* field = vtkSOADataArrayTemplate<float>::New();
         field->SetNumberOfComponents(3);
       //field->SetNumberOfTuples(VTKgrid->GetNumberOfCells());
         field->SetName(name);
         field->SetArray(0, vector0, VTKgrid->GetNumberOfCells(), false, true);
         field->SetArray(1, vector1, VTKgrid->GetNumberOfCells(), false, true);
         field->SetArray(2, vector2, VTKgrid->GetNumberOfCells(), false, true);
         VTKgrid->GetCellData()->AddArray(field);
         field->Delete();
       }
       else {
         field->SetArray(0, vector0, VTKgrid->GetNumberOfCells(), false, true);
         field->SetArray(1, vector1, VTKgrid->GetNumberOfCells(), false, true);
         field->SetArray(2, vector2, VTKgrid->GetNumberOfCells(), false, true);
       }
     }
}

-----Original Message-----
From: David Lonie [mailto:david.lonie at kitware.com]
Sent: Mittwoch, 7. September 2016 15:38
To: Staufer, Max
Cc: paraview-developers at paraview.org
Subject: Re: [Paraview-developers] SOADataArray Templates and Catalyst fail to work

Hi Max,

I'm having some trouble following your example code:

On Wed, Sep 7, 2016 at 4:13 AM, Staufer, Max <Max.Staufer at rolls-royce.com> wrote:
> However, pushing vector data to the client does not () , the pointer
> in the SOA -> AOS Structure works fine on the coprocessor side, but the Paraview client displays only random garbage.
>
> // Add a vector field to the VTK data container using
> SOADataArrayTemplate extern "C" void addvectorfieldsoa_(float* vector0,float* vector1,float* vector2, char* name) {
>    vtkCPInputDataDescription* idd =
> vtkCPPythonAdaptorAPI::GetCoProcessorData()->GetInputDescriptionByName
> ("input");
>
>      vtkUnstructuredGrid* VTKgrid =
> vtkUnstructuredGrid::SafeDownCast(idd->GetGrid());
>
>      if (!VTKgrid) {
>        vtkGenericWarningMacro("No adaptor grid to attach field data to.");
>        return;
>      }
>
>      if (idd->IsFieldNeeded(name)) {
>        //vtkSOADataArrayTemplate<float>* field = //vtkSOADataArrayTemplate<float>::SafeDownCast(VTKgrid->GetCellData()->GetArray(name));
>        vtkFloatArray* field = vtkFloatArray::SafeDownCast(
>          VTKgrid->GetCellData()->GetArray(name));
>        if (!field) {
>
>          // vector array
>          vtkSOADataArrayTemplate<float>* field = vtkSOADataArrayTemplate<float>::New();
>          field->SetNumberOfComponents(3); //field->SetNumberOfTuples(VTKgrid->GetNumberOfCells());
>          field->SetName(name);
>          field->SetArray(vector0, 3*VTKgrid->GetNumberOfCells(), 1);

There is no method in vtkSOADataArrayTemplate that matches the signature of the above call (in this scope, 'field' is a vtkSOADataArrayTemplate<float>).

>          field->SetArray(0, vector0, VTKgrid->GetNumberOfCells(), false, true);
>          field->SetArray(1, vector1, VTKgrid->GetNumberOfCells(), false, true);
>          field->SetArray(2, vector2, VTKgrid->GetNumberOfCells(), false, true);
>          VTKgrid->GetCellData()->AddArray(field);
>          field->Delete();
>        }
>        else {
>          field->SetArray(0, vector0, VTKgrid->GetNumberOfCells(), false, true);
>          field->SetArray(1, vector1, VTKgrid->GetNumberOfCells(), false, true);
>          field->SetArray(2, vector2, VTKgrid->GetNumberOfCells(),
> false, true);

There is no method in vtkFloatArray that matches the above signature (in this scope, 'field' is a vtkFloatArray).

>        }
>      }
> }

Is this the actual code? I'd be surprised if it compiles. I suspect that if the compiler is allowing the above, it's getting confused about the shadowed 'field' variable and doing Very Bad Things instead of throwing an error. Does renaming the new array to an unused identifier help anything?

Otherwise, I'd try iterating through the data in the raw pointers and the data in the data array and print out the values. That might provide some clues as to what's going wrong.

Also, I see that you've commented out SetNumberOfTuples, and also pass 'false' as the updateMaxId argument to SetArray. The array will think that it's empty in this situation, which is probably not what you want.

HTH,
Dave
Rolls-Royce Deutschland Ltd & Co KG Sitz/Registered Office: Blankenfelde-Mahlow, Deutschland, Registergericht/Court of Register: Amtsgericht Potsdam, HRA 2731 P, Persönlich haftende Gesellschafterin/General Partner: Rolls-Royce General Partner Limited, Sitz/Registered Office: Derby, United Kingdom, Register: Registry of Companies Wales and England, 4066556, Directors/Geschäftsführer: Paul O’Neil, Alastair McIntosh, Nicole Fehr, Dr. Holger Cartsburg Confidentiality Notice: This email and any attachments are confidential to the intended recipient and may also be privileged. If you are not the intended recipient please delete it from your system and notify the sender. You should not copy it or use it for any purpose nor disclose or distribute its contents to any other person.
The data contained in, or attached to, this e-mail, may contain confidential information. If you have received it in error you should notify the sender immediately by reply e-mail, delete the message from your system and contact +44 (0) 3301235850 (Security Operations Centre) if you need assistance. Please do not copy it for any purpose, or disclose its contents to any other person.

An e-mail response to this address may be subject to interception or monitoring for operational reasons or for lawful business practices.

(c) 2016 Rolls-Royce plc

Registered office: 62 Buckingham Gate, London SW1E 6AT Company number: 1003142. Registered in England.


More information about the Paraview-developers mailing list