X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGHS3DPRLPlugin%2FGHS3DPRLPlugin_GHS3DPRL.cxx;h=eb92f305a1ed48d3831a05c7024d524546c548b8;hb=f90fb724f90e06b4a14dfc033acfe2a9aed67e1c;hp=20d122dce29a11081caaea3d92e5e89b974b3085;hpb=4971be7e3503d22d2fcc5aa399d84c713f8e0466;p=plugins%2Fghs3dprlplugin.git diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx old mode 100755 new mode 100644 index 20d122d..eb92f30 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2016 CEA/DEN, EDF R&D +// Copyright (C) 2007-2021 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -30,6 +30,7 @@ #include #include #include +#include #include "utilities.h" @@ -56,14 +57,14 @@ static void removeFile( const TCollection_AsciiString& fileName ) try { OSD_File( fileName ).Remove(); } - catch ( Standard_ProgramError ) { + catch ( Standard_ProgramError& ) { MESSAGE("Can't remove file: " << fileName.ToCString() << " ; file does not exist or permission denied"); } } //============================================================================= -GHS3DPRLPlugin_GHS3DPRL::GHS3DPRLPlugin_GHS3DPRL(int hypId, int studyId, SMESH_Gen* gen) - : SMESH_3D_Algo(hypId, studyId, gen) +GHS3DPRLPlugin_GHS3DPRL::GHS3DPRLPlugin_GHS3DPRL(int hypId, SMESH_Gen* gen) + : SMESH_3D_Algo(hypId, gen) { MESSAGE("GHS3DPRLPlugin_GHS3DPRL::GHS3DPRLPlugin_GHS3DPRL"); _name = "MG-Tetra Parallel"; @@ -72,6 +73,7 @@ GHS3DPRLPlugin_GHS3DPRL::GHS3DPRLPlugin_GHS3DPRL(int hypId, int studyId, SMESH_G _countSubMesh=0; _nodeRefNumber=0; _compatibleHypothesis.push_back(GHS3DPRLPlugin_Hypothesis::GetHypType()); + _requireShape=false; } //============================================================================= @@ -205,11 +207,23 @@ static void exportGMF(MG_TetraHPC_API* theTetraInput, //============================================================================= // Here we are going to use the GHS3DPRL mesher for tetra-hpc (formerly tepal in v3 (2014)) bool GHS3DPRLPlugin_GHS3DPRL::Compute(SMESH_Mesh& theMesh, - const TopoDS_Shape& theShape) + const TopoDS_Shape& /*theShape*/) +{ + SMESH_MesherHelper helper( theMesh ); + bool ok = Compute( theMesh, &helper ); + return ok; +} + +//============================================================================= +// Here we are going to use the GHS3DPRL mesher for tetra-hpc (formerly tepal in v3 (2014)) +bool GHS3DPRLPlugin_GHS3DPRL::Compute(SMESH_Mesh& theMesh, + SMESH_MesherHelper* /*theHelper*/) { bool Ok=false; TCollection_AsciiString pluginerror("ghs3dprl: "); SMESHDS_Mesh* meshDS = theMesh.GetMeshDS(); + if ( theMesh.NbTriangles() == 0 ) + return error( COMPERR_BAD_INPUT_MESH, "No triangles in the mesh" ); if (_hypothesis==NULL){ pluginerror += "No existing parameters/hypothesis for GHS3DPRL"; @@ -247,6 +261,7 @@ bool GHS3DPRLPlugin_GHS3DPRL::Compute(SMESH_Mesh& theMesh, fileskinmesh(""), path, casenamemed; //_MEDName.c_str()); + int res = 0; // 0 is OK casenamemed += (char *)_MEDName.c_str(); int n=casenamemed.SearchFromEnd('/'); @@ -306,7 +321,7 @@ bool GHS3DPRLPlugin_GHS3DPRL::Compute(SMESH_Mesh& theMesh, exportGMF( &mgTetraHPC, fileskinmesh.ToCString(), meshDS ); - if ( useLib ) + if ( true /*useLib*/ ) { TCollection_AsciiString cmd = TCollection_AsciiString("mg-tetra_hpc.exe") + " --number_of_subdomains=" + NbPart + @@ -322,9 +337,11 @@ bool GHS3DPRLPlugin_GHS3DPRL::Compute(SMESH_Mesh& theMesh, << " Creating a log file : " << logFileName << endl << endl; mgTetraHPC.SetLogFile( logFileName.ToCString() ); - mgTetraHPC.Compute( cmd.ToCString() ); + std::string log; + mgTetraHPC.Compute( cmd.ToCString(), log ); - std::string log = mgTetraHPC.GetLog(); + if ( log.empty() ) + log = mgTetraHPC.GetLog(); if ( log.find(" Dlim " ) != std::string::npos || log.find(" license ") != std::string::npos ) return error("License problem"); @@ -342,20 +359,27 @@ bool GHS3DPRLPlugin_GHS3DPRL::Compute(SMESH_Mesh& theMesh, } fileskinmed=path + "GHS3DPRL_skin.med"; cout<<" Write file "< 0) + { + pluginerror = pluginerror + "PROBLEM tetrahpc2med command"; + cout< aVec = (*anIt).second; - nbtri += Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]); - nbqua += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); + std::vector aVec = (*anIt).second; + nbtri += std::max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]); + nbqua += std::max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); GProp_GProps G; BRepGProp::SurfaceProperties(F,G); double anArea = G.Mass(); @@ -419,7 +443,7 @@ bool GHS3DPRLPlugin_GHS3DPRL::Evaluate(SMESH_Mesh& aMesh, } // collect info from edges - int nb0d_e = 0, nb1d_e = 0; + smIdType nb0d_e = 0, nb1d_e = 0; bool IsQuadratic = false; bool IsFirst = true; TopTools_MapOfShape tmpMap; @@ -430,9 +454,9 @@ bool GHS3DPRLPlugin_GHS3DPRL::Evaluate(SMESH_Mesh& aMesh, tmpMap.Add(E); SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current()); MapShapeNbElemsItr anIt = aResMap.find(aSubMesh); - std::vector aVec = (*anIt).second; + std::vector aVec = (*anIt).second; nb0d_e += aVec[SMDSEntity_Node]; - nb1d_e += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]); + nb1d_e += std::max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]); if(IsFirst) { IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]); IsFirst = false; @@ -447,11 +471,11 @@ bool GHS3DPRLPlugin_GHS3DPRL::Evaluate(SMESH_Mesh& aMesh, double aVolume = G.Mass(); double tetrVol = 0.1179*ELen*ELen*ELen; double CoeffQuality = 0.9; - int nbVols = (int)aVolume/tetrVol/CoeffQuality; - int nb1d_f = (nbtri*3 + nbqua*4 - nb1d_e) / 2; - int nb1d_in = (int) ( nbVols*6 - nb1d_e - nb1d_f ) / 5; - std::vector aVec(SMDSEntity_Last); - for(int i=0; i aVec(SMDSEntity_Last); + for(smIdType i=0; i