]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
bos #20256 [CEA 18523] Porting SMESH to int 64 bits occ/20256_v2
authoreap <eap@opencascade.com>
Thu, 22 Apr 2021 09:47:42 +0000 (12:47 +0300)
committereap <eap@opencascade.com>
Thu, 22 Apr 2021 09:47:42 +0000 (12:47 +0300)
 fix regression in CGNS caused by rebase to master

src/DriverCGNS/DriverCGNS_Read.cxx
src/DriverCGNS/DriverCGNS_Write.cxx

index 86aae7294094c0446d6912ef726e0c4c214edd89..5afdfa3e7d1d2d9db8cb26f24c579a66822db3ea 100644 (file)
@@ -552,9 +552,9 @@ namespace
     nbNodes = ids[0];
     ++ids;
 #endif
-    vector<smIdType> idVec( ids[0] );
-    for ( int i = 0; i < ids[0]; ++i )
-      idVec[ i ] = ToSmIdType( ids[ i + 1]);
+    vector<smIdType> idVec( nbNodes );
+    for ( int i = 0; i < nbNodes; ++i )
+      idVec[ i ] = ToSmIdType( ids[ i ]);
     return mesh->AddPolygonalFaceWithID( idVec, ToSmIdType(ID) );
   }
 
@@ -892,6 +892,8 @@ Driver_Mesh::Status DriverCGNS_Read::Perform()
         curAddElemFun = addElemFuns[ elemType ];
         SMDS_MeshElement* newElem = 0;
         const SMDS_MeshElement* face;
+        vector<int> quantities;
+        vector<const SMDS_MeshNode*> nodes, faceNodes;
 
         while ( pos < eDataSize )
         {
@@ -923,9 +925,8 @@ Driver_Mesh::Status DriverCGNS_Read::Perform()
                 //                       Face1M, Face2M, ... FaceNM
                 nbFaces = polyOffset[ iElem + 1 ] - polyOffset[ iElem ];
 
-              vector<int> quantities( nbFaces );
-              vector<const SMDS_MeshNode*> nodes, faceNodes;
-              nodes.reserve( nbFaces * 4 );
+              quantities.resize( nbFaces ); quantities.back() = 0;
+              nodes.clear();                nodes.reserve( nbFaces * 4 );
               for ( int iF = 0; iF < nbFaces; ++iF )
               {
                 const int faceID = std::abs( elemData[ pos++ ]) + zone._elemIdShift;
@@ -947,6 +948,7 @@ Driver_Mesh::Status DriverCGNS_Read::Perform()
                 }
                 else {
                   polyhedError = true;
+                  pos += nbFaces - iF - 1;
                   break;
                 }
               }
index 9320b826ac675f902802c7b482322e9e04635dcf..bdedf770bf0f443b612f352d3ba0e39afcaeeff7 100644 (file)
@@ -474,7 +474,7 @@ Driver_Mesh::Status DriverCGNS_Write::Perform()
                             cgID-1, /*nbndry=*/0, elemData.data(), &iSec) != CG_OK )
         return addMessage( cg_get_error(), /*fatal = */true );
     }
-  }
+  } // while ( elem )
 
   // Write polyhedral volumes
   // -------------------------