<div dir="ltr"><div><div><div>Hi Max,<br><br></div>I'm a bit confused as to what you mean by server side and client side for this. Are you connecting your Catalyst instrumented simulation with the ParaView GUI through the Live functionality?<br><br></div>Cheers,<br></div>Andy<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 7, 2016 at 11:39 AM, David Lonie <span dir="ltr"><<a href="mailto:david.lonie@kitware.com" target="_blank">david.lonie@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wed, Sep 7, 2016 at 11:16 AM, Staufer, Max<br>
<<a href="mailto:Max.Staufer@rolls-royce.com">Max.Staufer@rolls-royce.com</a>> wrote:<br>
> I think I messed up my example, the one below is the correct one, sorry about that.<br>
> Using the SetNumberOfTuples method, actually leads to a direct crash, and did not find any reason<br>
> why it should be necessary, because on the simulation side the pointers are correctly pointing to the data.<br>
<br>
</span>I suspect there may be an issue because you're redeclaring the 'field'<br>
identifier inside the 'if (!field)' branch. Most compilers will handle<br>
such cases as expected, but it's worth trying to change the name of<br>
the variable for the new array in case the compiler is getting<br>
confused -- e.g, it may be resolving the SetNumberOfTuples call to the<br>
wrong 'field' pointer. SetNumberOfTuples should always be safe to call<br>
on a valid array, so the crash is suspicious.<br>
<br>
Either SetNumberOfTuples or SetArray with updateMaxId=true is<br>
required, because otherwise the dataarray is unaware of how many valid<br>
elements the buffer contains and will assume 0.<br>
<span class=""><br>
> Only on the Client side there is a problem.<br>
> I left the MaxId update to the default, the question here would be, what value should it be.<br>
> 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.<br>
> Is that the correct value?<br>
<br>
</span>The expected value of the MaxId variable is ((numComps * numTuples) -<br>
1). I'm not sure how you'd get ((numComps * numTuples) + 1).<br>
<br>
You can either call SetNumberOfComponents + SetNumberOfTuples to set<br>
MaxId, or SetNumberOfComponents and SetArray with updateMaxId = true.<br>
Either way will give the same result in this case. I'd advise using<br>
SetArray in this case simply to avoid unnecessary memory allocations<br>
(SetNumberOfTuples triggers a memory allocation for the array data,<br>
which will be immediately released when SetArray is called).<br>
<span class=""><br>
> Secondly, by updating the Maxid, I got the data transfer correct for the first processor but not for the other ones.<br>
><br>
> Any thoughts<br>
<br>
</span>I'd try using a different variable identifier than 'field' for the<br>
array created in the branch. There seems to be something fishy going<br>
on there with this compiler. Also use updateMaxId = true in this case.<br>
<br>
If there's some sort of MPI (or similar) data transfer happening after<br>
this, there may be an issue there. I'm not terribly familiar with<br>
Catalyst, so someone else might need to take a look if this doesn't<br>
resolve your problem.<br>
<br>
HTH,<br>
Dave<br>
<div class="HOEnZb"><div class="h5"><br>
> -----------------<br>
> extern "C" void addvectorfieldsoa_(float* vector0,float* vector1,float* vector2, char* name) {<br>
><br>
> vtkCPInputDataDescription* idd = vtkCPPythonAdaptorAPI::<wbr>GetCoProcessorData()-><wbr>GetInputDescriptionByName("<wbr>input");<br>
><br>
> vtkUnstructuredGrid* VTKgrid = vtkUnstructuredGrid::<wbr>SafeDownCast(idd->GetGrid());<br>
><br>
> if (!VTKgrid) {<br>
> vtkGenericWarningMacro("No adaptor grid to attach field data to.");<br>
> return;<br>
> }<br>
><br>
> if (idd->IsFieldNeeded(name)) {<br>
> vtkSOADataArrayTemplate<float><wbr>* field =<br>
> vtkSOADataArrayTemplate<float><wbr>::SafeDownCast(VTKgrid-><wbr>GetCellData()->GetArray(name))<wbr>;<br>
><br>
> if (!field) {<br>
> // vector array<br>
> vtkSOADataArrayTemplate<float><wbr>* field = vtkSOADataArrayTemplate<float><wbr>::New();<br>
> field->SetNumberOfComponents(<wbr>3);<br>
> //field->SetNumberOfTuples(<wbr>VTKgrid->GetNumberOfCells());<br>
> field->SetName(name);<br>
> field->SetArray(0, vector0, VTKgrid->GetNumberOfCells(), false, true);<br>
> field->SetArray(1, vector1, VTKgrid->GetNumberOfCells(), false, true);<br>
> field->SetArray(2, vector2, VTKgrid->GetNumberOfCells(), false, true);<br>
> VTKgrid->GetCellData()-><wbr>AddArray(field);<br>
> field->Delete();<br>
> }<br>
> else {<br>
> field->SetArray(0, vector0, VTKgrid->GetNumberOfCells(), false, true);<br>
> field->SetArray(1, vector1, VTKgrid->GetNumberOfCells(), false, true);<br>
> field->SetArray(2, vector2, VTKgrid->GetNumberOfCells(), false, true);<br>
> }<br>
> }<br>
> }<br>
><br>
> -----Original Message-----<br>
> From: David Lonie [mailto:<a href="mailto:david.lonie@kitware.com">david.lonie@kitware.<wbr>com</a>]<br>
> Sent: Mittwoch, 7. September 2016 15:38<br>
> To: Staufer, Max<br>
> Cc: <a href="mailto:paraview-developers@paraview.org">paraview-developers@paraview.<wbr>org</a><br>
> Subject: Re: [Paraview-developers] SOADataArray Templates and Catalyst fail to work<br>
><br>
> Hi Max,<br>
><br>
> I'm having some trouble following your example code:<br>
><br>
> On Wed, Sep 7, 2016 at 4:13 AM, Staufer, Max <<a href="mailto:Max.Staufer@rolls-royce.com">Max.Staufer@rolls-royce.com</a>> wrote:<br>
>> However, pushing vector data to the client does not () , the pointer<br>
>> in the SOA -> AOS Structure works fine on the coprocessor side, but the Paraview client displays only random garbage.<br>
>><br>
>> // Add a vector field to the VTK data container using<br>
>> SOADataArrayTemplate extern "C" void addvectorfieldsoa_(float* vector0,float* vector1,float* vector2, char* name) {<br>
>> vtkCPInputDataDescription* idd =<br>
>> vtkCPPythonAdaptorAPI::<wbr>GetCoProcessorData()-><wbr>GetInputDescriptionByName<br>
>> ("input");<br>
>><br>
>> vtkUnstructuredGrid* VTKgrid =<br>
>> vtkUnstructuredGrid::<wbr>SafeDownCast(idd->GetGrid());<br>
>><br>
>> if (!VTKgrid) {<br>
>> vtkGenericWarningMacro("No adaptor grid to attach field data to.");<br>
>> return;<br>
>> }<br>
>><br>
>> if (idd->IsFieldNeeded(name)) {<br>
>> //vtkSOADataArrayTemplate<<wbr>float>* field = //vtkSOADataArrayTemplate<<wbr>float>::SafeDownCast(VTKgrid-><wbr>GetCellData()->GetArray(name))<wbr>;<br>
>> vtkFloatArray* field = vtkFloatArray::SafeDownCast(<br>
>> VTKgrid->GetCellData()-><wbr>GetArray(name));<br>
>> if (!field) {<br>
>><br>
>> // vector array<br>
>> vtkSOADataArrayTemplate<float><wbr>* field = vtkSOADataArrayTemplate<float><wbr>::New();<br>
>> field->SetNumberOfComponents(<wbr>3); //field->SetNumberOfTuples(<wbr>VTKgrid->GetNumberOfCells());<br>
>> field->SetName(name);<br>
>> field->SetArray(vector0, 3*VTKgrid->GetNumberOfCells(), 1);<br>
><br>
> There is no method in vtkSOADataArrayTemplate that matches the signature of the above call (in this scope, 'field' is a vtkSOADataArrayTemplate<float><wbr>).<br>
><br>
>> field->SetArray(0, vector0, VTKgrid->GetNumberOfCells(), false, true);<br>
>> field->SetArray(1, vector1, VTKgrid->GetNumberOfCells(), false, true);<br>
>> field->SetArray(2, vector2, VTKgrid->GetNumberOfCells(), false, true);<br>
>> VTKgrid->GetCellData()-><wbr>AddArray(field);<br>
>> field->Delete();<br>
>> }<br>
>> else {<br>
>> field->SetArray(0, vector0, VTKgrid->GetNumberOfCells(), false, true);<br>
>> field->SetArray(1, vector1, VTKgrid->GetNumberOfCells(), false, true);<br>
>> field->SetArray(2, vector2, VTKgrid->GetNumberOfCells(),<br>
>> false, true);<br>
><br>
> There is no method in vtkFloatArray that matches the above signature (in this scope, 'field' is a vtkFloatArray).<br>
><br>
>> }<br>
>> }<br>
>> }<br>
><br>
> 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?<br>
><br>
> 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.<br>
><br>
> 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.<br>
><br>
> HTH,<br>
> Dave<br>
> 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.<br>
> 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.<br>
><br>
> An e-mail response to this address may be subject to interception or monitoring for operational reasons or for lawful business practices.<br>
><br>
> (c) 2016 Rolls-Royce plc<br>
><br>
> Registered office: 62 Buckingham Gate, London SW1E 6AT Company number: 1003142. Registered in England.<br>
______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=Paraview-developers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>Paraview-developers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/paraview-developers" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/paraview-<wbr>developers</a><br>
</div></div></blockquote></div><br></div>