cout replaced by MESSAGE + clean up

This commit is contained in:
Yoann Audouin 2022-09-21 16:36:10 +02:00
parent a99d4c8ed2
commit 08f1ef4cc3
4 changed files with 15 additions and 27 deletions

View File

@ -355,8 +355,8 @@ bool NETGENPlugin_NETGEN_2D_ONLY::RemoteCompute(SMESH_Mesh& aMesh,
+ output_mesh_file.string() +
" >> " + log_file.string();
std::cout << "Running command: " << std::endl;
std::cout << cmd << std::endl;
MESSAGE("Running command: ");
MESSAGE(cmd);
// Writing command in log
std::ofstream flog(log_file.string());
@ -411,8 +411,8 @@ bool NETGENPlugin_NETGEN_2D_ONLY::RemoteCompute(SMESH_Mesh& aMesh,
}
}
if(nodeVec.at(nodeIndex) == nullptr){
std::cout << "Error could not identify id";
return false;
std::cerr << "Error could not identify id";
return true;
}
}

View File

@ -627,8 +627,6 @@ bool NETGENPlugin_NETGEN_3D::compute(SMESH_Mesh& aMesh,
vector< const SMDS_MeshNode* >& nodeVec,
NETGENPlugin_NetgenLibWrapper& ngLib)
{
auto time0 = std::chrono::high_resolution_clock::now();
netgen::multithread.terminate = 0;
netgen::Mesh* ngMesh = ngLib._ngMesh;
@ -691,7 +689,6 @@ bool NETGENPlugin_NETGEN_3D::compute(SMESH_Mesh& aMesh,
try
{
OCC_CATCH_SIGNALS;
auto time0 = std::chrono::high_resolution_clock::now();
ngLib.CalcLocalH(ngMesh);
err = ngLib.GenerateMesh(occgeo, startWith, endWith);
@ -725,9 +722,6 @@ bool NETGENPlugin_NETGEN_3D::compute(SMESH_Mesh& aMesh,
str << " at " << netgen::multithread.task;
error(str);
}
auto time1 = std::chrono::high_resolution_clock::now();
auto elapsed = std::chrono::duration_cast<std::chrono::nanoseconds>(time1-time0);
std::cout << "Time for seq:compute: " << elapsed.count() * 1e-9 << std::endl;
int Netgen_NbOfNodesNew = Ng_GetNP(Netgen_mesh);
int Netgen_NbOfTetra = Ng_GetNE(Netgen_mesh);
@ -774,10 +768,6 @@ bool NETGENPlugin_NETGEN_3D::compute(SMESH_Mesh& aMesh,
}
}
}
auto time2 = std::chrono::high_resolution_clock::now();
elapsed = std::chrono::duration_cast<std::chrono::nanoseconds>(time2-time1);
std::cout << "Time for seq:compute: " << elapsed.count() * 1e-9 << std::endl;
return !err;
}
@ -903,14 +893,12 @@ double NETGENPlugin_NETGEN_3D::GetProgress() const
strncmp( netgen::multithread.task, volMeshing, 3 ) == 0 ))
{
res = 0.001 + meshingRatio * netgen::multithread.percent / 100.;
//cout << netgen::multithread.task << " " <<_progressTic << "-" << netgen::multithread.percent << endl;
}
else // different otimizations
{
if ( _progressByTic < 0. )
((NETGENPlugin_NETGEN_3D*)this)->_progressByTic = meshingRatio / _progressTic;
res = _progressByTic * _progressTic;
//cout << netgen::multithread.task << " " << _progressTic << " " << res << endl;
}
return Min ( res, 0.98 );
}

View File

@ -226,7 +226,6 @@ bool NETGENPlugin_NETGEN_3D_Remote::Compute(SMESH_Mesh& aMesh,
//Writing hypo
netgen_params aParams;
std::cout << _hypParameters << std::endl;
fillParameters(_hypParameters, aParams);
exportNetgenParams(param_file.string(), aParams);
@ -258,8 +257,8 @@ bool NETGENPlugin_NETGEN_3D_Remote::Compute(SMESH_Mesh& aMesh,
flog << cmd << endl;
flog << endl;
}
//std::cout << "Running command: " << std::endl;
//std::cout << cmd << std::endl;
MESSAGE("Running command: ");
MESSAGE(cmd);
// Building arguments for QProcess
@ -283,9 +282,9 @@ bool NETGENPlugin_NETGEN_3D_Remote::Compute(SMESH_Mesh& aMesh,
if(ret != 0){
// Run crahed
std::cout << "Issue with command: " << std::endl;
std::cout << "See log for more details: " << log_file.string() << std::endl;
std::cout << cmd << std::endl;
std::cerr << "Issue with command: " << std::endl;
std::cerr << "See log for more details: " << log_file.string() << std::endl;
std::cerr << cmd << std::endl;
return false;
}

View File

@ -214,19 +214,20 @@ int NETGENPlugin_NETGEN_3D_SA::run(const std::string input_mesh_file,
// Setting number of threads for netgen
myParams.nbThreads = nbThreads;
std::cout << "Meshing with netgen3d" << std::endl;
MESSAGE("Meshing with netgen3d");
int ret = Compute(myShape, *myMesh, myParams,
new_element_file, element_orientation_file,
!output_mesh_file.empty());
if(ret){
std::cout << "Meshing failed" << std::endl;
std::cerr << "Meshing failed" << std::endl;
return ret;
}
if(!output_mesh_file.empty()){
exportMesh(output_mesh_file, *myMesh, mesh_name);
std::string meshName = "MESH";
exportMesh(output_mesh_file, *myMesh, meshName);
}
return ret;
@ -250,7 +251,7 @@ bool NETGENPlugin_NETGEN_3D_SA::getSurfaceElements(
{
// Setting all element orientation to false if there no element orientation file
if(_element_orientation_file.empty()){
std::cout << "No element orientation file" << std::endl;
MESSAGE("No element orientation file");
SMDS_ElemIteratorPtr iteratorElem = meshDS->elementsIterator(SMDSAbs_Face);
while ( iteratorElem->more() ) // loop on elements on a geom face
@ -260,7 +261,7 @@ bool NETGENPlugin_NETGEN_3D_SA::getSurfaceElements(
elemOrientation[elem->GetID()] = false;
}
} else {
std::cout << "Reading from elements from file: " << _element_orientation_file << std::endl;
MESSAGE("Reading from elements from file: " << _element_orientation_file);
std::ifstream df(_element_orientation_file, ios::binary|ios::in);
int nbElement;
bool orient;