From: rnv Date: Mon, 10 Jan 2011 15:38:48 +0000 (+0000) Subject: Fix for the 21125: EDF 1233 SMESH: Degrardation of precision in a test case for quadr... X-Git-Tag: StartingPortingMED3~169 X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=commitdiff_plain;h=96cbac20480e2cb492d4f26cfd609c11a1ee8389 Fix for the 21125: EDF 1233 SMESH: Degrardation of precision in a test case for quadratic conversion. --- diff --git a/src/SMDS/SMDS_Mesh.cxx b/src/SMDS/SMDS_Mesh.cxx index 792e3e221..ab63d6280 100644 --- a/src/SMDS/SMDS_Mesh.cxx +++ b/src/SMDS/SMDS_Mesh.cxx @@ -154,6 +154,9 @@ SMDS_Mesh::SMDS_Mesh() myGrid->Initialize(); myGrid->Allocate(); vtkPoints* points = vtkPoints::New(); + // rnv: to fix bug "21125: EDF 1233 SMESH: Degrardation of precision in a test case for quadratic conversion" + // using double type for storing coordinates of nodes instead float. + points->SetDataType(VTK_DOUBLE); points->SetNumberOfPoints(SMDS_Mesh::chunkSize); myGrid->SetPoints( points ); points->Delete(); @@ -2503,6 +2506,9 @@ void SMDS_Mesh::Clear() myGrid->Initialize(); myGrid->Allocate(); vtkPoints* points = vtkPoints::New(); + // rnv: to fix bug "21125: EDF 1233 SMESH: Degrardation of precision in a test case for quadratic conversion" + // using double type for storing coordinates of nodes instead float. + points->SetDataType(VTK_DOUBLE); points->SetNumberOfPoints(SMDS_Mesh::chunkSize); myGrid->SetPoints( points ); points->Delete(); diff --git a/src/SMDS/SMDS_UnstructuredGrid.cxx b/src/SMDS/SMDS_UnstructuredGrid.cxx index 2db632a74..ec30d5b64 100644 --- a/src/SMDS/SMDS_UnstructuredGrid.cxx +++ b/src/SMDS/SMDS_UnstructuredGrid.cxx @@ -160,6 +160,9 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector& idNodesOldToNew, int n { MESSAGE("-------------- compactGrid, newNodeSize " << newNodeSize); newPoints = vtkPoints::New(); + // rnv: to fix bug "21125: EDF 1233 SMESH: Degrardation of precision in a test case for quadratic conversion" + // using double type for storing coordinates of nodes instead float. + newPoints->SetDataType(VTK_DOUBLE); newPoints->Initialize(); newPoints->Allocate(newNodeSize); newPoints->SetNumberOfPoints(newNodeSize); @@ -371,7 +374,7 @@ void SMDS_UnstructuredGrid::copyNodes(vtkPoints *newPoints, std::vector& id int nbPoints = end - start; if (nbPoints > 0) { - memcpy(target, source, 3 * sizeof(float) * nbPoints); + memcpy(target, source, 3 * sizeof(double) * nbPoints); for (int j = start; j < end; j++) idNodesOldToNew[j] = alreadyCopied++; // old vtkId --> new vtkId //idNodesOldToNew[alreadyCopied++] = idNodesOldToNew[j]; // new vtkId --> old SMDS id