-// Copyright (C) 2021 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2021-2023 CEA, EDF, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "SALOME_KernelServices.hxx"
-#include "SMESH_Component_Generator.hxx"
-
#include <cstring>
-std::string BuildSMESHInstanceInternal()
+#include <DriverGMF_Read.hxx>
+#include <SMESH_MGLicenseKeyGen.hxx>
+
+std::string GetMGLicenseKeyImpl(const char* gmfFile)
{
- Engines::EngineComponent_var zeRef = RetrieveSMESHInstance();
- CORBA::String_var ior = KERNEL::getORB()->object_to_string(zeRef);
- return std::string(ior.in());
+ smIdType nbVertex, nbEdge, nbFace, nbVol;
+ DriverGMF_Read gmfReader;
+ gmfReader.SetFile( gmfFile );
+ gmfReader.GetMeshInfo( nbVertex, nbEdge, nbFace, nbVol );
+
+ std::string errorTxt;
+ std::string key = SMESHUtils_MGLicenseKeyGen::GetKey( gmfFile,
+ FromSmIdType<int>( nbVertex ),
+ FromSmIdType<int>( nbEdge ),
+ FromSmIdType<int>( nbFace ),
+ FromSmIdType<int>( nbVol ),
+ errorTxt );
+ if ( !errorTxt.empty() )
+ {
+ std::cerr << "Error: Pb with MeshGems license: " << errorTxt << std::endl;
+ key = "<" + errorTxt + ">";
+ }
+ return key;
}