From: eap Date: Tue, 10 Aug 2021 16:49:20 +0000 (+0300) Subject: bos #24596 [CEA] New MeshGems license:: fix regressions in tests X-Git-Tag: V9_8_0a1~1^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bce92a219741546757b84363ff28cd714e38def0;p=plugins%2Fhexoticplugin.git bos #24596 [CEA] New MeshGems license:: fix regressions in tests --- diff --git a/src/HexoticPlugin/HexoticPlugin_Hexotic.cxx b/src/HexoticPlugin/HexoticPlugin_Hexotic.cxx index 37bd685..2e87506 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hexotic.cxx +++ b/src/HexoticPlugin/HexoticPlugin_Hexotic.cxx @@ -67,6 +67,7 @@ #include #include +#include #include #include #include @@ -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; } } diff --git a/src/HexoticPlugin/MG_Hexotic_API.cxx b/src/HexoticPlugin/MG_Hexotic_API.cxx index 6dcf7f8..5f88f1c 100644 --- a/src/HexoticPlugin/MG_Hexotic_API.cxx +++ b/src/HexoticPlugin/MG_Hexotic_API.cxx @@ -23,6 +23,7 @@ #define NOMINMAX #endif +#include #include #include #include @@ -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() : ""; } diff --git a/src/HexoticPlugin/MG_Hexotic_API.hxx b/src/HexoticPlugin/MG_Hexotic_API.hxx index bb91d35..e3d2cf4 100644 --- a/src/HexoticPlugin/MG_Hexotic_API.hxx +++ b/src/HexoticPlugin/MG_Hexotic_API.hxx @@ -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);