X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHOMARD_I%2FHOMARD_Gen_i.cxx;h=63d70304335357ac524ab836fb67e71dccc3187c;hb=114be747f34dd617afb4a5e437c5d5f276d31b23;hp=915463dfbb6380834bb5c4d0e9ed4e22ac2201e6;hpb=df48f2f8906e43a3b04e5cfb4076647890a50b95;p=modules%2Fhomard.git diff --git a/src/HOMARD_I/HOMARD_Gen_i.cxx b/src/HOMARD_I/HOMARD_Gen_i.cxx index 915463df..63d70304 100644 --- a/src/HOMARD_I/HOMARD_Gen_i.cxx +++ b/src/HOMARD_I/HOMARD_Gen_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2011-2016 CEA/DEN, EDF R&D +// Copyright (C) 2011-2020 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 @@ -30,18 +30,19 @@ #include "YACSDriver.hxx" #include "HOMARD.hxx" +#include "FrontTrack.hxx" + #include "HOMARD_version.h" #include "utilities.h" #include "Basics_Utils.hxx" +#include "Basics_DirUtils.hxx" #include "Utils_SINGLETON.hxx" #include "Utils_CorbaException.hxx" #include "SALOMEDS_Tool.hxx" #include "SALOME_LifeCycleCORBA.hxx" #include "SALOMEconfig.h" #include -#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog) -#include CORBA_CLIENT_HEADER(SMESH_Gen) #include #include @@ -89,19 +90,15 @@ HOMARD_Gen_i::HOMARD_Gen_i( CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId, const char *instanceName, - const char *interfaceName) : -Engines_Component_i(orb, poa, contId, instanceName, interfaceName) + const char *interfaceName, + bool checkNS) : +Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, checkNS) { - MESSAGE("constructor"); + MESSAGE("constructor de HOMARD_Gen_i"); _thisObj = this; _id = _poa->activate_object(_thisObj); - myHomard = new ::HOMARD_Gen(); - _NS = SINGLETON_::Instance(); - ASSERT(SINGLETON_::IsAlreadyExisting()); - _NS->init_orb(_orb); - - myStudy = SALOMEDS::Study::_duplicate( SMESH_Gen_i::getStudyServant() ); + myHomard = new ::HOMARD_Gen; _tag_gene = 0 ; _tag_boun = 0 ; @@ -121,7 +118,7 @@ HOMARD_Gen_i::~HOMARD_Gen_i() } //============================================================================= //============================================================================= -// Utilitaires pour l'??tude +// Utilitaires pour l'étude //============================================================================= //============================================================================= void HOMARD_Gen_i::UpdateStudy() @@ -142,9 +139,7 @@ void HOMARD_Gen_i::UpdateStudy() homardFather = myBuilder->NewComponent(ComponentDataType()); SALOMEDS::GenericAttribute_var anAttr = myBuilder->FindOrCreateAttribute(homardFather,"AttributeName"); SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr); - CORBA::Object_var objVarN = _NS->Resolve("/Kernel/ModulCatalog"); - SALOME_ModuleCatalog::ModuleCatalog_var Catalogue = - SALOME_ModuleCatalog::ModuleCatalog::_narrow(objVarN); + SALOME_ModuleCatalog::ModuleCatalog_var Catalogue = this->getModuleCatalog(); SALOME_ModuleCatalog::Acomponent_var Comp = Catalogue->GetComponent(ComponentDataType()); if (!Comp->_is_nil()) { @@ -499,7 +494,7 @@ CORBA::Long HOMARD_Gen_i::DeleteZone(const char* nomZone) { SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; - es.text = "This zone is used in an hypothesis and cannot be deleted."; + es.text = "This zone is used in a hypothesis and cannot be deleted."; throw SALOME::SALOME_Exception(es); return 2 ; }; @@ -873,7 +868,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(); @@ -1103,8 +1098,8 @@ HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::GetZone(const char* ZoneName) //============================================================================= void HOMARD_Gen_i::MeshInfo(const char* nomCas, const char* MeshName, const char* MeshFile, const char* DirName, CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte) { - INFOS ( "MeshInfo : nomCas = " << nomCas << ", MeshName = " << MeshName << ", MeshFile = " << MeshFile ); - INFOS ( "Qual = " << Qual << ", Diam = " << Diam << ", Conn = " << Conn << ", Tail = " << Tail << ", Inte = " << Inte ); + MESSAGE ( "MeshInfo : nomCas = " << nomCas << ", MeshName = " << MeshName << ", MeshFile = " << MeshFile ); + MESSAGE ( "Qual = " << Qual << ", Diam = " << Diam << ", Conn = " << Conn << ", Tail = " << Tail << ", Inte = " << Inte ); IsValidStudy () ; // Creation du cas @@ -1220,15 +1215,15 @@ 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 ); + MESSAGE ( "CreateCaseFromIteration : nomCas = " << nomCas << ", DirNameStart = " << DirNameStart ); std::string nomDirWork = getenv("PWD") ; 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 +1233,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 +1299,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 +1386,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,10 +1436,10 @@ 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 ); + MESSAGE ( "CreateCaseFromCaseLastIteration : nomCas = " << nomCas << ", DirNameStart = " << DirNameStart ); std::string DirNameStartIter = CreateCase1(DirNameStart, -1) ; @@ -1457,11 +1452,11 @@ 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 // { - INFOS ( "CreateCaseFromCaseIteration : nomCas = " << nomCas << ", DirNameStart = " << DirNameStart << ", Number = " << Number ); + MESSAGE ( "CreateCaseFromCaseIteration : nomCas = " << nomCas << ", DirNameStart = " << DirNameStart << ", Number = " << Number ); if ( Number < 0 ) { SALOME::ExceptionStruct es; @@ -1481,8 +1476,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 +1487,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 +1497,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 +1520,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 +1545,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 +1679,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; } @@ -1746,7 +1741,7 @@ HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCase0(const char* nomCas, const char* //============================================================================= HOMARD::HOMARD_Hypothesis_ptr HOMARD_Gen_i::CreateHypothesis(const char* nomHypothesis) { - INFOS ( "CreateHypothesis : nomHypothesis = " << nomHypothesis ); + MESSAGE ( "CreateHypothesis : nomHypothesis = " << nomHypothesis ); IsValidStudy () ; // A. Controle du nom : @@ -1790,7 +1785,7 @@ HOMARD::HOMARD_Hypothesis_ptr HOMARD_Gen_i::CreateHypothesis(const char* nomHypo HOMARD::HOMARD_Iteration_ptr HOMARD_Gen_i::CreateIteration(const char* NomIteration, const char* nomIterParent) //============================================================================= { - INFOS ("CreateIteration : NomIteration = " << NomIteration << ", nomIterParent = " << nomIterParent); + MESSAGE ("CreateIteration : NomIteration = " << NomIteration << ", nomIterParent = " << nomIterParent); IsValidStudy () ; HOMARD::HOMARD_Iteration_var myIterationParent = myStudyContext._mesIterations[nomIterParent]; @@ -1845,7 +1840,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 +1909,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) +{ + MESSAGE ("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 ); + MESSAGE ("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); @@ -1929,7 +1933,7 @@ HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryCylinder(const char* Bou CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, CORBA::Double Rayon) { - INFOS ("CreateBoundaryCylinder : BoundaryName = " << BoundaryName ) ; + MESSAGE ("CreateBoundaryCylinder : BoundaryName = " << BoundaryName ) ; // SALOME::ExceptionStruct es; int error = 0 ; @@ -1957,7 +1961,7 @@ HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundarySphere(const char* Bound CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, CORBA::Double Rayon) { - INFOS ("CreateBoundarySphere : BoundaryName = " << BoundaryName ) ; + MESSAGE ("CreateBoundarySphere : BoundaryName = " << BoundaryName ) ; // SALOME::ExceptionStruct es; int error = 0 ; @@ -1981,7 +1985,7 @@ HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryConeA(const char* Bounda CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, CORBA::Double Angle, CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre) { - INFOS ("CreateBoundaryConeA : BoundaryName = " << BoundaryName ) ; + MESSAGE ("CreateBoundaryConeA : BoundaryName = " << BoundaryName ) ; // SALOME::ExceptionStruct es; int error = 0 ; @@ -2009,7 +2013,7 @@ HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryConeR(const char* Bounda CORBA::Double Xcentre1, CORBA::Double Ycentre1, CORBA::Double Zcentre1, CORBA::Double Rayon1, CORBA::Double Xcentre2, CORBA::Double Ycentre2, CORBA::Double Zcentre2, CORBA::Double Rayon2) { - INFOS ("CreateBoundaryConeR : BoundaryName = " << BoundaryName ) ; + MESSAGE ("CreateBoundaryConeR : BoundaryName = " << BoundaryName ) ; // SALOME::ExceptionStruct es; int error = 0 ; @@ -2042,7 +2046,7 @@ HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryTorus(const char* Bounda CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, CORBA::Double RayonRev, CORBA::Double RayonPri) { - INFOS ("CreateBoundaryTorus : BoundaryName = " << BoundaryName ) ; + MESSAGE ("CreateBoundaryTorus : BoundaryName = " << BoundaryName ) ; // SALOME::ExceptionStruct es; int error = 0 ; @@ -2098,7 +2102,7 @@ HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZoneBox(const char* ZoneName, CORBA::Double Ymini, CORBA::Double Ymaxi, CORBA::Double Zmini, CORBA::Double Zmaxi) { - INFOS ("CreateZoneBox : ZoneName = " << ZoneName ) ; + MESSAGE ("CreateZoneBox : ZoneName = " << ZoneName ) ; // SALOME::ExceptionStruct es; int error = 0 ; @@ -2127,7 +2131,7 @@ HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZoneBox(const char* ZoneName, HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZoneSphere(const char* ZoneName, CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, CORBA::Double Rayon) { - INFOS ("CreateZoneSphere : ZoneName = " << ZoneName ) ; + MESSAGE ("CreateZoneSphere : ZoneName = " << ZoneName ) ; // SALOME::ExceptionStruct es; int error = 0 ; @@ -2152,7 +2156,7 @@ HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZoneCylinder(const char* ZoneName, CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, CORBA::Double Rayon, CORBA::Double Haut) { - INFOS ("CreateZoneCylinder : ZoneName = " << ZoneName ) ; + MESSAGE ("CreateZoneCylinder : ZoneName = " << ZoneName ) ; // SALOME::ExceptionStruct es; int error = 0 ; @@ -2184,7 +2188,7 @@ HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZonePipe(const char* ZoneName, CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, CORBA::Double Rayon, CORBA::Double Haut, CORBA::Double Rayonint) { - INFOS ("CreateZonePipe : ZoneName = " << ZoneName ) ; + MESSAGE ("CreateZonePipe : ZoneName = " << ZoneName ) ; // SALOME::ExceptionStruct es; int error = 0 ; @@ -2219,7 +2223,7 @@ HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZoneBox2D(const char* ZoneName, CORBA::Double Vmini, CORBA::Double Vmaxi, CORBA::Long Orient) { - INFOS ("CreateZoneBox2D : ZoneName = " << ZoneName ) ; + MESSAGE ("CreateZoneBox2D : ZoneName = " << ZoneName ) ; // MESSAGE ("Umini = " << Umini << ", Umaxi =" << Umaxi ) ; // MESSAGE ("Vmini = " << Vmini << ", Vmaxi =" << Vmaxi ) ; // MESSAGE ("Orient = " << Orient ) ; @@ -2279,7 +2283,7 @@ HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZoneDisk(const char* ZoneName, CORBA::Double Rayon, CORBA::Long Orient) { - INFOS ("CreateZoneDisk : ZoneName = " << ZoneName ) ; + MESSAGE ("CreateZoneDisk : ZoneName = " << ZoneName ) ; // SALOME::ExceptionStruct es; int error = 0 ; @@ -2324,7 +2328,7 @@ HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZoneDiskWithHole(const char* ZoneNam CORBA::Double Rayon, CORBA::Double Rayonint, CORBA::Long Orient) { - INFOS ("CreateZoneDiskWithHole : ZoneName = " << ZoneName ) ; + MESSAGE ("CreateZoneDiskWithHole : ZoneName = " << ZoneName ) ; // SALOME::ExceptionStruct es; int error = 0 ; @@ -2375,7 +2379,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 +2466,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 +2492,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 +2507,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 +2527,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 +2589,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 +2617,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 +2626,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) ) + { + MESSAGE ( "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 +2688,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 +2801,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 +3121,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 +3187,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 +3289,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 +3301,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 +3335,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 +3400,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 +3420,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 +3493,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 ; @@ -3375,6 +3609,11 @@ SALOMEDS::SObject_ptr HOMARD_Gen_i::PublishBoundaryInStudy( SALOMEDS::StudyBuild std::string value ; switch (BoundaryType) { + case -1 : + { value = "BoundaryCAOHomard" ; + icone = "geometry.png" ; + break; + } case 0 : { value = "BoundaryDiHomard" ; icone = "mesh_tree_mesh.png" ; @@ -3755,8 +3994,9 @@ void HOMARD_Gen_i::PublishResultInSmesh(const char* NomFich, CORBA::Long Option) // On enregistre le fichier MESSAGE( "Enregistrement du fichier"); - SALOME_LifeCycleCORBA* myLCC = new SALOME_LifeCycleCORBA(_NS); - SMESH::SMESH_Gen_var aSmeshEngine = SMESH::SMESH_Gen::_narrow(myLCC->FindOrLoad_Component("FactoryServer","SMESH")); + // + SMESH::SMESH_Gen_var aSmeshEngine = this->retrieveSMESHInst(); + // ASSERT(!CORBA::is_nil(aSmeshEngine)); aSmeshEngine->UpdateStudy(); SMESH::DriverMED_ReadStatus theStatus; @@ -3932,15 +4172,15 @@ 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) { - INFOS ( "CreateYACSSchema : Schema YACS " << nomYACS ); - INFOS ( ". nomCas : " << nomCas); - INFOS ( ". ScriptFile : " << ScriptFile); - INFOS ( ". DirName : " << DirName); - INFOS ( ". MeshFile : " << MeshFile); + MESSAGE ( "CreateYACSSchema : Schema YACS " << nomYACS ); + MESSAGE ( ". nomCas : " << nomCas); + MESSAGE ( ". ScriptFile : " << ScriptFile); + MESSAGE ( ". DirName : " << DirName); + MESSAGE ( ". MeshFile : " << MeshFile); // A. Controle du nom : if ((myStudyContext._mesYACSs).find(nomYACS) != (myStudyContext._mesYACSs).end()) @@ -3989,7 +4229,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 ; @@ -4003,8 +4243,8 @@ 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 + MESSAGE ( "YACSWrite : Ecriture de " << nomYACS ); +// Le répertoire du cas HOMARD::HOMARD_YACS_var myYACS = myStudyContext._mesYACSs[nomYACS]; ASSERT(!CORBA::is_nil(myYACS)); // Le nom du fichier du schema @@ -4020,7 +4260,7 @@ CORBA::Long HOMARD_Gen_i::YACSWrite(const char* nomYACS) //============================================================================= CORBA::Long HOMARD_Gen_i::YACSWriteOnFile(const char* nomYACS, const char* XMLFile) { - INFOS ( "YACSWriteOnFile : Ecriture de " << nomYACS << " sur " << XMLFile ); + MESSAGE ( "YACSWriteOnFile : Ecriture de " << nomYACS << " sur " << XMLFile ); // A. Prealable int codret = 0; @@ -4094,7 +4334,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 else if ( mot_cle == "HOMARD_Exec_MeshName" ) { myDriver->Texte_HOMARD_Exec_MeshName(MeshName); - std::string node = "Boucle_de_convergence.Alternance_Calcul_HOMARD.Adaptation.p0_Adaptation_HOMARD.HOMARD_Initialisation.p1_Iter_1.CreateCase" ; + std::string node ; + if ( _LangueShort == "fr" ) { node = "Boucle_de_convergence.Alternance_Calcul_HOMARD" ; } + else { node = "Convergence_Loop.Alternation_Computation_HOMARD" ; } + node += ".Adaptation.p0_Adaptation_HOMARD.HOMARD_Initialisation.p1_Iter_1.CreateCase" ; myDriver->TexteParametre( node, "MeshName", "string", MeshName ) ; } // G.1.7. Execution de HOMARD : les options de l'hypothese @@ -4286,16 +4529,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 ); @@ -4325,7 +4573,7 @@ SALOMEDS::TMPFile* HOMARD_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent, // HOMARD data file name std::string aFileName = ""; if (isMultiFile) - aFileName = SALOMEDS_Tool::GetNameFromPath(Kernel_Utils::encode(SMESH_Gen_i::getStudyServant()->URL())); + aFileName = SALOMEDS_Tool::GetNameFromPath(Kernel_Utils::encode(myStudy->URL())); aFileName += "_HOMARD.dat"; // initialize sequence of file names @@ -4449,7 +4697,7 @@ CORBA::Boolean HOMARD_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, // HOMARD data file name std::string aFileName = ""; if (isMultiFile) - aFileName = SALOMEDS_Tool::GetNameFromPath(Kernel_Utils::encode(SMESH_Gen_i::getStudyServant()->URL())); + aFileName = SALOMEDS_Tool::GetNameFromPath(Kernel_Utils::encode(myStudy->URL())); aFileName = tmpDir + aFileName + "_HOMARD.dat"; StudyContext& context = myStudyContext; @@ -4711,7 +4959,7 @@ Engines::TMPFile* HOMARD_Gen_i::DumpPython(CORBA::Boolean isPublished, MESSAGE ("Entree dans DumpPython"); isValidScript=1; - SALOMEDS::SObject_var aSO = SMESH_Gen_i::getStudyServant()->FindComponent("HOMARD"); + SALOMEDS::SObject_var aSO = myStudy->FindComponent("HOMARD"); if(CORBA::is_nil(aSO)) return new Engines::TMPFile(0); @@ -4880,7 +5128,7 @@ Engines::TMPFile* HOMARD_Gen_i::DumpPython(CORBA::Boolean isPublished, void HOMARD_Gen_i::IsValidStudy( ) { // MESSAGE( "IsValidStudy" ); - if (CORBA::is_nil(SMESH_Gen_i::getStudyServant())) + if (CORBA::is_nil(myStudy)) { SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; @@ -4985,7 +5233,7 @@ void HOMARD_Gen_i::SetPreferences( ) File += "/bin/salome/VERSION" ; MESSAGE ( "File = "<getId(); - } -}