X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHOMARD_I%2FHOMARD_Gen_i.cxx;h=4eee809efb1abf8aef71c841fe0e2b3e8fb45792;hb=refs%2Ftags%2FV9_13_0b1;hp=3d9cb4cecf847f4d97ae8b19051c9538c9e8d4ae;hpb=4c1ea8876f3bda169e254ee8b130b07fd9dea4d8;p=modules%2Fhomard.git diff --git a/src/HOMARD_I/HOMARD_Gen_i.cxx b/src/HOMARD_I/HOMARD_Gen_i.cxx index 3d9cb4ce..4eee809e 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-2024 CEA, EDF // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -30,16 +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 CORBA_CLIENT_HEADER(SALOME_ModuleCatalog) -#include CORBA_CLIENT_HEADER(SMESH_Gen) +#include #include #include @@ -87,20 +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); - - CORBA::Object_var aStudyObject = _NS->Resolve( "/Study" ); - myStudy = SALOMEDS::Study::_narrow( aStudyObject ); + myHomard = new ::HOMARD_Gen; _tag_gene = 0 ; _tag_boun = 0 ; @@ -141,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()) { @@ -498,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 ; }; @@ -872,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(); @@ -1102,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 @@ -1219,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 ) { @@ -1237,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 ; @@ -1390,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) ; @@ -1440,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) ; @@ -1456,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; @@ -1480,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 // { @@ -1491,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 ) { @@ -1501,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; @@ -1524,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; @@ -1683,11 +1679,11 @@ 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 false; } + if (LesExtremes.size()!=10) { return 0; } aSeq->length(10) ; for (int i =0 ; i< LesExtremes.size() ; i++) aSeq[i]=LesExtremes[i] ; @@ -1745,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 : @@ -1789,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]; @@ -1844,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); @@ -1913,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); @@ -1928,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 ; @@ -1956,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 ; @@ -1980,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 ; @@ -2008,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 ; @@ -2041,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 ; @@ -2097,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 ; @@ -2126,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 ; @@ -2151,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 ; @@ -2183,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 ; @@ -2218,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 ) ; @@ -2278,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 ; @@ -2323,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 ; @@ -2374,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 @@ -2461,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 ); @@ -2487,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); @@ -2502,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 ) { @@ -2522,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); @@ -2612,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; @@ -2621,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 @@ -2669,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 ); @@ -2782,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 @@ -2895,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 : @@ -2961,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]; @@ -3063,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 ; } @@ -3078,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 @@ -3112,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++ ; @@ -3170,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++ ; @@ -3185,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 @@ -3235,7 +3470,7 @@ void HOMARD_Gen_i::DriverTexteFieldInterp(HOMARD::HOMARD_Iteration_var myIterati // Le type d'interpolation std::string TypeInterpstr = std::string((*ListField)[iaux+1]) ; MESSAGE( "... FieldName = " << FieldName << ", TypeInterp = " << TypeInterpstr ); - // On cherche à savoir si des instants ont été précisés pour cette itération + // On cherche ?? savoir si des instants ont ??t?? pr??cis??s pour cette it??ration int tsrvu = 0; for (int jaux = 0; jaux< numberOfFieldsx3; jaux++) { @@ -3374,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" ; @@ -3754,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; @@ -3931,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()) @@ -3988,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 ; @@ -4002,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 @@ -4019,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; @@ -4093,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 @@ -4285,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 ); @@ -4319,19 +4568,18 @@ SALOMEDS::TMPFile* HOMARD_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent, // get temporary directory name std::string tmpDir = isMultiFile ? std::string(theURL) : SALOMEDS_Tool::GetTmpDir(); - SALOMEDS::Study_var aStudy = theComponent->GetStudy(); StudyContext& context = myStudyContext; // HOMARD data file name std::string aFileName = ""; if (isMultiFile) - aFileName = SALOMEDS_Tool::GetNameFromPath(aStudy->URL()); + aFileName = SALOMEDS_Tool::GetNameFromPath(Kernel_Utils::encode(myStudy->URL())); aFileName += "_HOMARD.dat"; // initialize sequence of file names - SALOMEDS::ListOfFileNames_var aFileSeq = new SALOMEDS::ListOfFileNames; - aFileSeq->length(1); - aFileSeq[0] = CORBA::string_dup(aFileName.c_str()) ; + SALOMEDS_Tool::ListOfFiles aFileSeq; + aFileSeq.reserve(1); + aFileSeq.push_back(CORBA::string_dup(aFileName.c_str())) ; // get full path to the data file aFileName = tmpDir + aFileName; @@ -4406,11 +4654,11 @@ SALOMEDS::TMPFile* HOMARD_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent, // put temporary files to the stream MESSAGE ("put temporary files to the stream"); - aStreamFile = SALOMEDS_Tool::PutFilesToStream(tmpDir.c_str(), aFileSeq.in(), isMultiFile); + aStreamFile = SALOMEDS_Tool::PutFilesToStream(tmpDir.c_str(), aFileSeq, isMultiFile); // remove temporary files MESSAGE ("remove temporary files"); - if (!isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(tmpDir.c_str(), aFileSeq.in(), true); + if (!isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(tmpDir.c_str(), aFileSeq, true); // return data stream MESSAGE ("return data stream"); @@ -4434,7 +4682,6 @@ CORBA::Boolean HOMARD_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, CORBA::Boolean isMultiFile) { MESSAGE ("Load pour theURL = "<< theURL); - SALOMEDS::Study_var aStudy = theComponent->GetStudy(); // set current study if (myStudy->_is_nil()) @@ -4444,13 +4691,13 @@ CORBA::Boolean HOMARD_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, std::string tmpDir = isMultiFile ? std::string(theURL) : SALOMEDS_Tool::GetTmpDir(); // Convert the stream into sequence of files to process - SALOMEDS::ListOfFileNames_var aFileSeq = SALOMEDS_Tool::PutStreamToFiles(theStream, - tmpDir.c_str(), - isMultiFile); + SALOMEDS_Tool::ListOfFiles aFileSeq = SALOMEDS_Tool::PutStreamToFiles(theStream, + tmpDir.c_str(), + isMultiFile); // HOMARD data file name std::string aFileName = ""; if (isMultiFile) - aFileName = SALOMEDS_Tool::GetNameFromPath(aStudy->URL()); + aFileName = SALOMEDS_Tool::GetNameFromPath(Kernel_Utils::encode(myStudy->URL())); aFileName = tmpDir + aFileName + "_HOMARD.dat"; StudyContext& context = myStudyContext; @@ -4552,7 +4799,7 @@ CORBA::Boolean HOMARD_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, // Remove temporary files created from the stream if (!isMultiFile) - SALOMEDS_Tool::RemoveTemporaryFiles(tmpDir.c_str(), aFileSeq.in(), true); + SALOMEDS_Tool::RemoveTemporaryFiles(tmpDir.c_str(), aFileSeq, true); return true; }; @@ -4570,9 +4817,6 @@ CORBA::Boolean HOMARD_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent, //=========================================================================== void HOMARD_Gen_i::Close(SALOMEDS::SComponent_ptr theComponent) { - if (theComponent->GetStudy()) - // - nullify myStudy - myStudy = SALOMEDS::Study::_nil(); }; //=========================================================================== @@ -4708,18 +4952,14 @@ PortableServer::ServantBase_var HOMARD_Gen_i::GetServant(CORBA::Object_ptr theOb } //========================================================================== -Engines::TMPFile* HOMARD_Gen_i::DumpPython(CORBA::Object_ptr theStudy, - CORBA::Boolean isPublished, - CORBA::Boolean isMultiFile, - CORBA::Boolean& isValidScript) +Engines::TMPFile* HOMARD_Gen_i::DumpPython(CORBA::Boolean isPublished, + CORBA::Boolean isMultiFile, + CORBA::Boolean& isValidScript) { MESSAGE ("Entree dans DumpPython"); isValidScript=1; - SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(theStudy); - if(CORBA::is_nil(aStudy)) - return new Engines::TMPFile(0); - SALOMEDS::SObject_var aSO = aStudy->FindComponent("HOMARD"); + SALOMEDS::SObject_var aSO = myStudy->FindComponent("HOMARD"); if(CORBA::is_nil(aSO)) return new Engines::TMPFile(0); @@ -5014,7 +5254,7 @@ void HOMARD_Gen_i::SetPreferences( ) if ( ok ) { std::string PrefFile ; - PrefFile = getenv("HOME") ; + PrefFile = Kernel_Utils::HomePath() ; PrefFile += "/.config/salome/SalomeApprc." + salome_version ; MESSAGE ( "PrefFile = "<getId(); - } -}