[vtkusers] Problem in VTK program during release mode
marees waran
nmar_143 at yahoo.co.in
Wed Mar 30 00:07:52 EST 2005
hai,
i am new to VTK and i am builting vtk in VC++.i am passing polydata and nNoOfCells(totalnumber of cells present in polydata,it is an integer, pass it as callby value) to function present in one file to function present in another file. Before passing it to that function i deepcopy the polydata and passing the duplicate copy only.in that function i am not doing any modification, just write the details of polydata into the file(Points,Color details and cell details). After coming out of the function when i try to access the polydata details it gives Exception, breaks in middle and also nNoOfCells(totalnumber of cells)count is changed , i tried with both the original and duplicate polydata it gives same exception.my code is running perfectly in debug mode, in release mode only it gives that exception. it is problem with VTK or in my code.Follwing is my code.
File 1:
--------
DataObject *pObject = pDataNode->GetObjectNode();
vtkPolyData *pPolyData = vtkPolyData::New();
pPolyData->DeepCopy(pObject->GetPolyData());
vtkPolyData *pPoly = vtkPolyData::New();
pPoly->DeepCopy(pPolyData);
int nNoOfCells = pPoly->GetNumberOfCells();
WriteToFile->WritePloyData (pPoly,nNoOfCells)
char strtemp[256];
VJINT nT = pPolyData->GetNumberOfCells();
swprintf(strtemp,_T("Number Of Cells (Original):%d\r\n"),nT);
MessageBox(NULL,strtemp,_T("Number Of Cells"),MB_OK);
swprintf(strtemp,_T("Number Of Cells (nNoOfCells):%d\r\n"),nNoOfCells);
MessageBox(NULL,strtemp,_T("Number Of Cells"),MB_OK);
FILE 2:
-------
void WritePolyData (vtkPolyData *pPoly, int nNoOfCells)
{
vtkPoints *pPoints = vtkPoints::New();
pPoints->DeepCopy( pPolya->Points );
pPoly->BuildLinks();
pPoly->BuildCells();
VJINT nNoOfPoints = pPoints->GetNumberOfPoints();
fprintf( m_pFile, "%d\t", nNoOfPoints );
int Point[3]
for( VJINT nIndex = 0; nIndex < nNoOfPoints; nIndex++ )
{
//Get the Point Details
pPoints->GetPoint( nIndex, dXYZ );
fprintf( m_pFile, "%lf\t", dXYZ[0] );
fprintf( m_pFile, "%lf\t", dXYZ[1] );
fprintf( m_pFile, "%lf\t", dXYZ[2] );
//Get color value
dColor = pScalar->GetTuple3( nIndex );
fprintf( m_pFile, "%lf\t", dColor[0] );
fprintf( m_pFile, "%lf\t", dColor[1] );
fprintf( m_pFile, "%lf\t", dColor[2] );
}
for( VJINT nIndex = 0; nIndex < nNoOfCells; nIndex++ )
{
//GetCell Details
CellID = nIndex;
vtkCell* pCell = m_pMeshPolyData->GetCell( nIndex );
for( VJINT nVertexCount = 0; nVertexCount < 3; nVertexCount ++ )
{
Point[nVertexCount] = pCell->GetPointId( nVertexCount );
}
fprintf( m_pFile, "%d\t", nCellID );
fprintf( m_pFile, "%d\t", Point[0] );
fprintf( m_pFile, "%d\t", Point[1] );
fprintf( m_pFile, "%d\t", Point[2] );
}
pPoly->DeleteLinks();
pPoly->DeleteCells();
}
---------------------------------
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050329/d5a08c0f/attachment.htm>
More information about the vtkusers
mailing list