Like I mentioned earlier this week, I have a piece of code like such:<br><div style="margin-left: 40px;"><span style="font-family: courier new,monospace;">#include <stdio.h></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">#include <vtkPLYReader.h></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">#include <vtkXMLPPolyDataWriter.h
></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">#include <vtkCallbackCommand.h></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
#include <vtkCommand.h></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">#include <sys/types.h></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
#include <time.h></span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
static void ShowProgress( vtkObject *caller,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> unsigned long vtkNotUsed(eventId), void *, void *av)</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;"> double amount;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> time_t theTime;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> char *strtime ;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> time(&theTime);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> strtime = asctime(localtime(&theTime));
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> strtime[strlen(strtime)-1] = '\0';</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
amount = *((double*)av);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> printf("\t%s: %s at %.1f%% Completion\n", strtime,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> caller->GetClassName(), (amount)*100.0);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">}</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">int main (int argc, char *argv[]) {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> printf("Reading \"%s\"...\n", argv[1]);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> vtkCallbackCommand *vtkProgress = vtkCallbackCommand::New();
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> vtkProgress->SetCallback(ShowProgress);</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> vtkPLYReader *reader = vtkPLYReader::New();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
reader->SetFileName(argv[1]);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> reader->AddObserver(vtkCommand::ProgressEvent, vtkProgress);</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> printf("Writing \"%s\"...\n", argv[2]);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
vtkXMLPPolyDataWriter *writer = vtkXMLPPolyDataWriter::New();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> writer->AddObserver(vtkCommand::ProgressEvent, vtkProgress);
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> writer->SetInput(reader->GetOutput());</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
writer->SetFileName(argv[2]);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> writer->SetNumberOfPieces(24);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> writer->WriteSummaryFileOn();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> writer->SetStartPiece(0);
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> writer->SetEndPiece(23);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
writer->SetGhostLevel(0);</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> printf("Here we go...\n");
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> writer->Write();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
}</span><br></div><br>Basically, I connect vtkPLYReader to a vtkXMLPPolyDataWriter to split a file into 24 chunks for better parallelism in Paraview. The PLY file easily loads, consuming ~4G of Ram (I've got 32G here, so no problems there). But heres the process output:
<br><br clear="all"><div style="margin-left: 40px;"><span style="font-family: courier new,monospace;">[1005] [rhand@ruby:src/experiments/conv2pvtp] </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[9:17:33am]% ./main /Work/rhand/coloredvertex-newyorkcity.ply /Work/rhand/pvtp/city.pvtp</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
Reading "/Work/rhand/coloredvertex-newyorkcity.ply"...</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Writing "/Work/rhand/pvtp/city.pvtp"...</span>
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Here we go...</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> Wed Jan 18 09:17:47 2006: vtkPLYReader at
0.0% Completion</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> Wed Jan 18 09:28:55 2006: vtkPLYReader at 100.0% Completion</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> Wed Jan 18 09:28:55 2006: vtkXMLPPolyDataWriter at 0.0% Completion</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
Wed Jan 18 09:28:55 2006: vtkXMLPPolyDataWriter at 0.0% Completion</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> Wed Jan 18 09:33:11 2006: vtkXMLPPolyDataWriter at
1.0% Completion</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> Wed Jan 18 09:50:50 2006: vtkXMLPPolyDataWriter at 2.0% Completion</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> Wed Jan 18 10:07:05 2006: vtkXMLPPolyDataWriter at 3.0% Completion</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
Wed Jan 18 10:23:48 2006: vtkXMLPPolyDataWriter at 4.0% Completion</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> Wed Jan 18 10:44:23 2006: vtkPLYReader at
0.0% Completion</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> Wed Jan 18 10:55:28 2006: vtkPLYReader at 100.0% Completion</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Assertion failed: index < this->Internals.size(), file /viz/home/rhand/src/VTK/vtk-ezviz/VTK/IO/vtkOffsetsManagerArray.h, line 140, pid /70683</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Abort</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[1006] [rhand@ruby:src/experiments/conv2pvtp]
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[10:55:29am]% ls /Work/rhand/pvtp/ -lah<br>total 585M<br>drwxr----- 2 rhand staff 52 Jan 18 10:55 .<br>
drwxrwxr-x 12 rhand erdcvsta 64k Jan 18 08:47 ..<br>-rw-r----- 1 rhand staff 584M Jan 18 10:44 city_0.vtp<br>-rw-r----- 1 rhand staff 1.5k Jan 18 10:55 city_1.vtp<br><br><br><br></span>
<br></div>So it seems to have written the first file, but died shortly into the second file. city_0.vtp seems to contain the entire dataset. See the following:<br>for the input PLY file:<br><div style="margin-left: 40px; font-family: courier new,monospace;">
[1066] [rhand@prism:/Work/rhand] <br>[11:31:25am]% head coloredvertex-newyorkcity.ply --lines=12<br>ply<br>format binary_little_endian 1.0<br>comment VTK generated PLY File<br>
obj_info vtkPolyData points and polygons: vtk4.0<br>element vertex <span style="font-weight: bold;">24969475</span><br>property float x<br>property float y<br>property float z<br>property uchar red<br>property uchar green
<br>property uchar blue<br>element face <span style="font-weight: bold;">50335280</span><br></div><br>and <br><div style="margin-left: 40px;"><span style="font-family: courier new,monospace;">[1062] [rhand@prism:/Work/rhand/pvtp]
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[11:29:32am]% head city_0.vtp</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
<?xml version="1.0"?></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"><VTKFile type="PolyData" version="0.1" byte_order="BigEndian" compressor="vtkZLibDataCompressor">
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> <PolyData></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
<Piece NumberOfPoints="<span style="font-weight: bold;">24969475</span>" NumberOfVerts="0" NumberOfLines="0" NumberOfStrips="0" NumberOfPolys="
<span style="font-weight: bold;">50335280</span>" ></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> <PointData Scalars="RGB"></span>
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> <DataArray type="UInt8" Name="RGB" NumberOfComponents="3" format="appended" offset="0" />
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </PointData></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
<CellData></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </CellData></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
<Points></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[1063] [rhand@prism:/Work/rhand/pvtp] </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[11:29:36am]% head city_1.vtp</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"><?xml ve NumberOfPoints="<span style="font-weight: bold;">
24969475</span>"="PolyData" version="0 NumberOfStrips="0"Endian" compressor="vtkZLibDataCompressor"></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
<PolyData></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> <Piece NumberOfPoints="" NumberOfVerts="" NumberOfLines="" NumberOfStrips="" NumberOfPolys="" >
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> <PointData Scalars="RGB"></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
<DataArray type="UInt8" Name="RGB" NumberOfComponents="3" format="appended" offset="" /></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
</PointData></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> <CellData></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
</CellData></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> <Points></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="" /></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
[1064] [rhand@prism:/Work/rhand/pvtp] </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[11:30:14am]%</span><br style="font-family: courier new,monospace;">
</div><br>Not sure why the header is scrambled on the city_1.vtp, I double checked. This isn't a cut-n-paste error, the header was written to the file like that. The last thing in the city_1.vtp is the AppendedData tag, followed by about 4 bytes of binary junk, even though it says it's base64 encoded.
<br><br>So, any ideas what's going on? I'm using the latest of the VTK-5-0 branch, on an SGI Irix, compiled in 64-bit mode.<br><br><br>-- <br>Randall Hand<br>Visualization Scientist, <br>ERDC-MSRC Vicksburg, MS<br>Homepage:
<a href="http://www.yeraze.com">http://www.yeraze.com</a>