<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)">
<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;}
span.st
        {mso-style-name:st;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@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:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">The interpolated velocity field classes are not written as filters. They are for internal use within other specialized classes like the stream/pathline filters.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Can you explain what you want to achieve at a more filter-like level?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">JB<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> vtkusers-bounces@vtk.org [mailto:vtkusers-bounces@vtk.org]
<b>On Behalf Of </b>Guillaume Jacquenot<br>
<b>Sent:</b> 19 January 2012 12:32<br>
<b>To:</b> vtkusers@vtk.org<br>
<b>Subject:</b> [vtkusers] VTK C&#43;&#43; : How to perform a velocity interpolation computation from a vtkMultiBlockDataSet with celldata?<o:p></o:p></span></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Dear all,<br>
<br>
My objective is to retrieve a velocity vector from an interpolation computation from a
<span style="font-family:&quot;Courier New&quot;">vtkMultiBlockDataSet with 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:&quot;Courier New&quot;"> vtkInterpolatedVelocityField or vtkCellLocatorInterpolatedVelocityField</span><br>
To do so, I see that i have to create an instance of <span style="font-family:&quot;Courier New&quot;">
vtkInterpolatedVelocityField or vtkCellLocatorInterpolatedVelocityField</span><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;"> and use the method
</span><span style="font-family:&quot;Courier New&quot;">addDataSet </span><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">to feed this instance.<br>
I have tried to do so with dataSet contained in my vtkMultiBlockDataSet. However, the method FunctionValues always returned &quot;Can'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.<br>
I know that I have to use the class </span><em><span style="font-family:&quot;Courier New&quot;">vtkCellDataToPointData</span></em><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">, but I don't manage to retrieve the result and send it as input to an instance of
</span><span style="font-family:&quot;Courier New&quot;">vtkInterpolatedVelocityField </span>
<span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">or vtkCellLocatorInterpolatedVelocityField.<br>
<em><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">vtkCellDataToPointData is a sub-class of vtkAlgorithm</span></em>, and I have seen it is nice to work with inputport, outputport methods.<br>
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:&quot;Courier New&quot;">
vtkCellDataToPointData to an instance of vtkInterpolatedVelocityField </span><br>
<br>
I have tried unsuccessfully the method <span style="font-family:&quot;Courier New&quot;">GetOutputDataObject and GetUnstructuredGridOutput on a instance of vtkCellDataToPointData
</span>. Cause the program to crash.<br>
<span style="font-family:&quot;Courier New&quot;">dataObj = c2p-&gt;GetOutputDataObject(0);<br>
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:&quot;Courier New&quot;">vtkMultiBlockDataSet from the cell data?
</span>That means that I add point data to my <span style="font-family:&quot;Courier New&quot;">
vtkMultiBlockDataSet</span> containing cell data, with algorithm <span style="font-family:&quot;Courier New&quot;">
vtkCellDataToPointData</span>. If possible, I guess I can use the method addDataset from
<span style="font-family:&quot;Courier New&quot;">vtkInterpolatedVelocityField.</span><br>
- Can I work directy on a <span style="font-family:&quot;Courier New&quot;">vtkMultiBlockDataSet with vtkCellDataToPointData on my function presented below, ie use c2p-&gt;SetInput(vtkMultiBlockDataSet) where c2p is
</span>a <span style="font-family:&quot;Courier New&quot;">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&nbsp; <span style="font-family:&quot;Courier New&quot;">
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't know for time being, if it will return a modified version of
<span style="font-family:&quot;Courier New&quot;">multiBlockDataSet, with cell data, or if it will return
</span>an instance of <span style="font-family:&quot;Courier New&quot;">vtkInterpolatedVelocityField
</span><br>
<br>
<span style="font-family:&quot;Courier New&quot;">void convertCellDataToPointData(vtkSmartPointer&lt;vtkMultiBlockDataSet&gt; &amp; multiBlockDataSet)<br>
{<br>
&nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkCellDataToPointData&gt; c2p = vtkSmartPointer&lt;vtkCellDataToPointData&gt;::New();<br>
&nbsp;&nbsp;&nbsp; c2p-&gt;DebugOn();<br>
&nbsp;&nbsp;&nbsp; c2p-&gt;SetInput(multiBlockDataSet);<br>
&nbsp;&nbsp;&nbsp; c2p-&gt;PassCellDataOff();<br>
&nbsp;&nbsp;&nbsp; c2p-&gt;Update();<br>
&nbsp;&nbsp;&nbsp; std::cout&lt;&lt;&quot;c2p-&gt;Print(std::cout)&quot;&lt;&lt;std::endl;<br>
&nbsp;&nbsp;&nbsp; c2p-&gt;Print(std::cout);<br>
&nbsp;&nbsp;&nbsp; c2p-&gt;UpdateInformation();<br>
&nbsp;&nbsp;&nbsp; c2p-&gt;UpdateWholeExtent();<br>
&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; &quot;c2p-&gt;GetTotalNumberOfInputConnections = &quot; &lt;&lt; c2p-&gt;GetTotalNumberOfInputConnections()&lt;&lt;std::endl;<br>
&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; &quot;c2p-&gt;GetNumberOfInputPorts&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = &quot; &lt;&lt; c2p-&gt;GetNumberOfInputPorts()&lt;&lt;std::endl;<br>
&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; &quot;c2p-&gt;GetNumberOfOutputPorts&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = &quot; &lt;&lt; c2p-&gt;GetNumberOfOutputPorts()&lt;&lt;std::endl;<br>
<br>
&nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkDataObject&gt; dataObj = vtkSmartPointer&lt;vtkDataObject&gt;::New();<br>
&nbsp;&nbsp;&nbsp; std::cout &lt;&lt;&quot;H1&quot;&lt;&lt;std::endl;<br>
&nbsp;&nbsp;&nbsp; dataObj = c2p-&gt;GetOutputDataObject(0);<br>
&nbsp;&nbsp;&nbsp; std::cout &lt;&lt;&quot;H2&quot;&lt;&lt;std::endl;<br>
&nbsp;&nbsp;&nbsp; dataObj-&gt;Print(std::cout); // Crash vtkStreamingDemandDrivenPipeline</span> : Algorithm vtkCellDataToPointData ...<span style="font-family:&quot;Courier New&quot;"><br>
<br>
&nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkUnstructuredGrid&gt; unstructuredGrid = vtkSmartPointer&lt;vtkUnstructuredGrid&gt;::New();<br>
&nbsp;&nbsp;&nbsp; unstructuredGrid = c2p-&gt;GetUnstructuredGridOutput();<br>
&nbsp;&nbsp;&nbsp; std::cout &lt;&lt;&quot;H3&quot;&lt;&lt;std::endl;<br>
&nbsp;&nbsp;&nbsp; std::cout&lt;&lt;&quot;unstructuredGrid-&gt;GetNumberOfCells&nbsp;&nbsp; = &quot;&lt;&lt;unstructuredGrid-&gt;GetNumberOfCells()&lt;&lt;std::endl; // Crash vtkStreamingDemandDrivenPipeline</span> : Algorithm vtkCellDataToPointData ...<span style="font-family:&quot;Courier New&quot;"><br>
&nbsp;&nbsp;&nbsp; std::cout&lt;&lt;&quot;unstructuredGrid-&gt;GetNumberOfPoints&nbsp; = &quot;&lt;&lt;unstructuredGrid-&gt;GetNumberOfPoints()&lt;&lt;std::endl;<br>
&nbsp;&nbsp;&nbsp; std::cout &lt;&lt;&quot;H4&quot;&lt;&lt;std::endl;<br>
&nbsp;&nbsp;&nbsp; unstructuredGrid-&gt;Print(std::cout);<br>
&nbsp;&nbsp;&nbsp; std::cout &lt;&lt;&quot;H5&quot;&lt;&lt;std::endl;<br>
}</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<o:p></o:p></p>
</div>
</body>
</html>