Salome HOME
Improve new MG license mechanism to be binary compatible 2.14/2.15 cbr/new_mg_license_215_v2
authorChristophe Bourcier <christophe.bourcier@cea.fr>
Wed, 19 Apr 2023 12:35:16 +0000 (14:35 +0200)
committerChristophe Bourcier <christophe.bourcier@cea.fr>
Wed, 19 Apr 2023 12:35:16 +0000 (14:35 +0200)
src/GHS3DPlugin/MG_Tetra_API.cxx

index 7e01ab8d96747850d3b269a1291be1cfcbaa77a4..48c6c13d24cad0350cd28f4c21dd3717d4778e7c 100644 (file)
@@ -40,9 +40,6 @@ extern "C"{
 #include <meshgems/tetra.h>
 }
 
-#define MESHGEMS_VERSION_HEX (MESHGEMS_VERSION_MAJOR << 16 | MESHGEMS_VERSION_MINOR << 8 | MESHGEMS_VERSION_PATCH)
-#define MESHGEMS_215 (2 << 16 | 15 << 8 | 0)
-
 struct MG_Tetra_API::LibData
 {
   // MG objects
@@ -653,44 +650,27 @@ bool MG_Tetra_API::LibData::Compute()
   status_t ret;
   std::string errorTxt;
 
-#if MESHGEMS_VERSION_HEX > MESHGEMS_215
-  // need to unlock Tetra license only once
-  std::string SPATIAL_LICENSE = SMESHUtils_MGLicenseKeyGen::GetKey(errorTxt);
-  ret = meshgems_tetra_unlock_product(SPATIAL_LICENSE.c_str());
-  if STATUS_IS_ERROR( ret )
-    {
-    AddError( SMESH_Comment( "Problem with SPATIAL_LICENSE to unlock Tetra: ") << errorTxt );
-    return false;
-    }
-  else
-    MESSAGE("SPATIAL_LICENSE unlock Tetra: " << ret);
-#endif
-
   if ( _tetraNodes.empty() )
   {
-#if MESHGEMS_VERSION_HEX < MESHGEMS_215
     // Sign the surface mesh
-    if ( !SMESHUtils_MGLicenseKeyGen::SignMesh( _tria_mesh, errorTxt ))
+    if ( !SMESHUtils_MGLicenseKeyGen::SignMesh( _tria_mesh, "tetra", errorTxt ))
     {
       AddError( SMESH_Comment( "Problem with library SalomeMeshGemsKeyGenerator: ") << errorTxt );
       return false;
     }
-#endif
     // Set surface mesh
     ret = tetra_set_surface_mesh( _session, _tria_mesh );
     if ( ret != STATUS_OK ) MG_Error( "unable to set surface mesh");
   }
   else
   {
-#if MESHGEMS_VERSION_HEX < MESHGEMS_215
     // Sign the volume mesh
     // TOOD: check if there is a typo here. Should be _tetra_mesh ?
-    if ( !SMESHUtils_MGLicenseKeyGen::SignMesh( _tria_mesh, errorTxt ))
+    if ( !SMESHUtils_MGLicenseKeyGen::SignMesh( _tria_mesh, "tetra", errorTxt ))
     {
       AddError( SMESH_Comment( "Problem with library SalomeMeshGemsKeyGenerator: ") << errorTxt );
       return false;
     }
-#endif
     // TOOD: check if there is a typo here. Should be _tetra_mesh ?
     ret = tetra_set_volume_mesh( _session, _tria_mesh );
     if ( ret != STATUS_OK ) MG_Error( "unable to set volume mesh");