From: Gerald NICOLAS Date: Mon, 15 Jan 2018 10:39:53 +0000 (+0100) Subject: Introduction de la frontière CAO X-Git-Tag: V9_0_0^2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f10e5af20a8a60e551c453e3882e3f78209c38d0;p=modules%2Fhomard.git Introduction de la frontière CAO --- diff --git a/src/FrontTrack/FrontTrack.cxx b/src/FrontTrack/FrontTrack.cxx index 7c0706c3..1b9a6ffd 100755 --- a/src/FrontTrack/FrontTrack.cxx +++ b/src/FrontTrack/FrontTrack.cxx @@ -22,7 +22,7 @@ * \param [in] theInputMedFile - a MED file holding a mesh including nodes that will be * moved onto the geometry * \param [in] theOutputMedFile - a MED file to create, that will hold a modified mesh - * \param [in] theNodeFiles - an array of names of files describing groups of nodes that + * \param [in] theInputNodeFiles - an array of names of files describing groups of nodes that * will be moved onto the geometry * \param [in] theXaoFileName - a path to a file in XAO format holding the geometry and * the geometrical groups. @@ -31,43 +31,58 @@ */ void FrontTrack::track( const std::string& theInputMedFile, const std::string& theOutputMedFile, - const std::vector< std::string > & theNodeFiles, + const std::vector< std::string > & theInputNodeFiles, const std::string& theXaoFileName, bool theIsParallel ) { // check arguments +#ifdef _DEBUG_ + std::cout << "FrontTrack::track" << std::endl; +#endif - if ( theNodeFiles.empty() ) + if ( theInputNodeFiles.empty() ) return; #ifdef _DEBUG_ - std::cout << "Input MED file:" << theInputMedFile << std::endl; + std::cout << "Input MED file: " << theInputMedFile << std::endl; #endif if ( !FT_Utils::fileExists( theInputMedFile )) throw std::invalid_argument( "Input MED file does not exist: " + theInputMedFile ); #ifdef _DEBUG_ - std::cout << "Output MED file:" << theOutputMedFile << std::endl; + std::cout << "Output MED file: " << theOutputMedFile << std::endl; #endif if ( !FT_Utils::canWrite( theOutputMedFile )) throw std::invalid_argument( "Can't create the output MED file: " + theOutputMedFile ); - for ( size_t i = 0; i < theNodeFiles.size(); ++i ) + std::vector< std::string > theNodeFiles ; + for ( size_t i = 0; i < theInputNodeFiles.size(); ++i ) { #ifdef _DEBUG_ - std::cout << "Input node file:" << theNodeFiles[i] << std::endl; + std::cout << "Initial input node file #"<1 + // keep only files with more than 1 line: + std::ifstream fichier(theInputNodeFiles[i].c_str()); + std::string s; + unsigned int nb_lines = 0; + while(std::getline(fichier,s)) ++nb_lines; +// std::cout << ". nb_lines: " << nb_lines << std::endl; + if ( nb_lines >= 2 ) { theNodeFiles.push_back( theInputNodeFiles[i] ); } } +#ifdef _DEBUG_ + for ( size_t i = 0; i < theNodeFiles.size(); ++i ) + { std::cout << "Valid input node file #"< & nodeFiles, - const std::string& xaoFileName, - bool isParallel=true); + void track( const std::string& theInputMedFile, + const std::string& theOutputMedFile, + const std::vector< std::string > & theInputNodeFiles, + const std::string& theXaoFileName, + bool theIsParallel=true); }; diff --git a/src/FrontTrack/FrontTrack_NodesOnGeom.cxx b/src/FrontTrack/FrontTrack_NodesOnGeom.cxx index 911358d5..5328b672 100755 --- a/src/FrontTrack/FrontTrack_NodesOnGeom.cxx +++ b/src/FrontTrack/FrontTrack_NodesOnGeom.cxx @@ -55,7 +55,7 @@ void FT_NodesOnGeom::read( const std::string& theNodeFile, // get shape dimension by the file name // ------------------------------------- - // hope the file name is something like "fr2D.**" + // hope the file name is something like "frnD.**" with n in (1,2) int dimPos = theNodeFile.size() - 5; if ( theNodeFile[ dimPos ] == '2' ) _shapeDim = 2; @@ -63,6 +63,9 @@ void FT_NodesOnGeom::read( const std::string& theNodeFile, _shapeDim = 1; else throw std::invalid_argument( "Can't define dimension by node file name " + theNodeFile ); +#ifdef _DEBUG_ + std::cout << ". Dimension of the file " << theNodeFile << ": " << _shapeDim << std::endl; +#endif // ------------------------------------- // read geom group names; several lines @@ -77,7 +80,9 @@ void FT_NodesOnGeom::read( const std::string& theNodeFile, while ( ::fgets( line, maxLineLen, file )) // read a line { if ( ::feof( file )) + { return; // no nodes in the file + } // check if the line describes node ids in format 3I10 (e.g. " 120 1 43\n") size_t lineLen = strlen( line ); @@ -149,6 +154,9 @@ void FT_NodesOnGeom::read( const std::string& theNodeFile, for ( size_t i = 0; i < geomNames.size(); ++i ) { std::string & groupName = geomNames[i]; +#ifdef _DEBUG_ + std::cout << ". Group name: " << groupName << std::endl; +#endif // remove trailing white spaces for ( int iC = groupName.size() - 1; iC >= 0; --iC ) @@ -219,7 +227,9 @@ void FT_NodesOnGeom::read( const std::string& theNodeFile, void FT_NodesOnGeom::projectAndMove() { _OK = true; - +// +// 1. Préalables +// // check if all the shapes are planar bool isAllPlanar = true; for ( size_t i = 0; i < _projectors.size() && isAllPlanar; ++i ) @@ -240,6 +250,10 @@ void FT_NodesOnGeom::projectAndMove() std::cout << ".. _projectors.size() = " << _projectors.size() << std::endl; std::cout << ".. _nodesOrder.size() = " << _nodesOrder.size() << std::endl; #endif +// +// 2. Calculs +// 2.1. Avec plusieurs shapes +// if ( _projectors.size() > 1 ) { // the nodes are to be projected onto several boundary shapes; @@ -284,6 +298,9 @@ void FT_NodesOnGeom::projectAndMove() } } } +// +// 2.2. Avec une seule shape +// else // one shape { for ( size_t i = 0; i < _nodesOrder.size(); ++i ) @@ -293,8 +310,11 @@ void FT_NodesOnGeom::projectAndMove() gp_Pnt xyz1 = getPoint( nn._neighborNodes[0] ); gp_Pnt xyz2 = getPoint( nn._neighborNodes[1] ); - // maxDist2 : le quart du carré de la distance entre les deux voisins du noued à bouger +// maxDist2 : le quart du carré de la distance entre les deux voisins du noeud à bouger double maxDist2 = xyz1.SquareDistance( xyz2 ) / 4.; +#ifdef _DEBUG_ + std::cout << "\n.. maxDist2 = " << maxDist2 << " entre " << nn._neighborNodes[0] << " et " << nn._neighborNodes[1] << " - milieu " << nn._nodeToMove << " - d/2 = " << sqrt(maxDist2) << " - d = " << sqrt(xyz1.SquareDistance( xyz2 )) << std::endl; +#endif if ( _projectors[ 0 ].project( xyz, maxDist2, newXyz, nn._params, nn._nearParams )) moveNode( nn._nodeToMove, newXyz ); @@ -302,8 +322,9 @@ void FT_NodesOnGeom::projectAndMove() notProjectedNodes.push_back( &nn ); } } - - +// +// 3. Bilan +// if ( !notProjectedNodes.empty() ) { // project nodes that are not projected by any of _projectors; diff --git a/src/FrontTrack/FrontTrack_Projector.cxx b/src/FrontTrack/FrontTrack_Projector.cxx index a23d00dc..efc18779 100755 --- a/src/FrontTrack/FrontTrack_Projector.cxx +++ b/src/FrontTrack/FrontTrack_Projector.cxx @@ -104,6 +104,9 @@ namespace // actual projection algorithms double* newSolution, const double* prevSolution = 0) { +#ifdef _DEBUG_ + std::cout << ".. project a point to the curve prevSolution = " << prevSolution << std::endl; +#endif gp_Pnt proj; Standard_Real param; @@ -115,6 +118,9 @@ namespace // actual projection algorithms { _dist = _projector.Project( _curve, P, _tol, proj, param, false ); } +#ifdef _DEBUG_ + std::cout << ".. _dist : " << _dist << std::endl; +#endif proj = _curve.Value( param ); newSolution[0] = param; @@ -130,6 +136,9 @@ namespace // actual projection algorithms double* newSolution, const double* prevSolution = 0) { +#ifdef _DEBUG_ + std::cout << ".. project a point to a curve and check " << std::endl; +#endif projection = project( point, newSolution, prevSolution ); return ( _uRange[0] < newSolution[0] && newSolution[0] < _uRange[1] && _dist * _dist < maxDist2 ); @@ -611,7 +620,7 @@ namespace // actual projection algorithms bool isStraight( const GeomAdaptor_Curve& curve, const double tol ) { // rough check: evaluate how far from a straight line connecting the curve ends - // stand several internal points of the curve + // stand several internal points of the curve const double f = curve.FirstParameter(); const double l = curve.LastParameter(); diff --git a/src/HOMARD/HOMARD_Boundary.cxx b/src/HOMARD/HOMARD_Boundary.cxx index 48dd23f5..66cd160f 100644 --- a/src/HOMARD/HOMARD_Boundary.cxx +++ b/src/HOMARD/HOMARD_Boundary.cxx @@ -77,12 +77,19 @@ std::string HOMARD_Boundary::GetDumpPython() const // switch (_Type) { + case -1: + { + aScript << "CAO boundary " << _Name << "\n"; + aScript << "\t" << _Name << " = homard.CreateBoundaryCAO(\"" << _Name << "\", "; + aScript << "\"" << _DataFile << "\")\n"; + break ; + } case 0: { aScript << "discrete boundary " << _Name << "\n"; aScript << "\t" << _Name << " = homard.CreateBoundaryDi(\"" << _Name << "\", "; aScript << "\"" << _MeshName << "\", "; - aScript << "\"" << _MeshFile << "\")\n"; + aScript << "\"" << _DataFile << "\")\n"; break ; } case 1: @@ -149,14 +156,14 @@ std::string HOMARD_Boundary::GetMeshName() const return _MeshName; } //============================================================================= -void HOMARD_Boundary::SetMeshFile( const char* MeshFile ) +void HOMARD_Boundary::SetDataFile( const char* DataFile ) { - _MeshFile = std::string( MeshFile ); + _DataFile = std::string( DataFile ); } //============================================================================= -std::string HOMARD_Boundary::GetMeshFile() const +std::string HOMARD_Boundary::GetDataFile() const { - return _MeshFile; + return _DataFile; } //======================================================================================= void HOMARD_Boundary::SetCylinder( double X0, double X1, double X2, diff --git a/src/HOMARD/HOMARD_Boundary.hxx b/src/HOMARD/HOMARD_Boundary.hxx index aa2fd594..322bc523 100644 --- a/src/HOMARD/HOMARD_Boundary.hxx +++ b/src/HOMARD/HOMARD_Boundary.hxx @@ -63,8 +63,8 @@ public: void SetMeshName( const char* MeshName ); std::string GetMeshName() const; - void SetMeshFile( const char* MeshFile ); - std::string GetMeshFile() const; + void SetDataFile( const char* DataFile ); + std::string GetDataFile() const; void SetCylinder( double X0, double X1, double X2, double X3, double X4, double X5, double X6 ); @@ -92,7 +92,7 @@ public: private: std::string _Name; std::string _NomCasCreation; - std::string _MeshFile; + std::string _DataFile; std::string _MeshName; int _Type; double _Xmin, _Xmax, _Ymin, _Ymax, _Zmin, _Zmax; diff --git a/src/HOMARD/HOMARD_Cas.cxx b/src/HOMARD/HOMARD_Cas.cxx index 9e23c1ce..f92fa262 100644 --- a/src/HOMARD/HOMARD_Cas.cxx +++ b/src/HOMARD/HOMARD_Cas.cxx @@ -109,11 +109,11 @@ std::string HOMARD_Cas::GetDumpPython() const //============================================================================= int HOMARD_Cas::SetDirName( const char* NomDir ) { - MESSAGE("SetDirName, NomDir : "< 1 ) { erreur = 1 ; } // Creation if ( CHDIR(NomDir) == 0 ) @@ -220,10 +220,17 @@ void HOMARD_Cas::SupprGroups() // Les frontieres // //============================================================================= +void HOMARD_Cas::AddBoundary( const char* Boundary ) +{ +// MESSAGE ( ". HOMARD_Cas::AddBoundary : Boundary = " << Boundary ); + const char* Group = ""; + AddBoundaryGroup( Boundary, Group ); +} +//============================================================================= void HOMARD_Cas::AddBoundaryGroup( const char* Boundary, const char* Group ) { -// MESSAGE ( ". AddBoundaryGroup : Boundary = " << Boundary ); -// MESSAGE ( ". AddBoundaryGroup : Group = " << Group ); +// MESSAGE ( ". HOMARD_Cas::AddBoundaryGroup : Boundary = " << Boundary ); +// MESSAGE ( ". HOMARD_Cas::AddBoundaryGroup : Group = " << Group ); _ListBoundaryGroup.push_back( Boundary ); _ListBoundaryGroup.push_back( Group ); } diff --git a/src/HOMARD/HOMARD_Cas.hxx b/src/HOMARD/HOMARD_Cas.hxx index f478539a..039368f2 100644 --- a/src/HOMARD/HOMARD_Cas.hxx +++ b/src/HOMARD/HOMARD_Cas.hxx @@ -76,6 +76,7 @@ public: const std::list& GetGroups() const; void SupprGroups(); + void AddBoundary( const char* Boundary ); void AddBoundaryGroup( const char* Boundary, const char* Group ); const std::list& GetBoundaryGroup() const; void SupprBoundaryGroup(); diff --git a/src/HOMARD/HOMARD_DriverTools.cxx b/src/HOMARD/HOMARD_DriverTools.cxx index 72697d94..6110d3d9 100644 --- a/src/HOMARD/HOMARD_DriverTools.cxx +++ b/src/HOMARD/HOMARD_DriverTools.cxx @@ -303,10 +303,14 @@ namespace HOMARD os << separator() << BoundaryType ; os << separator() << boundary.GetCaseCreation() ; - if ( BoundaryType == 0 ) + if ( BoundaryType == -1 ) + { + os << separator() << boundary.GetDataFile(); + } + else if ( BoundaryType == 0 ) { os << separator() << boundary.GetMeshName(); - os << separator() << boundary.GetMeshFile(); + os << separator() << boundary.GetDataFile(); } else { std::vector coor = boundary.GetCoords() ; @@ -744,12 +748,20 @@ namespace HOMARD // Si analytique, les coordonnees des frontieres : le nombre depend du type // Si discret, le maillage + // Si CAO, la géométrie int lgcoords ; - if ( BoundaryType == 1 ) { lgcoords = 7 ; } + if ( BoundaryType == -1 ) { lgcoords = -1 ; } + else if ( BoundaryType == 1 ) { lgcoords = 7 ; } else if ( BoundaryType == 2 ) { lgcoords = 4 ; } else { lgcoords = 0 ; } // - if ( lgcoords == 0 ) + if ( lgcoords == -1 ) + { + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + boundary.SetDataFile( chunk.c_str() ); + } + else if ( lgcoords == 0 ) { chunk = getNextChunk( stream, start, ok ); if ( !ok ) return false; @@ -757,7 +769,7 @@ namespace HOMARD chunk = getNextChunk( stream, start, ok ); if ( !ok ) return false; - boundary.SetMeshFile( chunk.c_str() ); + boundary.SetDataFile( chunk.c_str() ); } else { std::vector coords; diff --git a/src/HOMARD/HomardDriver.cxx b/src/HOMARD/HomardDriver.cxx index cb000bb8..1a545d91 100644 --- a/src/HOMARD/HomardDriver.cxx +++ b/src/HOMARD/HomardDriver.cxx @@ -85,12 +85,13 @@ void HomardDriver::TexteAdap( int ExtType ) else { _Texte += "CCAssoci saturne_2d\n" ; } _Texte += "ModeHOMA 1\n" ; _Texte += "NumeIter " + _siter + "\n" ; + _modeHOMARD = 1 ; // } //=============================================================================== void HomardDriver::TexteInfo( int TypeBila, int NumeIter ) { - MESSAGE("TexteInit, TypeBila ="<\n" ; - _Texte += " Etude_Initialisation.UpdateStudy\n" ; + _Texte += " Etude_Initialisation.SetCurrentStudy\n" ; _Texte += " " + methode + "\n" ; // 4. Les inports // 4.1. Le nom de la zone @@ -293,7 +293,7 @@ std::string YACSDriver::Texte_Iter_1_Boundary( int BoundaryType, const std::stri _noeud_1 = noeud_2 ; // 3. Definition du service _Texte += " \n" ; - _Texte += " Etude_Initialisation.UpdateStudy\n" ; + _Texte += " Etude_Initialisation.SetCurrentStudy\n" ; _Texte += " " + methode + "\n" ; // 4. Les inports // ATTENTION : les noms doivent etre les memes que dans Gen.xml, donc HOMARD_Gen.idl diff --git a/src/HOMARDGUI/CMakeLists.txt b/src/HOMARDGUI/CMakeLists.txt index 48382c78..08709354 100644 --- a/src/HOMARDGUI/CMakeLists.txt +++ b/src/HOMARDGUI/CMakeLists.txt @@ -67,10 +67,11 @@ SET(_ts_RESOURCES HOMARD_msg_en.ts HOMARD_msg_fr.ts HOMARD_msg_ja.ts -) +) # resource files / to be processed by uic SET(_uic_FILES + CreateBoundaryCAO.ui CreateBoundaryAn.ui CreateBoundaryDi.ui CreateCase.ui @@ -90,9 +91,11 @@ SET(_uic_FILES # header files / to be processed by moc SET(_moc_HEADERS HOMARDGUI.h + MonCreateBoundaryCAO.h MonCreateBoundaryAn.h - MonEditBoundaryAn.h MonCreateBoundaryDi.h + MonEditBoundaryCAO.h + MonEditBoundaryAn.h MonEditBoundaryDi.h MonCreateCase.h MonEditCase.h @@ -101,7 +104,9 @@ SET(_moc_HEADERS MonCreateHypothesis.h MonEditHypothesis.h MonCreateListGroup.h + MonCreateListGroupCAO.h MonEditListGroup.h + MonEditListGroupCAO.h MonCreateIteration.h MonEditIteration.h MonPursueIteration.h @@ -114,7 +119,7 @@ SET(_moc_HEADERS # header files / uic wrappings QT_WRAP_UIC(_uic_HEADERS ${_uic_FILES}) - + # header files / static SET(_other_HEADERS HOMARDGUI_Utils.h @@ -134,16 +139,20 @@ QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS}) SET(_other_SOURCES HOMARDGUI.cxx HOMARDGUI_Utils.cxx + MonCreateBoundaryCAO.cxx MonCreateBoundaryAn.cxx - MonEditBoundaryAn.cxx MonCreateBoundaryDi.cxx + MonEditBoundaryCAO.cxx + MonEditBoundaryAn.cxx MonEditBoundaryDi.cxx MonCreateCase.cxx MonEditCase.cxx MonCreateHypothesis.cxx MonEditHypothesis.cxx MonCreateListGroup.cxx + MonCreateListGroupCAO.cxx MonEditListGroup.cxx + MonEditListGroupCAO.cxx MonCreateIteration.cxx MonEditIteration.cxx MonPursueIteration.cxx diff --git a/src/HOMARDGUI/CreateBoundaryCAO.ui b/src/HOMARDGUI/CreateBoundaryCAO.ui new file mode 100755 index 00000000..c74c6012 --- /dev/null +++ b/src/HOMARDGUI/CreateBoundaryCAO.ui @@ -0,0 +1,133 @@ + + + CreateBoundaryCAO + + + + 0 + 0 + 566 + 195 + + + + + 0 + 0 + + + + Get CAO + + + true + + + true + + + + 9 + + + 6 + + + + + + + + + 9 + + + 6 + + + + + Help + + + + + + + Cancel + + + + + + + Apply + + + + + + + OK + + + + + + + + + + Filtering with groups + + + + + + + + 370 + 21 + + + + + + + + + + + + + + + XAO + + + + + + + + 382 + 21 + + + + 32 + + + + + + + Name + + + + + + + + diff --git a/src/HOMARDGUI/CreateCase.ui b/src/HOMARDGUI/CreateCase.ui index 77c562de..14fe44db 100644 --- a/src/HOMARDGUI/CreateCase.ui +++ b/src/HOMARDGUI/CreateCase.ui @@ -7,7 +7,7 @@ 0 0 600 - 1026 + 1150 @@ -202,7 +202,62 @@ - + + + + Boundary type + + + + 6 + + + 9 + + + + + No boundary + + + true + + + + + + + CAO + + + false + + + + + + + Non CAO + + + + + + + + + + Qt::Vertical + + + + 20 + 1 + + + + + 6 @@ -226,34 +281,8 @@ - - - - Qt::Vertical - - - - 20 - 1 - - - - - - - - Qt::Vertical - - - - 20 - 2 - - - - - - + + 0 @@ -261,9 +290,9 @@ - Discrete boundary + CAO - + 9 @@ -271,7 +300,7 @@ 6 - + Edit @@ -280,8 +309,44 @@ + + + + Help + + + false + + + + + + + -1 + + + QComboBox::AdjustToContents + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 13 + + + + - + New @@ -290,6 +355,40 @@ + + + + + + + Qt::Vertical + + + + 20 + 2 + + + + + + + + + 0 + 0 + + + + Discrete boundary + + + + 9 + + + 6 + @@ -316,6 +415,16 @@ + + + + Edit + + + false + + + @@ -326,10 +435,20 @@ + + + + New + + + false + + + - + @@ -405,7 +524,7 @@ - + Qt::Vertical @@ -418,14 +537,14 @@ - + Advanced options - + Advanced options @@ -482,37 +601,37 @@ - - - - - - - Format - - - - - - MED - - - true - - - - - - - Saturne - - - - - - - Saturne 2D + + + + Format + + + + + MED + + + true + + + + + + + Saturne + + + + + + + Saturne 2D + + + + @@ -521,7 +640,7 @@ - + Qt::Horizontal @@ -537,7 +656,7 @@ - + Qt::Vertical @@ -550,14 +669,27 @@ - + No comment. - + + + + Qt::Vertical + + + + 20 + 35 + + + + + @@ -612,20 +744,7 @@ - - - - Qt::Vertical - - - - 20 - 35 - - - - - + Qt::Horizontal @@ -642,6 +761,16 @@ + WName + GBTypeConf + GBBoundaryD + GBBoundaryA + CBAdvanced + GBAdvancedOptions + Comment + GroupButtons + GBBoundaryC + GBTypeBoun diff --git a/src/HOMARDGUI/HOMARDGUI.cxx b/src/HOMARDGUI/HOMARDGUI.cxx index 3d582396..e5e5c11c 100644 --- a/src/HOMARDGUI/HOMARDGUI.cxx +++ b/src/HOMARDGUI/HOMARDGUI.cxx @@ -59,6 +59,7 @@ #include "MonCreateIteration.h" #include "MonPursueIteration.h" #include "MonCreateYACS.h" +#include "MonEditBoundaryCAO.h" #include "MonEditBoundaryAn.h" #include "MonEditBoundaryDi.h" #include "MonEditCase.h" @@ -465,8 +466,14 @@ bool HOMARDGUI::OnGUIEvent (int theCommandID) _PTR(SObject) obj = chercheMonObjet(); if (obj) { + // Edition d'une frontiere CAO + if (HOMARD_UTILS::isBoundaryCAO(obj)) + { + MonEditBoundaryCAO *aDlg = new MonEditBoundaryCAO(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ; + aDlg->show(); + } // Edition d'une frontiere discrete - if (HOMARD_UTILS::isBoundaryDi(obj)) + else if (HOMARD_UTILS::isBoundaryDi(obj)) { MonEditBoundaryDi *aDlg = new MonEditBoundaryDi(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ; aDlg->show(); @@ -521,7 +528,7 @@ bool HOMARDGUI::OnGUIEvent (int theCommandID) if (obj) { // Suppression d'une frontiere - if ( HOMARD_UTILS::isBoundaryDi(obj) || HOMARD_UTILS::isBoundaryAn(obj) ) + if ( HOMARD_UTILS::isBoundaryCAO(obj) || HOMARD_UTILS::isBoundaryDi(obj) || HOMARD_UTILS::isBoundaryAn(obj) ) { try { homardGen->DeleteBoundary(_ObjectName.toStdString().c_str()); } @@ -755,7 +762,12 @@ void HOMARDGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& t bool DeleteObject = false ; bool EditObject = false ; // - if ( HOMARD_UTILS::isBoundaryAn(obj) ) + if ( HOMARD_UTILS::isBoundaryCAO(obj) ) + { + EditObject = true ; + DeleteObject = true ; + } + else if ( HOMARD_UTILS::isBoundaryAn(obj) ) { EditObject = true ; DeleteObject = true ; diff --git a/src/HOMARDGUI/HOMARDGUI_Utils.cxx b/src/HOMARDGUI/HOMARDGUI_Utils.cxx index 1f5abdc0..97aa1e1a 100644 --- a/src/HOMARDGUI/HOMARDGUI_Utils.cxx +++ b/src/HOMARDGUI/HOMARDGUI_Utils.cxx @@ -186,6 +186,13 @@ bool HOMARD_UTILS::isObject(_PTR(SObject) MonObj, QString TypeObject, int option return bOK ; } //================================================================ +// Retourne vrai si l'objet est une frontiere CAO +//================================================================ +bool HOMARD_UTILS::isBoundaryCAO(_PTR(SObject) MonObj) +{ + return isObject( MonObj, QString("BoundaryCAOHomard"), -1 ) ; +} +//================================================================ // Retourne vrai si l'objet est une frontiere analytique //================================================================ bool HOMARD_UTILS::isBoundaryAn(_PTR(SObject) MonObj) diff --git a/src/HOMARDGUI/HOMARDGUI_Utils.h b/src/HOMARDGUI/HOMARDGUI_Utils.h index 2946cf54..762c46be 100644 --- a/src/HOMARDGUI/HOMARDGUI_Utils.h +++ b/src/HOMARDGUI/HOMARDGUI_Utils.h @@ -71,6 +71,7 @@ namespace HOMARD_UTILS { // Function returns the last selected object in the list // of selected objects + HOMARD_EXPORT bool isBoundaryCAO(_PTR(SObject) MonObj); HOMARD_EXPORT bool isBoundaryAn(_PTR(SObject) MonObj); HOMARD_EXPORT bool isBoundaryDi(_PTR(SObject) MonObj); HOMARD_EXPORT bool isCase(_PTR(SObject) MonObj); diff --git a/src/HOMARDGUI/HOMARD_msg_en.ts b/src/HOMARDGUI/HOMARD_msg_en.ts index b95385fd..26c84aa1 100644 --- a/src/HOMARDGUI/HOMARD_msg_en.ts +++ b/src/HOMARDGUI/HOMARD_msg_en.ts @@ -363,6 +363,10 @@ HOM_BOUN_MESH The file for the mesh of the boundary must be selected. + + HOM_BOUN_CAO + The file for the CAO must be selected. + HOM_BOUN_CASE The meshfile of the case is unknown. @@ -371,6 +375,10 @@ HOM_AXE The axis must be a non 0 vector. + + HOM_BOUN_C_EDIT_WINDOW_TITLE + Edition of a CAO based boundary + HOM_BOUN_A_EDIT_WINDOW_TITLE Edition of an analytical boundary diff --git a/src/HOMARDGUI/HOMARD_msg_fr.ts b/src/HOMARDGUI/HOMARD_msg_fr.ts index 2026c26b..56140368 100644 --- a/src/HOMARDGUI/HOMARD_msg_fr.ts +++ b/src/HOMARDGUI/HOMARD_msg_fr.ts @@ -29,7 +29,7 @@ HOM_MEN_PURSUE_ITERATION - Cas de poursuite d'une itération + Cas de poursuite d'une itération HOM_MEN_COMPUTE @@ -77,7 +77,7 @@ HOM_TOP_PURSUE_ITERATION - Cas de poursuite d'une itération + Cas de poursuite d'une itération HOM_TOP_COMPUTE @@ -113,7 +113,7 @@ HOM_STB_PURSUE_ITERATION - Cas de poursuite d'une itération + Cas de poursuite d'une itération HOM_STB_COMPUTE @@ -225,7 +225,7 @@ HOM_SELECT_FILE_3 - Impossible d'ouvrir ce fichier. + Impossible d'ouvrir ce fichier. HOM_SCRIPT_FILE @@ -241,7 +241,7 @@ HOM_MED_FILE_3 - Ce fichier MED contient plus d'un maillage. + Ce fichier MED contient plus d'un maillage. HOM_MED_FILE_4 @@ -261,7 +261,7 @@ Create a case - Création d'un cas + Création d'un cas HOM_CASE_NAME @@ -285,11 +285,11 @@ HOM_START_DIRECTORY_1 - Il faut choisir un répertoire contenant l'itération à poursuivre. + Il faut choisir un répertoire contenant l'itération à poursuivre. HOM_START_DIRECTORY_3 - Un répertoire valide contenant l'itération à poursuivre doit être choisi. + Un répertoire valide contenant l'itération à poursuivre doit être choisi. HOM_CASE_MESH @@ -297,11 +297,11 @@ HOM_CASE_GROUP - Le groupe "%1" ne peut pas être attribué à plus d'une frontière. + Le groupe "%1" ne peut pas être attribué à plus d'une frontière. HOM_CASE_EDIT_WINDOW_TITLE - Edition d'un cas + Edition d'un cas HOM_CASE_EDIT_STATE_0 @@ -309,11 +309,11 @@ HOM_CASE_EDIT_STATE - Poursuite d'une itération. + Poursuite d'une itération. HOM_CASE_PURSUE_WINDOW_TITLE - Cas de poursuite d'une itération + Cas de poursuite d'une itération The configuration file cannot be found. @@ -329,11 +329,11 @@ HOM_ITER_NAME - Il faut donner un nom à l'itération. + Il faut donner un nom à l'itération. HOM_ITER_STARTING_POINT - Il faut désigner l'itération précédente. + Il faut désigner l'itération précédente. HOM_ITER_MESH @@ -361,7 +361,19 @@ HOM_ITER_EDIT_WINDOW_TITLE - Edition d'une itération + Edition d'une itération + + + Boundary type + Type de frontière + + + No boundary + Pas de frontière + + + Non CAO + Autre que CAO Discrete boundary @@ -417,7 +429,7 @@ Initialization of adaptation - Initialisation de l'adaptation + Initialisation de l'adaptation Maximal level @@ -445,11 +457,11 @@ Create an iteration - Création d'une itération + Création d'une itération Iteration Name - Nom de l'itération + Nom de l'itération Previous iteration @@ -501,15 +513,15 @@ The parent iteration is not defined. - L'itération parent n'est pas définie. + L'itération parent n'est pas définie. Unable to create the iteration. - Impossible de créer l'itération. + Impossible de créer l'itération. The directory for the computation cannot be created. - Impossible de créer le répertoire pour le calcul de l'itération. + Impossible de créer le répertoire pour le calcul de l'itération. This iteration is the first of the case and cannot be computed. @@ -517,11 +529,11 @@ This iteration does not have any associated hypothesis. - Cette itération n'est associée à aucune hypothèse. + Cette itération n'est associée à aucune hypothèse. The mesh file does not exist. - Le fichier du maillage n'existe pas. + Le fichier du maillage n'existe pas. The mesh file cannot be deleted. @@ -561,7 +573,7 @@ Rank - Numéro d'ordre + Numéro d'ordre Hypothesis @@ -569,11 +581,11 @@ Create an hypothesis - Création d'une hypothèse + Création d'une hypothèse HOM_HYPO_NAME - Il faut donner un nom à l'hypothèse. + Il faut donner un nom à l'hypothèse. HOM_HYPO_FIELD_FILE @@ -613,11 +625,11 @@ HOM_HYPO_EDIT_WINDOW_TITLE - Edition d'une hypothèse + Edition d'une hypothèse Type of adaptation - Type d'adaptation + Type d'adaptation Uniform @@ -653,7 +665,7 @@ Governing field for the adaptation - Champ pilotant l'adaptation + Champ pilotant l'adaptation Field name @@ -713,7 +725,7 @@ Create a zone - Création d'une zone + Création d'une zone HOM_ZONE_NAME @@ -729,7 +741,7 @@ HOM_ZONE_EDIT_WINDOW_TITLE - Edition d'une zone + Edition d'une zone Type of zone @@ -763,13 +775,17 @@ Coordinates Coordonnées + + Get CAO + Acquisition de la CAO + Create an analytical boundary - Création d'une frontière analytique + Création d'une frontière analytique Create a discrete boundary - Création d'une frontière discrète + Création d'une frontière discrète Type of boundary @@ -829,7 +845,11 @@ HOM_BOUN_MESH - Il faut choisir le maillage qui contient la frontière. + Il faut choisir le fichier qui contient le maillage de la frontière discrète. + + + HOM_BOUN_CAO + Il faut choisir le fichier qui contient la CAO. HOM_BOUN_CASE @@ -837,15 +857,19 @@ HOM_AXE - L'axe doit être un vecteur non nul. + L'axe doit être un vecteur non nul. + + + HOM_BOUN_C_EDIT_WINDOW_TITLE + Edition d'une frontière basée sur une CAO HOM_BOUN_A_EDIT_WINDOW_TITLE - Edition d'une frontière analytique + Edition d'une frontière analytique HOM_BOUN_D_EDIT_WINDOW_TITLE - Edition d'une frontière discrète + Edition d'une frontière discrète HOM_GROU_EDIT_WINDOW_TITLE @@ -861,11 +885,11 @@ The axis must be a non 0 vector. - L'axe doit être un vecteur non nul. + L'axe doit être un vecteur non nul. The angle must be included higher than 0 degree and lower than 90 degrees. - L'angle doit être compris entre 0 et 90 degrés. + L'angle doit être compris entre 0 et 90 degrés. The radius must be different. @@ -901,7 +925,7 @@ The orientation must be 1, 2 or 3. - L'orientation vaut 1, 2 ou 3. + L'orientation vaut 1, 2 ou 3. HOM_MESH_INFO_0 @@ -913,7 +937,7 @@ HOM_MESH_INFO_2 - Bilan de l'analyse dans l'arbre d'études, fichier + Bilan de l'analyse dans l'arbre d'études, fichier Filtering with groups @@ -933,7 +957,7 @@ Information on a mesh - Analyse d'un maillage + Analyse d'un maillage Group size @@ -985,15 +1009,15 @@ From an iteration - A partir d'une itération + A partir d'une itération From a case - A partir d'un cas + A partir d'un cas Iteration into the case - Choix d'une itération dans le cas + Choix d'une itération dans le cas Last iteration @@ -1001,11 +1025,11 @@ Iteration number - A partir d'une itération numérotée + A partir d'une itération numérotée The directory of the case does not exist. - Le répertoire du cas n'existe pas. + Le répertoire du cas n'existe pas. The directory for the case cannot be modified because some iterations are already defined. @@ -1013,7 +1037,7 @@ The directory for the case cannot be reached. - Impossible d'atteindre ce répertoire pour le cas. + Impossible d'atteindre ce répertoire pour le cas. The starting point for the case cannot be copied into the working directory. @@ -1025,19 +1049,19 @@ The directory of the case for the pursuit does not exist. - Le répertoire du cas de reprise n'existe pas. + Le répertoire du cas de reprise n'existe pas. The directory of the iteration does not exist. - Le répertoire de l'itération de reprise n'existe pas. + Le répertoire de l'itération de reprise n'existe pas. The number of iteration must be positive. - Le numéro de l'itération doit etre positif. + Le numéro de l'itération doit etre positif. Number of iteration - Numéro de l'itération + Numéro de l'itération Case @@ -1081,7 +1105,7 @@ Edit a file - Affichage d'un fichier + Affichage d'un fichier Print @@ -1093,7 +1117,7 @@ HOM_YACS_EDIT_WINDOW_TITLE - Edition d'un schéma YACS + Edition d'un schéma YACS PREF_TAB_GENERAL @@ -1105,7 +1129,7 @@ PREF_PUBLICATION_MAILLAGE_IN - Les maillages d'entrée + Les maillages d'entrée PREF_PUBLICATION_MAILLAGE_OUT diff --git a/src/HOMARDGUI/MonCreateBoundaryCAO.cxx b/src/HOMARDGUI/MonCreateBoundaryCAO.cxx new file mode 100755 index 00000000..efefdebe --- /dev/null +++ b/src/HOMARDGUI/MonCreateBoundaryCAO.cxx @@ -0,0 +1,202 @@ +// Copyright (C) 2011-2016 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 +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonCreateBoundaryCAO.h" +#include "MonCreateListGroupCAO.h" +#include "MonCreateCase.h" + +#include +#include + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include + +using namespace std; + +// ------------------------------------------------------------------------------- +MonCreateBoundaryCAO::MonCreateBoundaryCAO(MonCreateCase* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName, QString aName) +// --------------------------------------------------------------------------------- +/* Constructs a MonCreateBoundaryCAO */ + : + QDialog(0), Ui_CreateBoundaryCAO(), + _parent(parent), _aName(aName), + myHomardGen(HOMARD::HOMARD_Gen::_duplicate(myHomardGen0)), + _aCaseName(caseName) + { + MESSAGE("Constructeur") ; + setupUi(this); + setModal(modal); + InitConnect(); + + if ( _aName == QString("") ) {SetNewName();}; + } + +// ------------------------------------------------------------------------ +MonCreateBoundaryCAO::~MonCreateBoundaryCAO() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void MonCreateBoundaryCAO::InitConnect() +// ------------------------------------------------------------------------ +{ + connect( PushFichier, SIGNAL(pressed()), this, SLOT(SetCAOFile())); + connect( buttonOk, SIGNAL(pressed()), this, SLOT( PushOnOK())); + connect( buttonApply, SIGNAL(pressed()), this, SLOT( PushOnApply())); + connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close())); + connect( buttonHelp, SIGNAL(pressed()), this, SLOT( PushOnHelp())); + connect( CBGroupe, SIGNAL(stateChanged(int)), this, SLOT( SetFiltrage())); +} + +// ------------------------------------------------------------------------ +bool MonCreateBoundaryCAO::PushOnApply() +// ------------------------------------------------------------------------ +// Appele lorsque l'un des boutons Ok ou Apply est presse +// +{ +// Verifications + + QString aName=LEName->text().trimmed(); + if (aName=="") { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_BOUN_NAME") ); + return false; + } + +// La CAO + QString aCAOFile=LEFileName->text().trimmed(); + if (aCAOFile ==QString("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_BOUN_CAO") ); + return false; + } + +// Creation de l'objet CORBA si ce n'est pas deja fait sous le meme nom + if ( _aName != aName ) + { + try + { + _aName=aName; + aBoundary=myHomardGen->CreateBoundaryCAO(CORBA::string_dup(_aName.toStdString().c_str()), aCAOFile.toStdString().c_str()); + _parent->AddBoundaryCAO(_aName); + aBoundary->SetCaseCreation(_aCaseName.toStdString().c_str()); + } + catch( SALOME::SALOME_Exception& S_ex ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr(CORBA::string_dup(S_ex.details.text)) ); + return false; + } + } + +// Les groupes + AssocieLesGroupes(); + + HOMARD_UTILS::updateObjBrowser(); + return true; +} + + +// ------------------------------------------------------------------------ +void MonCreateBoundaryCAO::PushOnOK() +// ------------------------------------------------------------------------ +{ + if (PushOnApply()) this->close(); + if ( _parent ) { _parent->raise(); _parent->activateWindow(); }; +} +// ------------------------------------------------------------------------ +void MonCreateBoundaryCAO::PushOnHelp() +// ------------------------------------------------------------------------ +{ + std::string LanguageShort = myHomardGen->GetLanguageShort(); + HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("CAO"), QString(LanguageShort.c_str())); +} +// ------------------------------------------------------------------------ +void MonCreateBoundaryCAO::AssocieLesGroupes() +// ------------------------------------------------------------------------ +{ + HOMARD::ListGroupType_var aSeqGroupe = new HOMARD::ListGroupType; + aSeqGroupe->length(_listeGroupesBoundary.size()); + QStringList::const_iterator it; + int i=0; + for (it = _listeGroupesBoundary.constBegin(); it != _listeGroupesBoundary.constEnd(); it++) + aSeqGroupe[i++]=(*it).toStdString().c_str(); + aBoundary->SetGroups(aSeqGroupe); + +} + +// ------------------------------------------------- +void MonCreateBoundaryCAO::SetNewName() +// -------------------------------------------------- +{ + + HOMARD::listeBoundarys_var MyObjects = myHomardGen->GetAllBoundarysName(); + int num = 0; QString aName=""; + while (aName == QString("") ) + { + aName.setNum(num+1) ; + aName.insert(0, QString("Boun_")) ; + for ( int i=0; ilength(); i++) + { + if ( aName == QString(MyObjects[i])) + { + num ++ ; + aName = "" ; + break ; + } + } + } + LEName->setText(aName); +} +// ------------------------------------------------------------------------ +void MonCreateBoundaryCAO::SetCAOFile() +// ------------------------------------------------------------------------ +{ + QString aCAOFile = HOMARD_QT_COMMUN::PushNomFichier( false, QString("xao") ); + if (!(aCAOFile.isEmpty())) LEFileName->setText(aCAOFile); +} + +// ------------------------------------------------------------------------ +void MonCreateBoundaryCAO::setGroups (QStringList listGroup) +// ------------------------------------------------------------------------ +{ + _listeGroupesBoundary = listGroup; +} +// ------------------------------------------------------------------------ +void MonCreateBoundaryCAO::SetFiltrage() +// // ------------------------------------------------------------------------ +{ + if (!CBGroupe->isChecked()) return; + if (_aCaseName.toStdString().c_str() == QString()) { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_BOUN_CASE") ); + return; + } + + MonCreateListGroupCAO *aDlg = new MonCreateListGroupCAO(NULL, this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), + _aCaseName, _listeGroupesBoundary) ; + aDlg->show(); +} + diff --git a/src/HOMARDGUI/MonCreateBoundaryCAO.h b/src/HOMARDGUI/MonCreateBoundaryCAO.h new file mode 100755 index 00000000..7f135abb --- /dev/null +++ b/src/HOMARDGUI/MonCreateBoundaryCAO.h @@ -0,0 +1,73 @@ +// Copyright (C) 2011-2016 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 +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_CREATEBOUNDARYCAO_H +#define MON_CREATEBOUNDARYCAO_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(HOMARD_Boundary) + +#include "ui_CreateBoundaryCAO.h" +#include + +class MonCreateCase; +class HOMARD_EXPORT MonCreateBoundaryCAO : public QDialog, public Ui_CreateBoundaryCAO +{ + Q_OBJECT + +public: + MonCreateBoundaryCAO( MonCreateCase* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString caseName, QString BoundaryName ); + ~MonCreateBoundaryCAO(); + virtual void setGroups (QStringList listGroup); + +protected : + + MonCreateCase *_parent; + + QString _aName; + QString _aCaseName; + + + HOMARD::HOMARD_Boundary_var aBoundary; + HOMARD::HOMARD_Gen_var myHomardGen; + + QStringList _listeGroupesBoundary; + + virtual void AssocieLesGroupes(); + virtual void InitConnect(); + virtual void SetNewName(); + +public slots: + + virtual void SetCAOFile(); + virtual void SetFiltrage(); + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); +}; + +#endif // MON_CREATEBOUNDARYCAO_H diff --git a/src/HOMARDGUI/MonCreateCase.cxx b/src/HOMARDGUI/MonCreateCase.cxx index a912f79c..657ea9c1 100644 --- a/src/HOMARDGUI/MonCreateCase.cxx +++ b/src/HOMARDGUI/MonCreateCase.cxx @@ -18,6 +18,8 @@ // #include "MonCreateCase.h" +#include "MonCreateBoundaryCAO.h" +#include "MonEditBoundaryCAO.h" #include "MonCreateBoundaryAn.h" #include "MonEditBoundaryAn.h" #include "MonCreateBoundaryDi.h" @@ -59,8 +61,14 @@ MonCreateCase::MonCreateCase( bool modal, HOMARD::HOMARD_Gen_var myHomardGen0 ) InitConnect(); SetNewName() ; + + GBBoundaryC->setVisible(0); GBBoundaryA->setVisible(0); GBBoundaryD->setVisible(0); + + CBBoundaryA->setVisible(0); + CBBoundaryD->setVisible(0); + GBAdvancedOptions->setVisible(0); Comment->setVisible(0); CBPyramid->setChecked(false); @@ -79,21 +87,28 @@ MonCreateCase::~MonCreateCase() void MonCreateCase::InitConnect() // ------------------------------------------------------------------------ { - connect( LEName, SIGNAL(textChanged(QString)), this, SLOT(CaseNameChanged())); - connect( PushDir, SIGNAL(pressed()), this, SLOT(SetDirName())); - connect( PushFichier, SIGNAL(pressed()), this, SLOT(SetFileName())); + connect( LEName, SIGNAL(textChanged(QString)), this, SLOT(CaseNameChanged())); + connect( PushDir, SIGNAL(pressed()), this, SLOT(SetDirName())); + connect( PushFichier, SIGNAL(pressed()), this, SLOT(SetFileName())); connect( RBConforme, SIGNAL(clicked()), this, SLOT(SetConforme())); connect( RBNonConforme, SIGNAL(clicked()), this, SLOT(SetNonConforme())); - connect( CBBoundaryD, SIGNAL(stateChanged(int)), this, SLOT(SetBoundaryD())); - connect( PBBoundaryDiNew, SIGNAL(pressed()), this, SLOT(PushBoundaryDiNew())); - connect( PBBoundaryDiEdit, SIGNAL(pressed()), this, SLOT(PushBoundaryDiEdit()) ); - connect( PBBoundaryDiHelp, SIGNAL(pressed()), this, SLOT(PushBoundaryDiHelp()) ); - connect( CBBoundaryA, SIGNAL(stateChanged(int)), this, SLOT(SetBoundaryA())); - connect( PBBoundaryAnNew, SIGNAL(pressed()), this, SLOT(PushBoundaryAnNew())); - connect( PBBoundaryAnEdit, SIGNAL(pressed()), this, SLOT(PushBoundaryAnEdit()) ); - connect( PBBoundaryAnHelp, SIGNAL(pressed()), this, SLOT(PushBoundaryAnHelp()) ); + connect( RBBoundaryNo, SIGNAL(clicked()), this, SLOT(SetBoundaryNo())); + connect( RBBoundaryCAO, SIGNAL(clicked()), this, SLOT(SetBoundaryCAO())); + connect( RBBoundaryNonCAO, SIGNAL(clicked()), this, SLOT(SetBoundaryNonCAO())); + + connect( PBBoundaryCAONew, SIGNAL(pressed()), this, SLOT(PushBoundaryCAONew())); + connect( PBBoundaryCAOEdit, SIGNAL(pressed()), this, SLOT(PushBoundaryCAOEdit()) ); + connect( PBBoundaryCAOHelp, SIGNAL(pressed()), this, SLOT(PushBoundaryCAOHelp()) ); + connect( CBBoundaryD, SIGNAL(stateChanged(int)), this, SLOT(SetBoundaryD())); + connect( PBBoundaryDiNew, SIGNAL(pressed()), this, SLOT(PushBoundaryDiNew())); + connect( PBBoundaryDiEdit, SIGNAL(pressed()), this, SLOT(PushBoundaryDiEdit()) ); + connect( PBBoundaryDiHelp, SIGNAL(pressed()), this, SLOT(PushBoundaryDiHelp()) ); + connect( CBBoundaryA, SIGNAL(stateChanged(int)), this, SLOT(SetBoundaryA())); + connect( PBBoundaryAnNew, SIGNAL(pressed()), this, SLOT(PushBoundaryAnNew())); + connect( PBBoundaryAnEdit, SIGNAL(pressed()), this, SLOT(PushBoundaryAnEdit()) ); + connect( PBBoundaryAnHelp, SIGNAL(pressed()), this, SLOT(PushBoundaryAnHelp()) ); connect( CBAdvanced, SIGNAL(stateChanged(int)), this, SLOT(SetAdvanced())); connect( RBStandard, SIGNAL(clicked()), this, SLOT(SetStandard())); @@ -127,6 +142,7 @@ void MonCreateCase::InitBoundarys() TWBoundary->setItem( i, 0, new QTableWidgetItem(QString((_listeGroupesCas)[i]).trimmed())); TWBoundary->item( i, 0 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable ); } +// Pour les frontieres CAO : la liste a saisir // Pour les frontieres discretes : la liste a saisir // Pour les frontieres analytiques : les colonnes de chaque frontiere HOMARD::HOMARD_Boundary_var myBoundary ; @@ -136,8 +152,9 @@ void MonCreateCase::InitBoundarys() { myBoundary = myHomardGen->GetBoundary(mesBoundarys[i]); int type_obj = myBoundary->GetType() ; - if ( type_obj==0 ) { CBBoundaryDi->addItem(QString(mesBoundarys[i])); } - else { AddBoundaryAn(QString(mesBoundarys[i])); } + if ( type_obj==-1 ) { CBBoundaryCAO->addItem(QString(mesBoundarys[i])); } + else if ( type_obj==0 ) { CBBoundaryDi->addItem(QString(mesBoundarys[i])); } + else { AddBoundaryAn(QString(mesBoundarys[i])); } } // Ajustement TWBoundary->resizeColumnsToContents(); @@ -265,12 +282,20 @@ bool MonCreateCase::PushOnApply(int option) // Enregistrement et publication dans l'arbre d'etudes a la sortie definitive if ( option > 0 ) { + if (RBBoundaryCAO->isChecked()) + { + QString monBoundaryCAOName=CBBoundaryCAO->currentText(); + if (monBoundaryCAOName != "" ) + { + aCase->AddBoundary(monBoundaryCAOName.toStdString().c_str()); + } + } if (CBBoundaryD->isChecked()) { QString monBoundaryDiName=CBBoundaryDi->currentText(); if (monBoundaryDiName != "" ) { - aCase->AddBoundaryGroup(monBoundaryDiName.toStdString().c_str(), ""); + aCase->AddBoundary(monBoundaryDiName.toStdString().c_str()); } } if (CBBoundaryA->isChecked()) @@ -434,6 +459,74 @@ void MonCreateCase::SetSaturne2D() RBSaturne2D->setChecked(true); } // ------------------------------------------------------------------------ +void MonCreateCase::SetBoundaryNo() +// ------------------------------------------------------------------------ +{ +// + GBBoundaryC->setVisible(0); + GBBoundaryA->setVisible(0); + GBBoundaryD->setVisible(0); + CBBoundaryD->setVisible(0); + CBBoundaryA->setVisible(0); +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void MonCreateCase::SetBoundaryCAO() +// ------------------------------------------------------------------------ +{ +// + GBBoundaryC->setVisible(1); + GBBoundaryA->setVisible(0); + GBBoundaryD->setVisible(0); + CBBoundaryD->setVisible(0); + CBBoundaryA->setVisible(0); +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void MonCreateCase::SetBoundaryNonCAO() +// ------------------------------------------------------------------------ +{ +// + GBBoundaryC->setVisible(0); + CBBoundaryD->setVisible(1); + CBBoundaryA->setVisible(1); +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void MonCreateCase::AddBoundaryCAO(QString newBoundary) +// ------------------------------------------------------------------------ +{ + CBBoundaryCAO->insertItem(0,newBoundary); + CBBoundaryCAO->setCurrentIndex(0); +} +// ------------------------------------------------------------------------ +void MonCreateCase::PushBoundaryCAONew() +// ------------------------------------------------------------------------ +{ + MonCreateBoundaryCAO *BoundaryDlg = new MonCreateBoundaryCAO(this, true, + HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, "") ; + BoundaryDlg->show(); +} +// ------------------------------------------------------------------------ +void MonCreateCase::PushBoundaryCAOEdit() +// ------------------------------------------------------------------------ +{ + if (CBBoundaryCAO->currentText() == QString("")) return; + MonEditBoundaryCAO *BoundaryDlg = new MonEditBoundaryCAO(this, true, + HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, CBBoundaryCAO->currentText() ) ; + BoundaryDlg->show(); +} +// ------------------------------------------------------------------------ +void MonCreateCase::PushBoundaryCAOHelp() +// ------------------------------------------------------------------------ +{ + std::string LanguageShort = myHomardGen->GetLanguageShort(); + HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("CAO"), QString(LanguageShort.c_str())); +} +// ------------------------------------------------------------------------ void MonCreateCase::SetBoundaryD() // ------------------------------------------------------------------------ { @@ -497,8 +590,6 @@ void MonCreateCase::SetBoundaryA() else { GBBoundaryA->setVisible(0); } // adjustSize(); -// -// MESSAGE("Fin de SetBoundaryA "); } // ------------------------------------------------------------------------ void MonCreateCase::AddBoundaryAn(QString newBoundary) diff --git a/src/HOMARDGUI/MonCreateCase.h b/src/HOMARDGUI/MonCreateCase.h index 7b381599..8bc8645f 100644 --- a/src/HOMARDGUI/MonCreateCase.h +++ b/src/HOMARDGUI/MonCreateCase.h @@ -40,6 +40,7 @@ public: MonCreateCase( bool modal, HOMARD::HOMARD_Gen_var myHomardGen ); ~MonCreateCase(); + void AddBoundaryCAO(QString newBoundary); void AddBoundaryAn(QString newBoundary); void AddBoundaryDi(QString newBoundary); @@ -74,6 +75,12 @@ public slots: virtual void SetSaturne(); virtual void SetSaturne2D(); + virtual void SetBoundaryNo(); + virtual void SetBoundaryCAO(); + virtual void SetBoundaryNonCAO(); + virtual void PushBoundaryCAONew(); + virtual void PushBoundaryCAOEdit(); + virtual void PushBoundaryCAOHelp(); virtual void SetBoundaryD(); virtual void PushBoundaryDiNew(); virtual void PushBoundaryDiEdit(); diff --git a/src/HOMARDGUI/MonCreateListGroupCAO.cxx b/src/HOMARDGUI/MonCreateListGroupCAO.cxx new file mode 100755 index 00000000..8c8286aa --- /dev/null +++ b/src/HOMARDGUI/MonCreateListGroupCAO.cxx @@ -0,0 +1,150 @@ +// Copyright (C) 2011-2016 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 +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonCreateListGroupCAO.h" +#include "MonCreateHypothesis.h" +#include "MonCreateBoundaryCAO.h" + +#include + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include + +#include +#include +#include +#include +#include + +using namespace std; + +// -------------------------------------------------------------------------------------------------------------- +MonCreateListGroupCAO::MonCreateListGroupCAO(MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen0, QString aCaseName, QStringList listeGroupesHypo) : +// -------------------------------------------------------------------------------------------------------------- +// + QDialog(0), Ui_CreateListGroup(), + _aCaseName (aCaseName), + _listeGroupesHypo (listeGroupesHypo), + _parentHyp(parentHyp), + _parentBound(parentBound) +{ + MESSAGE("Debut de MonCreateListGroupCAO") + myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + setupUi(this); + setModal(modal); + InitConnect(); + InitGroupes(); +} +// -------------------------------------------------------------------------------------------------------------- +MonCreateListGroupCAO::MonCreateListGroupCAO(MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound, + HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo) : +// -------------------------------------------------------------------------------------------------------------- +// + QDialog(0), Ui_CreateListGroup(), + _aCaseName (aCaseName), + _listeGroupesHypo (listeGroupesHypo), + _parentHyp(parentHyp), + _parentBound(parentBound) +{ + myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen); + setupUi(this); + InitConnect(); +} + +// ------------------------------------------------------------------------ +MonCreateListGroupCAO::~MonCreateListGroupCAO() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void MonCreateListGroupCAO::InitConnect() +// ------------------------------------------------------------------------ +{ + connect( buttonOk, SIGNAL( pressed() ), this, SLOT( PushOnOK() ) ); + connect( buttonApply, SIGNAL( pressed() ), this, SLOT( PushOnApply() ) ); + connect( buttonCancel, SIGNAL( pressed() ), this, SLOT( close() ) ); + connect( buttonHelp, SIGNAL( pressed() ), this, SLOT( PushOnHelp() ) ); +} +// ------------------------------------------------------------------------ +bool MonCreateListGroupCAO::PushOnApply() +// ------------------------------------------------------------------------ +// Appele lorsque l'un des boutons Ok ou Apply est presse +// +{ + QStringList ListeGroup ; + for ( int row=0; row< TWGroupe->rowCount(); row++) + { + if ( TWGroupe->item( row, 0 )->checkState() == Qt::Checked ) + ListeGroup.insert(0, QString(TWGroupe->item(row, 1)->text()) ); + } + if ( _parentHyp ) { _parentHyp->setGroups(ListeGroup);}; + if ( _parentBound ) { _parentBound->setGroups(ListeGroup);}; + return true; +} + + +// ------------------------------------------------------------------------ +void MonCreateListGroupCAO::PushOnOK() +// ------------------------------------------------------------------------ +{ + if (PushOnApply()) this->close(); + if ( _parentHyp ) { _parentHyp->raise(); _parentHyp->activateWindow(); }; + if ( _parentBound ) { _parentBound->raise(); _parentBound->activateWindow(); }; +} +// ------------------------------------------------------------------------ +void MonCreateListGroupCAO::PushOnHelp() +// ------------------------------------------------------------------------ +{ + std::string LanguageShort = myHomardGen->GetLanguageShort(); + HOMARD_UTILS::PushOnHelp(QString("gui_create_hypothese.html"), QString(""), QString(LanguageShort.c_str())); +} +// ------------------------------------------------------------------------ +void MonCreateListGroupCAO::InitGroupes() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de MonCreateListGroupCAO::InitGroupes "); + for ( int row=0; row< TWGroupe->rowCount(); row++) + TWGroupe->removeRow(row); + TWGroupe->setRowCount(0); + if (_aCaseName == QString("")) { return; }; + HOMARD::HOMARD_Cas_var monCas= myHomardGen->GetCase(_aCaseName.toStdString().c_str()); + HOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups(); + for ( int i = 0; i < _listeGroupesCas->length(); i++ ) + { + TWGroupe->insertRow(i); + TWGroupe->setItem( i, 0, new QTableWidgetItem( QString ("") ) ); + TWGroupe->item( i, 0 )->setFlags( 0 ); + TWGroupe->item( i, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled ); + if (_listeGroupesHypo.contains (QString((_listeGroupesCas)[i]))) + {TWGroupe->item( i, 0 )->setCheckState( Qt::Checked );} + else + {TWGroupe->item( i, 0 )->setCheckState( Qt::Unchecked );} + TWGroupe->setItem( i, 1, new QTableWidgetItem(QString((_listeGroupesCas)[i]).trimmed())); + TWGroupe->item( i, 1 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable ); + } + TWGroupe->resizeColumnsToContents(); + TWGroupe->resizeRowsToContents(); + TWGroupe->clearSelection(); +// MESSAGE("Fin de MonCreateListGroupCAO::InitGroupes "); +} + diff --git a/src/HOMARDGUI/MonCreateListGroupCAO.h b/src/HOMARDGUI/MonCreateListGroupCAO.h new file mode 100755 index 00000000..19432667 --- /dev/null +++ b/src/HOMARDGUI/MonCreateListGroupCAO.h @@ -0,0 +1,64 @@ +// Copyright (C) 2011-2016 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 +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_CREATELISTGROUPCAO_H +#define MON_CREATELISTGROUPCAO_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) + +#include "ui_CreateListGroup.h" +#include + +class MonCreateHypothesis; +class MonCreateBoundaryCAO; +class HOMARD_EXPORT MonCreateListGroupCAO : public QDialog, public Ui_CreateListGroup +{ + Q_OBJECT + +public: + MonCreateListGroupCAO( MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); + MonCreateListGroupCAO( MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound, HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); + virtual ~MonCreateListGroupCAO(); + +protected : + + HOMARD::HOMARD_Gen_var myHomardGen; + + MonCreateHypothesis * _parentHyp; + MonCreateBoundaryCAO * _parentBound; + QString _aCaseName; + QStringList _listeGroupesHypo; + + virtual void InitConnect(); + virtual void InitGroupes(); + +public slots: + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); + +}; + +#endif // MON_CREATELISTGROUPCAO_H diff --git a/src/HOMARDGUI/MonEditBoundaryCAO.cxx b/src/HOMARDGUI/MonEditBoundaryCAO.cxx new file mode 100755 index 00000000..d217ea14 --- /dev/null +++ b/src/HOMARDGUI/MonEditBoundaryCAO.cxx @@ -0,0 +1,105 @@ +// Copyright (C) 2011-2016 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 +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonEditBoundaryCAO.h" +#include "MonEditListGroupCAO.h" + +#include + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include + +using namespace std; + +// ------------------------------------------------------------------------------------------------------------------------------------- +MonEditBoundaryCAO::MonEditBoundaryCAO( MonCreateCase* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString caseName, QString Name): +// ------------------------------------------------------------------------------------------------------------------------------------- +/* Constructs a MonEditBoundaryCAO + herite de MonCreateBoundaryCAO +*/ + MonCreateBoundaryCAO(parent, modal, myHomardGen, caseName, Name) +{ + MESSAGE("Debut de Boundary pour " << Name.toStdString().c_str()); + setWindowTitle(QObject::tr("HOM_BOUN_C_EDIT_WINDOW_TITLE")); + try + { + aBoundary=myHomardGen->GetBoundary(CORBA::string_dup(_aName.toStdString().c_str())); + if (caseName==QString("")) { _aCaseName=aBoundary->GetCaseCreation();} + InitValEdit(); + } + catch( SALOME::SALOME_Exception& S_ex ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr(CORBA::string_dup(S_ex.details.text)) ); + return; + } + + HOMARD::ListGroupType_var maListe = aBoundary->GetGroups(); + for ( int i = 0; i < maListe->length(); i++ ) + _listeGroupesBoundary << QString(maListe[i]); + +} +// ------------------------------ +MonEditBoundaryCAO::~MonEditBoundaryCAO() +// ------------------------------ +{ +} +// ------------------------------ +void MonEditBoundaryCAO::InitValEdit() +// ------------------------------ +{ + LEName->setText(_aName); + LEName->setReadOnly(true); + + QString aDataFile = aBoundary->GetDataFile(); + LEFileName->setText(aDataFile); + LEFileName->setReadOnly(1); + PushFichier->setVisible(0); +// + adjustSize(); +} +// ------------------------------ +bool MonEditBoundaryCAO::PushOnApply() +// ------------------------------ +{ + return true; +} +// ------------------------------------------------------------------------ +void MonEditBoundaryCAO::SetFiltrage() +// // ------------------------------------------------------------------------ +{ + if (!CBGroupe->isChecked()) return; + if (_aCaseName.toStdString().c_str() == QString()) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_BOUN_CASE") ); + return; + } + HOMARD::HOMARD_Cas_var monCas= myHomardGen->GetCase(_aCaseName.toStdString().c_str()); + HOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups(); + + MonEditListGroupCAO *aDlg = new MonEditListGroupCAO(NULL, this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), + _aCaseName, _listeGroupesBoundary) ; + aDlg->show(); +} + diff --git a/src/HOMARDGUI/MonEditBoundaryCAO.h b/src/HOMARDGUI/MonEditBoundaryCAO.h new file mode 100755 index 00000000..b86f4dc5 --- /dev/null +++ b/src/HOMARDGUI/MonEditBoundaryCAO.h @@ -0,0 +1,51 @@ +// Copyright (C) 2011-2016 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 +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_EDITBOUNDARYCAO_H +#define MON_EDITBOUNDARYCAO_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) + +#include + +class HOMARD_EXPORT MonEditBoundaryCAO : public MonCreateBoundaryCAO +{ + Q_OBJECT +public: + MonEditBoundaryCAO( MonCreateCase* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString caseName, QString Name ); + virtual ~MonEditBoundaryCAO(); + +protected : + virtual void InitValEdit(); + virtual bool PushOnApply(); + virtual void SetFiltrage(); + +public slots: + +}; + +#endif diff --git a/src/HOMARDGUI/MonEditBoundaryDi.cxx b/src/HOMARDGUI/MonEditBoundaryDi.cxx index 40e38f69..05f1fd15 100644 --- a/src/HOMARDGUI/MonEditBoundaryDi.cxx +++ b/src/HOMARDGUI/MonEditBoundaryDi.cxx @@ -71,8 +71,8 @@ void MonEditBoundaryDi::InitValEdit() LEName->setText(_aName); LEName->setReadOnly(true); - QString aMeshFile = aBoundary->GetMeshFile(); - LEFileName->setText(aMeshFile); + QString aDataFile = aBoundary->GetDataFile(); + LEFileName->setText(aDataFile); LEFileName->setReadOnly(1); PushFichier->setVisible(0); // diff --git a/src/HOMARDGUI/MonEditCase.cxx b/src/HOMARDGUI/MonEditCase.cxx index 2ad3ef4e..1035eae6 100644 --- a/src/HOMARDGUI/MonEditCase.cxx +++ b/src/HOMARDGUI/MonEditCase.cxx @@ -74,31 +74,43 @@ void MonEditCase::InitValEdit() RBNonConforme->setEnabled(false); int ExtType=aCase->GetExtType(); -// Non affichage du mode de suivi de frontiere - CBBoundaryA->setVisible(0); - GBBoundaryA->setVisible(0); + +// Suivi de frontiere +// A priori, aucun affichage + GBTypeBoun->setVisible(0); CBBoundaryD->setVisible(0); + CBBoundaryA->setVisible(0); + GBBoundaryC->setVisible(0); GBBoundaryD->setVisible(0); - + GBBoundaryA->setVisible(0); // On passe en revue tous les couples (frontiere,groupe) du cas HOMARD::ListBoundaryGroupType_var mesBoundarys = aCase->GetBoundaryGroup(); if (mesBoundarys->length()>0) { QStringList ListeFron ; QString NomFron ; + bool BounCAO = false ; bool BounDi = false ; bool BounAn = false ; for (int i=0; ilength(); i++) { -// Nom de la frontiere +// Nom de la frontiere NomFron = mesBoundarys[i++]; MESSAGE("NomFron "<GetBoundary(NomFron.toStdString().c_str()); int type_obj = myBoundary->GetType() ; + MESSAGE("type_obj "<addItem(NomFron); + } // C'est une frontiere discrete // Rermarque : on ne gere pas les groupes - if ( type_obj==0 ) + else if ( type_obj==0 ) { BounDi = true ; CBBoundaryDi->addItem(NomFron); @@ -138,9 +150,23 @@ void MonEditCase::InitValEdit() TWBoundary->item( 0, ok )->setCheckState( Qt::Checked ); } } - MESSAGE("BounDi "<setVisible(1); + if ( BounCAO ) + { RBBoundaryCAO->setChecked(true); + GBBoundaryC->setVisible(1); + CBBoundaryCAO->setDisabled(true); + PBBoundaryCAONew->setVisible(0); + PBBoundaryCAOHelp->setVisible(0); } + if ( BounDi ) + { RBBoundaryNonCAO->setChecked(true); + GBBoundaryD->setVisible(1); + CBBoundaryDi->setDisabled(true); + PBBoundaryDiNew->setVisible(0); + PBBoundaryDiHelp->setVisible(0); } if ( BounAn ) - { GBBoundaryA->setVisible(1); + { RBBoundaryNonCAO->setChecked(true); + GBBoundaryA->setVisible(1); // On rend les cases non modifiables. // On ne peut pas le faire pour tout le tableau sinon on perd l'ascenseur ! int nbcol = TWBoundary->columnCount(); @@ -155,11 +181,9 @@ void MonEditCase::InitValEdit() PBBoundaryAnNew->setVisible(0); PBBoundaryAnHelp->setVisible(0); } - if ( BounDi ) - { GBBoundaryD->setVisible(1); - CBBoundaryDi->setDisabled(true); - PBBoundaryDiNew->setVisible(0); - PBBoundaryDiHelp->setVisible(0); } + RBBoundaryNo->setEnabled(false); + RBBoundaryCAO->setEnabled(false); + RBBoundaryNonCAO->setEnabled(false); } // // Les options avancees (non modifiables) diff --git a/src/HOMARDGUI/MonEditListGroupCAO.cxx b/src/HOMARDGUI/MonEditListGroupCAO.cxx new file mode 100755 index 00000000..783e368c --- /dev/null +++ b/src/HOMARDGUI/MonEditListGroupCAO.cxx @@ -0,0 +1,61 @@ +// Copyright (C) 2011-2016 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 +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonEditListGroupCAO.h" +#include + +using namespace std; +//--------------------------------------------------------------------- +MonEditListGroupCAO::MonEditListGroupCAO( MonCreateHypothesis* parentHyp, + MonCreateBoundaryCAO* parentBound, + bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString aCaseName, + QStringList listeGroupesHypo): +//--------------------------------------------------------------------- +MonCreateListGroupCAO(parentHyp,parentBound,myHomardGen,aCaseName,listeGroupesHypo) +{ + MESSAGE("Debut de MonEditListGroupCAO"); + setWindowTitle(QObject::tr("HOM_GROU_EDIT_WINDOW_TITLE")); + setModal(true); + InitGroupes(); +} + +//------------------------------------ +MonEditListGroupCAO:: ~MonEditListGroupCAO() +//------------------------------------ +{ +} +// ------------------------------------- +void MonEditListGroupCAO:: InitGroupes() +// ------------------------------------- +{ + for (int i = 0; i < _listeGroupesHypo.size(); i++ ) + { + std::cerr << _listeGroupesHypo[i].toStdString().c_str() << std::endl; + TWGroupe->insertRow(i); + TWGroupe->setItem( i, 0, new QTableWidgetItem( QString ("") ) ); + TWGroupe->item( i, 0 )->setFlags( 0 ); + TWGroupe->item( i, 0 )->setCheckState( Qt::Checked ); + TWGroupe->setItem( i, 1, new QTableWidgetItem(_listeGroupesHypo[i])); + } + TWGroupe->resizeRowsToContents(); +} + + diff --git a/src/HOMARDGUI/MonEditListGroupCAO.h b/src/HOMARDGUI/MonEditListGroupCAO.h new file mode 100755 index 00000000..7a72ce5e --- /dev/null +++ b/src/HOMARDGUI/MonEditListGroupCAO.h @@ -0,0 +1,49 @@ +// Copyright (C) 2011-2016 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 +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_EDITLISTGROUPCAO_H +#define MON_EDITLISTGROUPCAO_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) + +#include + +class MonCreateHypothesis; +class MonCreateBoundaryCAO; +class HOMARD_EXPORT MonEditListGroupCAO : public MonCreateListGroupCAO +{ + Q_OBJECT + +public: + MonEditListGroupCAO( MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); + virtual ~MonEditListGroupCAO(); + +protected : + + virtual void InitGroupes(); + +}; + +#endif // MON_EDITLISTGROUPCAO_H diff --git a/src/HOMARD_I/CMakeLists.txt b/src/HOMARD_I/CMakeLists.txt index 569efea1..99082ed3 100644 --- a/src/HOMARD_I/CMakeLists.txt +++ b/src/HOMARD_I/CMakeLists.txt @@ -29,6 +29,7 @@ INCLUDE_DIRECTORIES( ${PROJECT_BINARY_DIR} ${PROJECT_BINARY_DIR}/idl ${PROJECT_BINARY_DIR}/adm_local/unix + ${PROJECT_SOURCE_DIR}/src/FrontTrack ${PROJECT_SOURCE_DIR}/src/HOMARD ${PROJECT_SOURCE_DIR}/src/HOMARDGUI ) @@ -49,6 +50,7 @@ SET(_link_LIBRARIES ${KERNEL_SalomeGenericObj} ${SMESH_SalomeIDLSMESH} ${SMESH_SMESHEngine} + FrontTrack SalomeIDLHOMARD HOMARDImpl ) @@ -65,7 +67,7 @@ SET(HOMARDEngine_HEADERS HOMARD_Boundary_i.hxx HOMARD_YACS_i.hxx HomardMedCommun.h - HOMARD_i.hxx + HOMARD_i.hxx ) # --- sources --- diff --git a/src/HOMARD_I/HOMARD_Boundary_i.cxx b/src/HOMARD_I/HOMARD_Boundary_i.cxx index 3cb92a56..2d904436 100644 --- a/src/HOMARD_I/HOMARD_Boundary_i.cxx +++ b/src/HOMARD_I/HOMARD_Boundary_i.cxx @@ -134,18 +134,18 @@ char* HOMARD_Boundary_i::GetMeshName() return CORBA::string_dup( myHomardBoundary->GetMeshName().c_str() ); } //============================================================================= -void HOMARD_Boundary_i::SetMeshFile( const char* MeshFile ) +void HOMARD_Boundary_i::SetDataFile( const char* DataFile ) { ASSERT( myHomardBoundary ); - myHomardBoundary->SetMeshFile( MeshFile ); + myHomardBoundary->SetDataFile( DataFile ); int PublisMeshIN = _gen_i->GetPublisMeshIN () ; - if ( PublisMeshIN != 0 ) { _gen_i->PublishResultInSmesh(MeshFile, 0); } + if ( PublisMeshIN != 0 ) { _gen_i->PublishResultInSmesh(DataFile, 0); } } //============================================================================= -char* HOMARD_Boundary_i::GetMeshFile() +char* HOMARD_Boundary_i::GetDataFile() { ASSERT( myHomardBoundary ); - return CORBA::string_dup( myHomardBoundary->GetMeshFile().c_str() ); + return CORBA::string_dup( myHomardBoundary->GetDataFile().c_str() ); } //============================================================================= void HOMARD_Boundary_i::SetCylinder( double X0, double X1, double X2, double X3, double X4, double X5, double X6 ) diff --git a/src/HOMARD_I/HOMARD_Boundary_i.hxx b/src/HOMARD_I/HOMARD_Boundary_i.hxx index ba26c743..86485d1f 100644 --- a/src/HOMARD_I/HOMARD_Boundary_i.hxx +++ b/src/HOMARD_I/HOMARD_Boundary_i.hxx @@ -72,8 +72,8 @@ public: void SetMeshName( const char* MeshName ); char* GetMeshName(); - void SetMeshFile( const char* MeshFile ); - char* GetMeshFile(); + void SetDataFile( const char* DataFile ); + char* GetDataFile(); void SetCylinder( double Xcentre, double Ycentre, double ZCentre, double Xaxe, double Yaxe, double Zaxe, diff --git a/src/HOMARD_I/HOMARD_Cas_i.cxx b/src/HOMARD_I/HOMARD_Cas_i.cxx index 6558e235..74fdfa3d 100755 --- a/src/HOMARD_I/HOMARD_Cas_i.cxx +++ b/src/HOMARD_I/HOMARD_Cas_i.cxx @@ -319,46 +319,140 @@ HOMARD::ListGroupType* HOMARD_Cas_i::GetGroups() return aResult._retn(); } //============================================================================= +void HOMARD_Cas_i::AddBoundary(const char* BoundaryName) +{ + MESSAGE ("HOMARD_Cas_i::AddBoundary : BoundaryName = "<< BoundaryName ); + const char * Group = "" ; + AddBoundaryGroup( BoundaryName, Group) ; +} +//============================================================================= void HOMARD_Cas_i::AddBoundaryGroup( const char* BoundaryName, const char* Group) { - MESSAGE ("AddBoundaryGroup : BoundaryName = "<< BoundaryName << ", Group = " << Group ); + MESSAGE ("HOMARD_Cas_i::AddBoundaryGroup : BoundaryName = "<< BoundaryName << ", Group = " << Group ); ASSERT( myHomardCas ); - // A. La liste des frontiere+groupes + // A. Préalables + // A.1. Caractéristiques de la frontière à ajouter + HOMARD::HOMARD_Boundary_ptr myBoundary = _gen_i->GetBoundary(BoundaryName) ; + ASSERT(!CORBA::is_nil(myBoundary)); + int BoundaryType = myBoundary->GetType(); + MESSAGE ( ". BoundaryType = " << BoundaryType ); + // A.2. La liste des frontiere+groupes const std::list& ListBoundaryGroup = myHomardCas->GetBoundaryGroup(); std::list::const_iterator it; - // B. La frontiere - // B.1. La frontiere est-elle deja enregistree pour ce cas ? - bool existe = false ; - for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ ) + // B. Controles + const char * boun ; + int erreur = 0 ; + while ( erreur == 0 ) { -// MESSAGE (".. Frontiere : "<< *it ); - if ( *it == BoundaryName ) { existe = true ; } - it++ ; - } - // B.2. Pour une nouvelle frontiere, publication dans l'arbre d'etudes sous le cas - if ( !existe ) - { - char* CaseName = GetName() ; - MESSAGE ( "AddBoundaryGroup : insertion de la frontiere dans l'arbre de " << CaseName ); - _gen_i->PublishBoundaryUnderCase(CaseName, BoundaryName) ; + // B.1. Si on ajoute une frontière CAO, elle doit être la seule frontière + if ( BoundaryType == -1 ) + { + for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ ) + { + boun = (*it).c_str() ; + MESSAGE (".. Frontiere enregistrée : "<< boun ); + if ( *it != BoundaryName ) + { erreur = 1 ; + break ; } + // On saute le nom du groupe + it++ ; + } + } + if ( erreur != 0 ) { break ; } + // B.2. Si on ajoute une frontière non CAO, il ne doit pas y avoir de frontière CAO + if ( BoundaryType != -1 ) + { + for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ ) + { + boun = (*it).c_str() ; + MESSAGE (".. Frontiere enregistrée : "<< boun ); + HOMARD::HOMARD_Boundary_ptr myBoundary_0 = _gen_i->GetBoundary(boun) ; + int BoundaryType_0 = myBoundary_0->GetType(); + MESSAGE ( ".. BoundaryType_0 = " << BoundaryType_0 ); + if ( BoundaryType_0 == -1 ) + { erreur = 2 ; + break ; } + // On saute le nom du groupe + it++ ; + } + if ( erreur != 0 ) { break ; } + } + // B.3. Si on ajoute une frontière discrète, il ne doit pas y avoir d'autre frontière discrète + if ( BoundaryType == 0 ) + { + for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ ) + { + boun = (*it).c_str() ; + MESSAGE (".. Frontiere enregistrée : "<< boun ); + if ( boun != BoundaryName ) + { + HOMARD::HOMARD_Boundary_ptr myBoundary_0 = _gen_i->GetBoundary(boun) ; + int BoundaryType_0 = myBoundary_0->GetType(); + MESSAGE ( ".. BoundaryType_0 = " << BoundaryType_0 ); + if ( BoundaryType_0 == 0 ) + { erreur = 3 ; + break ; } + } + // On saute le nom du groupe + it++ ; + } + if ( erreur != 0 ) { break ; } + } + // B.4. Pour une nouvelle frontiere, publication dans l'arbre d'etudes sous le cas + bool existe = false ; + for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ ) + { + MESSAGE (".. Frontiere : "<< *it ); + if ( *it == BoundaryName ) { existe = true ; } + // On saute le nom du groupe + it++ ; + } + if ( !existe ) + { + char* CaseName = GetName() ; + MESSAGE ( "AddBoundaryGroup : insertion de la frontiere dans l'arbre de " << CaseName ); + _gen_i->PublishBoundaryUnderCase(CaseName, BoundaryName) ; + } + // B.5. Le groupe est-il deja enregistre pour une frontiere de ce cas ? + for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ ) + { + boun = (*it).c_str() ; + it++ ; + MESSAGE (".. Groupe enregistré : "<< *it ); + if ( *it == Group ) + { erreur = 5 ; + break ; } + } + if ( erreur != 0 ) { break ; } + // + break ; } - // C. Le groupe est-il deja enregistre pour une frontiere de ce cas ? - for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ ) + // F. Si aucune erreur, enregistrement du couple (frontiere,groupe) dans la reference du cas + // Sinon, arrêt + if ( erreur == 0 ) + { myHomardCas->AddBoundaryGroup( BoundaryName, Group ); } + else { - std::string boun = *it ; - it++ ; -// MESSAGE (".. Group : "<< *it ); - if ( *it == Group ) - { INFOS ("Frontiere " << boun << " Un groupe est deja associe " << Group ) ; - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid AddBoundaryGroup"; - throw SALOME::SALOME_Exception(es); - return ; - } + std::stringstream ss; + ss << erreur; + std::string str = ss.str(); + std::string texte ; + texte = "Erreur numéro " + str + " pour la frontière à enregistrer : " + std::string(BoundaryName) ; + if ( erreur == 1 ) { texte += "\nIl existe déjà la frontière " ; } + else if ( erreur == 2 ) { texte += "\nIl existe déjà la frontière CAO " ; } + else if ( erreur == 3 ) { texte += "\nIl existe déjà une frontière discrète : " ; } + else if ( erreur == 5 ) { texte += "\nLe groupe " + std::string(Group) + " est déjà enregistré pour la frontière " ; } + texte += std::string(boun) ; + // + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; +#ifdef _DEBUG_ + texte += "\nInvalid AddBoundaryGroup"; +#endif + INFOS(texte) ; + es.text = CORBA::string_dup(texte.c_str()); + throw SALOME::SALOME_Exception(es); } - // D. Enregistrement du couple (frontiere,groupe) dans la reference du cas - myHomardCas->AddBoundaryGroup( BoundaryName, Group ); } //============================================================================= HOMARD::ListBoundaryGroupType* HOMARD_Cas_i::GetBoundaryGroup() diff --git a/src/HOMARD_I/HOMARD_Cas_i.hxx b/src/HOMARD_I/HOMARD_Cas_i.hxx index 14a25ac6..71181bf8 100644 --- a/src/HOMARD_I/HOMARD_Cas_i.hxx +++ b/src/HOMARD_I/HOMARD_Cas_i.hxx @@ -86,7 +86,8 @@ public: void SetGroups(const HOMARD::ListGroupType& ListGroup); HOMARD::ListGroupType* GetGroups(); - void AddBoundaryGroup( const char* Boundary, const char* Group); + void AddBoundary(const char* Boundary); + void AddBoundaryGroup(const char* Boundary, const char* Group); HOMARD::ListBoundaryGroupType* GetBoundaryGroup(); void SupprBoundaryGroup( ); diff --git a/src/HOMARD_I/HOMARD_Gen_i.cxx b/src/HOMARD_I/HOMARD_Gen_i.cxx index 915463df..9602c2f9 100644 --- a/src/HOMARD_I/HOMARD_Gen_i.cxx +++ b/src/HOMARD_I/HOMARD_Gen_i.cxx @@ -30,6 +30,8 @@ #include "YACSDriver.hxx" #include "HOMARD.hxx" +#include "FrontTrack.hxx" + #include "HOMARD_version.h" #include "utilities.h" @@ -121,7 +123,7 @@ HOMARD_Gen_i::~HOMARD_Gen_i() } //============================================================================= //============================================================================= -// Utilitaires pour l'??tude +// Utilitaires pour l'étude //============================================================================= //============================================================================= void HOMARD_Gen_i::UpdateStudy() @@ -873,7 +875,7 @@ void HOMARD_Gen_i::AssociateIterHypo(const char* nomIter, const char* nomHypo) myIteration->SetHypoName(nomHypo); myHypo->LinkIteration(nomIter); - // On stocke les noms des champ a interpoler pour le futur controle de la donnee des pas de temps + // On stocke les noms des champ a interpoler pour le futur controle de la donnée des pas de temps myIteration->SupprFieldInterps() ; HOMARD::listeFieldInterpsHypo* ListField = myHypo->GetFieldInterps(); int numberOfFieldsx2 = ListField->length(); @@ -1220,7 +1222,7 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCase(const char* nomCas, const char* HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromIteration(const char* nomCas, const char* DirNameStart) // // nomCas : nom du cas a creer -// DirNameStart : nom du repertoire contenant l'iteration de reprise +// DirNameStart : nom du répertoire contenant l'iteration de reprise // { INFOS ( "CreateCaseFromIteration : nomCas = " << nomCas << ", DirNameStart = " << DirNameStart ); @@ -1228,7 +1230,7 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromIteration(const char* nomCas, int codret ; // A. Decodage du point de reprise - // A.1. Controle du repertoire de depart de l'iteration + // A.1. Controle du répertoire de depart de l'iteration codret = CHDIR(DirNameStart) ; if ( codret != 0 ) { @@ -1238,7 +1240,7 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromIteration(const char* nomCas, throw SALOME::SALOME_Exception(es); return 0; }; - // A.2. Reperage des fichiers du repertoire de reprise + // A.2. Reperage des fichiers du répertoire de reprise std::string file_configuration = "" ; std::string file_maillage_homard = "" ; int bilan ; @@ -1304,13 +1306,13 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromIteration(const char* nomCas, char* MeshFile ; // le constructeur de ifstream permet d'ouvrir un fichier en lecture std::ifstream fichier( file_configuration.c_str() ); - if ( fichier ) // ce test ??choue si le fichier n'est pas ouvert + if ( fichier ) // ce test échoue si le fichier n'est pas ouvert { std::string ligne; // variable contenant chaque ligne lue std::string mot_cle; std::string argument; int decalage; - // cette boucle sur les lignes s'arr??te d??s qu'une erreur de lecture survient + // cette boucle sur les lignes s'arrête dès qu'une erreur de lecture survient while ( std::getline( fichier, ligne ) ) { // B.1. Pour la ligne courante, on identifie le premier mot : le mot-cle @@ -1391,9 +1393,9 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromIteration(const char* nomCas, myCase->SetPyram (Pyram) ; // E. Copie du fichier de maillage homard - // E.1. Repertoire associe au cas + // E.1. Répertoire associe au cas char* nomDirCase = myCase->GetDirName() ; - // E.2. Repertoire associe a l'iteration de ce cas + // E.2. Répertoire associe a l'iteration de ce cas char* IterName ; IterName = myCase->GetIter0Name() ; HOMARD::HOMARD_Iteration_var Iter = GetIteration(IterName) ; @@ -1441,7 +1443,7 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromIteration(const char* nomCas, HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromCaseLastIteration(const char* nomCas, const char* DirNameStart) // // nomCas : nom du cas a creer -// DirNameStart : nom du repertoire du cas contenant l'iteration de reprise +// DirNameStart : nom du répertoire du cas contenant l'iteration de reprise // { INFOS ( "CreateCaseFromCaseLastIteration : nomCas = " << nomCas << ", DirNameStart = " << DirNameStart ); @@ -1457,7 +1459,7 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromCaseLastIteration(const char* HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromCaseIteration(const char* nomCas, const char* DirNameStart, CORBA::Long Number) // // nomCas : nom du cas a creer -// DirNameStart : nom du repertoire du cas contenant l'iteration de reprise +// DirNameStart : nom du répertoire du cas contenant l'iteration de reprise // Number : numero de l'iteration de depart // { @@ -1481,8 +1483,8 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromCaseIteration(const char* nom //============================================================================= std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Number) // -// Retourne le nom du repertoire ou se trouve l'iteration voulue. -// DirNameStart : nom du repertoire du cas contenant l'iteration de reprise +// Retourne le nom du répertoire ou se trouve l'iteration voulue. +// DirNameStart : nom du répertoire du cas contenant l'iteration de reprise // Number : numero de l'iteration de depart ou -1 si on cherche la derniere // { @@ -1492,7 +1494,7 @@ std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Numb int codret ; int NumeIterMax = -1 ; - // A.1. Controle du repertoire de depart du cas + // A.1. Controle du répertoire de depart du cas codret = CHDIR(DirNameStart) ; if ( codret != 0 ) { @@ -1502,7 +1504,7 @@ std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Numb throw SALOME::SALOME_Exception(es); return 0; }; - // A.2. Reperage des sous-repertoire du repertoire de reprise + // A.2. Reperage des sous-répertoire du répertoire de reprise bool existe = false ; #ifndef WIN32 DIR *dp; @@ -1525,7 +1527,7 @@ std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Numb { if ( CHDIR(DirName_1.c_str()) == 0 ) { -// On cherche le fichier de configuration dans ce sous-repertoire +// On cherche le fichier de configuration dans ce sous-répertoire codret = CHDIR(DirNameStart); #ifndef WIN32 DIR *dp_1; @@ -1550,12 +1552,12 @@ std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Numb CHDIR(DirName_1.c_str()) ; std::ifstream fichier( file_name_1.c_str() ); - if ( fichier ) // ce test ??choue si le fichier n'est pas ouvert + if ( fichier ) // ce test échoue si le fichier n'est pas ouvert { int NumeIter ; std::string ligne; // variable contenant chaque ligne lue std::string mot_cle; - // cette boucle sur les lignes s'arr??te d??s qu'une erreur de lecture survient + // cette boucle sur les lignes s'arrête dès qu'une erreur de lecture survient while ( std::getline( fichier, ligne ) ) { // B.1. Pour la ligne courante, on identifie le premier mot : le mot-cle @@ -1684,8 +1686,8 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCase0(const char* nomCas, const char* // C. Caracteristiques du maillage if ( existeMeshFile != 0 ) { - // Les valeurs extremes des coordonnees -// MESSAGE ( "CreateCase0 : Les valeurs extremes des coordonnees" ); + // Les valeurs extremes des coordonnées +// MESSAGE ( "CreateCase0 : Les valeurs extremes des coordonnées" ); std::vector LesExtremes =GetBoundingBoxInMedFile(MeshFile) ; HOMARD::extrema_var aSeq = new HOMARD::extrema() ; if (LesExtremes.size()!=10) { return 0; } @@ -1845,7 +1847,7 @@ HOMARD::HOMARD_Iteration_ptr HOMARD_Gen_i::CreateIteration(const char* NomIterat myIteration->SetNumber(numero); // Nombre d'iterations deja connues pour le cas, permettant -// la creation d'un sous-repertoire unique +// la creation d'un sous-répertoire unique int nbitercase = myCase->GetNumberofIter(); char* nomDirIter = CreateDirNameIter(nomDirCase, nbitercase ); myIteration->SetDirNameLoc(nomDirIter); @@ -1914,11 +1916,20 @@ HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundary(const char* BoundaryNam return HOMARD::HOMARD_Boundary::_duplicate(myBoundary); } //============================================================================= +HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryCAO(const char* BoundaryName, const char* CAOFile) +{ + INFOS ("CreateBoundaryCAO : BoundaryName = " << BoundaryName << ", CAOFile = " << CAOFile ); + HOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, -1); + myBoundary->SetDataFile( CAOFile ) ; + + return HOMARD::HOMARD_Boundary::_duplicate(myBoundary); +} +//============================================================================= HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryDi(const char* BoundaryName, const char* MeshName, const char* MeshFile) { - INFOS ("CreateBoundaryDi : BoundaryName = " << BoundaryName << ", MeshName = " << MeshName ); + INFOS ("CreateBoundaryDi : BoundaryName = " << BoundaryName << ", MeshName = " << MeshName << ", MeshFile = " << MeshFile ); HOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 0); - myBoundary->SetMeshFile( MeshFile ) ; + myBoundary->SetDataFile( MeshFile ) ; myBoundary->SetMeshName( MeshName ) ; return HOMARD::HOMARD_Boundary::_duplicate(myBoundary); @@ -2375,7 +2386,7 @@ HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZoneDiskWithHole(const char* ZoneNam //============================================================================= //============================================================================= // Traitement d'une iteration -// etatMenage = 1 : destruction du repertoire d'execution +// etatMenage = 1 : destruction du répertoire d'execution // modeHOMARD = 1 : adaptation // != 1 : information avec les options modeHOMARD // Option1 >0 : appel depuis python @@ -2462,10 +2473,10 @@ CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMena HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; ASSERT(!CORBA::is_nil(myCase)); - // B. Les repertoires - // B.1. Le repertoire courant + // B. Les répertoires + // B.1. Le répertoire courant std::string nomDirWork = getenv("PWD") ; - // B.2. Le sous-repertoire de l'iteration a traiter + // B.2. Le sous-répertoire de l'iteration a traiter char* DirCompute = ComputeDirManagement(myCase, myIteration, etatMenage); MESSAGE( ". DirCompute = " << DirCompute ); @@ -2488,11 +2499,11 @@ CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMena FileInfo += "." + siterp1 + ".bilan" ; myIteration->SetFileInfo(FileInfo.c_str()); - // D. On passe dans le repertoire de l'iteration a calculer + // D. On passe dans le répertoire de l'iteration a calculer MESSAGE ( ". On passe dans DirCompute = " << DirCompute ); CHDIR(DirCompute); - // E. Les donnees de l'execution HOMARD + // E. Les données de l'exécution HOMARD // E.1. L'objet du texte du fichier de configuration HomardDriver* myDriver = new HomardDriver(siter, siterp1); myDriver->TexteInit(DirCompute, LogFile, _Langue); @@ -2503,7 +2514,7 @@ CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMena const char* MeshFile = myIteration->GetMeshFile(); MESSAGE ( ". MeshFile = " << MeshFile ); - // E.3. Les donnees du traitement HOMARD + // E.3. Les données du traitement HOMARD int iaux ; if ( modeHOMARD == 1 ) { @@ -2523,7 +2534,7 @@ CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMena } // E.4. Ajout des informations liees a l'eventuel suivi de frontiere - DriverTexteBoundary(myCase, myDriver) ; + int BoundaryOption = DriverTexteBoundary(myCase, myDriver) ; // E.5. Ecriture du texte dans le fichier MESSAGE ( ". Ecriture du texte dans le fichier de configuration ; codret = "<ExecuteHomard(Option1); @@ -2585,7 +2596,7 @@ CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMena text = "Error during the adaptation.\n" ; bool stopvu = false ; std::ifstream fichier( LogFile.c_str() ); - if ( fichier ) // ce test ??choue si le fichier n'est pas ouvert + if ( fichier ) // ce test échoue si le fichier n'est pas ouvert { std::string ligne; // variable contenant chaque ligne lue while ( std::getline( fichier, ligne ) ) @@ -2613,7 +2624,7 @@ CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMena } } - // I. Menage et retour dans le repertoire du cas + // I. Menage et retour dans le répertoire du cas if (codret == 0) { delete myDriver; @@ -2622,14 +2633,28 @@ CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMena CHDIR(nomDirWork.c_str()); } + // J. Suivi de la frontière CAO +// std::cout << "- codret : " << codret << std::endl; +// std::cout << "- modeHOMARD : " << modeHOMARD << std::endl; +// std::cout << "- BoundaryOption : " << BoundaryOption << std::endl; +// std::cout << "- codretexec : " << codretexec << std::endl; + if (codret == 0) + { + if ( ( modeHOMARD == 1 ) && ( BoundaryOption % 5 == 0 ) && (codretexec == 0) ) + { + INFOS ( "Suivi de frontière CAO" ); + codret = ComputeCAO(myCase, myIteration, Option1, Option2) ; + } + } + return codretexec ; } //============================================================================= -// Calcul d'une iteration : partie specifique a l'adaptation +// Calcul d'une iteration : partie spécifique à l'adaptation //============================================================================= CORBA::Long HOMARD_Gen_i::ComputeAdap(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage, HomardDriver* myDriver, CORBA::Long Option1, CORBA::Long Option2) { - MESSAGE ( "ComputeAdap" ); + MESSAGE ( "ComputeAdap avec Option1 = " << Option1 << ", Option2 = " << Option2 ); // A. Prealable // A.1. Bases @@ -2670,11 +2695,11 @@ CORBA::Long HOMARD_Gen_i::ComputeAdap(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOM } }; - // C. Le sous-repertoire de l'iteration precedente + // C. Le sous-répertoire de l'iteration precedente char* DirComputePa = ComputeDirPaManagement(myCase, myIteration); MESSAGE( ". DirComputePa = " << DirComputePa ); - // D. Les donnees de l'adaptation HOMARD + // D. Les données de l'adaptation HOMARD // D.1. Le type de conformite int ConfType = myCase->GetConfType(); MESSAGE ( ". ConfType = " << ConfType ); @@ -2783,14 +2808,221 @@ CORBA::Long HOMARD_Gen_i::ComputeAdap(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOM return codret ; } //============================================================================= -// Creation d'un nom de sous-repertoire pour l'iteration au sein d'un repertoire parent -// nomrep : nom du repertoire parent -// num : le nom du sous-repertoire est sous la forme 'In', n est >= num +// Calcul d'une iteration : partie spécifique au suivi de frontière CAO +//============================================================================= +CORBA::Long HOMARD_Gen_i::ComputeCAO(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long Option1, CORBA::Long Option2) +{ + MESSAGE ( "ComputeCAO avec Option1 = " << Option1 << ", Option2 = " << Option2 ); + + // A. Prealable + // A.1. Bases + int codret = 0; + // A.2. Le sous-répertoire de l'iteration en cours de traitement + char* DirCompute = myIteration->GetDirName(); + // A.3. Le maillage résultat de l'iteration en cours de traitement + char* MeshFile = myIteration->GetMeshFile(); + + // B. Les données pour FrontTrack + // B.1. Le maillage à modifier + const std::string theInputMedFile = MeshFile; + MESSAGE ( ". theInputMedFile = " << theInputMedFile ); + + // B.2. Le maillage après modification : fichier identique + const std::string theOutputMedFile = MeshFile ; + MESSAGE ( ". theOutputMedFile = " << theInputMedFile ); + + // B.3. La liste des fichiers contenant les numéros des noeuds à bouger + std::vector< std::string > theInputNodeFiles ; + MESSAGE ( ". DirCompute = " << DirCompute ); + int bilan ; + int icpt = 0 ; +#ifndef WIN32 + DIR *dp; + struct dirent *dirp; + dp = opendir(DirCompute); + while ( (dirp = readdir(dp)) != NULL ) + { + std::string file_name(dirp->d_name); + bilan = file_name.find("fr") ; + if ( bilan != string::npos ) + { + std::stringstream filename_total ; + filename_total << DirCompute << "/" << file_name ; + theInputNodeFiles.push_back(filename_total.str()) ; + icpt += 1 ; + } + } +#else + HANDLE hFind = INVALID_HANDLE_VALUE; + WIN32_FIND_DATA ffd; + hFind = FindFirstFile(DirNameStart, &ffd); + if (INVALID_HANDLE_VALUE != hFind) { + while (FindNextFile(hFind, &ffd) != 0) { + std::string file_name(ffd.cFileName); + bilan = file_name.find("fr") ; + if ( bilan != string::npos ) + { + std::stringstream filename_total ; + filename_total << DirCompute << "/" << file_name ; + theInputNodeFiles.push_back(filename_total.str()) ; + icpt += 1 ; + } + } + FindClose(hFind); + } +#endif + for ( int i = 0; i < icpt; i++ ) + { MESSAGE ( ". theInputNodeFiles["<< i << "] = " << theInputNodeFiles[i] ); } + + // B.4. Le fichier de la CAO + HOMARD::ListBoundaryGroupType* ListBoundaryGroupType = myCase->GetBoundaryGroup(); + std::string BoundaryName = std::string((*ListBoundaryGroupType)[0]); + MESSAGE ( ". BoundaryName = " << BoundaryName ); + HOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; + const std::string theXaoFileName = myBoundary->GetDataFile(); + MESSAGE ( ". theXaoFileName = " << theXaoFileName ); + + // B.5. Parallélisme + bool theIsParallel = false; + + // C. Lancement des projections + MESSAGE ( ". Lancement des projections" ); + FrontTrack* myFrontTrack = new FrontTrack(); + myFrontTrack->track(theInputMedFile, theOutputMedFile, theInputNodeFiles, theXaoFileName, theIsParallel); + + // D. Transfert des coordonnées modifiées dans le fichier historique de HOMARD + // On lance une exécution spéciale de HOMARD en attendant de savoir le faire avec MEDCoupling + MESSAGE ( ". Transfert des coordonnées" ); + codret = ComputeCAObis(myIteration, Option1, Option2) ; + + return codret ; +} +//============================================================================= +//============================================================================= +// Transfert des coordonnées en suivi de frontière CAO +// Option1 >0 : appel depuis python +// <0 : appel depuis GUI +// Option2 : multiple de nombres premiers +// 1 : aucune option +// x2 : publication du maillage dans SMESH +//============================================================================= +CORBA::Long HOMARD_Gen_i::ComputeCAObis(HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long Option1, CORBA::Long Option2) +{ + MESSAGE ( "ComputeCAObis, avec Option1 = " << Option1 << ", Option2 = " << Option2 ); + + // A. Prealable + int codret = 0; + + // A.1. Controle de la possibilite d'agir + // A.1.1. Etat de l'iteration + int etat = myIteration->GetState(); + MESSAGE ( "etat = "<GetNumber(); + std::string siterp1 ; + std::stringstream saux1 ; + saux1 << NumeIter ; + siterp1 = saux1.str() ; + if (NumeIter < 10) { siterp1 = "0" + siterp1 ; } + MESSAGE ( "siterp1 = "<GetCaseName(); + HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[CaseName]; + ASSERT(!CORBA::is_nil(myCase)); + + // A.4. Le sous-répertoire de l'iteration a traiter + char* DirCompute = myIteration->GetDirName(); + MESSAGE( ". DirCompute = " << DirCompute ); + + // C. Le fichier des messages + std::string LogFile = DirCompute ; + LogFile += "/Liste." + siterp1 + ".maj_coords.log" ; + MESSAGE (". LogFile = " << LogFile); + myIteration->SetFileInfo(LogFile.c_str()); + + // D. On passe dans le répertoire de l'iteration a calculer + MESSAGE ( ". On passe dans DirCompute = " << DirCompute ); + CHDIR(DirCompute); + + // E. Les données de l'exécution HOMARD + // E.1. L'objet du texte du fichier de configuration + HomardDriver* myDriver = new HomardDriver("", siterp1); + myDriver->TexteInit(DirCompute, LogFile, _Langue); + + // E.2. Le maillage associe a l'iteration + const char* NomMesh = myIteration->GetMeshName(); + MESSAGE ( ". NomMesh = " << NomMesh ); + const char* MeshFile = myIteration->GetMeshFile(); + MESSAGE ( ". MeshFile = " << MeshFile ); + + // E.3. Les données du traitement HOMARD + int iaux ; + myDriver->TexteMajCoords( NumeIter ) ; + iaux = 0 ; + myDriver->TexteMaillageHOMARD( DirCompute, siterp1, iaux ) ; + myDriver->TexteMaillage(NomMesh, MeshFile, 0); +// + // E.4. Ecriture du texte dans le fichier + MESSAGE ( ". Ecriture du texte dans le fichier de configuration ; codret = "<CreeFichier(); } + +// F. Execution +// + int codretexec = 1789 ; + if (codret == 0) + { + codretexec = myDriver->ExecuteHomard(Option1); + MESSAGE ( "Erreur en executant HOMARD : " << codretexec ); + } + + // G. Gestion des resultats + if (codret == 0) + { + // G.1. Le fichier des messages, dans tous les cas + const char* NomIteration = myIteration->GetName(); + std::string Commentaire = "logmaj_coords" ; + PublishFileUnderIteration(NomIteration, LogFile.c_str(), Commentaire.c_str()); + // G.2 Message d'erreur + if (codretexec != 0) + { + std::string text = "\n\nSee the file " + LogFile + "\n" ; + INFOS ( text ) ; + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + + // On force le succes pour pouvoir consulter le fichier log + codretexec = 0 ; + } + } + + // H. Menage et retour dans le répertoire du cas + if (codret == 0) { delete myDriver; } + + return codret ; +} +//============================================================================= +// Creation d'un nom de sous-répertoire pour l'iteration au sein d'un répertoire parent +// nomrep : nom du répertoire parent +// num : le nom du sous-répertoire est sous la forme 'In', n est >= num //============================================================================= char* HOMARD_Gen_i::CreateDirNameIter(const char* nomrep, CORBA::Long num ) { MESSAGE ( "CreateDirNameIter : nomrep ="<< nomrep << ", num = "<GetDirName(); MESSAGE ( ". nomDirCase = " << nomDirCase ); - // B.3. Le sous-repertoire de l'iteration a calculer, puis le repertoire complet a creer - // B.3.1. Le nom du sous-repertoire + // B.3. Le sous-répertoire de l'iteration a calculer, puis le répertoire complet a creer + // B.3.1. Le nom du sous-répertoire const char* nomDirIt = myIteration->GetDirNameLoc(); - // B.3.2. Le nom complet du sous-repertoire + // B.3.2. Le nom complet du sous-répertoire std::stringstream DirCompute ; DirCompute << nomDirCase << "/" << nomDirIt; MESSAGE (". DirCompute = " << DirCompute.str() ); - // B.3.3. Si le sous-repertoire n'existe pas, on le cree + // B.3.3. Si le sous-répertoire n'existe pas, on le cree if (CHDIR(DirCompute.str().c_str()) != 0) { #ifndef WIN32 @@ -2896,24 +3128,24 @@ char* HOMARD_Gen_i::ComputeDirManagement(HOMARD::HOMARD_Cas_var myCase, HOMARD:: #endif { // GERALD -- QMESSAGE BOX - std::cerr << "Pb Creation du repertoire DirCompute = " << DirCompute.str() << std::endl; - VERIFICATION("Pb a la creation du repertoire" == 0); + std::cerr << "Pb Creation du répertoire DirCompute = " << DirCompute.str() << std::endl; + VERIFICATION("Pb a la creation du répertoire" == 0); } } else { -// Le repertoire existe +// Le répertoire existe // On demande de faire le menage de son contenu : if (etatMenage == 1) { - MESSAGE (". Menage du repertoire DirCompute = " << DirCompute.str()); + MESSAGE (". Menage du répertoire DirCompute = " << DirCompute.str()); std::string commande = "rm -rf " + DirCompute.str()+"/*" ; int codret = system(commande.c_str()); if (codret != 0) { // GERALD -- QMESSAGE BOX - std::cerr << ". Menage du repertoire de calcul" << DirCompute.str() << std::endl; - VERIFICATION("Pb au menage du repertoire de calcul" == 0); + std::cerr << ". Menage du répertoire de calcul" << DirCompute.str() << std::endl; + VERIFICATION("Pb au menage du répertoire de calcul" == 0); } } // On n'a pas demande de faire le menage de son contenu : on sort en erreur : @@ -2962,16 +3194,16 @@ char* HOMARD_Gen_i::ComputeDirManagement(HOMARD::HOMARD_Cas_var myCase, HOMARD:: return CORBA::string_dup( DirCompute.str().c_str() ); } //============================================================================= -// Calcul d'une iteration : gestion du repertoire de calcul de l'iteration parent +// Calcul d'une iteration : gestion du répertoire de calcul de l'iteration parent //============================================================================= char* HOMARD_Gen_i::ComputeDirPaManagement(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration) { - MESSAGE ( "ComputeDirPaManagement : repertoires pour le calcul" ); - // Le repertoire du cas + MESSAGE ( "ComputeDirPaManagement : répertoires pour le calcul" ); + // Le répertoire du cas const char* nomDirCase = myCase->GetDirName(); MESSAGE ( ". nomDirCase = " << nomDirCase ); - // Le sous-repertoire de l'iteration precedente + // Le sous-répertoire de l'iteration precedente const char* nomIterationParent = myIteration->GetIterParentName(); HOMARD::HOMARD_Iteration_var myIterationParent = myStudyContext._mesIterations[nomIterationParent]; @@ -3064,11 +3296,8 @@ void HOMARD_Gen_i::DriverTexteField(HOMARD::HOMARD_Iteration_var myIteration, HO for (int NumeComp = 0; NumeComp< numberOfCompos; NumeComp++) { std::string nomCompo = std::string((*mescompo)[NumeComp]); - if ((system(nomCompo.c_str())) != 0) - { - MESSAGE( "... nomCompo = " << nomCompo ); - myDriver->TexteCompo(NumeComp, nomCompo); - } + MESSAGE( "... nomCompo = " << nomCompo ); + myDriver->TexteCompo(NumeComp, nomCompo); } return ; } @@ -3079,7 +3308,7 @@ void HOMARD_Gen_i::DriverTexteField(HOMARD::HOMARD_Iteration_var myIteration, HO // 2. les liens avec les groupes // 3. un entier resumant le type de comportement pour les frontieres //============================================================================= -void HOMARD_Gen_i::DriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, HomardDriver* myDriver) +int HOMARD_Gen_i::DriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, HomardDriver* myDriver) { MESSAGE ( "... DriverTexteBoundary" ); // 1. Recuperation des frontieres @@ -3113,17 +3342,24 @@ void HOMARD_Gen_i::DriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, HomardDriv int BoundaryType = myBoundary->GetType(); MESSAGE ( "... BoundaryType = " << BoundaryType ); // 2.2.2. Ecriture selon le type - // 2.2.2.1. Cas d une frontiere discrete - if (BoundaryType == 0) + // 2.2.2.1. Cas d une frontiere CAO + if (BoundaryType == -1) + { +// const char* CAOFile = myBoundary->GetDataFile() ; +// MESSAGE ( ". CAOFile = " << CAOFile ); + if ( BoundaryOption % 5 != 0 ) { BoundaryOption = BoundaryOption*5 ; } + } + // 2.2.2.2. Cas d une frontiere discrete + else if (BoundaryType == 0) { const char* MeshName = myBoundary->GetMeshName() ; MESSAGE ( ". MeshName = " << MeshName ); - const char* MeshFile = myBoundary->GetMeshFile() ; + const char* MeshFile = myBoundary->GetDataFile() ; MESSAGE ( ". MeshFile = " << MeshFile ); myDriver->TexteBoundaryDi( MeshName, MeshFile); if ( BoundaryOption % 2 != 0 ) { BoundaryOption = BoundaryOption*2 ; } } - // 2.2.2.1. Cas d une frontiere analytique + // 2.2.2.3. Cas d une frontiere analytique else { NumBoundaryAnalytical++ ; @@ -3171,12 +3407,17 @@ void HOMARD_Gen_i::DriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, HomardDriv // 3.1. Recuperation du nom du groupe std::string GroupName = std::string((*ListBoundaryGroupType)[NumBoundary+1]); MESSAGE ( "... GroupName = " << GroupName); - // 3.2. Cas d une frontiere discrete - if ( BoundaryType == 0 ) + // 3.2. Cas d une frontiere CAO + if ( BoundaryType == -1 ) + { + if ( GroupName.size() > 0 ) { myDriver->TexteBoundaryCAOGr ( GroupName ) ; } + } + // 3.3. Cas d une frontiere discrete + else if ( BoundaryType == 0 ) { if ( GroupName.size() > 0 ) { myDriver->TexteBoundaryDiGr ( GroupName ) ; } } - // 3.3. Cas d une frontiere analytique + // 3.4. Cas d une frontiere analytique else { NumBoundaryAnalytical++ ; @@ -3186,7 +3427,7 @@ void HOMARD_Gen_i::DriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, HomardDriv // 4. Ecriture de l'option finale myDriver->TexteBoundaryOption(BoundaryOption); // - return ; + return BoundaryOption ; } //============================================================================= // Calcul d'une iteration : ecriture des interpolations dans le fichier de configuration @@ -3259,7 +3500,7 @@ void HOMARD_Gen_i::DriverTexteFieldInterp(HOMARD::HOMARD_Iteration_var myIterati } jaux += 2 ; } - // Si aucun instant n'a ??t?? d??fini + // Si aucun instant n'a été défini if ( tsrvu == 0 ) { NumField += 1 ; @@ -3932,7 +4173,7 @@ void HOMARD_Gen_i::PublishFileUnderYACS(const char* nomYACS, const char* NomFich // Creation d'un schema YACS // nomCas : nom du cas a traiter // FileName : nom du fichier contenant le script de lancement du calcul -// DirName : le repertoire de lancement des calculs du sch??ma +// DirName : le répertoire de lancement des calculs du schéma //============================================================================= HOMARD::HOMARD_YACS_ptr HOMARD_Gen_i::CreateYACSSchema (const char* nomYACS, const char* nomCas, const char* ScriptFile, const char* DirName, const char* MeshFile) { @@ -3989,7 +4230,7 @@ HOMARD::HOMARD_YACS_ptr HOMARD_Gen_i::CreateYACSSchema (const char* nomYACS, con myYACS->SetMaxNode( defaut_i ) ; defaut_i = GetYACSMaxElem() ; myYACS->SetMaxElem( defaut_i ) ; - // D.3. Fichier de sauvegarde dans le repertoire du cas + // D.3. Fichier de sauvegarde dans le répertoire du cas HOMARD::HOMARD_Cas_ptr caseyacs = GetCase(nomCas) ; std::string dirnamecase = caseyacs->GetDirName() ; std::string XMLFile ; @@ -4004,7 +4245,7 @@ HOMARD::HOMARD_YACS_ptr HOMARD_Gen_i::CreateYACSSchema (const char* nomYACS, con CORBA::Long HOMARD_Gen_i::YACSWrite(const char* nomYACS) { INFOS ( "YACSWrite : Ecriture de " << nomYACS ); -// Le repertoire du cas +// Le répertoire du cas HOMARD::HOMARD_YACS_var myYACS = myStudyContext._mesYACSs[nomYACS]; ASSERT(!CORBA::is_nil(myYACS)); // Le nom du fichier du schema @@ -4094,7 +4335,7 @@ CORBA::Long HOMARD_Gen_i::YACSWriteOnFile(const char* nomYACS, const char* XMLFi MESSAGE ("pythonHypo :\n"<Texte_Iter_1_Case_Options(pythonCas); } - // G.1.5. Execution de HOMARD : le repertoire du cas + // G.1.5. Execution de HOMARD : le répertoire du cas else if ( mot_cle == "HOMARD_Exec_DirName" ) { myDriver->Texte_HOMARD_Exec_DirName(); } // G.1.6. Execution de HOMARD : le nom du maillage @@ -4286,16 +4527,21 @@ std::string HOMARD_Gen_i::YACSDriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, int BoundaryType = myBoundary->GetType(); MESSAGE ( "... BoundaryType = " << BoundaryType); const char* MeshName ; - const char* MeshFile ; - if (BoundaryType == 0) + const char* DataFile ; + if (BoundaryType == -1) + { + DataFile = myBoundary->GetDataFile() ; + MESSAGE ( ". CAOFile = " << DataFile ); + } + else if (BoundaryType == 0) { MeshName = myBoundary->GetMeshName() ; MESSAGE ( ". MeshName = " << MeshName ); - MeshFile = myBoundary->GetMeshFile() ; - MESSAGE ( ". MeshFile = " << MeshFile ); + DataFile = myBoundary->GetDataFile() ; + MESSAGE ( ". MeshFile = " << DataFile ); } std::string texte_control_0 ; - texte_control_0 = myDriver->Texte_Iter_1_Boundary(BoundaryType, pythonStructure, methode, BoundaryName, MeshName, MeshFile ); + texte_control_0 = myDriver->Texte_Iter_1_Boundary(BoundaryType, pythonStructure, methode, BoundaryName, MeshName, DataFile ); texte_control += texte_control_0 ; // 5. Memorisation du traitement ListeBoundaryTraitees.push_back( BoundaryName ); @@ -4985,7 +5231,7 @@ void HOMARD_Gen_i::SetPreferences( ) File += "/bin/salome/VERSION" ; MESSAGE ( "File = "< #include @@ -60,8 +60,10 @@ public: // Les creations HOMARD::HOMARD_Boundary_ptr CreateBoundary (const char* nomBoundary, CORBA::Long typeBoundary); + HOMARD::HOMARD_Boundary_ptr CreateBoundaryCAO(const char* nomBoundary, + const char* DataFile); HOMARD::HOMARD_Boundary_ptr CreateBoundaryDi (const char* nomBoundary, - const char* MeshName, const char* FileName); + const char* MeshName, const char* DataFile); HOMARD::HOMARD_Boundary_ptr CreateBoundaryCylinder (const char* nomBoundary, CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, CORBA::Double Xaxis, CORBA::Double Yaxis, CORBA::Double Zaxis, @@ -175,11 +177,13 @@ public: CORBA::Long Compute(const char* nomIteration, CORBA::Long etatMenage, CORBA::Long modeHOMARD, CORBA::Long Option1, CORBA::Long Option2); CORBA::Long ComputeAdap(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage, HomardDriver* myDriver, CORBA::Long Option1, CORBA::Long Option2); + CORBA::Long ComputeCAO(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long Option1, CORBA::Long Option2); + CORBA::Long ComputeCAObis(HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long Option1, CORBA::Long Option2); char* ComputeDirManagement(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage); char* ComputeDirPaManagement(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration); void DriverTexteZone(HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver); void DriverTexteField(HOMARD::HOMARD_Iteration_var myIteration, HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver); - void DriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, HomardDriver* myDriver); + int DriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, HomardDriver* myDriver); void DriverTexteFieldInterp(HOMARD::HOMARD_Iteration_var myIteration, HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver); char* VerifieDir(const char* nomDir);