[vtkusers] probe of multiblock PLOT3D data
Aurélien Marsan
aur.marsan at gmail.com
Tue Oct 18 04:40:00 EDT 2011
Godd morning,
I think you should probe one block after the other, and add the probe
results.
That is the solution I've found in order to probe a point in a
MultiBlockDataSet.
Aurélien
2011/10/14 Hamilton Woods <ghw at accutrol.com>
> I'm not sure how this mailing list works. There were several
> "responses" to my earlier post of this message, none related
> to my question.
>
> I basically want to know how to probe points for data at locations
> that are in other than block 1 of a PLOT3D file.
>
> I have a pair of PLOT3D files (.xyz and .q) that has more than
> one block of data. Paraview displays the data nicely. I can
> even do a PlotOverLine through block 1 and block 2.
>
> When I try to probe data using VTK in C++ the data in block
> 2 are missing. If I delete the block 1 coordinates and data
> and re-fire, I am able to probe data.
>
> Is there a trick to probing data in multiblock PLOT3D data
> that is necessary in VTK that is not necessary in Paraview?
>
> Here is a code snippet:
>
> vtkPLOT3DReader* reader = vtkPLOT3DReader::New();
> reader->SetBinaryFile(0);
> reader->SetMultiGrid(1);
> reader->SetXYZFileName(geometryFile.c_str());
> reader->SetQFileName(qFile.c_str());
> reader->SetScalarFunctionNumber(100);
> reader->Update();
>
> vtkSmartPointer<vtkPolyData> probePolyData =
> vtkSmartPointer<vtkPolyData>::New();
> vtkSmartPointer<vtkProbeFilter> probe =
> vtkSmartPointer<vtkProbeFilter>::New();
> //probe->SetSource(image);
> probe->SetSourceConnection(reader->GetOutputPort());
>
> probePoints = vtkSmartPointer<vtkPoints>::New();
>
> for (iLine=0; iLine<nLines; ++iLine)
> {
>
> probePoints->Initialize();
> // Add some points to interpolate
> fracx =
> (StopPoints[iLine].x-StartPoints[iLine].x)/double(NPoints-1);
> fracy =
> (StopPoints[iLine].y-StartPoints[iLine].y)/double(NPoints-1);
> fracz =
> (StopPoints[iLine].z-StartPoints[iLine].z)/double(NPoints-1);
> for (iPoint=0; iPoint<NPoints; ++iPoint)
> {
> di = double(iPoint);
> x = StartPoints[iLine].x + di*fracx;
> y = StartPoints[iLine].y + di*fracy;
> z = StartPoints[iLine].z + di*fracz;
> probePoints->InsertNextPoint(x, y, z);
> }
>
> probePolyData->Initialize();
> probePolyData->SetPoints(probePoints);
>
> probe->SetInput(probePolyData);
> probe->Update();
>
> vtkDataArray* data =
> probe->GetOutput()->GetPointData()->GetScalars();
> vtkDoubleArray* doubleData = vtkDoubleArray::SafeDownCast
> (data);
>
> NumDataPoints = data->GetDataSize();
> integratedDensity = 0.0;
> //outData << iLine << endl;
> ds = sqrt(pow(fracx,2)+pow(fracy,2)+pow(fracz,2));
> s = sqrt(pow(StartPoints[iLine].x-StopPoints[iLine].x,2)
> +pow(StartPoints[iLine].y-StopPoints[iLine].y,2)
> +pow(StartPoints[iLine].z-StopPoints[iLine].z,2));
> data->GetTuple(0, val);
> rhom1 = val[0];
> for(int i = 1; i < NumDataPoints; ++i)
> {
> data->GetTuple(i, val);
> // cout << "Interpolation using
> ProbeFilter ";
> // cout <<
> "doubleData->GetValue(" << i << "): " << val[0] << endl;
> //outData << i << "\t" << val[0] << endl;
> rho = val[0];
> integratedDensity += (rho+rhom1)*ds/2.0;
> rhom1 = rho;
> }
> }
>
> Thanks for your help,
> Hamilton Woods
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111018/1655433f/attachment.htm>
More information about the vtkusers
mailing list