]> SALOME platform Git repositories - plugins/ghs3dplugin.git/commitdiff
Salome HOME
Fix int64 connectivity in readGMFFile cbr/fix_int64_readgmffile
authorChristophe Bourcier <christophe.bourcier@cea.fr>
Wed, 17 May 2023 05:56:09 +0000 (07:56 +0200)
committerChristophe Bourcier <christophe.bourcier@cea.fr>
Wed, 17 May 2023 05:56:09 +0000 (07:56 +0200)
src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx

index fbc5bf17f57965b46d08b012b7ac03c3efb046f0..11682bb50b881aebab901e2264b81fafa5d78167 100644 (file)
@@ -730,7 +730,9 @@ static bool readGMFFile(MG_Tetra_API*                   MGOutput,
     else
       continue;
 
-    std::vector<int> id (nbElem*tabRef[token]); // node ids
+    // Connectivity table
+    // Use smIdType to allow above int64 limit
+    std::vector<smIdType> id (nbElem*tabRef[token]); // node ids
     std::vector<int> domainID( nbElem ); // domain
 
     if (token == GmfVertices) {
@@ -786,32 +788,51 @@ static bool readGMFFile(MG_Tetra_API*                   MGOutput,
     else if (token == GmfCorners && nbElem > 0) {
       (nbElem <= 1) ? tmpStr = " corner" : tmpStr = " corners";
       for ( int iElem = 0; iElem < nbElem; iElem++ )
-        MGOutput->GmfGetLin( InpMsh, token, &id[iElem*tabRef[token]]);
+        MGOutput->GmfGetLin( InpMsh, token,
+                             reinterpret_cast<int*>(&id[iElem*tabRef[token]]));
     }
     else if (token == GmfRidges && nbElem > 0) {
       (nbElem <= 1) ? tmpStr = " ridge" : tmpStr = " ridges";
       for ( int iElem = 0; iElem < nbElem; iElem++ )
-        MGOutput->GmfGetLin( InpMsh, token, &id[iElem*tabRef[token]]);
+        MGOutput->GmfGetLin( InpMsh, token,
+                             reinterpret_cast<int*>(&id[iElem*tabRef[token]]));
     }
     else if (token == GmfEdges && nbElem > 0) {
       (nbElem <= 1) ? tmpStr = " edge" : tmpStr = " edges";
       for ( int iElem = 0; iElem < nbElem; iElem++ )
-        MGOutput->GmfGetLin( InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &domainID[iElem]);
+        MGOutput->GmfGetLin( InpMsh, token,
+                             reinterpret_cast<int*>(&id[iElem*tabRef[token]]),
+                             reinterpret_cast<int*>(&id[iElem*tabRef[token]+1]),
+                             &domainID[iElem]);
     }
     else if (token == GmfTriangles && nbElem > 0) {
       (nbElem <= 1) ? tmpStr = " triangle" : tmpStr = " triangles";
       for ( int iElem = 0; iElem < nbElem; iElem++ )
-        MGOutput->GmfGetLin( InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &id[iElem*tabRef[token]+2], &domainID[iElem]);
+        MGOutput->GmfGetLin( InpMsh, token,
+                             reinterpret_cast<int*>(&id[iElem*tabRef[token]]),
+                             reinterpret_cast<int*>(&id[iElem*tabRef[token]+1]),
+                             reinterpret_cast<int*>(&id[iElem*tabRef[token]+2]),
+                             &domainID[iElem]);
     }
     else if (token == GmfQuadrilaterals && nbElem > 0) {
       (nbElem <= 1) ? tmpStr = " Quadrilateral" : tmpStr = " Quadrilaterals";
       for ( int iElem = 0; iElem < nbElem; iElem++ )
-        MGOutput->GmfGetLin( InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &id[iElem*tabRef[token]+2], &id[iElem*tabRef[token]+3], &domainID[iElem]);
+        MGOutput->GmfGetLin( InpMsh, token,
+                             reinterpret_cast<int*>(&id[iElem*tabRef[token]]),
+                             reinterpret_cast<int*>(&id[iElem*tabRef[token]+1]),
+                             reinterpret_cast<int*>(&id[iElem*tabRef[token]+2]),
+                             reinterpret_cast<int*>(&id[iElem*tabRef[token]+3]),
+                             &domainID[iElem]);
     }
     else if (token == GmfTetrahedra && nbElem > 0) {
       (nbElem <= 1) ? tmpStr = " Tetrahedron" : tmpStr = " Tetrahedra";
       for ( int iElem = 0; iElem < nbElem; iElem++ ) {
-        MGOutput->GmfGetLin( InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &id[iElem*tabRef[token]+2], &id[iElem*tabRef[token]+3], &domainID[iElem]);
+        MGOutput->GmfGetLin( InpMsh, token,
+                             reinterpret_cast<int*>(&id[iElem*tabRef[token]]),
+                             reinterpret_cast<int*>(&id[iElem*tabRef[token]+1]),
+                             reinterpret_cast<int*>(&id[iElem*tabRef[token]+2]),
+                             reinterpret_cast<int*>(&id[iElem*tabRef[token]+3]),
+                             &domainID[iElem]);
 #ifdef _MY_DEBUG_
         subdomainId2tetraId[dummy].insert(iElem+1);
 #endif
@@ -820,8 +841,16 @@ static bool readGMFFile(MG_Tetra_API*                   MGOutput,
     else if (token == GmfHexahedra && nbElem > 0) {
       (nbElem <= 1) ? tmpStr = " Hexahedron" : tmpStr = " Hexahedra";
       for ( int iElem = 0; iElem < nbElem; iElem++ )
-        MGOutput->GmfGetLin( InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &id[iElem*tabRef[token]+2], &id[iElem*tabRef[token]+3],
-                  &id[iElem*tabRef[token]+4], &id[iElem*tabRef[token]+5], &id[iElem*tabRef[token]+6], &id[iElem*tabRef[token]+7], &domainID[iElem]);
+        MGOutput->GmfGetLin( InpMsh, token,
+                             reinterpret_cast<int*>(&id[iElem*tabRef[token]]),
+                             reinterpret_cast<int*>(&id[iElem*tabRef[token]+1]),
+                             reinterpret_cast<int*>(&id[iElem*tabRef[token]+2]),
+                             reinterpret_cast<int*>(&id[iElem*tabRef[token]+3]),
+                             reinterpret_cast<int*>(&id[iElem*tabRef[token]+4]),
+                             reinterpret_cast<int*>(&id[iElem*tabRef[token]+5]),
+                             reinterpret_cast<int*>(&id[iElem*tabRef[token]+6]),
+                             reinterpret_cast<int*>(&id[iElem*tabRef[token]+7]),
+                             &domainID[iElem]);
     }
     std::cout << tmpStr << std::endl;
     std::cout << std::endl;