<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:"Calibri","sans-serif";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:"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">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:"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">JB<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"><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""> 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++ : How to perform a velocity interpolation computation from a vtkMultiBlockDataSet with celldata?<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </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:"Courier New"">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:"Courier New""> vtkInterpolatedVelocityField or vtkCellLocatorInterpolatedVelocityField</span><br>
To do so, I see that i have to create an instance of <span style="font-family:"Courier New"">
vtkInterpolatedVelocityField or vtkCellLocatorInterpolatedVelocityField</span><span style="font-family:"Arial","sans-serif""> and use the method
</span><span style="font-family:"Courier New"">addDataSet </span><span style="font-family:"Arial","sans-serif"">to feed this instance.<br>
I have tried to do so with dataSet contained in my vtkMultiBlockDataSet. However, the method FunctionValues always returned "Can't evaluate dataset". 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:"Courier New"">vtkCellDataToPointData</span></em><span style="font-family:"Arial","sans-serif"">, but I don't manage to retrieve the result and send it as input to an instance of
</span><span style="font-family:"Courier New"">vtkInterpolatedVelocityField </span>
<span style="font-family:"Arial","sans-serif"">or vtkCellLocatorInterpolatedVelocityField.<br>
<em><span style="font-family:"Arial","sans-serif"">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:"Courier New"">
vtkCellDataToPointData to an instance of vtkInterpolatedVelocityField </span><br>
<br>
I have tried unsuccessfully the method <span style="font-family:"Courier New"">GetOutputDataObject and GetUnstructuredGridOutput on a instance of vtkCellDataToPointData
</span>. Cause the program to crash.<br>
<span style="font-family:"Courier New"">dataObj = c2p->GetOutputDataObject(0);<br>
unstructuredGrid = c2p->GetUnstructuredGridOutput();</span><br>
<br>
More precisely, my questions are the followings:<br>
- Can I add "inplace" point data to a <span style="font-family:"Courier New"">vtkMultiBlockDataSet from the cell data?
</span>That means that I add point data to my <span style="font-family:"Courier New"">
vtkMultiBlockDataSet</span> containing cell data, with algorithm <span style="font-family:"Courier New"">
vtkCellDataToPointData</span>. If possible, I guess I can use the method addDataset from
<span style="font-family:"Courier New"">vtkInterpolatedVelocityField.</span><br>
- Can I work directy on a <span style="font-family:"Courier New"">vtkMultiBlockDataSet with vtkCellDataToPointData on my function presented below, ie use c2p->SetInput(vtkMultiBlockDataSet) where c2p is
</span>a <span style="font-family:"Courier New"">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"">
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:"Courier New"">multiBlockDataSet, with cell data, or if it will return
</span>an instance of <span style="font-family:"Courier New"">vtkInterpolatedVelocityField
</span><br>
<br>
<span style="font-family:"Courier New"">void convertCellDataToPointData(vtkSmartPointer<vtkMultiBlockDataSet> & multiBlockDataSet)<br>
{<br>
vtkSmartPointer<vtkCellDataToPointData> c2p = vtkSmartPointer<vtkCellDataToPointData>::New();<br>
c2p->DebugOn();<br>
c2p->SetInput(multiBlockDataSet);<br>
c2p->PassCellDataOff();<br>
c2p->Update();<br>
std::cout<<"c2p->Print(std::cout)"<<std::endl;<br>
c2p->Print(std::cout);<br>
c2p->UpdateInformation();<br>
c2p->UpdateWholeExtent();<br>
std::cout << "c2p->GetTotalNumberOfInputConnections = " << c2p->GetTotalNumberOfInputConnections()<<std::endl;<br>
std::cout << "c2p->GetNumberOfInputPorts = " << c2p->GetNumberOfInputPorts()<<std::endl;<br>
std::cout << "c2p->GetNumberOfOutputPorts = " << c2p->GetNumberOfOutputPorts()<<std::endl;<br>
<br>
vtkSmartPointer<vtkDataObject> dataObj = vtkSmartPointer<vtkDataObject>::New();<br>
std::cout <<"H1"<<std::endl;<br>
dataObj = c2p->GetOutputDataObject(0);<br>
std::cout <<"H2"<<std::endl;<br>
dataObj->Print(std::cout); // Crash vtkStreamingDemandDrivenPipeline</span> : Algorithm vtkCellDataToPointData ...<span style="font-family:"Courier New""><br>
<br>
vtkSmartPointer<vtkUnstructuredGrid> unstructuredGrid = vtkSmartPointer<vtkUnstructuredGrid>::New();<br>
unstructuredGrid = c2p->GetUnstructuredGridOutput();<br>
std::cout <<"H3"<<std::endl;<br>
std::cout<<"unstructuredGrid->GetNumberOfCells = "<<unstructuredGrid->GetNumberOfCells()<<std::endl; // Crash vtkStreamingDemandDrivenPipeline</span> : Algorithm vtkCellDataToPointData ...<span style="font-family:"Courier New""><br>
std::cout<<"unstructuredGrid->GetNumberOfPoints = "<<unstructuredGrid->GetNumberOfPoints()<<std::endl;<br>
std::cout <<"H4"<<std::endl;<br>
unstructuredGrid->Print(std::cout);<br>
std::cout <<"H5"<<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>