{
if (hyp) {
MESSAGE("GHS3DPRLPlugin_GHS3DPRL::SetParameters");
- _MEDName = hyp->GetMEDName(); //"DOMAIN\0"
- _NbPart = hyp->GetNbPart();
- _KeepFiles = hyp->GetKeepFiles();
- _Background = hyp->GetBackground();
+ _MEDName = hyp->GetMEDName(); //"DOMAIN\0"
+ _NbPart = hyp->GetNbPart();
+ _KeepFiles = hyp->GetKeepFiles();
+ _Background = hyp->GetBackground();
_Multithread = hyp->GetMultithread();
- //_ToMergeSubdomains = hyp->GetToMergeSubdomains();
- _Gradation = hyp->GetGradation();
- _MinSize = hyp->GetMinSize();
- _MaxSize = hyp->GetMaxSize();
+ _Gradation = hyp->GetGradation();
+ _MinSize = hyp->GetMinSize();
+ _MaxSize = hyp->GetMaxSize();
+ _AdvOptions = hyp->GetAdvancedOption();
}
}
//=============================================================================
// 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)
+bool GHS3DPRLPlugin_GHS3DPRL::Compute(SMESH_Mesh& theMesh,
+ const TopoDS_Shape& theShape)
{
- bool Ok=false;
- TCollection_AsciiString pluginerror("ghs3dprl: ");
- SMESHDS_Mesh* meshDS = theMesh.GetMeshDS();
- //cout<<"GetMeshDS done\n";
- if (_countSubMesh==0){
- MESSAGE("GHS3DPRLPlugin_GHS3DPRL::Compute for tetra-hpc");
- _countTotal=0;
- TopExp_Explorer expf(meshDS->ShapeToMesh(), TopAbs_SOLID);
- for ( ; expf.More(); expf.Next() ) _countTotal++;
- }
- _countSubMesh++;
- //cout<<"Compute _countSubMesh "<<_countSubMesh<<endl;
- //no stuff if multiples submesh, multiple call compute
- //mesh all in one pass tepal (the last)
- if (_countSubMesh != _countTotal ) return true;
-
- //stuff on last call
- if (_hypothesis==NULL){
- pluginerror += "No existing parameters/hypothesis for GHS3DPRL";
- cout <<"\n"<<pluginerror<<"\n\n";
- error(COMPERR_ALGO_FAILED, pluginerror.ToCString() );
- return false;
- }
- SetParameters(_hypothesis);
- cout << "\n" << _name << " parameters:" << endl;
- cout << " generic path/name of MED Files = " << _MEDName << endl;
- cout << " number of partitions = " << _NbPart << endl;
- cout << " gradation = " << _Gradation << endl;
- cout << " min_size = " << _MinSize << endl;
- cout << " max_size = " << _MaxSize << endl;
- cout << " keep intermediates files (from tetra-hpc) = " << _KeepFiles << endl;
- cout << " background (from tetra-hpc) = " << _Background << "\n";
- cout << " multithread = " << _Multithread << "\n\n";
-
- //string tmpDir=getTmpDir_new();
- TCollection_AsciiString
- tmpDir=getTmpDir(),
- GHS3DPRL_In,
- GHS3DPRL_Out,
- GHS3DPRL_Outxml,
- run_GHS3DPRL("tetrahpc2med "),
- rm("rm -f "),
- run_nokeep_files,
- NbPart,
- Gradation,
- MinSize,
- MaxSize,
- fileskinmed(""),
- fileskinmesh(""),
- path,
- casenamemed; //_MEDName.c_str());
-
- casenamemed += (char *)_MEDName.c_str();
- int n=casenamemed.SearchFromEnd('/');
- if (n>0) {
- path=casenamemed.SubString(1,n);
- casenamemed=casenamemed.SubString(n+1,casenamemed.Length());
- }
- else
- path=tmpDir;
-
- if (casenamemed.Length()>20){
- casenamemed=casenamemed.SubString(1,20);
- cerr<<"MEDName truncated (no more 20 characters) = "<<casenamemed<<endl;
- }
- //cout<<"path="<<path<<endl;
- //cout<<"casenamemed="<<casenamemed<<endl;
-
- map <int,int> aSmdsToGHS3DPRLIdMap;
- map <int,const SMDS_MeshNode*> aGHS3DPRLIdToNodeMap;
- GHS3DPRL_In = path + "GHS3DPRL";
- GHS3DPRL_Out = path + casenamemed;
- GHS3DPRL_Outxml = path + casenamemed + ".xml"; //master file
- NbPart=_NbPart;
- Gradation=_Gradation;
- MinSize=_MinSize;
- MaxSize=_MaxSize;
-
- //an example:
- //tetrahpc2med --casename=/home/whoami/tmp/GHS3DPRL --number=5 --medname=DOMAIN
- // --gradation=1.05 --min_size=1e-3 --max_size=1e-2
- // --verbose=0 --menu=no --launchtetra=yes;
-
- run_GHS3DPRL = run_GHS3DPRL +
- " --casename=" + GHS3DPRL_In +
- " --number=" + NbPart +
- " --medname=" + GHS3DPRL_Out +
- " --launchtetra=yes" +
- " --gradation=" + Gradation +
- " --min_size=" + MinSize +
- " --max_size=" + MaxSize +
- " --verbose=3";
- if (_Background) run_GHS3DPRL += " --background=yes"; else run_GHS3DPRL += " --background=no";
- if (_Multithread) run_GHS3DPRL += " --multithread=yes"; else run_GHS3DPRL += " --multithread=no";
- run_nokeep_files = rm +GHS3DPRL_In + "* " + path + "tetrahpc.log";
- system( run_nokeep_files.ToCString() ); //clean files
- run_nokeep_files = rm + GHS3DPRL_In + "* ";
-
- cout<<"GHS3DPRL command :\n "<<run_GHS3DPRL.ToCString()<<endl;
- fileskinmesh=path + "GHS3DPRL.mesh";
- cout<<" Write input file for tetra_hpc.exe "<<fileskinmesh<<"...";
- GHS3DPRL_Out = path + casenamemed;
- removeFile( GHS3DPRL_Outxml ); //only the master xml file
- //Ok=writeGHS3DPRLFiles(GHS3DPRL_In, meshDS, aSmdsToGHS3DPRLIdMap, aGHS3DPRLIdToNodeMap);
- bool toCreateGroups = false;
- theMesh.ExportGMF(fileskinmesh.ToCString(), meshDS, toCreateGroups );
- cout<<" ...done\n";
- //else {
- // cout<<" ...NOT done\n";
- // pluginerror = pluginerror + "problem writing input tepal files " + GHS3DPRL_In + ".mesh";
-
- //Ecriture dans un fichier MED ?v2.? meme si not Ok
- //create empty file -> avoid warning message
- //med_idt fid=MEDouvrir((const char *)fileskinmed.ToCString(),MED_CREATION);
- //med_err ret=MEDfermer(fid);
- //fileskinmed=fileskinmed + "cp /home/wambeke/empty.med "+ path + "GHS3DPRL_skin.med";
- //system( fileskinmed.ToCString() );
- fileskinmed=path + "GHS3DPRL_skin.med";
- cout<<" Write file "<<fileskinmed<<"...";
- theMesh.ExportMED(fileskinmed.ToCString(),"SKIN_INITIAL",true,1);
- cout<<" ...done\n\n";
-
-
- //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() );
- 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());
- 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 = readResult( aResultFile, meshDS, theShape, aGHS3DPRLIdToNodeMap, GHS3DPRL_Out, _nodeRefNumber );
- Ok = true;
- Ok = false; //but it is not a problem but if true my message is overwritten
- 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";
- cout<<pluginerror<<endl;
- error(COMPERR_ALGO_FAILED, pluginerror.ToCString());
- if (!_KeepFiles) system( run_nokeep_files.ToCString() );
- }
- else{
- Ok = false; //it is a problem AND my message is NOT overwritten
- 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";
- TCollection_AsciiString run_list_files("ls -alt ");
- run_list_files += GHS3DPRL_Out + "* " + GHS3DPRL_In + "* " + path + "tetrahpc.log";
- system( run_list_files.ToCString() );
- cout<<endl;
- }
- _countSubMesh=0;
-
-
- return Ok;
+ bool Ok=false;
+ TCollection_AsciiString pluginerror("ghs3dprl: ");
+ SMESHDS_Mesh* meshDS = theMesh.GetMeshDS();
+ //cout<<"GetMeshDS done\n";
+ if (_countSubMesh==0){
+ MESSAGE("GHS3DPRLPlugin_GHS3DPRL::Compute for tetra-hpc");
+ _countTotal=0;
+ TopExp_Explorer expf(meshDS->ShapeToMesh(), TopAbs_SOLID);
+ for ( ; expf.More(); expf.Next() ) _countTotal++;
+ }
+ _countSubMesh++;
+ //cout<<"Compute _countSubMesh "<<_countSubMesh<<endl;
+ //no stuff if multiples submesh, multiple call compute
+ //mesh all in one pass tepal (the last)
+ if (_countSubMesh != _countTotal ) return true;
+
+ //stuff on last call
+ if (_hypothesis==NULL){
+ pluginerror += "No existing parameters/hypothesis for GHS3DPRL";
+ cout <<"\n"<<pluginerror<<"\n\n";
+ error(COMPERR_ALGO_FAILED, pluginerror.ToCString() );
+ return false;
+ }
+ SetParameters(_hypothesis);
+ cout << "\n" << _name << " parameters:" << endl;
+ cout << " generic path/name of MED Files = " << _MEDName << endl;
+ cout << " number of partitions = " << _NbPart << endl;
+ cout << " gradation = " << _Gradation << endl;
+ cout << " min_size = " << _MinSize << endl;
+ cout << " max_size = " << _MaxSize << endl;
+ cout << " keep intermediates files (from tetra-hpc) = " << _KeepFiles << endl;
+ cout << " background (from tetra-hpc) = " << _Background << "\n";
+ cout << " multithread = " << _Multithread << "\n\n";
+ cout << " adv. options = '" << _AdvOptions << "'\n\n";
+
+ //string tmpDir=getTmpDir_new();
+ TCollection_AsciiString
+ tmpDir=getTmpDir(),
+ GHS3DPRL_In,
+ GHS3DPRL_Out,
+ GHS3DPRL_Outxml,
+ run_GHS3DPRL("tetrahpc2med "),
+ rm("rm -f "),
+ run_nokeep_files,
+ NbPart,
+ Gradation,
+ MinSize,
+ MaxSize,
+ fileskinmed(""),
+ fileskinmesh(""),
+ path,
+ casenamemed; //_MEDName.c_str());
+
+ casenamemed += (char *)_MEDName.c_str();
+ int n=casenamemed.SearchFromEnd('/');
+ if (n>0) {
+ path=casenamemed.SubString(1,n);
+ casenamemed=casenamemed.SubString(n+1,casenamemed.Length());
+ }
+ else
+ path=tmpDir;
+
+ if (casenamemed.Length()>20){
+ casenamemed=casenamemed.SubString(1,20);
+ cerr<<"MEDName truncated (no more 20 characters) = "<<casenamemed<<endl;
+ }
+ //cout<<"path="<<path<<endl;
+ //cout<<"casenamemed="<<casenamemed<<endl;
+
+ map <int,int> aSmdsToGHS3DPRLIdMap;
+ map <int,const SMDS_MeshNode*> aGHS3DPRLIdToNodeMap;
+ GHS3DPRL_In = path + "GHS3DPRL";
+ GHS3DPRL_Out = path + casenamemed;
+ GHS3DPRL_Outxml = path + casenamemed + ".xml"; //master file
+ NbPart=_NbPart;
+ Gradation=_Gradation;
+ MinSize=_MinSize;
+ MaxSize=_MaxSize;
+
+ //an example:
+ //tetrahpc2med --casename=/home/whoami/tmp/GHS3DPRL --number=5 --medname=DOMAIN
+ // --gradation=1.05 --min_size=1e-3 --max_size=1e-2
+ // --verbose=0 --menu=no --launchtetra=yes;
+
+ run_GHS3DPRL = run_GHS3DPRL +
+ " --casename=" + GHS3DPRL_In +
+ " --number=" + NbPart +
+ " --medname=" + GHS3DPRL_Out +
+ " --launchtetra=yes" +
+ " --gradation=" + Gradation +
+ " --min_size=" + MinSize +
+ " --max_size=" + MaxSize +
+ " --verbose=3" +
+ " " + _AdvOptions.c_str();
+ if (_Background) run_GHS3DPRL += " --background=yes"; else run_GHS3DPRL += " --background=no";
+ if (_Multithread) run_GHS3DPRL += " --multithread=yes"; else run_GHS3DPRL += " --multithread=no";
+ run_nokeep_files = rm +GHS3DPRL_In + "* " + path + "tetrahpc.log";
+ system( run_nokeep_files.ToCString() ); //clean files
+ run_nokeep_files = rm + GHS3DPRL_In + "* ";
+
+ cout<<"GHS3DPRL command :\n "<<run_GHS3DPRL.ToCString()<<endl;
+ fileskinmesh=path + "GHS3DPRL.mesh";
+ cout<<" Write input file for tetra_hpc.exe "<<fileskinmesh<<"...";
+ GHS3DPRL_Out = path + casenamemed;
+ removeFile( GHS3DPRL_Outxml ); //only the master xml file
+ //Ok=writeGHS3DPRLFiles(GHS3DPRL_In, meshDS, aSmdsToGHS3DPRLIdMap, aGHS3DPRLIdToNodeMap);
+ bool toCreateGroups = false;
+ theMesh.ExportGMF(fileskinmesh.ToCString(), meshDS, toCreateGroups );
+ cout<<" ...done\n";
+ //else {
+ // cout<<" ...NOT done\n";
+ // pluginerror = pluginerror + "problem writing input tepal files " + GHS3DPRL_In + ".mesh";
+
+ //Ecriture dans un fichier MED ?v2.? meme si not Ok
+ //create empty file -> avoid warning message
+ //med_idt fid=MEDouvrir((const char *)fileskinmed.ToCString(),MED_CREATION);
+ //med_err ret=MEDfermer(fid);
+ //fileskinmed=fileskinmed + "cp /home/wambeke/empty.med "+ path + "GHS3DPRL_skin.med";
+ //system( fileskinmed.ToCString() );
+ fileskinmed=path + "GHS3DPRL_skin.med";
+ cout<<" Write file "<<fileskinmed<<"...";
+ theMesh.ExportMED(fileskinmed.ToCString(),"SKIN_INITIAL",true,1);
+ cout<<" ...done\n\n";
+
+
+ //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() );
+ 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());
+ 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 = readResult( aResultFile, meshDS, theShape, aGHS3DPRLIdToNodeMap, GHS3DPRL_Out, _nodeRefNumber );
+ Ok = true;
+ Ok = false; //but it is not a problem but if true my message is overwritten
+ 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";
+ cout<<pluginerror<<endl;
+ error(COMPERR_ALGO_FAILED, pluginerror.ToCString());
+ if (!_KeepFiles) system( run_nokeep_files.ToCString() );
+ }
+ else{
+ Ok = false; //it is a problem AND my message is NOT overwritten
+ 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";
+ TCollection_AsciiString run_list_files("ls -alt ");
+ run_list_files += GHS3DPRL_Out + "* " + GHS3DPRL_In + "* " + path + "tetrahpc.log";
+ system( run_list_files.ToCString() );
+ cout<<endl;
+ }
+ _countSubMesh=0;
+
+
+ return Ok;
}
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
bool GHS3DPRLPlugin_GHS3DPRL::Evaluate(SMESH_Mesh& aMesh,
#include <SMESHGUI_Utils.h>
#include <SMESHGUI_HypothesesUtils.h>
+#include <SMESH_AdvOptionsWdg.h>
#include CORBA_SERVER_HEADER(GHS3DPRLPlugin_Algorithm)
#include <QtxIntSpinBox.h>
#include <QtxDoubleSpinBox.h>
+#include <QCheckBox>
#include <QFrame>
+#include <QGridLayout>
#include <QGroupBox>
#include <QLabel>
#include <QLineEdit>
-#include <QCheckBox>
+#include <QTabWidget>
#include <QVBoxLayout>
-#include <QGridLayout>
GHS3DPRLPluginGUI_HypothesisCreator::GHS3DPRLPluginGUI_HypothesisCreator( const QString& theHypType )
: SMESHGUI_GenericHypothesisCreator( theHypType ),
lay->setMargin( 5 );
lay->setSpacing( 0 );
- QGroupBox* GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), fr );
+ // tab
+ QTabWidget* tab = new QTabWidget( fr );
+ tab->setTabShape( QTabWidget::Rounded );
+ tab->setTabPosition( QTabWidget::North );
+ lay->addWidget( tab );
+
+ // basic parameters
+ QWidget* GroupC1 = new QWidget();
lay->addWidget( GroupC1 );
QGridLayout* l = new QGridLayout( GroupC1 );
myIs3D = true;
+ myAdvTable = new SMESH_AdvOptionsWdg( fr );
+
+ // add tabs
+ tab->insertTab( 0, GroupC1, tr( "SMESH_ARGUMENTS" ));
+ tab->insertTab( 1, myAdvTable, tr( "SMESH_ADVANCED" ));
+
return fr;
}
myGradation->setValue( data.myGradation );
myMinSize->setValue( data.myMinSize );
myMaxSize->setValue( data.myMaxSize );
+ myAdvTable->SetCustomOptions( data.myAdvOptions );
}
QString GHS3DPRLPluginGUI_HypothesisCreator::storeParams() const
GHS3DPRLPlugin::GHS3DPRLPlugin_Hypothesis::_narrow( initParamsHypothesis() );
HypothesisData* data = SMESH::GetHypothesisData( hypType() );
- h_data.myName = isCreation() && data ? hypName() : "";
- h_data.myMEDName = h->GetMEDName(); //"DOMAIN\0";
- h_data.myNbPart = h->GetNbPart();
- h_data.myKeepFiles = h->GetKeepFiles();
- h_data.myBackground = h->GetBackground();
+ h_data.myName = isCreation() && data ? hypName() : "";
+ h_data.myMEDName = SMESH::toQStr( h->GetMEDName() ); //"DOMAIN\0";
+ h_data.myNbPart = h->GetNbPart();
+ h_data.myKeepFiles = h->GetKeepFiles();
+ h_data.myBackground = h->GetBackground();
h_data.myMultithread = h->GetMultithread();
- //h_data.myToMeshHoles = h->GetToMeshHoles();
- //h_data.myToMergeSubdomains = h->GetToMergeSubdomains();
- h_data.myGradation = h->GetGradation();
- h_data.myMinSize = h->GetMinSize();
- h_data.myMaxSize = h->GetMaxSize();
+ h_data.myGradation = h->GetGradation();
+ h_data.myMinSize = h->GetMinSize();
+ h_data.myMaxSize = h->GetMaxSize();
+ h_data.myAdvOptions = SMESH::toQStr( h->GetAdvancedOption() );
return true;
}
if ( isCreation() )
SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().constData() );
- h->SetMEDName( h_data.myMEDName.toLatin1().constData() );
- h->SetNbPart( h_data.myNbPart );
- h->SetKeepFiles( h_data.myKeepFiles );
- h->SetBackground( h_data.myBackground );
- h->SetMultithread( h_data.myMultithread );
- //h->SetToMeshHoles( h_data.myToMeshHoles );
- //h->SetToMergeSubdomains( h_data.myToMergeSubdomains );
- h->SetGradation( h_data.myGradation );
- h->SetMinSize( h_data.myMinSize );
- h->SetMaxSize( h_data.myMaxSize );
+ h->SetMEDName ( h_data.myMEDName.toLatin1().constData() );
+ h->SetNbPart ( h_data.myNbPart );
+ h->SetKeepFiles ( h_data.myKeepFiles );
+ h->SetBackground ( h_data.myBackground );
+ h->SetMultithread ( h_data.myMultithread );
+ h->SetGradation ( h_data.myGradation );
+ h->SetMinSize ( h_data.myMinSize );
+ h->SetMaxSize ( h_data.myMaxSize );
+ h->SetAdvancedOption( h_data.myAdvOptions.toLatin1().constData() );
}
catch ( const SALOME::SALOME_Exception& ex )
{
bool GHS3DPRLPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DPRLHypothesisData& h_data ) const
{
- h_data.myName = myName ? myName->text() : "";
- h_data.myMEDName = myMEDName->text().simplified().replace(' ', '_');
- h_data.myNbPart = myNbPart->value();
- h_data.myKeepFiles = myKeepFiles->isChecked();
+ h_data.myName = myName ? myName->text() : "";
+ h_data.myMEDName = myMEDName->text().simplified().replace(' ', '_');
+ h_data.myNbPart = myNbPart->value();
+ h_data.myKeepFiles = myKeepFiles->isChecked();
h_data.myBackground = myBackground->isChecked();
- //h_data.myToMeshHoles = myToMeshHoles->isChecked();
- //h_data.myToMergeSubdomains = myToMergeSubdomains->isChecked();
- h_data.myGradation = myGradation->value();
- h_data.myMinSize = myMinSize->value();
- h_data.myMaxSize = myMaxSize->value();
+ h_data.myGradation = myGradation->value();
+ h_data.myMinSize = myMinSize->value();
+ h_data.myMaxSize = myMaxSize->value();
+ h_data.myAdvOptions = myAdvTable->GetCustomOptions();
return true;
}