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 "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.</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'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->GetOutputDataObject(0);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">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,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->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'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<vtkMultiBlockDataSet> & 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<vtkCellDataToPointData> c2p = vtkSmartPointer<vtkCellDataToPointData>::New();</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> c2p->DebugOn();</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> c2p->SetInput(multiBlockDataSet);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> c2p->PassCellDataOff();</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> c2p->Update();</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> std::cout<<"c2p->Print(std::cout)"<<std::endl;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> c2p->Print(std::cout);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> c2p->UpdateInformation();</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> c2p->UpdateWholeExtent();</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> std::cout << "c2p->GetTotalNumberOfInputConnections = " << c2p->GetTotalNumberOfInputConnections()<<std::endl;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> std::cout << "c2p->GetNumberOfInputPorts = " << c2p->GetNumberOfInputPorts()<<std::endl;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> std::cout << "c2p->GetNumberOfOutputPorts = " << c2p->GetNumberOfOutputPorts()<<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<vtkDataObject> dataObj = vtkSmartPointer<vtkDataObject>::New();</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> std::cout <<"H1"<<std::endl;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> dataObj = c2p->GetOutputDataObject(0);</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> std::cout <<"H2"<<std::endl;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> dataObj->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<vtkUnstructuredGrid> unstructuredGrid = vtkSmartPointer<vtkUnstructuredGrid>::New();</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> unstructuredGrid = c2p->GetUnstructuredGridOutput();</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> std::cout <<"H3"<<std::endl;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> std::cout<<"unstructuredGrid->GetNumberOfCells = "<<unstructuredGrid->GetNumberOfCells()<<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<<"unstructuredGrid->GetNumberOfPoints = "<<unstructuredGrid->GetNumberOfPoints()<<std::endl;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> std::cout <<"H4"<<std::endl;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> unstructuredGrid->Print(std::cout);</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> std::cout <<"H5"<<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>