<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Just to illustrate,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Blow is a really small Simulation of a flow in a cavity.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Left Render window shows Velocity_X component of the SOADataArray made up from U V W scalar arrays, right shows U (Velocity_X component) set in catalyst as
 scalar float array.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">It’s a two processor run. The Processor0 values look fine while the processor1 values don’t.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><img width="1252" height="735" id="Picture_x0020_1" src="cid:image001.png@01D209D0.8ADBBDB0"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Paraview-developers [mailto:paraview-developers-bounces@paraview.org]
<b>On Behalf Of </b>Staufer, Max<br>
<b>Sent:</b> Donnerstag, 8. September 2016 09:47<br>
<b>To:</b> Andy Bauer; David Lonie<br>
<b>Cc:</b> paraview-developers@paraview.org<br>
<b>Subject:</b> [CAUTION - EXTERNAL SENDER]: Re: [Paraview-developers] SOADataArray Templates and Catalyst fail to work<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi Andy,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">  correct, simulation side is the catalyst instrumented code, client side is the Paraview GUI for live processing.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I have to admit, that I did not look into the Paraview part yet, but the fact that all scalar arrays aka. “standard” float arrays,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">one and multiple components, are displayed correctly, when ordered correctly in C ordering, but the SOAArray is only displayed correctly
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">for the first processor, tells me that there is probably something wrong on the client, receiving end.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">On that front, what is the role of maxid in a multiprocessor scenario ?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Max
<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Andy Bauer [<a href="mailto:andy.bauer@kitware.com">mailto:andy.bauer@kitware.com</a>]
<br>
<b>Sent:</b> Mittwoch, 7. September 2016 21:04<br>
<b>To:</b> David Lonie<br>
<b>Cc:</b> Staufer, Max; <a href="mailto:paraview-developers@paraview.org">paraview-developers@paraview.org</a><br>
<b>Subject:</b> Re: [Paraview-developers] SOADataArray Templates and Catalyst fail to work<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Hi Max,<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">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?<o:p></o:p></p>
</div>
<p class="MsoNormal">Cheers,<o:p></o:p></p>
</div>
<p class="MsoNormal">Andy<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Wed, Sep 7, 2016 at 11:39 AM, David Lonie <<a href="mailto:david.lonie@kitware.com" target="_blank">david.lonie@kitware.com</a>> wrote:<o:p></o:p></p>
<p class="MsoNormal">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>
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>
<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>
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>
<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>
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<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal"><br>
> -----------------<br>
> extern "C" void addvectorfieldsoa_(float* vector0,float* vector1,float* vector2, char* name) {<br>
><br>
>    vtkCPInputDataDescription* idd = vtkCPPythonAdaptorAPI::GetCoProcessorData()->GetInputDescriptionByName("input");<br>
><br>
>      vtkUnstructuredGrid* VTKgrid = vtkUnstructuredGrid::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>* field =<br>
>              vtkSOADataArrayTemplate<float>::SafeDownCast(VTKgrid->GetCellData()->GetArray(name));<br>
><br>
>        if (!field) {<br>
>          // vector array<br>
>          vtkSOADataArrayTemplate<float>* field = vtkSOADataArrayTemplate<float>::New();<br>
>          field->SetNumberOfComponents(3);<br>
>        //field->SetNumberOfTuples(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()->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.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.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::GetCoProcessorData()->GetInputDescriptionByName<br>
>> ("input");<br>
>><br>
>>      vtkUnstructuredGrid* VTKgrid =<br>
>> vtkUnstructuredGrid::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>* field = //vtkSOADataArrayTemplate<float>::SafeDownCast(VTKgrid->GetCellData()->GetArray(name));<br>
>>        vtkFloatArray* field = vtkFloatArray::SafeDownCast(<br>
>>          VTKgrid->GetCellData()->GetArray(name));<br>
>>        if (!field) {<br>
>><br>
>>          // vector array<br>
>>          vtkSOADataArrayTemplate<float>* field = vtkSOADataArrayTemplate<float>::New();<br>
>>          field->SetNumberOfComponents(3); //field->SetNumberOfTuples(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>).<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()->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>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">
http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=Paraview-developers" target="_blank">
http://markmail.org/search/?q=Paraview-developers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/paraview-developers" target="_blank">http://public.kitware.com/mailman/listinfo/paraview-developers</a><o:p></o:p></p>
</div>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">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. <o:p></o:p></p>
<p><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.<o:p></o:p></p>
<p>An e-mail response to this address may be subject to interception or monitoring for operational reasons or for lawful business practices.<o:p></o:p></p>
<p>(c) 2016 Rolls-Royce plc<o:p></o:p></p>
<p>Registered office: 62 Buckingham Gate, London SW1E 6AT Company number: 1003142. Registered in England.<o:p></o:p></p>
</div>
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.
<P><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.</P>
<P>An e-mail response to this address may be subject to interception or monitoring for operational reasons or for lawful business practices.</P>
<P>(c) 2016 Rolls-Royce plc</P><span lang=EN-GB>
<P dir=ltr align=left>Registered office: 62 Buckingham Gate, London SW1E 6AT Company number: 1003142. Registered in England.</span></P></body>
</html>