From: Gérald NICOLAS Date: Tue, 26 May 2020 12:36:52 +0000 (+0200) Subject: Changements de noms HOMARD ==> ADAPT X-Git-Tag: V9_7_0a1~18^2~93 X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=commitdiff_plain;h=93ad4359b074e4a3743dc485affbd865163f71e1 Changements de noms HOMARD ==> ADAPT --- diff --git a/idl/ADAPT_Gen.idl b/idl/ADAPT_Gen.idl new file mode 100644 index 000000000..83114652e --- /dev/null +++ b/idl/ADAPT_Gen.idl @@ -0,0 +1,233 @@ +// 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 +// 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 __ADAPT_GEN__ +#define __ADAPT_GEN__ + +#include "SALOME_Component.idl" +#include "SALOME_Exception.idl" +#include "SALOMEDS.idl" + +#include "HOMARD_Cas.idl" +#include "HOMARD_Hypothesis.idl" +#include "HOMARD_Iteration.idl" +#include "HOMARD_Zone.idl" +#include "HOMARD_Boundary.idl" +#include "HOMARD_YACS.idl" + +module ADAPT +{ + typedef sequence listeHypotheses; + typedef sequence listeZones; + typedef sequence listeIterations; + typedef sequence listeCases; + typedef sequence listeBoundarys; + typedef sequence listeYACSs; + + interface ADAPT_Gen : Engines::EngineComponent, SALOMEDS::Driver + { +// +// A. Les methodes qui suivent sont celles que l'on retrouvera dans +// le fichier resources/HOMARDCatalog.xml.in pour definir le composant HOMARD dans YACS +// A priori, ce sont les seules sont l'utilisateur doit connaitre l'existence. +// ATTENTION : si les noms des arguments changent dans les Createxxxx, il faudra les changer +// dans YACSDriver pour assurer la coherence +// +// A.1. Les creations +// + HOMARD_Boundary CreateBoundaryCAO (in string BoundaryName, in string FileName) + raises(SALOME::SALOME_Exception); + HOMARD_Boundary CreateBoundaryDi (in string BoundaryName, in string MeshName, in string FileName) + raises(SALOME::SALOME_Exception); + HOMARD_Boundary CreateBoundaryCylinder (in string BoundaryName, + in double Xcentre, in double Ycentre, in double Zcentre, + in double Xaxis, in double Yaxis, in double Zaxis, + in double Radius) + raises (SALOME::SALOME_Exception); + HOMARD_Boundary CreateBoundarySphere (in string BoundaryName, + in double Xcentre, in double Ycentre, in double Zcentre, + in double Radius) + raises(SALOME::SALOME_Exception); + HOMARD_Boundary CreateBoundaryConeR (in string BoundaryName, + in double Xcentre1, in double Ycentre1, in double Zcentre1, in double Radius1, + in double Xcentre2, in double Ycentre2, in double Zcentre2, in double Radius2) + raises(SALOME::SALOME_Exception); + HOMARD_Boundary CreateBoundaryConeA (in string BoundaryName, + in double Xaxis, in double Yaxis, in double Zaxis, in double Angle, + in double Xcentre, in double Ycentre, in double Zcentre) + raises(SALOME::SALOME_Exception); + HOMARD_Boundary CreateBoundaryTorus (in string BoundaryName, + in double Xcentre, in double Ycentre, in double Zcentre, + in double Xaxis, in double Yaxis, in double Zaxis, + in double RadiusRev, in double RadiusPri) + raises (SALOME::SALOME_Exception); + HOMARD_Cas CreateCase(in string CaseName, in string MeshName, in string FileName ) + raises(SALOME::SALOME_Exception); + HOMARD_Cas CreateCaseFromIteration(in string CaseName, in string DirNameStart ) + raises(SALOME::SALOME_Exception); + HOMARD_Cas CreateCaseFromCaseLastIteration(in string CaseName, in string DirNameStart ) + raises(SALOME::SALOME_Exception); + HOMARD_Cas CreateCaseFromCaseIteration(in string CaseName, in string DirNameStart, in long Number ) + raises(SALOME::SALOME_Exception); + HOMARD_Hypothesis CreateHypothesis(in string HypoName ) + raises(SALOME::SALOME_Exception); + HOMARD_Zone CreateZoneBox (in string ZoneName, + in double Xmini, in double Xmaxi, + in double Ymini, in double Ymaxi, + in double Zmini, in double Zmaxi) + raises(SALOME::SALOME_Exception); + HOMARD_Zone CreateZoneBox2D (in string ZoneName, + in double Umini, in double Umaxi, + in double Vmini, in double Vmaxi, + in long Orient) + raises(SALOME::SALOME_Exception); + HOMARD_Zone CreateZoneCylinder (in string ZoneName, + in double Xcentre, in double Ycentre, in double Zcentre, + in double Xaxis, in double Yaxis, in double Zaxis, + in double Radius, in double Height) + raises(SALOME::SALOME_Exception); + HOMARD_Zone CreateZoneDisk (in string ZoneName, + in double Ucentre, in double Vcentre, + in double Radius, in long Orient) + raises(SALOME::SALOME_Exception); + HOMARD_Zone CreateZoneDiskWithHole (in string ZoneName, + in double Ucentre, in double Vcentre, + in double Radius, in double InternalRadius, + in long Orient) + raises(SALOME::SALOME_Exception); + HOMARD_Zone CreateZonePipe (in string ZoneName, + in double Xcentre, in double Ycentre, in double Zcentre, + in double Xaxis, in double Yaxis, in double Zaxis, + in double Radius, in double Height, in double InternalRadius) + raises(SALOME::SALOME_Exception); + HOMARD_Zone CreateZoneSphere (in string ZoneName, + in double Xcentre, in double Ycentre, in double Zcentre, + in double Radius) + raises(SALOME::SALOME_Exception); +// +// A.2. Les informations +// + HOMARD_Boundary GetBoundary(in string BoundaryName) raises (SALOME::SALOME_Exception); + HOMARD_Cas GetCase(in string CaseName) raises (SALOME::SALOME_Exception); + HOMARD_Hypothesis GetHypothesis(in string HypoName) raises (SALOME::SALOME_Exception); + HOMARD_Iteration GetIteration(in string IterName) raises (SALOME::SALOME_Exception); + HOMARD_YACS GetYACS(in string YACSName) raises (SALOME::SALOME_Exception); + HOMARD_Zone GetZone(in string ZoneName) raises (SALOME::SALOME_Exception); + + listeBoundarys GetAllBoundarysName() raises (SALOME::SALOME_Exception); + listeCases GetAllCasesName() raises (SALOME::SALOME_Exception); + listeHypotheses GetAllHypothesesName() raises (SALOME::SALOME_Exception); + listeIterations GetAllIterationsName() raises (SALOME::SALOME_Exception); + listeYACSs GetAllYACSsName() raises (SALOME::SALOME_Exception); + listeZones GetAllZonesName() raises (SALOME::SALOME_Exception); + + void MeshInfo(in string CaseName, in string MeshName, in string FileName, in string DirName, in long Qual, in long Diam, in long Conn, in long Tail, in long Inte ) + raises(SALOME::SALOME_Exception); + + HOMARD_Iteration LastIteration(in string CaseName) raises (SALOME::SALOME_Exception); +// +// A.3. L'etude +// + void UpdateStudy() raises (SALOME::SALOME_Exception); +// +// A.4. Les caracteristiques generales +// + void SetLanguageShort (in string LanguageShort) raises (SALOME::SALOME_Exception); + string GetLanguageShort () raises (SALOME::SALOME_Exception); +// +// B. Les methodes qui suivent n'apparaissent pas dans le composant HOMARD dans YACS +// L'utilisateur ne devrait pas les connaitre (ni s'en servir, a fortiori) +// + HOMARD_Iteration CreateIteration(in string IterName, in string PreviousIterName ) + raises(SALOME::SALOME_Exception); +// + void InvalideBoundary (in string BoundaryName) raises (SALOME::SALOME_Exception); + void InvalideHypo (in string HypoName) raises (SALOME::SALOME_Exception); + void InvalideIter (in string IterName) raises (SALOME::SALOME_Exception); + void InvalideIterOption (in string IterName, in long Option) + raises(SALOME::SALOME_Exception); + void InvalideYACS (in string YacsName) raises (SALOME::SALOME_Exception); + void InvalideZone (in string ZoneName) raises (SALOME::SALOME_Exception); + + long DeleteBoundary (in string BoundaryName) raises (SALOME::SALOME_Exception); + long DeleteCase(in string CaseName, in long Option) + raises(SALOME::SALOME_Exception); + long DeleteHypo(in string HypoName) raises (SALOME::SALOME_Exception); + long DeleteIteration(in string IterName, in long Option) + raises(SALOME::SALOME_Exception); + long DeleteIterationOption(in string IterName, in long Option1, in long Option2) + raises(SALOME::SALOME_Exception); + long DeleteYACS(in string YacsName, in long Option) raises (SALOME::SALOME_Exception); + long DeleteZone (in string ZoneName) raises (SALOME::SALOME_Exception); +// + void AssociateIterHypo(in string IterName, in string HypoName) + raises(SALOME::SALOME_Exception); + +// + void AssociateHypoZone(in string HypoName, in string ZoneName, in long TypeUse) + raises(SALOME::SALOME_Exception); + void DissociateHypoZone(in string HypoName, in string ZoneName) + raises(SALOME::SALOME_Exception); + + long Compute (in string IterName, in long CleanOption, in long modeHOMARD, in long Option1, in long Option2) + raises(SALOME::SALOME_Exception); + +// + string CreateDirNameIter(in string NomDir, in long option ) + raises(SALOME::SALOME_Exception); + + string VerifieDir (in string NomDir) raises (SALOME::SALOME_Exception); + +// + void PublishFileUnderIteration(in string IterName, in string FileName, in string Comment) + raises(SALOME::SALOME_Exception); + void PublishBoundaryUnderCase(in string CaseName, in string BoundaryName) + raises(SALOME::SALOME_Exception); + void PublishResultInSmesh(in string FileName, in long Option) + raises(SALOME::SALOME_Exception); + void PublishMeshIterInSmesh (in string IterName) raises(SALOME::SALOME_Exception); + +// + +// +// La creation des schemas YACS + HOMARD_YACS CreateYACSSchema(in string YACSName, in string CaseName, in string ScriptFile, in string DirName, in string MeshFile) + raises(SALOME::SALOME_Exception); + long YACSWrite (in string YACSName) raises (SALOME::SALOME_Exception); + long YACSWriteOnFile (in string YACSName, in string YACSFile) + raises(SALOME::SALOME_Exception); + +// +// Les preferences + void SetPublisMesh (in long PublisMeshIN, in long PublisMeshOUT) + raises (SALOME::SALOME_Exception); + long GetPublisMeshIN () raises (SALOME::SALOME_Exception); + long GetPublisMeshOUT () raises (SALOME::SALOME_Exception); + void SetYACSMaximum(in long YACSMaxIter, in long YACSMaxNode, in long YACSMaxElem) + raises (SALOME::SALOME_Exception); + long GetYACSMaxIter() raises (SALOME::SALOME_Exception); + long GetYACSMaxNode() raises (SALOME::SALOME_Exception); + long GetYACSMaxElem() raises (SALOME::SALOME_Exception); + void SetYACSConvergenceType(in long TypeTest) raises (SALOME::SALOME_Exception); + long GetYACSConvergenceType() raises (SALOME::SALOME_Exception); + }; +}; + +#endif + diff --git a/idl/CMakeLists.txt b/idl/CMakeLists.txt index e870d89af..7aabfb53b 100644 --- a/idl/CMakeLists.txt +++ b/idl/CMakeLists.txt @@ -38,7 +38,7 @@ SET(SalomeIDLSMESH_IDLSOURCES SMESH_Measurements.idl HOMARD_Boundary.idl HOMARD_Cas.idl - HOMARD_Gen.idl + ADAPT_Gen.idl HOMARD_Hypothesis.idl HOMARD_Iteration.idl HOMARD_YACS.idl diff --git a/idl/HOMARD_Gen.idl b/idl/HOMARD_Gen.idl deleted file mode 100644 index 797b3f8c4..000000000 --- a/idl/HOMARD_Gen.idl +++ /dev/null @@ -1,233 +0,0 @@ -// 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 -// 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 __HOMARD_GEN__ -#define __HOMARD_GEN__ - -#include "SALOME_Component.idl" -#include "SALOME_Exception.idl" -#include "SALOMEDS.idl" - -#include "HOMARD_Cas.idl" -#include "HOMARD_Hypothesis.idl" -#include "HOMARD_Iteration.idl" -#include "HOMARD_Zone.idl" -#include "HOMARD_Boundary.idl" -#include "HOMARD_YACS.idl" - -module ADAPT -{ - typedef sequence listeHypotheses; - typedef sequence listeZones; - typedef sequence listeIterations; - typedef sequence listeCases; - typedef sequence listeBoundarys; - typedef sequence listeYACSs; - - interface HOMARD_Gen : Engines::EngineComponent, SALOMEDS::Driver - { -// -// A. Les methodes qui suivent sont celles que l'on retrouvera dans -// le fichier resources/HOMARDCatalog.xml.in pour definir le composant HOMARD dans YACS -// A priori, ce sont les seules sont l'utilisateur doit connaitre l'existence. -// ATTENTION : si les noms des arguments changent dans les Createxxxx, il faudra les changer -// dans YACSDriver pour assurer la coherence -// -// A.1. Les creations -// - HOMARD_Boundary CreateBoundaryCAO (in string BoundaryName, in string FileName) - raises(SALOME::SALOME_Exception); - HOMARD_Boundary CreateBoundaryDi (in string BoundaryName, in string MeshName, in string FileName) - raises(SALOME::SALOME_Exception); - HOMARD_Boundary CreateBoundaryCylinder (in string BoundaryName, - in double Xcentre, in double Ycentre, in double Zcentre, - in double Xaxis, in double Yaxis, in double Zaxis, - in double Radius) - raises (SALOME::SALOME_Exception); - HOMARD_Boundary CreateBoundarySphere (in string BoundaryName, - in double Xcentre, in double Ycentre, in double Zcentre, - in double Radius) - raises(SALOME::SALOME_Exception); - HOMARD_Boundary CreateBoundaryConeR (in string BoundaryName, - in double Xcentre1, in double Ycentre1, in double Zcentre1, in double Radius1, - in double Xcentre2, in double Ycentre2, in double Zcentre2, in double Radius2) - raises(SALOME::SALOME_Exception); - HOMARD_Boundary CreateBoundaryConeA (in string BoundaryName, - in double Xaxis, in double Yaxis, in double Zaxis, in double Angle, - in double Xcentre, in double Ycentre, in double Zcentre) - raises(SALOME::SALOME_Exception); - HOMARD_Boundary CreateBoundaryTorus (in string BoundaryName, - in double Xcentre, in double Ycentre, in double Zcentre, - in double Xaxis, in double Yaxis, in double Zaxis, - in double RadiusRev, in double RadiusPri) - raises (SALOME::SALOME_Exception); - HOMARD_Cas CreateCase(in string CaseName, in string MeshName, in string FileName ) - raises(SALOME::SALOME_Exception); - HOMARD_Cas CreateCaseFromIteration(in string CaseName, in string DirNameStart ) - raises(SALOME::SALOME_Exception); - HOMARD_Cas CreateCaseFromCaseLastIteration(in string CaseName, in string DirNameStart ) - raises(SALOME::SALOME_Exception); - HOMARD_Cas CreateCaseFromCaseIteration(in string CaseName, in string DirNameStart, in long Number ) - raises(SALOME::SALOME_Exception); - HOMARD_Hypothesis CreateHypothesis(in string HypoName ) - raises(SALOME::SALOME_Exception); - HOMARD_Zone CreateZoneBox (in string ZoneName, - in double Xmini, in double Xmaxi, - in double Ymini, in double Ymaxi, - in double Zmini, in double Zmaxi) - raises(SALOME::SALOME_Exception); - HOMARD_Zone CreateZoneBox2D (in string ZoneName, - in double Umini, in double Umaxi, - in double Vmini, in double Vmaxi, - in long Orient) - raises(SALOME::SALOME_Exception); - HOMARD_Zone CreateZoneCylinder (in string ZoneName, - in double Xcentre, in double Ycentre, in double Zcentre, - in double Xaxis, in double Yaxis, in double Zaxis, - in double Radius, in double Height) - raises(SALOME::SALOME_Exception); - HOMARD_Zone CreateZoneDisk (in string ZoneName, - in double Ucentre, in double Vcentre, - in double Radius, in long Orient) - raises(SALOME::SALOME_Exception); - HOMARD_Zone CreateZoneDiskWithHole (in string ZoneName, - in double Ucentre, in double Vcentre, - in double Radius, in double InternalRadius, - in long Orient) - raises(SALOME::SALOME_Exception); - HOMARD_Zone CreateZonePipe (in string ZoneName, - in double Xcentre, in double Ycentre, in double Zcentre, - in double Xaxis, in double Yaxis, in double Zaxis, - in double Radius, in double Height, in double InternalRadius) - raises(SALOME::SALOME_Exception); - HOMARD_Zone CreateZoneSphere (in string ZoneName, - in double Xcentre, in double Ycentre, in double Zcentre, - in double Radius) - raises(SALOME::SALOME_Exception); -// -// A.2. Les informations -// - HOMARD_Boundary GetBoundary(in string BoundaryName) raises (SALOME::SALOME_Exception); - HOMARD_Cas GetCase(in string CaseName) raises (SALOME::SALOME_Exception); - HOMARD_Hypothesis GetHypothesis(in string HypoName) raises (SALOME::SALOME_Exception); - HOMARD_Iteration GetIteration(in string IterName) raises (SALOME::SALOME_Exception); - HOMARD_YACS GetYACS(in string YACSName) raises (SALOME::SALOME_Exception); - HOMARD_Zone GetZone(in string ZoneName) raises (SALOME::SALOME_Exception); - - listeBoundarys GetAllBoundarysName() raises (SALOME::SALOME_Exception); - listeCases GetAllCasesName() raises (SALOME::SALOME_Exception); - listeHypotheses GetAllHypothesesName() raises (SALOME::SALOME_Exception); - listeIterations GetAllIterationsName() raises (SALOME::SALOME_Exception); - listeYACSs GetAllYACSsName() raises (SALOME::SALOME_Exception); - listeZones GetAllZonesName() raises (SALOME::SALOME_Exception); - - void MeshInfo(in string CaseName, in string MeshName, in string FileName, in string DirName, in long Qual, in long Diam, in long Conn, in long Tail, in long Inte ) - raises(SALOME::SALOME_Exception); - - HOMARD_Iteration LastIteration(in string CaseName) raises (SALOME::SALOME_Exception); -// -// A.3. L'etude -// - void UpdateStudy() raises (SALOME::SALOME_Exception); -// -// A.4. Les caracteristiques generales -// - void SetLanguageShort (in string LanguageShort) raises (SALOME::SALOME_Exception); - string GetLanguageShort () raises (SALOME::SALOME_Exception); -// -// B. Les methodes qui suivent n'apparaissent pas dans le composant HOMARD dans YACS -// L'utilisateur ne devrait pas les connaitre (ni s'en servir, a fortiori) -// - HOMARD_Iteration CreateIteration(in string IterName, in string PreviousIterName ) - raises(SALOME::SALOME_Exception); -// - void InvalideBoundary (in string BoundaryName) raises (SALOME::SALOME_Exception); - void InvalideHypo (in string HypoName) raises (SALOME::SALOME_Exception); - void InvalideIter (in string IterName) raises (SALOME::SALOME_Exception); - void InvalideIterOption (in string IterName, in long Option) - raises(SALOME::SALOME_Exception); - void InvalideYACS (in string YacsName) raises (SALOME::SALOME_Exception); - void InvalideZone (in string ZoneName) raises (SALOME::SALOME_Exception); - - long DeleteBoundary (in string BoundaryName) raises (SALOME::SALOME_Exception); - long DeleteCase(in string CaseName, in long Option) - raises(SALOME::SALOME_Exception); - long DeleteHypo(in string HypoName) raises (SALOME::SALOME_Exception); - long DeleteIteration(in string IterName, in long Option) - raises(SALOME::SALOME_Exception); - long DeleteIterationOption(in string IterName, in long Option1, in long Option2) - raises(SALOME::SALOME_Exception); - long DeleteYACS(in string YacsName, in long Option) raises (SALOME::SALOME_Exception); - long DeleteZone (in string ZoneName) raises (SALOME::SALOME_Exception); -// - void AssociateIterHypo(in string IterName, in string HypoName) - raises(SALOME::SALOME_Exception); - -// - void AssociateHypoZone(in string HypoName, in string ZoneName, in long TypeUse) - raises(SALOME::SALOME_Exception); - void DissociateHypoZone(in string HypoName, in string ZoneName) - raises(SALOME::SALOME_Exception); - - long Compute (in string IterName, in long CleanOption, in long modeHOMARD, in long Option1, in long Option2) - raises(SALOME::SALOME_Exception); - -// - string CreateDirNameIter(in string NomDir, in long option ) - raises(SALOME::SALOME_Exception); - - string VerifieDir (in string NomDir) raises (SALOME::SALOME_Exception); - -// - void PublishFileUnderIteration(in string IterName, in string FileName, in string Comment) - raises(SALOME::SALOME_Exception); - void PublishBoundaryUnderCase(in string CaseName, in string BoundaryName) - raises(SALOME::SALOME_Exception); - void PublishResultInSmesh(in string FileName, in long Option) - raises(SALOME::SALOME_Exception); - void PublishMeshIterInSmesh (in string IterName) raises(SALOME::SALOME_Exception); - -// - -// -// La creation des schemas YACS - HOMARD_YACS CreateYACSSchema(in string YACSName, in string CaseName, in string ScriptFile, in string DirName, in string MeshFile) - raises(SALOME::SALOME_Exception); - long YACSWrite (in string YACSName) raises (SALOME::SALOME_Exception); - long YACSWriteOnFile (in string YACSName, in string YACSFile) - raises(SALOME::SALOME_Exception); - -// -// Les preferences - void SetPublisMesh (in long PublisMeshIN, in long PublisMeshOUT) - raises (SALOME::SALOME_Exception); - long GetPublisMeshIN () raises (SALOME::SALOME_Exception); - long GetPublisMeshOUT () raises (SALOME::SALOME_Exception); - void SetYACSMaximum(in long YACSMaxIter, in long YACSMaxNode, in long YACSMaxElem) - raises (SALOME::SALOME_Exception); - long GetYACSMaxIter() raises (SALOME::SALOME_Exception); - long GetYACSMaxNode() raises (SALOME::SALOME_Exception); - long GetYACSMaxElem() raises (SALOME::SALOME_Exception); - void SetYACSConvergenceType(in long TypeTest) raises (SALOME::SALOME_Exception); - long GetYACSConvergenceType() raises (SALOME::SALOME_Exception); - }; -}; - -#endif - diff --git a/src/ADAPT/ADAPT_Gen.cxx b/src/ADAPT/ADAPT_Gen.cxx new file mode 100644 index 000000000..94e762ed5 --- /dev/null +++ b/src/ADAPT/ADAPT_Gen.cxx @@ -0,0 +1,41 @@ +// HOMARD HOMARD : implementation of HOMARD idl descriptions +// +// 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 +// 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 +// +// File : ADAPT_Gen.cxx +// Author : Gerald NICOLAS, EDF +// Module : HOMARD + +#include "ADAPT_Gen.hxx" +#include "utilities.h" + +//============================================================================= +//============================================================================= +ADAPT_Gen::ADAPT_Gen() +{ + MESSAGE("ADAPT_Gen"); +} + +//============================================================================= +//============================================================================= +ADAPT_Gen::~ADAPT_Gen() +{ + MESSAGE("~ADAPT_Gen"); +} +//============================================================================= diff --git a/src/ADAPT/ADAPT_Gen.hxx b/src/ADAPT/ADAPT_Gen.hxx new file mode 100644 index 000000000..7a7d05098 --- /dev/null +++ b/src/ADAPT/ADAPT_Gen.hxx @@ -0,0 +1,37 @@ +// HOMARD HOMARD : implementation of HOMARD idl descriptions +// +// 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 +// 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 +// +// File : ADAPT_Gen.hxx +// Author : Gerald NICOLAS, EDF +// Module : HOMARD + +#ifndef _ADAPT_GEN_HXX_ +#define _ADAPT_GEN_HXX_ + +#include "HOMARD.hxx" + +class HOMARDIMPL_EXPORT ADAPT_Gen +{ +public : + ADAPT_Gen(); + ~ADAPT_Gen(); +}; + +#endif diff --git a/src/ADAPT/CMakeLists.txt b/src/ADAPT/CMakeLists.txt index bc90a1aa0..728d7203d 100644 --- a/src/ADAPT/CMakeLists.txt +++ b/src/ADAPT/CMakeLists.txt @@ -43,7 +43,7 @@ SET(ADAPTImpl_HEADERS HOMARD_Hypothesis.hxx HOMARD_Iteration.hxx HOMARD_Zone.hxx - HOMARD_Gen.hxx + ADAPT_Gen.hxx HOMARD_DriverTools.hxx HOMARD_YACS.hxx HomardDriver.hxx @@ -59,7 +59,7 @@ SET(ADAPTImpl_SOURCES HOMARD_Hypothesis.cxx HOMARD_Iteration.cxx HOMARD_Zone.cxx - HOMARD_Gen.cxx + ADAPT_Gen.cxx HOMARD_DriverTools.cxx HOMARD_YACS.cxx HomardDriver.cxx diff --git a/src/ADAPT/HOMARD_DriverTools.cxx b/src/ADAPT/HOMARD_DriverTools.cxx index df7c5e6b2..74ec51209 100644 --- a/src/ADAPT/HOMARD_DriverTools.cxx +++ b/src/ADAPT/HOMARD_DriverTools.cxx @@ -32,7 +32,7 @@ #include #include "utilities.h" -namespace HOMARD +namespace ADAPT { std::string SEPARATOR = "|" ; @@ -837,4 +837,4 @@ namespace HOMARD return true; } -} // namespace HOMARD /end/ +} // namespace ADAPT /end/ diff --git a/src/ADAPT/HOMARD_DriverTools.hxx b/src/ADAPT/HOMARD_DriverTools.hxx index 887d5f35b..e7aff54f8 100644 --- a/src/ADAPT/HOMARD_DriverTools.hxx +++ b/src/ADAPT/HOMARD_DriverTools.hxx @@ -35,7 +35,7 @@ class HOMARD_Hypothesis; class HOMARD_Zone; class HOMARD_YACS; -namespace HOMARD +namespace ADAPT { //! persistence entity type typedef enum { Case, Zone, Hypothesis, Iteration, Boundary, YACS } SignatureType; diff --git a/src/ADAPT/HOMARD_Gen.cxx b/src/ADAPT/HOMARD_Gen.cxx deleted file mode 100644 index a9059a6ad..000000000 --- a/src/ADAPT/HOMARD_Gen.cxx +++ /dev/null @@ -1,41 +0,0 @@ -// HOMARD HOMARD : implementation of HOMARD idl descriptions -// -// 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 -// 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 -// -// File : HOMARD_Gen.cxx -// Author : Gerald NICOLAS, EDF -// Module : HOMARD - -#include "HOMARD_Gen.hxx" -#include "utilities.h" - -//============================================================================= -//============================================================================= -HOMARD_Gen::HOMARD_Gen() -{ - MESSAGE("HOMARD_Gen"); -} - -//============================================================================= -//============================================================================= -HOMARD_Gen::~HOMARD_Gen() -{ - MESSAGE("~HOMARD_Gen"); -} -//============================================================================= diff --git a/src/ADAPT/HOMARD_Gen.hxx b/src/ADAPT/HOMARD_Gen.hxx deleted file mode 100644 index 3ff864a14..000000000 --- a/src/ADAPT/HOMARD_Gen.hxx +++ /dev/null @@ -1,37 +0,0 @@ -// HOMARD HOMARD : implementation of HOMARD idl descriptions -// -// 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 -// 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 -// -// File : HOMARD_Gen.hxx -// Author : Gerald NICOLAS, EDF -// Module : HOMARD - -#ifndef _HOMARD_GEN_HXX_ -#define _HOMARD_GEN_HXX_ - -#include "HOMARD.hxx" - -class HOMARDIMPL_EXPORT HOMARD_Gen -{ -public : - HOMARD_Gen(); - ~HOMARD_Gen(); -}; - -#endif diff --git a/src/ADAPT/YACSDriver.cxx b/src/ADAPT/YACSDriver.cxx index 27910535d..864803db8 100644 --- a/src/ADAPT/YACSDriver.cxx +++ b/src/ADAPT/YACSDriver.cxx @@ -144,7 +144,7 @@ std::string YACSDriver::Texte_Iter_1_Zone( int ZoneType, const std::string pytho _Texte += Texte_inport( "string", "ZoneName" ) ; TexteParametre( node, "ZoneName", "string", ZoneName ) ; // 4.2. Les valeurs numeriques -// ATTENTION : les noms doivent etre les memes que dans Gen.xml, donc HOMARD_Gen.idl +// ATTENTION : les noms doivent etre les memes que dans Gen.xml, donc ADAPT_Gen.idl // 4.2.1. Decodage des valeurs // La chaine pythonStructure est de ce genre : // CreateZoneBox( "Zone_1", 0.144, 0.216, 0.096, 0.1464, 0.076, 0.12) @@ -312,7 +312,7 @@ std::string YACSDriver::Texte_Iter_1_Boundary( int BoundaryType, const std::stri _Texte += " " + motcle + ".UpdateStudy\n" ; _Texte += " " + methode + "\n" ; // 4. Les inports -// ATTENTION : les noms doivent etre les memes que dans Gen.xml, donc HOMARD_Gen.idl +// ATTENTION : les noms doivent etre les memes que dans Gen.xml, donc ADAPT_Gen.idl // 4.1. Le nom de la frontiere _Texte += Texte_inport( "string", "BoundaryName" ) ; TexteParametre( node, "BoundaryName", "string", BoundaryName ) ; @@ -658,7 +658,7 @@ void YACSDriver::CreeFichier( ) // } //=============================================================================== -// REMARQUE : on devrait utiliser le GetStringInTexte de HOMARD_Gen_i mais je ne sais pas +// REMARQUE : on devrait utiliser le GetStringInTexte de ADAPT_Gen_i mais je ne sais pas // comment l'appeler. ALors je clone. // Recuperation de la chaine de caracteres par rapport l'apparition d'un texte // ligne : la ligne a manipuler diff --git a/src/ADAPTGUI/ADAPTGUI.cxx b/src/ADAPTGUI/ADAPTGUI.cxx index 5b5fae290..ed8cf6b51 100644 --- a/src/ADAPTGUI/ADAPTGUI.cxx +++ b/src/ADAPTGUI/ADAPTGUI.cxx @@ -103,10 +103,10 @@ ADAPTGUI::~ADAPTGUI() // function : InitHOMARDGen // launch HOMARD component and return a handle //======================================================================= -HOMARD::HOMARD_Gen_var ADAPTGUI::InitHOMARDGen(SalomeApp_Application* app) +ADAPT::ADAPT_Gen_var ADAPTGUI::InitHOMARDGen(SalomeApp_Application* app) { Engines::EngineComponent_var comp = app->lcc()->FindOrLoad_Component( "FactoryServer","HOMARD" ); - HOMARD::HOMARD_Gen_var clr = HOMARD::HOMARD_Gen::_narrow(comp); + ADAPT::ADAPT_Gen_var clr = ADAPT::ADAPT_Gen::_narrow(comp); ASSERT(!CORBA::is_nil(clr)); return clr; } @@ -261,10 +261,10 @@ void ADAPTGUI::createMenus() //================================================ // function : recupPreferences -// Pour chaque valeur, le defaut est la valeur definie dans HOMARD_Gen -// . Si la recuperation dans config/salome s'est bien passee a la creation de HOMARD_Gen, +// Pour chaque valeur, le defaut est la valeur definie dans ADAPT_Gen +// . Si la recuperation dans config/salome s'est bien passee a la creation de ADAPT_Gen, // ces valeurs sont les valeurs definies. -// . Si cela ne s'est pas bien passe, ce sont les valeurs par defaut de HOMARD_Gen +// . Si cela ne s'est pas bien passe, ce sont les valeurs par defaut de ADAPT_Gen //================================================ void ADAPTGUI::recupPreferences() { @@ -273,7 +273,7 @@ void ADAPTGUI::recupPreferences() // A. Declarations // SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( application() ); - HOMARD::HOMARD_Gen_var homardGen = ADAPTGUI::InitHOMARDGen(app); + ADAPT::ADAPT_Gen_var homardGen = ADAPTGUI::InitHOMARDGen(app); int defaut_i ; std::string defaut_s ; QString QString_v ; @@ -370,7 +370,7 @@ bool ADAPTGUI::OnGUIEvent (int theCommandID) SUIT_Desktop* parent = application()->desktop(); - HOMARD::HOMARD_Gen_var homardGen = ADAPTGUI::InitHOMARDGen(app); + ADAPT::ADAPT_Gen_var homardGen = ADAPTGUI::InitHOMARDGen(app); if (!CORBA::is_nil(homardGen)) homardGen->UpdateStudy(); @@ -385,7 +385,7 @@ bool ADAPTGUI::OnGUIEvent (int theCommandID) { MESSAGE("command " << theCommandID << " activated"); MonCreateCase *aDlg = new MonCreateCase( true, - HOMARD::HOMARD_Gen::_duplicate(homardGen) ) ; + ADAPT::ADAPT_Gen::_duplicate(homardGen) ) ; aDlg->show(); break; } @@ -394,7 +394,7 @@ bool ADAPTGUI::OnGUIEvent (int theCommandID) { MESSAGE("command " << theCommandID << " activated"); MonPursueIteration *aDlg = new MonPursueIteration( true, - HOMARD::HOMARD_Gen::_duplicate(homardGen) ) ; + ADAPT::ADAPT_Gen::_duplicate(homardGen) ) ; aDlg->show(); break; } @@ -403,7 +403,7 @@ bool ADAPTGUI::OnGUIEvent (int theCommandID) { MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() ); MonCreateIteration *IterDlg = new MonCreateIteration( parent, true, - HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ; + ADAPT::ADAPT_Gen::_duplicate(homardGen), _ObjectName ) ; IterDlg->show(); break; } @@ -439,7 +439,7 @@ bool ADAPTGUI::OnGUIEvent (int theCommandID) case 1121: // Information sur le maillage de l'iteration { MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() ); - MonIterInfo *IterDlg = new MonIterInfo( parent, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ; + MonIterInfo *IterDlg = new MonIterInfo( parent, true, ADAPT::ADAPT_Gen::_duplicate(homardGen), _ObjectName ) ; IterDlg->show(); break; } @@ -469,50 +469,50 @@ bool ADAPTGUI::OnGUIEvent (int theCommandID) // Edition d'une frontiere CAO if (HOMARD_UTILS::isBoundaryCAO(obj)) { - MonEditBoundaryCAO *aDlg = new MonEditBoundaryCAO(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ; + MonEditBoundaryCAO *aDlg = new MonEditBoundaryCAO(0, true, ADAPT::ADAPT_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ; aDlg->show(); } // Edition d'une frontiere discrete else if (HOMARD_UTILS::isBoundaryDi(obj)) { - MonEditBoundaryDi *aDlg = new MonEditBoundaryDi(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ; + MonEditBoundaryDi *aDlg = new MonEditBoundaryDi(0, true, ADAPT::ADAPT_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ; aDlg->show(); } // Edition d'une frontiere analytique else if (HOMARD_UTILS::isBoundaryAn(obj)) { - MonEditBoundaryAn *aDlg = new MonEditBoundaryAn(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ; + MonEditBoundaryAn *aDlg = new MonEditBoundaryAn(0, true, ADAPT::ADAPT_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ; aDlg->show(); } // Edition d'un cas else if (HOMARD_UTILS::isCase(obj)) { - MonEditCase *aDlg = new MonEditCase(true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ; + MonEditCase *aDlg = new MonEditCase(true, ADAPT::ADAPT_Gen::_duplicate(homardGen), _ObjectName ) ; aDlg->show(); } // Edition d'une hypothese else if (HOMARD_UTILS::isHypo(obj)) { - MonEditHypothesis *aDlg = new MonEditHypothesis(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName, QString(""), QString("")) ; + MonEditHypothesis *aDlg = new MonEditHypothesis(0, true, ADAPT::ADAPT_Gen::_duplicate(homardGen), _ObjectName, QString(""), QString("")) ; aDlg->show(); } // Edition d'une iteration else if (HOMARD_UTILS::isIter(obj)) { - MonEditIteration *aDlg = new MonEditIteration(parent, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ; + MonEditIteration *aDlg = new MonEditIteration(parent, true, ADAPT::ADAPT_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ; aDlg->show(); } // Edition d'un schema YACS else if (HOMARD_UTILS::isYACS(obj)) { MESSAGE("appel de MonEditYACS"); - MonEditYACS *aDlg = new MonEditYACS(true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName) ; + MonEditYACS *aDlg = new MonEditYACS(true, ADAPT::ADAPT_Gen::_duplicate(homardGen), _ObjectName) ; aDlg->show(); } // Edition d'une zone else if (HOMARD_UTILS::isZone(obj)) { - MonEditZone *aDlg = new MonEditZone(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ; + MonEditZone *aDlg = new MonEditZone(0, true, ADAPT::ADAPT_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ; aDlg->show(); } } @@ -613,7 +613,7 @@ bool ADAPTGUI::OnGUIEvent (int theCommandID) { MESSAGE("etape 1301") MESSAGE("command " << theCommandID << " activated"); - MonMeshInfo *aDlg = new MonMeshInfo( parent, true, HOMARD::HOMARD_Gen::_duplicate(homardGen) ) ; + MonMeshInfo *aDlg = new MonMeshInfo( parent, true, ADAPT::ADAPT_Gen::_duplicate(homardGen) ) ; aDlg->show(); break; } @@ -624,7 +624,7 @@ bool ADAPTGUI::OnGUIEvent (int theCommandID) _PTR(SObject) obj = chercheMonObjet(); if ( (obj) && ( HOMARD_UTILS::isFileType(obj,QString("log")) || HOMARD_UTILS::isFileType(obj,QString("Summary")) || HOMARD_UTILS::isFileType(obj,QString("xml")) ) ) { - MonEditFile *aDlg = new MonEditFile( 0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName, 0 ) ; + MonEditFile *aDlg = new MonEditFile( 0, true, ADAPT::ADAPT_Gen::_duplicate(homardGen), _ObjectName, 0 ) ; if ( aDlg->_codret == 0 ) { aDlg->show(); } } break; @@ -634,7 +634,7 @@ bool ADAPTGUI::OnGUIEvent (int theCommandID) { MESSAGE("etape 1401") MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() ); - MonCreateYACS *aDlg = new MonCreateYACS( true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ; + MonCreateYACS *aDlg = new MonCreateYACS( true, ADAPT::ADAPT_Gen::_duplicate(homardGen), _ObjectName ) ; aDlg->show(); break; } diff --git a/src/ADAPTGUI/ADAPTGUI.h b/src/ADAPTGUI/ADAPTGUI.h index d86a72991..82b71aa79 100644 --- a/src/ADAPTGUI/ADAPTGUI.h +++ b/src/ADAPTGUI/ADAPTGUI.h @@ -30,7 +30,7 @@ #include #include -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include CORBA_CLIENT_HEADER(HOMARD_Cas) #include CORBA_CLIENT_HEADER(HOMARD_Hypothesis) @@ -53,7 +53,7 @@ public: QString engineIOR() const; void windows( QMap& ) const; - static HOMARD::HOMARD_Gen_var InitHOMARDGen(SalomeApp_Application* ); + static ADAPT::ADAPT_Gen_var InitHOMARDGen(SalomeApp_Application* ); public slots: @@ -89,7 +89,7 @@ private: _PTR(SObject) chercheMonObjet(); virtual void createPreferences(); - HOMARD::HOMARD_Gen_var myComponentHomard; + ADAPT::ADAPT_Gen_var myComponentHomard; int anId; QString _ObjectName; diff --git a/src/ADAPTGUI/HOMARDGUI_Utils.cxx b/src/ADAPTGUI/HOMARDGUI_Utils.cxx index 562546eec..5358c5c32 100644 --- a/src/ADAPTGUI/HOMARDGUI_Utils.cxx +++ b/src/ADAPTGUI/HOMARDGUI_Utils.cxx @@ -90,7 +90,7 @@ void HOMARD_UTILS::updateObjBrowser() appMod->updateObjBrowser( true ); } else - MESSAGE( "--- HOMARD::updateObjBrowser: appMod = NULL"); + MESSAGE( "--- ADAPT::updateObjBrowser: appMod = NULL"); } } diff --git a/src/ADAPTGUI/HOMARDGUI_Utils.h b/src/ADAPTGUI/HOMARDGUI_Utils.h index d257dbb6f..a2f24a6e2 100644 --- a/src/ADAPTGUI/HOMARDGUI_Utils.h +++ b/src/ADAPTGUI/HOMARDGUI_Utils.h @@ -26,7 +26,7 @@ #include #include CORBA_CLIENT_HEADER(HOMARD_Cas) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include "SALOMEDSClient_definitions.hxx" #include "SALOME_InteractiveObject.hxx" diff --git a/src/ADAPTGUI/HomardQtCommun.h b/src/ADAPTGUI/HomardQtCommun.h index 4587833e2..32f32deff 100644 --- a/src/ADAPTGUI/HomardQtCommun.h +++ b/src/ADAPTGUI/HomardQtCommun.h @@ -29,7 +29,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include CORBA_CLIENT_HEADER(HOMARD_Cas) #include diff --git a/src/ADAPTGUI/MonCreateBoundaryAn.cxx b/src/ADAPTGUI/MonCreateBoundaryAn.cxx index 40fa47f4b..a9a4880ee 100644 --- a/src/ADAPTGUI/MonCreateBoundaryAn.cxx +++ b/src/ADAPTGUI/MonCreateBoundaryAn.cxx @@ -41,7 +41,7 @@ using namespace std; // ------------------------------------------------------------------------------------------------------------------------ MonCreateBoundaryAn::MonCreateBoundaryAn(MonCreateCase* parent, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen0, + ADAPT::ADAPT_Gen_var myHomardGen0, QString caseName) : // ------------------------------------------------------------------------------------------------------------------------------ /* Constructs a MonCreateBoundaryAn @@ -67,7 +67,7 @@ MonCreateBoundaryAn::MonCreateBoundaryAn(MonCreateCase* parent, bool modal, Chgt (false) { MESSAGE("Constructeur") ; - myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + myHomardGen=ADAPT::ADAPT_Gen::_duplicate(myHomardGen0); setupUi(this); setModal(modal); @@ -103,7 +103,7 @@ MonCreateBoundaryAn::MonCreateBoundaryAn(MonCreateCase* parent, bool modal, } // -------------------------------------------------------------------------------------------------------------- MonCreateBoundaryAn::MonCreateBoundaryAn(MonCreateCase* parent, - HOMARD::HOMARD_Gen_var myHomardGen0, + ADAPT::ADAPT_Gen_var myHomardGen0, QString caseName): // -------------------------------------------------------------------------------------------------------------- // @@ -172,8 +172,8 @@ void MonCreateBoundaryAn::InitValBoundaryAn() // if (_aCaseName == QString("")) { return; } - HOMARD::HOMARD_Cas_var aCas = myHomardGen->GetCase(_aCaseName.toStdString().c_str()); - HOMARD::extrema_var MesExtremes = aCas->GetBoundingBox(); + ADAPT::HOMARD_Cas_var aCas = myHomardGen->GetCase(_aCaseName.toStdString().c_str()); + ADAPT::extrema_var MesExtremes = aCas->GetBoundingBox(); int num = MesExtremes->length() ; ASSERT(num == 10); _Xmin=MesExtremes[0]; _Xmax=MesExtremes[1]; _Xincr=MesExtremes[2]; @@ -521,7 +521,7 @@ void MonCreateBoundaryAn::SetNewName() { // Recherche d'un nom par defaut qui n'existe pas encore - HOMARD::listeBoundarys_var MyObjects = myHomardGen->GetAllBoundarysName(); + ADAPT::listeBoundarys_var MyObjects = myHomardGen->GetAllBoundarysName(); int num = 0; QString aName=""; while (aName=="" ) { diff --git a/src/ADAPTGUI/MonCreateBoundaryAn.h b/src/ADAPTGUI/MonCreateBoundaryAn.h index 46c838ac9..2576d14fd 100644 --- a/src/ADAPTGUI/MonCreateBoundaryAn.h +++ b/src/ADAPTGUI/MonCreateBoundaryAn.h @@ -26,7 +26,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include CORBA_CLIENT_HEADER(HOMARD_Boundary) #include "ui_CreateBoundaryAn.h" @@ -39,13 +39,13 @@ class HOMARD_EXPORT MonCreateBoundaryAn : public QDialog, public Ui_CreateBounda public: MonCreateBoundaryAn( MonCreateCase* parent, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString caseName); virtual ~MonCreateBoundaryAn(); protected : MonCreateBoundaryAn( MonCreateCase* parent, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString caseName); MonCreateCase * _parent; @@ -70,8 +70,8 @@ protected : bool Chgt; - HOMARD::HOMARD_Boundary_var aBoundaryAn ; - HOMARD::HOMARD_Gen_var myHomardGen; + ADAPT::HOMARD_Boundary_var aBoundaryAn ; + ADAPT::ADAPT_Gen_var myHomardGen; virtual void InitConnect(); virtual void InitValBoundaryAn(); diff --git a/src/ADAPTGUI/MonCreateBoundaryCAO.cxx b/src/ADAPTGUI/MonCreateBoundaryCAO.cxx index da07e84a5..da3f9d31e 100644 --- a/src/ADAPTGUI/MonCreateBoundaryCAO.cxx +++ b/src/ADAPTGUI/MonCreateBoundaryCAO.cxx @@ -33,14 +33,14 @@ using namespace std; // ------------------------------------------------------------------------------- MonCreateBoundaryCAO::MonCreateBoundaryCAO(MonCreateCase* parent, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen0, + ADAPT::ADAPT_Gen_var myHomardGen0, QString caseName, QString aName) // --------------------------------------------------------------------------------- /* Constructs a MonCreateBoundaryCAO */ : QDialog(0), Ui_CreateBoundaryCAO(), _parent(parent), _aName(aName), - myHomardGen(HOMARD::HOMARD_Gen::_duplicate(myHomardGen0)), + myHomardGen(ADAPT::ADAPT_Gen::_duplicate(myHomardGen0)), _aCaseName(caseName) { MESSAGE("Constructeur") ; @@ -137,7 +137,7 @@ void MonCreateBoundaryCAO::PushOnHelp() void MonCreateBoundaryCAO::AssocieLesGroupes() // ------------------------------------------------------------------------ { - HOMARD::ListGroupType_var aSeqGroupe = new HOMARD::ListGroupType; + ADAPT::ListGroupType_var aSeqGroupe = new ADAPT::ListGroupType; aSeqGroupe->length(_listeGroupesBoundary.size()); QStringList::const_iterator it; int i=0; @@ -152,7 +152,7 @@ void MonCreateBoundaryCAO::SetNewName() // -------------------------------------------------- { - HOMARD::listeBoundarys_var MyObjects = myHomardGen->GetAllBoundarysName(); + ADAPT::listeBoundarys_var MyObjects = myHomardGen->GetAllBoundarysName(); int num = 0; QString aName=""; while (aName == QString("") ) { @@ -195,7 +195,7 @@ void MonCreateBoundaryCAO::SetFiltrage() return; } - MonCreateListGroupCAO *aDlg = new MonCreateListGroupCAO(NULL, this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), + MonCreateListGroupCAO *aDlg = new MonCreateListGroupCAO(NULL, this, true, ADAPT::ADAPT_Gen::_duplicate(myHomardGen), _aCaseName, _listeGroupesBoundary) ; aDlg->show(); } diff --git a/src/ADAPTGUI/MonCreateBoundaryCAO.h b/src/ADAPTGUI/MonCreateBoundaryCAO.h index 1b6eff095..1d5b646e1 100644 --- a/src/ADAPTGUI/MonCreateBoundaryCAO.h +++ b/src/ADAPTGUI/MonCreateBoundaryCAO.h @@ -26,7 +26,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include CORBA_CLIENT_HEADER(HOMARD_Boundary) #include "ui_CreateBoundaryCAO.h" @@ -39,7 +39,7 @@ class HOMARD_EXPORT MonCreateBoundaryCAO : public QDialog, public Ui_CreateBound public: MonCreateBoundaryCAO( MonCreateCase* parent, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString caseName, QString BoundaryName ); ~MonCreateBoundaryCAO(); virtual void setGroups (QStringList listGroup); @@ -52,8 +52,8 @@ protected : QString _aCaseName; - HOMARD::HOMARD_Boundary_var aBoundary; - HOMARD::HOMARD_Gen_var myHomardGen; + ADAPT::HOMARD_Boundary_var aBoundary; + ADAPT::ADAPT_Gen_var myHomardGen; QStringList _listeGroupesBoundary; diff --git a/src/ADAPTGUI/MonCreateBoundaryDi.cxx b/src/ADAPTGUI/MonCreateBoundaryDi.cxx index f61b7653f..8d1158c72 100644 --- a/src/ADAPTGUI/MonCreateBoundaryDi.cxx +++ b/src/ADAPTGUI/MonCreateBoundaryDi.cxx @@ -33,14 +33,14 @@ using namespace std; // ------------------------------------------------------------------------------- MonCreateBoundaryDi::MonCreateBoundaryDi(MonCreateCase* parent, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen0, + ADAPT::ADAPT_Gen_var myHomardGen0, QString caseName, QString aName) // --------------------------------------------------------------------------------- /* Constructs a MonCreateBoundaryDi */ : QDialog(0), Ui_CreateBoundaryDi(), _parent(parent), _aName(aName), - myHomardGen(HOMARD::HOMARD_Gen::_duplicate(myHomardGen0)), + myHomardGen(ADAPT::ADAPT_Gen::_duplicate(myHomardGen0)), _aCaseName(caseName) { MESSAGE("Constructeur") ; @@ -146,7 +146,7 @@ void MonCreateBoundaryDi::PushOnHelp() void MonCreateBoundaryDi::AssocieLesGroupes() // ------------------------------------------------------------------------ { - HOMARD::ListGroupType_var aSeqGroupe = new HOMARD::ListGroupType; + ADAPT::ListGroupType_var aSeqGroupe = new ADAPT::ListGroupType; aSeqGroupe->length(_listeGroupesBoundary.size()); QStringList::const_iterator it; int i=0; @@ -161,7 +161,7 @@ void MonCreateBoundaryDi::SetNewName() // -------------------------------------------------- { - HOMARD::listeBoundarys_var MyObjects = myHomardGen->GetAllBoundarysName(); + ADAPT::listeBoundarys_var MyObjects = myHomardGen->GetAllBoundarysName(); int num = 0; QString aName=""; while (aName == QString("") ) { @@ -204,7 +204,7 @@ void MonCreateBoundaryDi::SetFiltrage() return; } - MonCreateListGroup *aDlg = new MonCreateListGroup(NULL, this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), + MonCreateListGroup *aDlg = new MonCreateListGroup(NULL, this, true, ADAPT::ADAPT_Gen::_duplicate(myHomardGen), _aCaseName, _listeGroupesBoundary) ; aDlg->show(); } diff --git a/src/ADAPTGUI/MonCreateBoundaryDi.h b/src/ADAPTGUI/MonCreateBoundaryDi.h index b81ef6a7c..de99a1120 100644 --- a/src/ADAPTGUI/MonCreateBoundaryDi.h +++ b/src/ADAPTGUI/MonCreateBoundaryDi.h @@ -26,7 +26,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include CORBA_CLIENT_HEADER(HOMARD_Boundary) #include "ui_CreateBoundaryDi.h" @@ -39,7 +39,7 @@ class HOMARD_EXPORT MonCreateBoundaryDi : public QDialog, public Ui_CreateBounda public: MonCreateBoundaryDi( MonCreateCase* parent, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString caseName, QString BoundaryName ); ~MonCreateBoundaryDi(); virtual void setGroups (QStringList listGroup); @@ -52,8 +52,8 @@ protected : QString _aCaseName; - HOMARD::HOMARD_Boundary_var aBoundary; - HOMARD::HOMARD_Gen_var myHomardGen; + ADAPT::HOMARD_Boundary_var aBoundary; + ADAPT::ADAPT_Gen_var myHomardGen; QStringList _listeGroupesBoundary; diff --git a/src/ADAPTGUI/MonCreateCase.cxx b/src/ADAPTGUI/MonCreateCase.cxx index fa451efa7..3943d3ed4 100644 --- a/src/ADAPTGUI/MonCreateCase.cxx +++ b/src/ADAPTGUI/MonCreateCase.cxx @@ -46,7 +46,7 @@ using namespace std; * Sets attributes to default values */ // ----------------------------------------------------------------------------------------- -MonCreateCase::MonCreateCase( bool modal, HOMARD::HOMARD_Gen_var myHomardGen0 ) +MonCreateCase::MonCreateCase( bool modal, ADAPT::ADAPT_Gen_var myHomardGen0 ) : Ui_CreateCase(), _aCaseName(""),_aDirName(""), @@ -55,7 +55,7 @@ MonCreateCase::MonCreateCase( bool modal, HOMARD::HOMARD_Gen_var myHomardGen0 ) _Pyram(0) { MESSAGE("Debut du constructeur de MonCreateCase"); - myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + myHomardGen=ADAPT::ADAPT_Gen::_duplicate(myHomardGen0); setupUi(this); setModal(modal); InitConnect(); @@ -132,7 +132,7 @@ void MonCreateCase::InitBoundarys() { MESSAGE("InitBoundarys"); // Pour les frontieres analytiques : la colonne des groupes - HOMARD::ListGroupType_var _listeGroupesCas = aCase->GetGroups(); + ADAPT::ListGroupType_var _listeGroupesCas = aCase->GetGroups(); QTableWidgetItem *__colItem = new QTableWidgetItem(); __colItem->setText(QApplication::translate("CreateCase", "", 0)); TWBoundary->setHorizontalHeaderItem(0, __colItem); @@ -145,8 +145,8 @@ void MonCreateCase::InitBoundarys() // 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 ; - HOMARD::listeBoundarys_var mesBoundarys = myHomardGen->GetAllBoundarysName(); + ADAPT::HOMARD_Boundary_var myBoundary ; + ADAPT::listeBoundarys_var mesBoundarys = myHomardGen->GetAllBoundarysName(); // MESSAGE("Nombre de frontieres enregistrees : "<length()); for (int i=0; ilength(); i++) { @@ -352,7 +352,7 @@ void MonCreateCase::PushOnHelp() void MonCreateCase::SetNewName() // ------------------------------ { - HOMARD::listeCases_var MyCases = myHomardGen->GetAllCasesName(); + ADAPT::listeCases_var MyCases = myHomardGen->GetAllCasesName(); int num = 0; QString aCaseName=""; while (aCaseName=="" ) { @@ -507,7 +507,7 @@ void MonCreateCase::PushBoundaryCAONew() // ------------------------------------------------------------------------ { MonCreateBoundaryCAO *BoundaryDlg = new MonCreateBoundaryCAO(this, true, - HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, "") ; + ADAPT::ADAPT_Gen::_duplicate(myHomardGen), _aCaseName, "") ; BoundaryDlg->show(); } // ------------------------------------------------------------------------ @@ -516,7 +516,7 @@ void MonCreateCase::PushBoundaryCAOEdit() { if (CBBoundaryCAO->currentText() == QString("")) return; MonEditBoundaryCAO *BoundaryDlg = new MonEditBoundaryCAO(this, true, - HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, CBBoundaryCAO->currentText() ) ; + ADAPT::ADAPT_Gen::_duplicate(myHomardGen), _aCaseName, CBBoundaryCAO->currentText() ) ; BoundaryDlg->show(); } // ------------------------------------------------------------------------ @@ -555,7 +555,7 @@ void MonCreateCase::PushBoundaryDiNew() // ------------------------------------------------------------------------ { MonCreateBoundaryDi *BoundaryDlg = new MonCreateBoundaryDi(this, true, - HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, "") ; + ADAPT::ADAPT_Gen::_duplicate(myHomardGen), _aCaseName, "") ; BoundaryDlg->show(); } // ------------------------------------------------------------------------ @@ -564,7 +564,7 @@ void MonCreateCase::PushBoundaryDiEdit() { if (CBBoundaryDi->currentText() == QString("")) return; MonEditBoundaryDi *BoundaryDlg = new MonEditBoundaryDi(this, true, - HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, CBBoundaryDi->currentText() ) ; + ADAPT::ADAPT_Gen::_duplicate(myHomardGen), _aCaseName, CBBoundaryDi->currentText() ) ; BoundaryDlg->show(); } // ------------------------------------------------------------------------ @@ -624,7 +624,7 @@ void MonCreateCase::PushBoundaryAnNew() // ------------------------------------------------------------------------ { MonCreateBoundaryAn *BoundaryDlg = new MonCreateBoundaryAn(this, true, - HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName) ; + ADAPT::ADAPT_Gen::_duplicate(myHomardGen), _aCaseName) ; BoundaryDlg->show(); } // ------------------------------------------------------------------------ @@ -641,7 +641,7 @@ void MonCreateCase::PushBoundaryAnEdit() MESSAGE("nom "<show(); } } } diff --git a/src/ADAPTGUI/MonCreateCase.h b/src/ADAPTGUI/MonCreateCase.h index ab1a2f4c1..03178ef2e 100644 --- a/src/ADAPTGUI/MonCreateCase.h +++ b/src/ADAPTGUI/MonCreateCase.h @@ -26,7 +26,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include CORBA_CLIENT_HEADER(HOMARD_Cas) #include "ui_CreateCase.h" @@ -37,7 +37,7 @@ class HOMARD_EXPORT MonCreateCase : public QDialog, public Ui_CreateCase Q_OBJECT public: - MonCreateCase( bool modal, HOMARD::HOMARD_Gen_var myHomardGen ); + MonCreateCase( bool modal, ADAPT::ADAPT_Gen_var myHomardGen ); ~MonCreateCase(); void AddBoundaryCAO(QString newBoundary); @@ -53,8 +53,8 @@ protected : int _Pyram; - HOMARD::HOMARD_Cas_var aCase ; - HOMARD::HOMARD_Gen_var myHomardGen; + ADAPT::HOMARD_Cas_var aCase ; + ADAPT::ADAPT_Gen_var myHomardGen; virtual void InitConnect(); virtual void InitBoundarys(); diff --git a/src/ADAPTGUI/MonCreateHypothesis.cxx b/src/ADAPTGUI/MonCreateHypothesis.cxx index 6b03def0e..add1122ee 100644 --- a/src/ADAPTGUI/MonCreateHypothesis.cxx +++ b/src/ADAPTGUI/MonCreateHypothesis.cxx @@ -35,7 +35,7 @@ using namespace std; // ------------------------------------------------------------------------------- MonCreateHypothesis::MonCreateHypothesis(MonCreateIteration* parent, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen0, + ADAPT::ADAPT_Gen_var myHomardGen0, QString Name, QString caseName, QString aFieldFile) // --------------------------------------------------------------------------------- @@ -56,7 +56,7 @@ MonCreateHypothesis::MonCreateHypothesis(MonCreateIteration* parent, bool modal, { MESSAGE("Constructeur") ; - myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + myHomardGen=ADAPT::ADAPT_Gen::_duplicate(myHomardGen0); setupUi(this); if ( modal ) { setWindowModality(Qt::WindowModal); } else { setWindowModality(Qt::NonModal); } @@ -231,7 +231,7 @@ void MonCreateHypothesis::SetNewName() // -------------------------------------------------- { - HOMARD::listeHypotheses_var MyObjects = myHomardGen->GetAllHypothesesName(); + ADAPT::listeHypotheses_var MyObjects = myHomardGen->GetAllHypothesesName(); int num = 0;// QString aName=""; while (aName=="" ) @@ -318,7 +318,7 @@ void MonCreateHypothesis::PushZoneNew() // ------------------------------------------------------------------------ { MESSAGE("Debut de MonCreateHypothesis::PushZoneNew") - MonCreateZone *aDlg = new MonCreateZone(this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName) ; + MonCreateZone *aDlg = new MonCreateZone(this, true, ADAPT::ADAPT_Gen::_duplicate(myHomardGen), _aCaseName) ; aDlg->show(); } @@ -336,7 +336,7 @@ void MonCreateHypothesis::PushZoneEdit() return; } QString zoneName = monItem->text().trimmed(); - MonEditZone *aDlg = new MonEditZone(this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, zoneName) ; + MonEditZone *aDlg = new MonEditZone(this, true, ADAPT::ADAPT_Gen::_duplicate(myHomardGen), _aCaseName, zoneName) ; aDlg->show(); } // ------------------------------------------------------------------------ @@ -357,7 +357,7 @@ void MonCreateHypothesis::GetAllZones() // Par defaut, aucune n'est selectionnee { MESSAGE("Debut de GetAllZones") ; - HOMARD::listeZones_var mesZones = myHomardGen->GetAllZonesName(); + ADAPT::listeZones_var mesZones = myHomardGen->GetAllZonesName(); int nbrow=TWZone->rowCount(); for ( int row=0; row< nbrow; row++) { @@ -711,7 +711,7 @@ void MonCreateHypothesis::SetFiltrage() // ------------------------------------------------------------------------ { if (!CBGroupe->isChecked()) return; - MonCreateListGroup *aDlg = new MonCreateListGroup(this, NULL, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),_aCaseName, _aListeGroupes) ; + MonCreateListGroup *aDlg = new MonCreateListGroup(this, NULL, true, ADAPT::ADAPT_Gen::_duplicate(myHomardGen),_aCaseName, _aListeGroupes) ; aDlg->show(); } @@ -805,7 +805,7 @@ void MonCreateHypothesis::AssocieComposants() void MonCreateHypothesis::AssocieLesGroupes() // ------------------------------------------------------------------------ { - HOMARD::ListGroupType_var aSeqGroupe = new HOMARD::ListGroupType; + ADAPT::ListGroupType_var aSeqGroupe = new ADAPT::ListGroupType; aSeqGroupe->length(_aListeGroupes.size()); QStringList::const_iterator it; int i=0; diff --git a/src/ADAPTGUI/MonCreateHypothesis.h b/src/ADAPTGUI/MonCreateHypothesis.h index 929ee30aa..a760fcfef 100644 --- a/src/ADAPTGUI/MonCreateHypothesis.h +++ b/src/ADAPTGUI/MonCreateHypothesis.h @@ -26,7 +26,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include CORBA_CLIENT_HEADER(HOMARD_Hypothesis) #include "ui_CreateHypothesis.h" @@ -38,7 +38,7 @@ class HOMARD_EXPORT MonCreateHypothesis : public QScrollArea, public Ui_CreateHy Q_OBJECT public: - MonCreateHypothesis( MonCreateIteration* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, + MonCreateHypothesis( MonCreateIteration* parent, bool modal, ADAPT::ADAPT_Gen_var myHomardGen, QString aHypotheseName, QString caseName, QString aFieldFile); ~MonCreateHypothesis(); @@ -46,7 +46,7 @@ public: virtual void setGroups(QStringList listGroup); protected : - // MonCreateHypothesis( MonCreateIteration* parent, HOMARD::HOMARD_Gen_var myHomardGen, + // MonCreateHypothesis( MonCreateIteration* parent, ADAPT::ADAPT_Gen_var myHomardGen, // QString caseName, QString aFieldFile); MonCreateIteration *_parent; @@ -74,8 +74,8 @@ protected : int _AdapInit; int _ExtraOutput; - HOMARD::HOMARD_Hypothesis_var aHypothesis; - HOMARD::HOMARD_Gen_var myHomardGen; + ADAPT::HOMARD_Hypothesis_var aHypothesis; + ADAPT::ADAPT_Gen_var myHomardGen; QStringList _aListeZone; QStringList _aListeComposant; diff --git a/src/ADAPTGUI/MonCreateIteration.cxx b/src/ADAPTGUI/MonCreateIteration.cxx index 99da0c955..8d4d200d3 100644 --- a/src/ADAPTGUI/MonCreateIteration.cxx +++ b/src/ADAPTGUI/MonCreateIteration.cxx @@ -33,7 +33,7 @@ using namespace std; // ----------------------------------------------------------------------------------------------------- MonCreateIteration::MonCreateIteration(QWidget* parent, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen0, QString IterParentName ): + ADAPT::ADAPT_Gen_var myHomardGen0, QString IterParentName ): // ----------------------------------------------------------------------------------------------------- /* Constructs a MonCreateIteration * Inherits from CasHomard @@ -46,7 +46,7 @@ MonCreateIteration::MonCreateIteration(QWidget* parent, bool modal, _CaseName("") { MESSAGE("Constructeur"); - myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + myHomardGen=ADAPT::ADAPT_Gen::_duplicate(myHomardGen0); setupUi(this); if ( modal ) { setWindowModality(Qt::WindowModal); } else { setWindowModality(Qt::NonModal); } @@ -87,7 +87,7 @@ void MonCreateIteration::InitConnect() void MonCreateIteration::GetHypotheses() // ------------------------------------------------------------------------ { - HOMARD::listeHypotheses_var mesHypotheses = myHomardGen->GetAllHypothesesName(); + ADAPT::listeHypotheses_var mesHypotheses = myHomardGen->GetAllHypothesesName(); for (int i=0; ilength(); i++) { CBHypothese->addItem(QString(mesHypotheses[i])); @@ -128,8 +128,8 @@ bool MonCreateIteration::PushOnApply() QObject::tr("HOM_ITER_HYPO") ); return false; } - HOMARD::HOMARD_Hypothesis_var _myHypothesis = myHomardGen->GetHypothesis(monHypoName.toStdString().c_str()); - HOMARD::listeTypes_var ListTypes (_myHypothesis->GetAdapRefinUnRef()); + ADAPT::HOMARD_Hypothesis_var _myHypothesis = myHomardGen->GetHypothesis(monHypoName.toStdString().c_str()); + ADAPT::listeTypes_var ListTypes (_myHypothesis->GetAdapRefinUnRef()); int TypeAdap = ListTypes[0]; if ( TypeAdap == 1 && LEFieldFile->text().trimmed() == QString("") ) { @@ -202,7 +202,7 @@ void MonCreateIteration::SetIterParentName() if (_IterParentName == QString("")) { raise();return;}; } _CaseName=HOMARD_QT_COMMUN::SelectionCasEtude(); - HOMARD::HOMARD_Iteration_var aIterParent = myHomardGen->GetIteration(_IterParentName.toStdString().c_str()) ; + ADAPT::HOMARD_Iteration_var aIterParent = myHomardGen->GetIteration(_IterParentName.toStdString().c_str()) ; QString MeshName = aIterParent->GetMeshName(); LEMeshName_n->setText(MeshName); @@ -217,7 +217,7 @@ void MonCreateIteration::SetNewName() { // Recherche d'un nom par defaut qui n'existe pas encore - HOMARD::listeIterations_var MyObjects=myHomardGen->GetAllIterationsName(); + ADAPT::listeIterations_var MyObjects=myHomardGen->GetAllIterationsName(); int num = 0;// QString aName=""; while (aName=="" ) @@ -249,7 +249,7 @@ void MonCreateIteration::PushHypoEdit() return; } QString aFieldFile=LEFieldFile->text().trimmed(); - MonEditHypothesis *HypoDlg = new MonEditHypothesis(this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),CBHypothese->currentText(), _CaseName, aFieldFile) ; + MonEditHypothesis *HypoDlg = new MonEditHypothesis(this, true, ADAPT::ADAPT_Gen::_duplicate(myHomardGen),CBHypothese->currentText(), _CaseName, aFieldFile) ; HypoDlg->show(); } @@ -273,11 +273,11 @@ void MonCreateIteration::PushHypoNew() } if ( _CaseName == QString("")) { - HOMARD::HOMARD_Iteration_var aIterParent = myHomardGen->GetIteration(_IterParentName.toStdString().c_str()) ; + ADAPT::HOMARD_Iteration_var aIterParent = myHomardGen->GetIteration(_IterParentName.toStdString().c_str()) ; _CaseName = aIterParent->GetCaseName(); } QString aFieldFile=LEFieldFile->text().trimmed(); - MonCreateHypothesis *HypoDlg = new MonCreateHypothesis(this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), QString(""), _CaseName, aFieldFile) ; + MonCreateHypothesis *HypoDlg = new MonCreateHypothesis(this, true, ADAPT::ADAPT_Gen::_duplicate(myHomardGen), QString(""), _CaseName, aFieldFile) ; HypoDlg->show(); } // ------------------------------------------------------------------------ diff --git a/src/ADAPTGUI/MonCreateIteration.h b/src/ADAPTGUI/MonCreateIteration.h index 7567c4866..a10f48d91 100644 --- a/src/ADAPTGUI/MonCreateIteration.h +++ b/src/ADAPTGUI/MonCreateIteration.h @@ -26,7 +26,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include CORBA_CLIENT_HEADER(HOMARD_Cas) #include "ui_CreateIteration.h" @@ -37,24 +37,24 @@ class HOMARD_EXPORT MonCreateIteration : public QScrollArea, public Ui_CreateIte Q_OBJECT public: - MonCreateIteration( QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString IterParentName ); + MonCreateIteration( QWidget* parent, bool modal, ADAPT::ADAPT_Gen_var myHomardGen, QString IterParentName ); ~MonCreateIteration(); void addHypothese(QString newHypothese); protected : - MonCreateIteration( QWidget* parent, HOMARD::HOMARD_Gen_var myHomardGen, QString IterParentName ); + MonCreateIteration( QWidget* parent, ADAPT::ADAPT_Gen_var myHomardGen, QString IterParentName ); QString _Name; QString _IterParentName; QString _CaseName; - HOMARD::HOMARD_Iteration_var aIter ; - HOMARD::HOMARD_Iteration_var aIterParent ; - HOMARD::HOMARD_Cas_var aCas ; - HOMARD::HOMARD_Gen_var myHomardGen; + ADAPT::HOMARD_Iteration_var aIter ; + ADAPT::HOMARD_Iteration_var aIterParent ; + ADAPT::HOMARD_Cas_var aCas ; + ADAPT::ADAPT_Gen_var myHomardGen; virtual void InitConnect(); diff --git a/src/ADAPTGUI/MonCreateListGroup.cxx b/src/ADAPTGUI/MonCreateListGroup.cxx index 28f93e315..7664a01fe 100644 --- a/src/ADAPTGUI/MonCreateListGroup.cxx +++ b/src/ADAPTGUI/MonCreateListGroup.cxx @@ -38,7 +38,7 @@ using namespace std; // -------------------------------------------------------------------------------------------------------------- MonCreateListGroup::MonCreateListGroup(MonCreateHypothesis* parentHyp, MonCreateBoundaryDi* parentBound, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen0, QString aCaseName, QStringList listeGroupesHypo) : + ADAPT::ADAPT_Gen_var myHomardGen0, QString aCaseName, QStringList listeGroupesHypo) : // -------------------------------------------------------------------------------------------------------------- // QDialog(0), Ui_CreateListGroup(), @@ -48,7 +48,7 @@ MonCreateListGroup::MonCreateListGroup(MonCreateHypothesis* parentHyp, MonCreate _parentBound(parentBound) { MESSAGE("Debut de MonCreateListGroup") - myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + myHomardGen=ADAPT::ADAPT_Gen::_duplicate(myHomardGen0); setupUi(this); setModal(modal); InitConnect(); @@ -56,7 +56,7 @@ MonCreateListGroup::MonCreateListGroup(MonCreateHypothesis* parentHyp, MonCreate } // -------------------------------------------------------------------------------------------------------------- MonCreateListGroup::MonCreateListGroup(MonCreateHypothesis* parentHyp, MonCreateBoundaryDi* parentBound, - HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo) : + ADAPT::ADAPT_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo) : // -------------------------------------------------------------------------------------------------------------- // QDialog(0), Ui_CreateListGroup(), @@ -65,7 +65,7 @@ MonCreateListGroup::MonCreateListGroup(MonCreateHypothesis* parentHyp, MonCreate _parentHyp(parentHyp), _parentBound(parentBound) { - myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen); + myHomardGen=ADAPT::ADAPT_Gen::_duplicate(myHomardGen); setupUi(this); InitConnect(); } @@ -130,8 +130,8 @@ void MonCreateListGroup::InitGroupes() 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(); + ADAPT::HOMARD_Cas_var monCas= myHomardGen->GetCase(_aCaseName.toStdString().c_str()); + ADAPT::ListGroupType_var _listeGroupesCas = monCas->GetGroups(); for ( int i = 0; i < _listeGroupesCas->length(); i++ ) { TWGroupe->insertRow(i); diff --git a/src/ADAPTGUI/MonCreateListGroup.h b/src/ADAPTGUI/MonCreateListGroup.h index b0472d3b9..4aa8a159e 100644 --- a/src/ADAPTGUI/MonCreateListGroup.h +++ b/src/ADAPTGUI/MonCreateListGroup.h @@ -26,7 +26,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include "ui_CreateListGroup.h" #include @@ -38,13 +38,13 @@ class HOMARD_EXPORT MonCreateListGroup : public QDialog, public Ui_CreateListGro Q_OBJECT public: - MonCreateListGroup( MonCreateHypothesis* parentHyp, MonCreateBoundaryDi* parentBound, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); - MonCreateListGroup( MonCreateHypothesis* parentHyp, MonCreateBoundaryDi* parentBound, HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); + MonCreateListGroup( MonCreateHypothesis* parentHyp, MonCreateBoundaryDi* parentBound, bool modal, ADAPT::ADAPT_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); + MonCreateListGroup( MonCreateHypothesis* parentHyp, MonCreateBoundaryDi* parentBound, ADAPT::ADAPT_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); virtual ~MonCreateListGroup(); protected : - HOMARD::HOMARD_Gen_var myHomardGen; + ADAPT::ADAPT_Gen_var myHomardGen; MonCreateHypothesis * _parentHyp; MonCreateBoundaryDi * _parentBound; diff --git a/src/ADAPTGUI/MonCreateListGroupCAO.cxx b/src/ADAPTGUI/MonCreateListGroupCAO.cxx index 796f2502d..a630d4558 100644 --- a/src/ADAPTGUI/MonCreateListGroupCAO.cxx +++ b/src/ADAPTGUI/MonCreateListGroupCAO.cxx @@ -38,7 +38,7 @@ using namespace std; // -------------------------------------------------------------------------------------------------------------- MonCreateListGroupCAO::MonCreateListGroupCAO(MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen0, QString aCaseName, QStringList listeGroupesHypo) : + ADAPT::ADAPT_Gen_var myHomardGen0, QString aCaseName, QStringList listeGroupesHypo) : // -------------------------------------------------------------------------------------------------------------- // QDialog(0), Ui_CreateListGroup(), @@ -48,7 +48,7 @@ MonCreateListGroupCAO::MonCreateListGroupCAO(MonCreateHypothesis* parentHyp, Mon _parentBound(parentBound) { MESSAGE("Debut de MonCreateListGroupCAO") - myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + myHomardGen=ADAPT::ADAPT_Gen::_duplicate(myHomardGen0); setupUi(this); setModal(modal); InitConnect(); @@ -56,7 +56,7 @@ MonCreateListGroupCAO::MonCreateListGroupCAO(MonCreateHypothesis* parentHyp, Mon } // -------------------------------------------------------------------------------------------------------------- MonCreateListGroupCAO::MonCreateListGroupCAO(MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound, - HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo) : + ADAPT::ADAPT_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo) : // -------------------------------------------------------------------------------------------------------------- // QDialog(0), Ui_CreateListGroup(), @@ -65,7 +65,7 @@ MonCreateListGroupCAO::MonCreateListGroupCAO(MonCreateHypothesis* parentHyp, Mon _parentHyp(parentHyp), _parentBound(parentBound) { - myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen); + myHomardGen=ADAPT::ADAPT_Gen::_duplicate(myHomardGen); setupUi(this); InitConnect(); } @@ -127,8 +127,8 @@ void MonCreateListGroupCAO::InitGroupes() 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(); + ADAPT::HOMARD_Cas_var monCas= myHomardGen->GetCase(_aCaseName.toStdString().c_str()); + ADAPT::ListGroupType_var _listeGroupesCas = monCas->GetGroups(); for ( int i = 0; i < _listeGroupesCas->length(); i++ ) { TWGroupe->insertRow(i); diff --git a/src/ADAPTGUI/MonCreateListGroupCAO.h b/src/ADAPTGUI/MonCreateListGroupCAO.h index 898389b83..8917c4136 100644 --- a/src/ADAPTGUI/MonCreateListGroupCAO.h +++ b/src/ADAPTGUI/MonCreateListGroupCAO.h @@ -26,7 +26,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include "ui_CreateListGroup.h" #include @@ -38,13 +38,13 @@ class HOMARD_EXPORT MonCreateListGroupCAO : public QDialog, public Ui_CreateList 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); + MonCreateListGroupCAO( MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound, bool modal, ADAPT::ADAPT_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); + MonCreateListGroupCAO( MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound, ADAPT::ADAPT_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); virtual ~MonCreateListGroupCAO(); protected : - HOMARD::HOMARD_Gen_var myHomardGen; + ADAPT::ADAPT_Gen_var myHomardGen; MonCreateHypothesis * _parentHyp; MonCreateBoundaryCAO * _parentBound; diff --git a/src/ADAPTGUI/MonCreateYACS.cxx b/src/ADAPTGUI/MonCreateYACS.cxx index 4d1002798..9572db73a 100644 --- a/src/ADAPTGUI/MonCreateYACS.cxx +++ b/src/ADAPTGUI/MonCreateYACS.cxx @@ -34,7 +34,7 @@ using namespace std; // ---------------------------------------------------------------------- -MonCreateYACS::MonCreateYACS (bool modal, HOMARD::HOMARD_Gen_var myHomardGen0, QString CaseName ): +MonCreateYACS::MonCreateYACS (bool modal, ADAPT::ADAPT_Gen_var myHomardGen0, QString CaseName ): // ---------------------------------------------------------------------- /* Constructs a MonCreateYACS * Sets attributes to default values @@ -46,11 +46,11 @@ MonCreateYACS::MonCreateYACS (bool modal, HOMARD::HOMARD_Gen_var myHomardGen0, Q _aDirName(""), _aMeshFile(""), _Type(1) - // Les valeurs de _Type, _MaxIter, _MaxNode, _MaxElem doivent etre les memes que celles dans HOMARD_Gen_i::CreateYACSSchema + // Les valeurs de _Type, _MaxIter, _MaxNode, _MaxElem doivent etre les memes que celles dans ADAPT_Gen_i::CreateYACSSchema // et doivent correspondre aux defauts des boutons { // MESSAGE("Debut du constructeur de MonCreateYACS"); - myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + myHomardGen=ADAPT::ADAPT_Gen::_duplicate(myHomardGen0); setupUi(this); if ( modal ) { setWindowModality(Qt::WindowModal); } else { setWindowModality(Qt::NonModal); } @@ -75,7 +75,7 @@ MonCreateYACS::MonCreateYACS (bool modal, HOMARD::HOMARD_Gen_var myHomardGen0, Q } // ---------------------------------------------------------------------- -MonCreateYACS::MonCreateYACS(HOMARD::HOMARD_Gen_var myHomardGen0, +MonCreateYACS::MonCreateYACS(ADAPT::ADAPT_Gen_var myHomardGen0, QString caseName): // ---------------------------------------------------------------------- // Constructeur appele par MonEditYACS @@ -273,7 +273,7 @@ void MonCreateYACS::SetNewName() // -------------------------------------------------- { - HOMARD::listeYACSs_var MyObjects = myHomardGen->GetAllYACSsName(); + ADAPT::listeYACSs_var MyObjects = myHomardGen->GetAllYACSsName(); int num = 0; QString aName=""; while (aName == QString("") ) { diff --git a/src/ADAPTGUI/MonCreateYACS.h b/src/ADAPTGUI/MonCreateYACS.h index a0c5ba0f7..f932b704e 100644 --- a/src/ADAPTGUI/MonCreateYACS.h +++ b/src/ADAPTGUI/MonCreateYACS.h @@ -26,7 +26,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include CORBA_CLIENT_HEADER(HOMARD_Cas) #include "ui_CreateYACS.h" @@ -37,11 +37,11 @@ class HOMARD_EXPORT MonCreateYACS : public QScrollArea, public Ui_CreateYACS Q_OBJECT public: - MonCreateYACS( bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString CaseName); + MonCreateYACS( bool modal, ADAPT::ADAPT_Gen_var myHomardGen, QString CaseName); virtual ~MonCreateYACS(); protected : - MonCreateYACS( HOMARD::HOMARD_Gen_var myHomardGen, QString CaseName); + MonCreateYACS( ADAPT::ADAPT_Gen_var myHomardGen, QString CaseName); QString _Name; QString _aCaseName; @@ -56,8 +56,8 @@ class HOMARD_EXPORT MonCreateYACS : public QScrollArea, public Ui_CreateYACS bool Chgt; - HOMARD::HOMARD_YACS_var aYACS; - HOMARD::HOMARD_Gen_var myHomardGen; + ADAPT::HOMARD_YACS_var aYACS; + ADAPT::ADAPT_Gen_var myHomardGen; virtual void InitConnect(); virtual bool CreateOrUpdate(); diff --git a/src/ADAPTGUI/MonCreateZone.cxx b/src/ADAPTGUI/MonCreateZone.cxx index 1adb91653..b07d87e0b 100644 --- a/src/ADAPTGUI/MonCreateZone.cxx +++ b/src/ADAPTGUI/MonCreateZone.cxx @@ -38,7 +38,7 @@ using namespace std; // ---------------------------------------------------------------------- MonCreateZone::MonCreateZone(MonCreateHypothesis* parent, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen0, + ADAPT::ADAPT_Gen_var myHomardGen0, QString caseName) : // ---------------------------------------------------------------------- /* Constructs a MonCreateZone @@ -61,7 +61,7 @@ MonCreateZone::MonCreateZone(MonCreateHypothesis* parent, bool modal, Chgt (false) { MESSAGE("Constructeur") ; - myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0) ; + myHomardGen=ADAPT::ADAPT_Gen::_duplicate(myHomardGen0) ; setupUi(this) ; setModal(modal) ; InitConnect( ) ; @@ -74,7 +74,7 @@ MonCreateZone::MonCreateZone(MonCreateHypothesis* parent, bool modal, } // ---------------------------------------------------------------------- MonCreateZone::MonCreateZone(MonCreateHypothesis* parent, - HOMARD::HOMARD_Gen_var myHomardGen0, + ADAPT::ADAPT_Gen_var myHomardGen0, QString caseName): // ---------------------------------------------------------------------- // Constructeur appele par MonEditZone @@ -131,8 +131,8 @@ void MonCreateZone::InitValZone() // if (_aCaseName == QString("")) { return; } - HOMARD::HOMARD_Cas_var aCas = myHomardGen->GetCase(_aCaseName.toStdString().c_str()) ; - HOMARD::extrema_var MesExtremes = aCas->GetBoundingBox() ; + ADAPT::HOMARD_Cas_var aCas = myHomardGen->GetCase(_aCaseName.toStdString().c_str()) ; + ADAPT::extrema_var MesExtremes = aCas->GetBoundingBox() ; int num = MesExtremes->length() ; ASSERT(num == 10) ; _Xmin=MesExtremes[0]; _Xmax=MesExtremes[1]; _Xincr=MesExtremes[2]; @@ -600,7 +600,7 @@ void MonCreateZone::SetNewName() MESSAGE("SetNewName"); // Recherche d'un nom par defaut qui n'existe pas encore - HOMARD::listeZones_var MyObjects = myHomardGen->GetAllZonesName() ; + ADAPT::listeZones_var MyObjects = myHomardGen->GetAllZonesName() ; int num = 0; QString aName=""; while (aName=="" ) { diff --git a/src/ADAPTGUI/MonCreateZone.h b/src/ADAPTGUI/MonCreateZone.h index 932e9965f..099c063e3 100644 --- a/src/ADAPTGUI/MonCreateZone.h +++ b/src/ADAPTGUI/MonCreateZone.h @@ -26,7 +26,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include "ui_CreateZone.h" #include @@ -38,13 +38,13 @@ class HOMARD_EXPORT MonCreateZone : public QDialog, public Ui_CreateZone public: MonCreateZone( MonCreateHypothesis* parent, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString caseName); virtual ~MonCreateZone(); protected : MonCreateZone( MonCreateHypothesis* parent, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString caseName); MonCreateHypothesis * _parent; @@ -64,8 +64,8 @@ protected : bool Chgt; - HOMARD::HOMARD_Zone_var aZone ; - HOMARD::HOMARD_Gen_var myHomardGen; + ADAPT::HOMARD_Zone_var aZone ; + ADAPT::ADAPT_Gen_var myHomardGen; virtual void InitConnect(); virtual void InitValZone(); diff --git a/src/ADAPTGUI/MonEditBoundaryAn.cxx b/src/ADAPTGUI/MonEditBoundaryAn.cxx index 6f7889d94..bb9a8c340 100644 --- a/src/ADAPTGUI/MonEditBoundaryAn.cxx +++ b/src/ADAPTGUI/MonEditBoundaryAn.cxx @@ -27,7 +27,7 @@ using namespace std; // ------------------------------------------------------------------------ MonEditBoundaryAn::MonEditBoundaryAn( MonCreateCase* parent, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString caseName, QString Name ): // ------------------------------------------------------------------------ /* Constructs a MonEditBoundaryAn @@ -95,7 +95,7 @@ void MonEditBoundaryAn::InitValEdit() void MonEditBoundaryAn::InitValBoundaryAnLimit() // ------------------------------------------------------------------------ { - HOMARD::double_array_var mesCoordLimits = aBoundaryAn->GetLimit(); + ADAPT::double_array_var mesCoordLimits = aBoundaryAn->GetLimit(); ASSERT(mesCoordLimits->length() == 3 ); _Xincr=mesCoordLimits[0]; _Yincr=mesCoordLimits[1]; @@ -105,7 +105,7 @@ void MonEditBoundaryAn::InitValBoundaryAnLimit() void MonEditBoundaryAn::InitValBoundaryAnCylindre() // ------------------------------------------------------------------------ { - HOMARD::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords(); + ADAPT::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords(); ASSERT(mesCoordBoundary->length() == 7 ); _BoundaryAnXcentre=mesCoordBoundary[0]; _BoundaryAnYcentre=mesCoordBoundary[1]; @@ -119,7 +119,7 @@ void MonEditBoundaryAn::InitValBoundaryAnCylindre() void MonEditBoundaryAn::InitValBoundaryAnSphere() // ------------------------------------------------------------------------ { - HOMARD::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords(); + ADAPT::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords(); ASSERT(mesCoordBoundary->length() == 4 ); _BoundaryAnXcentre=mesCoordBoundary[0]; _BoundaryAnYcentre=mesCoordBoundary[1]; @@ -130,7 +130,7 @@ void MonEditBoundaryAn::InitValBoundaryAnSphere() void MonEditBoundaryAn::InitValBoundaryAnConeA() // ------------------------------------------------------------------------ { - HOMARD::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords(); + ADAPT::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords(); ASSERT(mesCoordBoundary->length() == 7 ); _BoundaryAnXaxisCone=mesCoordBoundary[0]; _BoundaryAnYaxisCone=mesCoordBoundary[1]; @@ -145,7 +145,7 @@ void MonEditBoundaryAn::InitValBoundaryAnConeA() void MonEditBoundaryAn::InitValBoundaryAnConeR() // ------------------------------------------------------------------------ { - HOMARD::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords(); + ADAPT::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords(); ASSERT(mesCoordBoundary->length() == 8 ); _BoundaryAnXcone1=mesCoordBoundary[0]; _BoundaryAnYcone1=mesCoordBoundary[1]; @@ -161,7 +161,7 @@ void MonEditBoundaryAn::InitValBoundaryAnConeR() void MonEditBoundaryAn::InitValBoundaryAnTore() // ------------------------------------------------------------------------ { - HOMARD::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords(); + ADAPT::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords(); ASSERT(mesCoordBoundary->length() == 8 ); _BoundaryAnXcentre=mesCoordBoundary[0]; _BoundaryAnYcentre=mesCoordBoundary[1]; diff --git a/src/ADAPTGUI/MonEditBoundaryAn.h b/src/ADAPTGUI/MonEditBoundaryAn.h index ea98981e3..f43764b8e 100644 --- a/src/ADAPTGUI/MonEditBoundaryAn.h +++ b/src/ADAPTGUI/MonEditBoundaryAn.h @@ -26,7 +26,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include @@ -35,7 +35,7 @@ class HOMARD_EXPORT MonEditBoundaryAn : public MonCreateBoundaryAn Q_OBJECT public: MonEditBoundaryAn( MonCreateCase* parent, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString caseName, QString Name); virtual ~MonEditBoundaryAn(); diff --git a/src/ADAPTGUI/MonEditBoundaryCAO.cxx b/src/ADAPTGUI/MonEditBoundaryCAO.cxx index 36e3714ed..e9ab43a93 100644 --- a/src/ADAPTGUI/MonEditBoundaryCAO.cxx +++ b/src/ADAPTGUI/MonEditBoundaryCAO.cxx @@ -31,7 +31,7 @@ using namespace std; // ------------------------------------------------------------------------------------------------------------------------------------- MonEditBoundaryCAO::MonEditBoundaryCAO( MonCreateCase* parent, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString caseName, QString Name): // ------------------------------------------------------------------------------------------------------------------------------------- /* Constructs a MonEditBoundaryCAO @@ -54,7 +54,7 @@ MonEditBoundaryCAO::MonEditBoundaryCAO( MonCreateCase* parent, bool modal, return; } - HOMARD::ListGroupType_var maListe = aBoundary->GetGroups(); + ADAPT::ListGroupType_var maListe = aBoundary->GetGroups(); for ( int i = 0; i < maListe->length(); i++ ) _listeGroupesBoundary << QString(maListe[i]); @@ -95,10 +95,10 @@ void MonEditBoundaryCAO::SetFiltrage() QObject::tr("HOM_BOUN_CASE") ); return; } - HOMARD::HOMARD_Cas_var monCas= myHomardGen->GetCase(_aCaseName.toStdString().c_str()); - HOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups(); + ADAPT::HOMARD_Cas_var monCas= myHomardGen->GetCase(_aCaseName.toStdString().c_str()); + ADAPT::ListGroupType_var _listeGroupesCas = monCas->GetGroups(); - MonEditListGroupCAO *aDlg = new MonEditListGroupCAO(NULL, this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), + MonEditListGroupCAO *aDlg = new MonEditListGroupCAO(NULL, this, true, ADAPT::ADAPT_Gen::_duplicate(myHomardGen), _aCaseName, _listeGroupesBoundary) ; aDlg->show(); } diff --git a/src/ADAPTGUI/MonEditBoundaryCAO.h b/src/ADAPTGUI/MonEditBoundaryCAO.h index 01ac507b8..d8131825d 100644 --- a/src/ADAPTGUI/MonEditBoundaryCAO.h +++ b/src/ADAPTGUI/MonEditBoundaryCAO.h @@ -26,7 +26,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include @@ -35,7 +35,7 @@ class HOMARD_EXPORT MonEditBoundaryCAO : public MonCreateBoundaryCAO Q_OBJECT public: MonEditBoundaryCAO( MonCreateCase* parent, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString caseName, QString Name ); virtual ~MonEditBoundaryCAO(); diff --git a/src/ADAPTGUI/MonEditBoundaryDi.cxx b/src/ADAPTGUI/MonEditBoundaryDi.cxx index d891732c0..fa92cc174 100644 --- a/src/ADAPTGUI/MonEditBoundaryDi.cxx +++ b/src/ADAPTGUI/MonEditBoundaryDi.cxx @@ -31,7 +31,7 @@ using namespace std; // ------------------------------------------------------------------------------------------------------------------------------------- MonEditBoundaryDi::MonEditBoundaryDi( MonCreateCase* parent, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString caseName, QString Name): // ------------------------------------------------------------------------------------------------------------------------------------- /* Constructs a MonEditBoundaryDi @@ -54,7 +54,7 @@ MonEditBoundaryDi::MonEditBoundaryDi( MonCreateCase* parent, bool modal, return; } - HOMARD::ListGroupType_var maListe = aBoundary->GetGroups(); + ADAPT::ListGroupType_var maListe = aBoundary->GetGroups(); for ( int i = 0; i < maListe->length(); i++ ) _listeGroupesBoundary << QString(maListe[i]); @@ -95,10 +95,10 @@ void MonEditBoundaryDi::SetFiltrage() QObject::tr("HOM_BOUN_CASE") ); return; } - HOMARD::HOMARD_Cas_var monCas= myHomardGen->GetCase(_aCaseName.toStdString().c_str()); - HOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups(); + ADAPT::HOMARD_Cas_var monCas= myHomardGen->GetCase(_aCaseName.toStdString().c_str()); + ADAPT::ListGroupType_var _listeGroupesCas = monCas->GetGroups(); - MonEditListGroup *aDlg = new MonEditListGroup(NULL, this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), + MonEditListGroup *aDlg = new MonEditListGroup(NULL, this, true, ADAPT::ADAPT_Gen::_duplicate(myHomardGen), _aCaseName, _listeGroupesBoundary) ; aDlg->show(); } diff --git a/src/ADAPTGUI/MonEditBoundaryDi.h b/src/ADAPTGUI/MonEditBoundaryDi.h index 123b12340..97cdc7fe4 100644 --- a/src/ADAPTGUI/MonEditBoundaryDi.h +++ b/src/ADAPTGUI/MonEditBoundaryDi.h @@ -26,7 +26,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include @@ -35,7 +35,7 @@ class HOMARD_EXPORT MonEditBoundaryDi : public MonCreateBoundaryDi Q_OBJECT public: MonEditBoundaryDi( MonCreateCase* parent, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString caseName, QString Name ); virtual ~MonEditBoundaryDi(); diff --git a/src/ADAPTGUI/MonEditCase.cxx b/src/ADAPTGUI/MonEditCase.cxx index d6304c54c..4ed612213 100644 --- a/src/ADAPTGUI/MonEditCase.cxx +++ b/src/ADAPTGUI/MonEditCase.cxx @@ -32,7 +32,7 @@ using namespace std; */ // ------------------------------------------------------------- MonEditCase::MonEditCase ( bool modal, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString CaseName ): MonCreateCase(modal, myHomardGen) { @@ -61,7 +61,7 @@ void MonEditCase::InitValEdit() PushDir->setVisible(0); QString _aitername=aCase->GetIter0Name(); - HOMARD::HOMARD_Iteration_var aIter = myHomardGen->GetIteration(_aitername.toStdString().c_str()); + ADAPT::HOMARD_Iteration_var aIter = myHomardGen->GetIteration(_aitername.toStdString().c_str()); QString aFileName = aIter->GetMeshFile(); LEFileName->setText(aFileName); LEFileName->setReadOnly(true); @@ -84,7 +84,7 @@ void MonEditCase::InitValEdit() GBBoundaryD->setVisible(0); GBBoundaryA->setVisible(0); // On passe en revue tous les couples (frontiere,groupe) du cas - HOMARD::ListBoundaryGroupType_var mesBoundarys = aCase->GetBoundaryGroup(); + ADAPT::ListBoundaryGroupType_var mesBoundarys = aCase->GetBoundaryGroup(); if (mesBoundarys->length()>0) { QStringList ListeFron ; @@ -98,7 +98,7 @@ void MonEditCase::InitValEdit() NomFron = mesBoundarys[i++]; MESSAGE("NomFron "<GetBoundary(NomFron.toStdString().c_str()); + ADAPT::HOMARD_Boundary_var myBoundary = myHomardGen->GetBoundary(NomFron.toStdString().c_str()); int type_obj = myBoundary->GetType() ; MESSAGE("type_obj "< #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include @@ -35,7 +35,7 @@ class HOMARD_EXPORT MonEditCase : public MonCreateCase Q_OBJECT public: MonEditCase( bool modal, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString Name ); virtual ~MonEditCase(); diff --git a/src/ADAPTGUI/MonEditFile.cxx b/src/ADAPTGUI/MonEditFile.cxx index 773b9f394..b1ee709ee 100644 --- a/src/ADAPTGUI/MonEditFile.cxx +++ b/src/ADAPTGUI/MonEditFile.cxx @@ -43,7 +43,7 @@ using namespace std; * --------------------------------------------------------- */ MonEditFile::MonEditFile( QWidget* parent, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString aFileName, int option): // QWidget(0), Ui_EditFile(), diff --git a/src/ADAPTGUI/MonEditFile.h b/src/ADAPTGUI/MonEditFile.h index 62687b8be..cf34d7f2e 100644 --- a/src/ADAPTGUI/MonEditFile.h +++ b/src/ADAPTGUI/MonEditFile.h @@ -27,7 +27,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include CORBA_CLIENT_HEADER(HOMARD_Cas) #include "ui_EditFile.h" @@ -42,14 +42,14 @@ class HOMARD_EXPORT MonEditFile : public QWidget, public Ui_EditFile public: MonEditFile( QWidget* parent, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString FileName, int option ); ~MonEditFile(); int _codret ; protected : - HOMARD::HOMARD_Gen_var myHomardGen; + ADAPT::ADAPT_Gen_var myHomardGen; QString _aFileName ; int _option ; diff --git a/src/ADAPTGUI/MonEditHypothesis.cxx b/src/ADAPTGUI/MonEditHypothesis.cxx index d7dd550c7..35fd32103 100644 --- a/src/ADAPTGUI/MonEditHypothesis.cxx +++ b/src/ADAPTGUI/MonEditHypothesis.cxx @@ -30,7 +30,7 @@ using namespace std; // ---------------------------------------------------------------------------- MonEditHypothesis::MonEditHypothesis( MonCreateIteration* parent, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString Name, QString caseName, QString aFieldFile ): // ---------------------------------------------------------------------------- @@ -55,7 +55,7 @@ MonEditHypothesis::~MonEditHypothesis() void MonEditHypothesis::InitGroupes() // ------------------------------ { - HOMARD::ListGroupType_var maListe = aHypothesis->GetGroups(); + ADAPT::ListGroupType_var maListe = aHypothesis->GetGroups(); for ( int i = 0; i < maListe->length(); i++ ) _aListeGroupes << QString(maListe[i]); @@ -69,7 +69,7 @@ void MonEditHypothesis::InitValEdit() MESSAGE("Debut de InitValEdit"); LEName->setText(_Name); LEName->setReadOnly(true); - HOMARD::listeTypes_var ListTypes (aHypothesis->GetAdapRefinUnRef()); + ADAPT::listeTypes_var ListTypes (aHypothesis->GetAdapRefinUnRef()); ASSERT( ListTypes->length()==3) ; _aTypeAdap = ListTypes[0]; _aTypeRaff = ListTypes[1]; @@ -214,7 +214,7 @@ void MonEditHypothesis::InitAdaptZone() // Recuperation de toutes les zones decrites et notation de celles retenues GetAllZones(); - HOMARD::listeZonesHypo_var mesZonesAvant = aHypothesis->GetZones(); + ADAPT::listeZonesHypo_var mesZonesAvant = aHypothesis->GetZones(); for (int i=0; ilength(); i++) { MESSAGE ("i"<setEnabled(false); RBZone->setEnabled(false); - HOMARD::InfosHypo_var aInfosHypo = aHypothesis->GetField(); + ADAPT::InfosHypo_var aInfosHypo = aHypothesis->GetField(); _aFieldName = aInfosHypo->FieldName; _TypeThR = aInfosHypo->TypeThR; _ThreshR = aInfosHypo->ThreshR; @@ -284,7 +284,7 @@ void MonEditHypothesis::InitAdaptChamps() CBFieldName->setEnabled(false); //SetFieldName(Qt::Unchecked); - HOMARD::listeComposantsHypo_var mesComposantsAvant = aHypothesis->GetComps(); + ADAPT::listeComposantsHypo_var mesComposantsAvant = aHypothesis->GetComps(); TWCMP->clear(); TWCMP->setRowCount(0); TWCMP->resizeRowsToContents(); @@ -397,7 +397,7 @@ void MonEditHypothesis::InitFieldInterp() RBFieldChosen->setChecked(true); // TWField->setVisible(1); - HOMARD::listeFieldInterpsHypo_var mesChampsAvant = aHypothesis->GetFieldInterps(); + ADAPT::listeFieldInterpsHypo_var mesChampsAvant = aHypothesis->GetFieldInterps(); TWField->clear(); TWField->setRowCount(0); TWField->resizeRowsToContents(); @@ -456,7 +456,7 @@ void MonEditHypothesis::SetFiltrage() { if (CBGroupe->isChecked()) { - MonEditListGroup *aDlg = new MonEditListGroup(this, NULL, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),_aCaseName, _aListeGroupes) ; + MonEditListGroup *aDlg = new MonEditListGroup(this, NULL, true, ADAPT::ADAPT_Gen::_duplicate(myHomardGen),_aCaseName, _aListeGroupes) ; aDlg->show(); } } diff --git a/src/ADAPTGUI/MonEditHypothesis.h b/src/ADAPTGUI/MonEditHypothesis.h index 051365b01..7bf402e9a 100644 --- a/src/ADAPTGUI/MonEditHypothesis.h +++ b/src/ADAPTGUI/MonEditHypothesis.h @@ -26,7 +26,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include @@ -35,7 +35,7 @@ class HOMARD_EXPORT MonEditHypothesis : public MonCreateHypothesis Q_OBJECT public: MonEditHypothesis( MonCreateIteration* parent, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString caseName, QString Name, QString aFieldFile ); virtual ~MonEditHypothesis(); diff --git a/src/ADAPTGUI/MonEditIteration.cxx b/src/ADAPTGUI/MonEditIteration.cxx index e158f27cf..2a5203af5 100644 --- a/src/ADAPTGUI/MonEditIteration.cxx +++ b/src/ADAPTGUI/MonEditIteration.cxx @@ -28,7 +28,7 @@ using namespace std; // ------------------------------------------------------------------------------------------------------------------------------------- MonEditIteration::MonEditIteration ( QWidget* parent, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString IterParentName, QString IterName ): // ------------------------------------------------------------------------------------------------------------------------------------- /* Constructs a MonEditIteration @@ -118,7 +118,7 @@ void MonEditIteration::InitValEdit() PBHypoNew->setVisible(0); // Pour une adaptation selon un champ - HOMARD::HOMARD_Hypothesis_var myHypo = myHomardGen->GetHypothesis(HypoName.toStdString().c_str()) ; + ADAPT::HOMARD_Hypothesis_var myHypo = myHomardGen->GetHypothesis(HypoName.toStdString().c_str()) ; _aTypeAdap = myHypo->GetAdapType() ; if ( _aTypeAdap == 1 ) { diff --git a/src/ADAPTGUI/MonEditIteration.h b/src/ADAPTGUI/MonEditIteration.h index 0107d4b26..3fa4084b7 100644 --- a/src/ADAPTGUI/MonEditIteration.h +++ b/src/ADAPTGUI/MonEditIteration.h @@ -26,7 +26,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include @@ -35,7 +35,7 @@ class HOMARD_EXPORT MonEditIteration : public MonCreateIteration Q_OBJECT public: MonEditIteration( QWidget* parent, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString IterParentName, QString Name ); virtual ~MonEditIteration(); diff --git a/src/ADAPTGUI/MonEditListGroup.cxx b/src/ADAPTGUI/MonEditListGroup.cxx index d8a68150a..19f096138 100644 --- a/src/ADAPTGUI/MonEditListGroup.cxx +++ b/src/ADAPTGUI/MonEditListGroup.cxx @@ -25,7 +25,7 @@ using namespace std; MonEditListGroup::MonEditListGroup( MonCreateHypothesis* parentHyp, MonCreateBoundaryDi* parentBound, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo): //--------------------------------------------------------------------- diff --git a/src/ADAPTGUI/MonEditListGroup.h b/src/ADAPTGUI/MonEditListGroup.h index 8ea41c935..d789abf48 100644 --- a/src/ADAPTGUI/MonEditListGroup.h +++ b/src/ADAPTGUI/MonEditListGroup.h @@ -26,7 +26,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include @@ -37,7 +37,7 @@ class HOMARD_EXPORT MonEditListGroup : public MonCreateListGroup Q_OBJECT public: - MonEditListGroup( MonCreateHypothesis* parentHyp, MonCreateBoundaryDi* parentBound, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); + MonEditListGroup( MonCreateHypothesis* parentHyp, MonCreateBoundaryDi* parentBound, bool modal, ADAPT::ADAPT_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); virtual ~MonEditListGroup(); protected : diff --git a/src/ADAPTGUI/MonEditListGroupCAO.cxx b/src/ADAPTGUI/MonEditListGroupCAO.cxx index 5c942fd5a..18a0d3f52 100644 --- a/src/ADAPTGUI/MonEditListGroupCAO.cxx +++ b/src/ADAPTGUI/MonEditListGroupCAO.cxx @@ -25,7 +25,7 @@ using namespace std; MonEditListGroupCAO::MonEditListGroupCAO( MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo): //--------------------------------------------------------------------- diff --git a/src/ADAPTGUI/MonEditListGroupCAO.h b/src/ADAPTGUI/MonEditListGroupCAO.h index 4f6ada6db..90dfb1967 100644 --- a/src/ADAPTGUI/MonEditListGroupCAO.h +++ b/src/ADAPTGUI/MonEditListGroupCAO.h @@ -26,7 +26,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include @@ -37,7 +37,7 @@ 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); + MonEditListGroupCAO( MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound, bool modal, ADAPT::ADAPT_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); virtual ~MonEditListGroupCAO(); protected : diff --git a/src/ADAPTGUI/MonEditYACS.cxx b/src/ADAPTGUI/MonEditYACS.cxx index 0c41e5b56..51fff9cb3 100644 --- a/src/ADAPTGUI/MonEditYACS.cxx +++ b/src/ADAPTGUI/MonEditYACS.cxx @@ -32,7 +32,7 @@ using namespace std; */ // ------------------------------------------------------------- MonEditYACS::MonEditYACS ( bool modal, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString Name ): MonCreateYACS(myHomardGen, Name) { diff --git a/src/ADAPTGUI/MonEditYACS.h b/src/ADAPTGUI/MonEditYACS.h index 11fe76d01..f8d3a48d5 100644 --- a/src/ADAPTGUI/MonEditYACS.h +++ b/src/ADAPTGUI/MonEditYACS.h @@ -26,7 +26,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include @@ -35,7 +35,7 @@ class HOMARD_EXPORT MonEditYACS : public MonCreateYACS Q_OBJECT public: MonEditYACS( bool modal, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString Name ); virtual ~MonEditYACS(); diff --git a/src/ADAPTGUI/MonEditZone.cxx b/src/ADAPTGUI/MonEditZone.cxx index acab891eb..3bb2c98da 100644 --- a/src/ADAPTGUI/MonEditZone.cxx +++ b/src/ADAPTGUI/MonEditZone.cxx @@ -32,7 +32,7 @@ using namespace std; // ------------------------------------------------------------------------ MonEditZone::MonEditZone( MonCreateHypothesis* parent, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString caseName, QString Name ): // ------------------------------------------------------------------------ /* Constructs a MonEditZone @@ -113,7 +113,7 @@ void MonEditZone::InitValEdit() void MonEditZone::InitValZoneLimit() // ------------------------------------------------------------------------ { - HOMARD::double_array_var mesCoordLimits = aZone->GetLimit(); + ADAPT::double_array_var mesCoordLimits = aZone->GetLimit(); ASSERT(mesCoordLimits->length() == 3 ); _Xincr=mesCoordLimits[0]; _Yincr=mesCoordLimits[1]; @@ -123,7 +123,7 @@ void MonEditZone::InitValZoneLimit() void MonEditZone::InitValZoneBox() // ------------------------------------------------------------------------ { - HOMARD::double_array_var mesCoordZones = aZone->GetCoords(); + ADAPT::double_array_var mesCoordZones = aZone->GetCoords(); ASSERT(mesCoordZones->length() == 6 ); _ZoneXmin=mesCoordZones[0]; _ZoneXmax=mesCoordZones[1]; @@ -136,7 +136,7 @@ void MonEditZone::InitValZoneBox() void MonEditZone::InitValZoneSphere() // ------------------------------------------------------------------------ { - HOMARD::double_array_var mesCoordZones = aZone->GetCoords(); + ADAPT::double_array_var mesCoordZones = aZone->GetCoords(); ASSERT(mesCoordZones->length() == 4 ); _ZoneXcentre=mesCoordZones[0]; _ZoneYcentre=mesCoordZones[1]; @@ -148,7 +148,7 @@ void MonEditZone::InitValZoneSphere() void MonEditZone::InitValZoneCylinder() // ------------------------------------------------------------------------ { - HOMARD::double_array_var mesCoordZones = aZone->GetCoords(); + ADAPT::double_array_var mesCoordZones = aZone->GetCoords(); ASSERT(mesCoordZones->length() == 8 ); _ZoneXcentre=mesCoordZones[0]; _ZoneYcentre=mesCoordZones[1]; @@ -163,7 +163,7 @@ void MonEditZone::InitValZoneCylinder() void MonEditZone::InitValZonePipe() // ------------------------------------------------------------------------ { - HOMARD::double_array_var mesCoordZones = aZone->GetCoords(); + ADAPT::double_array_var mesCoordZones = aZone->GetCoords(); ASSERT(mesCoordZones->length() == 9 ); _ZoneXcentre=mesCoordZones[0]; _ZoneYcentre=mesCoordZones[1]; diff --git a/src/ADAPTGUI/MonEditZone.h b/src/ADAPTGUI/MonEditZone.h index 6570d263e..726a1d933 100644 --- a/src/ADAPTGUI/MonEditZone.h +++ b/src/ADAPTGUI/MonEditZone.h @@ -26,7 +26,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include @@ -35,7 +35,7 @@ class HOMARD_EXPORT MonEditZone : public MonCreateZone Q_OBJECT public: MonEditZone( MonCreateHypothesis* parent, bool modal, - HOMARD::HOMARD_Gen_var myHomardGen, + ADAPT::ADAPT_Gen_var myHomardGen, QString caseName, QString Name); virtual ~MonEditZone(); diff --git a/src/ADAPTGUI/MonIterInfo.cxx b/src/ADAPTGUI/MonIterInfo.cxx index b361d29e8..4a789439c 100644 --- a/src/ADAPTGUI/MonIterInfo.cxx +++ b/src/ADAPTGUI/MonIterInfo.cxx @@ -33,7 +33,7 @@ using namespace std; // ----------------------------------------------------------------------------------------- -MonIterInfo::MonIterInfo(QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen0, QString IterName) +MonIterInfo::MonIterInfo(QWidget* parent, bool modal, ADAPT::ADAPT_Gen_var myHomardGen0, QString IterName) // ----------------------------------------------------------------------------------------- /* Constructs a MonIterInfo * Inherits from CasHomard @@ -51,7 +51,7 @@ MonIterInfo::MonIterInfo(QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myH _Option(-1) { MESSAGE("appel de _duplicate"); - myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + myHomardGen=ADAPT::ADAPT_Gen::_duplicate(myHomardGen0); setupUi(this); setModal(modal); InitConnect(); @@ -112,7 +112,7 @@ bool MonIterInfo::PushOnApply() // Le bilan de l'analyse a afficher QString aFileName = aIter->GetFileInfo() ; - MonEditFile *aDlg = new MonEditFile( 0, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), aFileName, 0 ) ; + MonEditFile *aDlg = new MonEditFile( 0, true, ADAPT::ADAPT_Gen::_duplicate(myHomardGen), aFileName, 0 ) ; if ( aDlg->_codret == 0 ) { aDlg->show(); } diff --git a/src/ADAPTGUI/MonIterInfo.h b/src/ADAPTGUI/MonIterInfo.h index 358c3baf4..5ce8cf742 100644 --- a/src/ADAPTGUI/MonIterInfo.h +++ b/src/ADAPTGUI/MonIterInfo.h @@ -26,7 +26,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include CORBA_CLIENT_HEADER(HOMARD_Cas) #include "ui_IterInfo.h" @@ -40,11 +40,11 @@ class HOMARD_EXPORT MonIterInfo : public QDialog, public Ui_IterInfo Q_OBJECT public: - MonIterInfo( QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString IterName); + MonIterInfo( QWidget* parent, bool modal, ADAPT::ADAPT_Gen_var myHomardGen, QString IterName); ~MonIterInfo(); protected : - MonIterInfo( QWidget* parent, HOMARD::HOMARD_Gen_var myHomardGen, QString IterName ); + MonIterInfo( QWidget* parent, ADAPT::ADAPT_Gen_var myHomardGen, QString IterName ); QString _IterName; QString _aCaseName; @@ -56,8 +56,8 @@ protected : int _Quality; int _Option; - HOMARD::HOMARD_Iteration_var aIter ; - HOMARD::HOMARD_Gen_var myHomardGen; + ADAPT::HOMARD_Iteration_var aIter ; + ADAPT::ADAPT_Gen_var myHomardGen; virtual void InitConnect(); diff --git a/src/ADAPTGUI/MonMeshInfo.cxx b/src/ADAPTGUI/MonMeshInfo.cxx index 7c5e92899..b172e38e1 100644 --- a/src/ADAPTGUI/MonMeshInfo.cxx +++ b/src/ADAPTGUI/MonMeshInfo.cxx @@ -36,7 +36,7 @@ using namespace std; // ----------------------------------------------------------------------------------------- -MonMeshInfo::MonMeshInfo(QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen0) +MonMeshInfo::MonMeshInfo(QWidget* parent, bool modal, ADAPT::ADAPT_Gen_var myHomardGen0) // ----------------------------------------------------------------------------------------- /* Constructs a MonMeshInfo * Inherits from CasHomard @@ -51,7 +51,7 @@ MonMeshInfo::MonMeshInfo(QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myH _Entanglement(0), _Quality(0) { - myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + myHomardGen=ADAPT::ADAPT_Gen::_duplicate(myHomardGen0); setupUi(this); setModal(modal); InitConnect(); @@ -168,9 +168,9 @@ bool MonMeshInfo::PushOnApply() // Le bilan de l'analyse a afficher aCase = myHomardGen->GetCase(_aCaseName.toStdString().c_str()); string iter0 = aCase->GetIter0Name(); - HOMARD::HOMARD_Iteration_var aIter = myHomardGen->GetIteration(iter0.c_str()); + ADAPT::HOMARD_Iteration_var aIter = myHomardGen->GetIteration(iter0.c_str()); aFileName = aIter->GetFileInfo() ; - MonEditFile *aDlg = new MonEditFile( 0, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), aFileName, 1 ) ; + MonEditFile *aDlg = new MonEditFile( 0, true, ADAPT::ADAPT_Gen::_duplicate(myHomardGen), aFileName, 1 ) ; if ( aDlg->_codret == 0 ) { aDlg->show(); } HOMARD_UTILS::updateObjBrowser(); @@ -194,7 +194,7 @@ void MonMeshInfo::PushOnHelp() void MonMeshInfo::SetNewCaseName() // ------------------------------ { - HOMARD::listeCases_var MyCases = myHomardGen->GetAllCasesName(); + ADAPT::listeCases_var MyCases = myHomardGen->GetAllCasesName(); int num = 0; QString aCaseName=""; while (aCaseName=="" ) { diff --git a/src/ADAPTGUI/MonMeshInfo.h b/src/ADAPTGUI/MonMeshInfo.h index 55a31fe34..132ce89de 100644 --- a/src/ADAPTGUI/MonMeshInfo.h +++ b/src/ADAPTGUI/MonMeshInfo.h @@ -26,7 +26,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include CORBA_CLIENT_HEADER(HOMARD_Cas) #include "ui_MeshInfo.h" @@ -37,7 +37,7 @@ class HOMARD_EXPORT MonMeshInfo : public QDialog, public Ui_MeshInfo Q_OBJECT public: - MonMeshInfo( QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen); + MonMeshInfo( QWidget* parent, bool modal, ADAPT::ADAPT_Gen_var myHomardGen); ~MonMeshInfo(); protected : @@ -50,8 +50,8 @@ protected : int _Entanglement; int _Quality; - HOMARD::HOMARD_Cas_var aCase ; - HOMARD::HOMARD_Gen_var myHomardGen; + ADAPT::HOMARD_Cas_var aCase ; + ADAPT::ADAPT_Gen_var myHomardGen; virtual void InitConnect(); virtual void SetNewCaseName(); diff --git a/src/ADAPTGUI/MonPursueIteration.cxx b/src/ADAPTGUI/MonPursueIteration.cxx index b6c76d407..b929d5810 100644 --- a/src/ADAPTGUI/MonPursueIteration.cxx +++ b/src/ADAPTGUI/MonPursueIteration.cxx @@ -39,13 +39,13 @@ using namespace std; * Sets attributes to default values */ // ----------------------------------------------------------------------------------------- -MonPursueIteration::MonPursueIteration ( bool modal, HOMARD::HOMARD_Gen_var myHomardGen0 ) +MonPursueIteration::MonPursueIteration ( bool modal, ADAPT::ADAPT_Gen_var myHomardGen0 ) : Ui_PursueIteration(), _aCaseName(""), _aDirName(""), _aDirNameStart("") { MESSAGE("Debut du constructeur de MonPursueIteration"); - myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + myHomardGen=ADAPT::ADAPT_Gen::_duplicate(myHomardGen0); setupUi(this); setModal(modal); @@ -221,7 +221,7 @@ void MonPursueIteration::PushOnHelp() void MonPursueIteration::SetNewCaseName() // ------------------------------ { - HOMARD::listeCases_var MyCases = myHomardGen->GetAllCasesName(); + ADAPT::listeCases_var MyCases = myHomardGen->GetAllCasesName(); int num = 0; QString aCaseName=""; while (aCaseName=="" ) { diff --git a/src/ADAPTGUI/MonPursueIteration.h b/src/ADAPTGUI/MonPursueIteration.h index fbeda6f75..367f9141d 100644 --- a/src/ADAPTGUI/MonPursueIteration.h +++ b/src/ADAPTGUI/MonPursueIteration.h @@ -26,7 +26,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(ADAPT_Gen) #include CORBA_CLIENT_HEADER(HOMARD_Cas) #include "ui_PursueIteration.h" @@ -37,7 +37,7 @@ class HOMARD_EXPORT MonPursueIteration : public QDialog, public Ui_PursueIterati Q_OBJECT public: - MonPursueIteration( bool modal, HOMARD::HOMARD_Gen_var myHomardGen ); + MonPursueIteration( bool modal, ADAPT::ADAPT_Gen_var myHomardGen ); virtual ~MonPursueIteration(); protected : @@ -47,8 +47,8 @@ class HOMARD_EXPORT MonPursueIteration : public QDialog, public Ui_PursueIterati int _Type ; - HOMARD::HOMARD_Cas_var aCase ; - HOMARD::HOMARD_Gen_var myHomardGen; + ADAPT::HOMARD_Cas_var aCase ; + ADAPT::ADAPT_Gen_var myHomardGen; virtual void InitConnect(); virtual void SetNewCaseName(); diff --git a/src/ADAPT_I/ADAPT_Gen_i.cxx b/src/ADAPT_I/ADAPT_Gen_i.cxx new file mode 100644 index 000000000..6b055fd62 --- /dev/null +++ b/src/ADAPT_I/ADAPT_Gen_i.cxx @@ -0,0 +1,5432 @@ +// 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 +// 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 "ADAPT_Gen_i.hxx" +#include "HOMARD_Cas_i.hxx" +#include "HOMARD_Hypothesis_i.hxx" +#include "HOMARD_Iteration_i.hxx" +#include "HOMARD_Boundary_i.hxx" +#include "HOMARD_Zone_i.hxx" +#include "HOMARD_YACS_i.hxx" +#include "HomardDriver.hxx" +#include "HOMARD_DriverTools.hxx" +#include "HomardMedCommun.h" +#include "YACSDriver.hxx" +#include "HOMARD.hxx" + +#include "FrontTrack.hxx" + +#include "SMESH_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 +#include +#ifndef WIN32 +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef WIN32 +#include +#endif + +using namespace std; + +//============================================================================= +//functions +//============================================================================= +std::string RemoveTabulation( std::string theScript ) +{ + std::string::size_type aPos = 0; + while( aPos < theScript.length() ) + { + aPos = theScript.find( "\n\t", aPos ); + if( aPos == std::string::npos ) + break; + theScript.replace( aPos, 2, "\n" ); + aPos++; + } + return theScript; +} +//============================================================================= +/*! + * standard constructor + */ +//============================================================================= +ADAPT_Gen_i::ADAPT_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) +{ + MESSAGE("constructor"); + _thisObj = this; + _id = _poa->activate_object(_thisObj); + + myHomard = new ::ADAPT_Gen(); + _NS = SINGLETON_::Instance(); + ASSERT(SINGLETON_::IsAlreadyExisting()); + _NS->init_orb(_orb); + + myStudy = SALOMEDS::Study::_duplicate( SMESH_Gen_i::getStudyServant() ); + + _tag_gene = 0 ; + _tag_boun = 0 ; + _tag_hypo = 0 ; + _tag_yacs = 0 ; + _tag_zone = 0 ; + + SetPreferences( ) ; +} +//================================= +/*! + * standard destructor + */ +//================================ +ADAPT_Gen_i::~ADAPT_Gen_i() +{ +} +//============================================================================= +//============================================================================= +// Utilitaires pour l'étude +//============================================================================= +//============================================================================= +void ADAPT_Gen_i::UpdateStudy() +{ + ASSERT(!CORBA::is_nil(myStudy)); + SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder(); + + // Create SComponent labelled 'homard' if it doesn't already exit + SALOMEDS::SComponent_var homardFather = myStudy->FindComponent(ComponentDataType()); + if (CORBA::is_nil(homardFather)) + { + myBuilder->NewCommand(); + MESSAGE("Add Component HOMARD"); + + bool aLocked = myStudy->GetProperties()->IsLocked(); + if (aLocked) myStudy->GetProperties()->SetLocked(false); + + 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::Acomponent_var Comp = Catalogue->GetComponent(ComponentDataType()); + if (!Comp->_is_nil()) + { + aName->SetValue(ComponentDataType()); + } + + anAttr = myBuilder->FindOrCreateAttribute(homardFather,"AttributePixMap"); + SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap("HOMARD_2.png"); + myBuilder->DefineComponentInstance(homardFather, ADAPT_Gen::_this()); + + if (aLocked) myStudy->GetProperties()->SetLocked(true); + myBuilder->CommitCommand(); + } +} + +//============================================================================= +//============================================================================= +// Utilitaires pour l'iteration +//============================================================================= +//============================================================================= +void ADAPT_Gen_i::SetEtatIter(const char* nomIter, const CORBA::Long Etat) +//===================================================================================== +{ + MESSAGE( "SetEtatIter : affectation de l'etat " << Etat << " a l'iteration " << nomIter ); + ADAPT::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[nomIter]; + if (CORBA::is_nil(myIteration)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid iteration"; + throw SALOME::SALOME_Exception(es); + return ; + }; + + myIteration->SetState(Etat); + + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + SALOMEDS::SObject_var aIterSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIteration))); + + std::string icone ; + if ( Etat <= 0 ) + icone = "iter0.png" ; + else if ( Etat == 2 ) + icone = "iter_calculee.png" ; + else + icone = "iter_non_calculee.png" ; + PublishInStudyAttr(aStudyBuilder, aIterSO, NULL , NULL, icone.c_str(), NULL) ; + + aStudyBuilder->CommitCommand(); + +} +//============================================================================= +//============================================================================= +// +//============================================================================= +//============================================================================= +// Destruction des structures identifiees par leurs noms +//============================================================================= +//============================================================================= +CORBA::Long ADAPT_Gen_i::DeleteBoundary(const char* BoundaryName) +{ + MESSAGE ( "DeleteBoundary : BoundaryName = " << BoundaryName ); + ADAPT::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; + if (CORBA::is_nil(myBoundary)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid boundary"; + throw SALOME::SALOME_Exception(es); + return 1 ; + }; + +// On verifie que la frontiere n'est plus utilisee + ADAPT::listeCases* maListe = GetAllCasesName(); + int numberOfCases = maListe->length(); + MESSAGE ( ".. Nombre de cas = " << numberOfCases ); + std::string CaseName ; + ADAPT::ListBoundaryGroupType* ListBoundaryGroupType ; + int numberOfitems ; + ADAPT::HOMARD_Cas_var myCase ; + for (int NumeCas = 0; NumeCas< numberOfCases; NumeCas++) + { + CaseName = std::string((*maListe)[NumeCas]); + MESSAGE ( "... Examen du cas = " << CaseName.c_str() ); + myCase = myStudyContext._mesCas[CaseName]; + ASSERT(!CORBA::is_nil(myCase)); + ListBoundaryGroupType = myCase->GetBoundaryGroup(); + numberOfitems = ListBoundaryGroupType->length(); + MESSAGE ( "... number of string for Boundary+Group = " << numberOfitems); + for (int NumBoundary = 0; NumBoundary< numberOfitems; NumBoundary=NumBoundary+2) + { + if ( std::string((*ListBoundaryGroupType)[NumBoundary]) == BoundaryName ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This boundary is used in a case and cannot be deleted."; + throw SALOME::SALOME_Exception(es); + return 2 ; + }; + }; + } + + // comme on a un _var comme pointeur CORBA, on ne se preoccupe pas du delete + myStudyContext._mesBoundarys.erase(BoundaryName); + SALOMEDS::Study::ListOfSObject_var listSO = myStudy->FindObjectByName(BoundaryName, ComponentDataType()); + SALOMEDS::SObject_var aSO =listSO[0]; + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + myStudy->NewBuilder()->RemoveObjectWithChildren(aSO); + + return 0 ; +} +//============================================================================= +CORBA::Long ADAPT_Gen_i::DeleteCase(const char* nomCas, CORBA::Long Option) +{ + // Pour detruire un cas + MESSAGE ( "DeleteCase : nomCas = " << nomCas << ", avec option = " << Option ); + ADAPT::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; + if (CORBA::is_nil(myCase)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid case context"; + throw SALOME::SALOME_Exception(es); + return 1; + }; + // On commence par detruire toutes les iterations en partant de l'initiale et y compris elle + CORBA::String_var nomIter = myCase->GetIter0Name(); + CORBA::Long Option1 = 0 ; + if ( DeleteIterationOption(nomIter, Option1, Option) != 0 ) + { + return 2; + }; + + // comme on a un _var comme pointeur CORBA, on ne se preoccupe pas du delete + myStudyContext._mesCas.erase(nomCas); + SALOMEDS::Study::ListOfSObject_var listSO = myStudy->FindObjectByName(nomCas, ComponentDataType()); + SALOMEDS::SObject_var aSO =listSO[0]; + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + myStudy->NewBuilder()->RemoveObjectWithChildren(aSO); + + return 0 ; +} +//============================================================================= +CORBA::Long ADAPT_Gen_i::DeleteHypo(const char* nomHypo) +{ + MESSAGE ( "DeleteHypo : nomHypo = " << nomHypo ); + ADAPT::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypo]; + if (CORBA::is_nil(myHypo)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid hypothesis"; + throw SALOME::SALOME_Exception(es); + return 1 ; + }; + +// On verifie que l'hypothese n'est plus utilisee + ADAPT::listeIters* maListeIter = myHypo->GetIterations(); + int numberOfIter = maListeIter->length(); + if ( numberOfIter > 0 ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This hypothesis is used in an iteration and cannot be deleted."; + throw SALOME::SALOME_Exception(es); + return 2 ; + }; + + // suppression du lien avec les zones eventuelles + ADAPT::listeZonesHypo* maListe = myHypo->GetZones(); + int numberOfZones = maListe->length(); + MESSAGE ( ".. Nombre de zones = " << numberOfZones ); + for (int NumeZone = 0; NumeZone< numberOfZones; NumeZone++) + { + std::string ZoneName = std::string((*maListe)[NumeZone]); + MESSAGE ( ".. suppression du lien avec la zone = " << ZoneName.c_str() ); + DissociateHypoZone(nomHypo, ZoneName.c_str()) ; + NumeZone += 1 ; + } + + // comme on a un _var comme pointeur CORBA, on ne se preoccupe pas du delete + myStudyContext._mesHypotheses.erase(nomHypo); + SALOMEDS::Study::ListOfSObject_var listSO = myStudy->FindObjectByName(nomHypo, ComponentDataType()); + SALOMEDS::SObject_var aSO =listSO[0]; + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + myStudy->NewBuilder()->RemoveObjectWithChildren(aSO); + + return 0 ; +} +//============================================================================= +CORBA::Long ADAPT_Gen_i::DeleteIteration(const char* nomIter, CORBA::Long Option) +{ + // Option = 0 : On ne supprime pas le fichier du maillage associe + // Option = 1 : On supprime le fichier du maillage associe + // Pour detruire une iteration courante + MESSAGE ( "DeleteIteration : nomIter = " << nomIter << ", avec option = " << Option ); + CORBA::Long Option1 = 1 ; + return DeleteIterationOption(nomIter, Option1, Option); +} +//============================================================================= +CORBA::Long ADAPT_Gen_i::DeleteIterationOption(const char* nomIter, CORBA::Long Option1, CORBA::Long Option2) +{ + // Option1 = 0 : On autorise la destruction de l'iteration 0 + // Option1 = 1 : On interdit la destruction de l'iteration 0 + + // Option2 = 0 : On ne supprime pas le fichier du maillage associe + // Option2 = 1 : On supprime le fichier du maillage associe + MESSAGE ( "DeleteIterationOption : nomIter = " << nomIter << ", avec options = " << Option1<< ", " << Option2 ); + ADAPT::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[nomIter]; + if (CORBA::is_nil(myIteration)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid iteration"; + throw SALOME::SALOME_Exception(es); + return 1 ; + }; + + int numero = myIteration->GetNumber(); + MESSAGE ( "DeleteIterationOption : numero = " << numero ); + if ( numero == 0 && Option1 == 1 ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This iteration cannot be deleted."; + throw SALOME::SALOME_Exception(es); + return 2 ; + }; + + // On detruit recursivement toutes les filles + ADAPT::listeIterFilles* maListe = myIteration->GetIterations(); + int numberOfIter = maListe->length(); + for (int NumeIter = 0; NumeIter< numberOfIter; NumeIter++) + { + std::string nomIterFille = std::string((*maListe)[NumeIter]); + MESSAGE ( ".. appel recursif de DeleteIterationOption pour nomIter = " << nomIterFille.c_str() ); + DeleteIterationOption(nomIterFille.c_str(), Option1, Option2); + } + + // On arrive ici pour une iteration sans fille + MESSAGE ( "Destruction effective de " << nomIter ); + // On commence par invalider l'iteration pour faire le menage des dependances + // et eventuellement du maillage associe + int option ; + if ( numero == 0 ) { option = 0 ; } + else { option = Option2 ; } + InvalideIterOption(nomIter, option) ; + + // Retrait dans la descendance de l'iteration parent + if ( numero > 0 ) + { + std::string nomIterationParent = myIteration->GetIterParentName(); + MESSAGE ( "Retrait dans la descendance de nomIterationParent " << nomIterationParent ); + ADAPT::HOMARD_Iteration_var myIterationParent = myStudyContext._mesIterations[nomIterationParent]; + if (CORBA::is_nil(myIterationParent)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid iteration"; + throw SALOME::SALOME_Exception(es); + return 3 ; + }; + myIterationParent->UnLinkNextIteration(nomIter); + } + + // suppression du lien avec l'hypothese + if ( numero > 0 ) + { + std::string nomHypo = myIteration->GetHypoName(); + ADAPT::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypo]; + ASSERT(!CORBA::is_nil(myHypo)); + myHypo->UnLinkIteration(nomIter); + } + + // comme on a un _var comme pointeur CORBA, on ne se preoccupe pas du delete + myStudyContext._mesIterations.erase(nomIter); + SALOMEDS::Study::ListOfSObject_var listSO = myStudy->FindObjectByName(nomIter, ComponentDataType()); + SALOMEDS::SObject_var aSO =listSO[0]; + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + myStudy->NewBuilder()->RemoveObjectWithChildren(aSO); + // on peut aussi faire RemoveObject +// MESSAGE ( "Au final" ); +// ADAPT::listeIterations* Liste = GetAllIterationsName() ; +// numberOfIter = Liste->length(); +// for (int NumeIter = 0; NumeIter< numberOfIter; NumeIter++) +// { +// std::string nomIterFille = std::string((*Liste)[NumeIter]); +// MESSAGE ( ".. nomIter = " << nomIterFille.c_str() ); +// } + + return 0 ; +} +//============================================================================= +CORBA::Long ADAPT_Gen_i::DeleteYACS(const char* nomYACS, CORBA::Long Option) +{ + // Option = 0 : On ne supprime pas le fichier du schema associe + // Option = 1 : On supprime le fichier du schema associe + MESSAGE ( "DeleteYACS : nomYACS = " << nomYACS << ", avec option = " << Option ); + ADAPT::HOMARD_YACS_var myYACS = myStudyContext._mesYACSs[nomYACS]; + if (CORBA::is_nil(myYACS)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid schema YACS"; + throw SALOME::SALOME_Exception(es); + return 1 ; + }; + // Suppression eventuelle du fichier XML + if ( Option == 1 ) + { + std::string nomFichier = myYACS->GetXMLFile(); + std::string commande = "rm -rf " + nomFichier ; + MESSAGE ( "commande = " << commande ); + if ((system(commande.c_str())) != 0) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The xml file for the schema YACS cannot be removed." ; + throw SALOME::SALOME_Exception(es); + return 2 ; + } + } + // comme on a un _var comme pointeur CORBA, on ne se preoccupe pas du delete + myStudyContext._mesYACSs.erase(nomYACS); + SALOMEDS::Study::ListOfSObject_var listSO = myStudy->FindObjectByName(nomYACS, ComponentDataType()); + SALOMEDS::SObject_var aSO =listSO[0]; + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + myStudy->NewBuilder()->RemoveObjectWithChildren(aSO); + + return 0 ; +} +//============================================================================= +CORBA::Long ADAPT_Gen_i::DeleteZone(const char* nomZone) +{ + MESSAGE ( "DeleteZone : nomZone = " << nomZone ); + ADAPT::HOMARD_Zone_var myZone = myStudyContext._mesZones[nomZone]; + if (CORBA::is_nil(myZone)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid zone"; + throw SALOME::SALOME_Exception(es); + return 1 ; + }; + +// On verifie que la zone n'est plus utilisee + ADAPT::listeHypo* maListe = myZone->GetHypo(); + int numberOfHypo = maListe->length(); + MESSAGE ( ".. Nombre d'hypotheses = " << numberOfHypo ); + if ( numberOfHypo > 0 ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This zone is used in a hypothesis and cannot be deleted."; + throw SALOME::SALOME_Exception(es); + return 2 ; + }; +// + // comme on a un _var comme pointeur CORBA, on ne se preoccupe pas du delete + myStudyContext._mesZones.erase(nomZone); + SALOMEDS::Study::ListOfSObject_var listSO = myStudy->FindObjectByName(nomZone, ComponentDataType()); + SALOMEDS::SObject_var aSO =listSO[0]; + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + myStudy->NewBuilder()->RemoveObjectWithChildren(aSO); + + return 0 ; +} +//============================================================================= +//============================================================================= +// +//============================================================================= +//============================================================================= +// Invalidation des structures identifiees par leurs noms +//============================================================================= +//============================================================================= +void ADAPT_Gen_i::InvalideBoundary(const char* BoundaryName) +{ + MESSAGE( "InvalideBoundary : BoundaryName = " << BoundaryName ); + ADAPT::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; + if (CORBA::is_nil(myBoundary)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid boundary"; + throw SALOME::SALOME_Exception(es); + return ; + } + else + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "No change is allowed in a boundary. Ask for evolution."; + throw SALOME::SALOME_Exception(es); + return ; + }; +} +//============================================================================= +void ADAPT_Gen_i::InvalideHypo(const char* nomHypo) +{ + MESSAGE( "InvalideHypo : nomHypo = " << nomHypo ); + ADAPT::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypo]; + if (CORBA::is_nil(myHypo)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid hypothesis"; + throw SALOME::SALOME_Exception(es); + return ; + }; + + ADAPT::listeIters* maListe = myHypo->GetIterations(); + int numberOfIter = maListe->length(); + for (int NumeIter = 0; NumeIter< numberOfIter; NumeIter++) + { + std::string nomIter = std::string((*maListe)[NumeIter]); + MESSAGE( ".. nomIter = " << nomIter ); + InvalideIter(nomIter.c_str()); + } +} +//============================================================================= +void ADAPT_Gen_i::InvalideIter(const char* nomIter) +{ + MESSAGE("InvalideIter : nomIter = " << nomIter); + // Pour invalider totalement une iteration courante + CORBA::Long Option = 1 ; + return InvalideIterOption(nomIter, Option); +} +//============================================================================= +void ADAPT_Gen_i::InvalideIterOption(const char* nomIter, CORBA::Long Option) +{ + // Option = 0 : On ne supprime pas le fichier du maillage associe + // Option = 1 : On supprime le fichier du maillage associe + MESSAGE ( "InvalideIterOption : nomIter = " << nomIter << ", avec option = " << Option ); + ADAPT::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[nomIter]; + if (CORBA::is_nil(myIteration)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid iteration"; + throw SALOME::SALOME_Exception(es); + return ; + }; + + ADAPT::listeIterFilles* maListe = myIteration->GetIterations(); + int numberOfIter = maListe->length(); + for (int NumeIter = 0; NumeIter< numberOfIter; NumeIter++) + { + std::string nomIterFille = std::string((*maListe)[NumeIter]); + MESSAGE ( ".. appel recursif de InvalideIter pour nomIter = " << nomIterFille.c_str() ); + InvalideIter(nomIterFille.c_str()); + } + + // On arrive ici pour une iteration sans fille + MESSAGE ( "Invalidation effective de " << nomIter ); + SALOMEDS::SObject_var aIterSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIteration))); + SALOMEDS::ChildIterator_var aIter = myStudy->NewChildIterator(aIterSO); + for (; aIter->More(); aIter->Next()) + { + SALOMEDS::SObject_var so = aIter->Value(); + SALOMEDS::GenericAttribute_var anAttr; + if (!so->FindAttribute(anAttr, "AttributeComment")) continue; + SALOMEDS::AttributeComment_var aCommentAttr = SALOMEDS::AttributeComment::_narrow(anAttr); + std::string value (aCommentAttr->Value()); + if(value == std::string("IterationHomard")) continue; + if(value == std::string("HypoHomard")) continue; + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + aStudyBuilder->RemoveObject(so); + } + + int etat = myIteration->GetState(); + if ( etat > 0 ) + { + SetEtatIter(nomIter,1); + const char * nomCas = myIteration->GetCaseName(); + ADAPT::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; + if (CORBA::is_nil(myCase)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid case context"; + throw SALOME::SALOME_Exception(es); + return ; + }; + std::string nomDir = myIteration->GetDirName(); + std::string nomFichier = myIteration->GetMeshFile(); + std::string commande = "rm -rf " + std::string(nomDir); + if ( Option == 1 ) { commande = commande + ";rm -rf " + std::string(nomFichier) ; } + MESSAGE ( "commande = " << commande ); + if ((system(commande.c_str())) != 0) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The directory for the calculation cannot be cleared." ; + throw SALOME::SALOME_Exception(es); + return ; + } + // Suppression du maillage publie dans SMESH + std::string MeshName = myIteration->GetMeshName() ; + DeleteResultInSmesh(nomFichier, MeshName) ; + }; + +} +//============================================================================= +void ADAPT_Gen_i::InvalideIterInfo(const char* nomIter) +{ + MESSAGE("InvalideIterInfo : nomIter = " << nomIter); + ADAPT::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[nomIter]; + if (CORBA::is_nil(myIteration)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid iteration"; + throw SALOME::SALOME_Exception(es); + return ; + }; + + SALOMEDS::SObject_var aIterSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIteration))); + SALOMEDS::ChildIterator_var aIter = myStudy->NewChildIterator(aIterSO); + for (; aIter->More(); aIter->Next()) + { + SALOMEDS::SObject_var so = aIter->Value(); + SALOMEDS::GenericAttribute_var anAttr; + if (!so->FindAttribute(anAttr, "AttributeComment")) continue; + SALOMEDS::AttributeComment_var aCommentAttr = SALOMEDS::AttributeComment::_narrow(anAttr); + std::string value (aCommentAttr->Value()); +/* MESSAGE("... value = " << value);*/ + if( (value == std::string("logInfo")) || ( value == std::string("SummaryInfo")) ) + { + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + aStudyBuilder->RemoveObject(so); + } + } + + const char * nomCas = myIteration->GetCaseName(); + ADAPT::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; + if (CORBA::is_nil(myCase)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid case context"; + throw SALOME::SALOME_Exception(es); + return ; + }; + const char* nomDir = myIteration->GetDirName(); + std::string commande = "rm -f " + std::string(nomDir) + "/info* " ; + commande += std::string(nomDir) + "/Liste.*info" ; +/* MESSAGE ( "commande = " << commande );*/ + if ((system(commande.c_str())) != 0) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The directory for the calculation cannot be cleared." ; + throw SALOME::SALOME_Exception(es); + return ; + } +} +//============================================================================= +void ADAPT_Gen_i::InvalideYACS(const char* YACSName) +{ + MESSAGE( "InvalideYACS : YACSName = " << YACSName ); + ADAPT::HOMARD_YACS_var myYACS = myStudyContext._mesYACSs[YACSName]; + if (CORBA::is_nil(myYACS)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid schema YACS"; + throw SALOME::SALOME_Exception(es); + return ; + }; + // + SALOMEDS::SObject_var aYACSSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myYACS))); + SALOMEDS::ChildIterator_var aYACS = myStudy->NewChildIterator(aYACSSO); + for (; aYACS->More(); aYACS->Next()) + { + SALOMEDS::SObject_var so = aYACS->Value(); + SALOMEDS::GenericAttribute_var anAttr; + if (!so->FindAttribute(anAttr, "AttributeComment")) continue; + SALOMEDS::AttributeComment_var aCommentAttr = SALOMEDS::AttributeComment::_narrow(anAttr); + std::string value (aCommentAttr->Value()); + if( value == std::string("xml") ) + { + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + aStudyBuilder->RemoveObject(so); + } + } + std::string nomFichier = myYACS->GetXMLFile(); + std::string commande = "rm -rf " + std::string(nomFichier) ; + MESSAGE ( "commande = " << commande ); + if ((system(commande.c_str())) != 0) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The XML file for the schema YACS cannot be removed." ; + throw SALOME::SALOME_Exception(es); + return ; + } +} +//============================================================================= +void ADAPT_Gen_i::InvalideZone(const char* ZoneName) +{ + MESSAGE( "InvalideZone : ZoneName = " << ZoneName ); + ADAPT::HOMARD_Zone_var myZone = myStudyContext._mesZones[ZoneName]; + if (CORBA::is_nil(myZone)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid zone"; + throw SALOME::SALOME_Exception(es); + return ; + }; + ADAPT::listeHypo* maListe = myZone->GetHypo(); + int numberOfHypo = maListe->length(); + MESSAGE( ".. numberOfHypo = " << numberOfHypo ); + for (int NumeHypo = 0; NumeHypo< numberOfHypo; NumeHypo++) + { + std::string nomHypo = std::string((*maListe)[NumeHypo]); + MESSAGE( ".. nomHypo = " << nomHypo ); + InvalideHypo(nomHypo.c_str()); + } +} +//============================================================================= +//============================================================================= +// +//============================================================================= +//============================================================================= +// Association de lien entre des structures identifiees par leurs noms +//============================================================================= +//============================================================================= +void ADAPT_Gen_i::AssociateCaseIter(const char* nomCas, const char* nomIter, const char* labelIter) +{ + MESSAGE( "AssociateCaseIter : " << nomCas << ", " << nomIter << ", " << labelIter ); + + ADAPT::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; + if (CORBA::is_nil(myCase)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid case"; + throw SALOME::SALOME_Exception(es); + return ; + }; + + ADAPT::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[nomIter]; + if (CORBA::is_nil(myIteration)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid iteration"; + throw SALOME::SALOME_Exception(es); + return ; + }; + + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + SALOMEDS::SObject_var aCasSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myCase))); + if (CORBA::is_nil(aCasSO)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid case"; + throw SALOME::SALOME_Exception(es); + return ; + }; + + aStudyBuilder->NewCommand(); + SALOMEDS::SObject_var newStudyIter = aStudyBuilder->NewObject(aCasSO); + PublishInStudyAttr(aStudyBuilder, newStudyIter, nomIter , labelIter, + "iter_non_calculee.png", _orb->object_to_string(myIteration)) ; + aStudyBuilder->CommitCommand(); + + myCase->AddIteration(nomIter); + myIteration->SetCaseName(nomCas); +} +//===================================================================================== +void ADAPT_Gen_i::AssociateHypoZone(const char* nomHypothesis, const char* ZoneName, CORBA::Long TypeUse) +{ + MESSAGE ( "AssociateHypoZone : nomHypo = " << nomHypothesis << ", ZoneName= " << ZoneName << ", TypeUse = " << TypeUse); + + ADAPT::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypothesis]; + ASSERT(!CORBA::is_nil(myHypo)); + SALOMEDS::SObject_var aHypoSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myHypo))); + ASSERT(!CORBA::is_nil(aHypoSO)); + + ADAPT::HOMARD_Zone_var myZone = myStudyContext._mesZones[ZoneName]; + ASSERT(!CORBA::is_nil(myZone)); + SALOMEDS::SObject_var aZoneSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myZone))); + ASSERT(!CORBA::is_nil(aZoneSO)); + + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + + aStudyBuilder->NewCommand(); + + SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aHypoSO); + aStudyBuilder->Addreference(aSubSO, aZoneSO); + + aStudyBuilder->CommitCommand(); + + myZone->AddHypo(nomHypothesis); + myHypo->AddZone0(ZoneName, TypeUse); +}; +//============================================================================= +void ADAPT_Gen_i::AssociateIterHypo(const char* nomIter, const char* nomHypo) +{ + MESSAGE("AssociateIterHypo : nomHypo = " << nomHypo << " nomIter = " << nomIter); + + // Verification de l'existence de l'hypothese + ADAPT::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypo]; + ASSERT(!CORBA::is_nil(myHypo)); + SALOMEDS::SObject_var aHypoSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myHypo))); + ASSERT(!CORBA::is_nil(aHypoSO)); + + // Verification de l'existence de l'iteration + ADAPT::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[nomIter]; + ASSERT(!CORBA::is_nil(myIteration)); + SALOMEDS::SObject_var aIterSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIteration))); + ASSERT(!CORBA::is_nil(aIterSO)); + + // Gestion de l'arbre d'etudes + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + aStudyBuilder->NewCommand(); + SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aIterSO); + aStudyBuilder->Addreference(aSubSO, aHypoSO); + aStudyBuilder->CommitCommand(); + + // Liens reciproques + myIteration->SetHypoName(nomHypo); + myHypo->LinkIteration(nomIter); + + // On stocke les noms des champ a interpoler pour le futur controle de la donnée des pas de temps + myIteration->SupprFieldInterps() ; + ADAPT::listeFieldInterpsHypo* ListField = myHypo->GetFieldInterps(); + int numberOfFieldsx2 = ListField->length(); + for (int iaux = 0; iaux< numberOfFieldsx2; iaux++) + { + std::string FieldName = std::string((*ListField)[iaux]) ; + myIteration->SetFieldInterp(FieldName.c_str()) ; + iaux++ ; + } +}; +//============================================================================= +//============================================================================= +// +//============================================================================= +//============================================================================= +// Dissociation de lien entre des structures identifiees par leurs noms +//============================================================================= +//============================================================================= +void ADAPT_Gen_i::DissociateHypoZone(const char* nomHypothesis, const char* ZoneName) +{ + MESSAGE ( "DissociateHypoZone : ZoneName= " << ZoneName << ", nomHypo = " << nomHypothesis); + + ADAPT::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypothesis]; + ASSERT(!CORBA::is_nil(myHypo)); + SALOMEDS::SObject_var aHypoSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myHypo))); + ASSERT(!CORBA::is_nil(aHypoSO)); + + ADAPT::HOMARD_Zone_var myZone = myStudyContext._mesZones[ZoneName]; + ASSERT(!CORBA::is_nil(myZone)); + SALOMEDS::SObject_var aZoneSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myZone))); + ASSERT(!CORBA::is_nil(aZoneSO)); + + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + + SALOMEDS::ChildIterator_var it = myStudy->NewChildIterator(aHypoSO); + for (; it->More(); it->Next()) + { + SALOMEDS::SObject_var aHypObj = it->Value(); + SALOMEDS::SObject_var ptrObj; + if (aHypObj->ReferencedObject(ptrObj)) + { + if (std::string(ptrObj->GetName()) == std::string(aZoneSO->GetName())) + { + aStudyBuilder->NewCommand(); + aStudyBuilder->RemoveObject(aHypObj); + aStudyBuilder->CommitCommand(); + break; + } + } + } + + myZone->SupprHypo(nomHypothesis); + myHypo->SupprZone(ZoneName); +}; +//============================================================================= +//============================================================================= +// + +//============================================================================= +//============================================================================= +// Recuperation des listes +//============================================================================= +//============================================================================= +ADAPT::listeBoundarys* ADAPT_Gen_i::GetAllBoundarysName() +{ + MESSAGE("GetAllBoundarysName"); + IsValidStudy () ; + + ADAPT::listeBoundarys_var ret = new ADAPT::listeBoundarys; + ret->length(myStudyContext._mesBoundarys.size()); + std::map::const_iterator it; + int i = 0; + for (it = myStudyContext._mesBoundarys.begin(); + it != myStudyContext._mesBoundarys.end(); it++) + { + ret[i++] = CORBA::string_dup((*it).first.c_str()); + } + + return ret._retn(); +} +//============================================================================= +ADAPT::listeCases* ADAPT_Gen_i::GetAllCasesName() +{ + MESSAGE("GetAllCasesName"); + IsValidStudy () ; + + ADAPT::listeCases_var ret = new ADAPT::listeCases; + ret->length(myStudyContext._mesCas.size()); + std::map::const_iterator it; + int i = 0; + for (it = myStudyContext._mesCas.begin(); + it != myStudyContext._mesCas.end(); it++) + { + ret[i++] = CORBA::string_dup((*it).first.c_str()); + } + + return ret._retn(); +} +//============================================================================= +ADAPT::listeHypotheses* ADAPT_Gen_i::GetAllHypothesesName() +{ + MESSAGE("GetAllHypothesesName"); + IsValidStudy () ; + + ADAPT::listeHypotheses_var ret = new ADAPT::listeHypotheses; + ret->length(myStudyContext._mesHypotheses.size()); + std::map::const_iterator it; + int i = 0; + for (it = myStudyContext._mesHypotheses.begin(); + it != myStudyContext._mesHypotheses.end(); it++) + { + ret[i++] = CORBA::string_dup((*it).first.c_str()); + } + + return ret._retn(); +} +//============================================================================= +ADAPT::listeIterations* ADAPT_Gen_i::GetAllIterationsName() +{ + MESSAGE("GetAllIterationsName"); + IsValidStudy () ; + + ADAPT::listeIterations_var ret = new ADAPT::listeIterations; + ret->length(myStudyContext._mesIterations.size()); + std::map::const_iterator it; + int i = 0; + for (it = myStudyContext._mesIterations.begin(); + it != myStudyContext._mesIterations.end(); it++) + { + ret[i++] = CORBA::string_dup((*it).first.c_str()); + } + + return ret._retn(); +} +//============================================================================= +ADAPT::listeYACSs* ADAPT_Gen_i::GetAllYACSsName() +{ + MESSAGE("GetAllYACSsName"); + IsValidStudy () ; + + ADAPT::listeYACSs_var ret = new ADAPT::listeYACSs; + ret->length(myStudyContext._mesYACSs.size()); + std::map::const_iterator it; + int i = 0; + for (it = myStudyContext._mesYACSs.begin(); + it != myStudyContext._mesYACSs.end(); it++) + { + ret[i++] = CORBA::string_dup((*it).first.c_str()); + } + + return ret._retn(); +} +//============================================================================= +ADAPT::listeZones* ADAPT_Gen_i::GetAllZonesName() +{ + MESSAGE("GetAllZonesName"); + IsValidStudy () ; + + ADAPT::listeZones_var ret = new ADAPT::listeZones; + ret->length(myStudyContext._mesZones.size()); + std::map::const_iterator it; + int i = 0; + for (it = myStudyContext._mesZones.begin(); + it != myStudyContext._mesZones.end(); it++) + { + ret[i++] = CORBA::string_dup((*it).first.c_str()); + } + + return ret._retn(); +} +//============================================================================= +//============================================================================= + +//============================================================================= +//============================================================================= +// Recuperation des structures identifiees par leurs noms +//============================================================================= +//============================================================================= +ADAPT::HOMARD_Boundary_ptr ADAPT_Gen_i::GetBoundary(const char* nomBoundary) +{ + ADAPT::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[nomBoundary]; + ASSERT(!CORBA::is_nil(myBoundary)); + return ADAPT::HOMARD_Boundary::_duplicate(myBoundary); +} +//============================================================================= +ADAPT::HOMARD_Cas_ptr ADAPT_Gen_i::GetCase(const char* nomCas) +{ + ADAPT::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; + ASSERT(!CORBA::is_nil(myCase)); + return ADAPT::HOMARD_Cas::_duplicate(myCase); +} +//============================================================================= +ADAPT::HOMARD_Hypothesis_ptr ADAPT_Gen_i::GetHypothesis(const char* nomHypothesis) +{ + ADAPT::HOMARD_Hypothesis_var myHypothesis = myStudyContext._mesHypotheses[nomHypothesis]; + ASSERT(!CORBA::is_nil(myHypothesis)); + return ADAPT::HOMARD_Hypothesis::_duplicate(myHypothesis); +} +//============================================================================= +ADAPT::HOMARD_Iteration_ptr ADAPT_Gen_i::GetIteration(const char* NomIterationation) +{ + ADAPT::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[NomIterationation]; + ASSERT(!CORBA::is_nil(myIteration)); + return ADAPT::HOMARD_Iteration::_duplicate(myIteration); +} +//============================================================================= +ADAPT::HOMARD_YACS_ptr ADAPT_Gen_i::GetYACS(const char* nomYACS) +{ + ADAPT::HOMARD_YACS_var myYACS = myStudyContext._mesYACSs[nomYACS]; + ASSERT(!CORBA::is_nil(myYACS)); + return ADAPT::HOMARD_YACS::_duplicate(myYACS); +} +//============================================================================= +ADAPT::HOMARD_Zone_ptr ADAPT_Gen_i::GetZone(const char* ZoneName) +{ + ADAPT::HOMARD_Zone_var myZone = myStudyContext._mesZones[ZoneName]; + ASSERT(!CORBA::is_nil(myZone)); + return ADAPT::HOMARD_Zone::_duplicate(myZone); +} +//============================================================================= +//============================================================================= + +//============================================================================= +//============================================================================= +// Informations +//============================================================================= +//============================================================================= +void ADAPT_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 ); + IsValidStudy () ; + +// Creation du cas + int option = 1 ; + if ( _PublisMeshIN != 0 ) option = 2 ; + ADAPT::HOMARD_Cas_ptr myCase = CreateCase0(nomCas, MeshName, MeshFile, 1, 0, option) ; + myCase->SetDirName(DirName) ; +// Analyse + myCase->MeshInfo(Qual, Diam, Conn, Tail, Inte) ; + + return ; +} +//============================================================================= +//============================================================================= + +//============================================================================= +//============================================================================= +// Recuperation des structures par le contexte +//============================================================================= +//============================================================================= +ADAPT::HOMARD_Iteration_ptr ADAPT_Gen_i::LastIteration(const char* nomCas) +{ + ADAPT::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; + ASSERT(!CORBA::is_nil(myCase)); +// + ADAPT::HOMARD_Iteration_var myIteration = myCase->LastIteration(); + ASSERT(!CORBA::is_nil(myIteration)); +// + return ADAPT::HOMARD_Iteration::_duplicate(myIteration); +} +//============================================================================= +//============================================================================= + +//============================================================================= +//============================================================================= +// Nouvelles structures +//============================================================================= +//============================================================================= +ADAPT::HOMARD_Cas_ptr ADAPT_Gen_i::newCase() +{ + ADAPT::ADAPT_Gen_var engine = POA_ADAPT::ADAPT_Gen::_this(); + HOMARD_Cas_i* aServant = new HOMARD_Cas_i(_orb, engine); + ADAPT::HOMARD_Cas_var aCase = ADAPT::HOMARD_Cas::_narrow(aServant->_this()); + return aCase._retn(); +} +//============================================================================= +ADAPT::HOMARD_Hypothesis_ptr ADAPT_Gen_i::newHypothesis() +{ + ADAPT::ADAPT_Gen_var engine = POA_ADAPT::ADAPT_Gen::_this(); + HOMARD_Hypothesis_i* aServant = new HOMARD_Hypothesis_i(_orb, engine); + ADAPT::HOMARD_Hypothesis_var aHypo = ADAPT::HOMARD_Hypothesis::_narrow(aServant->_this()); + return aHypo._retn(); +} +//============================================================================= +ADAPT::HOMARD_Iteration_ptr ADAPT_Gen_i::newIteration() +{ + ADAPT::ADAPT_Gen_var engine = POA_ADAPT::ADAPT_Gen::_this(); + HOMARD_Iteration_i* aServant = new HOMARD_Iteration_i(_orb, engine); + ADAPT::HOMARD_Iteration_var aIter = ADAPT::HOMARD_Iteration::_narrow(aServant->_this()); + return aIter._retn(); +} +//============================================================================= +ADAPT::HOMARD_Boundary_ptr ADAPT_Gen_i::newBoundary() +{ + ADAPT::ADAPT_Gen_var engine = POA_ADAPT::ADAPT_Gen::_this(); + HOMARD_Boundary_i* aServant = new HOMARD_Boundary_i(_orb, engine); + ADAPT::HOMARD_Boundary_var aBoundary = ADAPT::HOMARD_Boundary::_narrow(aServant->_this()); + return aBoundary._retn(); +} +//============================================================================= +ADAPT::HOMARD_Zone_ptr ADAPT_Gen_i::newZone() +{ + ADAPT::ADAPT_Gen_var engine = POA_ADAPT::ADAPT_Gen::_this(); + HOMARD_Zone_i* aServant = new HOMARD_Zone_i(_orb, engine); + ADAPT::HOMARD_Zone_var aZone = ADAPT::HOMARD_Zone::_narrow(aServant->_this()); + return aZone._retn(); +} +//============================================================================= +ADAPT::HOMARD_YACS_ptr ADAPT_Gen_i::newYACS() +{ + ADAPT::ADAPT_Gen_var engine = POA_ADAPT::ADAPT_Gen::_this(); + HOMARD_YACS_i* aServant = new HOMARD_YACS_i(_orb, engine); + ADAPT::HOMARD_YACS_var aYACS = ADAPT::HOMARD_YACS::_narrow(aServant->_this()); + return aYACS._retn(); +} +//============================================================================= +//============================================================================= + +//============================================================================= +//============================================================================= +// Creation des structures identifiees par leurs noms +//============================================================================= +//============================================================================= +ADAPT::HOMARD_Cas_ptr ADAPT_Gen_i::CreateCase(const char* nomCas, const char* MeshName, const char* MeshFile) +// +// Creation d'un cas initial +// nomCas : nom du cas a creer +// MeshName, MeshFile : nom et fichier du maillage correspondant +// +{ + INFOS ( "CreateCase : nomCas = " << nomCas << ", MeshName = " << MeshName << ", MeshFile = " << MeshFile ); + + int option = 1 ; + if ( _PublisMeshIN != 0 ) option = 2 ; + ADAPT::HOMARD_Cas_ptr myCase = CreateCase0(nomCas, MeshName, MeshFile, 0, 0, option) ; + +// Valeurs par defaut des filtrages + myCase->SetPyram(0); + + return ADAPT::HOMARD_Cas::_duplicate(myCase); +} +//============================================================================= +ADAPT::HOMARD_Cas_ptr ADAPT_Gen_i::CreateCaseFromIteration(const char* nomCas, const char* DirNameStart) +// +// nomCas : nom du cas a creer +// DirNameStart : nom du répertoire contenant l'iteration de reprise +// +{ + INFOS ( "CreateCaseFromIteration : nomCas = " << nomCas << ", DirNameStart = " << DirNameStart ); + std::string nomDirWork = getenv("PWD") ; + int codret ; + + // A. Decodage du point de reprise + // A.1. Controle du répertoire de depart de l'iteration + codret = CHDIR(DirNameStart) ; + if ( codret != 0 ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The directory of the iteration does not exist."; + throw SALOME::SALOME_Exception(es); + return 0; + }; + // A.2. Reperage des fichiers du répertoire de reprise + std::string file_configuration = "" ; + std::string file_maillage_homard = "" ; + int bilan ; +#ifndef WIN32 + DIR *dp; + struct dirent *dirp; + dp = opendir(DirNameStart); + while ( (dirp = readdir(dp)) != NULL ) + { + std::string file_name(dirp->d_name); +// MESSAGE ( file_name ); + bilan = file_name.find("HOMARD.Configuration.") ; + if ( bilan != string::npos ) { file_configuration = file_name ; } + bilan = file_name.find("maill.") ; + if ( bilan != string::npos ) + { + bilan = file_name.find(".hom.med") ; + if ( bilan != string::npos ) { file_maillage_homard = file_name ; } + } + } + closedir(dp); +#else + HANDLE hFind = INVALID_HANDLE_VALUE; + WIN32_FIND_DATA ffd; + hFind = FindFirstFile(DirNameStart, &ffd); + if (INVALID_HANDLE_VALUE != hFind) { + while (FindNextFile(hFind, &ffd) != 0) { + if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories + std::string file_name(ffd.cFileName); + bilan = file_name.find("HOMARD.Configuration.") ; + if ( bilan != string::npos ) { file_configuration = file_name ; } + bilan = file_name.find("maill.") ; + if ( bilan != string::npos ) + { + bilan = file_name.find(".hom.med") ; + if ( bilan != string::npos ) { file_maillage_homard = file_name ; } + } + } + FindClose(hFind); + } +#endif + MESSAGE ( "==> file_configuration : " << file_configuration ) ; + MESSAGE ( "==> file_maillage_homard : " << file_maillage_homard ) ; + // A.3. Controle + if ( ( file_configuration == "" ) || ( file_maillage_homard == "" ) ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text ; + if ( file_configuration == "" ) { text = "The configuration file cannot be found." ; } + else { text = "The HOMARD mesh file cannot be found." ; } + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + + // B. Lecture du fichier de configuration + // ATTENTION : on doit veiller a la coherence entre HomardDriver et CreateCaseFromIteration + int NumeIter ; + int TypeExt = 0 ; + int TypeConf = 0 ; + int Pyram = 0 ; + char* MeshName ; + 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 + { + 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 + while ( std::getline( fichier, ligne ) ) + { + // B.1. Pour la ligne courante, on identifie le premier mot : le mot-cle + std::istringstream ligne_bis(ligne); // variable contenant chaque ligne sous forme de flux + ligne_bis >> mot_cle ; + // B.2. Des valeurs entieres : le second bloc de la ligne + if ( mot_cle == "NumeIter" ) + { + ligne_bis >> NumeIter ; + NumeIter += 1 ; + } + // B.3. Des valeurs caracteres brutes : le second bloc de la ligne est la valeur + else if ( ( mot_cle == "TypeConf" ) || ( mot_cle == "TypeElem" ) ) + { + ligne_bis >> argument ; + + if ( mot_cle == "TypeConf" ) + { + if ( argument == "conforme" ) { TypeConf = 1 ; } + else if ( argument == "non_conforme_1_noeud" ) { TypeConf = 2 ; } + else if ( argument == "non_conforme_1_arete" ) { TypeConf = 3 ; } + else if ( argument == "non_conforme_indicateur" ) { TypeConf = 4 ; } + } + else if ( mot_cle == "TypeElem" ) + { + if ( argument == "ignore_pyra" ) { Pyram = 1 ; } + else if ( argument == "HOMARD" ) { Pyram = 0 ; } + } + } + // B.4. Des valeurs caracteres : le deuxieme bloc de la ligne peut etre encadre par des quotes : + // il faut les supprimer + else if ( ( mot_cle == "CCNoMNP1" ) || ( mot_cle == "CCMaiNP1" ) ) + { + ligne_bis >> argument ; + if ( argument[0] == '"' ) { decalage = 1 ; } + else { decalage = 0 ; } + size_t size = argument.size() + 1 - 2*decalage ; + + if ( mot_cle == "CCNoMNP1" ) + { + MeshName = new char[ size ]; + strncpy( MeshName, argument.c_str()+decalage, size ); + MeshName[size-1] = '\0' ; + } + else if ( mot_cle == "CCMaiNP1" ) + { + MeshFile = new char[ size ]; + strncpy( MeshFile, argument.c_str()+decalage, size ); + MeshFile[size-1] = '\0' ; + } + } + } + MESSAGE ( "==> TypeConf : " << TypeConf ) ; + MESSAGE ( "==> MeshName : " << MeshName ) ; + MESSAGE ( "==> MeshFile : " << MeshFile ) ; + MESSAGE ( "==> NumeIter : " << NumeIter ) ; + MESSAGE ( "==> Pyram : " << Pyram ) ; + } + else + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "The configuration file cannot be read." ; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + + // C. Creation effective du cas + + int option = 1 ; + if ( _PublisMeshIN != 0 ) option = 2 ; + ADAPT::HOMARD_Cas_ptr myCase = CreateCase0(nomCas, MeshName, MeshFile, 1, NumeIter, option) ; + + // D. Parametrages lus dans le fichier de configuration + + myCase->SetConfType (TypeConf) ; + myCase->SetExtType (TypeExt) ; + myCase->SetPyram (Pyram) ; + + // E. Copie du fichier de maillage homard + // E.1. Répertoire associe au cas + char* nomDirCase = myCase->GetDirName() ; + // E.2. Répertoire associe a l'iteration de ce cas + char* IterName ; + IterName = myCase->GetIter0Name() ; + ADAPT::HOMARD_Iteration_var Iter = GetIteration(IterName) ; + char* nomDirIter = CreateDirNameIter(nomDirCase, 0 ); + Iter->SetDirNameLoc(nomDirIter); + std::string nomDirIterTotal ; + nomDirIterTotal = std::string(nomDirCase) + "/" + std::string(nomDirIter) ; +#ifndef WIN32 + if (mkdir(nomDirIterTotal.c_str(), S_IRWXU|S_IRGRP|S_IXGRP) != 0) +#else + if (_mkdir(nomDirIterTotal.c_str()) != 0) +#endif + { + MESSAGE ( "nomDirIterTotal : " << nomDirIterTotal ) ; + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "The directory for the computation cannot be created." ; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + // E.3. Copie du maillage HOMARD au format MED + codret = CHDIR(DirNameStart) ; + std::string commande = "cp " + file_maillage_homard + " " + nomDirIterTotal ; + MESSAGE ( "commande : " << commande ) ; + codret = system(commande.c_str()) ; + MESSAGE ( "codret : " << codret ) ; + if ( codret != 0 ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The starting point for the case cannot be copied into the working directory."; + throw SALOME::SALOME_Exception(es); + return 0; + }; + + // F. Menage + + delete[] MeshName ; + delete[] MeshFile ; + + CHDIR(nomDirWork.c_str()); + return ADAPT::HOMARD_Cas::_duplicate(myCase); +} +//============================================================================= +ADAPT::HOMARD_Cas_ptr ADAPT_Gen_i::CreateCaseFromCaseLastIteration(const char* nomCas, const char* DirNameStart) +// +// nomCas : nom du cas a creer +// DirNameStart : nom du répertoire du cas contenant l'iteration de reprise +// +{ + INFOS ( "CreateCaseFromCaseLastIteration : nomCas = " << nomCas << ", DirNameStart = " << DirNameStart ); + + std::string DirNameStartIter = CreateCase1(DirNameStart, -1) ; + + DirNameStartIter = string(DirNameStart) + "/" + DirNameStartIter ; + ADAPT::HOMARD_Cas_ptr myCase = CreateCaseFromIteration(nomCas, DirNameStartIter.c_str()) ; + + return ADAPT::HOMARD_Cas::_duplicate(myCase); +} +//============================================================================= +ADAPT::HOMARD_Cas_ptr ADAPT_Gen_i::CreateCaseFromCaseIteration(const char* nomCas, const char* DirNameStart, CORBA::Long Number) +// +// nomCas : nom du cas a creer +// 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 ); + if ( Number < 0 ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The number of iteration must be positive."; + throw SALOME::SALOME_Exception(es); + return 0; + }; + + std::string DirNameStartIter = CreateCase1(DirNameStart, Number) ; + + DirNameStartIter = string(DirNameStart) + "/" + DirNameStartIter ; + ADAPT::HOMARD_Cas_ptr myCase = CreateCaseFromIteration(nomCas, DirNameStartIter.c_str()) ; + + return ADAPT::HOMARD_Cas::_duplicate(myCase); +} +//============================================================================= +std::string ADAPT_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Number) +// +// 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 +// +{ + MESSAGE ( "CreateCase1 : DirNameStart = " << DirNameStart << ", Number = " << Number ); + std::string nomDirWork = getenv("PWD") ; + std::string DirNameStartIter ; + int codret ; + int NumeIterMax = -1 ; + + // A.1. Controle du répertoire de depart du cas + codret = CHDIR(DirNameStart) ; + if ( codret != 0 ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The directory of the case for the pursuit does not exist."; + throw SALOME::SALOME_Exception(es); + return 0; + }; + // A.2. Reperage des sous-répertoire du répertoire de reprise + bool existe = false ; +#ifndef WIN32 + DIR *dp; + struct dirent *dirp; + dp = opendir(DirNameStart); + while ( (dirp = readdir(dp)) != NULL ) { + std::string DirName_1(dirp->d_name); +#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 DirName_1 = ""; + if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + DirName_1 = std::string(ffd.cFileName); + } +#endif + if ( ( DirName_1 != "." ) && ( DirName_1 != ".." ) ) + { + if ( CHDIR(DirName_1.c_str()) == 0 ) + { +// On cherche le fichier de configuration dans ce sous-répertoire + codret = CHDIR(DirNameStart); +#ifndef WIN32 + DIR *dp_1; + struct dirent *dirp_1; + dp_1 = opendir(DirName_1.c_str()) ; + while ( (dirp_1 = readdir(dp_1)) != NULL ) + { + std::string file_name_1(dirp_1->d_name); +#else + HANDLE hFind1 = INVALID_HANDLE_VALUE; + WIN32_FIND_DATA ffd1; + hFind1 = FindFirstFile(DirName_1.c_str(), &ffd1); + while (FindNextFile(hFind1, &ffd1) != 0) + { + if (ffd1.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories + std::string file_name_1(ffd1.cFileName); +#endif + int bilan = file_name_1.find("HOMARD.Configuration.") ; + if ( bilan != string::npos ) + { + // Decodage du fichier pour trouver le numero d'iteration + 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 + { + 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 + while ( std::getline( fichier, ligne ) ) + { + // B.1. Pour la ligne courante, on identifie le premier mot : le mot-cle + std::istringstream ligne_bis(ligne); // variable contenant chaque ligne sous forme de flux + ligne_bis >> mot_cle ; + if ( mot_cle == "NumeIter" ) + { + ligne_bis >> NumeIter ; + NumeIter += 1 ; +// MESSAGE ( "==> NumeIter : " << NumeIter ) ; + if ( Number == - 1 ) + { + if ( NumeIter >= NumeIterMax ) + { + NumeIterMax = NumeIter ; + DirNameStartIter = DirName_1 ; + } + } + else + { + if ( NumeIter == Number ) + { + DirNameStartIter = DirName_1 ; + existe = true ; + break ; + } + } + } + } + } + else + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "The configuration file cannot be read." ; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + CHDIR(DirNameStart) ; + } + if ( existe ) { break ; } + } +#ifndef WIN32 + closedir(dp_1); +#else + FindClose(hFind1); +#endif + if ( existe ) { break ; } + } + } + } +#ifndef WIN32 + closedir(dp); +#else + FindClose(hFind); +#endif + CHDIR(nomDirWork.c_str()); + + if ( ( Number >= 0 && ( !existe ) ) || ( Number < 0 && ( NumeIterMax == -1 ) ) ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The directory of the iteration does not exist."; + throw SALOME::SALOME_Exception(es); + return 0; + }; + + return DirNameStartIter ; +} +//============================================================================= +ADAPT::HOMARD_Cas_ptr ADAPT_Gen_i::CreateCase0(const char* nomCas, const char* MeshName, const char* MeshFile, CORBA::Long MeshOption, CORBA::Long NumeIter, CORBA::Long Option) +// +// nomCas : nom du cas a creer +// MeshName, MeshFile : nom et fichier du maillage correspondant +// MeshOption : 0 : le maillage fourni est obligatoirement present ==> erreur si absent +// 1 : le maillage fourni peut ne pas exister ==> on continue si absent +// -1 : le maillage n'est pas fourni +// NumeIter : numero de l'iteration correspondante : 0, pour un depart, n>0 pour une poursuite +// Option : multiple de nombres premiers +// 1 : aucune option +// x2 : publication du maillage dans SMESH +{ + MESSAGE ( "CreateCase0 : nomCas = " << nomCas ); + MESSAGE ( "CreateCase0 : MeshName = " << MeshName << ", MeshFile = " << MeshFile << ", MeshOption = " << MeshOption ); + MESSAGE ( "CreateCase0 : NumeIter = " << NumeIter << ", Option = " << Option ); +// + // A. Controles + // A.1. L'etude + IsValidStudy () ; + + // A.2. Controle du nom : + if ((myStudyContext._mesCas).find(nomCas)!=(myStudyContext._mesCas).end()) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This case has already been defined."; + throw SALOME::SALOME_Exception(es); + return 0; + }; + + // A.3. Controle du fichier du maillage + int existeMeshFile ; + if ( MeshOption >= 0 ) + { + existeMeshFile = MEDFileExist ( MeshFile ) ; + MESSAGE ( "CreateCase0 : existeMeshFile = " << existeMeshFile ); + if ( ( existeMeshFile == 0 ) && ( MeshOption == 0 ) ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The mesh file does not exist."; + throw SALOME::SALOME_Exception(es); + return 0; + } + } + else { existeMeshFile = 0 ; } + + // B. Creation de l'objet cas et publication +// MESSAGE ( "CreateCase0 : Creation de l'objet" ); + ADAPT::HOMARD_Cas_var myCase = newCase(); + myCase->SetName(nomCas); + SALOMEDS::SObject_var aSO; + SALOMEDS::SObject_var aResultSO=PublishInStudy(aSO, myCase, nomCas); + myStudyContext._mesCas[nomCas] = myCase; + + // C. Caracteristiques du maillage + if ( existeMeshFile != 0 ) + { + // Les valeurs extremes des coordonnées +// MESSAGE ( "CreateCase0 : Les valeurs extremes des coordonnées" ); + std::vector LesExtremes =GetBoundingBoxInMedFile(MeshFile) ; + ADAPT::extrema_var aSeq = new ADAPT::extrema() ; + if (LesExtremes.size()!=10) { return 0; } + aSeq->length(10) ; + for (int i =0 ; i< LesExtremes.size() ; i++) + aSeq[i]=LesExtremes[i] ; + myCase->SetBoundingBox(aSeq) ; + // Les groupes +// MESSAGE ( "CreateCase0 : Les groupes" ); + std::set LesGroupes =GetListeGroupesInMedFile(MeshFile) ; + ADAPT::ListGroupType_var aSeqGroupe = new ADAPT::ListGroupType ; + aSeqGroupe->length(LesGroupes.size()); + std::set::const_iterator it ; + int i = 0 ; + for (it=LesGroupes.begin() ; it != LesGroupes.end() ; it++) + aSeqGroupe[i++]=(*it).c_str() ; + myCase->SetGroups(aSeqGroupe) ; + } + + // D. L'iteration initiale du cas + MESSAGE ( "CreateCase0 : iteration initiale du cas" ); + // D.1. Recherche d'un nom : par defaut, on prend le nom du maillage correspondant. + // Si ce nom d'iteration existe deja, on incremente avec 0, 1, 2, etc. + int monNum = 0; + std::string NomIteration = std::string(MeshName) ; + while ( (myStudyContext._mesIterations).find(NomIteration) != (myStudyContext._mesIterations.end()) ) + { + std::ostringstream nom; + nom << MeshName << monNum; + NomIteration = nom.str(); + monNum += 1; + } + MESSAGE ( "CreateCas0 : ==> NomIteration = " << NomIteration ); + + // D.2. Creation de l'iteration + ADAPT::HOMARD_Iteration_var anIter = newIteration(); + myStudyContext._mesIterations[NomIteration] = anIter; + anIter->SetName(NomIteration.c_str()); + AssociateCaseIter (nomCas, NomIteration.c_str(), "IterationHomard"); + + // D.4. Maillage correspondant + if ( existeMeshFile != 0 ) + { + anIter->SetMeshFile(MeshFile); + if ( Option % 2 == 0 ) { PublishResultInSmesh(MeshFile, 0); } + } + anIter->SetMeshName(MeshName); + + // D.5. Numero d'iteration + anIter->SetNumber(NumeIter); + + // D.6. Etat + SetEtatIter(NomIteration.c_str(), -NumeIter); +// + + return ADAPT::HOMARD_Cas::_duplicate(myCase); +} +//============================================================================= +ADAPT::HOMARD_Hypothesis_ptr ADAPT_Gen_i::CreateHypothesis(const char* nomHypothesis) +{ + INFOS ( "CreateHypothesis : nomHypothesis = " << nomHypothesis ); + IsValidStudy () ; + + // A. Controle du nom : + if ((myStudyContext._mesHypotheses).find(nomHypothesis) != (myStudyContext._mesHypotheses).end()) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This hypothesis has already been defined."; + throw SALOME::SALOME_Exception(es); + return 0; + } + + // B. Creation de l'objet + ADAPT::HOMARD_Hypothesis_var myHypothesis = newHypothesis(); + if (CORBA::is_nil(myHypothesis)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Unable to create the hypothesis"; + throw SALOME::SALOME_Exception(es); + return 0; + }; + myHypothesis->SetName(nomHypothesis); + + // C. Enregistrement + myStudyContext._mesHypotheses[nomHypothesis] = myHypothesis; + + SALOMEDS::SObject_var aSO; + SALOMEDS::SObject_var aResultSO=PublishInStudy(aSO, myHypothesis, nomHypothesis); + + // D. Valeurs par defaut des options avancees + myHypothesis->SetNivMax(-1); + myHypothesis->SetDiamMin(-1.0); + myHypothesis->SetAdapInit(0); + myHypothesis->SetExtraOutput(1); + + return ADAPT::HOMARD_Hypothesis::_duplicate(myHypothesis); +} + +//============================================================================= +ADAPT::HOMARD_Iteration_ptr ADAPT_Gen_i::CreateIteration(const char* NomIteration, const char* nomIterParent) +//============================================================================= +{ + INFOS ("CreateIteration : NomIteration = " << NomIteration << ", nomIterParent = " << nomIterParent); + IsValidStudy () ; + + ADAPT::HOMARD_Iteration_var myIterationParent = myStudyContext._mesIterations[nomIterParent]; + if (CORBA::is_nil(myIterationParent)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The parent iteration is not defined."; + throw SALOME::SALOME_Exception(es); + return 0; + }; + + const char* nomCas = myIterationParent->GetCaseName(); + MESSAGE ("CreateIteration : nomCas = " << nomCas); + ADAPT::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; + if (CORBA::is_nil(myCase)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid case context"; + throw SALOME::SALOME_Exception(es); + return 0; + }; + const char* nomDirCase = myCase->GetDirName(); + + // Controle du nom : + if ((myStudyContext._mesIterations).find(NomIteration)!=(myStudyContext._mesIterations).end()) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This iteration has already been defined."; + throw SALOME::SALOME_Exception(es); + return 0; + }; + + ADAPT::HOMARD_Iteration_var myIteration = newIteration(); + if (CORBA::is_nil(myIteration)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Unable to create the iteration"; + throw SALOME::SALOME_Exception(es); + return 0; + }; + myStudyContext._mesIterations[std::string(NomIteration)] = myIteration; +// Nom de l'iteration et du maillage + myIteration->SetName(NomIteration); + myIteration->SetMeshName(NomIteration); + myIteration->SetState(1); + + int numero = myIterationParent->GetNumber() + 1; + myIteration->SetNumber(numero); + +// Nombre d'iterations deja connues pour le cas, permettant +// la creation d'un sous-répertoire unique + int nbitercase = myCase->GetNumberofIter(); + char* nomDirIter = CreateDirNameIter(nomDirCase, nbitercase ); + myIteration->SetDirNameLoc(nomDirIter); + +// Le nom du fichier du maillage MED est indice par le nombre d'iterations du cas. +// Si on a une chaine unique depuis le depart, ce nombre est le meme que le +// numero d'iteration dans la sucession : maill.01.med, maill.02.med, etc... C'est la +// situation la plus frequente. +// Si on a plusieurs branches, donc des iterations du meme niveau d'adaptation, utiliser +// le nombre d'iterations du cas permet d'eviter les collisions. + int jaux ; + if ( nbitercase < 100 ) { jaux = 2 ; } + else if ( nbitercase < 1000 ) { jaux = 3 ; } + else if ( nbitercase < 10000 ) { jaux = 4 ; } + else if ( nbitercase < 100000 ) { jaux = 5 ; } + else { jaux = 9 ; } + std::ostringstream iaux ; + iaux << std::setw(jaux) << std::setfill('0') << nbitercase ; + std::stringstream MeshFile; + MeshFile << nomDirCase << "/maill." << iaux.str() << ".med"; + myIteration->SetMeshFile(MeshFile.str().c_str()); + +// Association avec le cas + std::string label = "IterationHomard_" + std::string(nomIterParent); + AssociateCaseIter(nomCas, NomIteration, label.c_str()); +// Lien avec l'iteration precedente + myIterationParent->LinkNextIteration(NomIteration); + myIteration->SetIterParentName(nomIterParent); + // Gestion de l'arbre d'etudes + SALOMEDS::SObject_var aIterSOParent = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIterationParent))); + SALOMEDS::SObject_var aIterSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIteration))); + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + aStudyBuilder->NewCommand(); + SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aIterSO); + aStudyBuilder->Addreference(aSubSO, aIterSOParent); + aStudyBuilder->CommitCommand(); + + return ADAPT::HOMARD_Iteration::_duplicate(myIteration); +} +//============================================================================= +ADAPT::HOMARD_Boundary_ptr ADAPT_Gen_i::CreateBoundary(const char* BoundaryName, CORBA::Long BoundaryType) +{ + MESSAGE ("CreateBoundary : BoundaryName = " << BoundaryName << ", BoundaryType = " << BoundaryType); + IsValidStudy () ; + + // Controle du nom : + if ((myStudyContext._mesBoundarys).find(BoundaryName)!=(myStudyContext._mesBoundarys).end()) + { + MESSAGE ("CreateBoundary : la frontiere " << BoundaryName << " existe deja"); + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This boundary has already been defined"; + throw SALOME::SALOME_Exception(es); + return 0; + }; + + ADAPT::HOMARD_Boundary_var myBoundary = newBoundary(); + myBoundary->SetName(BoundaryName); + myBoundary->SetType(BoundaryType); + + myStudyContext._mesBoundarys[BoundaryName] = myBoundary; + + SALOMEDS::SObject_var aSO; + SALOMEDS::SObject_var aResultSO=PublishInStudy(aSO, myBoundary, BoundaryName); + + return ADAPT::HOMARD_Boundary::_duplicate(myBoundary); +} +//============================================================================= +ADAPT::HOMARD_Boundary_ptr ADAPT_Gen_i::CreateBoundaryCAO(const char* BoundaryName, const char* CAOFile) +{ + INFOS ("CreateBoundaryCAO : BoundaryName = " << BoundaryName << ", CAOFile = " << CAOFile ); + ADAPT::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, -1); + myBoundary->SetDataFile( CAOFile ) ; + + return ADAPT::HOMARD_Boundary::_duplicate(myBoundary); +} +//============================================================================= +ADAPT::HOMARD_Boundary_ptr ADAPT_Gen_i::CreateBoundaryDi(const char* BoundaryName, const char* MeshName, const char* MeshFile) +{ + INFOS ("CreateBoundaryDi : BoundaryName = " << BoundaryName << ", MeshName = " << MeshName << ", MeshFile = " << MeshFile ); + ADAPT::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 0); + myBoundary->SetDataFile( MeshFile ) ; + myBoundary->SetMeshName( MeshName ) ; + + return ADAPT::HOMARD_Boundary::_duplicate(myBoundary); +} +//============================================================================= +ADAPT::HOMARD_Boundary_ptr ADAPT_Gen_i::CreateBoundaryCylinder(const char* BoundaryName, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, + CORBA::Double Rayon) +{ + INFOS ("CreateBoundaryCylinder : BoundaryName = " << BoundaryName ) ; +// + SALOME::ExceptionStruct es; + int error = 0 ; + if ( Rayon <= 0.0 ) + { es.text = "The radius must be positive." ; + error = 1 ; } + double daux = fabs(Xaxe) + fabs(Yaxe) + fabs(Zaxe) ; + if ( daux < 0.0000001 ) + { es.text = "The axis must be a non 0 vector." ; + error = 2 ; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + ADAPT::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 1) ; + myBoundary->SetCylinder( Xcentre, Ycentre, Zcentre, Xaxe, Yaxe, Zaxe, Rayon ) ; + + return ADAPT::HOMARD_Boundary::_duplicate(myBoundary) ; +} +//============================================================================= +ADAPT::HOMARD_Boundary_ptr ADAPT_Gen_i::CreateBoundarySphere(const char* BoundaryName, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Rayon) +{ + INFOS ("CreateBoundarySphere : BoundaryName = " << BoundaryName ) ; +// + SALOME::ExceptionStruct es; + int error = 0 ; + if ( Rayon <= 0.0 ) + { es.text = "The radius must be positive." ; + error = 1 ; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + ADAPT::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 2) ; + myBoundary->SetSphere( Xcentre, Ycentre, Zcentre, Rayon ) ; + + return ADAPT::HOMARD_Boundary::_duplicate(myBoundary) ; +} +//============================================================================= +ADAPT::HOMARD_Boundary_ptr ADAPT_Gen_i::CreateBoundaryConeA(const char* BoundaryName, + 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 ) ; +// + SALOME::ExceptionStruct es; + int error = 0 ; + if ( Angle <= 0.0 || Angle >= 90.0 ) + { es.text = "The angle must be included higher than 0 degree and lower than 90 degrees." ; + error = 1 ; } + double daux = fabs(Xaxe) + fabs(Yaxe) + fabs(Zaxe) ; + if ( daux < 0.0000001 ) + { es.text = "The axis must be a non 0 vector." ; + error = 2 ; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + ADAPT::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 3) ; + myBoundary->SetConeA( Xaxe, Yaxe, Zaxe, Angle, Xcentre, Ycentre, Zcentre ) ; + + return ADAPT::HOMARD_Boundary::_duplicate(myBoundary) ; +} +//============================================================================= +ADAPT::HOMARD_Boundary_ptr ADAPT_Gen_i::CreateBoundaryConeR(const char* BoundaryName, + 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 ) ; +// + SALOME::ExceptionStruct es; + int error = 0 ; + if ( Rayon1 < 0.0 || Rayon2 < 0.0 ) + { es.text = "The radius must be positive." ; + error = 1 ; } + double daux = fabs(Rayon2-Rayon1) ; + if ( daux < 0.0000001 ) + { es.text = "The radius must be different." ; + error = 2 ; } + daux = fabs(Xcentre2-Xcentre1) + fabs(Ycentre2-Ycentre1) + fabs(Zcentre2-Zcentre1) ; + if ( daux < 0.0000001 ) + { es.text = "The centers must be different." ; + error = 3 ; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + ADAPT::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 4) ; + myBoundary->SetConeR( Xcentre1, Ycentre1, Zcentre1, Rayon1, Xcentre2, Ycentre2, Zcentre2, Rayon2 ) ; + + return ADAPT::HOMARD_Boundary::_duplicate(myBoundary) ; +} +//============================================================================= +ADAPT::HOMARD_Boundary_ptr ADAPT_Gen_i::CreateBoundaryTorus(const char* BoundaryName, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, + CORBA::Double RayonRev, CORBA::Double RayonPri) +{ + INFOS ("CreateBoundaryTorus : BoundaryName = " << BoundaryName ) ; +// + SALOME::ExceptionStruct es; + int error = 0 ; + if ( ( RayonRev <= 0.0 ) || ( RayonPri <= 0.0 ) ) + { es.text = "The radius must be positive." ; + error = 1 ; } + double daux = fabs(Xaxe) + fabs(Yaxe) + fabs(Zaxe) ; + if ( daux < 0.0000001 ) + { es.text = "The axis must be a non 0 vector." ; + error = 2 ; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + ADAPT::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 5) ; + myBoundary->SetTorus( Xcentre, Ycentre, Zcentre, Xaxe, Yaxe, Zaxe, RayonRev, RayonPri ) ; + + return ADAPT::HOMARD_Boundary::_duplicate(myBoundary) ; +} +//============================================================================= +ADAPT::HOMARD_Zone_ptr ADAPT_Gen_i::CreateZone(const char* ZoneName, CORBA::Long ZoneType) +{ + MESSAGE ("CreateZone : ZoneName = " << ZoneName << ", ZoneType = " << ZoneType); + IsValidStudy () ; + + // Controle du nom : + if ((myStudyContext._mesZones).find(ZoneName)!=(myStudyContext._mesZones).end()) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This zone has already been defined"; + throw SALOME::SALOME_Exception(es); + return 0; + }; + + ADAPT::HOMARD_Zone_var myZone = newZone(); + myZone->SetName(ZoneName); + myZone->SetType(ZoneType); + + myStudyContext._mesZones[ZoneName] = myZone; + + SALOMEDS::SObject_var aSO; + SALOMEDS::SObject_var aResultSO=PublishInStudy(aSO, myZone, ZoneName); + + return ADAPT::HOMARD_Zone::_duplicate(myZone); +} +//============================================================================= +ADAPT::HOMARD_Zone_ptr ADAPT_Gen_i::CreateZoneBox(const char* ZoneName, + CORBA::Double Xmini, CORBA::Double Xmaxi, + CORBA::Double Ymini, CORBA::Double Ymaxi, + CORBA::Double Zmini, CORBA::Double Zmaxi) +{ + INFOS ("CreateZoneBox : ZoneName = " << ZoneName ) ; +// + SALOME::ExceptionStruct es; + int error = 0 ; + if ( Xmini > Xmaxi ) + { es.text = "The X coordinates are not coherent." ; + error = 1 ; } + if ( Ymini > Ymaxi ) + { es.text = "The Y coordinates are not coherent." ; + error = 2 ; } + if ( Zmini > Zmaxi ) + { es.text = "The Z coordinates are not coherent." ; + error = 3 ; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + ADAPT::HOMARD_Zone_var myZone = CreateZone(ZoneName, 2) ; + myZone->SetBox ( Xmini, Xmaxi, Ymini, Ymaxi, Zmini, Zmaxi) ; + + return ADAPT::HOMARD_Zone::_duplicate(myZone) ; +} +//============================================================================= +ADAPT::HOMARD_Zone_ptr ADAPT_Gen_i::CreateZoneSphere(const char* ZoneName, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, CORBA::Double Rayon) +{ + INFOS ("CreateZoneSphere : ZoneName = " << ZoneName ) ; +// + SALOME::ExceptionStruct es; + int error = 0 ; + if ( Rayon <= 0.0 ) + { es.text = "The radius must be positive." ; + error = 1 ; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + ADAPT::HOMARD_Zone_var myZone = CreateZone(ZoneName, 4) ; + myZone->SetSphere( Xcentre, Ycentre, Zcentre, Rayon ) ; + + return ADAPT::HOMARD_Zone::_duplicate(myZone) ; +} +//============================================================================= +ADAPT::HOMARD_Zone_ptr ADAPT_Gen_i::CreateZoneCylinder(const char* ZoneName, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, + CORBA::Double Rayon, CORBA::Double Haut) +{ + INFOS ("CreateZoneCylinder : ZoneName = " << ZoneName ) ; +// + SALOME::ExceptionStruct es; + int error = 0 ; + if ( Rayon <= 0.0 ) + { es.text = "The radius must be positive." ; + error = 1 ; } + double daux = fabs(Xaxe) + fabs(Yaxe) + fabs(Zaxe) ; + if ( daux < 0.0000001 ) + { es.text = "The axis must be a non 0 vector." ; + error = 2 ; } + if ( Haut <= 0.0 ) + { es.text = "The height must be positive." ; + error = 3 ; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + ADAPT::HOMARD_Zone_var myZone = CreateZone(ZoneName, 5) ; + myZone->SetCylinder( Xcentre, Ycentre, Zcentre, Xaxe, Yaxe, Zaxe, Rayon, Haut ) ; + + return ADAPT::HOMARD_Zone::_duplicate(myZone) ; +} +//============================================================================= +ADAPT::HOMARD_Zone_ptr ADAPT_Gen_i::CreateZonePipe(const char* ZoneName, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, + CORBA::Double Rayon, CORBA::Double Haut, CORBA::Double Rayonint) +{ + INFOS ("CreateZonePipe : ZoneName = " << ZoneName ) ; +// + SALOME::ExceptionStruct es; + int error = 0 ; + if ( Rayon <= 0.0 || Rayonint <= 0.0 ) + { es.text = "The radius must be positive." ; + error = 1 ; } + double daux = fabs(Xaxe) + fabs(Yaxe) + fabs(Zaxe) ; + if ( daux < 0.0000001 ) + { es.text = "The axis must be a non 0 vector." ; + error = 2 ; } + if ( Haut <= 0.0 ) + { es.text = "The height must be positive." ; + error = 3 ; } + if ( Rayon <= Rayonint ) + { es.text = "The external radius must be higher than the internal radius." ; + error = 4 ; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + ADAPT::HOMARD_Zone_var myZone = CreateZone(ZoneName, 7) ; + myZone->SetPipe( Xcentre, Ycentre, Zcentre, Xaxe, Yaxe, Zaxe, Rayon, Haut, Rayonint ) ; + + return ADAPT::HOMARD_Zone::_duplicate(myZone) ; +} +//============================================================================= +ADAPT::HOMARD_Zone_ptr ADAPT_Gen_i::CreateZoneBox2D(const char* ZoneName, + CORBA::Double Umini, CORBA::Double Umaxi, + CORBA::Double Vmini, CORBA::Double Vmaxi, + CORBA::Long Orient) +{ + INFOS ("CreateZoneBox2D : ZoneName = " << ZoneName ) ; +// MESSAGE ("Umini = " << Umini << ", Umaxi =" << Umaxi ) ; +// MESSAGE ("Vmini = " << Vmini << ", Vmaxi =" << Vmaxi ) ; +// MESSAGE ("Orient = " << Orient ) ; +// + SALOME::ExceptionStruct es; + int error = 0 ; + if ( Umini > Umaxi ) + { es.text = "The first coordinates are not coherent." ; + error = 1 ; } + if ( Vmini > Vmaxi ) + { es.text = "The second coordinates are not coherent." ; + error = 2 ; } + if ( Orient < 1 || Orient > 3 ) + { es.text = "The orientation must be 1, 2 or 3." ; + error = 3 ; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + double Xmini, Xmaxi ; + double Ymini, Ymaxi ; + double Zmini, Zmaxi ; + if ( Orient == 1 ) + { Xmini = Umini ; + Xmaxi = Umaxi ; + Ymini = Vmini ; + Ymaxi = Vmaxi ; + Zmini = 0. ; + Zmaxi = 0. ; } + else if ( Orient == 2 ) + { Xmini = 0. ; + Xmaxi = 0. ; + Ymini = Umini ; + Ymaxi = Umaxi ; + Zmini = Vmini ; + Zmaxi = Vmaxi ; } + else if ( Orient == 3 ) + { Xmini = Vmini ; + Xmaxi = Vmaxi ; + Ymini = 0. ; + Ymaxi = 0. ; + Zmini = Umini ; + Zmaxi = Umaxi ; } + else { VERIFICATION( (Orient>=1) && (Orient<=3) ) ; } + + ADAPT::HOMARD_Zone_var myZone = CreateZone(ZoneName, 10+Orient) ; + myZone->SetBox ( Xmini, Xmaxi, Ymini, Ymaxi, Zmini, Zmaxi) ; + + return ADAPT::HOMARD_Zone::_duplicate(myZone) ; +} +//============================================================================= +ADAPT::HOMARD_Zone_ptr ADAPT_Gen_i::CreateZoneDisk(const char* ZoneName, + CORBA::Double Ucentre, CORBA::Double Vcentre, + CORBA::Double Rayon, + CORBA::Long Orient) +{ + INFOS ("CreateZoneDisk : ZoneName = " << ZoneName ) ; +// + SALOME::ExceptionStruct es; + int error = 0 ; + if ( Rayon <= 0.0 ) + { es.text = "The radius must be positive." ; + error = 1 ; } + if ( Orient < 1 || Orient > 3 ) + { es.text = "The orientation must be 1, 2 or 3." ; + error = 3 ; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + double Xcentre ; + double Ycentre ; + double Zcentre ; + if ( Orient == 1 ) + { Xcentre = Ucentre ; + Ycentre = Vcentre ; + Zcentre = 0. ; } + else if ( Orient == 2 ) + { Xcentre = 0. ; + Ycentre = Ucentre ; + Zcentre = Vcentre ; } + else if ( Orient == 3 ) + { Xcentre = Vcentre ; + Ycentre = 0. ; + Zcentre = Ucentre ; } + else { VERIFICATION( (Orient>=1) && (Orient<=3) ) ; } + + ADAPT::HOMARD_Zone_var myZone = CreateZone(ZoneName, 30+Orient) ; + myZone->SetCylinder( Xcentre, Ycentre, Zcentre, 0., 0., 1., Rayon, 1. ) ; + + return ADAPT::HOMARD_Zone::_duplicate(myZone) ; +} +//============================================================================= +ADAPT::HOMARD_Zone_ptr ADAPT_Gen_i::CreateZoneDiskWithHole(const char* ZoneName, + CORBA::Double Ucentre, CORBA::Double Vcentre, + CORBA::Double Rayon, CORBA::Double Rayonint, + CORBA::Long Orient) +{ + INFOS ("CreateZoneDiskWithHole : ZoneName = " << ZoneName ) ; +// + SALOME::ExceptionStruct es; + int error = 0 ; + if ( Rayon <= 0.0 || Rayonint <= 0.0 ) + { es.text = "The radius must be positive." ; + error = 1 ; } + if ( Orient < 1 || Orient > 3 ) + { es.text = "The orientation must be 1, 2 or 3." ; + error = 3 ; } + if ( Rayon <= Rayonint ) + { es.text = "The external radius must be higher than the internal radius." ; + error = 4 ; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + double Xcentre ; + double Ycentre ; + double Zcentre ; + if ( Orient == 1 ) + { Xcentre = Ucentre ; + Ycentre = Vcentre ; + Zcentre = 0. ; } + else if ( Orient == 2 ) + { Xcentre = 0. ; + Ycentre = Ucentre ; + Zcentre = Vcentre ; } + else if ( Orient == 3 ) + { Xcentre = Vcentre ; + Ycentre = 0. ; + Zcentre = Ucentre ; } + else { VERIFICATION( (Orient>=1) && (Orient<=3) ) ; } + + ADAPT::HOMARD_Zone_var myZone = CreateZone(ZoneName, 60+Orient) ; + myZone->SetPipe( Xcentre, Ycentre, Zcentre, 0., 0., 1., Rayon, 1., Rayonint ) ; + + return ADAPT::HOMARD_Zone::_duplicate(myZone) ; +} +//============================================================================= +//============================================================================= + + + + +//============================================================================= +//============================================================================= +// Traitement d'une iteration +// etatMenage = 1 : destruction du répertoire d'execution +// modeHOMARD = 1 : adaptation +// != 1 : information avec les options modeHOMARD +// 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 ADAPT_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMenage, CORBA::Long modeHOMARD, CORBA::Long Option1, CORBA::Long Option2) +{ + INFOS ( "Compute : traitement de " << NomIteration << ", avec modeHOMARD = " << modeHOMARD << ", Option1 = " << Option1 << ", Option2 = " << Option2 ); + + // A. Prealable + int codret = 0; + + // A.1. L'objet iteration + ADAPT::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[NomIteration]; + ASSERT(!CORBA::is_nil(myIteration)); + + // A.2. Controle de la possibilite d'agir + // A.2.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 ; } + + std::string siter ; + if ( modeHOMARD==1 ) + { + std::stringstream saux0 ; + int iaux = max(0, NumeIter-1) ; + saux0 << iaux ; + siter = saux0.str() ; + if (NumeIter < 11) { siter = "0" + siter ; } + } + else + { siter = siterp1 ; } + + // A.4. Le cas + const char* nomCas = myIteration->GetCaseName(); + ADAPT::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; + ASSERT(!CORBA::is_nil(myCase)); + + // B. Les répertoires + // B.1. Le répertoire courant + std::string nomDirWork = getenv("PWD") ; + // B.2. Le sous-répertoire de l'iteration a traiter + char* DirCompute = ComputeDirManagement(myCase, myIteration, etatMenage); + MESSAGE( ". DirCompute = " << DirCompute ); + + // C. Le fichier des messages + // C.1. Le deroulement de l'execution de HOMARD + std::string LogFile = DirCompute ; + LogFile += "/Liste" ; + if ( modeHOMARD == 1 ) { LogFile += "." + siter + ".vers." + siterp1 ; } + LogFile += ".log" ; + MESSAGE (". LogFile = " << LogFile); + if ( modeHOMARD == 1 ) { myIteration->SetLogFile(LogFile.c_str()); } + // C.2. Le bilan de l'analyse du maillage + std::string FileInfo = DirCompute ; + FileInfo += "/" ; + if ( modeHOMARD == 1 ) { FileInfo += "apad" ; } + else + { if ( NumeIter == 0 ) { FileInfo += "info_av" ; } + else { FileInfo += "info_ap" ; } + } + FileInfo += "." + siterp1 + ".bilan" ; + myIteration->SetFileInfo(FileInfo.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(siter, 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 ; + if ( modeHOMARD == 1 ) + { + iaux = 1 ; + myDriver->TexteMaillageHOMARD( DirCompute, siterp1, iaux ) ; + myDriver->TexteMaillage(NomMesh, MeshFile, 1); + codret = ComputeAdap(myCase, myIteration, etatMenage, myDriver, Option1, Option2) ; + } + else + { + InvalideIterInfo(NomIteration); + myDriver->TexteInfo( modeHOMARD, NumeIter ) ; + iaux = 0 ; + myDriver->TexteMaillageHOMARD( DirCompute, siterp1, iaux ) ; + myDriver->TexteMaillage(NomMesh, MeshFile, 0); + myDriver->CreeFichierDonn(); + } + + // E.4. Ajout des informations liees a l'eventuel suivi de frontiere + int BoundaryOption = DriverTexteBoundary(myCase, myDriver) ; + + // E.5. Ecriture du texte dans le fichier + MESSAGE ( ". Ecriture du texte dans le fichier de configuration ; codret = "<CreeFichier(); } + +// G. Execution +// + int codretexec = 1789 ; + if (codret == 0) + { + codretexec = myDriver->ExecuteHomard(Option1); +// + MESSAGE ( "Erreur en executant HOMARD : " << codretexec ); + // En mode adaptation, on ajuste l'etat de l'iteration + if ( modeHOMARD == 1 ) + { + if (codretexec == 0) { SetEtatIter(NomIteration,2); } + else { SetEtatIter(NomIteration,1); } + // GERALD -- QMESSAGE BOX + } + } + + // H. Gestion des resultats + if (codret == 0) + { + std::string Commentaire ; + // H.1. Le fichier des messages, dans tous les cas + Commentaire = "log" ; + if ( modeHOMARD == 1 ) { Commentaire += " " + siterp1 ; } + else { Commentaire += "Info" ; } + PublishFileUnderIteration(NomIteration, LogFile.c_str(), Commentaire.c_str()); + + // H.2. Si tout s'est bien passe : + if (codretexec == 0) + { + // H.2.1. Le fichier de bilan + Commentaire = "Summary" ; + if ( modeHOMARD == 1 ) { Commentaire += " " + siterp1 ; } + else { Commentaire += "Info" ; } + PublishFileUnderIteration(NomIteration, FileInfo.c_str(), Commentaire.c_str()); + // H.2.2. Le fichier de maillage obtenu + if ( modeHOMARD == 1 ) + { + std::stringstream saux0 ; + Commentaire = "Mesh" ; + Commentaire += " " + siterp1 ; + PublishFileUnderIteration(NomIteration, MeshFile, Commentaire.c_str()); + if ( Option2 % 2 == 0 ) { PublishResultInSmesh(MeshFile, 1); } + } + } + // H.3 Message d'erreur + if (codretexec != 0) + { + std::string text = "" ; + // Message d'erreur en cas de probleme en adaptation + if ( modeHOMARD == 1 ) + { + 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 + { + std::string ligne; // variable contenant chaque ligne lue + while ( std::getline( fichier, ligne ) ) + { +// INFOS(ligne); + if ( stopvu ) + { text += ligne+ "\n"; } + else + { + int position = ligne.find( "===== HOMARD ===== STOP =====" ) ; + if ( position > 0 ) { stopvu = true ; } + } + } + } + } + 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); +// + // En mode information, on force le succes pour pouvoir consulter le fichier log + if ( modeHOMARD != 1 ) { codretexec = 0 ; } + } + } + + // I. Menage et retour dans le répertoire du cas + if (codret == 0) + { + delete myDriver; + MESSAGE ( ". On retourne dans nomDirWork = " << nomDirWork ); + + 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 spécifique à l'adaptation +//============================================================================= +CORBA::Long ADAPT_Gen_i::ComputeAdap(ADAPT::HOMARD_Cas_var myCase, ADAPT::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage, HomardDriver* myDriver, CORBA::Long Option1, CORBA::Long Option2) +{ + MESSAGE ( "ComputeAdap avec Option1 = " << Option1 << ", Option2 = " << Option2 ); + + // A. Prealable + // A.1. Bases + int codret = 0; + // Numero de l'iteration + int NumeIter = myIteration->GetNumber(); + std::stringstream saux0 ; + saux0 << NumeIter-1 ; + std::string siter = saux0.str() ; + if (NumeIter < 11) { siter = "0" + siter ; } + + // A.2. On verifie qu il y a une hypothese (erreur improbable); + const char* nomHypo = myIteration->GetHypoName(); + if (std::string(nomHypo) == std::string("")) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This iteration does not have any associated hypothesis."; + throw SALOME::SALOME_Exception(es); + return 2; + }; + ADAPT::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypo]; + ASSERT(!CORBA::is_nil(myHypo)); + + // B. L'iteration parent + const char* nomIterationParent = myIteration->GetIterParentName(); + ADAPT::HOMARD_Iteration_var myIterationParent = myStudyContext._mesIterations[nomIterationParent]; + ASSERT(!CORBA::is_nil(myIterationParent)); + // Si l'iteration parent n'est pas calculee, on le fait (recursivite amont) + if ( myIterationParent->GetState() == 1 ) + { + int iaux = 1 ; + int codret = Compute(nomIterationParent, etatMenage, iaux, Option1, Option2); + if (codret != 0) + { + // GERALD -- QMESSAGE BOX + VERIFICATION("Pb au calcul de l'iteration precedente" == 0); + } + }; + + // C. Le sous-répertoire de l'iteration precedente + char* DirComputePa = ComputeDirPaManagement(myCase, myIteration); + MESSAGE( ". DirComputePa = " << DirComputePa ); + + // D. Les données de l'adaptation HOMARD + // D.1. Le type de conformite + int ConfType = myCase->GetConfType(); + MESSAGE ( ". ConfType = " << ConfType ); + + // D.1. Le type externe + int ExtType = myCase->GetExtType(); + MESSAGE ( ". ExtType = " << ExtType ); + + // D.3. Le maillage de depart + const char* NomMeshParent = myIterationParent->GetMeshName(); + MESSAGE ( ". NomMeshParent = " << NomMeshParent ); + const char* MeshFileParent = myIterationParent->GetMeshFile(); + MESSAGE ( ". MeshFileParent = " << MeshFileParent ); + + // D.4. Le maillage associe a l'iteration + const char* MeshFile = myIteration->GetMeshFile(); + MESSAGE ( ". MeshFile = " << MeshFile ); + FILE *file = fopen(MeshFile,"r"); + if (file != NULL) + { + fclose(file); + if (etatMenage == 0) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "MeshFile : " + std::string(MeshFile) + " already exists "; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + return 4; + } + else + { + std::string commande = "rm -f " + std::string(MeshFile); + codret = system(commande.c_str()); + if (codret != 0) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The mesh file cannot be deleted."; + throw SALOME::SALOME_Exception(es); + return 5; + } + } + } + + // D.5. Les types de raffinement et de deraffinement + // Les appels corba sont lourds, il vaut mieux les grouper + ADAPT::listeTypes* ListTypes = myHypo->GetAdapRefinUnRef(); + ASSERT(ListTypes->length() == 3); + int TypeAdap = (*ListTypes)[0]; + int TypeRaff = (*ListTypes)[1]; + int TypeDera = (*ListTypes)[2]; +// MESSAGE ( ". TypeAdap = " << TypeAdap << ", TypeRaff = " << TypeRaff << ", TypeDera = " << TypeDera ); + + // E. Texte du fichier de configuration + // E.1. Incontournables du texte + myDriver->TexteAdap(ExtType); + int iaux = 0 ; + myDriver->TexteMaillageHOMARD( DirComputePa, siter, iaux ) ; + myDriver->TexteMaillage(NomMeshParent, MeshFileParent, 0); + myDriver->TexteConfRaffDera(ConfType, TypeAdap, TypeRaff, TypeDera); + + // E.2. Ajout des informations liees aux zones eventuelles + if ( TypeAdap == 0 ) + { DriverTexteZone(myHypo, myDriver) ; } + + // E.3. Ajout des informations liees aux champs eventuels + if ( TypeAdap == 1 ) + { DriverTexteField(myIteration, myHypo, myDriver) ; } + + // E.4. Ajout des informations liees au filtrage eventuel par les groupes + ADAPT::ListGroupType* listeGroupes = myHypo->GetGroups(); + int numberOfGroups = listeGroupes->length(); + MESSAGE( ". Filtrage par " << numberOfGroups << " groupes"); + if (numberOfGroups > 0) + { + for (int NumGroup = 0; NumGroup< numberOfGroups; NumGroup++) + { + std::string GroupName = std::string((*listeGroupes)[NumGroup]); + MESSAGE( "... GroupName = " << GroupName ); + myDriver->TexteGroup(GroupName); + } + } + + // E.5. Ajout des informations liees a l'eventuelle interpolation des champs + DriverTexteFieldInterp(myIteration, myHypo, myDriver) ; + + // E.6. Ajout des options avancees + int Pyram = myCase->GetPyram(); + MESSAGE ( ". Pyram = " << Pyram ); + int NivMax = myHypo->GetNivMax(); + MESSAGE ( ". NivMax = " << NivMax ); + double DiamMin = myHypo->GetDiamMin() ; + MESSAGE ( ". DiamMin = " << DiamMin ); + int AdapInit = myHypo->GetAdapInit(); + MESSAGE ( ". AdapInit = " << AdapInit ); + int ExtraOutput = myHypo->GetExtraOutput(); + MESSAGE ( ". ExtraOutput = " << ExtraOutput ); + myDriver->TexteAdvanced(Pyram, NivMax, DiamMin, AdapInit, ExtraOutput); + + // E.7. Ajout des informations sur le deroulement de l'execution + int MessInfo = myIteration->GetInfoCompute(); + MESSAGE ( ". MessInfo = " << MessInfo ); + myDriver->TexteInfoCompute(MessInfo); + + return codret ; +} +//============================================================================= +// Calcul d'une iteration : partie spécifique au suivi de frontière CAO +//============================================================================= +CORBA::Long ADAPT_Gen_i::ComputeCAO(ADAPT::HOMARD_Cas_var myCase, ADAPT::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 + ADAPT::ListBoundaryGroupType* ListBoundaryGroupType = myCase->GetBoundaryGroup(); + std::string BoundaryName = std::string((*ListBoundaryGroupType)[0]); + MESSAGE ( ". BoundaryName = " << BoundaryName ); + ADAPT::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 ADAPT_Gen_i::ComputeCAObis(ADAPT::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(); + ADAPT::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* ADAPT_Gen_i::CreateDirNameIter(const char* nomrep, CORBA::Long num ) +{ + MESSAGE ( "CreateDirNameIter : nomrep ="<< nomrep << ", num = "<d_name); +#else + HANDLE hFind = INVALID_HANDLE_VALUE; + WIN32_FIND_DATA ffd; + hFind = FindFirstFile(nomrep, &ffd); + if (INVALID_HANDLE_VALUE != hFind) { + while (FindNextFile(hFind, &ffd) != 0) { + if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories + std::string file_name(ffd.cFileName); +#endif + if ( file_name == DirNameA.str() ) { existe = true ; } + } +#ifndef WIN32 + closedir(dp); +#else + FindClose(hFind); +#endif + if ( !existe ) + { + DirName = DirNameA.str() ; + a_chercher = false ; + break ; + } + } + num += 1; + } + + MESSAGE ( "==> DirName = " << DirName); + MESSAGE ( ". On retourne dans nomDirActuel = " << nomDirActuel ); + CHDIR(nomDirActuel.c_str()); + return CORBA::string_dup( DirName.c_str() ); +} +//============================================================================= +// Calcul d'une iteration : gestion du répertoire de calcul +// Si le sous-répertoire existe : +// etatMenage = 0 : on sort en erreur si le répertoire n'est pas vide +// etatMenage = 1 : on fait le menage du répertoire +// etatMenage = -1 : on ne fait rien +//============================================================================= +char* ADAPT_Gen_i::ComputeDirManagement(ADAPT::HOMARD_Cas_var myCase, ADAPT::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage) +{ + MESSAGE ( "ComputeDirManagement : répertoires pour le calcul" ); + // B.2. Le répertoire du cas + const char* nomDirCase = myCase->GetDirName(); + MESSAGE ( ". nomDirCase = " << nomDirCase ); + + // 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-répertoire + std::stringstream DirCompute ; + DirCompute << nomDirCase << "/" << nomDirIt; + MESSAGE (". DirCompute = " << DirCompute.str() ); + + // B.3.3. Si le sous-répertoire n'existe pas, on le cree + if (CHDIR(DirCompute.str().c_str()) != 0) + { +#ifndef WIN32 + if (mkdir(DirCompute.str().c_str(), S_IRWXU|S_IRGRP|S_IXGRP) != 0) +#else + if (_mkdir(DirCompute.str().c_str()) != 0) +#endif + { + // GERALD -- QMESSAGE BOX + std::cerr << "Pb Creation du répertoire DirCompute = " << DirCompute.str() << std::endl; + VERIFICATION("Pb a la creation du répertoire" == 0); + } + } + else + { +// Le répertoire existe +// On demande de faire le menage de son contenu : + if (etatMenage == 1) + { + 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 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 : + else + { + if (etatMenage == 0) + { +#ifndef WIN32 + DIR *dp; + struct dirent *dirp; + dp = opendir(DirCompute.str().c_str()); + bool result = true; + while ((dirp = readdir(dp)) != NULL && result ) + { + std::string file_name(dirp->d_name); + result = file_name.empty() || file_name == "." || file_name == ".."; //if any file - break and return false + } + closedir(dp); +#else + HANDLE hFind = INVALID_HANDLE_VALUE; + WIN32_FIND_DATA ffd; + hFind = FindFirstFile(DirCompute.str().c_str(), &ffd); + bool result = true; + if (INVALID_HANDLE_VALUE != hFind) { + while (FindNextFile(hFind, &ffd) != 0) { + if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories + std::string file_name(ffd.cFileName); + result = file_name.empty() || file_name == "." || file_name == ".."; //if any file - break and return false + } + } + FindClose(hFind); +#endif + if ( result == false) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "Directory : " + DirCompute.str() + " is not empty"; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + VERIFICATION("Directory is not empty" == 0); + } + } + } + } + + return CORBA::string_dup( DirCompute.str().c_str() ); +} +//============================================================================= +// Calcul d'une iteration : gestion du répertoire de calcul de l'iteration parent +//============================================================================= +char* ADAPT_Gen_i::ComputeDirPaManagement(ADAPT::HOMARD_Cas_var myCase, ADAPT::HOMARD_Iteration_var myIteration) +{ + MESSAGE ( "ComputeDirPaManagement : répertoires pour le calcul" ); + // Le répertoire du cas + const char* nomDirCase = myCase->GetDirName(); + MESSAGE ( ". nomDirCase = " << nomDirCase ); + + // Le sous-répertoire de l'iteration precedente + + const char* nomIterationParent = myIteration->GetIterParentName(); + ADAPT::HOMARD_Iteration_var myIterationParent = myStudyContext._mesIterations[nomIterationParent]; + const char* nomDirItPa = myIterationParent->GetDirNameLoc(); + std::stringstream DirComputePa ; + DirComputePa << nomDirCase << "/" << nomDirItPa; + MESSAGE( ". nomDirItPa = " << nomDirItPa); + MESSAGE( ". DirComputePa = " << DirComputePa.str() ); + + return CORBA::string_dup( DirComputePa.str().c_str() ); +} +//============================================================================= +// Calcul d'une iteration : ecriture des zones dans le fichier de configuration +//============================================================================= +void ADAPT_Gen_i::DriverTexteZone(ADAPT::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver) +{ + MESSAGE ( "... DriverTexteZone" ); + ADAPT::listeZonesHypo* ListZone = myHypo->GetZones(); + int numberOfZonesx2 = ListZone->length(); + int NumZone ; + + for (int iaux = 0; iaux< numberOfZonesx2; iaux++) + { + std::string ZoneName = std::string((*ListZone)[iaux]); + MESSAGE ( "... ZoneName = " << ZoneName); + ADAPT::HOMARD_Zone_var myZone = myStudyContext._mesZones[ZoneName]; + ASSERT(!CORBA::is_nil(myZone)); + + int ZoneType = myZone->GetType(); + std::string TypeUsestr = std::string((*ListZone)[iaux+1]); + int TypeUse = atoi( TypeUsestr.c_str() ); + MESSAGE ( "... ZoneType = " << ZoneType << ", TypeUse = "<GetCoords(); + if ( ZoneType == 2 || ( ZoneType>=11 && ZoneType <=13 ) ) // Cas d un parallelepipede ou d'un rectangle + { myDriver->TexteZone(NumZone, ZoneType, TypeUse, (*zone)[0], (*zone)[1], (*zone)[2], (*zone)[3], (*zone)[4], (*zone)[5], 0., 0., 0.); } + else if ( ZoneType == 4 ) // Cas d une sphere + { myDriver->TexteZone(NumZone, ZoneType, TypeUse, (*zone)[0], (*zone)[1], (*zone)[2], (*zone)[3], 0., 0., 0., 0., 0.); } + else if ( ZoneType == 5 || ( ZoneType>=31 && ZoneType <=33 ) ) // Cas d un cylindre ou d'un disque + { myDriver->TexteZone(NumZone, ZoneType, TypeUse, (*zone)[0], (*zone)[1], (*zone)[2], (*zone)[3], (*zone)[4], (*zone)[5], (*zone)[6], (*zone)[7], 0.); } + else if ( ZoneType == 7 || ( ZoneType>=61 && ZoneType <=63 ) ) // Cas d un tuyau ou disque perce + { myDriver->TexteZone(NumZone, ZoneType, TypeUse, (*zone)[0], (*zone)[1], (*zone)[2], (*zone)[3], (*zone)[4], (*zone)[5], (*zone)[6], (*zone)[7], (*zone)[8]); } + else { VERIFICATION("ZoneType est incorrect." == 0) ; } + iaux += 1 ; + } + return ; +} +//============================================================================= +// Calcul d'une iteration : ecriture des champs dans le fichier de configuration +//============================================================================= +void ADAPT_Gen_i::DriverTexteField(ADAPT::HOMARD_Iteration_var myIteration, ADAPT::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver) +{ + MESSAGE ( "... DriverTexteField" ); +// Le fichier du champ + char* FieldFile = myIteration->GetFieldFile(); + MESSAGE ( ". FieldFile = " << FieldFile ); + if (strlen(FieldFile) == 0) + { + // GERALD -- QMESSAGE BOX + std::cerr << "Le fichier du champ n'a pas ete fourni." << std::endl; + VERIFICATION("The file for the field is not given." == 0); + } +// Les caracteristiques d'instants du champ de pilotage + int TimeStep = myIteration->GetTimeStep(); + MESSAGE( ". TimeStep = " << TimeStep ); + int Rank = myIteration->GetRank(); + MESSAGE( ". Rank = " << Rank ); +// Les informations sur les champs + ADAPT::InfosHypo* aInfosHypo = myHypo->GetField(); +// Le nom + const char* FieldName = aInfosHypo->FieldName; +// Les seuils + int TypeThR = aInfosHypo->TypeThR; + double ThreshR = aInfosHypo->ThreshR; + int TypeThC = aInfosHypo->TypeThC; + double ThreshC = aInfosHypo->ThreshC; +// Saut entre mailles ou non ? + int UsField = aInfosHypo->UsField; + MESSAGE( ". UsField = " << UsField ); +// L'usage des composantes + int UsCmpI = aInfosHypo->UsCmpI; + MESSAGE( ". UsCmpI = " << UsCmpI ); +// + myDriver->TexteField(FieldName, FieldFile, TimeStep, Rank, TypeThR, ThreshR, TypeThC, ThreshC, UsField, UsCmpI); +// +// Les composantes + ADAPT::listeComposantsHypo* mescompo = myHypo->GetComps(); + int numberOfCompos = mescompo->length(); + MESSAGE( ". numberOfCompos = " << numberOfCompos ); + for (int NumeComp = 0; NumeComp< numberOfCompos; NumeComp++) + { + std::string nomCompo = std::string((*mescompo)[NumeComp]); + MESSAGE( "... nomCompo = " << nomCompo ); + myDriver->TexteCompo(NumeComp, nomCompo); + } + return ; +} +//============================================================================= +// Calcul d'une iteration : ecriture des frontieres dans le fichier de configuration +// On ecrit dans l'ordre : +// 1. la definition des frontieres +// 2. les liens avec les groupes +// 3. un entier resumant le type de comportement pour les frontieres +//============================================================================= +int ADAPT_Gen_i::DriverTexteBoundary(ADAPT::HOMARD_Cas_var myCase, HomardDriver* myDriver) +{ + MESSAGE ( "... DriverTexteBoundary" ); + // 1. Recuperation des frontieres + std::list ListeBoundaryTraitees ; + ADAPT::ListBoundaryGroupType* ListBoundaryGroupType = myCase->GetBoundaryGroup(); + int numberOfitems = ListBoundaryGroupType->length(); + MESSAGE ( "... number of string for Boundary+Group = " << numberOfitems); + int BoundaryOption = 1 ; + // 2. Parcours des frontieres pour ecrire leur description + int NumBoundaryAnalytical = 0 ; + for (int NumBoundary = 0; NumBoundary< numberOfitems; NumBoundary=NumBoundary+2) + { + std::string BoundaryName = std::string((*ListBoundaryGroupType)[NumBoundary]); + MESSAGE ( "... BoundaryName = " << BoundaryName); + // 2.1. La frontiere a-t-elle deja ete ecrite ? + // Cela arrive quand elle est liee a plusieurs groupes. Il ne faut l'ecrire que la premiere fois + int A_faire = 1 ; + std::list::const_iterator it = ListeBoundaryTraitees.begin(); + while (it != ListeBoundaryTraitees.end()) + { + MESSAGE ( "..... BoundaryNameTraitee = " << *it); + if ( BoundaryName == *it ) { A_faire = 0 ; } + it++; + } + // 2.2. Ecriture de la frontiere + if ( A_faire == 1 ) + { + // 2.2.1. Caracteristiques de la frontiere + ADAPT::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; + ASSERT(!CORBA::is_nil(myBoundary)); + int BoundaryType = myBoundary->GetType(); + MESSAGE ( "... BoundaryType = " << BoundaryType ); + // 2.2.2. Ecriture selon le type + // 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->GetDataFile() ; + MESSAGE ( ". MeshFile = " << MeshFile ); + myDriver->TexteBoundaryDi( MeshName, MeshFile); + if ( BoundaryOption % 2 != 0 ) { BoundaryOption = BoundaryOption*2 ; } + } + // 2.2.2.3. Cas d une frontiere analytique + else + { + NumBoundaryAnalytical++ ; + ADAPT::double_array* coor = myBoundary->GetCoords(); + if (BoundaryType == 1) // Cas d un cylindre + { + myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], (*coor)[4], (*coor)[5], (*coor)[6], 0.); + if ( BoundaryOption % 3 != 0 ) { BoundaryOption = BoundaryOption*3 ; } + } + else if (BoundaryType == 2) // Cas d une sphere + { + myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], 0., 0., 0., 0.); + if ( BoundaryOption % 3 != 0 ) { BoundaryOption = BoundaryOption*3 ; } + } + else if (BoundaryType == 3) // Cas d un cone defini par un axe et un angle + { + myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], (*coor)[4], (*coor)[5], (*coor)[6], 0.); + if ( BoundaryOption % 3 != 0 ) { BoundaryOption = BoundaryOption*3 ; } + } + else if (BoundaryType == 4) // Cas d un cone defini par les 2 rayons + { + myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], (*coor)[4], (*coor)[5], (*coor)[6], (*coor)[7]); + if ( BoundaryOption % 3 != 0 ) { BoundaryOption = BoundaryOption*3 ; } + } + else if (BoundaryType == 5) // Cas d un tore + { + myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], (*coor)[4], (*coor)[5], (*coor)[6], (*coor)[7]); + if ( BoundaryOption % 3 != 0 ) { BoundaryOption = BoundaryOption*3 ; } + } + } + // 2.2.3. Memorisation du traitement + ListeBoundaryTraitees.push_back( BoundaryName ); + } + } + // 3. Parcours des frontieres pour ecrire les liens avec les groupes + NumBoundaryAnalytical = 0 ; + for (int NumBoundary = 0; NumBoundary< numberOfitems; NumBoundary=NumBoundary+2) + { + std::string BoundaryName = std::string((*ListBoundaryGroupType)[NumBoundary]); + MESSAGE ( "... BoundaryName = " << BoundaryName); + ADAPT::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; + ASSERT(!CORBA::is_nil(myBoundary)); + int BoundaryType = myBoundary->GetType(); + MESSAGE ( "... BoundaryType = " << BoundaryType ); + // 3.1. Recuperation du nom du groupe + std::string GroupName = std::string((*ListBoundaryGroupType)[NumBoundary+1]); + MESSAGE ( "... GroupName = " << GroupName); + // 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.4. Cas d une frontiere analytique + else + { + NumBoundaryAnalytical++ ; + myDriver->TexteBoundaryAnGr ( BoundaryName, NumBoundaryAnalytical, GroupName ) ; + } + } + // 4. Ecriture de l'option finale + myDriver->TexteBoundaryOption(BoundaryOption); +// + return BoundaryOption ; +} +//============================================================================= +// Calcul d'une iteration : ecriture des interpolations dans le fichier de configuration +//============================================================================= +void ADAPT_Gen_i::DriverTexteFieldInterp(ADAPT::HOMARD_Iteration_var myIteration, ADAPT::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver) +{ + MESSAGE ( "... DriverTexteFieldInterp" ); + int TypeFieldInterp = myHypo->GetTypeFieldInterp(); + MESSAGE ( "... TypeFieldInterp = " << TypeFieldInterp); + if (TypeFieldInterp != 0) + { +// Le fichier des champs + char* FieldFile = myIteration->GetFieldFile(); + MESSAGE ( ". FieldFile = " << FieldFile ); + if (strlen(FieldFile) == 0) + { + // GERALD -- QMESSAGE BOX + VERIFICATION("The file for the field is not given." == 0); + } + // + const char* MeshFile = myIteration->GetMeshFile(); + myDriver->TexteFieldInterp(FieldFile, MeshFile); + + // Les champs + // Interpolation de tous les champs + if ( TypeFieldInterp == 1 ) + { + myDriver->TexteFieldInterpAll(); + } + // Interpolation de certains champs + else if (TypeFieldInterp == 2) + { + // Les champs et leurs instants pour l'iteration + ADAPT::listeFieldInterpTSRsIter* ListFieldTSR = myIteration->GetFieldInterpsTimeStepRank(); + int numberOfFieldsx3 = ListFieldTSR->length(); + MESSAGE( ". pour iteration, numberOfFields = " << numberOfFieldsx3/3 ); + // Les champs pour l'hypothese + ADAPT::listeFieldInterpsHypo* ListField = myHypo->GetFieldInterps(); + int numberOfFieldsx2 = ListField->length(); + MESSAGE( ". pour hypothese, numberOfFields = " << numberOfFieldsx2/2 ); + // On parcourt tous les champs de l'hypothese + int NumField = 0 ; + for (int iaux = 0; iaux< numberOfFieldsx2; iaux++) + { + // Le nom du champ + std::string FieldName = std::string((*ListField)[iaux]) ; + // 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 + int tsrvu = 0; + for (int jaux = 0; jaux< numberOfFieldsx3; jaux++) + { + // Le nom du champ + std::string FieldName2 = std::string((*ListFieldTSR)[jaux]) ; + MESSAGE( "..... FieldName2 = " << FieldName2 ); + // Quand c'est le bon champ, on ecrit le pas de temps + if ( FieldName == FieldName2 ) + { + tsrvu = 1 ; + // Le pas de temps + std::string TimeStepstr = std::string((*ListFieldTSR)[jaux+1]) ; + // Le numero d'ordre + std::string Rankstr = std::string((*ListFieldTSR)[jaux+2]) ; + MESSAGE( "..... TimeStepstr = " << TimeStepstr <<", Rankstr = "<TexteFieldInterpNameType(NumField, FieldName, TypeInterpstr, TimeStep, Rank); + } + jaux += 2 ; + } + // Si aucun instant n'a été défini + if ( tsrvu == 0 ) + { + NumField += 1 ; + myDriver->TexteFieldInterpNameType(NumField, FieldName, TypeInterpstr, -1, -1); + } + iaux++ ; + } + } + } + return ; +} +//=========================================================================== +//=========================================================================== + + +//=========================================================================== +//=========================================================================== +// Publications +//=========================================================================== +//=========================================================================== +SALOMEDS::SObject_ptr ADAPT_Gen_i::PublishInStudy(SALOMEDS::SObject_ptr theSObject, + CORBA::Object_ptr theObject, + const char* theName) +{ + MESSAGE("PublishInStudy pour " << theName); + SALOMEDS::SObject_var aResultSO; + if (CORBA::is_nil(myStudy)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid study context"; + throw SALOME::SALOME_Exception(es); + return 0; + }; + +// Recuperation de l'objet correspondant, en essayant chacun des types possibles +// Rq : Iteration est publiee ailleurs + ADAPT::HOMARD_Boundary_var aBoundary = ADAPT::HOMARD_Boundary::_narrow(theObject); + ADAPT::HOMARD_Cas_var aCase = ADAPT::HOMARD_Cas::_narrow(theObject); + ADAPT::HOMARD_Hypothesis_var aHypo = ADAPT::HOMARD_Hypothesis::_narrow(theObject); + ADAPT::HOMARD_YACS_var aYACS = ADAPT::HOMARD_YACS::_narrow(theObject); + ADAPT::HOMARD_Zone_var aZone = ADAPT::HOMARD_Zone::_narrow(theObject); + + UpdateStudy(); + +// Controle de la non publication d'un objet de meme nom + if ( (!aBoundary->_is_nil()) || (!aHypo->_is_nil()) || (!aYACS->_is_nil()) || (!aZone->_is_nil()) ) + { + SALOMEDS::Study::ListOfSObject_var listSO = myStudy->FindObjectByName(theName, ComponentDataType()); + if (listSO->length() >= 1) + { + MESSAGE("This name "<length()<<" time(s)"); + aResultSO = listSO[0]; + return aResultSO._retn(); + } + } + + // Caracteristiques de l'etude + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + aStudyBuilder->NewCommand(); + if(!aBoundary->_is_nil()) + aResultSO = PublishBoundaryInStudy(aStudyBuilder, aBoundary, theName); + else if(!aCase->_is_nil()) + aResultSO = PublishCaseInStudy(aStudyBuilder, aCase, theName); + else if(!aHypo->_is_nil()) + aResultSO = PublishHypotheseInStudy(aStudyBuilder, aHypo, theName); + else if(!aYACS->_is_nil()) + aResultSO = PublishYACSInStudy(aStudyBuilder, aYACS, theName); + else if(!aZone->_is_nil()) + aResultSO = PublishZoneInStudy(aStudyBuilder, aZone, theName); + + aStudyBuilder->CommitCommand(); + + return aResultSO._retn(); +}; +//============================================================================= +SALOMEDS::SObject_ptr ADAPT_Gen_i::PublishBoundaryInStudy( SALOMEDS::StudyBuilder_var aStudyBuilder, + ADAPT::HOMARD_Boundary_ptr theObject, const char* theName) +{ + MESSAGE("PublishBoundaryStudy pour "<FindComponent(ComponentDataType()); + if (theFatherHomard->_is_nil()) + { + MESSAGE("theFatherHomard->_is_nil()"); + return aResultSO._retn(); + } + + // On ajoute la categorie des boundarys dans l etude si necessaire + if ( _tag_boun == 0 ) + { + _tag_gene += 1 ; + _tag_boun = _tag_gene ; + } + MESSAGE("PublishBoundaryInStudy _tag_gene = "<<_tag_gene << ", _tag_boun = "<<_tag_boun ); + SALOMEDS::SObject_var aSObject; + if (!theFatherHomard->FindSubObject(_tag_boun, aSObject)) + { + MESSAGE("Ajout de la categorie des boundarys"); + aSObject = aStudyBuilder->NewObjectToTag(theFatherHomard, _tag_boun); + PublishInStudyAttr(aStudyBuilder, aSObject, "Boundaries", "BoundList", "zone_icone_2.png", NULL ) ; + } + else { MESSAGE("La categorie des boundarys existe deja."); } + + CORBA::Long BoundaryType = myBoundary->GetType(); +// MESSAGE("BoundaryType : "<NewObject(aSObject); + PublishInStudyAttr(aStudyBuilder, aResultSO, theName, value.c_str(), icone.c_str(), _orb->object_to_string(theObject)); + return aResultSO._retn(); +} +//============================================================================= +SALOMEDS::SObject_ptr ADAPT_Gen_i::PublishCaseInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, + ADAPT::HOMARD_Cas_ptr theObject, const char* theName) +{ + MESSAGE("PublishCaseInStudy pour "<_is_nil()"); + return aResultSO._retn(); + } + if (myStudy->_is_nil()) { + MESSAGE("ADAPT_Gen_i::myStudy->_is_nil()"); + return aResultSO._retn(); + } + + // On recupere le module pere dans l etude + SALOMEDS::SComponent_var theFatherHomard = myStudy->FindComponent(ComponentDataType()); + if (theFatherHomard->_is_nil()) + { + MESSAGE("theFatherHomard->_is_nil()"); + return aResultSO._retn(); + } + + _tag_gene += 1 ; + MESSAGE("PublishCaseInStudy _tag_gene = "<<_tag_gene ); + aResultSO = aStudyBuilder->NewObject(theFatherHomard); + PublishInStudyAttr(aStudyBuilder, aResultSO, theName, "CasHomard", "cas_calcule.png", + _orb->object_to_string(theObject) ) ; + + return aResultSO._retn(); +} +//============================================================================= +SALOMEDS::SObject_ptr ADAPT_Gen_i::PublishHypotheseInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, + ADAPT::HOMARD_Hypothesis_ptr theObject, const char* theName) +{ + MESSAGE("PublishHypotheseInStudy pour "<FindComponent(ComponentDataType()); + if (theFatherHomard->_is_nil()) + { + MESSAGE("theFatherHomard->_is_nil()"); + return aResultSO._retn(); + } + + // On ajoute la categorie des hypotheses dans l etude si necessaire + SALOMEDS::SObject_var aSObject; + if ( _tag_hypo == 0 ) + { + _tag_gene += 1 ; + _tag_hypo = _tag_gene ; + } + MESSAGE("PublishHypotheseInStudy _tag_gene = "<<_tag_gene << ", _tag_hypo = "<<_tag_hypo ); + if (!theFatherHomard->FindSubObject(_tag_hypo, aSObject)) + { + MESSAGE("Ajout de la categorie des hypotheses"); + aSObject = aStudyBuilder->NewObjectToTag(theFatherHomard, _tag_hypo); + PublishInStudyAttr(aStudyBuilder, aSObject, "Hypothesis", "HypoList", "hypotheses.png", NULL); + } + else { MESSAGE("La categorie des hypotheses existe deja."); } + +// Creation du resultat dans l'etude + aResultSO = aStudyBuilder->NewObject(aSObject); + PublishInStudyAttr(aStudyBuilder, aResultSO, theName, "HypoHomard", NULL, _orb->object_to_string(theObject) ) ; + + return aResultSO._retn(); +} +//============================================================================= +SALOMEDS::SObject_ptr ADAPT_Gen_i::PublishYACSInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, + ADAPT::HOMARD_YACS_ptr theObject, const char* theName) +{ + MESSAGE("PublishYACSInStudy pour "<FindComponent(ComponentDataType()); + if (theFatherHomard->_is_nil()) + { + MESSAGE("theFatherHomard->_is_nil()"); + return aResultSO._retn(); + } + // On ajoute la categorie des schemas YACS dans l etude si necessaire + if ( _tag_yacs == 0 ) + { + _tag_gene += 1 ; + _tag_yacs = _tag_gene ; + } + MESSAGE("PublishZoneStudy _tag_gene = "<<_tag_gene << ", _tag_yacs = "<<_tag_yacs ); + SALOMEDS::SObject_var aSObject; + if (!theFatherHomard->FindSubObject(_tag_yacs, aSObject)) + { + MESSAGE("Ajout de la categorie des schemas YACS"); + aSObject = aStudyBuilder->NewObjectToTag(theFatherHomard, _tag_yacs); + PublishInStudyAttr(aStudyBuilder, aSObject, "YACS", "YACSList", "full_view.png", NULL); + } + else { MESSAGE("La categorie des schemas YACS existe deja."); } + +// Creation du resultat dans l'etude + aResultSO = aStudyBuilder->NewObject(aSObject); + PublishInStudyAttr(aStudyBuilder, aResultSO, theName, "YACSHomard", "schema.png", _orb->object_to_string(theObject) ) ; + + return aResultSO._retn(); +} + +//============================================================================= +SALOMEDS::SObject_ptr ADAPT_Gen_i::PublishZoneInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, + ADAPT::HOMARD_Zone_ptr theObject, const char* theName) +{ + MESSAGE("PublishZoneStudy pour "<_is_nil()"); + return aResultSO._retn(); + } + if (myStudy->_is_nil()) + { + MESSAGE("PublishZoneInStudy : myStudy->_is_nil()"); + return aResultSO._retn(); + } + SALOMEDS::SComponent_var theFatherHomard = myStudy->FindComponent(ComponentDataType()); + if (theFatherHomard->_is_nil()) + { + MESSAGE("PublishZoneInStudy : theFatherHomard->_is_nil()"); + return aResultSO._retn(); + } + + // Caracteristique de la zone + ADAPT::HOMARD_Zone_var myZone = myStudyContext._mesZones[theName]; + CORBA::Long ZoneType = myZone->GetType(); + + // On ajoute la categorie des zones dans l etude si necessaire + if ( _tag_zone == 0 ) + { + _tag_gene += 1 ; + _tag_zone = _tag_gene ; + } + MESSAGE("PublishZoneStudy _tag_gene = "<<_tag_gene << ", _tag_zone = "<<_tag_zone ); + SALOMEDS::SObject_var aSObject; + if (!theFatherHomard->FindSubObject(_tag_zone, aSObject)) + { + MESSAGE("Ajout de la categorie des zones"); + aSObject = aStudyBuilder->NewObjectToTag(theFatherHomard, _tag_zone); + PublishInStudyAttr(aStudyBuilder, aSObject, "Zones", "ZoneList", "zone_icone_2.png", NULL ) ; + } + else { MESSAGE("La categorie des zones existe deja."); } + + aResultSO = aStudyBuilder->NewObject(aSObject); + std::string icone ; + switch (ZoneType) + { + case 11 : + { } + case 12 : + { } + case 13 : + { icone = "boxdxy_2.png" ; + break ; + } + case 2 : + { icone = "boxdxyz_2.png" ; + break ; + } + case 31 : + { } + case 32 : + { } + case 33 : + { icone = "disk_2.png" ; + break ; + } + case 4 : + { icone = "spherepoint_2.png" ; + break ; + } + case 5 : + { icone = "cylinderpointvector_2.png" ; + break ; + } + case 61 : + { } + case 62 : + { } + case 63 : + { icone = "diskwithhole_2.png" ; + break ; + } + case 7 : + { icone = "pipe_2.png" ; + break ; + } + } + PublishInStudyAttr(aStudyBuilder, aResultSO, theName, "ZoneHomard", icone.c_str(), _orb->object_to_string(theObject) ) ; + + return aResultSO._retn(); +} +//=========================================================================== +void ADAPT_Gen_i::PublishInStudyAttr(SALOMEDS::StudyBuilder_var aStudyBuilder, + SALOMEDS::SObject_var aResultSO, + const char* name, const char* comment, const char* icone, const char* ior) +{ + MESSAGE("PublishInStudyAttr pour name = "<SetValue(name); + } + +// Ajout du commentaire + if ( comment != NULL ) + { + anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeComment"); + SALOMEDS::AttributeComment_var aCommentAttrib = SALOMEDS::AttributeComment::_narrow(anAttr); + aCommentAttrib->SetValue(comment); + } + +// Ajout de l'icone + if ( icone != NULL ) + { + anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributePixMap"); + SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap(icone); + } + +// Ajout de l ior + if ( ior != NULL ) + { + anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeIOR"); + SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + anIOR->SetValue(ior); + } +}; + +//===================================================================================== +void ADAPT_Gen_i::PublishBoundaryUnderCase(const char* CaseName, const char* BoundaryName) +{ + MESSAGE ( "PublishBoundaryUnderCase : CaseName = " << CaseName << ", BoundaryName= " << BoundaryName ); + + ADAPT::HOMARD_Cas_var myCase = myStudyContext._mesCas[CaseName]; + ASSERT(!CORBA::is_nil(myCase)); + SALOMEDS::SObject_var aCaseSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myCase))); + ASSERT(!CORBA::is_nil(aCaseSO)); + + ADAPT::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; + ASSERT(!CORBA::is_nil(myBoundary)); + SALOMEDS::SObject_var aBoundarySO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myBoundary))); + ASSERT(!CORBA::is_nil(aBoundarySO)); + + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + + aStudyBuilder->NewCommand(); + + SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aCaseSO); + aStudyBuilder->Addreference(aSubSO, aBoundarySO); +// aStudyBuilder->RemoveReference(aSubSO); + + aStudyBuilder->CommitCommand(); + +}; +//===================================================================================== +void ADAPT_Gen_i::PublishCaseUnderYACS(const char* nomYACS, const char* CaseName) +{ + MESSAGE ( "PublishCaseUnderYACS : nomYACS = " << nomYACS << ", CaseName= " << CaseName ); + + ADAPT::HOMARD_YACS_var myYACS = myStudyContext._mesYACSs[nomYACS]; + ASSERT(!CORBA::is_nil(myYACS)); + SALOMEDS::SObject_var aYACSSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myYACS))); + ASSERT(!CORBA::is_nil(aYACSSO)); + + ADAPT::HOMARD_Cas_var myCase = myStudyContext._mesCas[CaseName]; + ASSERT(!CORBA::is_nil(myCase)); + SALOMEDS::SObject_var aCaseSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myCase))); + ASSERT(!CORBA::is_nil(aCaseSO)); + + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + + aStudyBuilder->NewCommand(); + + SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aYACSSO); + aStudyBuilder->Addreference(aSubSO, aCaseSO); + + aStudyBuilder->CommitCommand(); + +}; +//============================================================================= +void ADAPT_Gen_i::PublishResultInSmesh(const char* NomFich, CORBA::Long Option) +// Option = 0 : fichier issu d'une importation +// Option = 1 : fichier issu d'une execution HOMARD +{ + MESSAGE( "PublishResultInSmesh " << NomFich << ", avec Option = " << Option); + if (CORBA::is_nil(myStudy)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid study context"; + throw SALOME::SALOME_Exception(es); + return ; + }; + +// Le module SMESH est-il actif ? + SALOMEDS::SObject_var aSmeshSO = myStudy->FindComponent("SMESH"); +// + if (!CORBA::is_nil(aSmeshSO)) + { +// On verifie que le fichier n est pas deja publie + SALOMEDS::ChildIterator_var aIter = myStudy->NewChildIterator(aSmeshSO); + for (; aIter->More(); aIter->Next()) + { + SALOMEDS::SObject_var aSO = aIter->Value(); + SALOMEDS::GenericAttribute_var aGAttr; + if (aSO->FindAttribute(aGAttr,"AttributeExternalFileDef")) + { + SALOMEDS::AttributeExternalFileDef_var anAttr = SALOMEDS::AttributeExternalFileDef::_narrow(aGAttr); + CORBA::String_var value=anAttr->Value(); + if (strcmp((const char*)value,NomFich) == 0) + { + MESSAGE ( "PublishResultInSmesh : le fichier " << NomFich << " est deja publie." ); + // Pour un fichier importe, on ne republie pas + if ( Option == 0 ) { return; } + // Pour un fichier calcule, on commence par faire la depublication + else + { + MESSAGE ( "PublishResultInSmesh : depublication" ); + SALOMEDS::AttributeName_var anAttr2 = SALOMEDS::AttributeName::_narrow(aGAttr); + CORBA::String_var value2=anAttr2->Value(); + std::string MeshName = string(value2) ; + MESSAGE ( "PublishResultInSmesh : depublication de " << MeshName ); + DeleteResultInSmesh(NomFich, MeshName) ; + } + } + } + } + } + +// 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")); + ASSERT(!CORBA::is_nil(aSmeshEngine)); + aSmeshEngine->UpdateStudy(); + SMESH::DriverMED_ReadStatus theStatus; + //aSmeshEngine->CreateMeshesFromMED(NomFich, theStatus); + +// On met a jour les attributs AttributeExternalFileDef et AttributePixMap + SMESH::mesh_array* mesMaillages=aSmeshEngine->CreateMeshesFromMED(NomFich, theStatus); + for (int i = 0; i < mesMaillages->length(); i++) + { + MESSAGE( ". Mise a jour des attributs du maillage"); + SMESH::SMESH_Mesh_var monMaillage= (*mesMaillages)[i]; + SALOMEDS::SObject_var aSO=SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(monMaillage))); + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + SALOMEDS::GenericAttribute_var aGAttr = aStudyBuilder->FindOrCreateAttribute(aSO, "AttributeExternalFileDef"); + SALOMEDS::AttributeExternalFileDef_var anAttr = SALOMEDS::AttributeExternalFileDef::_narrow(aGAttr); + anAttr->SetValue(NomFich); + SALOMEDS::GenericAttribute_var aPixMap = aStudyBuilder->FindOrCreateAttribute(aSO, "AttributePixMap" ); + SALOMEDS::AttributePixMap_var anAttr2 = SALOMEDS::AttributePixMap::_narrow(aPixMap); + const char* icone ; + if ( Option == 0 ) { icone = "mesh_tree_importedmesh.png" ; } + else { icone = "mesh_tree_mesh.png" ; } + anAttr2->SetPixMap( icone ); + } + +} +//============================================================================= +void ADAPT_Gen_i::DeleteResultInSmesh(std::string NomFich, std::string MeshName) +{ + MESSAGE ("DeleteResultInSmesh pour le maillage " << MeshName << " dans le fichier " << NomFich ); + if (CORBA::is_nil(myStudy)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid study context"; + throw SALOME::SALOME_Exception(es); + return ; + }; + +// Le module SMESH est-il actif ? + SALOMEDS::SObject_var aSmeshSO = myStudy->FindComponent("SMESH"); +// + if (CORBA::is_nil(aSmeshSO)) + { + return ; + }; +// On verifie que le fichier est deja publie + SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder(); + SALOMEDS::ChildIterator_var aIter = myStudy->NewChildIterator(aSmeshSO); + for (; aIter->More(); aIter->Next()) + { + SALOMEDS::SObject_var aSO = aIter->Value(); + SALOMEDS::GenericAttribute_var aGAttr; + if (aSO->FindAttribute(aGAttr,"AttributeExternalFileDef")) + { + SALOMEDS::AttributeExternalFileDef_var anAttr = SALOMEDS::AttributeExternalFileDef::_narrow(aGAttr); + CORBA::String_var value=anAttr->Value(); + if (strcmp((const char*)value,NomFich.c_str()) == 0) + { + if (aSO->FindAttribute(aGAttr,"AttributeName")) + { + SALOMEDS::AttributeName_var anAttr2 = SALOMEDS::AttributeName::_narrow(aGAttr); + CORBA::String_var value2=anAttr2->Value(); + if (strcmp((const char*)value2,MeshName.c_str()) == 0) + { + myBuilder->RemoveObjectWithChildren( aSO ) ; + } + } + } + } + } + return ; +} +//============================================================================= +void ADAPT_Gen_i::PublishMeshIterInSmesh(const char* NomIter) +{ + MESSAGE( "PublishMeshIterInSmesh " << NomIter); + ADAPT::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[NomIter]; + + SALOMEDS::SObject_var aIterSO=SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIteration))); + if (CORBA::is_nil(myIteration)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid iterationStudy Object"; + throw SALOME::SALOME_Exception(es); + return ; + }; + const char* MeshFile = myIteration->GetMeshFile() ; + const char* MeshName = myIteration->GetMeshName() ; + CORBA::Long Option = -1 ; + int etat = myIteration->GetState(); +// Iteration initiale + if ( etat <= 0 ) { Option = 0 ; } +// ou iteration calculee + else if ( etat == 2 ) { Option = 1 ; } +// Publication effective apres menage eventuel + if ( Option >= 0 ) + { + DeleteResultInSmesh(MeshFile, MeshName) ; + PublishResultInSmesh(MeshFile, Option) ; + } + +} +//============================================================================= +void ADAPT_Gen_i::PublishFileUnderIteration(const char* NomIter, const char* NomFich, const char* Commentaire) +{ +// MESSAGE ("PublishFileUnderIteration pour l'iteration " << NomIter << " du fichier " << NomFich << " avec le commentaire " << Commentaire ); + ADAPT::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[NomIter]; + + SALOMEDS::SObject_var aIterSO=SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIteration))); + if (CORBA::is_nil(myIteration)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid iterationStudy Object"; + throw SALOME::SALOME_Exception(es); + return ; + }; + + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + + aStudyBuilder->NewCommand(); + + SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aIterSO); +// Pour les fichiers med, on affiche une icone de maillage +// Pour les fichiers qui sont du texte, on affiche une icone de fichier texte 'texte' +// Le reperage se fait par la 1ere lettre du commentaire : I pour Iteration n + std::string icone ; + std::string ior = " " ; + if ( Commentaire[0] == 'M' ) + { icone = "med.png" ; } + else + { icone = "texte_2.png" ; } + PublishInStudyAttr(aStudyBuilder, aSubSO, NomFich, Commentaire, icone.c_str(), ior.c_str() ) ; + + aStudyBuilder->CommitCommand(); +} +// +//============================================================================= +void ADAPT_Gen_i::PublishFileUnderYACS(const char* nomYACS, const char* NomFich, const char* Commentaire) +{ +// MESSAGE ("PublishFileUnderYACS pour le schema " << nomYACS << " du fichier " << NomFich << " avec le commentaire " << Commentaire ); + ADAPT::HOMARD_YACS_var myYACS = myStudyContext._mesYACSs[nomYACS]; + + SALOMEDS::SObject_var aYACSSO=SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myYACS))); + if (CORBA::is_nil(myYACS)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid YACSStudy Object"; + throw SALOME::SALOME_Exception(es); + return ; + }; + + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + + aStudyBuilder->NewCommand(); + + SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aYACSSO); + std::string icone = "texte_2.png" ; + std::string ior = " " ; + PublishInStudyAttr(aStudyBuilder, aSubSO, NomFich, Commentaire, icone.c_str(), ior.c_str() ) ; + + aStudyBuilder->CommitCommand(); +} +// +//============================================================================= +//============================================================================= +// YACS +//============================================================================= +//============================================================================= +//============================================================================= +// Creation d'un schema YACS +// nomCas : nom du cas a traiter +// FileName : nom du fichier contenant le script de lancement du calcul +// DirName : le répertoire de lancement des calculs du schéma +//============================================================================= +ADAPT::HOMARD_YACS_ptr ADAPT_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); + + // A. Controle du nom : + if ((myStudyContext._mesYACSs).find(nomYACS) != (myStudyContext._mesYACSs).end()) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This schema YACS has already been defined."; + throw SALOME::SALOME_Exception(es); + return 0; + } + + // B. Creation de l'objet + ADAPT::HOMARD_YACS_var myYACS = newYACS(); + if (CORBA::is_nil(myYACS)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Unable to create the schema YACS"; + throw SALOME::SALOME_Exception(es); + return 0; + }; + myYACS->SetName( nomYACS ) ; + + // C. Enregistrement + myStudyContext._mesYACSs[nomYACS] = myYACS; + + SALOMEDS::SObject_var aSO; + SALOMEDS::SObject_var aResultSO=PublishInStudy(aSO, myYACS, nomYACS); + + PublishCaseUnderYACS(nomYACS, nomCas); + + // D. Caracterisation + // D.1. Options + myYACS->SetDirName( DirName ) ; + myYACS->SetMeshFile( MeshFile ) ; + myYACS->SetScriptFile( ScriptFile ) ; + myYACS->SetCaseName( nomCas ) ; + // D.2. Defaut + int defaut_i ; + // D.2.1. Type constant + myYACS->SetType( 1 ) ; + // D.2.2. Convergence + defaut_i = GetYACSMaxIter() ; + myYACS->SetMaxIter( defaut_i ) ; + defaut_i = GetYACSMaxNode() ; + myYACS->SetMaxNode( defaut_i ) ; + defaut_i = GetYACSMaxElem() ; + myYACS->SetMaxElem( defaut_i ) ; + // D.3. Fichier de sauvegarde dans le répertoire du cas + ADAPT::HOMARD_Cas_ptr caseyacs = GetCase(nomCas) ; + std::string dirnamecase = caseyacs->GetDirName() ; + std::string XMLFile ; + XMLFile = dirnamecase + "/schema.xml" ; + myYACS->SetXMLFile( XMLFile.c_str() ) ; + + return ADAPT::HOMARD_YACS::_duplicate(myYACS); +} +//============================================================================= +// Ecriture d'un schema YACS +//============================================================================= +CORBA::Long ADAPT_Gen_i::YACSWrite(const char* nomYACS) +{ + INFOS ( "YACSWrite : Ecriture de " << nomYACS ); +// Le répertoire du cas + ADAPT::HOMARD_YACS_var myYACS = myStudyContext._mesYACSs[nomYACS]; + ASSERT(!CORBA::is_nil(myYACS)); +// Le nom du fichier du schema + std::string XMLFile ; + XMLFile = myYACS->GetXMLFile() ; + + int codret = YACSWriteOnFile(nomYACS, XMLFile.c_str()) ; + + return codret ; +} +//============================================================================= +// Ecriture d'un schema YACS sur un fichier donne +//============================================================================= +CORBA::Long ADAPT_Gen_i::YACSWriteOnFile(const char* nomYACS, const char* XMLFile) +{ + INFOS ( "YACSWriteOnFile : Ecriture de " << nomYACS << " sur " << XMLFile ); + + // A. Prealable + int codret = 0; + + // B. L'objet YACS + // B.1. L'objet + ADAPT::HOMARD_YACS_var myYACS = myStudyContext._mesYACSs[nomYACS]; + ASSERT(!CORBA::is_nil(myYACS)); + // B.2. Les caracteristiques + std::string DirName = myYACS->GetDirName() ; + std::string MeshFile = myYACS->GetMeshFile() ; + std::string ScriptFile = myYACS->GetScriptFile() ; + // B.3. Les caracteristiques de convergence + int MaxIter = myYACS->GetMaxIter() ; + int MaxNode = myYACS->GetMaxNode() ; + int MaxElem = myYACS->GetMaxElem() ; + + // C. Le cas + // C.1. L'objet cas + const char* nomCas = myYACS->GetCaseName(); + ADAPT::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; + ASSERT(!CORBA::is_nil(myCase)); + // C.2. Les instructions python associees au cas + CORBA::String_var dumpCorbaCase = myCase->GetDumpPython(); + std::string pythonCas = dumpCorbaCase.in(); + MESSAGE ("pythonCas :\n"<GetIter0() ; + std::string Iter0Name = myCase->GetIter0Name() ; + MESSAGE (". Iter0Name = " << Iter0Name); + std::string MeshName = Iter0->GetMeshName(); + MESSAGE (". MeshName = " << MeshName); + // D.2. L'iteration numero 1 + ADAPT::listeIterFilles* maListe = Iter0->GetIterations(); + int numberOfIter = maListe->length(); + if ( numberOfIter > 1 ) + { + MESSAGE (". numberOfIter = " << numberOfIter); + SALOME::ExceptionStruct es ; + es.type = SALOME::BAD_PARAM; + std::string text = "Une seule iteration est permise." ; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + return 0; + } + std::string Iter1Name = std::string((*maListe)[0]); + MESSAGE ("... Iter1Name = " << Iter1Name); + ADAPT::HOMARD_Iteration_var Iter1 = GetIteration(Iter1Name.c_str()) ; + // D.3. Les instructions python associees a l'iteration + CORBA::String_var dumpCorbaIter = Iter1->GetDumpPython(); + std::string pythonIter = dumpCorbaIter.in(); + MESSAGE ("pythonIter :\n"<GetHypoName(); + MESSAGE (". nomHypo = " << nomHypo); + ADAPT::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypo]; + ASSERT(!CORBA::is_nil(myHypo)); + // E.2. Les caracteristiques de l'adaptation + ADAPT::listeTypes* ListTypes = myHypo->GetAdapRefinUnRef(); + ASSERT(ListTypes->length() == 3); + int TypeAdap = (*ListTypes)[0]; +// int TypeRaff = (*ListTypes)[1]; +// int TypeDera = (*ListTypes)[2]; + // E.3. Les instructions python associees a l'hypothese + CORBA::String_var dumpCorbaHypo = myHypo->GetDumpPython(); + std::string pythonHypo = dumpCorbaHypo.in(); + MESSAGE ("pythonHypo :\n"<Texte_DataInit_MeshFile(MeshFile); } + // G.1.3. Le script de lancement + else if ( mot_cle == "Alternance_Calcul_HOMARD_Calcul" ) + { myDriver->Texte_Alternance_Calcul_HOMARD_Calcul(ScriptFile); } + // G.1.4. Les options du cas + else if ( mot_cle == "Iter_1_Case_Options" ) + { myDriver->Texte_Iter_1_Case_Options(pythonCas); } + // 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 ; + 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 + else if ( mot_cle == "HOMARD_Exec_Hypo_Options" ) + { myDriver->Texte_python_1( pythonHypo, 3, "Hypo" ) ; } + // G.1.8. Execution de HOMARD : les options de l'iteration + else if ( mot_cle == "HOMARD_Exec_Iter_Options" ) + { myDriver->Texte_python_2( pythonIter, "TimeStep", "Iter" ) ; } + // G.1.9. a. Creation eventuelles des zones et frontieres + // b. Enchainement + else if ( mot_cle == "Iter_1" ) + { + std::string texte_control = "" ; + if ( TypeAdap == 0 ) { texte_control += YACSDriverTexteZone( myHypo, myDriver ) ; } + texte_control += YACSDriverTexteBoundary( myCase, myDriver ) ; + texte_control += myDriver->Texte_Iter_1_control() ; + myDriver->TexteAdd(texte_control); + } + // G.1.10. Les tests de convergence + else if ( mot_cle == "Analyse_Test_Convergence" ) + { myDriver->TexteAnalyse_Test_Convergence(MaxIter, MaxNode, MaxElem); } + // G.1.11. Les parametres + else if ( mot_cle == "PARAMETRES" ) + { myDriver->TexteAddParametres(); } + // G.1.n. La ligne est recopiee telle quelle + else { myDriver->TexteAdd(ligne); } + } + // G.2. Ecriture du texte dans le fichier + if ( codret == 0 ) + { myDriver->CreeFichier(); } + } + else + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "The reference file for the YACS schema cannot be read." ; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + + delete myDriver; + + // H. Publication du fichier dans l'arbre + + std::string Commentaire = "xml" ; + PublishFileUnderYACS(nomYACS, XMLFile, Commentaire.c_str()); + + return codret ; +} +//============================================================================= +// Ecriture d'un schema YACS : ecriture des zones associees a une hypothese +//============================================================================= +std::string ADAPT_Gen_i::YACSDriverTexteZone(ADAPT::HOMARD_Hypothesis_var myHypo, YACSDriver* myDriver) +{ + MESSAGE ( "YACSDriverTexteZone" ); + // A. Les zones associees a cette hypothese + ADAPT::listeZonesHypo* ListZone = myHypo->GetZones(); + int numberOfZonesx2 = ListZone->length(); + + // B. Parcours des zones + std::string texte_control ; + for (int iaux = 0; iaux< numberOfZonesx2; iaux++) + { + // 1. Reperage de la zone + std::string ZoneName = std::string((*ListZone)[iaux]); + MESSAGE ( "\n. ZoneName = " << ZoneName << " - " <GetDumpPython(); + std::string pythonStructure_0 = dumpCorbaZone.in(); + MESSAGE ("pythonStructure_0 :"<GetBoundaryGroup(); + int numberOfitems = ListBoundaryGroupType->length(); + + // B. Parcours des frontieres + std::string texte_control ; + std::list ListeBoundaryTraitees ; + for (int NumBoundary = 0; NumBoundary< numberOfitems; NumBoundary=NumBoundary+2) + { + std::string BoundaryName = std::string((*ListBoundaryGroupType)[NumBoundary]); + MESSAGE ( "... BoundaryName = " << BoundaryName); + // Attention a n'ecrire la definition qu'une seule fois car elle peut se trouver + // plusieurs fois dans la definition du cas, d'ou la liste ListeBoundaryTraitees + int A_faire = 1 ; + std::list::const_iterator it = ListeBoundaryTraitees.begin(); + while (it != ListeBoundaryTraitees.end()) + { + MESSAGE ( "..... BoundaryNameTraitee = " << *it); + if ( BoundaryName == *it ) { A_faire = 0 ; } + it++; + } + if ( A_faire == 1 ) + { + // 1. Caracteristiques de la frontiere + ADAPT::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; + ASSERT(!CORBA::is_nil(myBoundary)); + // 2. Les instructions python associees a la frontiere + // La premiere ligne est un commentaire a eliminer + // La seconde ligne est l'instruction a proprement parler ; on ne garde que ce qui suit le "." + CORBA::String_var dumpCorbaBoundary = myBoundary->GetDumpPython(); + std::string pythonStructure_0 = dumpCorbaBoundary.in(); + MESSAGE ("pythonStructure_0 :"<URL())); + aFileName += "_HOMARD.dat"; + + // initialize sequence of file names + 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; + + // save data + // -> create file + std::ofstream f(aFileName.c_str()); + + // clear temporary id map + context._idmap.clear(); + + int id = 1; + + // -> save cases + std::map::const_iterator it_case; + for (it_case = context._mesCas.begin(); it_case != context._mesCas.end(); ++it_case) { + ADAPT::HOMARD_Cas_var aCas = it_case->second; + PortableServer::ServantBase_var aServant = GetServant(aCas); + HOMARD_Cas_i* aCasServant = dynamic_cast(aServant.in()); + if (aCasServant) { + f << ADAPT::GetSignature(ADAPT::Case) << aCasServant->Dump() << std::endl; + context._idmap[id++] = dynamic_cast(aCasServant); + } + } + // -> save zones + std::map::const_iterator it_zone; + for (it_zone = context._mesZones.begin(); it_zone != context._mesZones.end(); ++it_zone) { + ADAPT::HOMARD_Zone_var aZone = it_zone->second; + PortableServer::ServantBase_var aServant = GetServant(aZone); + HOMARD_Zone_i* aZoneServant = dynamic_cast(aServant.in()); + if (aZoneServant) { + f << ADAPT::GetSignature(ADAPT::Zone) << aZoneServant->Dump() << std::endl; + context._idmap[id++] = dynamic_cast(aZoneServant); + } + } + // -> save hypotheses + std::map::const_iterator it_hypo; + for (it_hypo = context._mesHypotheses.begin(); it_hypo != context._mesHypotheses.end(); ++it_hypo) { + ADAPT::HOMARD_Hypothesis_var aHypo = it_hypo->second; + PortableServer::ServantBase_var aServant = GetServant(aHypo); + HOMARD_Hypothesis_i* aHypoServant = dynamic_cast(aServant.in()); + if (aHypoServant) { + f << ADAPT::GetSignature(ADAPT::Hypothesis) << aHypoServant->Dump() << std::endl; + context._idmap[id++] = dynamic_cast(aHypoServant); + } + } + // -> save iterations + std::map::const_iterator it_iter; + for (it_iter = context._mesIterations.begin(); it_iter != context._mesIterations.end(); ++it_iter) { + ADAPT::HOMARD_Iteration_var aIter = it_iter->second; + PortableServer::ServantBase_var aServant = GetServant(aIter); + HOMARD_Iteration_i* aIterServant = dynamic_cast(aServant.in()); + if (aIterServant) { + f << ADAPT::GetSignature(ADAPT::Iteration) << aIterServant->Dump() << std::endl; + context._idmap[id++] = dynamic_cast(aIterServant); + } + } + // -> save boundaries + std::map::const_iterator it_boundary; + for (it_boundary = context._mesBoundarys.begin(); it_boundary != context._mesBoundarys.end(); ++it_boundary) { + ADAPT::HOMARD_Boundary_var aBoundary = it_boundary->second; + PortableServer::ServantBase_var aServant = GetServant(aBoundary); + HOMARD_Boundary_i* aBoundaryServant = dynamic_cast(aServant.in()); + if (aBoundaryServant) { + f << ADAPT::GetSignature(ADAPT::Boundary) << aBoundaryServant->Dump() << std::endl; + context._idmap[id++] = dynamic_cast(aBoundaryServant); + } + } + // -> close file + MESSAGE ("close file"); + f.close(); + + // put temporary files to the stream + MESSAGE ("put temporary files to the stream"); + 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, true); + + // return data stream + MESSAGE ("return data stream"); + return aStreamFile._retn(); +}; + +//=========================================================================== +SALOMEDS::TMPFile* ADAPT_Gen_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent, + const char* theURL, + CORBA::Boolean isMultiFile) +{ + // No specific ASCII persistence + SALOMEDS::TMPFile_var aStreamFile = Save(theComponent, theURL, isMultiFile); + return aStreamFile._retn(); +}; + +//=========================================================================== +CORBA::Boolean ADAPT_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, + const SALOMEDS::TMPFile& theStream, + const char* theURL, + CORBA::Boolean isMultiFile) +{ + MESSAGE ("Load pour theURL = "<< theURL); + + // set current study + if (myStudy->_is_nil()) + UpdateStudy(); + + // get temporary directory name + std::string tmpDir = isMultiFile ? std::string(theURL) : SALOMEDS_Tool::GetTmpDir(); + + // Convert the stream into sequence of files to process + 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(Kernel_Utils::encode(SMESH_Gen_i::getStudyServant()->URL())); + aFileName = tmpDir + aFileName + "_HOMARD.dat"; + + StudyContext& context = myStudyContext; + + // save data + // -> create file + std::ifstream f(aFileName.c_str()); + + // clear context + context._mesCas.clear(); + context._mesHypotheses.clear(); + context._mesIterations.clear(); + context._mesZones.clear(); + context._mesBoundarys.clear(); + context._idmap.clear(); + + int id = 1; + std::string line; + + while (f) { + std::getline(f, line); + std::string bounSignature = ADAPT::GetSignature(ADAPT::Boundary); + std::string caseSignature = ADAPT::GetSignature(ADAPT::Case); + std::string hypoSignature = ADAPT::GetSignature(ADAPT::Hypothesis); + std::string iterSignature = ADAPT::GetSignature(ADAPT::Iteration); + std::string zoneSignature = ADAPT::GetSignature(ADAPT::Zone); + std::string yacsSignature = ADAPT::GetSignature(ADAPT::YACS); + if (line.substr(0, bounSignature.size()) == bounSignature) { + // re-create boundary + MESSAGE ("Recreation de la frontiere" ); + ADAPT::HOMARD_Boundary_var aBoundary = newBoundary(); + PortableServer::ServantBase_var aServant = GetServant(aBoundary); + HOMARD_Boundary_i* aBoundaryServant = dynamic_cast(aServant.in()); + if (aBoundaryServant && aBoundaryServant->Restore(line.substr(bounSignature.size()))) { + context._mesBoundarys[aBoundary->GetName()] = aBoundary; + context._idmap[id] = dynamic_cast(aBoundaryServant); + } + } + else if (line.substr(0, caseSignature.size()) == caseSignature) { + // re-create case + MESSAGE ("Recreation du cas" ); + ADAPT::HOMARD_Cas_var aCase = newCase(); + PortableServer::ServantBase_var aServant = GetServant(aCase); + HOMARD_Cas_i* aCaseServant = dynamic_cast(aServant.in()); + if (aCaseServant && aCaseServant->Restore(line.substr(caseSignature.size()))) { + context._mesCas[aCase->GetName()] = aCase; + context._idmap[id] = dynamic_cast(aCaseServant); + } + } + else if (line.substr(0, hypoSignature.size()) == hypoSignature) { + // re-create hypothesis + MESSAGE ("Recreation de l hypothese" ); + ADAPT::HOMARD_Hypothesis_var aHypo = newHypothesis(); + PortableServer::ServantBase_var aServant = GetServant(aHypo); + HOMARD_Hypothesis_i* aHypoServant = dynamic_cast(aServant.in()); + if (aHypoServant && aHypoServant->Restore(line.substr(hypoSignature.size()))) { + context._mesHypotheses[aHypo->GetName()] = aHypo; + context._idmap[id] = dynamic_cast(aHypoServant); + } + } + else if (line.substr(0, iterSignature.size()) == iterSignature) { + // re-create iteration + MESSAGE ("Recreation de l'iteration" ); + ADAPT::HOMARD_Iteration_var aIter = newIteration(); + PortableServer::ServantBase_var aServant = GetServant(aIter); + HOMARD_Iteration_i* aIterServant = dynamic_cast(aServant.in()); + if (aIterServant && aIterServant->Restore(line.substr(iterSignature.size()))) { + context._mesIterations[aIter->GetName()] = aIter; + context._idmap[id] = dynamic_cast(aIterServant); + } + } + else if (line.substr(0, zoneSignature.size()) == zoneSignature) { + MESSAGE ("Recreation de la zone" ); + // re-create zone + ADAPT::HOMARD_Zone_var aZone = newZone(); + PortableServer::ServantBase_var aServant = GetServant(aZone); + HOMARD_Zone_i* aZoneServant = dynamic_cast(aServant.in()); + if (aZoneServant && aZoneServant->Restore(line.substr(zoneSignature.size()))) { + context._mesZones[aZone->GetName()] = aZone; + context._idmap[id] = dynamic_cast(aZoneServant); + } + } + else if (line.substr(0, zoneSignature.size()) == yacsSignature) { + MESSAGE ("Recreation du schema YACS" ); + // re-create YACS + ADAPT::HOMARD_YACS_var aYACS = newYACS(); + PortableServer::ServantBase_var aServant = GetServant(aYACS); + HOMARD_YACS_i* aYACSServant = dynamic_cast(aServant.in()); + if (aYACSServant && aYACSServant->Restore(line.substr(yacsSignature.size()))) { + context._mesYACSs[aYACS->GetName()] = aYACS; + context._idmap[id] = dynamic_cast(aYACSServant); + } + } + id++; + } + + // -> close file + f.close(); + + // Remove temporary files created from the stream + if (!isMultiFile) + SALOMEDS_Tool::RemoveTemporaryFiles(tmpDir.c_str(), aFileSeq, true); + + return true; +}; + +//=========================================================================== +CORBA::Boolean ADAPT_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent, + const SALOMEDS::TMPFile& theStream, + const char* theURL, + CORBA::Boolean isMultiFile) +{ + // No specific ASCII persistence + return Load(theComponent, theStream, theURL, isMultiFile); +}; + +//=========================================================================== +void ADAPT_Gen_i::Close(SALOMEDS::SComponent_ptr theComponent) +{ +}; + +//=========================================================================== +char* ADAPT_Gen_i::ComponentDataType() +{ + return CORBA::string_dup("HOMARD"); +}; + +//=========================================================================== +char* ADAPT_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, + const char* IORString, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII) +{ + CORBA::String_var aString(""); + if (!CORBA::is_nil(theSObject) && strcmp(IORString, "") != 0) { + StudyContext context = myStudyContext; + CORBA::Object_var anObj = _orb->string_to_object(IORString); + if (!CORBA::is_nil(anObj)) { + PortableServer::ServantBase_var aServant = GetServant(anObj); + PortableServer::ServantBase* aStorable = dynamic_cast(aServant.in()); + if (aStorable) { + std::map::const_iterator it; + for (it = context._idmap.begin(); it != context._idmap.end(); ++it) { + if (it->second == aStorable) { + std::stringstream os; + os << it->first; + aString = CORBA::string_dup(os.str().c_str()); + } + } + } + } + } + return aString._retn(); +}; + +//=========================================================================== +char* ADAPT_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, + const char* aLocalPersistentID, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII) +{ + CORBA::String_var aString(""); + if (!CORBA::is_nil(theSObject) && strcmp(aLocalPersistentID, "") != 0) { + StudyContext context = myStudyContext; + int id = atoi(aLocalPersistentID); + if (id > 0 && context._idmap.find(id) != context._idmap.end()) { + CORBA::Object_var object = _poa->servant_to_reference(context._idmap[ id ]); + if (!CORBA::is_nil(object)) { + aString = _orb->object_to_string(object); + } + } + } + return aString._retn(); +}; + +//=========================================================================== +CORBA::Boolean ADAPT_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR) +{ + if(CORBA::is_nil(myStudy)) + return false; + + ADAPT::HOMARD_Cas_var aCas = ADAPT::HOMARD_Cas::_narrow(theIOR); + if(!aCas->_is_nil()) + return true; + + ADAPT::HOMARD_Hypothesis_var aHypo = ADAPT::HOMARD_Hypothesis::_narrow(theIOR); + if(!aHypo->_is_nil()) + return true; + + ADAPT::HOMARD_Zone_var aZone = ADAPT::HOMARD_Zone::_narrow(theIOR); + if(!aZone->_is_nil()) + return true; + + ADAPT::HOMARD_Boundary_var aBoundary = ADAPT::HOMARD_Boundary::_narrow(theIOR); + if(!aBoundary->_is_nil()) + return true; + + /* Iteration is not published directly + ADAPT::HOMARD_Iteration_var aIter = ADAPT::HOMARD_Iteration::_narrow(theIOR); + if(!aIter->_is_nil()) + return true; + */ + return false; +}; + +//=========================================================================== +CORBA::Boolean ADAPT_Gen_i::CanCopy(SALOMEDS::SObject_ptr theObject) +{ + // No Copy/Paste support + return false; +}; + +//=========================================================================== +SALOMEDS::TMPFile* ADAPT_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, + CORBA::Long& theObjectID) +{ + // No Copy/Paste support + SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(0); + return aStreamFile._retn(); +}; + +//=========================================================================== +CORBA::Boolean ADAPT_Gen_i::CanPaste(const char *theComponentName, + CORBA::Long theObjectID) +{ + // No Copy/Paste support + return false; +}; + +//=========================================================================== +SALOMEDS::SObject_ptr ADAPT_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream, + CORBA::Long theObjectID, + SALOMEDS::SObject_ptr theSObject) +{ + // No Copy/Paste support + SALOMEDS::SObject_var aResultSO; + return aResultSO._retn(); +}; + +//=========================================================================== +PortableServer::ServantBase_var ADAPT_Gen_i::GetServant(CORBA::Object_ptr theObject) +{ + PortableServer::Servant aServant = 0; + if (!CORBA::is_nil(theObject)) { + try { + aServant = _poa->reference_to_servant(theObject); + } + catch (...) { + } + } + return aServant; +} + +//========================================================================== +Engines::TMPFile* ADAPT_Gen_i::DumpPython(CORBA::Boolean isPublished, + CORBA::Boolean isMultiFile, + CORBA::Boolean& isValidScript) +{ + MESSAGE ("Entree dans DumpPython"); + isValidScript=1; + + SALOMEDS::SObject_var aSO = SMESH_Gen_i::getStudyServant()->FindComponent("HOMARD"); + if(CORBA::is_nil(aSO)) + return new Engines::TMPFile(0); + + std::string aScript = "\"\"\"\n"; + aScript += "Python script for HOMARD\n"; + aScript += "Copyright 1996, 2011, 2015 EDF\n"; + aScript += "\"\"\"\n"; + aScript += "__revision__ = \"V1.2\"\n"; + aScript += "import HOMARD\n"; + if( isMultiFile ) + aScript += "import salome\n"; + aScript += "homard = salome.lcc.FindOrLoadComponent('FactoryServer','HOMARD')\n"; + aScript += "\thomard.UpdateStudy()\n"; + MESSAGE (". Au depart \n"< 0) + { + MESSAGE (". Ecritures des frontieres"); + aScript += "#\n# Creation of the boundaries"; + aScript += "\n# =========================="; + } + std::map::const_iterator it_boundary; + for (it_boundary = myStudyContext._mesBoundarys.begin(); + it_boundary != myStudyContext._mesBoundarys.end(); ++it_boundary) + { + ADAPT::HOMARD_Boundary_var maBoundary = (*it_boundary).second; + CORBA::String_var dumpCorbaBoundary = maBoundary->GetDumpPython(); + std::string dumpBoundary = dumpCorbaBoundary.in(); + MESSAGE (dumpBoundary<<"\n"); + aScript += dumpBoundary; + } + + + if (myStudyContext._mesZones.size() > 0) + { + MESSAGE (". Ecritures des zones"); + aScript += "#\n# Creation of the zones"; + aScript += "\n# ====================="; + } + std::map::const_iterator it_zone; + for ( it_zone = myStudyContext._mesZones.begin(); + it_zone != myStudyContext._mesZones.end(); ++it_zone) + { + ADAPT::HOMARD_Zone_var myZone = (*it_zone).second; + CORBA::String_var dumpCorbaZone = myZone->GetDumpPython(); + std::string dumpZone = dumpCorbaZone.in(); + MESSAGE (dumpZone<<"\n"); + aScript += dumpZone; + } + + + if (myStudyContext._mesHypotheses.size() > 0) + { + MESSAGE (". Ecritures des hypotheses"); + aScript += "#\n# Creation of the hypotheses"; + aScript += "\n# =========================="; + } + std::map::const_iterator it_hypo; + for ( it_hypo = myStudyContext._mesHypotheses.begin(); + it_hypo != myStudyContext._mesHypotheses.end(); it_hypo++) + { + ADAPT::HOMARD_Hypothesis_var monHypo = (*it_hypo).second; + CORBA::String_var dumpCorbaHypo = monHypo->GetDumpPython(); + std::string dumpHypo = dumpCorbaHypo.in(); + MESSAGE (dumpHypo<<"\n"); + aScript += dumpHypo; + } + + + if (myStudyContext._mesCas.size() > 0) + { + MESSAGE (". Ecritures des cas"); + aScript += "#\n# Creation of the cases"; + aScript += "\n# ====================="; + } + std::map::const_iterator it_cas; + for (it_cas = myStudyContext._mesCas.begin(); + it_cas != myStudyContext._mesCas.end(); it_cas++) + { + std::string nomCas = (*it_cas).first; + std::string dumpCas = std::string("\n# Creation of the case ") ; + dumpCas += nomCas + std::string("\n"); + dumpCas += std::string("\t") + nomCas; + dumpCas += std::string(" = homard.CreateCase(\"") + nomCas + std::string("\", \""); + + ADAPT::HOMARD_Cas_var myCase = (*it_cas).second; + CORBA::String_var cIter0= myCase->GetIter0Name(); + std::string iter0 = cIter0.in(); + + ADAPT::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[iter0]; + CORBA::String_var cMesh0= myIteration->GetMeshFile(); + std::string mesh0 = cMesh0.in(); + CORBA::String_var cMeshName0= myIteration->GetMeshName(); + std::string meshName0 = cMeshName0.in(); + dumpCas += meshName0 + std::string("\", \"")+ mesh0 + std::string("\")\n"); + CORBA::String_var dumpCorbaCase = myCase->GetDumpPython(); + std::string dumpCas2= dumpCorbaCase.in(); + + MESSAGE (dumpCas< 0) + { + MESSAGE (". Ecritures des iterations"); + aScript += "#\n# Creation of the iterations" ; + aScript += "\n# =========================="; + } + std::map::const_iterator it_iter; + for (it_iter = myStudyContext._mesIterations.begin(); + it_iter != myStudyContext._mesIterations.end(); ++it_iter) + { + ADAPT::HOMARD_Iteration_var aIter = (*it_iter).second; + CORBA::String_var dumpCorbaIter = aIter->GetDumpPython(); + std::string dumpIter = dumpCorbaIter.in(); + MESSAGE (dumpIter<<"\n"); + aScript += dumpIter; + } + + + if (myStudyContext._mesYACSs.size() > 0) + { + MESSAGE (". Ecritures des schemas YACS"); + aScript += "#\n# Creation of the schemas YACS"; + aScript += "\n# ============================"; + } + std::map::const_iterator it_yacs; + for ( it_yacs = myStudyContext._mesYACSs.begin(); + it_yacs != myStudyContext._mesYACSs.end(); ++it_yacs) + { + ADAPT::HOMARD_YACS_var myYACS = (*it_yacs).second; + CORBA::String_var dumpCorbaYACS = myYACS->GetDumpPython(); + std::string dumpYACS = dumpCorbaYACS.in(); + MESSAGE (dumpYACS<<"\n"); + aScript += dumpYACS; + } + + MESSAGE (". Ecritures finales"); + if( isMultiFile ) + aScript += "\n\tpass"; + aScript += "\n"; + + if( !isMultiFile ) // remove unnecessary tabulation + aScript = RemoveTabulation( aScript ); + +// MESSAGE ("A ecrire \n"<::const_iterator it; + for (it = myStudyContext._mesCas.begin(); + it != myStudyContext._mesCas.end(); it++) + { + if (std::string(nomDir) == std::string(it->second->GetDirName())) + { + casename = std::string(it->second->GetName()) ; + break ; + } + } + return CORBA::string_dup( casename.c_str() ); +} +/*//============================================================================= +void SALOMEException( std::string message ) +{ + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = message; + throw SALOME::SALOME_Exception(es); + return ; +}*/ +//============================================================================= +char* ADAPT_Gen_i::getVersion() +{ +#if HOMARD_DEVELOPMENT + return CORBA::string_dup(SMESH_VERSION_STR"dev"); +#else + return CORBA::string_dup(SMESH_VERSION_STR); +#endif +} +//=============================================================================== +// Recuperation de la chaine de caracteres par rapport a l'apparition d'un caractere +// ligne : la ligne a manipuler +// caractere : le caractere a reperer +// option : 0 : la chaine avant la premiere apparition du caractere +// 1 : la chaine apres la premiere apparition du caractere +// 2 : la chaine avant la derniere apparition du caractere +// 3 : la chaine apres la derniere apparition du caractere +// Si le caractere est absent, on retourne la chaine totale +//=============================================================================== +std::string ADAPT_Gen_i::GetStringInTexte( const std::string ligne, const std::string caractere, int option ) +{ +// MESSAGE("GetStringInTexte, recherche de '"<> mot_cle ; + chaine = GetStringInTexte ( mot_cle, "\"", 1 ) ; + chaine = GetStringInTexte ( chaine, "\"", 0 ) ; + if ( chaine == "language" ) { section_langue = true ; } + if ( chaine == "HOMARD" ) { section_homard = true ; } + // MESSAGE ( "section_langue = "<" ) + { /*MESSAGE ( "Fin de la section : "<< ligne<<", section_langue = "<> PublisMeshIN ; } + if ( chaine2 == "publish_mesh_out" ) { chainebis >> PublisMeshOUT ; } + // 3.2.2. Les maximum pour YACS + if ( chaine2 == "yacs_max_iter" ) { chainebis >> YACSMaxIter ; } + if ( chaine2 == "yacs_max_node" ) { chainebis >> YACSMaxNode ; } + if ( chaine2 == "yacs_max_elem" ) { chainebis >> YACSMaxElem ; } + if ( chaine2 == "yacs_type_test" ) { YACSTypeTestchaine = chaine ; } + } + } + } + } + } + + // C. Enregistrements + MESSAGE ("Enregistrement de LanguageShort = " << LanguageShort ); + SetLanguageShort( LanguageShort.c_str() ) ; + + MESSAGE ("Enregistrement de PublisMeshIN = " << PublisMeshIN<<", PublisMeshOUT = "<< PublisMeshOUT); + SetPublisMesh(PublisMeshIN, PublisMeshOUT) ; + + MESSAGE ("Enregistrement de YACSMaxIter = " << YACSMaxIter<<", YACSMaxNode = "<< YACSMaxNode<<", YACSMaxElem = "<< YACSMaxElem); + SetYACSMaximum(YACSMaxIter, YACSMaxNode, YACSMaxElem) ; + + MESSAGE ("Enregistrement de TypeTest = " << YACSTypeTestchaine.c_str() ); + int YACSTypeTest ; + if ( ( YACSTypeTestchaine == "VTest > VRef" ) || ( YACSTypeTestchaine == "VTest > VRef" ) ) { YACSTypeTest = 1 ; } + else if ( ( YACSTypeTestchaine == "VTest < VRef" ) || ( YACSTypeTestchaine == "VTest < VRef" ) ) { YACSTypeTest = 2 ; } + else { YACSTypeTest = 0 ; } + MESSAGE ("==> TypeTest = " << YACSTypeTest ); + SetYACSConvergenceType( YACSTypeTest ) ; + + return ; +} +//=============================================================================== +// Langue de SALOME +//=============================================================================== +void ADAPT_Gen_i::SetLanguageShort(const char* LanguageShort) +{ +// MESSAGE ("SetLanguageShort pour LanguageShort = " << LanguageShort ); + _LangueShort = LanguageShort ; + if ( _LangueShort == "fr" ) { _Langue = "Francais" ; } + else { _Langue = "English" ; } + return ; +} +char* ADAPT_Gen_i::GetLanguageShort() +{ +// MESSAGE ("GetLanguageShort"); + return CORBA::string_dup( _LangueShort.c_str() ); +} +//=============================================================================== +// Options de publications +//=============================================================================== +void ADAPT_Gen_i::SetPublisMesh(CORBA::Long PublisMeshIN, CORBA::Long PublisMeshOUT) +{ + _PublisMeshIN = PublisMeshIN ; + _PublisMeshOUT = PublisMeshOUT ; + return ; +} +CORBA::Long ADAPT_Gen_i::GetPublisMeshIN() +{ + return _PublisMeshIN ; +} +CORBA::Long ADAPT_Gen_i::GetPublisMeshOUT() +{ + return _PublisMeshOUT ; +} +//=============================================================================== +// YACS - test de convergence +//=============================================================================== +void ADAPT_Gen_i::SetYACSMaximum(CORBA::Long YACSMaxIter, CORBA::Long YACSMaxNode, CORBA::Long YACSMaxElem) +{ + _YACSMaxIter = YACSMaxIter ; + _YACSMaxNode = YACSMaxNode ; + _YACSMaxElem = YACSMaxElem ; + return ; +} +CORBA::Long ADAPT_Gen_i::GetYACSMaxIter() +{ + return _YACSMaxIter ; +} +CORBA::Long ADAPT_Gen_i::GetYACSMaxNode() +{ + return _YACSMaxNode ; +} +CORBA::Long ADAPT_Gen_i::GetYACSMaxElem() +{ + return _YACSMaxElem ; +} +void ADAPT_Gen_i::SetYACSConvergenceType(CORBA::Long YACSTypeTest) +{ + _YACSTypeTest = YACSTypeTest ; + return ; +} +CORBA::Long ADAPT_Gen_i::GetYACSConvergenceType() +{ + return _YACSTypeTest ; +} + +//============================================================================= +extern "C" +{ + HOMARDENGINE_EXPORT + PortableServer::ObjectId* ADAPTEngine_factory(CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId* contId, + const char* instanceName, + const char* interfaceName) + { + MESSAGE("PortableServer::ObjectId* ADAPTEngine_factory()"); + ADAPT_Gen_i* myADAPT_Gen = new ADAPT_Gen_i(orb, poa, contId, instanceName, interfaceName); + return myADAPT_Gen->getId(); + } +} diff --git a/src/ADAPT_I/ADAPT_Gen_i.hxx b/src/ADAPT_I/ADAPT_Gen_i.hxx new file mode 100644 index 000000000..4ef3172f1 --- /dev/null +++ b/src/ADAPT_I/ADAPT_Gen_i.hxx @@ -0,0 +1,347 @@ +// 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 +// 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 _ADAPT_GEN_I_HXX_ +#define _ADAPT_GEN_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(ADAPT_Gen) +#include CORBA_SERVER_HEADER(HOMARD_Cas) +#include CORBA_SERVER_HEADER(HOMARD_Hypothesis) +#include CORBA_SERVER_HEADER(HOMARD_Iteration) +#include CORBA_SERVER_HEADER(HOMARD_Zone) +#include CORBA_SERVER_HEADER(HOMARD_Boundary) +#include CORBA_SERVER_HEADER(HOMARD_YACS) +#include CORBA_CLIENT_HEADER(SALOMEDS) +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) + +#include "HOMARD_i.hxx" +#include "ADAPT_Gen.hxx" +#include "HomardDriver.hxx" +#include "YACSDriver.hxx" +#include "FrontTrack.hxx" +#include "SALOME_Component_i.hxx" +#include "SALOME_NamingService.hxx" +#include "Utils_CorbaException.hxx" + +#include +#include + +class HOMARDENGINE_EXPORT ADAPT_Gen_i: + public virtual Engines_Component_i, + public virtual POA_ADAPT::ADAPT_Gen +{ +public: + ADAPT_Gen_i( CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId* contId, + const char* instanceName, + const char* interfaceName ); + virtual ~ADAPT_Gen_i(); + + +// Generalites + +// Les creations + ADAPT::HOMARD_Boundary_ptr CreateBoundary (const char* nomBoundary, CORBA::Long typeBoundary); + ADAPT::HOMARD_Boundary_ptr CreateBoundaryCAO(const char* nomBoundary, + const char* DataFile); + ADAPT::HOMARD_Boundary_ptr CreateBoundaryDi (const char* nomBoundary, + const char* MeshName, const char* DataFile); + ADAPT::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, + CORBA::Double Rayon); + ADAPT::HOMARD_Boundary_ptr CreateBoundarySphere (const char* nomBoundary, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Rayon); + ADAPT::HOMARD_Boundary_ptr CreateBoundaryConeR (const char* nomBoundary, + CORBA::Double Xcentre1, CORBA::Double Ycentre1, CORBA::Double Zcentre1, CORBA::Double Rayon1, + CORBA::Double Xcentre2, CORBA::Double Ycentre2, CORBA::Double Zcentre2, CORBA::Double Rayon2); + ADAPT::HOMARD_Boundary_ptr CreateBoundaryConeA (const char* nomBoundary, + CORBA::Double Xaxis, CORBA::Double Yaxis, CORBA::Double Zaxis, CORBA::Double Angle, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre); + ADAPT::HOMARD_Boundary_ptr CreateBoundaryTorus (const char* nomBoundary, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Xaxis, CORBA::Double Yaxis, CORBA::Double Zaxis, + CORBA::Double RayonRev, CORBA::Double RayonPri); + + ADAPT::HOMARD_Cas_ptr CreateCase (const char* nomCas, const char* MeshName, const char* FileName); + ADAPT::HOMARD_Cas_ptr CreateCaseFromIteration (const char* nomCas, const char* DirNameStart); + ADAPT::HOMARD_Cas_ptr CreateCaseFromCaseLastIteration (const char* nomCas, const char* DirNameStart); + ADAPT::HOMARD_Cas_ptr CreateCaseFromCaseIteration (const char* nomCas, const char* DirNameStart, CORBA::Long Number); + ADAPT::HOMARD_Cas_ptr CreateCase0 (const char* nomCas, const char* MeshName, const char* FileName, CORBA::Long MeshOption, CORBA::Long NumeIter, CORBA::Long Option); + std::string CreateCase1 (const char* DirNameStart, CORBA::Long Number); + + ADAPT::HOMARD_Hypothesis_ptr CreateHypothesis(const char* nomHypothesis); + + ADAPT::HOMARD_Iteration_ptr CreateIteration (const char* nomIter, const char* nomIterParent); + + ADAPT::HOMARD_Zone_ptr CreateZone (const char* nomZone, CORBA::Long typeZone); + ADAPT::HOMARD_Zone_ptr CreateZoneBox (const char* nomZone, + CORBA::Double Xmini, CORBA::Double Xmaxi, + CORBA::Double Ymini, CORBA::Double Ymaxi, + CORBA::Double Zmini, CORBA::Double Zmaxi); + ADAPT::HOMARD_Zone_ptr CreateZoneBox2D (const char* nomZone, + CORBA::Double Umini, CORBA::Double Umaxi, + CORBA::Double Vmini, CORBA::Double Vmaxi, + CORBA::Long Orient); + ADAPT::HOMARD_Zone_ptr CreateZoneCylinder (const char* nomZone, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, + CORBA::Double Rayon, CORBA::Double Haut); + ADAPT::HOMARD_Zone_ptr CreateZoneDisk (const char* nomZone, + CORBA::Double Ucentre, CORBA::Double Vcentre, + CORBA::Double Rayon, + CORBA::Long Orient); + ADAPT::HOMARD_Zone_ptr CreateZoneDiskWithHole (const char* nomZone, + CORBA::Double Ucentre, CORBA::Double Vcentre, + CORBA::Double Rayon, CORBA::Double Rayonint, + CORBA::Long Orient); + ADAPT::HOMARD_Zone_ptr CreateZonePipe (const char* nomZone, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, + CORBA::Double Rayon, CORBA::Double Haut, CORBA::Double Rayonint); + ADAPT::HOMARD_Zone_ptr CreateZoneSphere (const char* nomZone, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, CORBA::Double Rayon); + +// Les informations + ADAPT::HOMARD_Boundary_ptr GetBoundary (const char* nomBoundary); + ADAPT::HOMARD_Cas_ptr GetCase (const char* nomCas); + ADAPT::HOMARD_Hypothesis_ptr GetHypothesis (const char* nomHypothesis); + ADAPT::HOMARD_Iteration_ptr GetIteration (const char* nomIteration); + ADAPT::HOMARD_YACS_ptr GetYACS (const char* nomYACS); + ADAPT::HOMARD_Zone_ptr GetZone (const char* nomZone); + + ADAPT::listeBoundarys* GetAllBoundarysName(); + ADAPT::listeCases* GetAllCasesName(); + ADAPT::listeHypotheses* GetAllHypothesesName(); + ADAPT::listeIterations* GetAllIterationsName(); + ADAPT::listeYACSs* GetAllYACSsName(); + ADAPT::listeZones* GetAllZonesName(); + + void MeshInfo (const char* nomCas, + const char* MeshName, const char* FileName, const char* DirName, + CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte); + + ADAPT::HOMARD_Iteration_ptr LastIteration (const char* nomCas); + +// L'etude + void UpdateStudy(); + void IsValidStudy(); + +// Liens entre structures + void InvalideBoundary(const char* nomBoundary); + void InvalideHypo(const char* nomHypo); + void InvalideIter(const char* nomIter); + void InvalideIterOption(const char* nomIter, CORBA::Long Option); + void InvalideIterInfo(const char* nomIter); + void InvalideYACS(const char* nomYACS); + void InvalideZone(const char* nomZone); + + CORBA::Long DeleteBoundary(const char* nomBoundary); + CORBA::Long DeleteCase(const char* nomCas, CORBA::Long Option); + CORBA::Long DeleteHypo(const char* nomHypothesis); + CORBA::Long DeleteIteration(const char* nomIter, CORBA::Long Option); + CORBA::Long DeleteIterationOption(const char* nomIter, CORBA::Long Option1, CORBA::Long Option2); + CORBA::Long DeleteYACS(const char* nomYACS, CORBA::Long Option); + CORBA::Long DeleteZone(const char* nomZone); + + void AssociateIterHypo(const char* nomIter, const char* nomHypothesis); + + void AssociateHypoZone(const char* nomHypothesis, const char* nomZone, CORBA::Long TypeUse); + void DissociateHypoZone(const char* nomHypothesis, const char* nomZone); + + void AssociateCaseIter(const char* nomCas, const char* nomIter, + const char* labelIter); + +// Actions + void SetEtatIter(const char* nomIter,const CORBA::Long Etat); + char* CreateDirNameIter(const char* nomrep, CORBA::Long num ); + + CORBA::Long Compute(const char* nomIteration, CORBA::Long etatMenage, CORBA::Long modeHOMARD, CORBA::Long Option1, CORBA::Long Option2); + CORBA::Long ComputeAdap(ADAPT::HOMARD_Cas_var myCase, ADAPT::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage, HomardDriver* myDriver, CORBA::Long Option1, CORBA::Long Option2); + CORBA::Long ComputeCAO(ADAPT::HOMARD_Cas_var myCase, ADAPT::HOMARD_Iteration_var myIteration, CORBA::Long Option1, CORBA::Long Option2); + CORBA::Long ComputeCAObis(ADAPT::HOMARD_Iteration_var myIteration, CORBA::Long Option1, CORBA::Long Option2); + char* ComputeDirManagement(ADAPT::HOMARD_Cas_var myCase, ADAPT::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage); + char* ComputeDirPaManagement(ADAPT::HOMARD_Cas_var myCase, ADAPT::HOMARD_Iteration_var myIteration); + void DriverTexteZone(ADAPT::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver); + void DriverTexteField(ADAPT::HOMARD_Iteration_var myIteration, ADAPT::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver); + int DriverTexteBoundary(ADAPT::HOMARD_Cas_var myCase, HomardDriver* myDriver); + void DriverTexteFieldInterp(ADAPT::HOMARD_Iteration_var myIteration, ADAPT::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver); + + char* VerifieDir(const char* nomDir); + + void PublishFileUnderIteration(const char* NomIter, const char* NomFich, const char* Commentaire); + void PublishFileUnderYACS(const char* NomYACS, const char* NomFich, const char* Commentaire); + void PublishBoundaryUnderCase(const char* CaseName, const char* BoundaryName); + void PublishCaseUnderYACS(const char* YACSName, const char* CaseName); + void PublishResultInSmesh(const char* NomFich, CORBA::Long Option); + void DeleteResultInSmesh(std::string NomFich, std::string MeshName); + void PublishMeshIterInSmesh(const char* NomIter); + +// YACS + ADAPT::HOMARD_YACS_ptr CreateYACSSchema (const char* YACSName, const char* nomCas, const char* ScriptFile, const char* DirName, const char* MeshFile); + CORBA::Long YACSWrite(const char* nomYACS); + CORBA::Long YACSWriteOnFile(const char* nomYACS, const char* XMLFile); + std::string YACSDriverTexteZone(ADAPT::HOMARD_Hypothesis_var myHypo, YACSDriver* myDriver); + std::string YACSDriverTexteBoundary(ADAPT::HOMARD_Cas_var myCase, YACSDriver* myDriver); + +// Preferences + void SetPreferences() ; + void SetLanguageShort(const char* LanguageShort); + char* GetLanguageShort(); + void SetPublisMesh(CORBA::Long PublisMeshIN, CORBA::Long PublisMeshOUT); + CORBA::Long GetPublisMeshIN(); + CORBA::Long GetPublisMeshOUT(); + void SetYACSMaximum(CORBA::Long YACSMaxIter, CORBA::Long YACSMaxNode, CORBA::Long YACSMaxElem); + CORBA::Long GetYACSMaxIter(); + CORBA::Long GetYACSMaxNode(); + CORBA::Long GetYACSMaxElem(); + void SetYACSConvergenceType(CORBA::Long YACSTypeTest); + CORBA::Long GetYACSConvergenceType(); + + + // --------------------------------------------------------------- + // next functions are inherited from SALOMEDS::Driver interface + // --------------------------------------------------------------- + + // --> Persistence + virtual SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent, + const char* theURL, + CORBA::Boolean isMultiFile); + + virtual SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent, + const char* theURL, + CORBA::Boolean isMultiFile); + + virtual CORBA::Boolean Load(SALOMEDS::SComponent_ptr theComponent, + const SALOMEDS::TMPFile& theStream, + const char* theURL, + CORBA::Boolean isMultiFile); + + virtual CORBA::Boolean LoadASCII(SALOMEDS::SComponent_ptr theComponent, + const SALOMEDS::TMPFile& theStream, + const char* theURL, + CORBA::Boolean isMultiFile); + + virtual void Close(SALOMEDS::SComponent_ptr IORSComponent); + + virtual char* ComponentDataType(); + + virtual char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, + const char* IORString, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII); + + virtual char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, + const char* aLocalPersistentID, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII); + + // --> Data publishing + virtual CORBA::Boolean CanPublishInStudy(CORBA::Object_ptr theIOR); + + virtual SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::SObject_ptr theSObject, + CORBA::Object_ptr theObject, + const char* theName); + + // --> Copy/Paste + virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject); + + virtual SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, + CORBA::Long& theObjectID); + + virtual CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID); + + virtual SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream, + CORBA::Long theObjectID, + SALOMEDS::SObject_ptr theObject); + +// virtual void SALOMEException( std::string message ); + +private: + SALOMEDS::SObject_ptr PublishBoundaryInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, + ADAPT::HOMARD_Boundary_ptr theObject, const char* theName); + SALOMEDS::SObject_ptr PublishCaseInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, + ADAPT::HOMARD_Cas_ptr theObject, const char* theName); + SALOMEDS::SObject_ptr PublishHypotheseInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, + ADAPT::HOMARD_Hypothesis_ptr theObject, const char* theName); + SALOMEDS::SObject_ptr PublishYACSInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, + ADAPT::HOMARD_YACS_ptr theObject, const char* theName); + SALOMEDS::SObject_ptr PublishZoneInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, + ADAPT::HOMARD_Zone_ptr theObject, const char* theName); + virtual void PublishInStudyAttr(SALOMEDS::StudyBuilder_var aStudyBuilder, + SALOMEDS::SObject_var aResultSO, + const char* theName, const char* comment, const char* icone, const char* ior); + + PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject); + + ADAPT::HOMARD_Boundary_ptr newBoundary(); + ADAPT::HOMARD_Cas_ptr newCase(); + ADAPT::HOMARD_Hypothesis_ptr newHypothesis(); + ADAPT::HOMARD_Iteration_ptr newIteration(); + ADAPT::HOMARD_YACS_ptr newYACS(); + ADAPT::HOMARD_Zone_ptr newZone(); + + + virtual Engines::TMPFile* DumpPython(CORBA::Boolean isPublished, + CORBA::Boolean isMultiFile, + CORBA::Boolean& isValidScript); + + virtual char* getVersion(); + std::string GetStringInTexte( const std::string Texte, const std::string String, int option ) ; + +private: + struct StudyContext + { + std::map _mesBoundarys; + std::map _mesCas; + std::map _mesHypotheses; + std::map _mesIterations; + std::map _mesYACSs; + std::map _mesZones; + std::map _idmap; + }; + + ::ADAPT_Gen* myHomard; + SALOMEDS::Study_var myStudy; + StudyContext myStudyContext; + SALOME_NamingService* _NS; + + int _tag_gene ; + int _tag_boun ; + int _tag_hypo ; + int _tag_yacs ; + int _tag_zone ; + +// Preferences + std::string _Langue ; + std::string _LangueShort ; + int _PublisMeshIN ; + int _PublisMeshOUT ; + int _YACSMaxIter ; + int _YACSMaxNode ; + int _YACSMaxElem ; + int _YACSTypeTest ; + ; + +}; + +#endif diff --git a/src/ADAPT_I/CMakeLists.txt b/src/ADAPT_I/CMakeLists.txt index b569b1e3d..d604458fb 100644 --- a/src/ADAPT_I/CMakeLists.txt +++ b/src/ADAPT_I/CMakeLists.txt @@ -68,7 +68,7 @@ SET(ADAPTEngine_HEADERS HOMARD_Hypothesis_i.hxx HOMARD_Iteration_i.hxx HOMARD_Zone_i.hxx - HOMARD_Gen_i.hxx + ADAPT_Gen_i.hxx HOMARD_Boundary_i.hxx HOMARD_YACS_i.hxx HomardMedCommun.h @@ -82,7 +82,7 @@ SET(ADAPTEngine_SOURCES HOMARD_Cas_i.cxx HOMARD_Hypothesis_i.cxx HOMARD_Iteration_i.cxx - HOMARD_Gen_i.cxx + ADAPT_Gen_i.cxx HOMARD_Zone_i.cxx HOMARD_Boundary_i.cxx HOMARD_YACS_i.cxx diff --git a/src/ADAPT_I/HOMARD_Boundary_i.cxx b/src/ADAPT_I/HOMARD_Boundary_i.cxx index ef80c35b5..cc1097767 100644 --- a/src/ADAPT_I/HOMARD_Boundary_i.cxx +++ b/src/ADAPT_I/HOMARD_Boundary_i.cxx @@ -27,7 +27,7 @@ // Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier // #include "HOMARD_Boundary_i.hxx" -#include "HOMARD_Gen_i.hxx" +#include "ADAPT_Gen_i.hxx" #include "HOMARD_Boundary.hxx" #include "HOMARD_DriverTools.hxx" @@ -49,7 +49,7 @@ HOMARD_Boundary_i::HOMARD_Boundary_i() */ //============================================================================= HOMARD_Boundary_i::HOMARD_Boundary_i( CORBA::ORB_ptr orb, - HOMARD::HOMARD_Gen_var engine ) + ADAPT::ADAPT_Gen_var engine ) { MESSAGE( "HOMARD_Boundary_i" ); _gen_i = engine; @@ -98,12 +98,12 @@ char* HOMARD_Boundary_i::GetDumpPython() //============================================================================= std::string HOMARD_Boundary_i::Dump() const { - return HOMARD::Dump( *myHomardBoundary ); + return ADAPT::Dump( *myHomardBoundary ); } //============================================================================= bool HOMARD_Boundary_i::Restore( const std::string& stream ) { - return HOMARD::Restore( *myHomardBoundary, stream ); + return ADAPT::Restore( *myHomardBoundary, stream ); } //============================================================================= //============================================================================= @@ -178,10 +178,10 @@ void HOMARD_Boundary_i::SetTorus( double X0, double X1, double X2, double X3, do myHomardBoundary->SetTorus( X0, X1, X2, X3, X4, X5, X6, X7 ); } //============================================================================= -HOMARD::double_array* HOMARD_Boundary_i::GetCoords() +ADAPT::double_array* HOMARD_Boundary_i::GetCoords() { ASSERT( myHomardBoundary ); - HOMARD::double_array_var aResult = new HOMARD::double_array(); + ADAPT::double_array_var aResult = new ADAPT::double_array(); std::vector mesCoor = myHomardBoundary->GetCoords(); aResult->length( mesCoor .size() ); std::vector::const_iterator it; @@ -197,10 +197,10 @@ void HOMARD_Boundary_i::SetLimit( double Xincr, double Yincr, double Zincr ) myHomardBoundary->SetLimit( Xincr, Yincr, Zincr ); } //============================================================================= -HOMARD::double_array* HOMARD_Boundary_i::GetLimit() +ADAPT::double_array* HOMARD_Boundary_i::GetLimit() { ASSERT( myHomardBoundary ); - HOMARD::double_array_var aResult = new HOMARD::double_array(); + ADAPT::double_array_var aResult = new ADAPT::double_array(); std::vector mesCoor = myHomardBoundary->GetLimit(); aResult->length( mesCoor .size() ); std::vector::const_iterator it; @@ -216,7 +216,7 @@ void HOMARD_Boundary_i::AddGroup( const char* Group) myHomardBoundary->AddGroup( Group ); } //============================================================================= -void HOMARD_Boundary_i::SetGroups(const HOMARD::ListGroupType& ListGroup) +void HOMARD_Boundary_i::SetGroups(const ADAPT::ListGroupType& ListGroup) { ASSERT( myHomardBoundary ); std::list ListString; @@ -227,11 +227,11 @@ void HOMARD_Boundary_i::SetGroups(const HOMARD::ListGroupType& ListGroup) myHomardBoundary->SetGroups( ListString ); } //============================================================================= -HOMARD::ListGroupType* HOMARD_Boundary_i::GetGroups() +ADAPT::ListGroupType* HOMARD_Boundary_i::GetGroups() { ASSERT( myHomardBoundary ); const std::list& ListString = myHomardBoundary->GetGroups(); - HOMARD::ListGroupType_var aResult = new HOMARD::ListGroupType; + ADAPT::ListGroupType_var aResult = new ADAPT::ListGroupType; aResult->length( ListString.size() ); std::list::const_iterator it; int i = 0; diff --git a/src/ADAPT_I/HOMARD_Boundary_i.hxx b/src/ADAPT_I/HOMARD_Boundary_i.hxx index eaac61af3..37b06921e 100644 --- a/src/ADAPT_I/HOMARD_Boundary_i.hxx +++ b/src/ADAPT_I/HOMARD_Boundary_i.hxx @@ -31,7 +31,7 @@ #define _HOMARD_Boundary_I_HXX_ #include -#include CORBA_SERVER_HEADER(HOMARD_Gen) +#include CORBA_SERVER_HEADER(ADAPT_Gen) #include CORBA_SERVER_HEADER(HOMARD_Boundary) #include "HOMARD_i.hxx" @@ -45,11 +45,11 @@ class HOMARD_Boundary; class HOMARDENGINE_EXPORT HOMARD_Boundary_i: public virtual Engines_Component_i, - public virtual POA_HOMARD::HOMARD_Boundary, + public virtual POA_ADAPT::HOMARD_Boundary, public virtual PortableServer::ServantBase { public: - HOMARD_Boundary_i( CORBA::ORB_ptr orb, HOMARD::HOMARD_Gen_var gen_i ); + HOMARD_Boundary_i( CORBA::ORB_ptr orb, ADAPT::ADAPT_Gen_var gen_i ); HOMARD_Boundary_i(); virtual ~HOMARD_Boundary_i(); @@ -88,14 +88,14 @@ public: double Xaxe, double Yaxe, double Zaxe, double rayonRev, double rayonPri ); - HOMARD::double_array* GetCoords(); + ADAPT::double_array* GetCoords(); void SetLimit( double Xincr, double Yincr, double Zincr); - HOMARD::double_array* GetLimit(); + ADAPT::double_array* GetLimit(); void AddGroup( const char* Group); - void SetGroups(const HOMARD::ListGroupType& ListGroup); - HOMARD::ListGroupType* GetGroups(); + void SetGroups(const ADAPT::ListGroupType& ListGroup); + ADAPT::ListGroupType* GetGroups(); // Liens avec les autres structures void SetCaseCreation( const char* NomCaseCreation ); @@ -106,7 +106,7 @@ private: ::HOMARD_Boundary* myHomardBoundary; CORBA::ORB_ptr _orb; - HOMARD::HOMARD_Gen_var _gen_i; + ADAPT::ADAPT_Gen_var _gen_i; }; #endif diff --git a/src/ADAPT_I/HOMARD_Cas_i.cxx b/src/ADAPT_I/HOMARD_Cas_i.cxx index 036dacef1..432faf678 100644 --- a/src/ADAPT_I/HOMARD_Cas_i.cxx +++ b/src/ADAPT_I/HOMARD_Cas_i.cxx @@ -28,7 +28,7 @@ // #include "HOMARD_Cas_i.hxx" -#include "HOMARD_Gen_i.hxx" +#include "ADAPT_Gen_i.hxx" #include "HOMARD_Cas.hxx" #include "HOMARD_DriverTools.hxx" #include "HOMARD.hxx" @@ -58,7 +58,7 @@ HOMARD_Cas_i::HOMARD_Cas_i() */ //============================================================================= HOMARD_Cas_i::HOMARD_Cas_i( CORBA::ORB_ptr orb, - HOMARD::HOMARD_Gen_var engine ) + ADAPT::ADAPT_Gen_var engine ) { MESSAGE( "HOMARD_Cas_i" ); _gen_i = engine; @@ -108,12 +108,12 @@ char* HOMARD_Cas_i::GetDumpPython() //============================================================================= std::string HOMARD_Cas_i::Dump() const { - return HOMARD::Dump( *myHomardCas ); + return ADAPT::Dump( *myHomardCas ); } //============================================================================= bool HOMARD_Cas_i::Restore( const std::string& stream ) { - return HOMARD::Restore( *myHomardCas, stream ); + return ADAPT::Restore( *myHomardCas, stream ); } //============================================================================= //============================================================================= @@ -161,7 +161,7 @@ void HOMARD_Cas_i::SetDirName( const char* NomDir ) { MESSAGE ( "etat : " << GetState() ) ; // D.1. Nom local du repertoire de l'iteration de depart dans le repertoire actuel du cas - HOMARD::HOMARD_Iteration_ptr Iter = GetIter0() ; + ADAPT::HOMARD_Iteration_ptr Iter = GetIter0() ; char* DirNameIter = Iter->GetDirNameLoc() ; MESSAGE ( "SetDirName : nom actuel pour le repertoire de l iteration, DirNameIter = "<< DirNameIter); // D.2. Recherche d'un nom local pour l'iteration de depart dans le futur repertoire du cas @@ -223,7 +223,7 @@ CORBA::Long HOMARD_Cas_i::GetState() ASSERT( myHomardCas ); // Nom de l'iteration initiale char* Iter0Name = GetIter0Name() ; - HOMARD::HOMARD_Iteration_ptr Iter = _gen_i->GetIteration(Iter0Name) ; + ADAPT::HOMARD_Iteration_ptr Iter = _gen_i->GetIteration(Iter0Name) ; int state = Iter->GetNumber() ; return state ; } @@ -260,7 +260,7 @@ CORBA::Long HOMARD_Cas_i::GetExtType() return myHomardCas->GetExtType(); } //============================================================================= -void HOMARD_Cas_i::SetBoundingBox( const HOMARD::extrema& LesExtrema ) +void HOMARD_Cas_i::SetBoundingBox( const ADAPT::extrema& LesExtrema ) { ASSERT( myHomardCas ); std::vector VExtrema; @@ -273,10 +273,10 @@ void HOMARD_Cas_i::SetBoundingBox( const HOMARD::extrema& LesExtrema ) myHomardCas->SetBoundingBox( VExtrema ); } //============================================================================= -HOMARD::extrema* HOMARD_Cas_i::GetBoundingBox() +ADAPT::extrema* HOMARD_Cas_i::GetBoundingBox() { ASSERT(myHomardCas ); - HOMARD::extrema_var aResult = new HOMARD::extrema(); + ADAPT::extrema_var aResult = new ADAPT::extrema(); std::vector LesExtremes = myHomardCas->GetBoundingBox(); ASSERT( LesExtremes.size() == 10 ); aResult->length( 10 ); @@ -293,7 +293,7 @@ void HOMARD_Cas_i::AddGroup( const char* Group) myHomardCas->AddGroup( Group ); } //============================================================================= -void HOMARD_Cas_i::SetGroups( const HOMARD::ListGroupType& ListGroup ) +void HOMARD_Cas_i::SetGroups( const ADAPT::ListGroupType& ListGroup ) { ASSERT( myHomardCas ); std::list ListString ; @@ -304,11 +304,11 @@ void HOMARD_Cas_i::SetGroups( const HOMARD::ListGroupType& ListGroup ) myHomardCas->SetGroups( ListString ); } //============================================================================= -HOMARD::ListGroupType* HOMARD_Cas_i::GetGroups() +ADAPT::ListGroupType* HOMARD_Cas_i::GetGroups() { ASSERT(myHomardCas ); const std::list& ListString = myHomardCas->GetGroups(); - HOMARD::ListGroupType_var aResult = new HOMARD::ListGroupType(); + ADAPT::ListGroupType_var aResult = new ADAPT::ListGroupType(); aResult->length( ListString.size() ); std::list::const_iterator it; int i = 0; @@ -332,7 +332,7 @@ void HOMARD_Cas_i::AddBoundaryGroup( const char* BoundaryName, const char* Group ASSERT( myHomardCas ); // A. Préalables // A.1. Caractéristiques de la frontière à ajouter - HOMARD::HOMARD_Boundary_ptr myBoundary = _gen_i->GetBoundary(BoundaryName) ; + ADAPT::HOMARD_Boundary_ptr myBoundary = _gen_i->GetBoundary(BoundaryName) ; ASSERT(!CORBA::is_nil(myBoundary)); int BoundaryType = myBoundary->GetType(); MESSAGE ( ". BoundaryType = " << BoundaryType ); @@ -366,7 +366,7 @@ void HOMARD_Cas_i::AddBoundaryGroup( const char* BoundaryName, const char* Group { boun = (*it).c_str() ; MESSAGE (".. Frontiere enregistrée : "<< boun ); - HOMARD::HOMARD_Boundary_ptr myBoundary_0 = _gen_i->GetBoundary(boun) ; + ADAPT::HOMARD_Boundary_ptr myBoundary_0 = _gen_i->GetBoundary(boun) ; int BoundaryType_0 = myBoundary_0->GetType(); MESSAGE ( ".. BoundaryType_0 = " << BoundaryType_0 ); if ( BoundaryType_0 == -1 ) @@ -386,7 +386,7 @@ void HOMARD_Cas_i::AddBoundaryGroup( const char* BoundaryName, const char* Group MESSAGE (".. Frontiere enregistrée : "<< boun ); if ( boun != BoundaryName ) { - HOMARD::HOMARD_Boundary_ptr myBoundary_0 = _gen_i->GetBoundary(boun) ; + ADAPT::HOMARD_Boundary_ptr myBoundary_0 = _gen_i->GetBoundary(boun) ; int BoundaryType_0 = myBoundary_0->GetType(); MESSAGE ( ".. BoundaryType_0 = " << BoundaryType_0 ); if ( BoundaryType_0 == 0 ) @@ -455,12 +455,12 @@ void HOMARD_Cas_i::AddBoundaryGroup( const char* BoundaryName, const char* Group } } //============================================================================= -HOMARD::ListBoundaryGroupType* HOMARD_Cas_i::GetBoundaryGroup() +ADAPT::ListBoundaryGroupType* HOMARD_Cas_i::GetBoundaryGroup() { MESSAGE ("GetBoundaryGroup"); ASSERT(myHomardCas ); const std::list& ListBoundaryGroup = myHomardCas->GetBoundaryGroup(); - HOMARD::ListBoundaryGroupType_var aResult = new HOMARD::ListBoundaryGroupType(); + ADAPT::ListBoundaryGroupType_var aResult = new ADAPT::ListBoundaryGroupType(); aResult->length( ListBoundaryGroup.size() ); std::list::const_iterator it; int i = 0; @@ -523,7 +523,7 @@ char* HOMARD_Cas_i::GetIter0Name() return CORBA::string_dup( myHomardCas->GetIter0Name().c_str() ); } //============================================================================= -HOMARD::HOMARD_Iteration_ptr HOMARD_Cas_i::GetIter0() +ADAPT::HOMARD_Iteration_ptr HOMARD_Cas_i::GetIter0() { // Nom de l'iteration initiale char* Iter0Name = GetIter0Name() ; @@ -531,7 +531,7 @@ HOMARD::HOMARD_Iteration_ptr HOMARD_Cas_i::GetIter0() return _gen_i->GetIteration(Iter0Name) ; } //============================================================================= -HOMARD::HOMARD_Iteration_ptr HOMARD_Cas_i::NextIteration( const char* IterName ) +ADAPT::HOMARD_Iteration_ptr HOMARD_Cas_i::NextIteration( const char* IterName ) { // Nom de l'iteration parent char* NomIterParent = GetIter0Name() ; @@ -540,10 +540,10 @@ HOMARD::HOMARD_Iteration_ptr HOMARD_Cas_i::NextIteration( const char* IterName ) return _gen_i->CreateIteration(IterName, NomIterParent) ; } //============================================================================= -HOMARD::HOMARD_Iteration_ptr HOMARD_Cas_i::LastIteration( ) +ADAPT::HOMARD_Iteration_ptr HOMARD_Cas_i::LastIteration( ) { - HOMARD::HOMARD_Iteration_ptr Iter ; - HOMARD::listeIterFilles_var ListeIterFilles ; + ADAPT::HOMARD_Iteration_ptr Iter ; + ADAPT::listeIterFilles_var ListeIterFilles ; char* IterName ; // Iteration initiale du cas IterName = GetIter0Name() ; @@ -586,7 +586,7 @@ void HOMARD_Cas_i::AddIteration( const char* NomIteration ) // DirName : le repertoire de lancement des calculs du sch?ma // MeshFile : nom du fichier contenant le maillage pour le premier calcul //============================================================================= -HOMARD::HOMARD_YACS_ptr HOMARD_Cas_i::CreateYACSSchema( const char* YACSName, const char* ScriptFile, const char* DirName, const char* MeshFile ) +ADAPT::HOMARD_YACS_ptr HOMARD_Cas_i::CreateYACSSchema( const char* YACSName, const char* ScriptFile, const char* DirName, const char* MeshFile ) { // Nom du cas const char* CaseName = GetName() ; diff --git a/src/ADAPT_I/HOMARD_Cas_i.hxx b/src/ADAPT_I/HOMARD_Cas_i.hxx index 94d17f857..60027606a 100644 --- a/src/ADAPT_I/HOMARD_Cas_i.hxx +++ b/src/ADAPT_I/HOMARD_Cas_i.hxx @@ -31,7 +31,7 @@ #define _HOMARD_CAS_I_HXX_ #include -#include CORBA_SERVER_HEADER(HOMARD_Gen) +#include CORBA_SERVER_HEADER(ADAPT_Gen) #include CORBA_SERVER_HEADER(HOMARD_Cas) #include "HOMARD_i.hxx" @@ -45,11 +45,11 @@ class HOMARD_Cas; class HOMARDENGINE_EXPORT HOMARD_Cas_i: public virtual Engines_Component_i, - public virtual POA_HOMARD::HOMARD_Cas, + public virtual POA_ADAPT::HOMARD_Cas, public virtual PortableServer::ServantBase { public: - HOMARD_Cas_i( CORBA::ORB_ptr orb, HOMARD::HOMARD_Gen_var gen_i ); + HOMARD_Cas_i( CORBA::ORB_ptr orb, ADAPT::ADAPT_Gen_var gen_i ); HOMARD_Cas_i(); virtual ~HOMARD_Cas_i(); @@ -79,16 +79,16 @@ public: void SetExtType( CORBA::Long ExtType ); CORBA::Long GetExtType(); - void SetBoundingBox( const HOMARD::extrema& LesExtremes ); - HOMARD::extrema* GetBoundingBox(); + void SetBoundingBox( const ADAPT::extrema& LesExtremes ); + ADAPT::extrema* GetBoundingBox(); void AddGroup( const char* Group); - void SetGroups(const HOMARD::ListGroupType& ListGroup); - HOMARD::ListGroupType* GetGroups(); + void SetGroups(const ADAPT::ListGroupType& ListGroup); + ADAPT::ListGroupType* GetGroups(); void AddBoundary(const char* Boundary); void AddBoundaryGroup(const char* Boundary, const char* Group); - HOMARD::ListBoundaryGroupType* GetBoundaryGroup(); + ADAPT::ListBoundaryGroupType* GetBoundaryGroup(); void SupprBoundaryGroup( ); void SetPyram( CORBA::Long Pyram ); @@ -98,22 +98,22 @@ public: // Liens avec les autres structures char* GetIter0Name(); - HOMARD::HOMARD_Iteration_ptr GetIter0() ; + ADAPT::HOMARD_Iteration_ptr GetIter0() ; - HOMARD::HOMARD_Iteration_ptr NextIteration( const char* Name ) ; + ADAPT::HOMARD_Iteration_ptr NextIteration( const char* Name ) ; - HOMARD::HOMARD_Iteration_ptr LastIteration() ; + ADAPT::HOMARD_Iteration_ptr LastIteration() ; void AddIteration( const char* NomIteration ); // YACS - HOMARD::HOMARD_YACS_ptr CreateYACSSchema( const char* YACSName, const char* ScriptFile, const char* DirName, const char* MeshFile ); + ADAPT::HOMARD_YACS_ptr CreateYACSSchema( const char* YACSName, const char* ScriptFile, const char* DirName, const char* MeshFile ); private: ::HOMARD_Cas* myHomardCas; CORBA::ORB_ptr _orb; - HOMARD::HOMARD_Gen_var _gen_i; + ADAPT::ADAPT_Gen_var _gen_i; }; #endif diff --git a/src/ADAPT_I/HOMARD_Gen_i.cxx b/src/ADAPT_I/HOMARD_Gen_i.cxx deleted file mode 100644 index 35cca098a..000000000 --- a/src/ADAPT_I/HOMARD_Gen_i.cxx +++ /dev/null @@ -1,5432 +0,0 @@ -// 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 -// 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 "HOMARD_Gen_i.hxx" -#include "HOMARD_Cas_i.hxx" -#include "HOMARD_Hypothesis_i.hxx" -#include "HOMARD_Iteration_i.hxx" -#include "HOMARD_Boundary_i.hxx" -#include "HOMARD_Zone_i.hxx" -#include "HOMARD_YACS_i.hxx" -#include "HomardDriver.hxx" -#include "HOMARD_DriverTools.hxx" -#include "HomardMedCommun.h" -#include "YACSDriver.hxx" -#include "HOMARD.hxx" - -#include "FrontTrack.hxx" - -#include "SMESH_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 -#include -#ifndef WIN32 -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef WIN32 -#include -#endif - -using namespace std; - -//============================================================================= -//functions -//============================================================================= -std::string RemoveTabulation( std::string theScript ) -{ - std::string::size_type aPos = 0; - while( aPos < theScript.length() ) - { - aPos = theScript.find( "\n\t", aPos ); - if( aPos == std::string::npos ) - break; - theScript.replace( aPos, 2, "\n" ); - aPos++; - } - return theScript; -} -//============================================================================= -/*! - * standard constructor - */ -//============================================================================= -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) -{ - MESSAGE("constructor"); - _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() ); - - _tag_gene = 0 ; - _tag_boun = 0 ; - _tag_hypo = 0 ; - _tag_yacs = 0 ; - _tag_zone = 0 ; - - SetPreferences( ) ; -} -//================================= -/*! - * standard destructor - */ -//================================ -HOMARD_Gen_i::~HOMARD_Gen_i() -{ -} -//============================================================================= -//============================================================================= -// Utilitaires pour l'étude -//============================================================================= -//============================================================================= -void HOMARD_Gen_i::UpdateStudy() -{ - ASSERT(!CORBA::is_nil(myStudy)); - SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder(); - - // Create SComponent labelled 'homard' if it doesn't already exit - SALOMEDS::SComponent_var homardFather = myStudy->FindComponent(ComponentDataType()); - if (CORBA::is_nil(homardFather)) - { - myBuilder->NewCommand(); - MESSAGE("Add Component HOMARD"); - - bool aLocked = myStudy->GetProperties()->IsLocked(); - if (aLocked) myStudy->GetProperties()->SetLocked(false); - - 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::Acomponent_var Comp = Catalogue->GetComponent(ComponentDataType()); - if (!Comp->_is_nil()) - { - aName->SetValue(ComponentDataType()); - } - - anAttr = myBuilder->FindOrCreateAttribute(homardFather,"AttributePixMap"); - SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); - aPixmap->SetPixMap("HOMARD_2.png"); - myBuilder->DefineComponentInstance(homardFather, HOMARD_Gen::_this()); - - if (aLocked) myStudy->GetProperties()->SetLocked(true); - myBuilder->CommitCommand(); - } -} - -//============================================================================= -//============================================================================= -// Utilitaires pour l'iteration -//============================================================================= -//============================================================================= -void HOMARD_Gen_i::SetEtatIter(const char* nomIter, const CORBA::Long Etat) -//===================================================================================== -{ - MESSAGE( "SetEtatIter : affectation de l'etat " << Etat << " a l'iteration " << nomIter ); - HOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[nomIter]; - if (CORBA::is_nil(myIteration)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid iteration"; - throw SALOME::SALOME_Exception(es); - return ; - }; - - myIteration->SetState(Etat); - - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); - SALOMEDS::SObject_var aIterSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIteration))); - - std::string icone ; - if ( Etat <= 0 ) - icone = "iter0.png" ; - else if ( Etat == 2 ) - icone = "iter_calculee.png" ; - else - icone = "iter_non_calculee.png" ; - PublishInStudyAttr(aStudyBuilder, aIterSO, NULL , NULL, icone.c_str(), NULL) ; - - aStudyBuilder->CommitCommand(); - -} -//============================================================================= -//============================================================================= -// -//============================================================================= -//============================================================================= -// Destruction des structures identifiees par leurs noms -//============================================================================= -//============================================================================= -CORBA::Long HOMARD_Gen_i::DeleteBoundary(const char* BoundaryName) -{ - MESSAGE ( "DeleteBoundary : BoundaryName = " << BoundaryName ); - HOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; - if (CORBA::is_nil(myBoundary)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid boundary"; - throw SALOME::SALOME_Exception(es); - return 1 ; - }; - -// On verifie que la frontiere n'est plus utilisee - HOMARD::listeCases* maListe = GetAllCasesName(); - int numberOfCases = maListe->length(); - MESSAGE ( ".. Nombre de cas = " << numberOfCases ); - std::string CaseName ; - HOMARD::ListBoundaryGroupType* ListBoundaryGroupType ; - int numberOfitems ; - HOMARD::HOMARD_Cas_var myCase ; - for (int NumeCas = 0; NumeCas< numberOfCases; NumeCas++) - { - CaseName = std::string((*maListe)[NumeCas]); - MESSAGE ( "... Examen du cas = " << CaseName.c_str() ); - myCase = myStudyContext._mesCas[CaseName]; - ASSERT(!CORBA::is_nil(myCase)); - ListBoundaryGroupType = myCase->GetBoundaryGroup(); - numberOfitems = ListBoundaryGroupType->length(); - MESSAGE ( "... number of string for Boundary+Group = " << numberOfitems); - for (int NumBoundary = 0; NumBoundary< numberOfitems; NumBoundary=NumBoundary+2) - { - if ( std::string((*ListBoundaryGroupType)[NumBoundary]) == BoundaryName ) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "This boundary is used in a case and cannot be deleted."; - throw SALOME::SALOME_Exception(es); - return 2 ; - }; - }; - } - - // comme on a un _var comme pointeur CORBA, on ne se preoccupe pas du delete - myStudyContext._mesBoundarys.erase(BoundaryName); - SALOMEDS::Study::ListOfSObject_var listSO = myStudy->FindObjectByName(BoundaryName, ComponentDataType()); - SALOMEDS::SObject_var aSO =listSO[0]; - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); - myStudy->NewBuilder()->RemoveObjectWithChildren(aSO); - - return 0 ; -} -//============================================================================= -CORBA::Long HOMARD_Gen_i::DeleteCase(const char* nomCas, CORBA::Long Option) -{ - // Pour detruire un cas - MESSAGE ( "DeleteCase : nomCas = " << nomCas << ", avec option = " << Option ); - HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; - if (CORBA::is_nil(myCase)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid case context"; - throw SALOME::SALOME_Exception(es); - return 1; - }; - // On commence par detruire toutes les iterations en partant de l'initiale et y compris elle - CORBA::String_var nomIter = myCase->GetIter0Name(); - CORBA::Long Option1 = 0 ; - if ( DeleteIterationOption(nomIter, Option1, Option) != 0 ) - { - return 2; - }; - - // comme on a un _var comme pointeur CORBA, on ne se preoccupe pas du delete - myStudyContext._mesCas.erase(nomCas); - SALOMEDS::Study::ListOfSObject_var listSO = myStudy->FindObjectByName(nomCas, ComponentDataType()); - SALOMEDS::SObject_var aSO =listSO[0]; - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); - myStudy->NewBuilder()->RemoveObjectWithChildren(aSO); - - return 0 ; -} -//============================================================================= -CORBA::Long HOMARD_Gen_i::DeleteHypo(const char* nomHypo) -{ - MESSAGE ( "DeleteHypo : nomHypo = " << nomHypo ); - HOMARD::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypo]; - if (CORBA::is_nil(myHypo)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid hypothesis"; - throw SALOME::SALOME_Exception(es); - return 1 ; - }; - -// On verifie que l'hypothese n'est plus utilisee - HOMARD::listeIters* maListeIter = myHypo->GetIterations(); - int numberOfIter = maListeIter->length(); - if ( numberOfIter > 0 ) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "This hypothesis is used in an iteration and cannot be deleted."; - throw SALOME::SALOME_Exception(es); - return 2 ; - }; - - // suppression du lien avec les zones eventuelles - HOMARD::listeZonesHypo* maListe = myHypo->GetZones(); - int numberOfZones = maListe->length(); - MESSAGE ( ".. Nombre de zones = " << numberOfZones ); - for (int NumeZone = 0; NumeZone< numberOfZones; NumeZone++) - { - std::string ZoneName = std::string((*maListe)[NumeZone]); - MESSAGE ( ".. suppression du lien avec la zone = " << ZoneName.c_str() ); - DissociateHypoZone(nomHypo, ZoneName.c_str()) ; - NumeZone += 1 ; - } - - // comme on a un _var comme pointeur CORBA, on ne se preoccupe pas du delete - myStudyContext._mesHypotheses.erase(nomHypo); - SALOMEDS::Study::ListOfSObject_var listSO = myStudy->FindObjectByName(nomHypo, ComponentDataType()); - SALOMEDS::SObject_var aSO =listSO[0]; - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); - myStudy->NewBuilder()->RemoveObjectWithChildren(aSO); - - return 0 ; -} -//============================================================================= -CORBA::Long HOMARD_Gen_i::DeleteIteration(const char* nomIter, CORBA::Long Option) -{ - // Option = 0 : On ne supprime pas le fichier du maillage associe - // Option = 1 : On supprime le fichier du maillage associe - // Pour detruire une iteration courante - MESSAGE ( "DeleteIteration : nomIter = " << nomIter << ", avec option = " << Option ); - CORBA::Long Option1 = 1 ; - return DeleteIterationOption(nomIter, Option1, Option); -} -//============================================================================= -CORBA::Long HOMARD_Gen_i::DeleteIterationOption(const char* nomIter, CORBA::Long Option1, CORBA::Long Option2) -{ - // Option1 = 0 : On autorise la destruction de l'iteration 0 - // Option1 = 1 : On interdit la destruction de l'iteration 0 - - // Option2 = 0 : On ne supprime pas le fichier du maillage associe - // Option2 = 1 : On supprime le fichier du maillage associe - MESSAGE ( "DeleteIterationOption : nomIter = " << nomIter << ", avec options = " << Option1<< ", " << Option2 ); - HOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[nomIter]; - if (CORBA::is_nil(myIteration)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid iteration"; - throw SALOME::SALOME_Exception(es); - return 1 ; - }; - - int numero = myIteration->GetNumber(); - MESSAGE ( "DeleteIterationOption : numero = " << numero ); - if ( numero == 0 && Option1 == 1 ) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "This iteration cannot be deleted."; - throw SALOME::SALOME_Exception(es); - return 2 ; - }; - - // On detruit recursivement toutes les filles - HOMARD::listeIterFilles* maListe = myIteration->GetIterations(); - int numberOfIter = maListe->length(); - for (int NumeIter = 0; NumeIter< numberOfIter; NumeIter++) - { - std::string nomIterFille = std::string((*maListe)[NumeIter]); - MESSAGE ( ".. appel recursif de DeleteIterationOption pour nomIter = " << nomIterFille.c_str() ); - DeleteIterationOption(nomIterFille.c_str(), Option1, Option2); - } - - // On arrive ici pour une iteration sans fille - MESSAGE ( "Destruction effective de " << nomIter ); - // On commence par invalider l'iteration pour faire le menage des dependances - // et eventuellement du maillage associe - int option ; - if ( numero == 0 ) { option = 0 ; } - else { option = Option2 ; } - InvalideIterOption(nomIter, option) ; - - // Retrait dans la descendance de l'iteration parent - if ( numero > 0 ) - { - std::string nomIterationParent = myIteration->GetIterParentName(); - MESSAGE ( "Retrait dans la descendance de nomIterationParent " << nomIterationParent ); - HOMARD::HOMARD_Iteration_var myIterationParent = myStudyContext._mesIterations[nomIterationParent]; - if (CORBA::is_nil(myIterationParent)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid iteration"; - throw SALOME::SALOME_Exception(es); - return 3 ; - }; - myIterationParent->UnLinkNextIteration(nomIter); - } - - // suppression du lien avec l'hypothese - if ( numero > 0 ) - { - std::string nomHypo = myIteration->GetHypoName(); - HOMARD::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypo]; - ASSERT(!CORBA::is_nil(myHypo)); - myHypo->UnLinkIteration(nomIter); - } - - // comme on a un _var comme pointeur CORBA, on ne se preoccupe pas du delete - myStudyContext._mesIterations.erase(nomIter); - SALOMEDS::Study::ListOfSObject_var listSO = myStudy->FindObjectByName(nomIter, ComponentDataType()); - SALOMEDS::SObject_var aSO =listSO[0]; - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); - myStudy->NewBuilder()->RemoveObjectWithChildren(aSO); - // on peut aussi faire RemoveObject -// MESSAGE ( "Au final" ); -// HOMARD::listeIterations* Liste = GetAllIterationsName() ; -// numberOfIter = Liste->length(); -// for (int NumeIter = 0; NumeIter< numberOfIter; NumeIter++) -// { -// std::string nomIterFille = std::string((*Liste)[NumeIter]); -// MESSAGE ( ".. nomIter = " << nomIterFille.c_str() ); -// } - - return 0 ; -} -//============================================================================= -CORBA::Long HOMARD_Gen_i::DeleteYACS(const char* nomYACS, CORBA::Long Option) -{ - // Option = 0 : On ne supprime pas le fichier du schema associe - // Option = 1 : On supprime le fichier du schema associe - MESSAGE ( "DeleteYACS : nomYACS = " << nomYACS << ", avec option = " << Option ); - HOMARD::HOMARD_YACS_var myYACS = myStudyContext._mesYACSs[nomYACS]; - if (CORBA::is_nil(myYACS)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid schema YACS"; - throw SALOME::SALOME_Exception(es); - return 1 ; - }; - // Suppression eventuelle du fichier XML - if ( Option == 1 ) - { - std::string nomFichier = myYACS->GetXMLFile(); - std::string commande = "rm -rf " + nomFichier ; - MESSAGE ( "commande = " << commande ); - if ((system(commande.c_str())) != 0) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "The xml file for the schema YACS cannot be removed." ; - throw SALOME::SALOME_Exception(es); - return 2 ; - } - } - // comme on a un _var comme pointeur CORBA, on ne se preoccupe pas du delete - myStudyContext._mesYACSs.erase(nomYACS); - SALOMEDS::Study::ListOfSObject_var listSO = myStudy->FindObjectByName(nomYACS, ComponentDataType()); - SALOMEDS::SObject_var aSO =listSO[0]; - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); - myStudy->NewBuilder()->RemoveObjectWithChildren(aSO); - - return 0 ; -} -//============================================================================= -CORBA::Long HOMARD_Gen_i::DeleteZone(const char* nomZone) -{ - MESSAGE ( "DeleteZone : nomZone = " << nomZone ); - HOMARD::HOMARD_Zone_var myZone = myStudyContext._mesZones[nomZone]; - if (CORBA::is_nil(myZone)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid zone"; - throw SALOME::SALOME_Exception(es); - return 1 ; - }; - -// On verifie que la zone n'est plus utilisee - HOMARD::listeHypo* maListe = myZone->GetHypo(); - int numberOfHypo = maListe->length(); - MESSAGE ( ".. Nombre d'hypotheses = " << numberOfHypo ); - if ( numberOfHypo > 0 ) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "This zone is used in a hypothesis and cannot be deleted."; - throw SALOME::SALOME_Exception(es); - return 2 ; - }; -// - // comme on a un _var comme pointeur CORBA, on ne se preoccupe pas du delete - myStudyContext._mesZones.erase(nomZone); - SALOMEDS::Study::ListOfSObject_var listSO = myStudy->FindObjectByName(nomZone, ComponentDataType()); - SALOMEDS::SObject_var aSO =listSO[0]; - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); - myStudy->NewBuilder()->RemoveObjectWithChildren(aSO); - - return 0 ; -} -//============================================================================= -//============================================================================= -// -//============================================================================= -//============================================================================= -// Invalidation des structures identifiees par leurs noms -//============================================================================= -//============================================================================= -void HOMARD_Gen_i::InvalideBoundary(const char* BoundaryName) -{ - MESSAGE( "InvalideBoundary : BoundaryName = " << BoundaryName ); - HOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; - if (CORBA::is_nil(myBoundary)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid boundary"; - throw SALOME::SALOME_Exception(es); - return ; - } - else - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "No change is allowed in a boundary. Ask for evolution."; - throw SALOME::SALOME_Exception(es); - return ; - }; -} -//============================================================================= -void HOMARD_Gen_i::InvalideHypo(const char* nomHypo) -{ - MESSAGE( "InvalideHypo : nomHypo = " << nomHypo ); - HOMARD::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypo]; - if (CORBA::is_nil(myHypo)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid hypothesis"; - throw SALOME::SALOME_Exception(es); - return ; - }; - - HOMARD::listeIters* maListe = myHypo->GetIterations(); - int numberOfIter = maListe->length(); - for (int NumeIter = 0; NumeIter< numberOfIter; NumeIter++) - { - std::string nomIter = std::string((*maListe)[NumeIter]); - MESSAGE( ".. nomIter = " << nomIter ); - InvalideIter(nomIter.c_str()); - } -} -//============================================================================= -void HOMARD_Gen_i::InvalideIter(const char* nomIter) -{ - MESSAGE("InvalideIter : nomIter = " << nomIter); - // Pour invalider totalement une iteration courante - CORBA::Long Option = 1 ; - return InvalideIterOption(nomIter, Option); -} -//============================================================================= -void HOMARD_Gen_i::InvalideIterOption(const char* nomIter, CORBA::Long Option) -{ - // Option = 0 : On ne supprime pas le fichier du maillage associe - // Option = 1 : On supprime le fichier du maillage associe - MESSAGE ( "InvalideIterOption : nomIter = " << nomIter << ", avec option = " << Option ); - HOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[nomIter]; - if (CORBA::is_nil(myIteration)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid iteration"; - throw SALOME::SALOME_Exception(es); - return ; - }; - - HOMARD::listeIterFilles* maListe = myIteration->GetIterations(); - int numberOfIter = maListe->length(); - for (int NumeIter = 0; NumeIter< numberOfIter; NumeIter++) - { - std::string nomIterFille = std::string((*maListe)[NumeIter]); - MESSAGE ( ".. appel recursif de InvalideIter pour nomIter = " << nomIterFille.c_str() ); - InvalideIter(nomIterFille.c_str()); - } - - // On arrive ici pour une iteration sans fille - MESSAGE ( "Invalidation effective de " << nomIter ); - SALOMEDS::SObject_var aIterSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIteration))); - SALOMEDS::ChildIterator_var aIter = myStudy->NewChildIterator(aIterSO); - for (; aIter->More(); aIter->Next()) - { - SALOMEDS::SObject_var so = aIter->Value(); - SALOMEDS::GenericAttribute_var anAttr; - if (!so->FindAttribute(anAttr, "AttributeComment")) continue; - SALOMEDS::AttributeComment_var aCommentAttr = SALOMEDS::AttributeComment::_narrow(anAttr); - std::string value (aCommentAttr->Value()); - if(value == std::string("IterationHomard")) continue; - if(value == std::string("HypoHomard")) continue; - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); - aStudyBuilder->RemoveObject(so); - } - - int etat = myIteration->GetState(); - if ( etat > 0 ) - { - SetEtatIter(nomIter,1); - const char * nomCas = myIteration->GetCaseName(); - HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; - if (CORBA::is_nil(myCase)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid case context"; - throw SALOME::SALOME_Exception(es); - return ; - }; - std::string nomDir = myIteration->GetDirName(); - std::string nomFichier = myIteration->GetMeshFile(); - std::string commande = "rm -rf " + std::string(nomDir); - if ( Option == 1 ) { commande = commande + ";rm -rf " + std::string(nomFichier) ; } - MESSAGE ( "commande = " << commande ); - if ((system(commande.c_str())) != 0) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "The directory for the calculation cannot be cleared." ; - throw SALOME::SALOME_Exception(es); - return ; - } - // Suppression du maillage publie dans SMESH - std::string MeshName = myIteration->GetMeshName() ; - DeleteResultInSmesh(nomFichier, MeshName) ; - }; - -} -//============================================================================= -void HOMARD_Gen_i::InvalideIterInfo(const char* nomIter) -{ - MESSAGE("InvalideIterInfo : nomIter = " << nomIter); - HOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[nomIter]; - if (CORBA::is_nil(myIteration)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid iteration"; - throw SALOME::SALOME_Exception(es); - return ; - }; - - SALOMEDS::SObject_var aIterSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIteration))); - SALOMEDS::ChildIterator_var aIter = myStudy->NewChildIterator(aIterSO); - for (; aIter->More(); aIter->Next()) - { - SALOMEDS::SObject_var so = aIter->Value(); - SALOMEDS::GenericAttribute_var anAttr; - if (!so->FindAttribute(anAttr, "AttributeComment")) continue; - SALOMEDS::AttributeComment_var aCommentAttr = SALOMEDS::AttributeComment::_narrow(anAttr); - std::string value (aCommentAttr->Value()); -/* MESSAGE("... value = " << value);*/ - if( (value == std::string("logInfo")) || ( value == std::string("SummaryInfo")) ) - { - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); - aStudyBuilder->RemoveObject(so); - } - } - - const char * nomCas = myIteration->GetCaseName(); - HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; - if (CORBA::is_nil(myCase)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid case context"; - throw SALOME::SALOME_Exception(es); - return ; - }; - const char* nomDir = myIteration->GetDirName(); - std::string commande = "rm -f " + std::string(nomDir) + "/info* " ; - commande += std::string(nomDir) + "/Liste.*info" ; -/* MESSAGE ( "commande = " << commande );*/ - if ((system(commande.c_str())) != 0) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "The directory for the calculation cannot be cleared." ; - throw SALOME::SALOME_Exception(es); - return ; - } -} -//============================================================================= -void HOMARD_Gen_i::InvalideYACS(const char* YACSName) -{ - MESSAGE( "InvalideYACS : YACSName = " << YACSName ); - HOMARD::HOMARD_YACS_var myYACS = myStudyContext._mesYACSs[YACSName]; - if (CORBA::is_nil(myYACS)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid schema YACS"; - throw SALOME::SALOME_Exception(es); - return ; - }; - // - SALOMEDS::SObject_var aYACSSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myYACS))); - SALOMEDS::ChildIterator_var aYACS = myStudy->NewChildIterator(aYACSSO); - for (; aYACS->More(); aYACS->Next()) - { - SALOMEDS::SObject_var so = aYACS->Value(); - SALOMEDS::GenericAttribute_var anAttr; - if (!so->FindAttribute(anAttr, "AttributeComment")) continue; - SALOMEDS::AttributeComment_var aCommentAttr = SALOMEDS::AttributeComment::_narrow(anAttr); - std::string value (aCommentAttr->Value()); - if( value == std::string("xml") ) - { - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); - aStudyBuilder->RemoveObject(so); - } - } - std::string nomFichier = myYACS->GetXMLFile(); - std::string commande = "rm -rf " + std::string(nomFichier) ; - MESSAGE ( "commande = " << commande ); - if ((system(commande.c_str())) != 0) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "The XML file for the schema YACS cannot be removed." ; - throw SALOME::SALOME_Exception(es); - return ; - } -} -//============================================================================= -void HOMARD_Gen_i::InvalideZone(const char* ZoneName) -{ - MESSAGE( "InvalideZone : ZoneName = " << ZoneName ); - HOMARD::HOMARD_Zone_var myZone = myStudyContext._mesZones[ZoneName]; - if (CORBA::is_nil(myZone)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid zone"; - throw SALOME::SALOME_Exception(es); - return ; - }; - HOMARD::listeHypo* maListe = myZone->GetHypo(); - int numberOfHypo = maListe->length(); - MESSAGE( ".. numberOfHypo = " << numberOfHypo ); - for (int NumeHypo = 0; NumeHypo< numberOfHypo; NumeHypo++) - { - std::string nomHypo = std::string((*maListe)[NumeHypo]); - MESSAGE( ".. nomHypo = " << nomHypo ); - InvalideHypo(nomHypo.c_str()); - } -} -//============================================================================= -//============================================================================= -// -//============================================================================= -//============================================================================= -// Association de lien entre des structures identifiees par leurs noms -//============================================================================= -//============================================================================= -void HOMARD_Gen_i::AssociateCaseIter(const char* nomCas, const char* nomIter, const char* labelIter) -{ - MESSAGE( "AssociateCaseIter : " << nomCas << ", " << nomIter << ", " << labelIter ); - - HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; - if (CORBA::is_nil(myCase)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid case"; - throw SALOME::SALOME_Exception(es); - return ; - }; - - HOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[nomIter]; - if (CORBA::is_nil(myIteration)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid iteration"; - throw SALOME::SALOME_Exception(es); - return ; - }; - - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); - SALOMEDS::SObject_var aCasSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myCase))); - if (CORBA::is_nil(aCasSO)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid case"; - throw SALOME::SALOME_Exception(es); - return ; - }; - - aStudyBuilder->NewCommand(); - SALOMEDS::SObject_var newStudyIter = aStudyBuilder->NewObject(aCasSO); - PublishInStudyAttr(aStudyBuilder, newStudyIter, nomIter , labelIter, - "iter_non_calculee.png", _orb->object_to_string(myIteration)) ; - aStudyBuilder->CommitCommand(); - - myCase->AddIteration(nomIter); - myIteration->SetCaseName(nomCas); -} -//===================================================================================== -void HOMARD_Gen_i::AssociateHypoZone(const char* nomHypothesis, const char* ZoneName, CORBA::Long TypeUse) -{ - MESSAGE ( "AssociateHypoZone : nomHypo = " << nomHypothesis << ", ZoneName= " << ZoneName << ", TypeUse = " << TypeUse); - - HOMARD::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypothesis]; - ASSERT(!CORBA::is_nil(myHypo)); - SALOMEDS::SObject_var aHypoSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myHypo))); - ASSERT(!CORBA::is_nil(aHypoSO)); - - HOMARD::HOMARD_Zone_var myZone = myStudyContext._mesZones[ZoneName]; - ASSERT(!CORBA::is_nil(myZone)); - SALOMEDS::SObject_var aZoneSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myZone))); - ASSERT(!CORBA::is_nil(aZoneSO)); - - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); - - aStudyBuilder->NewCommand(); - - SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aHypoSO); - aStudyBuilder->Addreference(aSubSO, aZoneSO); - - aStudyBuilder->CommitCommand(); - - myZone->AddHypo(nomHypothesis); - myHypo->AddZone0(ZoneName, TypeUse); -}; -//============================================================================= -void HOMARD_Gen_i::AssociateIterHypo(const char* nomIter, const char* nomHypo) -{ - MESSAGE("AssociateIterHypo : nomHypo = " << nomHypo << " nomIter = " << nomIter); - - // Verification de l'existence de l'hypothese - HOMARD::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypo]; - ASSERT(!CORBA::is_nil(myHypo)); - SALOMEDS::SObject_var aHypoSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myHypo))); - ASSERT(!CORBA::is_nil(aHypoSO)); - - // Verification de l'existence de l'iteration - HOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[nomIter]; - ASSERT(!CORBA::is_nil(myIteration)); - SALOMEDS::SObject_var aIterSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIteration))); - ASSERT(!CORBA::is_nil(aIterSO)); - - // Gestion de l'arbre d'etudes - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); - aStudyBuilder->NewCommand(); - SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aIterSO); - aStudyBuilder->Addreference(aSubSO, aHypoSO); - aStudyBuilder->CommitCommand(); - - // Liens reciproques - myIteration->SetHypoName(nomHypo); - myHypo->LinkIteration(nomIter); - - // 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(); - for (int iaux = 0; iaux< numberOfFieldsx2; iaux++) - { - std::string FieldName = std::string((*ListField)[iaux]) ; - myIteration->SetFieldInterp(FieldName.c_str()) ; - iaux++ ; - } -}; -//============================================================================= -//============================================================================= -// -//============================================================================= -//============================================================================= -// Dissociation de lien entre des structures identifiees par leurs noms -//============================================================================= -//============================================================================= -void HOMARD_Gen_i::DissociateHypoZone(const char* nomHypothesis, const char* ZoneName) -{ - MESSAGE ( "DissociateHypoZone : ZoneName= " << ZoneName << ", nomHypo = " << nomHypothesis); - - HOMARD::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypothesis]; - ASSERT(!CORBA::is_nil(myHypo)); - SALOMEDS::SObject_var aHypoSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myHypo))); - ASSERT(!CORBA::is_nil(aHypoSO)); - - HOMARD::HOMARD_Zone_var myZone = myStudyContext._mesZones[ZoneName]; - ASSERT(!CORBA::is_nil(myZone)); - SALOMEDS::SObject_var aZoneSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myZone))); - ASSERT(!CORBA::is_nil(aZoneSO)); - - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); - - SALOMEDS::ChildIterator_var it = myStudy->NewChildIterator(aHypoSO); - for (; it->More(); it->Next()) - { - SALOMEDS::SObject_var aHypObj = it->Value(); - SALOMEDS::SObject_var ptrObj; - if (aHypObj->ReferencedObject(ptrObj)) - { - if (std::string(ptrObj->GetName()) == std::string(aZoneSO->GetName())) - { - aStudyBuilder->NewCommand(); - aStudyBuilder->RemoveObject(aHypObj); - aStudyBuilder->CommitCommand(); - break; - } - } - } - - myZone->SupprHypo(nomHypothesis); - myHypo->SupprZone(ZoneName); -}; -//============================================================================= -//============================================================================= -// - -//============================================================================= -//============================================================================= -// Recuperation des listes -//============================================================================= -//============================================================================= -HOMARD::listeBoundarys* HOMARD_Gen_i::GetAllBoundarysName() -{ - MESSAGE("GetAllBoundarysName"); - IsValidStudy () ; - - HOMARD::listeBoundarys_var ret = new HOMARD::listeBoundarys; - ret->length(myStudyContext._mesBoundarys.size()); - std::map::const_iterator it; - int i = 0; - for (it = myStudyContext._mesBoundarys.begin(); - it != myStudyContext._mesBoundarys.end(); it++) - { - ret[i++] = CORBA::string_dup((*it).first.c_str()); - } - - return ret._retn(); -} -//============================================================================= -HOMARD::listeCases* HOMARD_Gen_i::GetAllCasesName() -{ - MESSAGE("GetAllCasesName"); - IsValidStudy () ; - - HOMARD::listeCases_var ret = new HOMARD::listeCases; - ret->length(myStudyContext._mesCas.size()); - std::map::const_iterator it; - int i = 0; - for (it = myStudyContext._mesCas.begin(); - it != myStudyContext._mesCas.end(); it++) - { - ret[i++] = CORBA::string_dup((*it).first.c_str()); - } - - return ret._retn(); -} -//============================================================================= -HOMARD::listeHypotheses* HOMARD_Gen_i::GetAllHypothesesName() -{ - MESSAGE("GetAllHypothesesName"); - IsValidStudy () ; - - HOMARD::listeHypotheses_var ret = new HOMARD::listeHypotheses; - ret->length(myStudyContext._mesHypotheses.size()); - std::map::const_iterator it; - int i = 0; - for (it = myStudyContext._mesHypotheses.begin(); - it != myStudyContext._mesHypotheses.end(); it++) - { - ret[i++] = CORBA::string_dup((*it).first.c_str()); - } - - return ret._retn(); -} -//============================================================================= -HOMARD::listeIterations* HOMARD_Gen_i::GetAllIterationsName() -{ - MESSAGE("GetAllIterationsName"); - IsValidStudy () ; - - HOMARD::listeIterations_var ret = new HOMARD::listeIterations; - ret->length(myStudyContext._mesIterations.size()); - std::map::const_iterator it; - int i = 0; - for (it = myStudyContext._mesIterations.begin(); - it != myStudyContext._mesIterations.end(); it++) - { - ret[i++] = CORBA::string_dup((*it).first.c_str()); - } - - return ret._retn(); -} -//============================================================================= -HOMARD::listeYACSs* HOMARD_Gen_i::GetAllYACSsName() -{ - MESSAGE("GetAllYACSsName"); - IsValidStudy () ; - - HOMARD::listeYACSs_var ret = new HOMARD::listeYACSs; - ret->length(myStudyContext._mesYACSs.size()); - std::map::const_iterator it; - int i = 0; - for (it = myStudyContext._mesYACSs.begin(); - it != myStudyContext._mesYACSs.end(); it++) - { - ret[i++] = CORBA::string_dup((*it).first.c_str()); - } - - return ret._retn(); -} -//============================================================================= -HOMARD::listeZones* HOMARD_Gen_i::GetAllZonesName() -{ - MESSAGE("GetAllZonesName"); - IsValidStudy () ; - - HOMARD::listeZones_var ret = new HOMARD::listeZones; - ret->length(myStudyContext._mesZones.size()); - std::map::const_iterator it; - int i = 0; - for (it = myStudyContext._mesZones.begin(); - it != myStudyContext._mesZones.end(); it++) - { - ret[i++] = CORBA::string_dup((*it).first.c_str()); - } - - return ret._retn(); -} -//============================================================================= -//============================================================================= - -//============================================================================= -//============================================================================= -// Recuperation des structures identifiees par leurs noms -//============================================================================= -//============================================================================= -HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::GetBoundary(const char* nomBoundary) -{ - HOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[nomBoundary]; - ASSERT(!CORBA::is_nil(myBoundary)); - return HOMARD::HOMARD_Boundary::_duplicate(myBoundary); -} -//============================================================================= -HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::GetCase(const char* nomCas) -{ - HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; - ASSERT(!CORBA::is_nil(myCase)); - return HOMARD::HOMARD_Cas::_duplicate(myCase); -} -//============================================================================= -HOMARD::HOMARD_Hypothesis_ptr HOMARD_Gen_i::GetHypothesis(const char* nomHypothesis) -{ - HOMARD::HOMARD_Hypothesis_var myHypothesis = myStudyContext._mesHypotheses[nomHypothesis]; - ASSERT(!CORBA::is_nil(myHypothesis)); - return HOMARD::HOMARD_Hypothesis::_duplicate(myHypothesis); -} -//============================================================================= -HOMARD::HOMARD_Iteration_ptr HOMARD_Gen_i::GetIteration(const char* NomIterationation) -{ - HOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[NomIterationation]; - ASSERT(!CORBA::is_nil(myIteration)); - return HOMARD::HOMARD_Iteration::_duplicate(myIteration); -} -//============================================================================= -HOMARD::HOMARD_YACS_ptr HOMARD_Gen_i::GetYACS(const char* nomYACS) -{ - HOMARD::HOMARD_YACS_var myYACS = myStudyContext._mesYACSs[nomYACS]; - ASSERT(!CORBA::is_nil(myYACS)); - return HOMARD::HOMARD_YACS::_duplicate(myYACS); -} -//============================================================================= -HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::GetZone(const char* ZoneName) -{ - HOMARD::HOMARD_Zone_var myZone = myStudyContext._mesZones[ZoneName]; - ASSERT(!CORBA::is_nil(myZone)); - return HOMARD::HOMARD_Zone::_duplicate(myZone); -} -//============================================================================= -//============================================================================= - -//============================================================================= -//============================================================================= -// Informations -//============================================================================= -//============================================================================= -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 ); - IsValidStudy () ; - -// Creation du cas - int option = 1 ; - if ( _PublisMeshIN != 0 ) option = 2 ; - HOMARD::HOMARD_Cas_ptr myCase = CreateCase0(nomCas, MeshName, MeshFile, 1, 0, option) ; - myCase->SetDirName(DirName) ; -// Analyse - myCase->MeshInfo(Qual, Diam, Conn, Tail, Inte) ; - - return ; -} -//============================================================================= -//============================================================================= - -//============================================================================= -//============================================================================= -// Recuperation des structures par le contexte -//============================================================================= -//============================================================================= -HOMARD::HOMARD_Iteration_ptr HOMARD_Gen_i::LastIteration(const char* nomCas) -{ - HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; - ASSERT(!CORBA::is_nil(myCase)); -// - HOMARD::HOMARD_Iteration_var myIteration = myCase->LastIteration(); - ASSERT(!CORBA::is_nil(myIteration)); -// - return HOMARD::HOMARD_Iteration::_duplicate(myIteration); -} -//============================================================================= -//============================================================================= - -//============================================================================= -//============================================================================= -// Nouvelles structures -//============================================================================= -//============================================================================= -HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::newCase() -{ - HOMARD::HOMARD_Gen_var engine = POA_HOMARD::HOMARD_Gen::_this(); - HOMARD_Cas_i* aServant = new HOMARD_Cas_i(_orb, engine); - HOMARD::HOMARD_Cas_var aCase = HOMARD::HOMARD_Cas::_narrow(aServant->_this()); - return aCase._retn(); -} -//============================================================================= -HOMARD::HOMARD_Hypothesis_ptr HOMARD_Gen_i::newHypothesis() -{ - HOMARD::HOMARD_Gen_var engine = POA_HOMARD::HOMARD_Gen::_this(); - HOMARD_Hypothesis_i* aServant = new HOMARD_Hypothesis_i(_orb, engine); - HOMARD::HOMARD_Hypothesis_var aHypo = HOMARD::HOMARD_Hypothesis::_narrow(aServant->_this()); - return aHypo._retn(); -} -//============================================================================= -HOMARD::HOMARD_Iteration_ptr HOMARD_Gen_i::newIteration() -{ - HOMARD::HOMARD_Gen_var engine = POA_HOMARD::HOMARD_Gen::_this(); - HOMARD_Iteration_i* aServant = new HOMARD_Iteration_i(_orb, engine); - HOMARD::HOMARD_Iteration_var aIter = HOMARD::HOMARD_Iteration::_narrow(aServant->_this()); - return aIter._retn(); -} -//============================================================================= -HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::newBoundary() -{ - HOMARD::HOMARD_Gen_var engine = POA_HOMARD::HOMARD_Gen::_this(); - HOMARD_Boundary_i* aServant = new HOMARD_Boundary_i(_orb, engine); - HOMARD::HOMARD_Boundary_var aBoundary = HOMARD::HOMARD_Boundary::_narrow(aServant->_this()); - return aBoundary._retn(); -} -//============================================================================= -HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::newZone() -{ - HOMARD::HOMARD_Gen_var engine = POA_HOMARD::HOMARD_Gen::_this(); - HOMARD_Zone_i* aServant = new HOMARD_Zone_i(_orb, engine); - HOMARD::HOMARD_Zone_var aZone = HOMARD::HOMARD_Zone::_narrow(aServant->_this()); - return aZone._retn(); -} -//============================================================================= -HOMARD::HOMARD_YACS_ptr HOMARD_Gen_i::newYACS() -{ - HOMARD::HOMARD_Gen_var engine = POA_HOMARD::HOMARD_Gen::_this(); - HOMARD_YACS_i* aServant = new HOMARD_YACS_i(_orb, engine); - HOMARD::HOMARD_YACS_var aYACS = HOMARD::HOMARD_YACS::_narrow(aServant->_this()); - return aYACS._retn(); -} -//============================================================================= -//============================================================================= - -//============================================================================= -//============================================================================= -// Creation des structures identifiees par leurs noms -//============================================================================= -//============================================================================= -HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCase(const char* nomCas, const char* MeshName, const char* MeshFile) -// -// Creation d'un cas initial -// nomCas : nom du cas a creer -// MeshName, MeshFile : nom et fichier du maillage correspondant -// -{ - INFOS ( "CreateCase : nomCas = " << nomCas << ", MeshName = " << MeshName << ", MeshFile = " << MeshFile ); - - int option = 1 ; - if ( _PublisMeshIN != 0 ) option = 2 ; - HOMARD::HOMARD_Cas_ptr myCase = CreateCase0(nomCas, MeshName, MeshFile, 0, 0, option) ; - -// Valeurs par defaut des filtrages - myCase->SetPyram(0); - - return HOMARD::HOMARD_Cas::_duplicate(myCase); -} -//============================================================================= -HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromIteration(const char* nomCas, const char* DirNameStart) -// -// nomCas : nom du cas a creer -// DirNameStart : nom du répertoire contenant l'iteration de reprise -// -{ - INFOS ( "CreateCaseFromIteration : nomCas = " << nomCas << ", DirNameStart = " << DirNameStart ); - std::string nomDirWork = getenv("PWD") ; - int codret ; - - // A. Decodage du point de reprise - // A.1. Controle du répertoire de depart de l'iteration - codret = CHDIR(DirNameStart) ; - if ( codret != 0 ) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "The directory of the iteration does not exist."; - throw SALOME::SALOME_Exception(es); - return 0; - }; - // A.2. Reperage des fichiers du répertoire de reprise - std::string file_configuration = "" ; - std::string file_maillage_homard = "" ; - int bilan ; -#ifndef WIN32 - DIR *dp; - struct dirent *dirp; - dp = opendir(DirNameStart); - while ( (dirp = readdir(dp)) != NULL ) - { - std::string file_name(dirp->d_name); -// MESSAGE ( file_name ); - bilan = file_name.find("HOMARD.Configuration.") ; - if ( bilan != string::npos ) { file_configuration = file_name ; } - bilan = file_name.find("maill.") ; - if ( bilan != string::npos ) - { - bilan = file_name.find(".hom.med") ; - if ( bilan != string::npos ) { file_maillage_homard = file_name ; } - } - } - closedir(dp); -#else - HANDLE hFind = INVALID_HANDLE_VALUE; - WIN32_FIND_DATA ffd; - hFind = FindFirstFile(DirNameStart, &ffd); - if (INVALID_HANDLE_VALUE != hFind) { - while (FindNextFile(hFind, &ffd) != 0) { - if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories - std::string file_name(ffd.cFileName); - bilan = file_name.find("HOMARD.Configuration.") ; - if ( bilan != string::npos ) { file_configuration = file_name ; } - bilan = file_name.find("maill.") ; - if ( bilan != string::npos ) - { - bilan = file_name.find(".hom.med") ; - if ( bilan != string::npos ) { file_maillage_homard = file_name ; } - } - } - FindClose(hFind); - } -#endif - MESSAGE ( "==> file_configuration : " << file_configuration ) ; - MESSAGE ( "==> file_maillage_homard : " << file_maillage_homard ) ; - // A.3. Controle - if ( ( file_configuration == "" ) || ( file_maillage_homard == "" ) ) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - std::string text ; - if ( file_configuration == "" ) { text = "The configuration file cannot be found." ; } - else { text = "The HOMARD mesh file cannot be found." ; } - es.text = CORBA::string_dup(text.c_str()); - throw SALOME::SALOME_Exception(es); - } - - // B. Lecture du fichier de configuration - // ATTENTION : on doit veiller a la coherence entre HomardDriver et CreateCaseFromIteration - int NumeIter ; - int TypeExt = 0 ; - int TypeConf = 0 ; - int Pyram = 0 ; - char* MeshName ; - 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 - { - 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 - while ( std::getline( fichier, ligne ) ) - { - // B.1. Pour la ligne courante, on identifie le premier mot : le mot-cle - std::istringstream ligne_bis(ligne); // variable contenant chaque ligne sous forme de flux - ligne_bis >> mot_cle ; - // B.2. Des valeurs entieres : le second bloc de la ligne - if ( mot_cle == "NumeIter" ) - { - ligne_bis >> NumeIter ; - NumeIter += 1 ; - } - // B.3. Des valeurs caracteres brutes : le second bloc de la ligne est la valeur - else if ( ( mot_cle == "TypeConf" ) || ( mot_cle == "TypeElem" ) ) - { - ligne_bis >> argument ; - - if ( mot_cle == "TypeConf" ) - { - if ( argument == "conforme" ) { TypeConf = 1 ; } - else if ( argument == "non_conforme_1_noeud" ) { TypeConf = 2 ; } - else if ( argument == "non_conforme_1_arete" ) { TypeConf = 3 ; } - else if ( argument == "non_conforme_indicateur" ) { TypeConf = 4 ; } - } - else if ( mot_cle == "TypeElem" ) - { - if ( argument == "ignore_pyra" ) { Pyram = 1 ; } - else if ( argument == "HOMARD" ) { Pyram = 0 ; } - } - } - // B.4. Des valeurs caracteres : le deuxieme bloc de la ligne peut etre encadre par des quotes : - // il faut les supprimer - else if ( ( mot_cle == "CCNoMNP1" ) || ( mot_cle == "CCMaiNP1" ) ) - { - ligne_bis >> argument ; - if ( argument[0] == '"' ) { decalage = 1 ; } - else { decalage = 0 ; } - size_t size = argument.size() + 1 - 2*decalage ; - - if ( mot_cle == "CCNoMNP1" ) - { - MeshName = new char[ size ]; - strncpy( MeshName, argument.c_str()+decalage, size ); - MeshName[size-1] = '\0' ; - } - else if ( mot_cle == "CCMaiNP1" ) - { - MeshFile = new char[ size ]; - strncpy( MeshFile, argument.c_str()+decalage, size ); - MeshFile[size-1] = '\0' ; - } - } - } - MESSAGE ( "==> TypeConf : " << TypeConf ) ; - MESSAGE ( "==> MeshName : " << MeshName ) ; - MESSAGE ( "==> MeshFile : " << MeshFile ) ; - MESSAGE ( "==> NumeIter : " << NumeIter ) ; - MESSAGE ( "==> Pyram : " << Pyram ) ; - } - else - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - std::string text = "The configuration file cannot be read." ; - es.text = CORBA::string_dup(text.c_str()); - throw SALOME::SALOME_Exception(es); - } - - // C. Creation effective du cas - - int option = 1 ; - if ( _PublisMeshIN != 0 ) option = 2 ; - HOMARD::HOMARD_Cas_ptr myCase = CreateCase0(nomCas, MeshName, MeshFile, 1, NumeIter, option) ; - - // D. Parametrages lus dans le fichier de configuration - - myCase->SetConfType (TypeConf) ; - myCase->SetExtType (TypeExt) ; - myCase->SetPyram (Pyram) ; - - // E. Copie du fichier de maillage homard - // E.1. Répertoire associe au cas - char* nomDirCase = myCase->GetDirName() ; - // E.2. Répertoire associe a l'iteration de ce cas - char* IterName ; - IterName = myCase->GetIter0Name() ; - HOMARD::HOMARD_Iteration_var Iter = GetIteration(IterName) ; - char* nomDirIter = CreateDirNameIter(nomDirCase, 0 ); - Iter->SetDirNameLoc(nomDirIter); - std::string nomDirIterTotal ; - nomDirIterTotal = std::string(nomDirCase) + "/" + std::string(nomDirIter) ; -#ifndef WIN32 - if (mkdir(nomDirIterTotal.c_str(), S_IRWXU|S_IRGRP|S_IXGRP) != 0) -#else - if (_mkdir(nomDirIterTotal.c_str()) != 0) -#endif - { - MESSAGE ( "nomDirIterTotal : " << nomDirIterTotal ) ; - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - std::string text = "The directory for the computation cannot be created." ; - es.text = CORBA::string_dup(text.c_str()); - throw SALOME::SALOME_Exception(es); - } - // E.3. Copie du maillage HOMARD au format MED - codret = CHDIR(DirNameStart) ; - std::string commande = "cp " + file_maillage_homard + " " + nomDirIterTotal ; - MESSAGE ( "commande : " << commande ) ; - codret = system(commande.c_str()) ; - MESSAGE ( "codret : " << codret ) ; - if ( codret != 0 ) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "The starting point for the case cannot be copied into the working directory."; - throw SALOME::SALOME_Exception(es); - return 0; - }; - - // F. Menage - - delete[] MeshName ; - delete[] MeshFile ; - - CHDIR(nomDirWork.c_str()); - return HOMARD::HOMARD_Cas::_duplicate(myCase); -} -//============================================================================= -HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromCaseLastIteration(const char* nomCas, const char* DirNameStart) -// -// nomCas : nom du cas a creer -// DirNameStart : nom du répertoire du cas contenant l'iteration de reprise -// -{ - INFOS ( "CreateCaseFromCaseLastIteration : nomCas = " << nomCas << ", DirNameStart = " << DirNameStart ); - - std::string DirNameStartIter = CreateCase1(DirNameStart, -1) ; - - DirNameStartIter = string(DirNameStart) + "/" + DirNameStartIter ; - HOMARD::HOMARD_Cas_ptr myCase = CreateCaseFromIteration(nomCas, DirNameStartIter.c_str()) ; - - return HOMARD::HOMARD_Cas::_duplicate(myCase); -} -//============================================================================= -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 répertoire du cas contenant l'iteration de reprise -// Number : numero de l'iteration de depart -// -{ - INFOS ( "CreateCaseFromCaseIteration : nomCas = " << nomCas << ", DirNameStart = " << DirNameStart << ", Number = " << Number ); - if ( Number < 0 ) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "The number of iteration must be positive."; - throw SALOME::SALOME_Exception(es); - return 0; - }; - - std::string DirNameStartIter = CreateCase1(DirNameStart, Number) ; - - DirNameStartIter = string(DirNameStart) + "/" + DirNameStartIter ; - HOMARD::HOMARD_Cas_ptr myCase = CreateCaseFromIteration(nomCas, DirNameStartIter.c_str()) ; - - return HOMARD::HOMARD_Cas::_duplicate(myCase); -} -//============================================================================= -std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Number) -// -// 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 -// -{ - MESSAGE ( "CreateCase1 : DirNameStart = " << DirNameStart << ", Number = " << Number ); - std::string nomDirWork = getenv("PWD") ; - std::string DirNameStartIter ; - int codret ; - int NumeIterMax = -1 ; - - // A.1. Controle du répertoire de depart du cas - codret = CHDIR(DirNameStart) ; - if ( codret != 0 ) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "The directory of the case for the pursuit does not exist."; - throw SALOME::SALOME_Exception(es); - return 0; - }; - // A.2. Reperage des sous-répertoire du répertoire de reprise - bool existe = false ; -#ifndef WIN32 - DIR *dp; - struct dirent *dirp; - dp = opendir(DirNameStart); - while ( (dirp = readdir(dp)) != NULL ) { - std::string DirName_1(dirp->d_name); -#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 DirName_1 = ""; - if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { - DirName_1 = std::string(ffd.cFileName); - } -#endif - if ( ( DirName_1 != "." ) && ( DirName_1 != ".." ) ) - { - if ( CHDIR(DirName_1.c_str()) == 0 ) - { -// On cherche le fichier de configuration dans ce sous-répertoire - codret = CHDIR(DirNameStart); -#ifndef WIN32 - DIR *dp_1; - struct dirent *dirp_1; - dp_1 = opendir(DirName_1.c_str()) ; - while ( (dirp_1 = readdir(dp_1)) != NULL ) - { - std::string file_name_1(dirp_1->d_name); -#else - HANDLE hFind1 = INVALID_HANDLE_VALUE; - WIN32_FIND_DATA ffd1; - hFind1 = FindFirstFile(DirName_1.c_str(), &ffd1); - while (FindNextFile(hFind1, &ffd1) != 0) - { - if (ffd1.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories - std::string file_name_1(ffd1.cFileName); -#endif - int bilan = file_name_1.find("HOMARD.Configuration.") ; - if ( bilan != string::npos ) - { - // Decodage du fichier pour trouver le numero d'iteration - 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 - { - 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 - while ( std::getline( fichier, ligne ) ) - { - // B.1. Pour la ligne courante, on identifie le premier mot : le mot-cle - std::istringstream ligne_bis(ligne); // variable contenant chaque ligne sous forme de flux - ligne_bis >> mot_cle ; - if ( mot_cle == "NumeIter" ) - { - ligne_bis >> NumeIter ; - NumeIter += 1 ; -// MESSAGE ( "==> NumeIter : " << NumeIter ) ; - if ( Number == - 1 ) - { - if ( NumeIter >= NumeIterMax ) - { - NumeIterMax = NumeIter ; - DirNameStartIter = DirName_1 ; - } - } - else - { - if ( NumeIter == Number ) - { - DirNameStartIter = DirName_1 ; - existe = true ; - break ; - } - } - } - } - } - else - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - std::string text = "The configuration file cannot be read." ; - es.text = CORBA::string_dup(text.c_str()); - throw SALOME::SALOME_Exception(es); - } - CHDIR(DirNameStart) ; - } - if ( existe ) { break ; } - } -#ifndef WIN32 - closedir(dp_1); -#else - FindClose(hFind1); -#endif - if ( existe ) { break ; } - } - } - } -#ifndef WIN32 - closedir(dp); -#else - FindClose(hFind); -#endif - CHDIR(nomDirWork.c_str()); - - if ( ( Number >= 0 && ( !existe ) ) || ( Number < 0 && ( NumeIterMax == -1 ) ) ) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "The directory of the iteration does not exist."; - throw SALOME::SALOME_Exception(es); - return 0; - }; - - return DirNameStartIter ; -} -//============================================================================= -HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCase0(const char* nomCas, const char* MeshName, const char* MeshFile, CORBA::Long MeshOption, CORBA::Long NumeIter, CORBA::Long Option) -// -// nomCas : nom du cas a creer -// MeshName, MeshFile : nom et fichier du maillage correspondant -// MeshOption : 0 : le maillage fourni est obligatoirement present ==> erreur si absent -// 1 : le maillage fourni peut ne pas exister ==> on continue si absent -// -1 : le maillage n'est pas fourni -// NumeIter : numero de l'iteration correspondante : 0, pour un depart, n>0 pour une poursuite -// Option : multiple de nombres premiers -// 1 : aucune option -// x2 : publication du maillage dans SMESH -{ - MESSAGE ( "CreateCase0 : nomCas = " << nomCas ); - MESSAGE ( "CreateCase0 : MeshName = " << MeshName << ", MeshFile = " << MeshFile << ", MeshOption = " << MeshOption ); - MESSAGE ( "CreateCase0 : NumeIter = " << NumeIter << ", Option = " << Option ); -// - // A. Controles - // A.1. L'etude - IsValidStudy () ; - - // A.2. Controle du nom : - if ((myStudyContext._mesCas).find(nomCas)!=(myStudyContext._mesCas).end()) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "This case has already been defined."; - throw SALOME::SALOME_Exception(es); - return 0; - }; - - // A.3. Controle du fichier du maillage - int existeMeshFile ; - if ( MeshOption >= 0 ) - { - existeMeshFile = MEDFileExist ( MeshFile ) ; - MESSAGE ( "CreateCase0 : existeMeshFile = " << existeMeshFile ); - if ( ( existeMeshFile == 0 ) && ( MeshOption == 0 ) ) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "The mesh file does not exist."; - throw SALOME::SALOME_Exception(es); - return 0; - } - } - else { existeMeshFile = 0 ; } - - // B. Creation de l'objet cas et publication -// MESSAGE ( "CreateCase0 : Creation de l'objet" ); - HOMARD::HOMARD_Cas_var myCase = newCase(); - myCase->SetName(nomCas); - SALOMEDS::SObject_var aSO; - SALOMEDS::SObject_var aResultSO=PublishInStudy(aSO, myCase, nomCas); - myStudyContext._mesCas[nomCas] = myCase; - - // C. Caracteristiques du maillage - if ( existeMeshFile != 0 ) - { - // 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; } - aSeq->length(10) ; - for (int i =0 ; i< LesExtremes.size() ; i++) - aSeq[i]=LesExtremes[i] ; - myCase->SetBoundingBox(aSeq) ; - // Les groupes -// MESSAGE ( "CreateCase0 : Les groupes" ); - std::set LesGroupes =GetListeGroupesInMedFile(MeshFile) ; - HOMARD::ListGroupType_var aSeqGroupe = new HOMARD::ListGroupType ; - aSeqGroupe->length(LesGroupes.size()); - std::set::const_iterator it ; - int i = 0 ; - for (it=LesGroupes.begin() ; it != LesGroupes.end() ; it++) - aSeqGroupe[i++]=(*it).c_str() ; - myCase->SetGroups(aSeqGroupe) ; - } - - // D. L'iteration initiale du cas - MESSAGE ( "CreateCase0 : iteration initiale du cas" ); - // D.1. Recherche d'un nom : par defaut, on prend le nom du maillage correspondant. - // Si ce nom d'iteration existe deja, on incremente avec 0, 1, 2, etc. - int monNum = 0; - std::string NomIteration = std::string(MeshName) ; - while ( (myStudyContext._mesIterations).find(NomIteration) != (myStudyContext._mesIterations.end()) ) - { - std::ostringstream nom; - nom << MeshName << monNum; - NomIteration = nom.str(); - monNum += 1; - } - MESSAGE ( "CreateCas0 : ==> NomIteration = " << NomIteration ); - - // D.2. Creation de l'iteration - HOMARD::HOMARD_Iteration_var anIter = newIteration(); - myStudyContext._mesIterations[NomIteration] = anIter; - anIter->SetName(NomIteration.c_str()); - AssociateCaseIter (nomCas, NomIteration.c_str(), "IterationHomard"); - - // D.4. Maillage correspondant - if ( existeMeshFile != 0 ) - { - anIter->SetMeshFile(MeshFile); - if ( Option % 2 == 0 ) { PublishResultInSmesh(MeshFile, 0); } - } - anIter->SetMeshName(MeshName); - - // D.5. Numero d'iteration - anIter->SetNumber(NumeIter); - - // D.6. Etat - SetEtatIter(NomIteration.c_str(), -NumeIter); -// - - return HOMARD::HOMARD_Cas::_duplicate(myCase); -} -//============================================================================= -HOMARD::HOMARD_Hypothesis_ptr HOMARD_Gen_i::CreateHypothesis(const char* nomHypothesis) -{ - INFOS ( "CreateHypothesis : nomHypothesis = " << nomHypothesis ); - IsValidStudy () ; - - // A. Controle du nom : - if ((myStudyContext._mesHypotheses).find(nomHypothesis) != (myStudyContext._mesHypotheses).end()) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "This hypothesis has already been defined."; - throw SALOME::SALOME_Exception(es); - return 0; - } - - // B. Creation de l'objet - HOMARD::HOMARD_Hypothesis_var myHypothesis = newHypothesis(); - if (CORBA::is_nil(myHypothesis)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Unable to create the hypothesis"; - throw SALOME::SALOME_Exception(es); - return 0; - }; - myHypothesis->SetName(nomHypothesis); - - // C. Enregistrement - myStudyContext._mesHypotheses[nomHypothesis] = myHypothesis; - - SALOMEDS::SObject_var aSO; - SALOMEDS::SObject_var aResultSO=PublishInStudy(aSO, myHypothesis, nomHypothesis); - - // D. Valeurs par defaut des options avancees - myHypothesis->SetNivMax(-1); - myHypothesis->SetDiamMin(-1.0); - myHypothesis->SetAdapInit(0); - myHypothesis->SetExtraOutput(1); - - return HOMARD::HOMARD_Hypothesis::_duplicate(myHypothesis); -} - -//============================================================================= -HOMARD::HOMARD_Iteration_ptr HOMARD_Gen_i::CreateIteration(const char* NomIteration, const char* nomIterParent) -//============================================================================= -{ - INFOS ("CreateIteration : NomIteration = " << NomIteration << ", nomIterParent = " << nomIterParent); - IsValidStudy () ; - - HOMARD::HOMARD_Iteration_var myIterationParent = myStudyContext._mesIterations[nomIterParent]; - if (CORBA::is_nil(myIterationParent)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "The parent iteration is not defined."; - throw SALOME::SALOME_Exception(es); - return 0; - }; - - const char* nomCas = myIterationParent->GetCaseName(); - MESSAGE ("CreateIteration : nomCas = " << nomCas); - HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; - if (CORBA::is_nil(myCase)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid case context"; - throw SALOME::SALOME_Exception(es); - return 0; - }; - const char* nomDirCase = myCase->GetDirName(); - - // Controle du nom : - if ((myStudyContext._mesIterations).find(NomIteration)!=(myStudyContext._mesIterations).end()) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "This iteration has already been defined."; - throw SALOME::SALOME_Exception(es); - return 0; - }; - - HOMARD::HOMARD_Iteration_var myIteration = newIteration(); - if (CORBA::is_nil(myIteration)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Unable to create the iteration"; - throw SALOME::SALOME_Exception(es); - return 0; - }; - myStudyContext._mesIterations[std::string(NomIteration)] = myIteration; -// Nom de l'iteration et du maillage - myIteration->SetName(NomIteration); - myIteration->SetMeshName(NomIteration); - myIteration->SetState(1); - - int numero = myIterationParent->GetNumber() + 1; - myIteration->SetNumber(numero); - -// Nombre d'iterations deja connues pour le cas, permettant -// la creation d'un sous-répertoire unique - int nbitercase = myCase->GetNumberofIter(); - char* nomDirIter = CreateDirNameIter(nomDirCase, nbitercase ); - myIteration->SetDirNameLoc(nomDirIter); - -// Le nom du fichier du maillage MED est indice par le nombre d'iterations du cas. -// Si on a une chaine unique depuis le depart, ce nombre est le meme que le -// numero d'iteration dans la sucession : maill.01.med, maill.02.med, etc... C'est la -// situation la plus frequente. -// Si on a plusieurs branches, donc des iterations du meme niveau d'adaptation, utiliser -// le nombre d'iterations du cas permet d'eviter les collisions. - int jaux ; - if ( nbitercase < 100 ) { jaux = 2 ; } - else if ( nbitercase < 1000 ) { jaux = 3 ; } - else if ( nbitercase < 10000 ) { jaux = 4 ; } - else if ( nbitercase < 100000 ) { jaux = 5 ; } - else { jaux = 9 ; } - std::ostringstream iaux ; - iaux << std::setw(jaux) << std::setfill('0') << nbitercase ; - std::stringstream MeshFile; - MeshFile << nomDirCase << "/maill." << iaux.str() << ".med"; - myIteration->SetMeshFile(MeshFile.str().c_str()); - -// Association avec le cas - std::string label = "IterationHomard_" + std::string(nomIterParent); - AssociateCaseIter(nomCas, NomIteration, label.c_str()); -// Lien avec l'iteration precedente - myIterationParent->LinkNextIteration(NomIteration); - myIteration->SetIterParentName(nomIterParent); - // Gestion de l'arbre d'etudes - SALOMEDS::SObject_var aIterSOParent = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIterationParent))); - SALOMEDS::SObject_var aIterSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIteration))); - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); - aStudyBuilder->NewCommand(); - SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aIterSO); - aStudyBuilder->Addreference(aSubSO, aIterSOParent); - aStudyBuilder->CommitCommand(); - - return HOMARD::HOMARD_Iteration::_duplicate(myIteration); -} -//============================================================================= -HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundary(const char* BoundaryName, CORBA::Long BoundaryType) -{ - MESSAGE ("CreateBoundary : BoundaryName = " << BoundaryName << ", BoundaryType = " << BoundaryType); - IsValidStudy () ; - - // Controle du nom : - if ((myStudyContext._mesBoundarys).find(BoundaryName)!=(myStudyContext._mesBoundarys).end()) - { - MESSAGE ("CreateBoundary : la frontiere " << BoundaryName << " existe deja"); - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "This boundary has already been defined"; - throw SALOME::SALOME_Exception(es); - return 0; - }; - - HOMARD::HOMARD_Boundary_var myBoundary = newBoundary(); - myBoundary->SetName(BoundaryName); - myBoundary->SetType(BoundaryType); - - myStudyContext._mesBoundarys[BoundaryName] = myBoundary; - - SALOMEDS::SObject_var aSO; - SALOMEDS::SObject_var aResultSO=PublishInStudy(aSO, myBoundary, BoundaryName); - - 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 << ", MeshFile = " << MeshFile ); - HOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 0); - myBoundary->SetDataFile( MeshFile ) ; - myBoundary->SetMeshName( MeshName ) ; - - return HOMARD::HOMARD_Boundary::_duplicate(myBoundary); -} -//============================================================================= -HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryCylinder(const char* BoundaryName, - CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, - CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, - CORBA::Double Rayon) -{ - INFOS ("CreateBoundaryCylinder : BoundaryName = " << BoundaryName ) ; -// - SALOME::ExceptionStruct es; - int error = 0 ; - if ( Rayon <= 0.0 ) - { es.text = "The radius must be positive." ; - error = 1 ; } - double daux = fabs(Xaxe) + fabs(Yaxe) + fabs(Zaxe) ; - if ( daux < 0.0000001 ) - { es.text = "The axis must be a non 0 vector." ; - error = 2 ; } - if ( error != 0 ) - { - es.type = SALOME::BAD_PARAM; - throw SALOME::SALOME_Exception(es); - return 0; - }; -// - HOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 1) ; - myBoundary->SetCylinder( Xcentre, Ycentre, Zcentre, Xaxe, Yaxe, Zaxe, Rayon ) ; - - return HOMARD::HOMARD_Boundary::_duplicate(myBoundary) ; -} -//============================================================================= -HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundarySphere(const char* BoundaryName, - CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, - CORBA::Double Rayon) -{ - INFOS ("CreateBoundarySphere : BoundaryName = " << BoundaryName ) ; -// - SALOME::ExceptionStruct es; - int error = 0 ; - if ( Rayon <= 0.0 ) - { es.text = "The radius must be positive." ; - error = 1 ; } - if ( error != 0 ) - { - es.type = SALOME::BAD_PARAM; - throw SALOME::SALOME_Exception(es); - return 0; - }; -// - HOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 2) ; - myBoundary->SetSphere( Xcentre, Ycentre, Zcentre, Rayon ) ; - - return HOMARD::HOMARD_Boundary::_duplicate(myBoundary) ; -} -//============================================================================= -HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryConeA(const char* BoundaryName, - 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 ) ; -// - SALOME::ExceptionStruct es; - int error = 0 ; - if ( Angle <= 0.0 || Angle >= 90.0 ) - { es.text = "The angle must be included higher than 0 degree and lower than 90 degrees." ; - error = 1 ; } - double daux = fabs(Xaxe) + fabs(Yaxe) + fabs(Zaxe) ; - if ( daux < 0.0000001 ) - { es.text = "The axis must be a non 0 vector." ; - error = 2 ; } - if ( error != 0 ) - { - es.type = SALOME::BAD_PARAM; - throw SALOME::SALOME_Exception(es); - return 0; - }; -// - HOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 3) ; - myBoundary->SetConeA( Xaxe, Yaxe, Zaxe, Angle, Xcentre, Ycentre, Zcentre ) ; - - return HOMARD::HOMARD_Boundary::_duplicate(myBoundary) ; -} -//============================================================================= -HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryConeR(const char* BoundaryName, - 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 ) ; -// - SALOME::ExceptionStruct es; - int error = 0 ; - if ( Rayon1 < 0.0 || Rayon2 < 0.0 ) - { es.text = "The radius must be positive." ; - error = 1 ; } - double daux = fabs(Rayon2-Rayon1) ; - if ( daux < 0.0000001 ) - { es.text = "The radius must be different." ; - error = 2 ; } - daux = fabs(Xcentre2-Xcentre1) + fabs(Ycentre2-Ycentre1) + fabs(Zcentre2-Zcentre1) ; - if ( daux < 0.0000001 ) - { es.text = "The centers must be different." ; - error = 3 ; } - if ( error != 0 ) - { - es.type = SALOME::BAD_PARAM; - throw SALOME::SALOME_Exception(es); - return 0; - }; -// - HOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 4) ; - myBoundary->SetConeR( Xcentre1, Ycentre1, Zcentre1, Rayon1, Xcentre2, Ycentre2, Zcentre2, Rayon2 ) ; - - return HOMARD::HOMARD_Boundary::_duplicate(myBoundary) ; -} -//============================================================================= -HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryTorus(const char* BoundaryName, - CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, - CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, - CORBA::Double RayonRev, CORBA::Double RayonPri) -{ - INFOS ("CreateBoundaryTorus : BoundaryName = " << BoundaryName ) ; -// - SALOME::ExceptionStruct es; - int error = 0 ; - if ( ( RayonRev <= 0.0 ) || ( RayonPri <= 0.0 ) ) - { es.text = "The radius must be positive." ; - error = 1 ; } - double daux = fabs(Xaxe) + fabs(Yaxe) + fabs(Zaxe) ; - if ( daux < 0.0000001 ) - { es.text = "The axis must be a non 0 vector." ; - error = 2 ; } - if ( error != 0 ) - { - es.type = SALOME::BAD_PARAM; - throw SALOME::SALOME_Exception(es); - return 0; - }; -// - HOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 5) ; - myBoundary->SetTorus( Xcentre, Ycentre, Zcentre, Xaxe, Yaxe, Zaxe, RayonRev, RayonPri ) ; - - return HOMARD::HOMARD_Boundary::_duplicate(myBoundary) ; -} -//============================================================================= -HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZone(const char* ZoneName, CORBA::Long ZoneType) -{ - MESSAGE ("CreateZone : ZoneName = " << ZoneName << ", ZoneType = " << ZoneType); - IsValidStudy () ; - - // Controle du nom : - if ((myStudyContext._mesZones).find(ZoneName)!=(myStudyContext._mesZones).end()) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "This zone has already been defined"; - throw SALOME::SALOME_Exception(es); - return 0; - }; - - HOMARD::HOMARD_Zone_var myZone = newZone(); - myZone->SetName(ZoneName); - myZone->SetType(ZoneType); - - myStudyContext._mesZones[ZoneName] = myZone; - - SALOMEDS::SObject_var aSO; - SALOMEDS::SObject_var aResultSO=PublishInStudy(aSO, myZone, ZoneName); - - return HOMARD::HOMARD_Zone::_duplicate(myZone); -} -//============================================================================= -HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZoneBox(const char* ZoneName, - CORBA::Double Xmini, CORBA::Double Xmaxi, - CORBA::Double Ymini, CORBA::Double Ymaxi, - CORBA::Double Zmini, CORBA::Double Zmaxi) -{ - INFOS ("CreateZoneBox : ZoneName = " << ZoneName ) ; -// - SALOME::ExceptionStruct es; - int error = 0 ; - if ( Xmini > Xmaxi ) - { es.text = "The X coordinates are not coherent." ; - error = 1 ; } - if ( Ymini > Ymaxi ) - { es.text = "The Y coordinates are not coherent." ; - error = 2 ; } - if ( Zmini > Zmaxi ) - { es.text = "The Z coordinates are not coherent." ; - error = 3 ; } - if ( error != 0 ) - { - es.type = SALOME::BAD_PARAM; - throw SALOME::SALOME_Exception(es); - return 0; - }; -// - HOMARD::HOMARD_Zone_var myZone = CreateZone(ZoneName, 2) ; - myZone->SetBox ( Xmini, Xmaxi, Ymini, Ymaxi, Zmini, Zmaxi) ; - - return HOMARD::HOMARD_Zone::_duplicate(myZone) ; -} -//============================================================================= -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 ) ; -// - SALOME::ExceptionStruct es; - int error = 0 ; - if ( Rayon <= 0.0 ) - { es.text = "The radius must be positive." ; - error = 1 ; } - if ( error != 0 ) - { - es.type = SALOME::BAD_PARAM; - throw SALOME::SALOME_Exception(es); - return 0; - }; -// - HOMARD::HOMARD_Zone_var myZone = CreateZone(ZoneName, 4) ; - myZone->SetSphere( Xcentre, Ycentre, Zcentre, Rayon ) ; - - return HOMARD::HOMARD_Zone::_duplicate(myZone) ; -} -//============================================================================= -HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZoneCylinder(const char* ZoneName, - CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, - CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, - CORBA::Double Rayon, CORBA::Double Haut) -{ - INFOS ("CreateZoneCylinder : ZoneName = " << ZoneName ) ; -// - SALOME::ExceptionStruct es; - int error = 0 ; - if ( Rayon <= 0.0 ) - { es.text = "The radius must be positive." ; - error = 1 ; } - double daux = fabs(Xaxe) + fabs(Yaxe) + fabs(Zaxe) ; - if ( daux < 0.0000001 ) - { es.text = "The axis must be a non 0 vector." ; - error = 2 ; } - if ( Haut <= 0.0 ) - { es.text = "The height must be positive." ; - error = 3 ; } - if ( error != 0 ) - { - es.type = SALOME::BAD_PARAM; - throw SALOME::SALOME_Exception(es); - return 0; - }; -// - HOMARD::HOMARD_Zone_var myZone = CreateZone(ZoneName, 5) ; - myZone->SetCylinder( Xcentre, Ycentre, Zcentre, Xaxe, Yaxe, Zaxe, Rayon, Haut ) ; - - return HOMARD::HOMARD_Zone::_duplicate(myZone) ; -} -//============================================================================= -HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZonePipe(const char* ZoneName, - CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, - CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, - CORBA::Double Rayon, CORBA::Double Haut, CORBA::Double Rayonint) -{ - INFOS ("CreateZonePipe : ZoneName = " << ZoneName ) ; -// - SALOME::ExceptionStruct es; - int error = 0 ; - if ( Rayon <= 0.0 || Rayonint <= 0.0 ) - { es.text = "The radius must be positive." ; - error = 1 ; } - double daux = fabs(Xaxe) + fabs(Yaxe) + fabs(Zaxe) ; - if ( daux < 0.0000001 ) - { es.text = "The axis must be a non 0 vector." ; - error = 2 ; } - if ( Haut <= 0.0 ) - { es.text = "The height must be positive." ; - error = 3 ; } - if ( Rayon <= Rayonint ) - { es.text = "The external radius must be higher than the internal radius." ; - error = 4 ; } - if ( error != 0 ) - { - es.type = SALOME::BAD_PARAM; - throw SALOME::SALOME_Exception(es); - return 0; - }; -// - HOMARD::HOMARD_Zone_var myZone = CreateZone(ZoneName, 7) ; - myZone->SetPipe( Xcentre, Ycentre, Zcentre, Xaxe, Yaxe, Zaxe, Rayon, Haut, Rayonint ) ; - - return HOMARD::HOMARD_Zone::_duplicate(myZone) ; -} -//============================================================================= -HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZoneBox2D(const char* ZoneName, - CORBA::Double Umini, CORBA::Double Umaxi, - CORBA::Double Vmini, CORBA::Double Vmaxi, - CORBA::Long Orient) -{ - INFOS ("CreateZoneBox2D : ZoneName = " << ZoneName ) ; -// MESSAGE ("Umini = " << Umini << ", Umaxi =" << Umaxi ) ; -// MESSAGE ("Vmini = " << Vmini << ", Vmaxi =" << Vmaxi ) ; -// MESSAGE ("Orient = " << Orient ) ; -// - SALOME::ExceptionStruct es; - int error = 0 ; - if ( Umini > Umaxi ) - { es.text = "The first coordinates are not coherent." ; - error = 1 ; } - if ( Vmini > Vmaxi ) - { es.text = "The second coordinates are not coherent." ; - error = 2 ; } - if ( Orient < 1 || Orient > 3 ) - { es.text = "The orientation must be 1, 2 or 3." ; - error = 3 ; } - if ( error != 0 ) - { - es.type = SALOME::BAD_PARAM; - throw SALOME::SALOME_Exception(es); - return 0; - }; -// - double Xmini, Xmaxi ; - double Ymini, Ymaxi ; - double Zmini, Zmaxi ; - if ( Orient == 1 ) - { Xmini = Umini ; - Xmaxi = Umaxi ; - Ymini = Vmini ; - Ymaxi = Vmaxi ; - Zmini = 0. ; - Zmaxi = 0. ; } - else if ( Orient == 2 ) - { Xmini = 0. ; - Xmaxi = 0. ; - Ymini = Umini ; - Ymaxi = Umaxi ; - Zmini = Vmini ; - Zmaxi = Vmaxi ; } - else if ( Orient == 3 ) - { Xmini = Vmini ; - Xmaxi = Vmaxi ; - Ymini = 0. ; - Ymaxi = 0. ; - Zmini = Umini ; - Zmaxi = Umaxi ; } - else { VERIFICATION( (Orient>=1) && (Orient<=3) ) ; } - - HOMARD::HOMARD_Zone_var myZone = CreateZone(ZoneName, 10+Orient) ; - myZone->SetBox ( Xmini, Xmaxi, Ymini, Ymaxi, Zmini, Zmaxi) ; - - return HOMARD::HOMARD_Zone::_duplicate(myZone) ; -} -//============================================================================= -HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZoneDisk(const char* ZoneName, - CORBA::Double Ucentre, CORBA::Double Vcentre, - CORBA::Double Rayon, - CORBA::Long Orient) -{ - INFOS ("CreateZoneDisk : ZoneName = " << ZoneName ) ; -// - SALOME::ExceptionStruct es; - int error = 0 ; - if ( Rayon <= 0.0 ) - { es.text = "The radius must be positive." ; - error = 1 ; } - if ( Orient < 1 || Orient > 3 ) - { es.text = "The orientation must be 1, 2 or 3." ; - error = 3 ; } - if ( error != 0 ) - { - es.type = SALOME::BAD_PARAM; - throw SALOME::SALOME_Exception(es); - return 0; - }; -// - double Xcentre ; - double Ycentre ; - double Zcentre ; - if ( Orient == 1 ) - { Xcentre = Ucentre ; - Ycentre = Vcentre ; - Zcentre = 0. ; } - else if ( Orient == 2 ) - { Xcentre = 0. ; - Ycentre = Ucentre ; - Zcentre = Vcentre ; } - else if ( Orient == 3 ) - { Xcentre = Vcentre ; - Ycentre = 0. ; - Zcentre = Ucentre ; } - else { VERIFICATION( (Orient>=1) && (Orient<=3) ) ; } - - HOMARD::HOMARD_Zone_var myZone = CreateZone(ZoneName, 30+Orient) ; - myZone->SetCylinder( Xcentre, Ycentre, Zcentre, 0., 0., 1., Rayon, 1. ) ; - - return HOMARD::HOMARD_Zone::_duplicate(myZone) ; -} -//============================================================================= -HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZoneDiskWithHole(const char* ZoneName, - CORBA::Double Ucentre, CORBA::Double Vcentre, - CORBA::Double Rayon, CORBA::Double Rayonint, - CORBA::Long Orient) -{ - INFOS ("CreateZoneDiskWithHole : ZoneName = " << ZoneName ) ; -// - SALOME::ExceptionStruct es; - int error = 0 ; - if ( Rayon <= 0.0 || Rayonint <= 0.0 ) - { es.text = "The radius must be positive." ; - error = 1 ; } - if ( Orient < 1 || Orient > 3 ) - { es.text = "The orientation must be 1, 2 or 3." ; - error = 3 ; } - if ( Rayon <= Rayonint ) - { es.text = "The external radius must be higher than the internal radius." ; - error = 4 ; } - if ( error != 0 ) - { - es.type = SALOME::BAD_PARAM; - throw SALOME::SALOME_Exception(es); - return 0; - }; -// - double Xcentre ; - double Ycentre ; - double Zcentre ; - if ( Orient == 1 ) - { Xcentre = Ucentre ; - Ycentre = Vcentre ; - Zcentre = 0. ; } - else if ( Orient == 2 ) - { Xcentre = 0. ; - Ycentre = Ucentre ; - Zcentre = Vcentre ; } - else if ( Orient == 3 ) - { Xcentre = Vcentre ; - Ycentre = 0. ; - Zcentre = Ucentre ; } - else { VERIFICATION( (Orient>=1) && (Orient<=3) ) ; } - - HOMARD::HOMARD_Zone_var myZone = CreateZone(ZoneName, 60+Orient) ; - myZone->SetPipe( Xcentre, Ycentre, Zcentre, 0., 0., 1., Rayon, 1., Rayonint ) ; - - return HOMARD::HOMARD_Zone::_duplicate(myZone) ; -} -//============================================================================= -//============================================================================= - - - - -//============================================================================= -//============================================================================= -// Traitement d'une iteration -// etatMenage = 1 : destruction du répertoire d'execution -// modeHOMARD = 1 : adaptation -// != 1 : information avec les options modeHOMARD -// 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::Compute(const char* NomIteration, CORBA::Long etatMenage, CORBA::Long modeHOMARD, CORBA::Long Option1, CORBA::Long Option2) -{ - INFOS ( "Compute : traitement de " << NomIteration << ", avec modeHOMARD = " << modeHOMARD << ", Option1 = " << Option1 << ", Option2 = " << Option2 ); - - // A. Prealable - int codret = 0; - - // A.1. L'objet iteration - HOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[NomIteration]; - ASSERT(!CORBA::is_nil(myIteration)); - - // A.2. Controle de la possibilite d'agir - // A.2.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 ; } - - std::string siter ; - if ( modeHOMARD==1 ) - { - std::stringstream saux0 ; - int iaux = max(0, NumeIter-1) ; - saux0 << iaux ; - siter = saux0.str() ; - if (NumeIter < 11) { siter = "0" + siter ; } - } - else - { siter = siterp1 ; } - - // A.4. Le cas - const char* nomCas = myIteration->GetCaseName(); - HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; - ASSERT(!CORBA::is_nil(myCase)); - - // B. Les répertoires - // B.1. Le répertoire courant - std::string nomDirWork = getenv("PWD") ; - // B.2. Le sous-répertoire de l'iteration a traiter - char* DirCompute = ComputeDirManagement(myCase, myIteration, etatMenage); - MESSAGE( ". DirCompute = " << DirCompute ); - - // C. Le fichier des messages - // C.1. Le deroulement de l'execution de HOMARD - std::string LogFile = DirCompute ; - LogFile += "/Liste" ; - if ( modeHOMARD == 1 ) { LogFile += "." + siter + ".vers." + siterp1 ; } - LogFile += ".log" ; - MESSAGE (". LogFile = " << LogFile); - if ( modeHOMARD == 1 ) { myIteration->SetLogFile(LogFile.c_str()); } - // C.2. Le bilan de l'analyse du maillage - std::string FileInfo = DirCompute ; - FileInfo += "/" ; - if ( modeHOMARD == 1 ) { FileInfo += "apad" ; } - else - { if ( NumeIter == 0 ) { FileInfo += "info_av" ; } - else { FileInfo += "info_ap" ; } - } - FileInfo += "." + siterp1 + ".bilan" ; - myIteration->SetFileInfo(FileInfo.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(siter, 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 ; - if ( modeHOMARD == 1 ) - { - iaux = 1 ; - myDriver->TexteMaillageHOMARD( DirCompute, siterp1, iaux ) ; - myDriver->TexteMaillage(NomMesh, MeshFile, 1); - codret = ComputeAdap(myCase, myIteration, etatMenage, myDriver, Option1, Option2) ; - } - else - { - InvalideIterInfo(NomIteration); - myDriver->TexteInfo( modeHOMARD, NumeIter ) ; - iaux = 0 ; - myDriver->TexteMaillageHOMARD( DirCompute, siterp1, iaux ) ; - myDriver->TexteMaillage(NomMesh, MeshFile, 0); - myDriver->CreeFichierDonn(); - } - - // E.4. Ajout des informations liees a l'eventuel suivi de frontiere - int BoundaryOption = DriverTexteBoundary(myCase, myDriver) ; - - // E.5. Ecriture du texte dans le fichier - MESSAGE ( ". Ecriture du texte dans le fichier de configuration ; codret = "<CreeFichier(); } - -// G. Execution -// - int codretexec = 1789 ; - if (codret == 0) - { - codretexec = myDriver->ExecuteHomard(Option1); -// - MESSAGE ( "Erreur en executant HOMARD : " << codretexec ); - // En mode adaptation, on ajuste l'etat de l'iteration - if ( modeHOMARD == 1 ) - { - if (codretexec == 0) { SetEtatIter(NomIteration,2); } - else { SetEtatIter(NomIteration,1); } - // GERALD -- QMESSAGE BOX - } - } - - // H. Gestion des resultats - if (codret == 0) - { - std::string Commentaire ; - // H.1. Le fichier des messages, dans tous les cas - Commentaire = "log" ; - if ( modeHOMARD == 1 ) { Commentaire += " " + siterp1 ; } - else { Commentaire += "Info" ; } - PublishFileUnderIteration(NomIteration, LogFile.c_str(), Commentaire.c_str()); - - // H.2. Si tout s'est bien passe : - if (codretexec == 0) - { - // H.2.1. Le fichier de bilan - Commentaire = "Summary" ; - if ( modeHOMARD == 1 ) { Commentaire += " " + siterp1 ; } - else { Commentaire += "Info" ; } - PublishFileUnderIteration(NomIteration, FileInfo.c_str(), Commentaire.c_str()); - // H.2.2. Le fichier de maillage obtenu - if ( modeHOMARD == 1 ) - { - std::stringstream saux0 ; - Commentaire = "Mesh" ; - Commentaire += " " + siterp1 ; - PublishFileUnderIteration(NomIteration, MeshFile, Commentaire.c_str()); - if ( Option2 % 2 == 0 ) { PublishResultInSmesh(MeshFile, 1); } - } - } - // H.3 Message d'erreur - if (codretexec != 0) - { - std::string text = "" ; - // Message d'erreur en cas de probleme en adaptation - if ( modeHOMARD == 1 ) - { - 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 - { - std::string ligne; // variable contenant chaque ligne lue - while ( std::getline( fichier, ligne ) ) - { -// INFOS(ligne); - if ( stopvu ) - { text += ligne+ "\n"; } - else - { - int position = ligne.find( "===== HOMARD ===== STOP =====" ) ; - if ( position > 0 ) { stopvu = true ; } - } - } - } - } - 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); -// - // En mode information, on force le succes pour pouvoir consulter le fichier log - if ( modeHOMARD != 1 ) { codretexec = 0 ; } - } - } - - // I. Menage et retour dans le répertoire du cas - if (codret == 0) - { - delete myDriver; - MESSAGE ( ". On retourne dans nomDirWork = " << nomDirWork ); - - 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 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 avec Option1 = " << Option1 << ", Option2 = " << Option2 ); - - // A. Prealable - // A.1. Bases - int codret = 0; - // Numero de l'iteration - int NumeIter = myIteration->GetNumber(); - std::stringstream saux0 ; - saux0 << NumeIter-1 ; - std::string siter = saux0.str() ; - if (NumeIter < 11) { siter = "0" + siter ; } - - // A.2. On verifie qu il y a une hypothese (erreur improbable); - const char* nomHypo = myIteration->GetHypoName(); - if (std::string(nomHypo) == std::string("")) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "This iteration does not have any associated hypothesis."; - throw SALOME::SALOME_Exception(es); - return 2; - }; - HOMARD::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypo]; - ASSERT(!CORBA::is_nil(myHypo)); - - // B. L'iteration parent - const char* nomIterationParent = myIteration->GetIterParentName(); - HOMARD::HOMARD_Iteration_var myIterationParent = myStudyContext._mesIterations[nomIterationParent]; - ASSERT(!CORBA::is_nil(myIterationParent)); - // Si l'iteration parent n'est pas calculee, on le fait (recursivite amont) - if ( myIterationParent->GetState() == 1 ) - { - int iaux = 1 ; - int codret = Compute(nomIterationParent, etatMenage, iaux, Option1, Option2); - if (codret != 0) - { - // GERALD -- QMESSAGE BOX - VERIFICATION("Pb au calcul de l'iteration precedente" == 0); - } - }; - - // C. Le sous-répertoire de l'iteration precedente - char* DirComputePa = ComputeDirPaManagement(myCase, myIteration); - MESSAGE( ". DirComputePa = " << DirComputePa ); - - // D. Les données de l'adaptation HOMARD - // D.1. Le type de conformite - int ConfType = myCase->GetConfType(); - MESSAGE ( ". ConfType = " << ConfType ); - - // D.1. Le type externe - int ExtType = myCase->GetExtType(); - MESSAGE ( ". ExtType = " << ExtType ); - - // D.3. Le maillage de depart - const char* NomMeshParent = myIterationParent->GetMeshName(); - MESSAGE ( ". NomMeshParent = " << NomMeshParent ); - const char* MeshFileParent = myIterationParent->GetMeshFile(); - MESSAGE ( ". MeshFileParent = " << MeshFileParent ); - - // D.4. Le maillage associe a l'iteration - const char* MeshFile = myIteration->GetMeshFile(); - MESSAGE ( ". MeshFile = " << MeshFile ); - FILE *file = fopen(MeshFile,"r"); - if (file != NULL) - { - fclose(file); - if (etatMenage == 0) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - std::string text = "MeshFile : " + std::string(MeshFile) + " already exists "; - es.text = CORBA::string_dup(text.c_str()); - throw SALOME::SALOME_Exception(es); - return 4; - } - else - { - std::string commande = "rm -f " + std::string(MeshFile); - codret = system(commande.c_str()); - if (codret != 0) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "The mesh file cannot be deleted."; - throw SALOME::SALOME_Exception(es); - return 5; - } - } - } - - // D.5. Les types de raffinement et de deraffinement - // Les appels corba sont lourds, il vaut mieux les grouper - HOMARD::listeTypes* ListTypes = myHypo->GetAdapRefinUnRef(); - ASSERT(ListTypes->length() == 3); - int TypeAdap = (*ListTypes)[0]; - int TypeRaff = (*ListTypes)[1]; - int TypeDera = (*ListTypes)[2]; -// MESSAGE ( ". TypeAdap = " << TypeAdap << ", TypeRaff = " << TypeRaff << ", TypeDera = " << TypeDera ); - - // E. Texte du fichier de configuration - // E.1. Incontournables du texte - myDriver->TexteAdap(ExtType); - int iaux = 0 ; - myDriver->TexteMaillageHOMARD( DirComputePa, siter, iaux ) ; - myDriver->TexteMaillage(NomMeshParent, MeshFileParent, 0); - myDriver->TexteConfRaffDera(ConfType, TypeAdap, TypeRaff, TypeDera); - - // E.2. Ajout des informations liees aux zones eventuelles - if ( TypeAdap == 0 ) - { DriverTexteZone(myHypo, myDriver) ; } - - // E.3. Ajout des informations liees aux champs eventuels - if ( TypeAdap == 1 ) - { DriverTexteField(myIteration, myHypo, myDriver) ; } - - // E.4. Ajout des informations liees au filtrage eventuel par les groupes - HOMARD::ListGroupType* listeGroupes = myHypo->GetGroups(); - int numberOfGroups = listeGroupes->length(); - MESSAGE( ". Filtrage par " << numberOfGroups << " groupes"); - if (numberOfGroups > 0) - { - for (int NumGroup = 0; NumGroup< numberOfGroups; NumGroup++) - { - std::string GroupName = std::string((*listeGroupes)[NumGroup]); - MESSAGE( "... GroupName = " << GroupName ); - myDriver->TexteGroup(GroupName); - } - } - - // E.5. Ajout des informations liees a l'eventuelle interpolation des champs - DriverTexteFieldInterp(myIteration, myHypo, myDriver) ; - - // E.6. Ajout des options avancees - int Pyram = myCase->GetPyram(); - MESSAGE ( ". Pyram = " << Pyram ); - int NivMax = myHypo->GetNivMax(); - MESSAGE ( ". NivMax = " << NivMax ); - double DiamMin = myHypo->GetDiamMin() ; - MESSAGE ( ". DiamMin = " << DiamMin ); - int AdapInit = myHypo->GetAdapInit(); - MESSAGE ( ". AdapInit = " << AdapInit ); - int ExtraOutput = myHypo->GetExtraOutput(); - MESSAGE ( ". ExtraOutput = " << ExtraOutput ); - myDriver->TexteAdvanced(Pyram, NivMax, DiamMin, AdapInit, ExtraOutput); - - // E.7. Ajout des informations sur le deroulement de l'execution - int MessInfo = myIteration->GetInfoCompute(); - MESSAGE ( ". MessInfo = " << MessInfo ); - myDriver->TexteInfoCompute(MessInfo); - - return codret ; -} -//============================================================================= -// 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 = "<d_name); -#else - HANDLE hFind = INVALID_HANDLE_VALUE; - WIN32_FIND_DATA ffd; - hFind = FindFirstFile(nomrep, &ffd); - if (INVALID_HANDLE_VALUE != hFind) { - while (FindNextFile(hFind, &ffd) != 0) { - if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories - std::string file_name(ffd.cFileName); -#endif - if ( file_name == DirNameA.str() ) { existe = true ; } - } -#ifndef WIN32 - closedir(dp); -#else - FindClose(hFind); -#endif - if ( !existe ) - { - DirName = DirNameA.str() ; - a_chercher = false ; - break ; - } - } - num += 1; - } - - MESSAGE ( "==> DirName = " << DirName); - MESSAGE ( ". On retourne dans nomDirActuel = " << nomDirActuel ); - CHDIR(nomDirActuel.c_str()); - return CORBA::string_dup( DirName.c_str() ); -} -//============================================================================= -// Calcul d'une iteration : gestion du répertoire de calcul -// Si le sous-répertoire existe : -// etatMenage = 0 : on sort en erreur si le répertoire n'est pas vide -// etatMenage = 1 : on fait le menage du répertoire -// etatMenage = -1 : on ne fait rien -//============================================================================= -char* HOMARD_Gen_i::ComputeDirManagement(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage) -{ - MESSAGE ( "ComputeDirManagement : répertoires pour le calcul" ); - // B.2. Le répertoire du cas - const char* nomDirCase = myCase->GetDirName(); - MESSAGE ( ". nomDirCase = " << nomDirCase ); - - // 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-répertoire - std::stringstream DirCompute ; - DirCompute << nomDirCase << "/" << nomDirIt; - MESSAGE (". DirCompute = " << DirCompute.str() ); - - // B.3.3. Si le sous-répertoire n'existe pas, on le cree - if (CHDIR(DirCompute.str().c_str()) != 0) - { -#ifndef WIN32 - if (mkdir(DirCompute.str().c_str(), S_IRWXU|S_IRGRP|S_IXGRP) != 0) -#else - if (_mkdir(DirCompute.str().c_str()) != 0) -#endif - { - // GERALD -- QMESSAGE BOX - std::cerr << "Pb Creation du répertoire DirCompute = " << DirCompute.str() << std::endl; - VERIFICATION("Pb a la creation du répertoire" == 0); - } - } - else - { -// Le répertoire existe -// On demande de faire le menage de son contenu : - if (etatMenage == 1) - { - 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 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 : - else - { - if (etatMenage == 0) - { -#ifndef WIN32 - DIR *dp; - struct dirent *dirp; - dp = opendir(DirCompute.str().c_str()); - bool result = true; - while ((dirp = readdir(dp)) != NULL && result ) - { - std::string file_name(dirp->d_name); - result = file_name.empty() || file_name == "." || file_name == ".."; //if any file - break and return false - } - closedir(dp); -#else - HANDLE hFind = INVALID_HANDLE_VALUE; - WIN32_FIND_DATA ffd; - hFind = FindFirstFile(DirCompute.str().c_str(), &ffd); - bool result = true; - if (INVALID_HANDLE_VALUE != hFind) { - while (FindNextFile(hFind, &ffd) != 0) { - if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories - std::string file_name(ffd.cFileName); - result = file_name.empty() || file_name == "." || file_name == ".."; //if any file - break and return false - } - } - FindClose(hFind); -#endif - if ( result == false) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - std::string text = "Directory : " + DirCompute.str() + " is not empty"; - es.text = CORBA::string_dup(text.c_str()); - throw SALOME::SALOME_Exception(es); - VERIFICATION("Directory is not empty" == 0); - } - } - } - } - - return CORBA::string_dup( DirCompute.str().c_str() ); -} -//============================================================================= -// 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 : répertoires pour le calcul" ); - // Le répertoire du cas - const char* nomDirCase = myCase->GetDirName(); - MESSAGE ( ". nomDirCase = " << nomDirCase ); - - // Le sous-répertoire de l'iteration precedente - - const char* nomIterationParent = myIteration->GetIterParentName(); - HOMARD::HOMARD_Iteration_var myIterationParent = myStudyContext._mesIterations[nomIterationParent]; - const char* nomDirItPa = myIterationParent->GetDirNameLoc(); - std::stringstream DirComputePa ; - DirComputePa << nomDirCase << "/" << nomDirItPa; - MESSAGE( ". nomDirItPa = " << nomDirItPa); - MESSAGE( ". DirComputePa = " << DirComputePa.str() ); - - return CORBA::string_dup( DirComputePa.str().c_str() ); -} -//============================================================================= -// Calcul d'une iteration : ecriture des zones dans le fichier de configuration -//============================================================================= -void HOMARD_Gen_i::DriverTexteZone(HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver) -{ - MESSAGE ( "... DriverTexteZone" ); - HOMARD::listeZonesHypo* ListZone = myHypo->GetZones(); - int numberOfZonesx2 = ListZone->length(); - int NumZone ; - - for (int iaux = 0; iaux< numberOfZonesx2; iaux++) - { - std::string ZoneName = std::string((*ListZone)[iaux]); - MESSAGE ( "... ZoneName = " << ZoneName); - HOMARD::HOMARD_Zone_var myZone = myStudyContext._mesZones[ZoneName]; - ASSERT(!CORBA::is_nil(myZone)); - - int ZoneType = myZone->GetType(); - std::string TypeUsestr = std::string((*ListZone)[iaux+1]); - int TypeUse = atoi( TypeUsestr.c_str() ); - MESSAGE ( "... ZoneType = " << ZoneType << ", TypeUse = "<GetCoords(); - if ( ZoneType == 2 || ( ZoneType>=11 && ZoneType <=13 ) ) // Cas d un parallelepipede ou d'un rectangle - { myDriver->TexteZone(NumZone, ZoneType, TypeUse, (*zone)[0], (*zone)[1], (*zone)[2], (*zone)[3], (*zone)[4], (*zone)[5], 0., 0., 0.); } - else if ( ZoneType == 4 ) // Cas d une sphere - { myDriver->TexteZone(NumZone, ZoneType, TypeUse, (*zone)[0], (*zone)[1], (*zone)[2], (*zone)[3], 0., 0., 0., 0., 0.); } - else if ( ZoneType == 5 || ( ZoneType>=31 && ZoneType <=33 ) ) // Cas d un cylindre ou d'un disque - { myDriver->TexteZone(NumZone, ZoneType, TypeUse, (*zone)[0], (*zone)[1], (*zone)[2], (*zone)[3], (*zone)[4], (*zone)[5], (*zone)[6], (*zone)[7], 0.); } - else if ( ZoneType == 7 || ( ZoneType>=61 && ZoneType <=63 ) ) // Cas d un tuyau ou disque perce - { myDriver->TexteZone(NumZone, ZoneType, TypeUse, (*zone)[0], (*zone)[1], (*zone)[2], (*zone)[3], (*zone)[4], (*zone)[5], (*zone)[6], (*zone)[7], (*zone)[8]); } - else { VERIFICATION("ZoneType est incorrect." == 0) ; } - iaux += 1 ; - } - return ; -} -//============================================================================= -// Calcul d'une iteration : ecriture des champs dans le fichier de configuration -//============================================================================= -void HOMARD_Gen_i::DriverTexteField(HOMARD::HOMARD_Iteration_var myIteration, HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver) -{ - MESSAGE ( "... DriverTexteField" ); -// Le fichier du champ - char* FieldFile = myIteration->GetFieldFile(); - MESSAGE ( ". FieldFile = " << FieldFile ); - if (strlen(FieldFile) == 0) - { - // GERALD -- QMESSAGE BOX - std::cerr << "Le fichier du champ n'a pas ete fourni." << std::endl; - VERIFICATION("The file for the field is not given." == 0); - } -// Les caracteristiques d'instants du champ de pilotage - int TimeStep = myIteration->GetTimeStep(); - MESSAGE( ". TimeStep = " << TimeStep ); - int Rank = myIteration->GetRank(); - MESSAGE( ". Rank = " << Rank ); -// Les informations sur les champs - HOMARD::InfosHypo* aInfosHypo = myHypo->GetField(); -// Le nom - const char* FieldName = aInfosHypo->FieldName; -// Les seuils - int TypeThR = aInfosHypo->TypeThR; - double ThreshR = aInfosHypo->ThreshR; - int TypeThC = aInfosHypo->TypeThC; - double ThreshC = aInfosHypo->ThreshC; -// Saut entre mailles ou non ? - int UsField = aInfosHypo->UsField; - MESSAGE( ". UsField = " << UsField ); -// L'usage des composantes - int UsCmpI = aInfosHypo->UsCmpI; - MESSAGE( ". UsCmpI = " << UsCmpI ); -// - myDriver->TexteField(FieldName, FieldFile, TimeStep, Rank, TypeThR, ThreshR, TypeThC, ThreshC, UsField, UsCmpI); -// -// Les composantes - HOMARD::listeComposantsHypo* mescompo = myHypo->GetComps(); - int numberOfCompos = mescompo->length(); - MESSAGE( ". numberOfCompos = " << numberOfCompos ); - for (int NumeComp = 0; NumeComp< numberOfCompos; NumeComp++) - { - std::string nomCompo = std::string((*mescompo)[NumeComp]); - MESSAGE( "... nomCompo = " << nomCompo ); - myDriver->TexteCompo(NumeComp, nomCompo); - } - return ; -} -//============================================================================= -// Calcul d'une iteration : ecriture des frontieres dans le fichier de configuration -// On ecrit dans l'ordre : -// 1. la definition des frontieres -// 2. les liens avec les groupes -// 3. un entier resumant le type de comportement pour les frontieres -//============================================================================= -int HOMARD_Gen_i::DriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, HomardDriver* myDriver) -{ - MESSAGE ( "... DriverTexteBoundary" ); - // 1. Recuperation des frontieres - std::list ListeBoundaryTraitees ; - HOMARD::ListBoundaryGroupType* ListBoundaryGroupType = myCase->GetBoundaryGroup(); - int numberOfitems = ListBoundaryGroupType->length(); - MESSAGE ( "... number of string for Boundary+Group = " << numberOfitems); - int BoundaryOption = 1 ; - // 2. Parcours des frontieres pour ecrire leur description - int NumBoundaryAnalytical = 0 ; - for (int NumBoundary = 0; NumBoundary< numberOfitems; NumBoundary=NumBoundary+2) - { - std::string BoundaryName = std::string((*ListBoundaryGroupType)[NumBoundary]); - MESSAGE ( "... BoundaryName = " << BoundaryName); - // 2.1. La frontiere a-t-elle deja ete ecrite ? - // Cela arrive quand elle est liee a plusieurs groupes. Il ne faut l'ecrire que la premiere fois - int A_faire = 1 ; - std::list::const_iterator it = ListeBoundaryTraitees.begin(); - while (it != ListeBoundaryTraitees.end()) - { - MESSAGE ( "..... BoundaryNameTraitee = " << *it); - if ( BoundaryName == *it ) { A_faire = 0 ; } - it++; - } - // 2.2. Ecriture de la frontiere - if ( A_faire == 1 ) - { - // 2.2.1. Caracteristiques de la frontiere - HOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; - ASSERT(!CORBA::is_nil(myBoundary)); - int BoundaryType = myBoundary->GetType(); - MESSAGE ( "... BoundaryType = " << BoundaryType ); - // 2.2.2. Ecriture selon le type - // 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->GetDataFile() ; - MESSAGE ( ". MeshFile = " << MeshFile ); - myDriver->TexteBoundaryDi( MeshName, MeshFile); - if ( BoundaryOption % 2 != 0 ) { BoundaryOption = BoundaryOption*2 ; } - } - // 2.2.2.3. Cas d une frontiere analytique - else - { - NumBoundaryAnalytical++ ; - HOMARD::double_array* coor = myBoundary->GetCoords(); - if (BoundaryType == 1) // Cas d un cylindre - { - myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], (*coor)[4], (*coor)[5], (*coor)[6], 0.); - if ( BoundaryOption % 3 != 0 ) { BoundaryOption = BoundaryOption*3 ; } - } - else if (BoundaryType == 2) // Cas d une sphere - { - myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], 0., 0., 0., 0.); - if ( BoundaryOption % 3 != 0 ) { BoundaryOption = BoundaryOption*3 ; } - } - else if (BoundaryType == 3) // Cas d un cone defini par un axe et un angle - { - myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], (*coor)[4], (*coor)[5], (*coor)[6], 0.); - if ( BoundaryOption % 3 != 0 ) { BoundaryOption = BoundaryOption*3 ; } - } - else if (BoundaryType == 4) // Cas d un cone defini par les 2 rayons - { - myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], (*coor)[4], (*coor)[5], (*coor)[6], (*coor)[7]); - if ( BoundaryOption % 3 != 0 ) { BoundaryOption = BoundaryOption*3 ; } - } - else if (BoundaryType == 5) // Cas d un tore - { - myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], (*coor)[4], (*coor)[5], (*coor)[6], (*coor)[7]); - if ( BoundaryOption % 3 != 0 ) { BoundaryOption = BoundaryOption*3 ; } - } - } - // 2.2.3. Memorisation du traitement - ListeBoundaryTraitees.push_back( BoundaryName ); - } - } - // 3. Parcours des frontieres pour ecrire les liens avec les groupes - NumBoundaryAnalytical = 0 ; - for (int NumBoundary = 0; NumBoundary< numberOfitems; NumBoundary=NumBoundary+2) - { - std::string BoundaryName = std::string((*ListBoundaryGroupType)[NumBoundary]); - MESSAGE ( "... BoundaryName = " << BoundaryName); - HOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; - ASSERT(!CORBA::is_nil(myBoundary)); - int BoundaryType = myBoundary->GetType(); - MESSAGE ( "... BoundaryType = " << BoundaryType ); - // 3.1. Recuperation du nom du groupe - std::string GroupName = std::string((*ListBoundaryGroupType)[NumBoundary+1]); - MESSAGE ( "... GroupName = " << GroupName); - // 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.4. Cas d une frontiere analytique - else - { - NumBoundaryAnalytical++ ; - myDriver->TexteBoundaryAnGr ( BoundaryName, NumBoundaryAnalytical, GroupName ) ; - } - } - // 4. Ecriture de l'option finale - myDriver->TexteBoundaryOption(BoundaryOption); -// - return BoundaryOption ; -} -//============================================================================= -// Calcul d'une iteration : ecriture des interpolations dans le fichier de configuration -//============================================================================= -void HOMARD_Gen_i::DriverTexteFieldInterp(HOMARD::HOMARD_Iteration_var myIteration, HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver) -{ - MESSAGE ( "... DriverTexteFieldInterp" ); - int TypeFieldInterp = myHypo->GetTypeFieldInterp(); - MESSAGE ( "... TypeFieldInterp = " << TypeFieldInterp); - if (TypeFieldInterp != 0) - { -// Le fichier des champs - char* FieldFile = myIteration->GetFieldFile(); - MESSAGE ( ". FieldFile = " << FieldFile ); - if (strlen(FieldFile) == 0) - { - // GERALD -- QMESSAGE BOX - VERIFICATION("The file for the field is not given." == 0); - } - // - const char* MeshFile = myIteration->GetMeshFile(); - myDriver->TexteFieldInterp(FieldFile, MeshFile); - - // Les champs - // Interpolation de tous les champs - if ( TypeFieldInterp == 1 ) - { - myDriver->TexteFieldInterpAll(); - } - // Interpolation de certains champs - else if (TypeFieldInterp == 2) - { - // Les champs et leurs instants pour l'iteration - HOMARD::listeFieldInterpTSRsIter* ListFieldTSR = myIteration->GetFieldInterpsTimeStepRank(); - int numberOfFieldsx3 = ListFieldTSR->length(); - MESSAGE( ". pour iteration, numberOfFields = " << numberOfFieldsx3/3 ); - // Les champs pour l'hypothese - HOMARD::listeFieldInterpsHypo* ListField = myHypo->GetFieldInterps(); - int numberOfFieldsx2 = ListField->length(); - MESSAGE( ". pour hypothese, numberOfFields = " << numberOfFieldsx2/2 ); - // On parcourt tous les champs de l'hypothese - int NumField = 0 ; - for (int iaux = 0; iaux< numberOfFieldsx2; iaux++) - { - // Le nom du champ - std::string FieldName = std::string((*ListField)[iaux]) ; - // 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 - int tsrvu = 0; - for (int jaux = 0; jaux< numberOfFieldsx3; jaux++) - { - // Le nom du champ - std::string FieldName2 = std::string((*ListFieldTSR)[jaux]) ; - MESSAGE( "..... FieldName2 = " << FieldName2 ); - // Quand c'est le bon champ, on ecrit le pas de temps - if ( FieldName == FieldName2 ) - { - tsrvu = 1 ; - // Le pas de temps - std::string TimeStepstr = std::string((*ListFieldTSR)[jaux+1]) ; - // Le numero d'ordre - std::string Rankstr = std::string((*ListFieldTSR)[jaux+2]) ; - MESSAGE( "..... TimeStepstr = " << TimeStepstr <<", Rankstr = "<TexteFieldInterpNameType(NumField, FieldName, TypeInterpstr, TimeStep, Rank); - } - jaux += 2 ; - } - // Si aucun instant n'a été défini - if ( tsrvu == 0 ) - { - NumField += 1 ; - myDriver->TexteFieldInterpNameType(NumField, FieldName, TypeInterpstr, -1, -1); - } - iaux++ ; - } - } - } - return ; -} -//=========================================================================== -//=========================================================================== - - -//=========================================================================== -//=========================================================================== -// Publications -//=========================================================================== -//=========================================================================== -SALOMEDS::SObject_ptr HOMARD_Gen_i::PublishInStudy(SALOMEDS::SObject_ptr theSObject, - CORBA::Object_ptr theObject, - const char* theName) -{ - MESSAGE("PublishInStudy pour " << theName); - SALOMEDS::SObject_var aResultSO; - if (CORBA::is_nil(myStudy)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid study context"; - throw SALOME::SALOME_Exception(es); - return 0; - }; - -// Recuperation de l'objet correspondant, en essayant chacun des types possibles -// Rq : Iteration est publiee ailleurs - HOMARD::HOMARD_Boundary_var aBoundary = HOMARD::HOMARD_Boundary::_narrow(theObject); - HOMARD::HOMARD_Cas_var aCase = HOMARD::HOMARD_Cas::_narrow(theObject); - HOMARD::HOMARD_Hypothesis_var aHypo = HOMARD::HOMARD_Hypothesis::_narrow(theObject); - HOMARD::HOMARD_YACS_var aYACS = HOMARD::HOMARD_YACS::_narrow(theObject); - HOMARD::HOMARD_Zone_var aZone = HOMARD::HOMARD_Zone::_narrow(theObject); - - UpdateStudy(); - -// Controle de la non publication d'un objet de meme nom - if ( (!aBoundary->_is_nil()) || (!aHypo->_is_nil()) || (!aYACS->_is_nil()) || (!aZone->_is_nil()) ) - { - SALOMEDS::Study::ListOfSObject_var listSO = myStudy->FindObjectByName(theName, ComponentDataType()); - if (listSO->length() >= 1) - { - MESSAGE("This name "<length()<<" time(s)"); - aResultSO = listSO[0]; - return aResultSO._retn(); - } - } - - // Caracteristiques de l'etude - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); - aStudyBuilder->NewCommand(); - if(!aBoundary->_is_nil()) - aResultSO = PublishBoundaryInStudy(aStudyBuilder, aBoundary, theName); - else if(!aCase->_is_nil()) - aResultSO = PublishCaseInStudy(aStudyBuilder, aCase, theName); - else if(!aHypo->_is_nil()) - aResultSO = PublishHypotheseInStudy(aStudyBuilder, aHypo, theName); - else if(!aYACS->_is_nil()) - aResultSO = PublishYACSInStudy(aStudyBuilder, aYACS, theName); - else if(!aZone->_is_nil()) - aResultSO = PublishZoneInStudy(aStudyBuilder, aZone, theName); - - aStudyBuilder->CommitCommand(); - - return aResultSO._retn(); -}; -//============================================================================= -SALOMEDS::SObject_ptr HOMARD_Gen_i::PublishBoundaryInStudy( SALOMEDS::StudyBuilder_var aStudyBuilder, - HOMARD::HOMARD_Boundary_ptr theObject, const char* theName) -{ - MESSAGE("PublishBoundaryStudy pour "<FindComponent(ComponentDataType()); - if (theFatherHomard->_is_nil()) - { - MESSAGE("theFatherHomard->_is_nil()"); - return aResultSO._retn(); - } - - // On ajoute la categorie des boundarys dans l etude si necessaire - if ( _tag_boun == 0 ) - { - _tag_gene += 1 ; - _tag_boun = _tag_gene ; - } - MESSAGE("PublishBoundaryInStudy _tag_gene = "<<_tag_gene << ", _tag_boun = "<<_tag_boun ); - SALOMEDS::SObject_var aSObject; - if (!theFatherHomard->FindSubObject(_tag_boun, aSObject)) - { - MESSAGE("Ajout de la categorie des boundarys"); - aSObject = aStudyBuilder->NewObjectToTag(theFatherHomard, _tag_boun); - PublishInStudyAttr(aStudyBuilder, aSObject, "Boundaries", "BoundList", "zone_icone_2.png", NULL ) ; - } - else { MESSAGE("La categorie des boundarys existe deja."); } - - CORBA::Long BoundaryType = myBoundary->GetType(); -// MESSAGE("BoundaryType : "<NewObject(aSObject); - PublishInStudyAttr(aStudyBuilder, aResultSO, theName, value.c_str(), icone.c_str(), _orb->object_to_string(theObject)); - return aResultSO._retn(); -} -//============================================================================= -SALOMEDS::SObject_ptr HOMARD_Gen_i::PublishCaseInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, - HOMARD::HOMARD_Cas_ptr theObject, const char* theName) -{ - MESSAGE("PublishCaseInStudy pour "<_is_nil()"); - return aResultSO._retn(); - } - if (myStudy->_is_nil()) { - MESSAGE("HOMARD_Gen_i::myStudy->_is_nil()"); - return aResultSO._retn(); - } - - // On recupere le module pere dans l etude - SALOMEDS::SComponent_var theFatherHomard = myStudy->FindComponent(ComponentDataType()); - if (theFatherHomard->_is_nil()) - { - MESSAGE("theFatherHomard->_is_nil()"); - return aResultSO._retn(); - } - - _tag_gene += 1 ; - MESSAGE("PublishCaseInStudy _tag_gene = "<<_tag_gene ); - aResultSO = aStudyBuilder->NewObject(theFatherHomard); - PublishInStudyAttr(aStudyBuilder, aResultSO, theName, "CasHomard", "cas_calcule.png", - _orb->object_to_string(theObject) ) ; - - return aResultSO._retn(); -} -//============================================================================= -SALOMEDS::SObject_ptr HOMARD_Gen_i::PublishHypotheseInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, - HOMARD::HOMARD_Hypothesis_ptr theObject, const char* theName) -{ - MESSAGE("PublishHypotheseInStudy pour "<FindComponent(ComponentDataType()); - if (theFatherHomard->_is_nil()) - { - MESSAGE("theFatherHomard->_is_nil()"); - return aResultSO._retn(); - } - - // On ajoute la categorie des hypotheses dans l etude si necessaire - SALOMEDS::SObject_var aSObject; - if ( _tag_hypo == 0 ) - { - _tag_gene += 1 ; - _tag_hypo = _tag_gene ; - } - MESSAGE("PublishHypotheseInStudy _tag_gene = "<<_tag_gene << ", _tag_hypo = "<<_tag_hypo ); - if (!theFatherHomard->FindSubObject(_tag_hypo, aSObject)) - { - MESSAGE("Ajout de la categorie des hypotheses"); - aSObject = aStudyBuilder->NewObjectToTag(theFatherHomard, _tag_hypo); - PublishInStudyAttr(aStudyBuilder, aSObject, "Hypothesis", "HypoList", "hypotheses.png", NULL); - } - else { MESSAGE("La categorie des hypotheses existe deja."); } - -// Creation du resultat dans l'etude - aResultSO = aStudyBuilder->NewObject(aSObject); - PublishInStudyAttr(aStudyBuilder, aResultSO, theName, "HypoHomard", NULL, _orb->object_to_string(theObject) ) ; - - return aResultSO._retn(); -} -//============================================================================= -SALOMEDS::SObject_ptr HOMARD_Gen_i::PublishYACSInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, - HOMARD::HOMARD_YACS_ptr theObject, const char* theName) -{ - MESSAGE("PublishYACSInStudy pour "<FindComponent(ComponentDataType()); - if (theFatherHomard->_is_nil()) - { - MESSAGE("theFatherHomard->_is_nil()"); - return aResultSO._retn(); - } - // On ajoute la categorie des schemas YACS dans l etude si necessaire - if ( _tag_yacs == 0 ) - { - _tag_gene += 1 ; - _tag_yacs = _tag_gene ; - } - MESSAGE("PublishZoneStudy _tag_gene = "<<_tag_gene << ", _tag_yacs = "<<_tag_yacs ); - SALOMEDS::SObject_var aSObject; - if (!theFatherHomard->FindSubObject(_tag_yacs, aSObject)) - { - MESSAGE("Ajout de la categorie des schemas YACS"); - aSObject = aStudyBuilder->NewObjectToTag(theFatherHomard, _tag_yacs); - PublishInStudyAttr(aStudyBuilder, aSObject, "YACS", "YACSList", "full_view.png", NULL); - } - else { MESSAGE("La categorie des schemas YACS existe deja."); } - -// Creation du resultat dans l'etude - aResultSO = aStudyBuilder->NewObject(aSObject); - PublishInStudyAttr(aStudyBuilder, aResultSO, theName, "YACSHomard", "schema.png", _orb->object_to_string(theObject) ) ; - - return aResultSO._retn(); -} - -//============================================================================= -SALOMEDS::SObject_ptr HOMARD_Gen_i::PublishZoneInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, - HOMARD::HOMARD_Zone_ptr theObject, const char* theName) -{ - MESSAGE("PublishZoneStudy pour "<_is_nil()"); - return aResultSO._retn(); - } - if (myStudy->_is_nil()) - { - MESSAGE("PublishZoneInStudy : myStudy->_is_nil()"); - return aResultSO._retn(); - } - SALOMEDS::SComponent_var theFatherHomard = myStudy->FindComponent(ComponentDataType()); - if (theFatherHomard->_is_nil()) - { - MESSAGE("PublishZoneInStudy : theFatherHomard->_is_nil()"); - return aResultSO._retn(); - } - - // Caracteristique de la zone - HOMARD::HOMARD_Zone_var myZone = myStudyContext._mesZones[theName]; - CORBA::Long ZoneType = myZone->GetType(); - - // On ajoute la categorie des zones dans l etude si necessaire - if ( _tag_zone == 0 ) - { - _tag_gene += 1 ; - _tag_zone = _tag_gene ; - } - MESSAGE("PublishZoneStudy _tag_gene = "<<_tag_gene << ", _tag_zone = "<<_tag_zone ); - SALOMEDS::SObject_var aSObject; - if (!theFatherHomard->FindSubObject(_tag_zone, aSObject)) - { - MESSAGE("Ajout de la categorie des zones"); - aSObject = aStudyBuilder->NewObjectToTag(theFatherHomard, _tag_zone); - PublishInStudyAttr(aStudyBuilder, aSObject, "Zones", "ZoneList", "zone_icone_2.png", NULL ) ; - } - else { MESSAGE("La categorie des zones existe deja."); } - - aResultSO = aStudyBuilder->NewObject(aSObject); - std::string icone ; - switch (ZoneType) - { - case 11 : - { } - case 12 : - { } - case 13 : - { icone = "boxdxy_2.png" ; - break ; - } - case 2 : - { icone = "boxdxyz_2.png" ; - break ; - } - case 31 : - { } - case 32 : - { } - case 33 : - { icone = "disk_2.png" ; - break ; - } - case 4 : - { icone = "spherepoint_2.png" ; - break ; - } - case 5 : - { icone = "cylinderpointvector_2.png" ; - break ; - } - case 61 : - { } - case 62 : - { } - case 63 : - { icone = "diskwithhole_2.png" ; - break ; - } - case 7 : - { icone = "pipe_2.png" ; - break ; - } - } - PublishInStudyAttr(aStudyBuilder, aResultSO, theName, "ZoneHomard", icone.c_str(), _orb->object_to_string(theObject) ) ; - - return aResultSO._retn(); -} -//=========================================================================== -void HOMARD_Gen_i::PublishInStudyAttr(SALOMEDS::StudyBuilder_var aStudyBuilder, - SALOMEDS::SObject_var aResultSO, - const char* name, const char* comment, const char* icone, const char* ior) -{ - MESSAGE("PublishInStudyAttr pour name = "<SetValue(name); - } - -// Ajout du commentaire - if ( comment != NULL ) - { - anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeComment"); - SALOMEDS::AttributeComment_var aCommentAttrib = SALOMEDS::AttributeComment::_narrow(anAttr); - aCommentAttrib->SetValue(comment); - } - -// Ajout de l'icone - if ( icone != NULL ) - { - anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributePixMap"); - SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); - aPixmap->SetPixMap(icone); - } - -// Ajout de l ior - if ( ior != NULL ) - { - anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeIOR"); - SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - anIOR->SetValue(ior); - } -}; - -//===================================================================================== -void HOMARD_Gen_i::PublishBoundaryUnderCase(const char* CaseName, const char* BoundaryName) -{ - MESSAGE ( "PublishBoundaryUnderCase : CaseName = " << CaseName << ", BoundaryName= " << BoundaryName ); - - HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[CaseName]; - ASSERT(!CORBA::is_nil(myCase)); - SALOMEDS::SObject_var aCaseSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myCase))); - ASSERT(!CORBA::is_nil(aCaseSO)); - - HOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; - ASSERT(!CORBA::is_nil(myBoundary)); - SALOMEDS::SObject_var aBoundarySO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myBoundary))); - ASSERT(!CORBA::is_nil(aBoundarySO)); - - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); - - aStudyBuilder->NewCommand(); - - SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aCaseSO); - aStudyBuilder->Addreference(aSubSO, aBoundarySO); -// aStudyBuilder->RemoveReference(aSubSO); - - aStudyBuilder->CommitCommand(); - -}; -//===================================================================================== -void HOMARD_Gen_i::PublishCaseUnderYACS(const char* nomYACS, const char* CaseName) -{ - MESSAGE ( "PublishCaseUnderYACS : nomYACS = " << nomYACS << ", CaseName= " << CaseName ); - - HOMARD::HOMARD_YACS_var myYACS = myStudyContext._mesYACSs[nomYACS]; - ASSERT(!CORBA::is_nil(myYACS)); - SALOMEDS::SObject_var aYACSSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myYACS))); - ASSERT(!CORBA::is_nil(aYACSSO)); - - HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[CaseName]; - ASSERT(!CORBA::is_nil(myCase)); - SALOMEDS::SObject_var aCaseSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myCase))); - ASSERT(!CORBA::is_nil(aCaseSO)); - - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); - - aStudyBuilder->NewCommand(); - - SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aYACSSO); - aStudyBuilder->Addreference(aSubSO, aCaseSO); - - aStudyBuilder->CommitCommand(); - -}; -//============================================================================= -void HOMARD_Gen_i::PublishResultInSmesh(const char* NomFich, CORBA::Long Option) -// Option = 0 : fichier issu d'une importation -// Option = 1 : fichier issu d'une execution HOMARD -{ - MESSAGE( "PublishResultInSmesh " << NomFich << ", avec Option = " << Option); - if (CORBA::is_nil(myStudy)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid study context"; - throw SALOME::SALOME_Exception(es); - return ; - }; - -// Le module SMESH est-il actif ? - SALOMEDS::SObject_var aSmeshSO = myStudy->FindComponent("SMESH"); -// - if (!CORBA::is_nil(aSmeshSO)) - { -// On verifie que le fichier n est pas deja publie - SALOMEDS::ChildIterator_var aIter = myStudy->NewChildIterator(aSmeshSO); - for (; aIter->More(); aIter->Next()) - { - SALOMEDS::SObject_var aSO = aIter->Value(); - SALOMEDS::GenericAttribute_var aGAttr; - if (aSO->FindAttribute(aGAttr,"AttributeExternalFileDef")) - { - SALOMEDS::AttributeExternalFileDef_var anAttr = SALOMEDS::AttributeExternalFileDef::_narrow(aGAttr); - CORBA::String_var value=anAttr->Value(); - if (strcmp((const char*)value,NomFich) == 0) - { - MESSAGE ( "PublishResultInSmesh : le fichier " << NomFich << " est deja publie." ); - // Pour un fichier importe, on ne republie pas - if ( Option == 0 ) { return; } - // Pour un fichier calcule, on commence par faire la depublication - else - { - MESSAGE ( "PublishResultInSmesh : depublication" ); - SALOMEDS::AttributeName_var anAttr2 = SALOMEDS::AttributeName::_narrow(aGAttr); - CORBA::String_var value2=anAttr2->Value(); - std::string MeshName = string(value2) ; - MESSAGE ( "PublishResultInSmesh : depublication de " << MeshName ); - DeleteResultInSmesh(NomFich, MeshName) ; - } - } - } - } - } - -// 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")); - ASSERT(!CORBA::is_nil(aSmeshEngine)); - aSmeshEngine->UpdateStudy(); - SMESH::DriverMED_ReadStatus theStatus; - //aSmeshEngine->CreateMeshesFromMED(NomFich, theStatus); - -// On met a jour les attributs AttributeExternalFileDef et AttributePixMap - SMESH::mesh_array* mesMaillages=aSmeshEngine->CreateMeshesFromMED(NomFich, theStatus); - for (int i = 0; i < mesMaillages->length(); i++) - { - MESSAGE( ". Mise a jour des attributs du maillage"); - SMESH::SMESH_Mesh_var monMaillage= (*mesMaillages)[i]; - SALOMEDS::SObject_var aSO=SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(monMaillage))); - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); - SALOMEDS::GenericAttribute_var aGAttr = aStudyBuilder->FindOrCreateAttribute(aSO, "AttributeExternalFileDef"); - SALOMEDS::AttributeExternalFileDef_var anAttr = SALOMEDS::AttributeExternalFileDef::_narrow(aGAttr); - anAttr->SetValue(NomFich); - SALOMEDS::GenericAttribute_var aPixMap = aStudyBuilder->FindOrCreateAttribute(aSO, "AttributePixMap" ); - SALOMEDS::AttributePixMap_var anAttr2 = SALOMEDS::AttributePixMap::_narrow(aPixMap); - const char* icone ; - if ( Option == 0 ) { icone = "mesh_tree_importedmesh.png" ; } - else { icone = "mesh_tree_mesh.png" ; } - anAttr2->SetPixMap( icone ); - } - -} -//============================================================================= -void HOMARD_Gen_i::DeleteResultInSmesh(std::string NomFich, std::string MeshName) -{ - MESSAGE ("DeleteResultInSmesh pour le maillage " << MeshName << " dans le fichier " << NomFich ); - if (CORBA::is_nil(myStudy)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid study context"; - throw SALOME::SALOME_Exception(es); - return ; - }; - -// Le module SMESH est-il actif ? - SALOMEDS::SObject_var aSmeshSO = myStudy->FindComponent("SMESH"); -// - if (CORBA::is_nil(aSmeshSO)) - { - return ; - }; -// On verifie que le fichier est deja publie - SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder(); - SALOMEDS::ChildIterator_var aIter = myStudy->NewChildIterator(aSmeshSO); - for (; aIter->More(); aIter->Next()) - { - SALOMEDS::SObject_var aSO = aIter->Value(); - SALOMEDS::GenericAttribute_var aGAttr; - if (aSO->FindAttribute(aGAttr,"AttributeExternalFileDef")) - { - SALOMEDS::AttributeExternalFileDef_var anAttr = SALOMEDS::AttributeExternalFileDef::_narrow(aGAttr); - CORBA::String_var value=anAttr->Value(); - if (strcmp((const char*)value,NomFich.c_str()) == 0) - { - if (aSO->FindAttribute(aGAttr,"AttributeName")) - { - SALOMEDS::AttributeName_var anAttr2 = SALOMEDS::AttributeName::_narrow(aGAttr); - CORBA::String_var value2=anAttr2->Value(); - if (strcmp((const char*)value2,MeshName.c_str()) == 0) - { - myBuilder->RemoveObjectWithChildren( aSO ) ; - } - } - } - } - } - return ; -} -//============================================================================= -void HOMARD_Gen_i::PublishMeshIterInSmesh(const char* NomIter) -{ - MESSAGE( "PublishMeshIterInSmesh " << NomIter); - HOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[NomIter]; - - SALOMEDS::SObject_var aIterSO=SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIteration))); - if (CORBA::is_nil(myIteration)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid iterationStudy Object"; - throw SALOME::SALOME_Exception(es); - return ; - }; - const char* MeshFile = myIteration->GetMeshFile() ; - const char* MeshName = myIteration->GetMeshName() ; - CORBA::Long Option = -1 ; - int etat = myIteration->GetState(); -// Iteration initiale - if ( etat <= 0 ) { Option = 0 ; } -// ou iteration calculee - else if ( etat == 2 ) { Option = 1 ; } -// Publication effective apres menage eventuel - if ( Option >= 0 ) - { - DeleteResultInSmesh(MeshFile, MeshName) ; - PublishResultInSmesh(MeshFile, Option) ; - } - -} -//============================================================================= -void HOMARD_Gen_i::PublishFileUnderIteration(const char* NomIter, const char* NomFich, const char* Commentaire) -{ -// MESSAGE ("PublishFileUnderIteration pour l'iteration " << NomIter << " du fichier " << NomFich << " avec le commentaire " << Commentaire ); - HOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[NomIter]; - - SALOMEDS::SObject_var aIterSO=SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIteration))); - if (CORBA::is_nil(myIteration)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid iterationStudy Object"; - throw SALOME::SALOME_Exception(es); - return ; - }; - - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); - - aStudyBuilder->NewCommand(); - - SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aIterSO); -// Pour les fichiers med, on affiche une icone de maillage -// Pour les fichiers qui sont du texte, on affiche une icone de fichier texte 'texte' -// Le reperage se fait par la 1ere lettre du commentaire : I pour Iteration n - std::string icone ; - std::string ior = " " ; - if ( Commentaire[0] == 'M' ) - { icone = "med.png" ; } - else - { icone = "texte_2.png" ; } - PublishInStudyAttr(aStudyBuilder, aSubSO, NomFich, Commentaire, icone.c_str(), ior.c_str() ) ; - - aStudyBuilder->CommitCommand(); -} -// -//============================================================================= -void HOMARD_Gen_i::PublishFileUnderYACS(const char* nomYACS, const char* NomFich, const char* Commentaire) -{ -// MESSAGE ("PublishFileUnderYACS pour le schema " << nomYACS << " du fichier " << NomFich << " avec le commentaire " << Commentaire ); - HOMARD::HOMARD_YACS_var myYACS = myStudyContext._mesYACSs[nomYACS]; - - SALOMEDS::SObject_var aYACSSO=SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myYACS))); - if (CORBA::is_nil(myYACS)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Invalid YACSStudy Object"; - throw SALOME::SALOME_Exception(es); - return ; - }; - - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); - - aStudyBuilder->NewCommand(); - - SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aYACSSO); - std::string icone = "texte_2.png" ; - std::string ior = " " ; - PublishInStudyAttr(aStudyBuilder, aSubSO, NomFich, Commentaire, icone.c_str(), ior.c_str() ) ; - - aStudyBuilder->CommitCommand(); -} -// -//============================================================================= -//============================================================================= -// YACS -//============================================================================= -//============================================================================= -//============================================================================= -// Creation d'un schema YACS -// nomCas : nom du cas a traiter -// FileName : nom du fichier contenant le script de lancement du calcul -// 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); - - // A. Controle du nom : - if ((myStudyContext._mesYACSs).find(nomYACS) != (myStudyContext._mesYACSs).end()) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "This schema YACS has already been defined."; - throw SALOME::SALOME_Exception(es); - return 0; - } - - // B. Creation de l'objet - HOMARD::HOMARD_YACS_var myYACS = newYACS(); - if (CORBA::is_nil(myYACS)) - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = "Unable to create the schema YACS"; - throw SALOME::SALOME_Exception(es); - return 0; - }; - myYACS->SetName( nomYACS ) ; - - // C. Enregistrement - myStudyContext._mesYACSs[nomYACS] = myYACS; - - SALOMEDS::SObject_var aSO; - SALOMEDS::SObject_var aResultSO=PublishInStudy(aSO, myYACS, nomYACS); - - PublishCaseUnderYACS(nomYACS, nomCas); - - // D. Caracterisation - // D.1. Options - myYACS->SetDirName( DirName ) ; - myYACS->SetMeshFile( MeshFile ) ; - myYACS->SetScriptFile( ScriptFile ) ; - myYACS->SetCaseName( nomCas ) ; - // D.2. Defaut - int defaut_i ; - // D.2.1. Type constant - myYACS->SetType( 1 ) ; - // D.2.2. Convergence - defaut_i = GetYACSMaxIter() ; - myYACS->SetMaxIter( defaut_i ) ; - defaut_i = GetYACSMaxNode() ; - myYACS->SetMaxNode( defaut_i ) ; - defaut_i = GetYACSMaxElem() ; - myYACS->SetMaxElem( defaut_i ) ; - // 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 ; - XMLFile = dirnamecase + "/schema.xml" ; - myYACS->SetXMLFile( XMLFile.c_str() ) ; - - return HOMARD::HOMARD_YACS::_duplicate(myYACS); -} -//============================================================================= -// Ecriture d'un schema YACS -//============================================================================= -CORBA::Long HOMARD_Gen_i::YACSWrite(const char* nomYACS) -{ - INFOS ( "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 - std::string XMLFile ; - XMLFile = myYACS->GetXMLFile() ; - - int codret = YACSWriteOnFile(nomYACS, XMLFile.c_str()) ; - - return codret ; -} -//============================================================================= -// Ecriture d'un schema YACS sur un fichier donne -//============================================================================= -CORBA::Long HOMARD_Gen_i::YACSWriteOnFile(const char* nomYACS, const char* XMLFile) -{ - INFOS ( "YACSWriteOnFile : Ecriture de " << nomYACS << " sur " << XMLFile ); - - // A. Prealable - int codret = 0; - - // B. L'objet YACS - // B.1. L'objet - HOMARD::HOMARD_YACS_var myYACS = myStudyContext._mesYACSs[nomYACS]; - ASSERT(!CORBA::is_nil(myYACS)); - // B.2. Les caracteristiques - std::string DirName = myYACS->GetDirName() ; - std::string MeshFile = myYACS->GetMeshFile() ; - std::string ScriptFile = myYACS->GetScriptFile() ; - // B.3. Les caracteristiques de convergence - int MaxIter = myYACS->GetMaxIter() ; - int MaxNode = myYACS->GetMaxNode() ; - int MaxElem = myYACS->GetMaxElem() ; - - // C. Le cas - // C.1. L'objet cas - const char* nomCas = myYACS->GetCaseName(); - HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; - ASSERT(!CORBA::is_nil(myCase)); - // C.2. Les instructions python associees au cas - CORBA::String_var dumpCorbaCase = myCase->GetDumpPython(); - std::string pythonCas = dumpCorbaCase.in(); - MESSAGE ("pythonCas :\n"<GetIter0() ; - std::string Iter0Name = myCase->GetIter0Name() ; - MESSAGE (". Iter0Name = " << Iter0Name); - std::string MeshName = Iter0->GetMeshName(); - MESSAGE (". MeshName = " << MeshName); - // D.2. L'iteration numero 1 - HOMARD::listeIterFilles* maListe = Iter0->GetIterations(); - int numberOfIter = maListe->length(); - if ( numberOfIter > 1 ) - { - MESSAGE (". numberOfIter = " << numberOfIter); - SALOME::ExceptionStruct es ; - es.type = SALOME::BAD_PARAM; - std::string text = "Une seule iteration est permise." ; - es.text = CORBA::string_dup(text.c_str()); - throw SALOME::SALOME_Exception(es); - return 0; - } - std::string Iter1Name = std::string((*maListe)[0]); - MESSAGE ("... Iter1Name = " << Iter1Name); - HOMARD::HOMARD_Iteration_var Iter1 = GetIteration(Iter1Name.c_str()) ; - // D.3. Les instructions python associees a l'iteration - CORBA::String_var dumpCorbaIter = Iter1->GetDumpPython(); - std::string pythonIter = dumpCorbaIter.in(); - MESSAGE ("pythonIter :\n"<GetHypoName(); - MESSAGE (". nomHypo = " << nomHypo); - HOMARD::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypo]; - ASSERT(!CORBA::is_nil(myHypo)); - // E.2. Les caracteristiques de l'adaptation - HOMARD::listeTypes* ListTypes = myHypo->GetAdapRefinUnRef(); - ASSERT(ListTypes->length() == 3); - int TypeAdap = (*ListTypes)[0]; -// int TypeRaff = (*ListTypes)[1]; -// int TypeDera = (*ListTypes)[2]; - // E.3. Les instructions python associees a l'hypothese - CORBA::String_var dumpCorbaHypo = myHypo->GetDumpPython(); - std::string pythonHypo = dumpCorbaHypo.in(); - MESSAGE ("pythonHypo :\n"<Texte_DataInit_MeshFile(MeshFile); } - // G.1.3. Le script de lancement - else if ( mot_cle == "Alternance_Calcul_HOMARD_Calcul" ) - { myDriver->Texte_Alternance_Calcul_HOMARD_Calcul(ScriptFile); } - // G.1.4. Les options du cas - else if ( mot_cle == "Iter_1_Case_Options" ) - { myDriver->Texte_Iter_1_Case_Options(pythonCas); } - // 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 ; - 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 - else if ( mot_cle == "HOMARD_Exec_Hypo_Options" ) - { myDriver->Texte_python_1( pythonHypo, 3, "Hypo" ) ; } - // G.1.8. Execution de HOMARD : les options de l'iteration - else if ( mot_cle == "HOMARD_Exec_Iter_Options" ) - { myDriver->Texte_python_2( pythonIter, "TimeStep", "Iter" ) ; } - // G.1.9. a. Creation eventuelles des zones et frontieres - // b. Enchainement - else if ( mot_cle == "Iter_1" ) - { - std::string texte_control = "" ; - if ( TypeAdap == 0 ) { texte_control += YACSDriverTexteZone( myHypo, myDriver ) ; } - texte_control += YACSDriverTexteBoundary( myCase, myDriver ) ; - texte_control += myDriver->Texte_Iter_1_control() ; - myDriver->TexteAdd(texte_control); - } - // G.1.10. Les tests de convergence - else if ( mot_cle == "Analyse_Test_Convergence" ) - { myDriver->TexteAnalyse_Test_Convergence(MaxIter, MaxNode, MaxElem); } - // G.1.11. Les parametres - else if ( mot_cle == "PARAMETRES" ) - { myDriver->TexteAddParametres(); } - // G.1.n. La ligne est recopiee telle quelle - else { myDriver->TexteAdd(ligne); } - } - // G.2. Ecriture du texte dans le fichier - if ( codret == 0 ) - { myDriver->CreeFichier(); } - } - else - { - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - std::string text = "The reference file for the YACS schema cannot be read." ; - es.text = CORBA::string_dup(text.c_str()); - throw SALOME::SALOME_Exception(es); - } - - delete myDriver; - - // H. Publication du fichier dans l'arbre - - std::string Commentaire = "xml" ; - PublishFileUnderYACS(nomYACS, XMLFile, Commentaire.c_str()); - - return codret ; -} -//============================================================================= -// Ecriture d'un schema YACS : ecriture des zones associees a une hypothese -//============================================================================= -std::string HOMARD_Gen_i::YACSDriverTexteZone(HOMARD::HOMARD_Hypothesis_var myHypo, YACSDriver* myDriver) -{ - MESSAGE ( "YACSDriverTexteZone" ); - // A. Les zones associees a cette hypothese - HOMARD::listeZonesHypo* ListZone = myHypo->GetZones(); - int numberOfZonesx2 = ListZone->length(); - - // B. Parcours des zones - std::string texte_control ; - for (int iaux = 0; iaux< numberOfZonesx2; iaux++) - { - // 1. Reperage de la zone - std::string ZoneName = std::string((*ListZone)[iaux]); - MESSAGE ( "\n. ZoneName = " << ZoneName << " - " <GetDumpPython(); - std::string pythonStructure_0 = dumpCorbaZone.in(); - MESSAGE ("pythonStructure_0 :"<GetBoundaryGroup(); - int numberOfitems = ListBoundaryGroupType->length(); - - // B. Parcours des frontieres - std::string texte_control ; - std::list ListeBoundaryTraitees ; - for (int NumBoundary = 0; NumBoundary< numberOfitems; NumBoundary=NumBoundary+2) - { - std::string BoundaryName = std::string((*ListBoundaryGroupType)[NumBoundary]); - MESSAGE ( "... BoundaryName = " << BoundaryName); - // Attention a n'ecrire la definition qu'une seule fois car elle peut se trouver - // plusieurs fois dans la definition du cas, d'ou la liste ListeBoundaryTraitees - int A_faire = 1 ; - std::list::const_iterator it = ListeBoundaryTraitees.begin(); - while (it != ListeBoundaryTraitees.end()) - { - MESSAGE ( "..... BoundaryNameTraitee = " << *it); - if ( BoundaryName == *it ) { A_faire = 0 ; } - it++; - } - if ( A_faire == 1 ) - { - // 1. Caracteristiques de la frontiere - HOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; - ASSERT(!CORBA::is_nil(myBoundary)); - // 2. Les instructions python associees a la frontiere - // La premiere ligne est un commentaire a eliminer - // La seconde ligne est l'instruction a proprement parler ; on ne garde que ce qui suit le "." - CORBA::String_var dumpCorbaBoundary = myBoundary->GetDumpPython(); - std::string pythonStructure_0 = dumpCorbaBoundary.in(); - MESSAGE ("pythonStructure_0 :"<URL())); - aFileName += "_HOMARD.dat"; - - // initialize sequence of file names - 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; - - // save data - // -> create file - std::ofstream f(aFileName.c_str()); - - // clear temporary id map - context._idmap.clear(); - - int id = 1; - - // -> save cases - std::map::const_iterator it_case; - for (it_case = context._mesCas.begin(); it_case != context._mesCas.end(); ++it_case) { - HOMARD::HOMARD_Cas_var aCas = it_case->second; - PortableServer::ServantBase_var aServant = GetServant(aCas); - HOMARD_Cas_i* aCasServant = dynamic_cast(aServant.in()); - if (aCasServant) { - f << HOMARD::GetSignature(HOMARD::Case) << aCasServant->Dump() << std::endl; - context._idmap[id++] = dynamic_cast(aCasServant); - } - } - // -> save zones - std::map::const_iterator it_zone; - for (it_zone = context._mesZones.begin(); it_zone != context._mesZones.end(); ++it_zone) { - HOMARD::HOMARD_Zone_var aZone = it_zone->second; - PortableServer::ServantBase_var aServant = GetServant(aZone); - HOMARD_Zone_i* aZoneServant = dynamic_cast(aServant.in()); - if (aZoneServant) { - f << HOMARD::GetSignature(HOMARD::Zone) << aZoneServant->Dump() << std::endl; - context._idmap[id++] = dynamic_cast(aZoneServant); - } - } - // -> save hypotheses - std::map::const_iterator it_hypo; - for (it_hypo = context._mesHypotheses.begin(); it_hypo != context._mesHypotheses.end(); ++it_hypo) { - HOMARD::HOMARD_Hypothesis_var aHypo = it_hypo->second; - PortableServer::ServantBase_var aServant = GetServant(aHypo); - HOMARD_Hypothesis_i* aHypoServant = dynamic_cast(aServant.in()); - if (aHypoServant) { - f << HOMARD::GetSignature(HOMARD::Hypothesis) << aHypoServant->Dump() << std::endl; - context._idmap[id++] = dynamic_cast(aHypoServant); - } - } - // -> save iterations - std::map::const_iterator it_iter; - for (it_iter = context._mesIterations.begin(); it_iter != context._mesIterations.end(); ++it_iter) { - HOMARD::HOMARD_Iteration_var aIter = it_iter->second; - PortableServer::ServantBase_var aServant = GetServant(aIter); - HOMARD_Iteration_i* aIterServant = dynamic_cast(aServant.in()); - if (aIterServant) { - f << HOMARD::GetSignature(HOMARD::Iteration) << aIterServant->Dump() << std::endl; - context._idmap[id++] = dynamic_cast(aIterServant); - } - } - // -> save boundaries - std::map::const_iterator it_boundary; - for (it_boundary = context._mesBoundarys.begin(); it_boundary != context._mesBoundarys.end(); ++it_boundary) { - HOMARD::HOMARD_Boundary_var aBoundary = it_boundary->second; - PortableServer::ServantBase_var aServant = GetServant(aBoundary); - HOMARD_Boundary_i* aBoundaryServant = dynamic_cast(aServant.in()); - if (aBoundaryServant) { - f << HOMARD::GetSignature(HOMARD::Boundary) << aBoundaryServant->Dump() << std::endl; - context._idmap[id++] = dynamic_cast(aBoundaryServant); - } - } - // -> close file - MESSAGE ("close file"); - f.close(); - - // put temporary files to the stream - MESSAGE ("put temporary files to the stream"); - 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, true); - - // return data stream - MESSAGE ("return data stream"); - return aStreamFile._retn(); -}; - -//=========================================================================== -SALOMEDS::TMPFile* HOMARD_Gen_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent, - const char* theURL, - CORBA::Boolean isMultiFile) -{ - // No specific ASCII persistence - SALOMEDS::TMPFile_var aStreamFile = Save(theComponent, theURL, isMultiFile); - return aStreamFile._retn(); -}; - -//=========================================================================== -CORBA::Boolean HOMARD_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile& theStream, - const char* theURL, - CORBA::Boolean isMultiFile) -{ - MESSAGE ("Load pour theURL = "<< theURL); - - // set current study - if (myStudy->_is_nil()) - UpdateStudy(); - - // get temporary directory name - std::string tmpDir = isMultiFile ? std::string(theURL) : SALOMEDS_Tool::GetTmpDir(); - - // Convert the stream into sequence of files to process - 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(Kernel_Utils::encode(SMESH_Gen_i::getStudyServant()->URL())); - aFileName = tmpDir + aFileName + "_HOMARD.dat"; - - StudyContext& context = myStudyContext; - - // save data - // -> create file - std::ifstream f(aFileName.c_str()); - - // clear context - context._mesCas.clear(); - context._mesHypotheses.clear(); - context._mesIterations.clear(); - context._mesZones.clear(); - context._mesBoundarys.clear(); - context._idmap.clear(); - - int id = 1; - std::string line; - - while (f) { - std::getline(f, line); - std::string bounSignature = HOMARD::GetSignature(HOMARD::Boundary); - std::string caseSignature = HOMARD::GetSignature(HOMARD::Case); - std::string hypoSignature = HOMARD::GetSignature(HOMARD::Hypothesis); - std::string iterSignature = HOMARD::GetSignature(HOMARD::Iteration); - std::string zoneSignature = HOMARD::GetSignature(HOMARD::Zone); - std::string yacsSignature = HOMARD::GetSignature(HOMARD::YACS); - if (line.substr(0, bounSignature.size()) == bounSignature) { - // re-create boundary - MESSAGE ("Recreation de la frontiere" ); - HOMARD::HOMARD_Boundary_var aBoundary = newBoundary(); - PortableServer::ServantBase_var aServant = GetServant(aBoundary); - HOMARD_Boundary_i* aBoundaryServant = dynamic_cast(aServant.in()); - if (aBoundaryServant && aBoundaryServant->Restore(line.substr(bounSignature.size()))) { - context._mesBoundarys[aBoundary->GetName()] = aBoundary; - context._idmap[id] = dynamic_cast(aBoundaryServant); - } - } - else if (line.substr(0, caseSignature.size()) == caseSignature) { - // re-create case - MESSAGE ("Recreation du cas" ); - HOMARD::HOMARD_Cas_var aCase = newCase(); - PortableServer::ServantBase_var aServant = GetServant(aCase); - HOMARD_Cas_i* aCaseServant = dynamic_cast(aServant.in()); - if (aCaseServant && aCaseServant->Restore(line.substr(caseSignature.size()))) { - context._mesCas[aCase->GetName()] = aCase; - context._idmap[id] = dynamic_cast(aCaseServant); - } - } - else if (line.substr(0, hypoSignature.size()) == hypoSignature) { - // re-create hypothesis - MESSAGE ("Recreation de l hypothese" ); - HOMARD::HOMARD_Hypothesis_var aHypo = newHypothesis(); - PortableServer::ServantBase_var aServant = GetServant(aHypo); - HOMARD_Hypothesis_i* aHypoServant = dynamic_cast(aServant.in()); - if (aHypoServant && aHypoServant->Restore(line.substr(hypoSignature.size()))) { - context._mesHypotheses[aHypo->GetName()] = aHypo; - context._idmap[id] = dynamic_cast(aHypoServant); - } - } - else if (line.substr(0, iterSignature.size()) == iterSignature) { - // re-create iteration - MESSAGE ("Recreation de l'iteration" ); - HOMARD::HOMARD_Iteration_var aIter = newIteration(); - PortableServer::ServantBase_var aServant = GetServant(aIter); - HOMARD_Iteration_i* aIterServant = dynamic_cast(aServant.in()); - if (aIterServant && aIterServant->Restore(line.substr(iterSignature.size()))) { - context._mesIterations[aIter->GetName()] = aIter; - context._idmap[id] = dynamic_cast(aIterServant); - } - } - else if (line.substr(0, zoneSignature.size()) == zoneSignature) { - MESSAGE ("Recreation de la zone" ); - // re-create zone - HOMARD::HOMARD_Zone_var aZone = newZone(); - PortableServer::ServantBase_var aServant = GetServant(aZone); - HOMARD_Zone_i* aZoneServant = dynamic_cast(aServant.in()); - if (aZoneServant && aZoneServant->Restore(line.substr(zoneSignature.size()))) { - context._mesZones[aZone->GetName()] = aZone; - context._idmap[id] = dynamic_cast(aZoneServant); - } - } - else if (line.substr(0, zoneSignature.size()) == yacsSignature) { - MESSAGE ("Recreation du schema YACS" ); - // re-create YACS - HOMARD::HOMARD_YACS_var aYACS = newYACS(); - PortableServer::ServantBase_var aServant = GetServant(aYACS); - HOMARD_YACS_i* aYACSServant = dynamic_cast(aServant.in()); - if (aYACSServant && aYACSServant->Restore(line.substr(yacsSignature.size()))) { - context._mesYACSs[aYACS->GetName()] = aYACS; - context._idmap[id] = dynamic_cast(aYACSServant); - } - } - id++; - } - - // -> close file - f.close(); - - // Remove temporary files created from the stream - if (!isMultiFile) - SALOMEDS_Tool::RemoveTemporaryFiles(tmpDir.c_str(), aFileSeq, true); - - return true; -}; - -//=========================================================================== -CORBA::Boolean HOMARD_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile& theStream, - const char* theURL, - CORBA::Boolean isMultiFile) -{ - // No specific ASCII persistence - return Load(theComponent, theStream, theURL, isMultiFile); -}; - -//=========================================================================== -void HOMARD_Gen_i::Close(SALOMEDS::SComponent_ptr theComponent) -{ -}; - -//=========================================================================== -char* HOMARD_Gen_i::ComponentDataType() -{ - return CORBA::string_dup("HOMARD"); -}; - -//=========================================================================== -char* HOMARD_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, - const char* IORString, - CORBA::Boolean isMultiFile, - CORBA::Boolean isASCII) -{ - CORBA::String_var aString(""); - if (!CORBA::is_nil(theSObject) && strcmp(IORString, "") != 0) { - StudyContext context = myStudyContext; - CORBA::Object_var anObj = _orb->string_to_object(IORString); - if (!CORBA::is_nil(anObj)) { - PortableServer::ServantBase_var aServant = GetServant(anObj); - PortableServer::ServantBase* aStorable = dynamic_cast(aServant.in()); - if (aStorable) { - std::map::const_iterator it; - for (it = context._idmap.begin(); it != context._idmap.end(); ++it) { - if (it->second == aStorable) { - std::stringstream os; - os << it->first; - aString = CORBA::string_dup(os.str().c_str()); - } - } - } - } - } - return aString._retn(); -}; - -//=========================================================================== -char* HOMARD_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, - const char* aLocalPersistentID, - CORBA::Boolean isMultiFile, - CORBA::Boolean isASCII) -{ - CORBA::String_var aString(""); - if (!CORBA::is_nil(theSObject) && strcmp(aLocalPersistentID, "") != 0) { - StudyContext context = myStudyContext; - int id = atoi(aLocalPersistentID); - if (id > 0 && context._idmap.find(id) != context._idmap.end()) { - CORBA::Object_var object = _poa->servant_to_reference(context._idmap[ id ]); - if (!CORBA::is_nil(object)) { - aString = _orb->object_to_string(object); - } - } - } - return aString._retn(); -}; - -//=========================================================================== -CORBA::Boolean HOMARD_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR) -{ - if(CORBA::is_nil(myStudy)) - return false; - - HOMARD::HOMARD_Cas_var aCas = HOMARD::HOMARD_Cas::_narrow(theIOR); - if(!aCas->_is_nil()) - return true; - - HOMARD::HOMARD_Hypothesis_var aHypo = HOMARD::HOMARD_Hypothesis::_narrow(theIOR); - if(!aHypo->_is_nil()) - return true; - - HOMARD::HOMARD_Zone_var aZone = HOMARD::HOMARD_Zone::_narrow(theIOR); - if(!aZone->_is_nil()) - return true; - - HOMARD::HOMARD_Boundary_var aBoundary = HOMARD::HOMARD_Boundary::_narrow(theIOR); - if(!aBoundary->_is_nil()) - return true; - - /* Iteration is not published directly - HOMARD::HOMARD_Iteration_var aIter = HOMARD::HOMARD_Iteration::_narrow(theIOR); - if(!aIter->_is_nil()) - return true; - */ - return false; -}; - -//=========================================================================== -CORBA::Boolean HOMARD_Gen_i::CanCopy(SALOMEDS::SObject_ptr theObject) -{ - // No Copy/Paste support - return false; -}; - -//=========================================================================== -SALOMEDS::TMPFile* HOMARD_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, - CORBA::Long& theObjectID) -{ - // No Copy/Paste support - SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(0); - return aStreamFile._retn(); -}; - -//=========================================================================== -CORBA::Boolean HOMARD_Gen_i::CanPaste(const char *theComponentName, - CORBA::Long theObjectID) -{ - // No Copy/Paste support - return false; -}; - -//=========================================================================== -SALOMEDS::SObject_ptr HOMARD_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream, - CORBA::Long theObjectID, - SALOMEDS::SObject_ptr theSObject) -{ - // No Copy/Paste support - SALOMEDS::SObject_var aResultSO; - return aResultSO._retn(); -}; - -//=========================================================================== -PortableServer::ServantBase_var HOMARD_Gen_i::GetServant(CORBA::Object_ptr theObject) -{ - PortableServer::Servant aServant = 0; - if (!CORBA::is_nil(theObject)) { - try { - aServant = _poa->reference_to_servant(theObject); - } - catch (...) { - } - } - return aServant; -} - -//========================================================================== -Engines::TMPFile* HOMARD_Gen_i::DumpPython(CORBA::Boolean isPublished, - CORBA::Boolean isMultiFile, - CORBA::Boolean& isValidScript) -{ - MESSAGE ("Entree dans DumpPython"); - isValidScript=1; - - SALOMEDS::SObject_var aSO = SMESH_Gen_i::getStudyServant()->FindComponent("HOMARD"); - if(CORBA::is_nil(aSO)) - return new Engines::TMPFile(0); - - std::string aScript = "\"\"\"\n"; - aScript += "Python script for HOMARD\n"; - aScript += "Copyright 1996, 2011, 2015 EDF\n"; - aScript += "\"\"\"\n"; - aScript += "__revision__ = \"V1.2\"\n"; - aScript += "import HOMARD\n"; - if( isMultiFile ) - aScript += "import salome\n"; - aScript += "homard = salome.lcc.FindOrLoadComponent('FactoryServer','HOMARD')\n"; - aScript += "\thomard.UpdateStudy()\n"; - MESSAGE (". Au depart \n"< 0) - { - MESSAGE (". Ecritures des frontieres"); - aScript += "#\n# Creation of the boundaries"; - aScript += "\n# =========================="; - } - std::map::const_iterator it_boundary; - for (it_boundary = myStudyContext._mesBoundarys.begin(); - it_boundary != myStudyContext._mesBoundarys.end(); ++it_boundary) - { - HOMARD::HOMARD_Boundary_var maBoundary = (*it_boundary).second; - CORBA::String_var dumpCorbaBoundary = maBoundary->GetDumpPython(); - std::string dumpBoundary = dumpCorbaBoundary.in(); - MESSAGE (dumpBoundary<<"\n"); - aScript += dumpBoundary; - } - - - if (myStudyContext._mesZones.size() > 0) - { - MESSAGE (". Ecritures des zones"); - aScript += "#\n# Creation of the zones"; - aScript += "\n# ====================="; - } - std::map::const_iterator it_zone; - for ( it_zone = myStudyContext._mesZones.begin(); - it_zone != myStudyContext._mesZones.end(); ++it_zone) - { - HOMARD::HOMARD_Zone_var myZone = (*it_zone).second; - CORBA::String_var dumpCorbaZone = myZone->GetDumpPython(); - std::string dumpZone = dumpCorbaZone.in(); - MESSAGE (dumpZone<<"\n"); - aScript += dumpZone; - } - - - if (myStudyContext._mesHypotheses.size() > 0) - { - MESSAGE (". Ecritures des hypotheses"); - aScript += "#\n# Creation of the hypotheses"; - aScript += "\n# =========================="; - } - std::map::const_iterator it_hypo; - for ( it_hypo = myStudyContext._mesHypotheses.begin(); - it_hypo != myStudyContext._mesHypotheses.end(); it_hypo++) - { - HOMARD::HOMARD_Hypothesis_var monHypo = (*it_hypo).second; - CORBA::String_var dumpCorbaHypo = monHypo->GetDumpPython(); - std::string dumpHypo = dumpCorbaHypo.in(); - MESSAGE (dumpHypo<<"\n"); - aScript += dumpHypo; - } - - - if (myStudyContext._mesCas.size() > 0) - { - MESSAGE (". Ecritures des cas"); - aScript += "#\n# Creation of the cases"; - aScript += "\n# ====================="; - } - std::map::const_iterator it_cas; - for (it_cas = myStudyContext._mesCas.begin(); - it_cas != myStudyContext._mesCas.end(); it_cas++) - { - std::string nomCas = (*it_cas).first; - std::string dumpCas = std::string("\n# Creation of the case ") ; - dumpCas += nomCas + std::string("\n"); - dumpCas += std::string("\t") + nomCas; - dumpCas += std::string(" = homard.CreateCase(\"") + nomCas + std::string("\", \""); - - HOMARD::HOMARD_Cas_var myCase = (*it_cas).second; - CORBA::String_var cIter0= myCase->GetIter0Name(); - std::string iter0 = cIter0.in(); - - HOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[iter0]; - CORBA::String_var cMesh0= myIteration->GetMeshFile(); - std::string mesh0 = cMesh0.in(); - CORBA::String_var cMeshName0= myIteration->GetMeshName(); - std::string meshName0 = cMeshName0.in(); - dumpCas += meshName0 + std::string("\", \"")+ mesh0 + std::string("\")\n"); - CORBA::String_var dumpCorbaCase = myCase->GetDumpPython(); - std::string dumpCas2= dumpCorbaCase.in(); - - MESSAGE (dumpCas< 0) - { - MESSAGE (". Ecritures des iterations"); - aScript += "#\n# Creation of the iterations" ; - aScript += "\n# =========================="; - } - std::map::const_iterator it_iter; - for (it_iter = myStudyContext._mesIterations.begin(); - it_iter != myStudyContext._mesIterations.end(); ++it_iter) - { - HOMARD::HOMARD_Iteration_var aIter = (*it_iter).second; - CORBA::String_var dumpCorbaIter = aIter->GetDumpPython(); - std::string dumpIter = dumpCorbaIter.in(); - MESSAGE (dumpIter<<"\n"); - aScript += dumpIter; - } - - - if (myStudyContext._mesYACSs.size() > 0) - { - MESSAGE (". Ecritures des schemas YACS"); - aScript += "#\n# Creation of the schemas YACS"; - aScript += "\n# ============================"; - } - std::map::const_iterator it_yacs; - for ( it_yacs = myStudyContext._mesYACSs.begin(); - it_yacs != myStudyContext._mesYACSs.end(); ++it_yacs) - { - HOMARD::HOMARD_YACS_var myYACS = (*it_yacs).second; - CORBA::String_var dumpCorbaYACS = myYACS->GetDumpPython(); - std::string dumpYACS = dumpCorbaYACS.in(); - MESSAGE (dumpYACS<<"\n"); - aScript += dumpYACS; - } - - MESSAGE (". Ecritures finales"); - if( isMultiFile ) - aScript += "\n\tpass"; - aScript += "\n"; - - if( !isMultiFile ) // remove unnecessary tabulation - aScript = RemoveTabulation( aScript ); - -// MESSAGE ("A ecrire \n"<::const_iterator it; - for (it = myStudyContext._mesCas.begin(); - it != myStudyContext._mesCas.end(); it++) - { - if (std::string(nomDir) == std::string(it->second->GetDirName())) - { - casename = std::string(it->second->GetName()) ; - break ; - } - } - return CORBA::string_dup( casename.c_str() ); -} -/*//============================================================================= -void SALOMEException( std::string message ) -{ - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - es.text = message; - throw SALOME::SALOME_Exception(es); - return ; -}*/ -//============================================================================= -char* HOMARD_Gen_i::getVersion() -{ -#if HOMARD_DEVELOPMENT - return CORBA::string_dup(SMESH_VERSION_STR"dev"); -#else - return CORBA::string_dup(SMESH_VERSION_STR); -#endif -} -//=============================================================================== -// Recuperation de la chaine de caracteres par rapport a l'apparition d'un caractere -// ligne : la ligne a manipuler -// caractere : le caractere a reperer -// option : 0 : la chaine avant la premiere apparition du caractere -// 1 : la chaine apres la premiere apparition du caractere -// 2 : la chaine avant la derniere apparition du caractere -// 3 : la chaine apres la derniere apparition du caractere -// Si le caractere est absent, on retourne la chaine totale -//=============================================================================== -std::string HOMARD_Gen_i::GetStringInTexte( const std::string ligne, const std::string caractere, int option ) -{ -// MESSAGE("GetStringInTexte, recherche de '"<> mot_cle ; - chaine = GetStringInTexte ( mot_cle, "\"", 1 ) ; - chaine = GetStringInTexte ( chaine, "\"", 0 ) ; - if ( chaine == "language" ) { section_langue = true ; } - if ( chaine == "HOMARD" ) { section_homard = true ; } - // MESSAGE ( "section_langue = "<" ) - { /*MESSAGE ( "Fin de la section : "<< ligne<<", section_langue = "<> PublisMeshIN ; } - if ( chaine2 == "publish_mesh_out" ) { chainebis >> PublisMeshOUT ; } - // 3.2.2. Les maximum pour YACS - if ( chaine2 == "yacs_max_iter" ) { chainebis >> YACSMaxIter ; } - if ( chaine2 == "yacs_max_node" ) { chainebis >> YACSMaxNode ; } - if ( chaine2 == "yacs_max_elem" ) { chainebis >> YACSMaxElem ; } - if ( chaine2 == "yacs_type_test" ) { YACSTypeTestchaine = chaine ; } - } - } - } - } - } - - // C. Enregistrements - MESSAGE ("Enregistrement de LanguageShort = " << LanguageShort ); - SetLanguageShort( LanguageShort.c_str() ) ; - - MESSAGE ("Enregistrement de PublisMeshIN = " << PublisMeshIN<<", PublisMeshOUT = "<< PublisMeshOUT); - SetPublisMesh(PublisMeshIN, PublisMeshOUT) ; - - MESSAGE ("Enregistrement de YACSMaxIter = " << YACSMaxIter<<", YACSMaxNode = "<< YACSMaxNode<<", YACSMaxElem = "<< YACSMaxElem); - SetYACSMaximum(YACSMaxIter, YACSMaxNode, YACSMaxElem) ; - - MESSAGE ("Enregistrement de TypeTest = " << YACSTypeTestchaine.c_str() ); - int YACSTypeTest ; - if ( ( YACSTypeTestchaine == "VTest > VRef" ) || ( YACSTypeTestchaine == "VTest > VRef" ) ) { YACSTypeTest = 1 ; } - else if ( ( YACSTypeTestchaine == "VTest < VRef" ) || ( YACSTypeTestchaine == "VTest < VRef" ) ) { YACSTypeTest = 2 ; } - else { YACSTypeTest = 0 ; } - MESSAGE ("==> TypeTest = " << YACSTypeTest ); - SetYACSConvergenceType( YACSTypeTest ) ; - - return ; -} -//=============================================================================== -// Langue de SALOME -//=============================================================================== -void HOMARD_Gen_i::SetLanguageShort(const char* LanguageShort) -{ -// MESSAGE ("SetLanguageShort pour LanguageShort = " << LanguageShort ); - _LangueShort = LanguageShort ; - if ( _LangueShort == "fr" ) { _Langue = "Francais" ; } - else { _Langue = "English" ; } - return ; -} -char* HOMARD_Gen_i::GetLanguageShort() -{ -// MESSAGE ("GetLanguageShort"); - return CORBA::string_dup( _LangueShort.c_str() ); -} -//=============================================================================== -// Options de publications -//=============================================================================== -void HOMARD_Gen_i::SetPublisMesh(CORBA::Long PublisMeshIN, CORBA::Long PublisMeshOUT) -{ - _PublisMeshIN = PublisMeshIN ; - _PublisMeshOUT = PublisMeshOUT ; - return ; -} -CORBA::Long HOMARD_Gen_i::GetPublisMeshIN() -{ - return _PublisMeshIN ; -} -CORBA::Long HOMARD_Gen_i::GetPublisMeshOUT() -{ - return _PublisMeshOUT ; -} -//=============================================================================== -// YACS - test de convergence -//=============================================================================== -void HOMARD_Gen_i::SetYACSMaximum(CORBA::Long YACSMaxIter, CORBA::Long YACSMaxNode, CORBA::Long YACSMaxElem) -{ - _YACSMaxIter = YACSMaxIter ; - _YACSMaxNode = YACSMaxNode ; - _YACSMaxElem = YACSMaxElem ; - return ; -} -CORBA::Long HOMARD_Gen_i::GetYACSMaxIter() -{ - return _YACSMaxIter ; -} -CORBA::Long HOMARD_Gen_i::GetYACSMaxNode() -{ - return _YACSMaxNode ; -} -CORBA::Long HOMARD_Gen_i::GetYACSMaxElem() -{ - return _YACSMaxElem ; -} -void HOMARD_Gen_i::SetYACSConvergenceType(CORBA::Long YACSTypeTest) -{ - _YACSTypeTest = YACSTypeTest ; - return ; -} -CORBA::Long HOMARD_Gen_i::GetYACSConvergenceType() -{ - return _YACSTypeTest ; -} - -//============================================================================= -extern "C" -{ - HOMARDENGINE_EXPORT - PortableServer::ObjectId* ADAPTEngine_factory(CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId* contId, - const char* instanceName, - const char* interfaceName) - { - MESSAGE("PortableServer::ObjectId* ADAPTEngine_factory()"); - HOMARD_Gen_i* myHOMARD_Gen = new HOMARD_Gen_i(orb, poa, contId, instanceName, interfaceName); - return myHOMARD_Gen->getId(); - } -} diff --git a/src/ADAPT_I/HOMARD_Gen_i.hxx b/src/ADAPT_I/HOMARD_Gen_i.hxx deleted file mode 100644 index 10c07cec4..000000000 --- a/src/ADAPT_I/HOMARD_Gen_i.hxx +++ /dev/null @@ -1,347 +0,0 @@ -// 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 -// 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 _HOMARD_GEN_I_HXX_ -#define _HOMARD_GEN_I_HXX_ - -#include -#include CORBA_SERVER_HEADER(HOMARD_Gen) -#include CORBA_SERVER_HEADER(HOMARD_Cas) -#include CORBA_SERVER_HEADER(HOMARD_Hypothesis) -#include CORBA_SERVER_HEADER(HOMARD_Iteration) -#include CORBA_SERVER_HEADER(HOMARD_Zone) -#include CORBA_SERVER_HEADER(HOMARD_Boundary) -#include CORBA_SERVER_HEADER(HOMARD_YACS) -#include CORBA_CLIENT_HEADER(SALOMEDS) -#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) - -#include "HOMARD_i.hxx" -#include "HOMARD_Gen.hxx" -#include "HomardDriver.hxx" -#include "YACSDriver.hxx" -#include "FrontTrack.hxx" -#include "SALOME_Component_i.hxx" -#include "SALOME_NamingService.hxx" -#include "Utils_CorbaException.hxx" - -#include -#include - -class HOMARDENGINE_EXPORT HOMARD_Gen_i: - public virtual Engines_Component_i, - public virtual POA_HOMARD::HOMARD_Gen -{ -public: - HOMARD_Gen_i( CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId* contId, - const char* instanceName, - const char* interfaceName ); - virtual ~HOMARD_Gen_i(); - - -// Generalites - -// 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* 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, - CORBA::Double Rayon); - HOMARD::HOMARD_Boundary_ptr CreateBoundarySphere (const char* nomBoundary, - CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, - CORBA::Double Rayon); - HOMARD::HOMARD_Boundary_ptr CreateBoundaryConeR (const char* nomBoundary, - CORBA::Double Xcentre1, CORBA::Double Ycentre1, CORBA::Double Zcentre1, CORBA::Double Rayon1, - CORBA::Double Xcentre2, CORBA::Double Ycentre2, CORBA::Double Zcentre2, CORBA::Double Rayon2); - HOMARD::HOMARD_Boundary_ptr CreateBoundaryConeA (const char* nomBoundary, - CORBA::Double Xaxis, CORBA::Double Yaxis, CORBA::Double Zaxis, CORBA::Double Angle, - CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre); - HOMARD::HOMARD_Boundary_ptr CreateBoundaryTorus (const char* nomBoundary, - CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, - CORBA::Double Xaxis, CORBA::Double Yaxis, CORBA::Double Zaxis, - CORBA::Double RayonRev, CORBA::Double RayonPri); - - HOMARD::HOMARD_Cas_ptr CreateCase (const char* nomCas, const char* MeshName, const char* FileName); - HOMARD::HOMARD_Cas_ptr CreateCaseFromIteration (const char* nomCas, const char* DirNameStart); - HOMARD::HOMARD_Cas_ptr CreateCaseFromCaseLastIteration (const char* nomCas, const char* DirNameStart); - HOMARD::HOMARD_Cas_ptr CreateCaseFromCaseIteration (const char* nomCas, const char* DirNameStart, CORBA::Long Number); - HOMARD::HOMARD_Cas_ptr CreateCase0 (const char* nomCas, const char* MeshName, const char* FileName, CORBA::Long MeshOption, CORBA::Long NumeIter, CORBA::Long Option); - std::string CreateCase1 (const char* DirNameStart, CORBA::Long Number); - - HOMARD::HOMARD_Hypothesis_ptr CreateHypothesis(const char* nomHypothesis); - - HOMARD::HOMARD_Iteration_ptr CreateIteration (const char* nomIter, const char* nomIterParent); - - HOMARD::HOMARD_Zone_ptr CreateZone (const char* nomZone, CORBA::Long typeZone); - HOMARD::HOMARD_Zone_ptr CreateZoneBox (const char* nomZone, - CORBA::Double Xmini, CORBA::Double Xmaxi, - CORBA::Double Ymini, CORBA::Double Ymaxi, - CORBA::Double Zmini, CORBA::Double Zmaxi); - HOMARD::HOMARD_Zone_ptr CreateZoneBox2D (const char* nomZone, - CORBA::Double Umini, CORBA::Double Umaxi, - CORBA::Double Vmini, CORBA::Double Vmaxi, - CORBA::Long Orient); - HOMARD::HOMARD_Zone_ptr CreateZoneCylinder (const char* nomZone, - CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, - CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, - CORBA::Double Rayon, CORBA::Double Haut); - HOMARD::HOMARD_Zone_ptr CreateZoneDisk (const char* nomZone, - CORBA::Double Ucentre, CORBA::Double Vcentre, - CORBA::Double Rayon, - CORBA::Long Orient); - HOMARD::HOMARD_Zone_ptr CreateZoneDiskWithHole (const char* nomZone, - CORBA::Double Ucentre, CORBA::Double Vcentre, - CORBA::Double Rayon, CORBA::Double Rayonint, - CORBA::Long Orient); - HOMARD::HOMARD_Zone_ptr CreateZonePipe (const char* nomZone, - CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, - CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, - CORBA::Double Rayon, CORBA::Double Haut, CORBA::Double Rayonint); - HOMARD::HOMARD_Zone_ptr CreateZoneSphere (const char* nomZone, - CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, CORBA::Double Rayon); - -// Les informations - HOMARD::HOMARD_Boundary_ptr GetBoundary (const char* nomBoundary); - HOMARD::HOMARD_Cas_ptr GetCase (const char* nomCas); - HOMARD::HOMARD_Hypothesis_ptr GetHypothesis (const char* nomHypothesis); - HOMARD::HOMARD_Iteration_ptr GetIteration (const char* nomIteration); - HOMARD::HOMARD_YACS_ptr GetYACS (const char* nomYACS); - HOMARD::HOMARD_Zone_ptr GetZone (const char* nomZone); - - HOMARD::listeBoundarys* GetAllBoundarysName(); - HOMARD::listeCases* GetAllCasesName(); - HOMARD::listeHypotheses* GetAllHypothesesName(); - HOMARD::listeIterations* GetAllIterationsName(); - HOMARD::listeYACSs* GetAllYACSsName(); - HOMARD::listeZones* GetAllZonesName(); - - void MeshInfo (const char* nomCas, - const char* MeshName, const char* FileName, const char* DirName, - CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte); - - HOMARD::HOMARD_Iteration_ptr LastIteration (const char* nomCas); - -// L'etude - void UpdateStudy(); - void IsValidStudy(); - -// Liens entre structures - void InvalideBoundary(const char* nomBoundary); - void InvalideHypo(const char* nomHypo); - void InvalideIter(const char* nomIter); - void InvalideIterOption(const char* nomIter, CORBA::Long Option); - void InvalideIterInfo(const char* nomIter); - void InvalideYACS(const char* nomYACS); - void InvalideZone(const char* nomZone); - - CORBA::Long DeleteBoundary(const char* nomBoundary); - CORBA::Long DeleteCase(const char* nomCas, CORBA::Long Option); - CORBA::Long DeleteHypo(const char* nomHypothesis); - CORBA::Long DeleteIteration(const char* nomIter, CORBA::Long Option); - CORBA::Long DeleteIterationOption(const char* nomIter, CORBA::Long Option1, CORBA::Long Option2); - CORBA::Long DeleteYACS(const char* nomYACS, CORBA::Long Option); - CORBA::Long DeleteZone(const char* nomZone); - - void AssociateIterHypo(const char* nomIter, const char* nomHypothesis); - - void AssociateHypoZone(const char* nomHypothesis, const char* nomZone, CORBA::Long TypeUse); - void DissociateHypoZone(const char* nomHypothesis, const char* nomZone); - - void AssociateCaseIter(const char* nomCas, const char* nomIter, - const char* labelIter); - -// Actions - void SetEtatIter(const char* nomIter,const CORBA::Long Etat); - char* CreateDirNameIter(const char* nomrep, CORBA::Long num ); - - 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); - 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); - - void PublishFileUnderIteration(const char* NomIter, const char* NomFich, const char* Commentaire); - void PublishFileUnderYACS(const char* NomYACS, const char* NomFich, const char* Commentaire); - void PublishBoundaryUnderCase(const char* CaseName, const char* BoundaryName); - void PublishCaseUnderYACS(const char* YACSName, const char* CaseName); - void PublishResultInSmesh(const char* NomFich, CORBA::Long Option); - void DeleteResultInSmesh(std::string NomFich, std::string MeshName); - void PublishMeshIterInSmesh(const char* NomIter); - -// YACS - HOMARD::HOMARD_YACS_ptr CreateYACSSchema (const char* YACSName, const char* nomCas, const char* ScriptFile, const char* DirName, const char* MeshFile); - CORBA::Long YACSWrite(const char* nomYACS); - CORBA::Long YACSWriteOnFile(const char* nomYACS, const char* XMLFile); - std::string YACSDriverTexteZone(HOMARD::HOMARD_Hypothesis_var myHypo, YACSDriver* myDriver); - std::string YACSDriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, YACSDriver* myDriver); - -// Preferences - void SetPreferences() ; - void SetLanguageShort(const char* LanguageShort); - char* GetLanguageShort(); - void SetPublisMesh(CORBA::Long PublisMeshIN, CORBA::Long PublisMeshOUT); - CORBA::Long GetPublisMeshIN(); - CORBA::Long GetPublisMeshOUT(); - void SetYACSMaximum(CORBA::Long YACSMaxIter, CORBA::Long YACSMaxNode, CORBA::Long YACSMaxElem); - CORBA::Long GetYACSMaxIter(); - CORBA::Long GetYACSMaxNode(); - CORBA::Long GetYACSMaxElem(); - void SetYACSConvergenceType(CORBA::Long YACSTypeTest); - CORBA::Long GetYACSConvergenceType(); - - - // --------------------------------------------------------------- - // next functions are inherited from SALOMEDS::Driver interface - // --------------------------------------------------------------- - - // --> Persistence - virtual SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent, - const char* theURL, - CORBA::Boolean isMultiFile); - - virtual SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent, - const char* theURL, - CORBA::Boolean isMultiFile); - - virtual CORBA::Boolean Load(SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile& theStream, - const char* theURL, - CORBA::Boolean isMultiFile); - - virtual CORBA::Boolean LoadASCII(SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile& theStream, - const char* theURL, - CORBA::Boolean isMultiFile); - - virtual void Close(SALOMEDS::SComponent_ptr IORSComponent); - - virtual char* ComponentDataType(); - - virtual char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, - const char* IORString, - CORBA::Boolean isMultiFile, - CORBA::Boolean isASCII); - - virtual char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, - const char* aLocalPersistentID, - CORBA::Boolean isMultiFile, - CORBA::Boolean isASCII); - - // --> Data publishing - virtual CORBA::Boolean CanPublishInStudy(CORBA::Object_ptr theIOR); - - virtual SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::SObject_ptr theSObject, - CORBA::Object_ptr theObject, - const char* theName); - - // --> Copy/Paste - virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject); - - virtual SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, - CORBA::Long& theObjectID); - - virtual CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID); - - virtual SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream, - CORBA::Long theObjectID, - SALOMEDS::SObject_ptr theObject); - -// virtual void SALOMEException( std::string message ); - -private: - SALOMEDS::SObject_ptr PublishBoundaryInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, - HOMARD::HOMARD_Boundary_ptr theObject, const char* theName); - SALOMEDS::SObject_ptr PublishCaseInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, - HOMARD::HOMARD_Cas_ptr theObject, const char* theName); - SALOMEDS::SObject_ptr PublishHypotheseInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, - HOMARD::HOMARD_Hypothesis_ptr theObject, const char* theName); - SALOMEDS::SObject_ptr PublishYACSInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, - HOMARD::HOMARD_YACS_ptr theObject, const char* theName); - SALOMEDS::SObject_ptr PublishZoneInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, - HOMARD::HOMARD_Zone_ptr theObject, const char* theName); - virtual void PublishInStudyAttr(SALOMEDS::StudyBuilder_var aStudyBuilder, - SALOMEDS::SObject_var aResultSO, - const char* theName, const char* comment, const char* icone, const char* ior); - - PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject); - - HOMARD::HOMARD_Boundary_ptr newBoundary(); - HOMARD::HOMARD_Cas_ptr newCase(); - HOMARD::HOMARD_Hypothesis_ptr newHypothesis(); - HOMARD::HOMARD_Iteration_ptr newIteration(); - HOMARD::HOMARD_YACS_ptr newYACS(); - HOMARD::HOMARD_Zone_ptr newZone(); - - - virtual Engines::TMPFile* DumpPython(CORBA::Boolean isPublished, - CORBA::Boolean isMultiFile, - CORBA::Boolean& isValidScript); - - virtual char* getVersion(); - std::string GetStringInTexte( const std::string Texte, const std::string String, int option ) ; - -private: - struct StudyContext - { - std::map _mesBoundarys; - std::map _mesCas; - std::map _mesHypotheses; - std::map _mesIterations; - std::map _mesYACSs; - std::map _mesZones; - std::map _idmap; - }; - - ::HOMARD_Gen* myHomard; - SALOMEDS::Study_var myStudy; - StudyContext myStudyContext; - SALOME_NamingService* _NS; - - int _tag_gene ; - int _tag_boun ; - int _tag_hypo ; - int _tag_yacs ; - int _tag_zone ; - -// Preferences - std::string _Langue ; - std::string _LangueShort ; - int _PublisMeshIN ; - int _PublisMeshOUT ; - int _YACSMaxIter ; - int _YACSMaxNode ; - int _YACSMaxElem ; - int _YACSTypeTest ; - ; - -}; - -#endif diff --git a/src/ADAPT_I/HOMARD_Hypothesis_i.cxx b/src/ADAPT_I/HOMARD_Hypothesis_i.cxx index f9c5249f7..b039bc3a8 100644 --- a/src/ADAPT_I/HOMARD_Hypothesis_i.cxx +++ b/src/ADAPT_I/HOMARD_Hypothesis_i.cxx @@ -28,7 +28,7 @@ // #include "HOMARD_Hypothesis_i.hxx" -#include "HOMARD_Gen_i.hxx" +#include "ADAPT_Gen_i.hxx" #include "HOMARD_Hypothesis.hxx" #include "HOMARD_DriverTools.hxx" @@ -51,7 +51,7 @@ HOMARD_Hypothesis_i::HOMARD_Hypothesis_i() */ //============================================================================= HOMARD_Hypothesis_i::HOMARD_Hypothesis_i( CORBA::ORB_ptr orb, - HOMARD::HOMARD_Gen_var engine ) + ADAPT::ADAPT_Gen_var engine ) { MESSAGE( "standard constructor" ); _gen_i = engine; @@ -101,12 +101,12 @@ char* HOMARD_Hypothesis_i::GetDumpPython() //============================================================================= std::string HOMARD_Hypothesis_i::Dump() const { - return HOMARD::Dump( *myHomardHypothesis ); + return ADAPT::Dump( *myHomardHypothesis ); } //============================================================================= bool HOMARD_Hypothesis_i::Restore( const std::string& stream ) { - return HOMARD::Restore( *myHomardHypothesis, stream ); + return ADAPT::Restore( *myHomardHypothesis, stream ); } //============================================================================= //============================================================================= @@ -132,10 +132,10 @@ void HOMARD_Hypothesis_i::SetUnifRefinUnRef( CORBA::Long TypeRaffDera ) myHomardHypothesis->SetRefinTypeDera( TypeRaff, TypeDera ); } //============================================================================= -HOMARD::listeTypes* HOMARD_Hypothesis_i::GetAdapRefinUnRef() +ADAPT::listeTypes* HOMARD_Hypothesis_i::GetAdapRefinUnRef() { ASSERT( myHomardHypothesis ); - HOMARD::listeTypes_var aResult = new HOMARD::listeTypes; + ADAPT::listeTypes_var aResult = new ADAPT::listeTypes; aResult->length( 3 ); aResult[0] = CORBA::Long( myHomardHypothesis->GetAdapType() ); aResult[1] = CORBA::Long( myHomardHypothesis->GetRefinType() ); @@ -177,10 +177,10 @@ void HOMARD_Hypothesis_i::SetUseField( CORBA::Long UsField ) myHomardHypothesis->SetUseField( UsField ); } //============================================================================= -HOMARD::InfosHypo* HOMARD_Hypothesis_i::GetField() +ADAPT::InfosHypo* HOMARD_Hypothesis_i::GetField() { ASSERT( myHomardHypothesis ); - HOMARD::InfosHypo* aInfosHypo = new HOMARD::InfosHypo(); + ADAPT::InfosHypo* aInfosHypo = new ADAPT::InfosHypo(); aInfosHypo->FieldName = CORBA::string_dup( myHomardHypothesis->GetFieldName().c_str() ); aInfosHypo->TypeThR = CORBA::Long( myHomardHypothesis->GetRefinThrType() ); aInfosHypo->ThreshR = CORBA::Double( myHomardHypothesis->GetThreshR() ); @@ -214,11 +214,11 @@ void HOMARD_Hypothesis_i::SupprComps() myHomardHypothesis->SupprComps(); } //============================================================================= -HOMARD::listeComposantsHypo* HOMARD_Hypothesis_i::GetComps() +ADAPT::listeComposantsHypo* HOMARD_Hypothesis_i::GetComps() { ASSERT( myHomardHypothesis ); const std::list& ListString = myHomardHypothesis->GetComps(); - HOMARD::listeComposantsHypo_var aResult = new HOMARD::listeComposantsHypo; + ADAPT::listeComposantsHypo_var aResult = new ADAPT::listeComposantsHypo; aResult->length( ListString.size() ); std::list::const_iterator it; int i = 0; @@ -329,7 +329,7 @@ void HOMARD_Hypothesis_i::SupprGroups() myHomardHypothesis->SupprGroups(); } //============================================================================= -void HOMARD_Hypothesis_i::SetGroups(const HOMARD::ListGroupType& ListGroup) +void HOMARD_Hypothesis_i::SetGroups(const ADAPT::ListGroupType& ListGroup) { ASSERT( myHomardHypothesis ); std::list ListString; @@ -340,11 +340,11 @@ void HOMARD_Hypothesis_i::SetGroups(const HOMARD::ListGroupType& ListGroup) myHomardHypothesis->SetGroups( ListString ); } //============================================================================= -HOMARD::ListGroupType* HOMARD_Hypothesis_i::GetGroups() +ADAPT::ListGroupType* HOMARD_Hypothesis_i::GetGroups() { ASSERT( myHomardHypothesis ); const std::list& ListString = myHomardHypothesis->GetGroups(); - HOMARD::ListGroupType_var aResult = new HOMARD::ListGroupType; + ADAPT::ListGroupType_var aResult = new ADAPT::ListGroupType; aResult->length( ListString.size() ); std::list::const_iterator it; int i = 0; @@ -391,11 +391,11 @@ void HOMARD_Hypothesis_i::SupprFieldInterps() myHomardHypothesis->SupprFieldInterps(); } //============================================================================= -HOMARD::listeFieldInterpsHypo* HOMARD_Hypothesis_i::GetFieldInterps() +ADAPT::listeFieldInterpsHypo* HOMARD_Hypothesis_i::GetFieldInterps() { ASSERT( myHomardHypothesis ); const std::list& ListString = myHomardHypothesis->GetFieldInterps(); - HOMARD::listeFieldInterpsHypo_var aResult = new HOMARD::listeFieldInterpsHypo; + ADAPT::listeFieldInterpsHypo_var aResult = new ADAPT::listeFieldInterpsHypo; aResult->length( ListString.size() ); std::list::const_iterator it; int i = 0; @@ -434,11 +434,11 @@ void HOMARD_Hypothesis_i::UnLinkIteration( const char* NomIteration ) myHomardHypothesis->UnLinkIteration( NomIteration ); } //============================================================================= -HOMARD::listeIters* HOMARD_Hypothesis_i::GetIterations() +ADAPT::listeIters* HOMARD_Hypothesis_i::GetIterations() { ASSERT( myHomardHypothesis ); const std::list& ListString = myHomardHypothesis->GetIterations(); - HOMARD::listeIters_var aResult = new HOMARD::listeIters; + ADAPT::listeIters_var aResult = new ADAPT::listeIters; aResult->length( ListString.size() ); std::list::const_iterator it; int i = 0; @@ -490,11 +490,11 @@ void HOMARD_Hypothesis_i::SupprZones() myHomardHypothesis->SupprZones(); } //============================================================================= -HOMARD::listeZonesHypo* HOMARD_Hypothesis_i::GetZones() +ADAPT::listeZonesHypo* HOMARD_Hypothesis_i::GetZones() { ASSERT( myHomardHypothesis ); const std::list& ListString = myHomardHypothesis->GetZones(); - HOMARD::listeZonesHypo_var aResult = new HOMARD::listeZonesHypo; + ADAPT::listeZonesHypo_var aResult = new ADAPT::listeZonesHypo; aResult->length( ListString.size() ); std::list::const_iterator it; int i = 0; diff --git a/src/ADAPT_I/HOMARD_Hypothesis_i.hxx b/src/ADAPT_I/HOMARD_Hypothesis_i.hxx index 79c4e6b24..d5dc6f98e 100644 --- a/src/ADAPT_I/HOMARD_Hypothesis_i.hxx +++ b/src/ADAPT_I/HOMARD_Hypothesis_i.hxx @@ -31,7 +31,7 @@ #define _HOMARD_HYPOTHESIS_I_HXX_ #include -#include CORBA_SERVER_HEADER(HOMARD_Gen) +#include CORBA_SERVER_HEADER(ADAPT_Gen) #include CORBA_SERVER_HEADER(HOMARD_Hypothesis) #include "HOMARD_i.hxx" @@ -45,11 +45,11 @@ class HOMARD_Hypothesis; class HOMARDENGINE_EXPORT HOMARD_Hypothesis_i: public virtual Engines_Component_i, - public virtual POA_HOMARD::HOMARD_Hypothesis, + public virtual POA_ADAPT::HOMARD_Hypothesis, public virtual PortableServer::ServantBase { public: - HOMARD_Hypothesis_i( CORBA::ORB_ptr orb, HOMARD::HOMARD_Gen_var gen_i ); + HOMARD_Hypothesis_i( CORBA::ORB_ptr orb, ADAPT::ADAPT_Gen_var gen_i ); HOMARD_Hypothesis_i(); virtual ~HOMARD_Hypothesis_i(); @@ -67,7 +67,7 @@ public: // Caracteristiques void SetUnifRefinUnRef( CORBA::Long TypeRaffDera ); - HOMARD::listeTypes* GetAdapRefinUnRef(); + ADAPT::listeTypes* GetAdapRefinUnRef(); CORBA::Long GetAdapType(); CORBA::Long GetRefinType(); CORBA::Long GetUnRefType(); @@ -75,13 +75,13 @@ public: void SetField( const char* FieldName ); char* GetFieldName(); void SetUseField(CORBA::Long UsField); - HOMARD::InfosHypo* GetField(); + ADAPT::InfosHypo* GetField(); void SetUseComp(CORBA::Long UsCmpI); void AddComp( const char* NomComp ); void SupprComp( const char* NomComp ); void SupprComps(); - HOMARD::listeComposantsHypo* GetComps(); + ADAPT::listeComposantsHypo* GetComps(); void SetRefinThr(CORBA::Long TypeThR, CORBA::Double ThreshR); CORBA::Long GetRefinThrType(); @@ -103,8 +103,8 @@ public: void AddGroup( const char* Group); void SupprGroup( const char* Group ); void SupprGroups(); - void SetGroups(const HOMARD::ListGroupType& ListGroup); - HOMARD::ListGroupType* GetGroups(); + void SetGroups(const ADAPT::ListGroupType& ListGroup); + ADAPT::ListGroupType* GetGroups(); void SetTypeFieldInterp( CORBA::Long TypeFieldInterp ); CORBA::Long GetTypeFieldInterp(); @@ -112,7 +112,7 @@ public: void AddFieldInterpType( const char* FieldInterp, CORBA::Long TypeInterp ); void SupprFieldInterp( const char* FieldInterp ); void SupprFieldInterps(); - HOMARD::listeFieldInterpsHypo* GetFieldInterps(); + ADAPT::listeFieldInterpsHypo* GetFieldInterps(); // Liens avec les autres structures void SetCaseCreation( const char* NomCaseCreation ); @@ -120,19 +120,19 @@ public: void LinkIteration( const char* NomIteration ); void UnLinkIteration( const char* NomIteration ); - HOMARD::listeIters* GetIterations(); + ADAPT::listeIters* GetIterations(); void AddZone( const char* NomZone, CORBA::Long TypeUse ); void AddZone0( const char* NomZone, CORBA::Long TypeUse ); void SupprZone( const char* NomZone ); void SupprZones(); - HOMARD::listeZonesHypo* GetZones(); + ADAPT::listeZonesHypo* GetZones(); private: ::HOMARD_Hypothesis* myHomardHypothesis; CORBA::ORB_ptr _orb; - HOMARD::HOMARD_Gen_var _gen_i; + ADAPT::ADAPT_Gen_var _gen_i; }; #endif diff --git a/src/ADAPT_I/HOMARD_Iteration_i.cxx b/src/ADAPT_I/HOMARD_Iteration_i.cxx index 640c13062..5990a6b71 100644 --- a/src/ADAPT_I/HOMARD_Iteration_i.cxx +++ b/src/ADAPT_I/HOMARD_Iteration_i.cxx @@ -28,7 +28,7 @@ // #include "HOMARD_Iteration_i.hxx" -#include "HOMARD_Gen_i.hxx" +#include "ADAPT_Gen_i.hxx" #include "HOMARD_Iteration.hxx" #include "HOMARD_DriverTools.hxx" @@ -52,7 +52,7 @@ HOMARD_Iteration_i::HOMARD_Iteration_i() */ //============================================================================= HOMARD_Iteration_i::HOMARD_Iteration_i( CORBA::ORB_ptr orb, - HOMARD::HOMARD_Gen_var engine ) + ADAPT::ADAPT_Gen_var engine ) { MESSAGE("constructor"); _gen_i = engine; @@ -101,12 +101,12 @@ char* HOMARD_Iteration_i::GetDumpPython() //============================================================================= std::string HOMARD_Iteration_i::Dump() const { - return HOMARD::Dump( *myHomardIteration ); + return ADAPT::Dump( *myHomardIteration ); } //============================================================================= bool HOMARD_Iteration_i::Restore( const std::string& stream ) { - return HOMARD::Restore( *myHomardIteration, stream ); + return ADAPT::Restore( *myHomardIteration, stream ); } //============================================================================= //============================================================================= @@ -129,7 +129,7 @@ char* HOMARD_Iteration_i::GetDirName() { ASSERT( myHomardIteration ); std::string casename = myHomardIteration->GetCaseName() ; - HOMARD::HOMARD_Cas_ptr caseiter = _gen_i->GetCase(casename.c_str()) ; + ADAPT::HOMARD_Cas_ptr caseiter = _gen_i->GetCase(casename.c_str()) ; std::string dirnamecase = caseiter->GetDirName() ; std::string dirname = dirnamecase + "/" + GetDirNameLoc() ; return CORBA::string_dup( dirname.c_str() ); @@ -240,11 +240,11 @@ void HOMARD_Iteration_i::SetFieldInterpTimeStepRank( const char* FieldInterp, CO myHomardIteration->SetFieldInterpTimeStepRank( FieldInterp, TimeStep, Rank ); } //============================================================================= -HOMARD::listeFieldInterpTSRsIter* HOMARD_Iteration_i::GetFieldInterpsTimeStepRank() +ADAPT::listeFieldInterpTSRsIter* HOMARD_Iteration_i::GetFieldInterpsTimeStepRank() { ASSERT( myHomardIteration ); const std::list& ListString = myHomardIteration->GetFieldInterpsTimeStepRank(); - HOMARD::listeFieldInterpTSRsIter_var aResult = new HOMARD::listeFieldInterpTSRsIter; + ADAPT::listeFieldInterpTSRsIter_var aResult = new ADAPT::listeFieldInterpTSRsIter; aResult->length( ListString.size() ); std::list::const_iterator it; int i = 0; @@ -260,11 +260,11 @@ void HOMARD_Iteration_i::SetFieldInterp( const char* FieldInterp ) myHomardIteration->SetFieldInterp( FieldInterp ); } //============================================================================= -HOMARD::listeFieldInterpsIter* HOMARD_Iteration_i::GetFieldInterps() +ADAPT::listeFieldInterpsIter* HOMARD_Iteration_i::GetFieldInterps() { ASSERT( myHomardIteration ); const std::list& ListString = myHomardIteration->GetFieldInterps(); - HOMARD::listeFieldInterpsIter_var aResult = new HOMARD::listeFieldInterpsIter; + ADAPT::listeFieldInterpsIter_var aResult = new ADAPT::listeFieldInterpsIter; aResult->length( ListString.size() ); std::list::const_iterator it; int i = 0; @@ -355,7 +355,7 @@ char* HOMARD_Iteration_i::GetFileInfo() // Liens avec les autres iterations //============================================================================= //============================================================================= -HOMARD::HOMARD_Iteration_ptr HOMARD_Iteration_i::NextIteration( const char* IterName ) +ADAPT::HOMARD_Iteration_ptr HOMARD_Iteration_i::NextIteration( const char* IterName ) { // Nom de l'iteration parent char* NomIterParent = GetName() ; @@ -375,11 +375,11 @@ void HOMARD_Iteration_i::UnLinkNextIteration( const char* NomIteration ) myHomardIteration->UnLinkNextIteration( NomIteration ); } //============================================================================= -HOMARD::listeIterFilles* HOMARD_Iteration_i::GetIterations() +ADAPT::listeIterFilles* HOMARD_Iteration_i::GetIterations() { ASSERT( myHomardIteration ); const std::list& maListe = myHomardIteration->GetIterations(); - HOMARD::listeIterFilles_var aResult = new HOMARD::listeIterFilles; + ADAPT::listeIterFilles_var aResult = new ADAPT::listeIterFilles; aResult->length( maListe.size() ); std::list::const_iterator it; int i = 0; @@ -402,7 +402,7 @@ char* HOMARD_Iteration_i::GetIterParentName() return CORBA::string_dup( myHomardIteration->GetIterParentName().c_str() ); } //============================================================================= -HOMARD::HOMARD_Iteration_ptr HOMARD_Iteration_i::GetIterParent() +ADAPT::HOMARD_Iteration_ptr HOMARD_Iteration_i::GetIterParent() { // Nom de l'iteration parent char* NomIterParent = GetIterParentName() ; diff --git a/src/ADAPT_I/HOMARD_Iteration_i.hxx b/src/ADAPT_I/HOMARD_Iteration_i.hxx index 1cc30b67e..87d353e77 100644 --- a/src/ADAPT_I/HOMARD_Iteration_i.hxx +++ b/src/ADAPT_I/HOMARD_Iteration_i.hxx @@ -31,7 +31,7 @@ #define _HOMARD_ITERATION_I_HXX_ #include -#include CORBA_SERVER_HEADER(HOMARD_Gen) +#include CORBA_SERVER_HEADER(ADAPT_Gen) #include CORBA_SERVER_HEADER(HOMARD_Iteration) #include "HOMARD_i.hxx" @@ -45,12 +45,12 @@ class HOMARD_Iteration; class HOMARDENGINE_EXPORT HOMARD_Iteration_i: public virtual Engines_Component_i, - public virtual POA_HOMARD::HOMARD_Iteration, + public virtual POA_ADAPT::HOMARD_Iteration, public virtual PortableServer::ServantBase { public: HOMARD_Iteration_i( CORBA::ORB_ptr orb, - HOMARD::HOMARD_Gen_var gen_i ); + ADAPT::ADAPT_Gen_var gen_i ); HOMARD_Iteration_i(); virtual ~HOMARD_Iteration_i(); @@ -95,9 +95,9 @@ public: // Instants pour un champ a interpoler void SetFieldInterpTimeStep( const char* FieldInterp, CORBA::Long TimeStep ); void SetFieldInterpTimeStepRank( const char* FieldInterp, CORBA::Long TimeStep, CORBA::Long Rank ); - HOMARD::listeFieldInterpTSRsIter* GetFieldInterpsTimeStepRank(); + ADAPT::listeFieldInterpTSRsIter* GetFieldInterpsTimeStepRank(); void SetFieldInterp( const char* FieldInterp ); - HOMARD::listeFieldInterpsIter* GetFieldInterps(); + ADAPT::listeFieldInterpsIter* GetFieldInterps(); void SupprFieldInterps(); void SetLogFile( const char* LogFile ); @@ -113,15 +113,15 @@ public: char* GetFileInfo(); // Liens avec les autres iterations - HOMARD::HOMARD_Iteration_ptr NextIteration( const char* Name) ; + ADAPT::HOMARD_Iteration_ptr NextIteration( const char* Name) ; void LinkNextIteration( const char* NomIteration ); void UnLinkNextIteration( const char* NomIteration ); - HOMARD::listeIterFilles* GetIterations(); + ADAPT::listeIterFilles* GetIterations(); void SetIterParentName( const char* NomIterParent ); char* GetIterParentName(); - HOMARD::HOMARD_Iteration_ptr GetIterParent() ; + ADAPT::HOMARD_Iteration_ptr GetIterParent() ; // Liens avec les autres structures void SetCaseName( const char* NomCas ); @@ -139,7 +139,7 @@ private: ::HOMARD_Iteration* myHomardIteration; CORBA::ORB_ptr _orb; - HOMARD::HOMARD_Gen_var _gen_i; + ADAPT::ADAPT_Gen_var _gen_i; }; #endif diff --git a/src/ADAPT_I/HOMARD_YACS_i.cxx b/src/ADAPT_I/HOMARD_YACS_i.cxx index 749d60d71..ae6977b23 100644 --- a/src/ADAPT_I/HOMARD_YACS_i.cxx +++ b/src/ADAPT_I/HOMARD_YACS_i.cxx @@ -28,7 +28,7 @@ // #include "HOMARD_YACS_i.hxx" -#include "HOMARD_Gen_i.hxx" +#include "ADAPT_Gen_i.hxx" #include "HOMARD_YACS.hxx" #include "HOMARD_DriverTools.hxx" @@ -52,7 +52,7 @@ HOMARD_YACS_i::HOMARD_YACS_i() */ //============================================================================= HOMARD_YACS_i::HOMARD_YACS_i( CORBA::ORB_ptr orb, - HOMARD::HOMARD_Gen_var engine ) + ADAPT::ADAPT_Gen_var engine ) { MESSAGE("constructor"); _gen_i = engine; @@ -101,12 +101,12 @@ char* HOMARD_YACS_i::GetDumpPython() //============================================================================= std::string HOMARD_YACS_i::Dump() const { - return HOMARD::Dump( *myHomardYACS ); + return ADAPT::Dump( *myHomardYACS ); } //============================================================================= bool HOMARD_YACS_i::Restore( const std::string& stream ) { - return HOMARD::Restore( *myHomardYACS, stream ); + return ADAPT::Restore( *myHomardYACS, stream ); } //============================================================================= //============================================================================= diff --git a/src/ADAPT_I/HOMARD_YACS_i.hxx b/src/ADAPT_I/HOMARD_YACS_i.hxx index 806602423..45c17851d 100644 --- a/src/ADAPT_I/HOMARD_YACS_i.hxx +++ b/src/ADAPT_I/HOMARD_YACS_i.hxx @@ -31,7 +31,7 @@ #define _HOMARD_YACS_I_HXX_ #include -#include CORBA_SERVER_HEADER(HOMARD_Gen) +#include CORBA_SERVER_HEADER(ADAPT_Gen) #include CORBA_SERVER_HEADER(HOMARD_YACS) #include "HOMARD_i.hxx" @@ -45,12 +45,12 @@ class HOMARD_YACS; class HOMARDENGINE_EXPORT HOMARD_YACS_i: public virtual Engines_Component_i, - public virtual POA_HOMARD::HOMARD_YACS, + public virtual POA_ADAPT::HOMARD_YACS, public virtual PortableServer::ServantBase { public: HOMARD_YACS_i( CORBA::ORB_ptr orb, - HOMARD::HOMARD_Gen_var gen_i ); + ADAPT::ADAPT_Gen_var gen_i ); HOMARD_YACS_i(); virtual ~HOMARD_YACS_i(); @@ -106,7 +106,7 @@ private: ::HOMARD_YACS* myHomardYACS; CORBA::ORB_ptr _orb; - HOMARD::HOMARD_Gen_var _gen_i; + ADAPT::ADAPT_Gen_var _gen_i; }; #endif diff --git a/src/ADAPT_I/HOMARD_Zone_i.cxx b/src/ADAPT_I/HOMARD_Zone_i.cxx index 4a16ee5dd..b8ee19062 100644 --- a/src/ADAPT_I/HOMARD_Zone_i.cxx +++ b/src/ADAPT_I/HOMARD_Zone_i.cxx @@ -28,7 +28,7 @@ // #include "HOMARD_Zone_i.hxx" -#include "HOMARD_Gen_i.hxx" +#include "ADAPT_Gen_i.hxx" #include "HOMARD_Zone.hxx" #include "HOMARD_DriverTools.hxx" @@ -51,7 +51,7 @@ HOMARD_Zone_i::HOMARD_Zone_i() */ //============================================================================= HOMARD_Zone_i::HOMARD_Zone_i( CORBA::ORB_ptr orb, - HOMARD::HOMARD_Gen_var engine ) + ADAPT::ADAPT_Gen_var engine ) { MESSAGE( "HOMARD_Zone_i" ); _gen_i = engine; @@ -101,12 +101,12 @@ char* HOMARD_Zone_i::GetDumpPython() //============================================================================= std::string HOMARD_Zone_i::Dump() const { - return HOMARD::Dump( *myHomardZone ); + return ADAPT::Dump( *myHomardZone ); } //============================================================================= bool HOMARD_Zone_i::Restore( const std::string& stream ) { - return HOMARD::Restore( *myHomardZone, stream ); + return ADAPT::Restore( *myHomardZone, stream ); } //============================================================================= //============================================================================= @@ -153,10 +153,10 @@ void HOMARD_Zone_i::SetSphere( double Xcentre, double Ycentre, double Zcentre, d myHomardZone->SetSphere( Xcentre, Ycentre, Zcentre, Rayon ); } //============================================================================= -HOMARD::double_array* HOMARD_Zone_i::GetCoords() +ADAPT::double_array* HOMARD_Zone_i::GetCoords() { ASSERT( myHomardZone ); - HOMARD::double_array_var aResult = new HOMARD::double_array(); + ADAPT::double_array_var aResult = new ADAPT::double_array(); std::vector mesCoor = myHomardZone->GetCoords(); aResult->length( mesCoor .size() ); std::vector::const_iterator it; @@ -173,10 +173,10 @@ void HOMARD_Zone_i::SetLimit( double Xincr, double Yincr, double Zincr ) myHomardZone->SetLimit( Xincr, Yincr, Zincr ); } //============================================================================= -HOMARD::double_array* HOMARD_Zone_i::GetLimit() +ADAPT::double_array* HOMARD_Zone_i::GetLimit() { ASSERT( myHomardZone ); - HOMARD::double_array_var aResult = new HOMARD::double_array(); + ADAPT::double_array_var aResult = new ADAPT::double_array(); std::vector mesCoor = myHomardZone->GetLimit(); aResult->length( mesCoor .size() ); std::vector::const_iterator it; @@ -197,11 +197,11 @@ void HOMARD_Zone_i::AddHypo( const char* NomHypo ) myHomardZone->AddHypo( NomHypo ); } //============================================================================= -HOMARD::listeHypo* HOMARD_Zone_i::GetHypo() +ADAPT::listeHypo* HOMARD_Zone_i::GetHypo() { ASSERT( myHomardZone ); const std::list& maListe = myHomardZone->GetHypo(); - HOMARD::listeHypo_var aResult = new HOMARD::listeHypo; + ADAPT::listeHypo_var aResult = new ADAPT::listeHypo; aResult->length( maListe.size() ); std:: list::const_iterator it; int i = 0; diff --git a/src/ADAPT_I/HOMARD_Zone_i.hxx b/src/ADAPT_I/HOMARD_Zone_i.hxx index 84c2d5c00..ee4e29e7c 100644 --- a/src/ADAPT_I/HOMARD_Zone_i.hxx +++ b/src/ADAPT_I/HOMARD_Zone_i.hxx @@ -31,7 +31,7 @@ #define _HOMARD_Zone_I_HXX_ #include -#include CORBA_SERVER_HEADER(HOMARD_Gen) +#include CORBA_SERVER_HEADER(ADAPT_Gen) #include CORBA_SERVER_HEADER(HOMARD_Zone) #include "HOMARD_i.hxx" @@ -45,11 +45,11 @@ class HOMARD_Zone; class HOMARDENGINE_EXPORT HOMARD_Zone_i: public virtual Engines_Component_i, - public virtual POA_HOMARD::HOMARD_Zone, + public virtual POA_ADAPT::HOMARD_Zone, public virtual PortableServer::ServantBase { public: - HOMARD_Zone_i( CORBA::ORB_ptr orb, HOMARD::HOMARD_Gen_var gen_i ); + HOMARD_Zone_i( CORBA::ORB_ptr orb, ADAPT::ADAPT_Gen_var gen_i ); HOMARD_Zone_i(); virtual ~HOMARD_Zone_i(); @@ -84,21 +84,21 @@ public: void SetSphere( double Xcentre, double Ycentre, double ZCentre, double Rayon ); - HOMARD::double_array* GetCoords(); + ADAPT::double_array* GetCoords(); void SetLimit( double Xincr, double Yincr, double Zincr); - HOMARD::double_array* GetLimit(); + ADAPT::double_array* GetLimit(); // Liens avec les autres structures void AddHypo( const char *NomHypo ); - HOMARD::listeHypo* GetHypo(); + ADAPT::listeHypo* GetHypo(); void SupprHypo( const char *NomHypo ); private: ::HOMARD_Zone* myHomardZone; CORBA::ORB_ptr _orb; - HOMARD::HOMARD_Gen_var _gen_i; + ADAPT::ADAPT_Gen_var _gen_i; }; #endif