#include <SMESH_TypeDefs.hxx>
#include <SMESH_subMesh.hxx>
#include <SMESH_MesherHelper.hxx>
+#include <SMESH_File.hxx>
#include "utilities.h"
SMESH_MesherHelper* /*theHelper*/)
{
bool Ok=false;
- TCollection_AsciiString pluginerror("ghs3dprl: ");
+ TCollection_AsciiString pluginerror("MG-TETRA_HPC: ");
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";
+ pluginerror += "No existing parameters/hypothesis for MG-TETRA_HPC";
cout <<"\n"<<pluginerror<<"\n\n";
error(COMPERR_ALGO_FAILED, pluginerror.ToCString() );
return false;
std::cout << log << std::endl;
// try to guess an error from the output log
std::string log2 = mgTetraHPC.GetLog();
- if ( log2.find(" Dlim " ) != std::string::npos ||
- log2.find(" license ") != std::string::npos )
+ if ( log2.find("Dlim" ) != std::string::npos ||
+ log2.find("icense") != std::string::npos )
return error("License problem");
std::cout << log2 << std::endl;
if ( log2.find("You are using an empty MPI stubs library") != std::string::npos )
cout<<" Write input file for mg-tetra_hpc "<<fileskinmesh<<"...";
cout<<" ...done\n";
}
- // if mpi, convert meshes to med with xml master file
+
if (!_Multithread)
{
fileskinmed=path + casenamemed + "_skin.med";
cout<<" Write file "<<fileskinmed<<"...";
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
- std::cout << "run_GHS3DPRL cmd: " << run_GHS3DPRL << std::endl;
- 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" );
+ // convert .mesh (one or several) to med file(s) with xml master file if mpi
+ cout<<"Mesh conversion 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
+ 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 "+ path +casenamemed + "_*.med";
+ cout<<pluginerror<<endl;
+ 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,
+ }
- if (_Background) {
- pluginerror = pluginerror + "backgrounding... plugin is not waiting for output files "+ path +casenamemed + "_*.med";
+ if (_Multithread)
+ {
+ // check the med file has been created (only one med file, since multithread)
+ TCollection_AsciiString resuMedFile = TCollection_AsciiString(path) + casenamemed + "_1.med";
+ SMESH_File file( resuMedFile.ToCString() );
+ if (file.exists() && file.size() > 0)
+ {
+ Ok = true;
+ pluginerror = pluginerror + "MG-tetra_hpc mesh not loaded in memory, is stored in file "+ resuMedFile;
cout<<pluginerror<<endl;
- 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,
+ error(COMPERR_WARNING, pluginerror.ToCString() );
+ if (!_KeepFiles) system( run_nokeep_files.ToCString() );
}
-
- // read a result, GHS3DPRL_Out is the name of master file (previous xml format)
+ }
+ else
+ {
+ // read a result, GHS3DPRL_Outxml is the name of master file (previous xml format)
FILE * aResultFile = fopen( GHS3DPRL_Outxml.ToCString(), "r" );
if (aResultFile){
Ok = true;
fclose(aResultFile);
- cout<<"GHS3DPRL OK output master file "<<casenamemed<<".xml exist !\n\n";
- pluginerror = pluginerror + "MG-tetra_hpc mesh(es) not loaded in memory, are stored in files "+ path + casenamemed + "_*.med";
+ cout<<"MG-TETRA_HPC OK output master file "<<casenamemed<<".xml exist !\n\n";
+ pluginerror = pluginerror + "MG-tetra_hpc meshes not loaded in memory, are stored in files "+ path + casenamemed + "_*.med";
cout<<pluginerror<<endl;
error(COMPERR_WARNING, pluginerror.ToCString() );
if (!_KeepFiles) system( run_nokeep_files.ToCString() );
pluginerror = pluginerror + "output master file " + casenamemed + ".xml do not exist";
cout<<pluginerror<<endl;
error(COMPERR_ALGO_FAILED, pluginerror.ToCString() );
- cout<<"GHS3DPRL KO output files "<<GHS3DPRL_Out<<" do not exist ! see intermediates files keeped:\n";
+ cout<<"MG-TETRA_HPC KO output files "<<GHS3DPRL_Out<<" do not exist ! see intermediate files kept:\n";
TCollection_AsciiString run_list_files("ls -alt ");
run_list_files += GHS3DPRL_Out + "* " + GHS3DPRL_In + "* " + logFileName;
system( run_list_files.ToCString() );
cout<<endl;
}
}
- else
- Ok = true;
+
return Ok;
}
}
//create file resume DOMAIN.joints.med of all joints for quick display (...may be...)
- tmp=path+medname+tmp.sprintf("_joints.med");
- charendnull(distfilename,tmp,MED_COMMENT_SIZE);
- fidjoint=MEDfileOpen(distfilename,MED_ACC_CREAT);
- if (fidjoint<0) std::cerr<<"Problem MEDfileOpen "<<distfilename<<std::endl;
- if (verbose>0) std::cout<<"CreateMEDFile for all joints <"<<distfilename<<">\n";
+ if (! for_multithread)
+ {
+ tmp=path+medname+tmp.sprintf("_joints.med");
+ charendnull(distfilename,tmp,MED_COMMENT_SIZE);
+ fidjoint=MEDfileOpen(distfilename,MED_ACC_CREAT);
+ if (fidjoint<0) std::cerr<<"Problem MEDfileOpen "<<distfilename<<std::endl;
+ if (verbose>0) std::cout<<"CreateMEDFile for all joints <"<<distfilename<<">\n";
+ }
//copy file source/GHS3DPRL_skin.med as destination/DOMAIN.skin.med
tmp=path+medname+"_skin.med";
}
MEDfileClose(fid); //no error
- //master.xml writings
- /*oktmp=*/Write_masterxmlMEDfile();
+ //master.xml writings if mpi mode
+ if (!for_multithread)
+ /*oktmp=*/Write_masterxmlMEDfile();
continue; //and loop on others domains
erreur: //error
}
- MEDfileClose(fidjoint); //no error
+ if (! for_multithread)
+ MEDfileClose(fidjoint); //no error
if (verbose>0)std::cout<<"\nTotalNumberOftetrahedra="<<nbtetrastotal<<std::endl;
ok = true;