From 3132571f496782e92117ab64c68636c5835c6d76 Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 20 May 2008 09:46:34 +0000 Subject: [PATCH] PAL19772 integration modifications GHS3DPRL plugin, and Hexotic plugin a message from a CEA developpeur : modified files for plugin GHS3DPRL (and Hexotic) correcting weakness in Hexotic plugin --- .../GHS3DPRLPlugin_GHS3DPRL.cxx | 54 +++++----- .../GHS3DPRLPlugin_Hypothesis.cxx | 100 ++++++++---------- src/GHS3DPRLPlugin/Makefile.in | 7 ++ .../GHS3DPRLPluginGUI_HypothesisCreator.cxx | 6 +- src/tepal2med/ghs3dprl_mesh_wrap.cxx | 5 +- src/tepal2med/tepal2med.cxx | 27 ++--- 6 files changed, 101 insertions(+), 98 deletions(-) diff --git a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx index 46f7df4..47e7cce 100755 --- a/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx +++ b/src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx @@ -83,8 +83,7 @@ bool GHS3DPRLPlugin_GHS3DPRL::CheckHypothesis const TopoDS_Shape& aShape, SMESH_Hypothesis::Hypothesis_Status& aStatus) { - MESSAGE("GHS3DPRLPlugin_GHS3DPRL::CheckHypothesis"); - + //MESSAGE("GHS3DPRLPlugin_GHS3DPRL::CheckHypothesis"); _hypothesis = NULL; list::const_iterator itl; @@ -376,7 +375,8 @@ static bool readResult(FILE * theFile, //============================================================================= // Pass parameters to GHS3DPRL -void GHS3DPRLPlugin_GHS3DPRL::SetParameters(const GHS3DPRLPlugin_Hypothesis* hyp) { +void GHS3DPRLPlugin_GHS3DPRL::SetParameters(const GHS3DPRLPlugin_Hypothesis* hyp) +{ if (hyp) { MESSAGE("GHS3DPRLPlugin_GHS3DPRL::SetParameters"); _MEDName = hyp->GetMEDName(); //"DOMAIN\0" @@ -386,13 +386,13 @@ void GHS3DPRLPlugin_GHS3DPRL::SetParameters(const GHS3DPRLPlugin_Hypothesis* hyp } //======================================================================= - +//before launching salome +//SALOME_TMP_DIR (for keep tepal intermediates files) could be set in user's directories static TCollection_AsciiString getTmpDir() { TCollection_AsciiString aTmpDir; - char *Tmp_dir = getenv("SALOME_TMP_DIR"); - if (Tmp_dir == NULL) Tmp_dir = getenv("TMPDIR"); + if (Tmp_dir == NULL) Tmp_dir = getenv("TMP"); if(Tmp_dir != NULL) { aTmpDir = Tmp_dir; @@ -407,10 +407,9 @@ static TCollection_AsciiString getTmpDir() #ifdef WIN32 aTmpDir = TCollection_AsciiString("C:\\"); #else - aTmpDir = TCollection_AsciiString("/export/home/"); + aTmpDir = TCollection_AsciiString("/tmp/"); #endif } - //cout<<"getTmpDir()="<0) @@ -488,14 +485,20 @@ bool GHS3DPRLPlugin_GHS3DPRL::Compute(SMESH_Mesh& theMesh, GHS3DPRL_In=path + "GHS3DPRL"; GHS3DPRL_Out=path + casenamemed; NbPart=_NbPart; - run_GHS3DPRL += GHS3DPRL_In + " " + NbPart + " 12500000 1 Test noMemu LaunchTepal " + GHS3DPRL_Out; - run_keep_files += GHS3DPRL_In + ".*.*.* " + path + "tepal.out"; + run_GHS3DPRL += GHS3DPRL_In + " " + NbPart + " 12500000 1 Test noMenu LaunchTepal " + GHS3DPRL_Out ; + run_nokeep_files += GHS3DPRL_In + ".*.*.* " + path + "tepal.log"; + + system( run_nokeep_files.ToCString() ); //clean files cout<<"GHS3DPRL command : "< #include +#include //============================================================================= /*! @@ -53,8 +54,14 @@ GHS3DPRLPlugin_Hypothesis::GHS3DPRLPlugin_Hypothesis (int hypId, int studyId, //============================================================================= void GHS3DPRLPlugin_Hypothesis::SetMEDName(string theVal) { - if (theVal != _MEDName) { - _MEDName = theVal; + //without whitespaces! ..from python? + QString tmp1,tmp2; + tmp1 = (QString) theVal; + tmp1.simplifyWhiteSpace(); //for qt3 + tmp1.replace(QChar(' '),QChar('_')); + tmp2 = (QString) _MEDName; + if (tmp1 != tmp2) { + _MEDName = (const char *) tmp1; NotifySubMeshesHypothesisModification(); } } @@ -80,12 +87,15 @@ void GHS3DPRLPlugin_Hypothesis::SetKeepFiles(bool theVal) { //============================================================================= ostream & GHS3DPRLPlugin_Hypothesis::SaveTo(ostream & save) { - save << "MEDName=" << _MEDName; - save << "NbPart=" << _NbPart; - save << "KeepFiles=" << (int)_KeepFiles; - cout << endl; - cout << "save : " << save << endl; - cout << endl; + /*save << _MEDName ; //without whitespaces! + save << " " << _NbPart; + save << " " << (int)_KeepFiles;*/ + + //explicit outputs for future code compatibility of saved .hdf + //save without any whitespaces! + save<<"MEDName="<<_MEDName<<";"; + save<<"NbPart="<<_NbPart<<";"; + save<<"KeepFiles="<<(int) _KeepFiles<<";"; return save; } @@ -96,55 +106,31 @@ ostream & GHS3DPRLPlugin_Hypothesis::SaveTo(ostream & save) //============================================================================= istream & GHS3DPRLPlugin_Hypothesis::LoadFrom(istream & load) { -// bool isOK = true; -// int is; -// double val; - -// isOK = (load >> val); -// if (isOK) -// _maxSize = val; -// else -// load.clear(ios::badbit | load.rdstate()); - -// isOK = (load >> is); -// if (isOK) -// SetFineness((Fineness) is); -// else -// load.clear(ios::badbit | load.rdstate()); - -// if (_fineness == UserDefined) -// { -// isOK = (load >> val); -// if (isOK) -// _growthRate = val; -// else -// load.clear(ios::badbit | load.rdstate()); - -// isOK = (load >> val); -// if (isOK) -// _nbSegPerEdge = val; -// else -// load.clear(ios::badbit | load.rdstate()); - -// isOK = (load >> val); -// if (isOK) -// _nbSegPerRadius = val; -// else -// load.clear(ios::badbit | load.rdstate()); -// } - -// isOK = (load >> is); -// if (isOK) -// _secondOrder = (bool) is; -// else -// load.clear(ios::badbit | load.rdstate()); - -// isOK = (load >> is); -// if (isOK) -// _optimize = (bool) is; -// else -// load.clear(ios::badbit | load.rdstate()); - return load; + //explicit inputs for future code compatibility of saved .hdf + bool isOK = true; + int imax; + string str1; + QString str2,str3,str4,str5; + + //save without any whitespaces! + isOK = (load >> str1); + if (!(isOK)) { + //defaults values assumed + load.clear(ios::badbit | load.rdstate()); + return load; + } + str2 = (QString) str1; + imax = str2.contains(";"); + for (int i=0; i<=imax; i++) { + str3 = str2.section(";",i,i); + str4 = str3.section("=",0,0); + str5 = str3.section("=",1,1); + + if (str4=="MEDName") _MEDName = str5.ascii(); + if (str4=="NbPart") _NbPart = str5.toInt(); + if (str4=="KeepFiles") _KeepFiles = (bool) str5.toInt(); + } + return load; } //============================================================================= diff --git a/src/GHS3DPRLPlugin/Makefile.in b/src/GHS3DPRLPlugin/Makefile.in index 525c23f..45fd4a7 100755 --- a/src/GHS3DPRLPlugin/Makefile.in +++ b/src/GHS3DPRLPlugin/Makefile.in @@ -51,4 +51,11 @@ LIB_CLIENT_IDL = \ # Libraries targets LIB = libGHS3DPRLEngine.la +CPPFLAGS+=$(QT_INCLUDES) +LDFLAGSFORBIN+=-lm $(QT_LIBS) + +$(BIN):$(OBJ) + $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(QT_LIBS) $< + + @CONCLUDE@ diff --git a/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.cxx b/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.cxx index ccb2df8..bcd9d03 100755 --- a/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.cxx +++ b/src/gui/GHS3DPRLPluginGUI_HypothesisCreator.cxx @@ -65,6 +65,7 @@ bool GHS3DPRLPluginGUI_HypothesisCreator::checkParams() const readParamsFromHypo( data_old ); readParamsFromWidgets( data_new ); bool res = storeParamsToHypo( data_new ); + storeParamsToHypo( data_old ); return res; } @@ -179,9 +180,12 @@ bool GHS3DPRLPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DPRLHypothe { h_data.myName = myName ? myName->text() : ""; h_data.myMEDName = myMEDName->text(); + //without whitespaces! + //h_data.myMEDName.simplified(); //for qt4 + h_data.myMEDName.simplifyWhiteSpace(); //for qt3 + h_data.myMEDName.replace(QChar(' '),QChar('_')); h_data.myNbPart = myNbPart->value(); h_data.myKeepFiles = myKeepFiles->isChecked(); - return true; } diff --git a/src/tepal2med/ghs3dprl_mesh_wrap.cxx b/src/tepal2med/ghs3dprl_mesh_wrap.cxx index 6a699c2..2a15d8b 100755 --- a/src/tepal2med/ghs3dprl_mesh_wrap.cxx +++ b/src/tepal2med/ghs3dprl_mesh_wrap.cxx @@ -927,6 +927,7 @@ bool ghs3dprl_mesh_wrap::Write_MEDfiles() file<<"#MED Fichier V 2.3"<<" "<nbfiles; + long nbtetrastotal=0; file<restore_key(key1); //tab1=this->mestab[key1]; med_int nbtetras=tab1->size/4; - if (this->verbose>4) cout<<"NumberOfTetraedes="< 11)||(argc < 2)) @@ -150,22 +150,25 @@ int main(int argc, char **argv) //verbose=5; if (verbose>0) - cout<<"CaseNameTepal="< "+path+"tepal.out"; - cout<<"LaunchTepal Command = "< "+path+"tepal.log"; + cout<<"\nLaunchTepal Command = "<