Salome HOME
bos #24596 [CEA] New MeshGems license:: fix regressions in tests occ/new_mg_licnese
authoreap <eap@opencascade.com>
Tue, 10 Aug 2021 16:49:20 +0000 (19:49 +0300)
committereap <eap@opencascade.com>
Tue, 10 Aug 2021 16:49:20 +0000 (19:49 +0300)
src/HexoticPlugin/HexoticPlugin_Hexotic.cxx
src/HexoticPlugin/MG_Hexotic_API.cxx
src/HexoticPlugin/MG_Hexotic_API.hxx

index 37bd68508ee54dfe84380ce3c7ac8c422dafac55..2e87506228ec5bac09bf435d7df1b250a675e50a 100644 (file)
@@ -67,6 +67,7 @@
 #include <TopoDS_Vertex.hxx>
 #include <gp_Pnt.hxx>
 
+#include <Basics_DirUtils.hxx>
 #include <Basics_Utils.hxx>
 #include <GEOMImpl_Types.hxx>
 #include <GEOM_wrap.hxx>
@@ -788,7 +789,7 @@ HexoticPlugin_Hexotic::getHexoticCommand(const TCollection_AsciiString& Hexotic_
   TCollection_AsciiString minl         = " --min_level ", maxl = " --max_level ", angle = " --ridge_angle ";
   TCollection_AsciiString mins         = " --min_size ", maxs = " --max_size ";
   TCollection_AsciiString in           = " --in ",   out  = " --out ";
-  TCollection_AsciiString sizeMap      = " --read_sizemap ";
+  TCollection_AsciiString sizeMap      = " --sizemap ";
   TCollection_AsciiString ignoreRidges = " --compute_ridges no ", invalideElements = " --allow_invalid_elements yes ";
   TCollection_AsciiString subdom       = " --components ";
 #ifndef WIN32
@@ -870,7 +871,7 @@ HexoticPlugin_Hexotic::getHexoticCommand(const TCollection_AsciiString& Hexotic_
     run_Hexotic +=  angle + sharpAngle;
   
   if (_sizeMaps.begin() != _sizeMaps.end() && forExecutable )
-    run_Hexotic += sizeMap + Hexotic_SizeMap_Prefix;
+    run_Hexotic += sizeMap + Hexotic_SizeMap_Prefix + ".sol";
 
   if (_nbLayers       > 0 &&
       _firstLayerSize > 0 &&
@@ -1025,7 +1026,7 @@ bool HexoticPlugin_Hexotic::Compute(SMESH_Mesh&          aMesh,
 
     SetParameters(_hypothesis);
 
-    TCollection_AsciiString aTmpDir = _hexoticWorkingDirectory.c_str();
+    TCollection_AsciiString aTmpDir = Kernel_Utils::GetTmpDirByPath(_hexoticWorkingDirectory).c_str();
     TCollection_AsciiString aQuote("");
 #ifdef WIN32
     aQuote = "\"";
@@ -1052,6 +1053,7 @@ bool HexoticPlugin_Hexotic::Compute(SMESH_Mesh&          aMesh,
       {
         MESSAGE("Use output file from blsurf as input file from hexotic: " << Hexotic_In);
         mgHexa.SetUseExecutable();
+        mgHexa.SetInputFile( _blsurfHypo->GetGMFFile() );
         defaultInputFile = false;
       }
     }
index 6dcf7f84778f273e2a631ec71fa6cd55b400877a..5f88f1ce28c2ae3207bc6cbf24480c8051c3d1d9 100644 (file)
@@ -23,6 +23,7 @@
 #define NOMINMAX
 #endif
 
+#include <DriverGMF_Read.hxx>
 #include <SMESH_Comment.hxx>
 #include <SMESH_File.hxx>
 #include <SMESH_MGLicenseKeyGen.hxx>
@@ -1108,9 +1109,9 @@ void MG_Hexotic_API::GmfSetKwd(int iMesh, GmfKwdCod what, int nb )
   if ( iMesh == 1 && _isMesh )
   {
     switch ( what ) {
-    case GmfVertices:  _nbNodes = nb; break;
-    case GmfEdges:     _nbEdges = nb; break;
-    case GmfTriangles: _nbFaces = nb; break;
+    case GmfVertices:  _nbNodes += nb; break;
+    case GmfEdges:     _nbEdges += nb; break;
+    case GmfTriangles: _nbFaces += nb; break;
     default:;
     }
   }
@@ -1131,6 +1132,26 @@ void MG_Hexotic_API::GmfSetKwd(int iMesh, GmfKwdCod what, int nb )
   ::GmfSetKwd(iMesh, what, nb );
 }
 
+//================================================================================
+/*!
+ * \brief Set GMF file made by MG-CADSurf to get nb of mesh entities from it
+ */
+//================================================================================
+
+void MG_Hexotic_API::SetInputFile( const std::string mesh2DFile )
+{
+  DriverGMF_Read fileReader;
+  fileReader.SetFile( mesh2DFile );
+
+  smIdType nbVertex, nbEdge, nbFace, nbVol;
+  if ( fileReader.GetMeshInfo(nbVertex, nbEdge, nbFace, nbVol))
+  {
+    _nbNodes += nbVertex;
+    _nbEdges += nbEdge;
+    _nbFaces += nbFace;
+  }
+}
+
 //================================================================================
 /*!
  * \brief Add coordinates of a node
@@ -1297,5 +1318,5 @@ std::string MG_Hexotic_API::GetLog()
 #endif
   }
   SMESH_File file( _logFile );
-  return file.getPos();
+  return file.exists() ? file.getPos() : "";
 }
index bb91d351311840217e221f6b4a4ab85670ffb66f..e3d2cf4eb942a64e53f01b95d5fbf6a55d78727d 100644 (file)
@@ -41,6 +41,7 @@ public:
   bool IsLibrary();
   bool IsExecutable() { return !IsLibrary(); }
   void SetUseExecutable();
+  void SetInputFile( const std::string mesh2DFile );
 
   // IN to MESHGEMS
   int  GmfOpenMesh(const char* theFile, int rdOrWr, int ver, int dim);