Dear all,<br><br>My objective is to retrieve a velocity vector from an interpolation computation from a <span style="font-family:courier new,monospace">vtkMultiBlockDataSet with </span><span style="font-family:courier new,monospace">vtkUnstructuredGrid</span> containing velocity vectors.<br>
My velocity vectors are located at the center of cells, not the points.<br>I managed to retrieve the velocity vector from a cell with vtkCellLocator.<br>However I want more accurate results, and thus perform data interpolation, depending on the requested point.<br>
<br>For this, I want to use the class<span style="font-family:courier new,monospace"> vtkInterpolatedVelocityField or vtkCellLocatorInterpolatedVelocityField</span><br>To do so, I see that i have to create an instance of <span style="font-family:courier new,monospace">vtkInterpolatedVelocityField or vtkCellLocatorInterpolatedVelocityField<span style="font-family:arial,helvetica,sans-serif"> and use the method <span style="font-family:courier new,monospace">addDataSet </span>to feed this instance.</span><br style="font-family:arial,helvetica,sans-serif">
<span style="font-family:arial,helvetica,sans-serif">I have tried to do so with dataSet contained in my </span></span><span style="font-family:arial,helvetica,sans-serif">vtkMultiBlockDataSet. However, the method FunctionValues always returned &quot;Can&#39;t evaluate dataset&quot;. I figured out that message was sent because my data are located at cell-centered not point-centered.<br>
Therefore I want to convert my cell-centered data to point-centered data.</span><br style="font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif">I know that I have to use the class </span><span style="font-family:courier new,monospace" class="st"><em>vtkCellDataToPointData</em></span><span style="font-family:arial,helvetica,sans-serif">, but I don&#39;t manage to retrieve the result and send it as input to an instance of <span style="font-family:courier new,monospace">vtkInterpolatedVelocityField </span>or vtkCellLocatorInterpolatedVelocityField.<br>
</span><span style="font-family:arial,helvetica,sans-serif" class="st"><em>vtkCellDataToPointData is a sub-class of vtkAlgorithm</em></span><span style="font-family:arial,helvetica,sans-serif">, and I have seen it is nice to work with inputport, outputport methods.</span><br style="font-family:arial,helvetica,sans-serif">
<span style="font-family:arial,helvetica,sans-serif">However, class vtkInterpolatedVelocityField is a sub-class of vtkFiltering, and does not have such connexion methods.<br><br></span>The general question is how to pass result from an instance of <span style="font-family:courier new,monospace">vtkCellDataToPointData to an instance of </span><span style="font-family:courier new,monospace">vtkInterpolatedVelocityField </span><br>
<br>I have tried unsuccessfully the method <span style="font-family:courier new,monospace">GetOutputDataObject and </span><span style="font-family:courier new,monospace">GetUnstructuredGridOutput on a instance of </span><span style="font-family:courier new,monospace">vtkCellDataToPointData </span>. Cause the program to crash.<br>
<span style="font-family:courier new,monospace">dataObj = c2p-&gt;GetOutputDataObject(0);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">unstructuredGrid = c2p-&gt;GetUnstructuredGridOutput();</span><br>
<br>More precisely, my questions are the followings:<br>- Can I add &quot;inplace&quot; point data to a <span style="font-family:courier new,monospace">vtkMultiBlockDataSet from the cell data? </span>That means that I add point data to my <span style="font-family:courier new,monospace">vtkMultiBlockDataSet</span> containing cell data, with algorithm <span style="font-family:courier new,monospace">vtkCellDataToPointData</span>. If possible, I guess I can use the method addDataset from <span style="font-family:courier new,monospace"></span><span style="font-family:courier new,monospace">vtkInterpolatedVelocityField.</span><br>
- Can I work directy on a <span style="font-family:courier new,monospace">vtkMultiBlockDataSet with </span><span style="font-family:courier new,monospace">vtkCellDataToPointData </span><span style="font-family:courier new,monospace">on my function presented below, ie use </span><span style="font-family:courier new,monospace">c2p-&gt;SetInput(vtkMultiBlockDataSet) where c2p is </span>a <span style="font-family:courier new,monospace">vtkCellDataToPointData?<br>
</span><br><br>Below is the function I want to develop with VTK 5.8. It compiles, but crashes at run time.<br>The vtkOuputWindow reports a problem with vtkExecutive at line 756.cxx  <span style="font-family:courier new,monospace">vtkStreamingDemandDrivenPipeline</span> : Algorithm vtkCellDataToPointData ...<br>
However on Windows, I cant read all the error message, and report it here.<br>For time being, the function does not return anything. I don&#39;t know for time being, if it will return a modified version of <span style="font-family:courier new,monospace">multiBlockDataSet, with cell data, or if it will return </span>an instance of <span style="font-family:courier new,monospace">vtkInterpolatedVelocityField </span><br>
<br><span style="font-family:courier new,monospace">void convertCellDataToPointData(vtkSmartPointer&lt;vtkMultiBlockDataSet&gt; &amp; multiBlockDataSet)</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">{</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">    vtkSmartPointer&lt;vtkCellDataToPointData&gt; c2p = vtkSmartPointer&lt;vtkCellDataToPointData&gt;::New();</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    c2p-&gt;DebugOn();</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">    c2p-&gt;SetInput(multiBlockDataSet);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    c2p-&gt;PassCellDataOff();</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">    c2p-&gt;Update();</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    std::cout&lt;&lt;&quot;c2p-&gt;Print(std::cout)&quot;&lt;&lt;std::endl;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">    c2p-&gt;Print(std::cout);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    c2p-&gt;UpdateInformation();</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">    c2p-&gt;UpdateWholeExtent();</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    std::cout &lt;&lt; &quot;c2p-&gt;GetTotalNumberOfInputConnections = &quot; &lt;&lt; c2p-&gt;GetTotalNumberOfInputConnections()&lt;&lt;std::endl;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">    std::cout &lt;&lt; &quot;c2p-&gt;GetNumberOfInputPorts            = &quot; &lt;&lt; c2p-&gt;GetNumberOfInputPorts()&lt;&lt;std::endl;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">    std::cout &lt;&lt; &quot;c2p-&gt;GetNumberOfOutputPorts           = &quot; &lt;&lt; c2p-&gt;GetNumberOfOutputPorts()&lt;&lt;std::endl;</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    vtkSmartPointer&lt;vtkDataObject&gt; dataObj = vtkSmartPointer&lt;vtkDataObject&gt;::New();</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">    std::cout &lt;&lt;&quot;H1&quot;&lt;&lt;std::endl;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    dataObj = c2p-&gt;GetOutputDataObject(0);</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">    std::cout &lt;&lt;&quot;H2&quot;&lt;&lt;std::endl;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    dataObj-&gt;Print(std::cout); // Crash vtkStreamingDemandDrivenPipeline</span> : Algorithm vtkCellDataToPointData ...<br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    vtkSmartPointer&lt;vtkUnstructuredGrid&gt; unstructuredGrid = vtkSmartPointer&lt;vtkUnstructuredGrid&gt;::New();</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">    unstructuredGrid = c2p-&gt;GetUnstructuredGridOutput();</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    std::cout &lt;&lt;&quot;H3&quot;&lt;&lt;std::endl;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">    std::cout&lt;&lt;&quot;unstructuredGrid-&gt;GetNumberOfCells   = &quot;&lt;&lt;unstructuredGrid-&gt;GetNumberOfCells()&lt;&lt;std::endl; // Crash </span><span style="font-family:courier new,monospace">vtkStreamingDemandDrivenPipeline</span> : Algorithm vtkCellDataToPointData ...<br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">    std::cout&lt;&lt;&quot;unstructuredGrid-&gt;GetNumberOfPoints  = &quot;&lt;&lt;unstructuredGrid-&gt;GetNumberOfPoints()&lt;&lt;std::endl;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">    std::cout &lt;&lt;&quot;H4&quot;&lt;&lt;std::endl;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    unstructuredGrid-&gt;Print(std::cout);</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">    std::cout &lt;&lt;&quot;H5&quot;&lt;&lt;std::endl;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">}</span><br>
<br>I work with version 5.8 of VTK. I use Win32.<br><br>Thanks for considering my problem.<br>Maybe an example can be generated on the VTK wiki from my problem.<br><br>Guillaume Jacquenot<br>