-// 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
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";
//=============================================================================
// 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 );
//=============================================================================
// 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)
+ SMESH_MesherHelper* /*theHelper*/)
{
bool Ok=false;
TCollection_AsciiString pluginerror("ghs3dprl: ");
fileskinmesh(""),
path,
casenamemed; //_MEDName.c_str());
+ int res = 0; // 0 is OK
casenamemed += (char *)_MEDName.c_str();
int n=casenamemed.SearchFromEnd('/');
exportGMF( &mgTetraHPC, fileskinmesh.ToCString(), meshDS );
- if ( useLib )
+ if ( true /*useLib*/ )
{
TCollection_AsciiString cmd = TCollection_AsciiString("mg-tetra_hpc.exe") +
" --number_of_subdomains=" + NbPart +
<< " 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");
}
fileskinmed=path + "GHS3DPRL_skin.med";
cout<<" Write file "<<fileskinmed<<"...";
- theMesh.ExportMED(fileskinmed.ToCString(),"SKIN_INITIAL",true,1);
+ theMesh.ExportMED(fileskinmed.ToCString(),"SKIN_INITIAL",true);
cout<<" ...done\n\n";
cout<<"GHS3DPRL command :\n "<<run_GHS3DPRL.ToCString()<<endl;
//sometimes it is better to wait flushing files on slow filesystem...
system( "sleep 3" );
//launch tetrahpc2med which launch mg-tetra_hpc.py which launch mg-tetra_hpc(_mpi?).exe
- system( run_GHS3DPRL.ToCString() );
+ res = system( run_GHS3DPRL.ToCString() );
+ if (res > 0)
+ {
+ pluginerror = pluginerror + "PROBLEM tetrahpc2med command";
+ cout<<pluginerror<<endl;
+ error(COMPERR_ALGO_FAILED, pluginerror.ToCString());
+ return false; //but it is not a problem but if true my message is overwritten
+ }
system( "sleep 3" );
if (_Background) {
pluginerror = pluginerror + "backgrounding... plugin is not waiting for output files "+ casenamemed + "_*.med";
cout<<pluginerror<<endl;
- error(COMPERR_ALGO_FAILED, pluginerror.ToCString());
+ error(COMPERR_NO_MESH_ON_SHAPE, pluginerror.ToCString());
return false; //but it is not a problem but if true my message is overwritten
//return true; //but it is not a problem,
}
// read a result, GHS3DPRL_Out is the name of master file (previous xml format)
FILE * aResultFile = fopen( GHS3DPRL_Outxml.ToCString(), "r" );
if (aResultFile){
- Ok = false; //but it is not a problem but if true my message is overwritten
+ Ok = true;
fclose(aResultFile);
cout<<"GHS3DPRL OK output master file "<<casenamemed<<".xml exist !\n\n";
- pluginerror = pluginerror + "new tetraedra not in memory, but stored in files "+ casenamemed + "_*.med";
+ pluginerror = pluginerror + "MG-tetra_hpc mesh(es) not loaded in memory, are stored in files "+ casenamemed + "_*.med";
cout<<pluginerror<<endl;
- error(COMPERR_ALGO_FAILED, pluginerror.ToCString());
+ error(COMPERR_WARNING, pluginerror.ToCString() );
if (!_KeepFiles) system( run_nokeep_files.ToCString() );
}
else{
const TopoDS_Shape& aShape,
MapShapeNbElems& aResMap)
{
- int nbtri = 0, nbqua = 0;
+ smIdType nbtri = 0, nbqua = 0;
double fullArea = 0.0;
for (TopExp_Explorer exp(aShape, TopAbs_FACE); exp.More(); exp.Next()) {
TopoDS_Face F = TopoDS::Face( exp.Current() );
"Submesh can not be evaluated",this));
return false;
}
- std::vector<int> aVec = (*anIt).second;
- nbtri += Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]);
- nbqua += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
+ std::vector<smIdType> 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();
}
// 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;
tmpMap.Add(E);
SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current());
MapShapeNbElemsItr anIt = aResMap.find(aSubMesh);
- std::vector<int> aVec = (*anIt).second;
+ std::vector<smIdType> 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;
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<int> aVec(SMDSEntity_Last);
- for(int i=0; i<SMDSEntity_Last; i++) aVec[i]=0;
+ smIdType nbVols = (smIdType)aVolume/tetrVol/CoeffQuality;
+ smIdType nb1d_f = (nbtri*3 + nbqua*4 - nb1d_e) / 2;
+ smIdType nb1d_in = (smIdType) ( nbVols*6 - nb1d_e - nb1d_f ) / 5;
+ std::vector<smIdType> aVec(SMDSEntity_Last);
+ for(smIdType i=0; i<SMDSEntity_Last; i++) aVec[i]=0;
if( IsQuadratic ) {
aVec[SMDSEntity_Node] = nb1d_in/6 + 1 + nb1d_in;
aVec[SMDSEntity_Quad_Tetra] = nbVols - nbqua*2;