From: jfa Date: Tue, 14 Dec 2021 13:56:00 +0000 (+0300) Subject: Debug, reduce code, mesh selection, dump python. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bdd574724272e16b782e6b8347ed21ba477df585;p=modules%2Fsmesh.git Debug, reduce code, mesh selection, dump python. --- diff --git a/idl/SMESH_Homard.idl b/idl/SMESH_Homard.idl index 80509b869..7c41d56c6 100644 --- a/idl/SMESH_Homard.idl +++ b/idl/SMESH_Homard.idl @@ -20,7 +20,8 @@ #ifndef _SMESH_HOMARD_IDL #define _SMESH_HOMARD_IDL -#include "SALOME_Component.idl" +#include "SMESH_Mesh.idl" + #include "SALOME_Exception.idl" #include "SALOMEDS.idl" @@ -30,71 +31,47 @@ module SMESHHOMARD typedef sequence extrema; typedef sequence ListGroupType; typedef sequence ListBoundaryGroupType; - typedef sequence listeIterFilles; - typedef sequence listeFieldInterpsIter; - typedef sequence listeFieldInterpTSRsIter; - typedef sequence listeFieldInterpsHypo; - typedef sequence listeIters; - typedef sequence listeComposantsHypo; - typedef sequence listeTypes; - - typedef sequence listeHypotheses; - typedef sequence listeIterations; - typedef sequence listeCases; typedef sequence listeBoundarys; - struct InfosHypo - { - string FieldName; - long UsCmpI; - long UsField; - long TypeThR; - double ThreshR; - long TypeThC; - double ThreshC; - }; - - interface HOMARD_Boundary : Engines::EngineComponent + interface HOMARD_Boundary : SALOME::GenericObj { // Generalites - void SetName(in string Name) raises (SALOME::SALOME_Exception); - string GetName() raises (SALOME::SALOME_Exception); + void SetName(in string Name) raises (SALOME::SALOME_Exception); + string GetName() raises (SALOME::SALOME_Exception); - long Delete() raises (SALOME::SALOME_Exception); - - string GetDumpPython() raises (SALOME::SALOME_Exception); + string GetDumpPython() raises (SALOME::SALOME_Exception); // Caracteristiques - void SetType (in long Type) raises (SALOME::SALOME_Exception); - long GetType() raises (SALOME::SALOME_Exception); + void SetType (in long Type) raises (SALOME::SALOME_Exception); + long GetType() raises (SALOME::SALOME_Exception); - void SetDataFile(in string DataFile) raises (SALOME::SALOME_Exception); - string GetDataFile() raises (SALOME::SALOME_Exception); + void SetDataFile(in string DataFile) raises (SALOME::SALOME_Exception); + string GetDataFile() raises (SALOME::SALOME_Exception); - void SetMeshName(in string MeshName) raises (SALOME::SALOME_Exception); - string GetMeshName() raises (SALOME::SALOME_Exception); + void SetMeshName(in string MeshName) raises (SALOME::SALOME_Exception); + string GetMeshName() raises (SALOME::SALOME_Exception); void SetCylinder (in double Xcentre, in double Ycentre, in double Zcentre, in double Xaxe, in double Yaxe, in double Zaxe, in double rayon) - raises (SALOME::SALOME_Exception); + raises (SALOME::SALOME_Exception); void SetSphere (in double Xcentre, in double Ycentre, in double Zcentre, in double rayon) - raises (SALOME::SALOME_Exception); + raises (SALOME::SALOME_Exception); - void SetConeR (in double Xcentre1, in double Ycentre1, in double Zcentre1, in double Rayon1, - in double Xcentre2, in double Ycentre2, in double Zcentre2, in double Rayon2) - raises (SALOME::SALOME_Exception); + void SetConeR (in double Xcentre1, in double Ycentre1, in double Zcentre1, + in double Rayon1, + in double Xcentre2, in double Ycentre2, in double Zcentre2, + in double Rayon2) raises (SALOME::SALOME_Exception); - void SetConeA(in double Xaxe,in double Yaxe,in double Zaxe,in double Angle, - in double Xcentre,in double Ycentre,in double ZCentre) - raises (SALOME::SALOME_Exception); + void SetConeA(in double Xaxe, in double Yaxe, in double Zaxe, in double Angle, + in double Xcentre, in double Ycentre, in double ZCentre) + raises (SALOME::SALOME_Exception); void SetTorus (in double Xcentre, in double Ycentre, in double Zcentre, in double Xaxe, in double Yaxe, in double Zaxe, in double rayonRev, in double rayonPri) raises (SALOME::SALOME_Exception); - SMESHHOMARD::double_array GetCoords() raises (SALOME::SALOME_Exception); void SetLimit (in double Xincr, in double Yincr, in double Zincr) @@ -108,28 +85,22 @@ module SMESHHOMARD // Liens avec les autres iterations void SetCaseCreation(in string NomCas) raises (SALOME::SALOME_Exception); string GetCaseCreation() raises (SALOME::SALOME_Exception); - }; - interface HOMARD_Iteration : Engines::EngineComponent + interface HOMARD_Iteration : SALOME::GenericObj { // Generalites - void SetName(in string Name) raises (SALOME::SALOME_Exception); - string GetName() raises (SALOME::SALOME_Exception); - - long Delete(in long Option, - in boolean doRemoveWorkingFiles) raises (SALOME::SALOME_Exception); - - string GetDumpPython() raises (SALOME::SALOME_Exception); + void SetName(in string Name) raises (SALOME::SALOME_Exception); + string GetName() raises (SALOME::SALOME_Exception); // Caracteristiques - void SetDirNameLoc(in string NomDir) raises (SALOME::SALOME_Exception); - string GetDirNameLoc() raises (SALOME::SALOME_Exception); + void SetDirNameLoc(in string NomDir) raises (SALOME::SALOME_Exception); + string GetDirNameLoc() raises (SALOME::SALOME_Exception); - string GetDirName() raises (SALOME::SALOME_Exception); + string GetDirName() raises (SALOME::SALOME_Exception); - void SetNumber(in long NumIter) raises (SALOME::SALOME_Exception); - long GetNumber() raises (SALOME::SALOME_Exception); + void SetNumber(in long NumIter) raises (SALOME::SALOME_Exception); + long GetNumber() raises (SALOME::SALOME_Exception); void SetState(in long State) raises (SALOME::SALOME_Exception); long GetState() raises (SALOME::SALOME_Exception); @@ -140,88 +111,42 @@ module SMESHHOMARD void SetMeshFile(in string MeshFile) raises (SALOME::SALOME_Exception); string GetMeshFile() raises (SALOME::SALOME_Exception); - void SetFieldFile(in string FieldFile) raises (SALOME::SALOME_Exception); - string GetFieldFile() raises (SALOME::SALOME_Exception); - - // Instants pour le champ de pilotage - void SetTimeStep(in long TimeStep) raises (SALOME::SALOME_Exception); - void SetTimeStepRank(in long TimeStep, in long Rank) - raises (SALOME::SALOME_Exception); - void SetTimeStepRankLast() raises (SALOME::SALOME_Exception); - long GetTimeStep() raises (SALOME::SALOME_Exception); - long GetRank() raises (SALOME::SALOME_Exception); - - // Instants pour un champ a interpoler - void SetFieldInterpTimeStep(in string FieldInterp, in long TimeStep) - raises (SALOME::SALOME_Exception); - void SetFieldInterpTimeStepRank(in string FieldInterp, in long TimeStep, in long Rank) - raises (SALOME::SALOME_Exception); - listeFieldInterpTSRsIter GetFieldInterpsTimeStepRank() raises (SALOME::SALOME_Exception); - void SetFieldInterp(in string FieldInterp) raises (SALOME::SALOME_Exception); - listeFieldInterpsIter GetFieldInterps() raises (SALOME::SALOME_Exception); - void SupprFieldInterps() raises (SALOME::SALOME_Exception); - // Fichier des messages void SetLogFile(in string LogFile) raises (SALOME::SALOME_Exception); string GetLogFile() raises (SALOME::SALOME_Exception); - long Compute(in long etatMenage, in long Option) raises (SALOME::SALOME_Exception); - - void MeshInfo(in long Qual, in long Diam, in long Conn, in long Tail, in long Inte) - raises (SALOME::SALOME_Exception); - void MeshInfoOption(in long Qual, in long Diam, in long Conn, in long Tail, in long Inte, in long Option) - raises (SALOME::SALOME_Exception); - - void SetFileInfo(in string FileInfo) raises (SALOME::SALOME_Exception); - string GetFileInfo() raises (SALOME::SALOME_Exception); + void SetFileInfo(in string FileInfo) raises (SALOME::SALOME_Exception); + string GetFileInfo() raises (SALOME::SALOME_Exception); // Liens avec les autres iterations - HOMARD_Iteration NextIteration(in string NomIter) raises (SALOME::SALOME_Exception); - void LinkNextIteration(in string NomIter) raises (SALOME::SALOME_Exception); void UnLinkNextIteration(in string NomIter) raises (SALOME::SALOME_Exception); - listeIterFilles GetIterations() raises (SALOME::SALOME_Exception); void SetIterParentName(in string NomIterParent) raises (SALOME::SALOME_Exception); string GetIterParentName() raises (SALOME::SALOME_Exception); - HOMARD_Iteration GetIterParent() raises (SALOME::SALOME_Exception); // Liens avec les autres structures void SetCaseName(in string NomCas) raises (SALOME::SALOME_Exception); string GetCaseName() raises (SALOME::SALOME_Exception); - void AssociateHypo(in string NomHypo) raises (SALOME::SALOME_Exception); void SetHypoName(in string NomHypo) raises (SALOME::SALOME_Exception); - string GetHypoName() raises (SALOME::SALOME_Exception); - // Divers + // Drivers void SetInfoCompute(in long MessInfo) raises (SALOME::SALOME_Exception); long GetInfoCompute() raises (SALOME::SALOME_Exception); }; - interface HOMARD_Cas : Engines::EngineComponent + interface HOMARD_Cas : SALOME::GenericObj { - // Generalites - void SetName(in string Name) raises (SALOME::SALOME_Exception); - string GetName() raises (SALOME::SALOME_Exception); - - long Delete(in long Option) raises (SALOME::SALOME_Exception); - - string GetDumpPython() raises (SALOME::SALOME_Exception); + string GetName() raises (SALOME::SALOME_Exception); + string GetDumpPython() raises (SALOME::SALOME_Exception); // Caracteristiques - void SetDirName(in string NomDir) raises (SALOME::SALOME_Exception); - string GetDirName() raises (SALOME::SALOME_Exception); - - long GetState() raises (SALOME::SALOME_Exception); - - long GetNumberofIter() raises (SALOME::SALOME_Exception); - - void SetConfType(in long ConfType) raises (SALOME::SALOME_Exception); - long GetConfType() raises (SALOME::SALOME_Exception); + void SetDirName(in string NomDir) raises (SALOME::SALOME_Exception); + string GetDirName() raises (SALOME::SALOME_Exception); - void SetExtType(in long ExtType) raises (SALOME::SALOME_Exception); - long GetExtType() raises (SALOME::SALOME_Exception); + void SetConfType(in long ConfType) raises (SALOME::SALOME_Exception); + long GetConfType() raises (SALOME::SALOME_Exception); void SetBoundingBox(in extrema LesExtremes) raises (SALOME::SALOME_Exception); extrema GetBoundingBox() raises (SALOME::SALOME_Exception); @@ -230,199 +155,99 @@ module SMESHHOMARD void SetGroups(in ListGroupType ListGroup) raises (SALOME::SALOME_Exception); ListGroupType GetGroups() raises (SALOME::SALOME_Exception); - void AddBoundary(in string BoundaryName) raises (SALOME::SALOME_Exception); - void AddBoundaryGroup(in string BoundaryName, in string Group) - raises (SALOME::SALOME_Exception); - ListBoundaryGroupType GetBoundaryGroup() raises (SALOME::SALOME_Exception); - void SupprBoundaryGroup() raises (SALOME::SALOME_Exception); + void AddBoundary(in string BoundaryName) raises (SALOME::SALOME_Exception); + void AddBoundaryGroup(in string BoundaryName, + in string Group) raises (SALOME::SALOME_Exception); + ListBoundaryGroupType GetBoundaryGroup() raises (SALOME::SALOME_Exception); + void SupprBoundaryGroup() raises (SALOME::SALOME_Exception); - void SetPyram(in long Pyram) raises (SALOME::SALOME_Exception); - long GetPyram() raises (SALOME::SALOME_Exception); - - void MeshInfo(in long Qual, in long Diam, in long Conn, in long Tail, in long Inte) - raises (SALOME::SALOME_Exception); - - // Liens avec les autres structures - string GetIter0Name () raises (SALOME::SALOME_Exception); - HOMARD_Iteration GetIter0 () raises (SALOME::SALOME_Exception); - - HOMARD_Iteration NextIteration(in string IterName) raises (SALOME::SALOME_Exception); - - HOMARD_Iteration LastIteration() raises (SALOME::SALOME_Exception); - - void AddIteration (in string IterName) raises (SALOME::SALOME_Exception); + void AddIteration (in string IterName) raises (SALOME::SALOME_Exception); }; - interface HOMARD_Hypothesis : Engines::EngineComponent + interface HOMARD_Hypothesis : SALOME::GenericObj { // Generalites - void SetName(in string Name) raises (SALOME::SALOME_Exception); - string GetName() raises (SALOME::SALOME_Exception); - - long Delete() raises (SALOME::SALOME_Exception); - - string GetDumpPython() raises (SALOME::SALOME_Exception); - - // Caracteristiques - void SetUnifRefinUnRef(in long RaffDera) raises (SALOME::SALOME_Exception); - listeTypes GetAdapRefinUnRef() raises (SALOME::SALOME_Exception); - long GetAdapType() raises (SALOME::SALOME_Exception); - long GetRefinType() raises (SALOME::SALOME_Exception); - long GetUnRefType() raises (SALOME::SALOME_Exception); - - void SetField(in string FieldName) raises (SALOME::SALOME_Exception); - string GetFieldName() raises (SALOME::SALOME_Exception); - void SetUseField(in long UsField) raises (SALOME::SALOME_Exception); - InfosHypo GetField() raises (SALOME::SALOME_Exception); - - void SetUseComp(in long UsCmpI) raises (SALOME::SALOME_Exception); - void AddComp(in string NomComp) raises (SALOME::SALOME_Exception); - void SupprComp(in string NomComp) raises (SALOME::SALOME_Exception); - void SupprComps() raises (SALOME::SALOME_Exception); - listeComposantsHypo GetComps() raises (SALOME::SALOME_Exception); - - void SetRefinThr(in long TypeThR, in double ThreshR) raises (SALOME::SALOME_Exception); - long GetRefinThrType() raises (SALOME::SALOME_Exception); - void SetUnRefThr(in long TypeThC, in double ThreshC) raises (SALOME::SALOME_Exception); - long GetUnRefThrType() raises (SALOME::SALOME_Exception); - - void SetNivMax(in long NivMax) raises (SALOME::SALOME_Exception); - long GetNivMax() raises (SALOME::SALOME_Exception); - - void SetDiamMin(in double DiamMin) raises (SALOME::SALOME_Exception); - double GetDiamMin() raises (SALOME::SALOME_Exception); - - void SetAdapInit(in long AdapInit) raises (SALOME::SALOME_Exception); - long GetAdapInit() raises (SALOME::SALOME_Exception); - void SetExtraOutput(in long ExtraOutput) raises (SALOME::SALOME_Exception); long GetExtraOutput() raises (SALOME::SALOME_Exception); - void AddGroup(in string LeGroupe) raises (SALOME::SALOME_Exception); - void SupprGroup(in string LeGroupe) raises (SALOME::SALOME_Exception); - void SupprGroups() raises (SALOME::SALOME_Exception); - void SetGroups(in ListGroupType ListGroup) raises (SALOME::SALOME_Exception); - ListGroupType GetGroups() raises (SALOME::SALOME_Exception); - - void SetTypeFieldInterp(in long TypeFieldInterp) raises (SALOME::SALOME_Exception); - long GetTypeFieldInterp() raises (SALOME::SALOME_Exception); - void AddFieldInterp(in string FieldInterp) raises (SALOME::SALOME_Exception); - void AddFieldInterpType(in string FieldInterp, in long TypeInterp) - raises (SALOME::SALOME_Exception); - void SupprFieldInterp(in string FieldInterp) raises (SALOME::SALOME_Exception); - void SupprFieldInterps() raises (SALOME::SALOME_Exception); - listeFieldInterpsHypo GetFieldInterps() raises (SALOME::SALOME_Exception); - - // Liens avec les autres structures - void SetCaseCreation(in string NomCas) raises (SALOME::SALOME_Exception); - string GetCaseCreation() raises (SALOME::SALOME_Exception); - void LinkIteration(in string NomIteration) raises (SALOME::SALOME_Exception); void UnLinkIteration(in string NomIteration) raises (SALOME::SALOME_Exception); - listeIters GetIterations() raises (SALOME::SALOME_Exception); }; interface HOMARD_Gen : SALOME::GenericObj { - // - // Creation - // - 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_Hypothesis CreateHypothesis(in string HypoName ) - 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); - - listeBoundarys GetAllBoundarysName() raises (SALOME::SALOME_Exception); - listeCases GetAllCasesName() raises (SALOME::SALOME_Exception); - listeHypotheses GetAllHypothesesName() raises (SALOME::SALOME_Exception); - listeIterations GetAllIterationsName() 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.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 ) + HOMARD_Boundary CreateBoundaryCAO (in string BoundaryName, in string FileName) 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, - in boolean doRemoveWorkingFiles) 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, - in boolean doRemoveWorkingFiles) raises(SALOME::SALOME_Exception); - long DeleteIterationOption(in string IterName, - in long Option1, in long Option2, - in boolean doRemoveWorkingFiles) raises(SALOME::SALOME_Exception); - // - void AssociateIterHypo(in string IterName, in string HypoName) + HOMARD_Boundary CreateBoundaryDi (in string BoundaryName, in string MeshName, + in string FileName) raises(SALOME::SALOME_Exception); - - long Compute (in string IterName, in long CleanOption, in long modeHOMARD, - in long Option1, in long Option2) + 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); - // - string CreateDirNameIter(in string NomDir, in long option ) + 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); - string VerifieDir (in string NomDir) 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); - // - // Les preferences - // - void SetPublisMesh (in long PublisMeshIN, in long PublisMeshOUT) + 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); - long GetPublisMeshIN () raises (SALOME::SALOME_Exception); - long GetPublisMeshOUT () raises (SALOME::SALOME_Exception); + + // CreateCase + HOMARD_Cas CreateCaseOnMesh(in string MeshName, + in SMESH::SMESH_Mesh smeshMesh, + in string theWorkingDir) raises(SALOME::SALOME_Exception); + HOMARD_Cas CreateCase(in string MeshName, + in string FileName, + in string theWorkingDir) raises(SALOME::SALOME_Exception); + + // A.2. Information + HOMARD_Boundary GetBoundary(in string BoundaryName) raises (SALOME::SALOME_Exception); + HOMARD_Cas GetCase() raises (SALOME::SALOME_Exception); + HOMARD_Iteration GetIteration(in long numIter) raises (SALOME::SALOME_Exception); + listeBoundarys GetAllBoundarysName() raises (SALOME::SALOME_Exception); + + // B. CreateIteration + HOMARD_Iteration CreateIteration() raises (SALOME::SALOME_Exception); + + void InvalideBoundary (in string BoundaryName) raises (SALOME::SALOME_Exception); + + long DeleteBoundary (in string BoundaryName) raises (SALOME::SALOME_Exception); + long DeleteCase() raises (SALOME::SALOME_Exception); + + long Compute() raises (SALOME::SALOME_Exception); + + string CreateDirNameIter (in string NomDir, in long num) + raises (SALOME::SALOME_Exception); + + void PublishResultInSmesh (in string FileName, in long Option) + raises (SALOME::SALOME_Exception); + + // Preferences + void SetKeepMedOUT (in boolean theKeepMedOUT); + void SetPublishMeshOUT (in boolean thePublishMeshOUT); + void SetMeshNameOUT (in string theMeshName) raises (SALOME::SALOME_Exception); + void SetMeshFileOUT (in string theFileName) raises (SALOME::SALOME_Exception); + + void SetVerboseLevel (in long theLevel); + void SetKeepWorkingFiles (in boolean theKeepWorkingFiles); + void SetLogInFile (in boolean theLogInFile); + void SetLogFile (in string theFileName) raises (SALOME::SALOME_Exception); + void SetRemoveLogOnSuccess (in boolean theRemoveLogOnSuccess); }; }; // module SMESHHOMARD diff --git a/src/SMESH/SMESH_Homard.cxx b/src/SMESH/SMESH_Homard.cxx index dac77cf17..f4516343d 100644 --- a/src/SMESH/SMESH_Homard.cxx +++ b/src/SMESH/SMESH_Homard.cxx @@ -126,7 +126,6 @@ namespace SMESHHOMARDImpl os << cas.GetName(); os << separator() << cas.GetDirName(); os << separator() << cas.GetConfType(); - os << separator() << cas.GetExtType(); std::vector coor = cas.GetBoundingBox(); os << separator() << coor.size(); @@ -148,7 +147,7 @@ namespace SMESHHOMARDImpl for ( it = ListString.begin(); it != ListString.end(); ++it ) os << separator() << *it; - os << separator() << cas.GetPyram(); + os << separator() << 0; //cas.GetPyram() saux = os.str(); // MESSAGE( ". Fin avec "<::const_iterator it = _ListBoundaryGroup.begin(); - while(it != _ListBoundaryGroup.end()) - { - aScript << "\t" <<_Name << ".AddBoundaryGroup(\""; - aScript << *it << "\", \""; + while (it != _ListBoundaryGroup.end()) { + aScript << _Name << ".AddBoundaryGroup(\"" << *it << "\", \""; it++; aScript << *it << "\")\n"; it++; } - if ( _Pyram > 0 ) - { - aScript << "\t" <<_Name << ".SetPyram("; - aScript << _Pyram << ")\n"; - } return aScript.str(); } @@ -1103,20 +1077,6 @@ const int HOMARD_Cas::GetConfType() const return _ConfType; } // -// Le type exterieur -// -//============================================================================= -void HOMARD_Cas::SetExtType( int ExtType ) -{ -// VERIFICATION( (ExtType>=0) && (ExtType<=2) ); - _ExtType = ExtType; -} -//============================================================================= -const int HOMARD_Cas::GetExtType() const -{ - return _ExtType; -} -// // La boite englobante // //============================================================================= @@ -1189,16 +1149,6 @@ void HOMARD_Cas::SupprBoundaryGroup() _ListBoundaryGroup.clear(); } //============================================================================= -void HOMARD_Cas::SetPyram( int Pyram ) -{ - _Pyram = Pyram; -} -//============================================================================= -const int HOMARD_Cas::GetPyram() const -{ - return _Pyram; -} -//============================================================================= //============================================================================= // Liens avec les autres structures //============================================================================= @@ -1268,18 +1218,15 @@ void HomardDriver::TexteInit( const std::string DirCompute, const std::string Lo // } //=============================================================================== -void HomardDriver::TexteAdap( int ExtType ) +void HomardDriver::TexteAdap() { MESSAGE("TexteAdap"); -// - _Texte += "Action homa\n" ; - if ( ExtType == 0 ) { _Texte += "CCAssoci med\n" ; } - else if ( ExtType == 1 ) { _Texte += "CCAssoci saturne\n" ; } - else { _Texte += "CCAssoci saturne_2d\n" ; } - _Texte += "ModeHOMA 1\n" ; - _Texte += "NumeIter " + _siter + "\n" ; - _modeHOMARD = 1 ; -// + + _Texte += "Action homa\n"; + _Texte += "CCAssoci med\n"; + _Texte += "ModeHOMA 1\n"; + _Texte += "NumeIter " + _siter + "\n"; + _modeHOMARD = 1; } //=============================================================================== void HomardDriver::TexteInfo( int TypeBila, int NumeIter ) @@ -2163,15 +2110,10 @@ void HomardDriver::TexteFieldInterpNameType( int NumeChamp, const std::string Fi //=============================================================================== // F. Les options avancees //=============================================================================== -void HomardDriver::TexteAdvanced( int Pyram, int NivMax, double DiamMin, int AdapInit, int ExtraOutput ) +void HomardDriver::TexteAdvanced( int NivMax, double DiamMin, int AdapInit, int ExtraOutput ) { - MESSAGE("TexteAdvanced, Pyram ="< 0 ) { _Texte += "# Niveaux extremes\n" ; @@ -2277,12 +2219,12 @@ void HomardDriver::CreeFichierDonn( ) // } //=============================================================================== -int HomardDriver::ExecuteHomard(int option) +int HomardDriver::ExecuteHomard() { - MESSAGE("ExecuteHomard, avec option = "<::const_iterator it = _ListZone.begin(); - int TypeUse ; - while(it != _ListZone.end()) - { - aScript << "\t" << _Name << ".AddZone(\"" << *it; - it++; - if ( *it == "1" ) { TypeUse = 1 ; } - else { TypeUse = -1 ; } - aScript << "\", " << TypeUse << ")\n"; - it++; - } - -// Raffinement selon un champ - if ( _TypeAdap == 1 ) - { - aScript << "\t" << _Name << ".SetField(\"" << _Field << "\")\n"; - aScript << "\t" << _Name << ".SetUseField(" << _UsField << ")\n"; - aScript << "\t" << _Name << ".SetUseComp(" << _UsCmpI << ")\n"; - std::list::const_iterator it_comp = _ListComp.begin(); - while(it_comp != _ListComp.end()) - { - aScript << "\t" << _Name << ".AddComp(\"" << *it_comp << "\")\n"; - it_comp++; - } - if ( _TypeRaff == 1 ) - { - aScript << "\t" << _Name << ".SetRefinThr(" << _TypeThR << ", " << _ThreshR << ")\n"; - } - if ( _TypeDera == 1 ) - { - aScript << "\t" << _Name << ".SetUnRefThr(" << _TypeThC << ", " << _ThreshC << ")\n"; - } - } - -// Filtrage du raffinement par des groupes - for ( it=_ListGroupSelected.begin(); it!=_ListGroupSelected.end();it++) - aScript << "\t" << _Name << ".AddGroup(\"" << (*it) << "\")\n" ; - -// Interpolation des champs - if ( _TypeFieldInterp == 2 ) - { - std::list::const_iterator it_champ = _ListFieldInterp.begin(); - while(it_champ != _ListFieldInterp.end()) - { - aScript << "\t" << _Name << ".AddFieldInterpType( \"" << *it_champ << "\" " ; - it_champ++; - aScript << ", " << *it_champ << ")\n"; - it_champ++; - } - } - else if ( _TypeFieldInterp != 0 ) - { - aScript << "\t" << _Name << ".SetTypeFieldInterp(" << _TypeFieldInterp << ")\n"; - } - if ( _NivMax > 0 ) - { - aScript << "\t" <<_Name << ".SetNivMax(" << _NivMax << ")\n"; - } - if ( _DiamMin > 0 ) - { - aScript << "\t" <<_Name << ".SetDiamMin(" << _DiamMin << ")\n"; - } - if ( _AdapInit != 0 ) - { - aScript << "\t" <<_Name << ".SetAdapInit(" << _AdapInit << ")\n"; - } - if ( _ExtraOutput != 1 ) - { - aScript << "\t" <<_Name << ".SetExtraOutput(" << _ExtraOutput << ")\n"; - } - - return aScript.str(); -} -//============================================================================= //============================================================================= // Caracteristiques //============================================================================= @@ -2843,83 +2699,6 @@ std::string HOMARD_Iteration::GetName() const return _Name; } //============================================================================= -std::string HOMARD_Iteration::GetDumpPython() const -{ - if (_IterParent == "") return std::string(" ") ; // Pas de creation explicite de iteration 0"; - - MESSAGE (". Ecriture de l iteration " << _Name ); - std::ostringstream aScript; - aScript << "\n# Creation of the iteration " << _Name << "\n"; - if( _NumIter == 1 ) - { - aScript << "\t" << _Name << " = " << _NomCas << ".NextIteration(\"" << _Name << "\")\n"; - } - else - { - aScript << "\t" << _Name << " = " << _IterParent << ".NextIteration(\"" << _Name << "\")\n"; - } -// L'hypothese (doit etre au debut) - aScript << "\t" << _Name << ".AssociateHypo(\"" << _NomHypo << "\")\n"; -// Le nom du maillage produit -// MESSAGE (".. maillage produit " << _NomMesh ); - aScript << "\t" << _Name << ".SetMeshName(\"" << _NomMesh << "\")\n" ; -// Le fichier du maillage produit - aScript << "\t" << _Name << ".SetMeshFile(\"" << _MeshFile << "\")\n"; -// Le fichier des champs - if ( _FieldFile != "" ) - { - aScript << "\t" << _Name << ".SetFieldFile(\"" << _FieldFile << "\")\n"; - } -// Si champ de pilotage, valeurs de pas de temps - MESSAGE (". champ de pilotage : _TimeStep = " << _TimeStep << ", _Rank : " << _Rank); - if ( _TimeStep != -1 ) - { - if ( _TimeStep == -2 ) { - aScript << "\t" << _Name << ".SetTimeStepRankLast()\n"; - } - else - { - if ( _TimeStep != -1 ) - { - if ( _Rank == -1 ) - { - aScript << "\t" << _Name << ".SetTimeStep( " << _TimeStep << " )\n"; - } - else - { - aScript << "\t" << _Name << ".SetTimeStepRank( " << _TimeStep << ", " << _Rank << " )\n"; - } - } - } - } -// Les instants d'interpolation - MESSAGE (". instants d'interpolation "); - std::list::const_iterator it = _ListFieldInterpTSR.begin() ; - while(it != _ListFieldInterpTSR.end()) - { - std::string FieldName = std::string((*it)) ; -// MESSAGE ("... FieldName = "<< FieldName); - (*it++); - std::string TimeStepstr = std::string((*it)) ; -// MESSAGE ("... TimeStepstr = "<< TimeStepstr); - (*it++); - std::string Rankstr = std::string((*it)) ; -// MESSAGE ("... Rankstr = "<< Rankstr); - (*it++); - aScript << "\t" << _Name << ".SetFieldInterpTimeStepRank( \"" << FieldName << "\"" ; - aScript << ", " << TimeStepstr ; - aScript << ", " << Rankstr << " )\n" ; - } - -// Compute - MESSAGE (". Compute "); - if ( _Etat == 2 ) { aScript << "\tcodret = " <<_Name << ".Compute(1, 1)\n"; } - else { aScript << "\t#codret = " <<_Name << ".Compute(1, 1)\n"; } -// MESSAGE (". Fin de l ecriture de l iteration " << _Name ); - - return aScript.str(); -} -//============================================================================= //============================================================================= // Caracteristiques //============================================================================= diff --git a/src/SMESH/SMESH_Homard.hxx b/src/SMESH/SMESH_Homard.hxx index d983675c8..45be48424 100644 --- a/src/SMESH/SMESH_Homard.hxx +++ b/src/SMESH/SMESH_Homard.hxx @@ -70,13 +70,13 @@ public: HOMARD_Boundary(); ~HOMARD_Boundary(); -// Generalites + // Generalites void SetName( const char* Name ); std::string GetName() const; std::string GetDumpPython() const; -// Caracteristiques + // Caracteristiques void SetType( int Type ); int GetType() const; @@ -133,13 +133,13 @@ public: HOMARD_Cas(); ~HOMARD_Cas(); -// Generalites + // Generalites void SetName( const char* Name ); std::string GetName() const; std::string GetDumpPython() const; -// Caracteristiques + // Caracteristiques int SetDirName( const char* NomDir ); std::string GetDirName() const; @@ -148,9 +148,6 @@ public: void SetConfType( int ConfType ); const int GetConfType() const; - void SetExtType( int ExtType ); - const int GetExtType() const; - void SetBoundingBox( const std::vector& extremas ); const std::vector& GetBoundingBox() const; @@ -164,9 +161,6 @@ public: const std::list& GetBoundaryGroup() const; void SupprBoundaryGroup(); - void SetPyram( int Pyram ); - const int GetPyram() const; - // Liens avec les autres structures std::string GetIter0Name() const; @@ -178,15 +172,12 @@ private: std::string _Name; std::string _NomDir; int _ConfType; - int _ExtType; int _Etat; std::vector _Boite; // cf HomardQTCommun pour structure du vecteur std::list _ListGroup; std::list _ListBoundaryGroup; - int _Pyram; - typedef std::string IterName; typedef std::list IterNames; IterNames _ListIter; @@ -202,7 +193,7 @@ public: void TexteInfo( int TypeBila, int NumeIter ); void TexteMajCoords( int NumeIter ); void CreeFichierDonn(); - void TexteAdap( int ExtType ); + void TexteAdap(); void CreeFichier(); void TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres ); void TexteMaillageHOMARD( const std::string Dir, const std::string liter, int apres ); @@ -225,11 +216,10 @@ public: void TexteFieldInterp( const std::string FieldFile, const std::string MeshFile ); void TexteFieldInterpAll(); void TexteFieldInterpNameType( int NumeChamp, const std::string FieldName, const std::string TypeInterp, int TimeStep, int Rank ); - void TexteAdvanced( int Pyram, int NivMax, double DiamMin, int AdapInit, int LevelOutput ); + void TexteAdvanced( int NivMax, double DiamMin, int AdapInit, int LevelOutput ); void TexteInfoCompute( int MessInfo ); // - int ExecuteHomard(int option); - // + int ExecuteHomard(); public: int _modeHOMARD; @@ -293,8 +283,6 @@ public: void SetName( const char* Name ); std::string GetName() const; - std::string GetDumpPython() const; - // Caracteristiques void SetAdapType( int TypeAdap ); int GetAdapType() const; @@ -399,13 +387,11 @@ public: HOMARD_Iteration(); ~HOMARD_Iteration(); -// Generalites + // Generalites void SetName( const char* Name ); std::string GetName() const; - std::string GetDumpPython() const; - -// Caracteristiques + // Caracteristiques void SetDirNameLoc( const char* NomDir ); std::string GetDirNameLoc() const; diff --git a/src/SMESHGUI/HOMARD_msg_en.ts b/src/SMESHGUI/HOMARD_msg_en.ts index dd267228a..d3352b29a 100644 --- a/src/SMESHGUI/HOMARD_msg_en.ts +++ b/src/SMESHGUI/HOMARD_msg_en.ts @@ -71,14 +71,6 @@ HOM_MED_FILE_4 The mesh in this MED file cannot be read. - - HOM_MED_FILE_5 - No field in this MED file. - - - HOM_MED_FILE_6 - The field(s) in this MED file cannot be read. - HOM_SELECT_STUDY Select a study object with associated MED file \n or select a MED file. @@ -151,10 +143,6 @@ HOM_ITER_HYPO A hypothesis must be selected. - - HOM_ITER_FIELD_FILE - With this hypothesis, a file for the field must be given. - HOM_ITER_STARTING_POINT_0 Mesh @@ -175,10 +163,6 @@ HOM_HYPO_NAME The hypothesis must be named. - - HOM_HYPO_FIELD_FILE - A file for the field must be given. - HOM_HYPO_NORM_L2 L2 norm diff --git a/src/SMESHGUI/HOMARD_msg_fr.ts b/src/SMESHGUI/HOMARD_msg_fr.ts index ffe28e3cb..77cd8ed7c 100644 --- a/src/SMESHGUI/HOMARD_msg_fr.ts +++ b/src/SMESHGUI/HOMARD_msg_fr.ts @@ -119,34 +119,10 @@ HOM_MED_FILE_4 Impossible de lire le maillage de ce fichier MED. - - HOM_MED_FILE_5 - Ce fichier MED ne contient aucun champ. - - - HOM_MED_FILE_6 - Impossible de lire le(s) champ(s) de ce fichier MED. - HOM_SELECT_STUDY Sélectionner une étude avec un fichier MED associé\n ou sélectionner un fichier MED. - - Create a case - Création d'un cas - - - HOM_CASE_NAME - Il faut donner un nom au cas. - - - HOM_CASE_DIRECTORY_1 - Il faut choisir un répertoire de travail pour le cas. - - - HOM_CASE_DIRECTORY_2 - Ce répertoire est déjà utilisé par le cas - HOM_CASE_DIRECTORY_3 Un répertoire valide doit être choisi. @@ -215,10 +191,6 @@ HOM_ITER_HYPO Choisir une hypothèse. - - HOM_ITER_FIELD_FILE - Avec cette hypothèse, il faut fournir le fichier du champ. - HOM_ITER_STARTING_POINT_0 Maillage @@ -411,30 +383,6 @@ Mesh n+1 Maillage n+1 - - Field information - Information sur les champs - - - Field file - Fichier des champs - - - No time step - Sans pas de temps - - - Last time step - Dernier pas de temps - - - Chosen time step - Pas de temps choisi - - - Time step - Pas de temps - Rank Numéro d'ordre @@ -451,10 +399,6 @@ HOM_HYPO_NAME Il faut donner un nom à l'hypothèse. - - HOM_HYPO_FIELD_FILE - Il faut fournir le fichier du champ. - HOM_HYPO_NORM_L2 Norme L2 @@ -487,10 +431,6 @@ Uniform Uniforme - - Driven by a field - Pilotage par un champ - Uniform adaptation Adaptation uniforme @@ -507,18 +447,6 @@ Nothing Rien - - File of the fields - Fichier des champs - - - Governing field for the adaptation - Champ pilotant l'adaptation - - - Field name - Nom du champ - Jump between elements Saut entre éléments @@ -555,10 +483,6 @@ No coarsening Sans déraffinement - - Field Interpolation - Interpolation des champs - Chosen Choisi diff --git a/src/SMESHGUI/HOMARD_msg_ja.ts b/src/SMESHGUI/HOMARD_msg_ja.ts index bf7fe028e..94cd0943c 100644 --- a/src/SMESHGUI/HOMARD_msg_ja.ts +++ b/src/SMESHGUI/HOMARD_msg_ja.ts @@ -216,10 +216,6 @@ HOM_ITER_HYPO 仮説を選択します。 - - HOM_ITER_FIELD_FILE - この前提には、ファイルのフィールドを指定する必要があります。 - HOM_ITER_STARTING_POINT_0 メッシュ @@ -400,30 +396,6 @@ Mesh n+1 メッシュ n + 1 - - Field information - フィールド情報 - - - Field file - フィールド ファイル - - - No time step - タイムステップなし - - - Last time step - 最終タイムステップ - - - Chosen time step - 選択されたタイムステップ - - - Time step - タイムステップ - Rank ランク @@ -440,10 +412,6 @@ HOM_HYPO_NAME 仮説に名前を付ける必要があります。 - - HOM_HYPO_FIELD_FILE - それはフィールドのファイルを提供する必要があります。 - HOM_HYPO_NORM_L2 標準の L2 @@ -476,10 +444,6 @@ Uniform 均一 - - Driven by a field - フィールドによって駆動 - Uniform adaptation 均一な適応 @@ -492,18 +456,6 @@ Nothing なし - - File of the fields - フィールドファイル - - - Governing field for the adaptation - 適合のためにフィールドを管理 - - - Field name - フィールド名 - Jump between elements 要素間ジャンプ @@ -540,10 +492,6 @@ No coarsening 粗大化なし - - Field Interpolation - フィールド補間 - Chosen 選択済み diff --git a/src/SMESHGUI/SMESHGUI_HomardAdaptDlg.cxx b/src/SMESHGUI/SMESHGUI_HomardAdaptDlg.cxx index e15a1bfd7..27674b988 100644 --- a/src/SMESHGUI/SMESHGUI_HomardAdaptDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_HomardAdaptDlg.cxx @@ -68,8 +68,7 @@ const int MARGIN = 9; // layout margin */ //================================================================================ SMESHGUI_HomardAdaptDlg::SMESHGUI_HomardAdaptDlg(SMESHHOMARD::HOMARD_Gen_ptr myHomardGen0) - : QDialog(SMESHGUI::desktop()), - myWorkingDir("") + : QDialog(SMESHGUI::desktop()) { MESSAGE("Debut du constructeur de SMESHGUI_HomardAdaptDlg"); myHomardGen = SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen0); @@ -105,20 +104,18 @@ SMESHGUI_HomardAdaptDlg::SMESHGUI_HomardAdaptDlg(SMESHHOMARD::HOMARD_Gen_ptr myH myAdvOpt->removeLogOnSuccessCheck->setChecked(false); // Working directory - myWorkingDir = QDir::tempPath(); + QString aWorkingDir = QDir::tempPath(); char *aTmp_dir = getenv("SALOME_TMP_DIR"); if (aTmp_dir != NULL) { QDir aTmpDir (aTmp_dir); if (aTmpDir.exists()) { - myWorkingDir = aTmpDir.absolutePath(); + aWorkingDir = aTmpDir.absolutePath(); } } - myAdvOpt->workingDirectoryLineEdit->setText(myWorkingDir); - QFileInfo anOutMedFile (QDir(myWorkingDir), "Uniform_01_R.med"); + myAdvOpt->workingDirectoryLineEdit->setText(aWorkingDir); // Out med file and/or mesh publication myArgs->myOutMedFileChk->setChecked(true); - myArgs->mySelectOutMedFileLineEdit->setText(anOutMedFile.absoluteFilePath()); myArgs->myOutPublishChk->setChecked(true); // buttons @@ -229,6 +226,8 @@ void SMESHGUI_HomardAdaptDlg::InitConnect() void SMESHGUI_HomardAdaptDlg::InitBoundarys() { MESSAGE("InitBoundarys"); + //myArgs->TWBoundary->clearContents(); + //myArgs->TWBoundary->clear(); // Pour les frontieres analytiques : la colonne des groupes SMESHHOMARD::ListGroupType_var _listeGroupesCas = myCase->GetGroups(); QTableWidgetItem *__colItem = new QTableWidgetItem(); @@ -262,10 +261,9 @@ void SMESHGUI_HomardAdaptDlg::InitBoundarys() // function : CheckCase // purpose : //================================================================================= -bool SMESHGUI_HomardAdaptDlg::CheckCase() +bool SMESHGUI_HomardAdaptDlg::CheckCase(bool fixCase) { MESSAGE("CheckCase"); - QString aCaseName = "Case_1"; QString aWorkingDir = myAdvOpt->workingDirectoryLineEdit->text().trimmed(); if (aWorkingDir == QString("")) { @@ -273,14 +271,6 @@ bool SMESHGUI_HomardAdaptDlg::CheckCase() QObject::tr("HOM_CASE_DIRECTORY_1") ); return false; } - if (aWorkingDir != myWorkingDir) { - QString CaseNameDir = myHomardGen->VerifieDir( aWorkingDir.toStdString().c_str()); - if ( ( CaseNameDir != "" ) & ( CaseNameDir != aCaseName ) ) { - QString texte = QObject::tr("HOM_CASE_DIRECTORY_2") + CaseNameDir; - QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), texte ); - return false; - } - } if (CHDIR(aWorkingDir.toStdString().c_str()) != 0) { QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), @@ -288,40 +278,42 @@ bool SMESHGUI_HomardAdaptDlg::CheckCase() return false; } - QString aFileName = myArgs->mySelectInMedFileLineEdit->text().trimmed(); - if (aFileName == QString("")) { - QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), - QObject::tr("HOM_CASE_MESH") ); - return false; - } + QString aMeshName, aFileName; + if (myArgs->myInMedFileRadio->isChecked()) { + aFileName = myArgs->mySelectInMedFileLineEdit->text().trimmed(); + if (aFileName == QString("")) { + QMessageBox::critical(0, QObject::tr("HOM_ERROR"), QObject::tr("HOM_CASE_MESH")); + return false; + } - // In mesh name - QString aMeshName = SMESH_HOMARD_QT_COMMUN::LireNomMaillage(aFileName); - if (aMeshName == "" ) { - QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), - QObject::tr("HOM_MED_FILE_2") ); - return false; + // In mesh name + aMeshName = SMESH_HOMARD_QT_COMMUN::LireNomMaillage(aFileName); + if (aMeshName == "") { + QMessageBox::critical(0, QObject::tr("HOM_ERROR"), QObject::tr("HOM_MED_FILE_2")); + return false; + } } - - // Out mesh name (initialize, if not yet) - if (myArgs->myOutMeshNameLineEdit->text().isEmpty()) { - myArgs->myOutMeshNameLineEdit->setText(aMeshName); + else { + aMeshName = myArgs->myInBrowserObject->text(); + if (aMeshName == "" || myMesh->_is_nil()) { + QMessageBox::critical(0, QObject::tr("HOM_ERROR"), + QObject::tr("Mesh object is not selected")); + return false; + } } // On verifie qu'un groupe n'est pas associe a deux frontieres differentes if (myArgs->CBBoundaryA->isChecked()) { - QStringList ListeGroup ; - QString NomGroup ; + QStringList ListeGroup; + QString NomGroup; int nbcol = myArgs->TWBoundary->columnCount(); int nbrow = myArgs->TWBoundary->rowCount(); for ( int col=1; col< nbcol; col++) { for ( int row=0; row< nbrow; row++) { if ( myArgs->TWBoundary->item( row, col )->checkState() == Qt::Checked ) { - // Nom du groupe + // Group name NomGroup = QString(myArgs->TWBoundary->item(row, 0)->text()) ; - //MESSAGE("NomGroup "<_is_nil()) { try { - myCase = myHomardGen->CreateCase - (CORBA::string_dup(aCaseName.toStdString().c_str()), - CORBA::string_dup(aMeshName.toStdString().c_str()), - CORBA::string_dup(aFileName.toStdString().c_str())); + if (myArgs->myInMedFileRadio->isChecked()) { + // create case from MED file + myCase = myHomardGen->CreateCase + (CORBA::string_dup(aMeshName.toStdString().c_str()), + CORBA::string_dup(aFileName.toStdString().c_str()), + aWorkingDir.toStdString().c_str()); + } + else { + // create case from SMESH_Mesh + myCase = myHomardGen->CreateCaseOnMesh + (CORBA::string_dup(aMeshName.toStdString().c_str()), + myMesh, + aWorkingDir.toStdString().c_str()); + } } catch( SALOME::SALOME_Exception& S_ex ) { QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), QObject::tr(CORBA::string_dup(S_ex.details.text)) ); return false; } - //myArgs->mySelectInMedFileLineEdit->setReadOnly(true); - //myArgs->mySelectInMedFileButton->hide(); + // Prevent changing case data + myArgs->myInMedFileRadio->setEnabled(false); + myArgs->myInBrowserRadio->setEnabled(false); + myArgs->mySelectInMedFileLineEdit->setReadOnly(true); + myArgs->mySelectInMedFileButton->setEnabled(false); + myArgs->myInBrowserObject->setReadOnly(true); + myAdvOpt->workingDirectoryLineEdit->setReadOnly(true); + myAdvOpt->workingDirectoryPushButton->setEnabled(false); InitBoundarys(); } // Repertoire et type - myCase->SetDirName(aWorkingDir.toStdString().c_str()); - myWorkingDir = aWorkingDir; myCase->SetConfType(myArgs->RBConforme->isChecked() ? 0 : 1); - //myCase->SetExtType(0); // ExtType // Menage des eventuelles frontieres deja enregistrees myCase->SupprBoundaryGroup(); @@ -373,10 +380,10 @@ bool SMESHGUI_HomardAdaptDlg::PushOnApply() MESSAGE("PushOnApply"); // Check data, create Case if not yet - if (!CheckCase()) + if (!CheckCase(true)) return false; - MESSAGE("PushOnApply: *** aaajfa *** 11"); + MESSAGE("PushOnApply: *** aaajfa *** 12"); // Create boundaries if (myArgs->RBBoundaryCAO->isChecked()) { @@ -395,65 +402,35 @@ bool SMESHGUI_HomardAdaptDlg::PushOnApply() QString NomGroup; int nbcol = myArgs->TWBoundary->columnCount(); int nbrow = myArgs->TWBoundary->rowCount(); - for ( int col=1; col< nbcol; col++) { - for ( int row=0; row< nbrow; row++) { + for ( int col = 1; col < nbcol; col++) { + for ( int row = 0; row < nbrow; row++) { if ( myArgs->TWBoundary->item( row, col )->checkState() == Qt::Checked ) { // Nom du groupe NomGroup = QString(myArgs->TWBoundary->item(row, 0)->text()) ; // Nom de la frontiere - QTableWidgetItem *__colItem = new QTableWidgetItem(); - __colItem = myArgs->TWBoundary->horizontalHeaderItem(col); + QTableWidgetItem *__colItem = myArgs->TWBoundary->horizontalHeaderItem(col); myCase->AddBoundaryGroup(QString(__colItem->text()).toStdString().c_str(), - NomGroup.toStdString().c_str()); + NomGroup.toStdString().c_str()); } } } } - MESSAGE("PushOnApply: *** aaajfa *** 12"); - - // create hypothesis - if (myHypothesis->_is_nil()) { - try { - myHypothesis = myHomardGen->CreateHypothesis("Hypo_1"); - myHypothesis->SetUnifRefinUnRef(1); - } - catch( SALOME::SALOME_Exception& S_ex ) { - QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), - QString(CORBA::string_dup(S_ex.details.text)) ); - //if (!myHypothesis->_is_nil()) { - // myHypothesis->Delete(); - // myHypothesis = SMESHHOMARD::HOMARD_Hypothesis::_nil(); - //} - return false; - } - } MESSAGE("PushOnApply: *** aaajfa *** 13"); - // create iteration - if (myIteration->_is_nil()) { - try { - myIteration = myCase->NextIteration("Iter_1"); - myIteration->AssociateHypo("Hypo_1"); - } - catch( SALOME::SALOME_Exception& S_ex ) { - QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), - QString(CORBA::string_dup(S_ex.details.text)) ); - return false; - } - } - // Verbose level? - myIteration->SetInfoCompute(myAdvOpt->verboseLevelSpin->value()); - // Output mesh name - myIteration->SetMeshName(myArgs->myOutMeshNameLineEdit->text().toStdString().c_str()); - // Output med file + // Output MED and MESH parameters + myHomardGen->SetKeepMedOUT(myArgs->myOutMedFileChk->isChecked()); + myHomardGen->SetPublishMeshOUT(myArgs->myOutPublishChk->isChecked()); + QString anOutMeshName = myArgs->myOutMeshNameLineEdit->text(); + if (anOutMeshName.isEmpty()) anOutMeshName = "DEFAULT_MESH_NAME"; + myHomardGen->SetMeshNameOUT(anOutMeshName.toStdString().c_str()); + + std::string aMeshFileOUT; if (myArgs->myOutMedFileChk->isChecked()) { QString anOutMed = myArgs->mySelectOutMedFileLineEdit->text(); if (anOutMed.isEmpty()) { // store in working directory and with default name - QString aMedFileIn = myArgs->mySelectInMedFileLineEdit->text().trimmed(); - QFileInfo aFileInfoIn (aMedFileIn); - aMedFileIn = aFileInfoIn.completeBaseName(); // name without path and last extension - QFileInfo aFileInfo (QDir(myWorkingDir), aMedFileIn + "_Uniform_01_R.med"); + QString aWorkingDir = myAdvOpt->workingDirectoryLineEdit->text().trimmed(); + QFileInfo aFileInfo (QDir(aWorkingDir), "Uniform_01_R.med"); anOutMed = aFileInfo.absoluteFilePath(); // show it myArgs->mySelectOutMedFileLineEdit->setText(anOutMed); @@ -462,34 +439,48 @@ bool SMESHGUI_HomardAdaptDlg::PushOnApply() QFileInfo aFileInfo (anOutMed); anOutMed = aFileInfo.absoluteFilePath(); } - myIteration->SetMeshFile(anOutMed.toStdString().c_str()); + aMeshFileOUT = anOutMed.toStdString(); } + else { + // Set file name without path for it to be created in current directory + // (it will be iteration's dir, and it will be destroyed after) + aMeshFileOUT = "Uniform_01_R.med"; + } + myHomardGen->SetMeshFileOUT(aMeshFileOUT.c_str()); + + // Advanced options + myHomardGen->SetVerboseLevel(myAdvOpt->verboseLevelSpin->value()); + myHomardGen->SetKeepWorkingFiles(myAdvOpt->keepWorkingFilesCheck->isChecked()); + myHomardGen->SetLogInFile(myAdvOpt->logInFileCheck->isChecked()); + myHomardGen->SetRemoveLogOnSuccess(myAdvOpt->removeLogOnSuccessCheck->isChecked()); + // Log file if (myAdvOpt->logInFileCheck->isChecked()) { // Write log file in the working dir - // Name of log file will be "_Uniform_01_R.med.log" - QString aMedFileIn = myArgs->mySelectInMedFileLineEdit->text().trimmed(); - QFileInfo aFileInfoIn (aMedFileIn); - aMedFileIn = aFileInfoIn.completeBaseName(); // name without path and last extension - QFileInfo aFileInfo (QDir(myWorkingDir), aMedFileIn + "_Uniform_01_R.med.log"); + QString aLogBaseName; + if (myArgs->myInMedFileRadio->isChecked()) { + // Name of log file will be "_Uniform_R.log" + QString aMedFileIn = myArgs->mySelectInMedFileLineEdit->text().trimmed(); + QFileInfo aFileInfoIn (aMedFileIn); + aLogBaseName = aFileInfoIn.fileName(); + } + else { + // Name of log file will be "SMESH_Mesh__Uniform_R.log" + aLogBaseName = "SMESH_Mesh_"; + aLogBaseName += myArgs->myInBrowserObject->text(); + } + QString aWorkingDir = myAdvOpt->workingDirectoryLineEdit->text().trimmed(); + QFileInfo aFileInfo (QDir(aWorkingDir), aLogBaseName + "_Uniform_R.log"); QString anOutLog = aFileInfo.absoluteFilePath(); - MESSAGE("myIteration->SetLogFile(" << anOutLog.toStdString().c_str() << ")"); - myIteration->SetLogFile(anOutLog.toStdString().c_str()); - MESSAGE("myIteration->GetLogFile() = " << myIteration->GetLogFile()); + MESSAGE("myHomardGen->SetLogFile(" << anOutLog.toStdString().c_str() << ")"); + myHomardGen->SetLogFile(anOutLog.toStdString().c_str()); } MESSAGE("PushOnApply: *** aaajfa *** 14"); - // compute and publish + // Compute and publish bool isSuccess = true; try { - int aCleanOption = 0; // report an error if output mesh file exists - int aModeHOMARD = 1; // adaptation - int anOption1 = -1; // appel depuis GUI - int anOption2 = 1; // do not publish to SMESH - if (myArgs->myOutPublishChk->isChecked()) - anOption2 = 2; // publish to SMESH - isSuccess = myHomardGen->Compute("Iter_1", aCleanOption, aModeHOMARD, - anOption1, anOption2) == 0; + isSuccess = myHomardGen->Compute() == 0; } catch( SALOME::SALOME_Exception& S_ex ) { QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), @@ -497,38 +488,26 @@ bool SMESHGUI_HomardAdaptDlg::PushOnApply() isSuccess = false; } MESSAGE("PushOnApply: *** aaajfa *** 15"); - // case 1131: // Publication du maillage de l'iteration - // homardGen->PublishMeshIterInSmesh(_ObjectName.toStdString().c_str()); - // case 1132: // Publication du maillage de l'iteration a partir du fichier - // homardGen->PublishResultInSmesh(_ObjectName.toStdString().c_str(), 1); - if (isSuccess) + // Update Object Browser + if (isSuccess) { SMESHGUI::GetSMESHGUI()->updateObjBrowser(); - // Remove log file and delete iteration object - MESSAGE("myIteration->GetLogFile() = " << myIteration->GetLogFile()); - if (isSuccess && - myAdvOpt->logInFileCheck->isChecked() && - myAdvOpt->removeLogOnSuccessCheck->isChecked()) { - // Remove log file on success - QFile(myIteration->GetLogFile()).remove(); + // Clean case, as it is deleted after successful Compute + myCase = SMESHHOMARD::HOMARD_Cas::_nil(); } - MESSAGE("PushOnApply: *** aaajfa *** 16"); - - // Delete iteration object - // This also removes all working files, if keepWorkingFilesCheck is not checked - myIteration->Delete(0, !myAdvOpt->keepWorkingFilesCheck->isChecked()); - // Delete hypothesis and case - if (!myHypothesis->_is_nil()) myHypothesis->Delete(); - if (!myCase->_is_nil()) myCase->Delete(1); + // Enable new case data selection + myArgs->myInMedFileRadio->setEnabled(true); + myArgs->myInBrowserRadio->setEnabled(true); + myArgs->mySelectInMedFileLineEdit->setReadOnly(false); + //myArgs->mySelectInMedFileButton->hide(); + myArgs->mySelectInMedFileButton->setEnabled(true); + myArgs->myInBrowserObject->setReadOnly(false); + myAdvOpt->workingDirectoryLineEdit->setReadOnly(false); + myAdvOpt->workingDirectoryPushButton->setEnabled(true); - MESSAGE("PushOnApply: *** aaajfa *** 17"); - myIteration = SMESHHOMARD::HOMARD_Iteration::_nil(); - myHypothesis = SMESHHOMARD::HOMARD_Hypothesis::_nil(); - myCase = SMESHHOMARD::HOMARD_Cas::_nil(); MESSAGE("PushOnApply: *** aaajfa *** THE END"); - return isSuccess; } @@ -551,65 +530,66 @@ void SMESHGUI_HomardAdaptDlg::PushOnHelp() void SMESHGUI_HomardAdaptDlg::updateSelection() { LightApp_SelectionMgr *selMgr = SMESHGUI::selectionMgr(); - disconnect( selMgr, 0, this, 0 ); + disconnect(selMgr, 0, this, 0); selMgr->clearFilters(); - SMESH::SetPointRepresentation( false ); - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() ) - aViewWindow->SetSelectionMode( ActorSelection ); - if (myArgs->myInBrowserRadio->isChecked()) - { - connect( selMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( selectionChanged() )); + if (!myArgs->myInBrowserRadio->isChecked()) + return; + + SMESH::SetPointRepresentation(false); + if (SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow()) + aViewWindow->SetSelectionMode(ActorSelection); + if (myArgs->myInBrowserRadio->isChecked()) { + connect(selMgr, SIGNAL(currentSelectionChanged()), this, SLOT(selectionChanged())); selectionChanged(); } - } + void SMESHGUI_HomardAdaptDlg::selectionChanged() { + if (!myArgs->myInBrowserRadio->isChecked()) + return; + LightApp_SelectionMgr *selMgr = SMESHGUI::selectionMgr(); - //~ get selected mesh + // get selected mesh SALOME_ListIO aList; selMgr->selectedObjects(aList); - QString aString = ""; - int nbSel = aList.Extent(); - if (nbSel != 1) - return; - - Handle(SALOME_InteractiveObject) IO = aList.First(); - SMESH::SMESH_Mesh_var mesh = SMESH::GetMeshByIO(IO); - if ( !mesh->_is_nil() ) - { - myMesh = mesh; - - SMESH::SMESH_IDSource_var sSelectedObj = SMESH::IObjectToInterface( IO ); - if ( sSelectedObj->_is_nil() ) - return; + QString aMeshName = ""; + + if (aList.Extent() == 1) { + Handle(SALOME_InteractiveObject) IO = aList.First(); + myMesh = SMESH::GetMeshByIO(IO); + SMESH::GetNameOfSelectedIObjects(selMgr, aMeshName); + if (aMeshName.isEmpty()) aMeshName = " "; + else aMeshName = aMeshName.trimmed(); } - else - return; - - SMESH::GetNameOfSelectedIObjects( selMgr, aString ); - if ( aString.isEmpty() ) aString = " "; - else aString = aString.trimmed(); - - //bool ok = !aString.isEmpty(); - if ( !mesh->_is_nil() ) - { - myArgs->myInBrowserObject->setText( aString ); - myArgs->myOutMeshNameLineEdit->setText( aString ); - myArgs->mySelectOutMedFileLineEdit->setText(aString + QString("_Uniform_01_R.med")); + else { + myMesh = SMESH::SMESH_Mesh::_nil(); } -} -void SMESHGUI_HomardAdaptDlg::setMyMesh(SMESH::SMESH_Mesh_var mesh) -{ - myMesh = mesh; -} + myArgs->myInBrowserObject->setText(aMeshName); -SMESH::SMESH_Mesh_var SMESHGUI_HomardAdaptDlg::getMyMesh() -{ - return myMesh; + // Out mesh name default value + // TODO: add some suffix? "_R" or "_UnifRefin", or "_Uniform_01_R" + myArgs->myOutMeshNameLineEdit->setText(aMeshName); + + // Output med file default value + // Construct it from Input mesh name and working directory + //if (myArgs->myOutMedFileChk->isChecked()) { + if (aMeshName.isEmpty()) { + myArgs->mySelectOutMedFileLineEdit->setText(""); + } + else { + QString aWorkingDir = myAdvOpt->workingDirectoryLineEdit->text().trimmed(); + QFileInfo aFileInfo (QDir(aWorkingDir), aMeshName + QString("_Uniform_01_R.med")); + for (int ii = 1; aFileInfo.exists(); ii++) { + QString anUniqueName = QString("%1_Uniform_01_R_%2.med").arg(aMeshName).arg(ii); + aFileInfo.setFile(QDir(aWorkingDir), anUniqueName); + } + myArgs->mySelectOutMedFileLineEdit->setText(aFileInfo.absoluteFilePath()); + } + //} } void SMESHGUI_HomardAdaptDlg::SetFileName() @@ -621,22 +601,33 @@ void SMESHGUI_HomardAdaptDlg::SetFileName() fileName = fileName0; if (fileName.isEmpty()) return; } - QFileInfo aFileInfo (fileName); - fileName = aFileInfo.absoluteFilePath(); + QFileInfo aFileInInfo (fileName); + fileName = aFileInInfo.absoluteFilePath(); myArgs->mySelectInMedFileLineEdit->setText(fileName); + // Out mesh name default value + // TODO: add some suffix? "_R" or "_UnifRefin", or "_Uniform_01_R" + QString aMeshName = SMESH_HOMARD_QT_COMMUN::LireNomMaillage(fileName); + myArgs->myOutMeshNameLineEdit->setText(aMeshName); + // Output med file default value - if (myArgs->myOutMedFileChk->isChecked()) { - std::string fname = fileName.toStdString(); - size_t lastdot = fname.find_last_of("."); - if (lastdot != std::string::npos) - fname = fname.substr(0, lastdot); - QString outF = QString(fname.c_str()) + QString("_Uniform_01_R.med"); - myArgs->mySelectOutMedFileLineEdit->setText(outF); + // Construct it from Input med file name and path + //if (myArgs->myOutMedFileChk->isChecked()) { + std::string fname = fileName.toStdString(); + size_t lastdot = fname.find_last_of("."); + if (lastdot != std::string::npos) + fname = fname.substr(0, lastdot); + QString fileNameOut = fname.c_str(); + QFileInfo aFileInfo (fileNameOut + QString("_Uniform_01_R.med")); + for (int ii = 1; aFileInfo.exists(); ii++) { + QString anUniqueName = QString("%1_Uniform_01_R_%2.med").arg(fileNameOut).arg(ii); + aFileInfo.setFile(anUniqueName); } + myArgs->mySelectOutMedFileLineEdit->setText(aFileInfo.absoluteFilePath()); + //} // Check data - CheckCase(); + CheckCase(false); } // ------------------------------------------------------------------------ @@ -698,7 +689,7 @@ void SMESHGUI_HomardAdaptDlg::SetBoundaryD() { MESSAGE("Debut de SetBoundaryD "); if (myArgs->CBBoundaryD->isChecked()) { - bool bOK = CheckCase(); + bool bOK = CheckCase(true); if (bOK) { myArgs->GBBoundaryD->setVisible(1); } @@ -712,8 +703,8 @@ void SMESHGUI_HomardAdaptDlg::SetBoundaryD() myArgs->GBBoundaryD->setVisible(0); } - myArgs->mySelectInMedFileLineEdit->setReadOnly(true); - myArgs->mySelectInMedFileButton->hide(); + //myArgs->mySelectInMedFileLineEdit->setReadOnly(true); + //myArgs->mySelectInMedFileButton->hide(); adjustSize(); } @@ -756,7 +747,7 @@ void SMESHGUI_HomardAdaptDlg::SetBoundaryA() { MESSAGE("Debut de SetBoundaryA "); if (myArgs->CBBoundaryA->isChecked()) { - bool bOK = CheckCase(); + bool bOK = CheckCase(true); if (bOK) { myArgs->GBBoundaryA->setVisible(1); } @@ -770,8 +761,8 @@ void SMESHGUI_HomardAdaptDlg::SetBoundaryA() myArgs->GBBoundaryA->setVisible(0); } - myArgs->mySelectInMedFileLineEdit->setReadOnly(true); - myArgs->mySelectInMedFileButton->hide(); + //myArgs->mySelectInMedFileLineEdit->setReadOnly(true); + //myArgs->mySelectInMedFileButton->hide(); adjustSize(); } @@ -858,7 +849,7 @@ void SMESHGUI_HomardAdaptArguments::setupUi(QWidget *CreateCase) QGroupBox* aMeshIn = new QGroupBox( tr( "MeshIn" ), this ); myInMedFileRadio = new QRadioButton( tr( "MEDFile" ), aMeshIn ); myInBrowserRadio = new QRadioButton( tr( "Browser" ), aMeshIn ); - myInBrowserObject = new QLineEdit( aMeshIn ); + myInBrowserObject = new QLineEdit( aMeshIn ); mySelectInMedFileButton = new QPushButton("...", aMeshIn); mySelectInMedFileLineEdit = new QLineEdit( aMeshIn ); @@ -952,11 +943,11 @@ void SMESHGUI_HomardAdaptArguments::setupUi(QWidget *CreateCase) CBBoundaryD = new QCheckBox(tr("BOUNDARY_DISCRETE"), GBBoundaryN); CBBoundaryA = new QCheckBox(tr("BOUNDARY_ANALYTICAL"), GBBoundaryN); - hboxLayout3 = new QHBoxLayout(GBBoundaryN); - hboxLayout3->setSpacing(6); - hboxLayout3->setContentsMargins(0, 0, 0, 0); - hboxLayout3->addWidget(CBBoundaryD); - hboxLayout3->addWidget(CBBoundaryA); + //hboxLayout3 = new QHBoxLayout(GBBoundaryN); + //hboxLayout3->setSpacing(6); + //hboxLayout3->setContentsMargins(0, 0, 0, 0); + //hboxLayout3->addWidget(CBBoundaryD); + //hboxLayout3->addWidget(CBBoundaryA); // discrete GBBoundaryD = new QGroupBox(tr("Discrete boundary"), GBBoundaryN); @@ -1034,6 +1025,14 @@ void SMESHGUI_HomardAdaptArguments::setupUi(QWidget *CreateCase) formLayout->setLayout(0, QFormLayout::FieldRole, gridLayout1); + // Boundary No Layout + QGridLayout* aBoundaryNoLayout = new QGridLayout(GBBoundaryN); + //aBoundaryNoLayout->addLayout(hboxLayout3, 0, 0); + aBoundaryNoLayout->addWidget(CBBoundaryD, 0, 0); + aBoundaryNoLayout->addWidget(CBBoundaryA, 0, 1); + aBoundaryNoLayout->addWidget(GBBoundaryD, 1, 0, 1, 2); + aBoundaryNoLayout->addWidget(GBBoundaryA, 2, 0, 1, 2); + // Boundary type Layout QGridLayout* aBoundTypeLayout = new QGridLayout(GBTypeBoun); aBoundTypeLayout->addWidget(RBBoundaryNo, 0, 0); diff --git a/src/SMESHGUI/SMESHGUI_HomardAdaptDlg.h b/src/SMESHGUI/SMESHGUI_HomardAdaptDlg.h index 64242c133..ebc5327b7 100644 --- a/src/SMESHGUI/SMESHGUI_HomardAdaptDlg.h +++ b/src/SMESHGUI/SMESHGUI_HomardAdaptDlg.h @@ -64,9 +64,6 @@ class SMESHGUI_EXPORT SMESHGUI_HomardAdaptDlg : public QDialog SMESHGUI_HomardAdaptDlg(SMESHHOMARD::HOMARD_Gen_ptr theHomardGen); ~SMESHGUI_HomardAdaptDlg(); - void setMyMesh(SMESH::SMESH_Mesh_var); - SMESH::SMESH_Mesh_var getMyMesh(); - void AddBoundaryCAO(QString newBoundary); void AddBoundaryAn(QString newBoundary); void AddBoundaryDi(QString newBoundary); @@ -75,8 +72,6 @@ class SMESHGUI_EXPORT SMESHGUI_HomardAdaptDlg : public QDialog QString myWorkingDir; SMESHHOMARD::HOMARD_Cas_var myCase; - SMESHHOMARD::HOMARD_Hypothesis_var myHypothesis; - SMESHHOMARD::HOMARD_Iteration_var myIteration; SALOME::GenericObj_wrap< SMESHHOMARD::HOMARD_Gen > myHomardGen; virtual void InitConnect(); @@ -103,7 +98,7 @@ class SMESHGUI_EXPORT SMESHGUI_HomardAdaptDlg : public QDialog virtual void PushBoundaryAnEdit(); virtual void PushBoundaryAnHelp(); - bool CheckCase(); + bool CheckCase(bool fixCase); virtual void PushOnOK(); virtual bool PushOnApply(); diff --git a/src/SMESHGUI/SMESHGUI_HomardBoundaryDlg.cxx b/src/SMESHGUI/SMESHGUI_HomardBoundaryDlg.cxx index 67c18a5ae..7d51a886a 100644 --- a/src/SMESHGUI/SMESHGUI_HomardBoundaryDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_HomardBoundaryDlg.cxx @@ -53,7 +53,6 @@ SMESH_CreateBoundaryAn::SMESH_CreateBoundaryAn(SMESHGUI_HomardAdaptDlg* parent, QDialog(0), SMESH_Ui_CreateBoundaryAn(), _parent(parent), _Name (""), - _aCaseName(caseName), _Type(1), _BoundaryAnXcentre(0), _BoundaryAnYcentre(0), _BoundaryAnZcentre(0), _BoundaryAnRayon(0), _BoundaryAnXaxis(0), _BoundaryAnYaxis(0), _BoundaryAnZaxis(0), @@ -112,7 +111,6 @@ SMESH_CreateBoundaryAn::SMESH_CreateBoundaryAn(SMESHGUI_HomardAdaptDlg* parent, QDialog(0), SMESH_Ui_CreateBoundaryAn(), _parent(parent), _Name (""), - _aCaseName(caseName), _Type(1), _BoundaryAnXcentre(0), _BoundaryAnYcentre(0), _BoundaryAnZcentre(0), _BoundaryAnRayon(0), _BoundaryAnXaxis(0), _BoundaryAnYaxis(0), _BoundaryAnZaxis(0), @@ -169,12 +167,10 @@ void SMESH_CreateBoundaryAn::InitConnect() void SMESH_CreateBoundaryAn::InitValBoundaryAn() // ------------------------------------------------------------------------ { -// -// 1. Les coordonnees extremes du maillage -// - if (_aCaseName == QString("")) { return; } - - SMESHHOMARD::HOMARD_Cas_var aCas = myHomardGen->GetCase(_aCaseName.toStdString().c_str()); + // + // 1. Les coordonnees extremes du maillage + // + SMESHHOMARD::HOMARD_Cas_var aCas = myHomardGen->GetCase(); SMESHHOMARD::extrema_var MesExtremes = aCas->GetBoundingBox(); int num = MesExtremes->length() ; ASSERT(num == 10); @@ -818,8 +814,7 @@ SMESH_CreateBoundaryCAO::SMESH_CreateBoundaryCAO(SMESHGUI_HomardAdaptDlg* parent : QDialog(0), SMESH_Ui_CreateBoundaryCAO(), _parent(parent), _aName(aName), - myHomardGen(SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen0)), - _aCaseName(caseName) + myHomardGen(SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen0)) { MESSAGE("Constructeur") ; setupUi(this); @@ -879,7 +874,7 @@ bool SMESH_CreateBoundaryCAO::PushOnApply() _aName=aName; aBoundary=myHomardGen->CreateBoundaryCAO(CORBA::string_dup(_aName.toStdString().c_str()), aCAOFile.toStdString().c_str()); _parent->AddBoundaryCAO(_aName); - aBoundary->SetCaseCreation(_aCaseName.toStdString().c_str()); + aBoundary->SetCaseCreation("Case_1"); } catch( SALOME::SALOME_Exception& S_ex ) { @@ -968,14 +963,10 @@ void SMESH_CreateBoundaryCAO::SetFiltrage() // // ------------------------------------------------------------------------ { if (!CBGroupe->isChecked()) return; - if (_aCaseName.toStdString().c_str() == QString()) { - QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), - QObject::tr("HOM_BOUN_CASE") ); - return; - } - SMESH_CreateListGroupCAO *aDlg = new SMESH_CreateListGroupCAO(this, true, SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen), - _aCaseName, _listeGroupesBoundary) ; + SMESH_CreateListGroupCAO *aDlg = new SMESH_CreateListGroupCAO + (this, true, SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen), + "Case_1", _listeGroupesBoundary); aDlg->show(); } @@ -988,8 +979,7 @@ SMESH_CreateBoundaryDi::SMESH_CreateBoundaryDi(SMESHGUI_HomardAdaptDlg* parent, : QDialog(0), SMESH_Ui_CreateBoundaryDi(), _parent(parent), _aName(aName), - myHomardGen(SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen0)), - _aCaseName(caseName) + myHomardGen(SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen0)) { MESSAGE("Constructeur") ; setupUi(this); @@ -1058,7 +1048,7 @@ bool SMESH_CreateBoundaryDi::PushOnApply() _aName=aName; aBoundary=myHomardGen->CreateBoundaryDi(CORBA::string_dup(_aName.toStdString().c_str()), aMeshName.toStdString().c_str(), aMeshFile.toStdString().c_str()); _parent->AddBoundaryDi(_aName); - aBoundary->SetCaseCreation(_aCaseName.toStdString().c_str()); + aBoundary->SetCaseCreation("Case_1"); } catch( SALOME::SALOME_Exception& S_ex ) { @@ -1147,15 +1137,10 @@ void SMESH_CreateBoundaryDi::SetFiltrage() // // ------------------------------------------------------------------------ { if (!CBGroupe->isChecked()) return; - if (_aCaseName.toStdString().c_str() == QString()) { - QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), - QObject::tr("HOM_BOUN_CASE") ); - return; - } SMESH_CreateListGroup *aDlg = new SMESH_CreateListGroup (this, true, SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen), - _aCaseName, _listeGroupesBoundary); + "Case_1", _listeGroupesBoundary); aDlg->show(); } @@ -1190,7 +1175,7 @@ void SMESH_EditBoundaryAn::InitValEdit() _Type = aBoundaryAn->GetType(); MESSAGE("_Type : "<<_Type); InitValBoundaryAnLimit(); - if (_aCaseName != QString("")) InitValBoundaryAn(); + InitValBoundaryAn(); switch (_Type) { case 1 : // il s agit d un cylindre @@ -1543,14 +1528,11 @@ SMESH_EditBoundaryCAO::SMESH_EditBoundaryCAO( SMESHGUI_HomardAdaptDlg* parent, b { MESSAGE("Debut de Boundary pour " << Name.toStdString().c_str()); setWindowTitle(QObject::tr("HOM_BOUN_C_EDIT_WINDOW_TITLE")); - try - { - aBoundary=myHomardGen->GetBoundary(CORBA::string_dup(_aName.toStdString().c_str())); - if (caseName==QString("")) { _aCaseName=aBoundary->GetCaseCreation();} - InitValEdit(); + try { + aBoundary = myHomardGen->GetBoundary(CORBA::string_dup(_aName.toStdString().c_str())); + InitValEdit(); } - catch( SALOME::SALOME_Exception& S_ex ) - { + catch( SALOME::SALOME_Exception& S_ex ) { QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), QObject::tr(CORBA::string_dup(S_ex.details.text)) ); return; @@ -1591,18 +1573,12 @@ void SMESH_EditBoundaryCAO::SetFiltrage() // // ------------------------------------------------------------------------ { if (!CBGroupe->isChecked()) return; - if (_aCaseName.toStdString().c_str() == QString()) - { - QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), - QObject::tr("HOM_BOUN_CASE") ); - return; - } - SMESHHOMARD::HOMARD_Cas_var monCas= myHomardGen->GetCase(_aCaseName.toStdString().c_str()); + SMESHHOMARD::HOMARD_Cas_var monCas = myHomardGen->GetCase(); SMESHHOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups(); SMESH_EditListGroupCAO *aDlg = new SMESH_EditListGroupCAO (this, true, SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen), - _aCaseName, _listeGroupesBoundary) ; + "Case_1", _listeGroupesBoundary) ; aDlg->show(); } @@ -1618,14 +1594,11 @@ SMESH_EditBoundaryDi::SMESH_EditBoundaryDi( SMESHGUI_HomardAdaptDlg* parent, boo { MESSAGE("Debut de Boundary pour " << Name.toStdString().c_str()); setWindowTitle(QObject::tr("HOM_BOUN_D_EDIT_WINDOW_TITLE")); - try - { - aBoundary=myHomardGen->GetBoundary(CORBA::string_dup(_aName.toStdString().c_str())); - if (caseName==QString("")) { _aCaseName=aBoundary->GetCaseCreation();} - InitValEdit(); + try { + aBoundary = myHomardGen->GetBoundary(CORBA::string_dup(_aName.toStdString().c_str())); + InitValEdit(); } - catch( SALOME::SALOME_Exception& S_ex ) - { + catch( SALOME::SALOME_Exception& S_ex ) { QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), QObject::tr(CORBA::string_dup(S_ex.details.text)) ); return; @@ -1666,17 +1639,11 @@ void SMESH_EditBoundaryDi::SetFiltrage() // // ------------------------------------------------------------------------ { if (!CBGroupe->isChecked()) return; - if (_aCaseName.toStdString().c_str() == QString()) - { - QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), - QObject::tr("HOM_BOUN_CASE") ); - return; - } - SMESHHOMARD::HOMARD_Cas_var monCas= myHomardGen->GetCase(_aCaseName.toStdString().c_str()); + SMESHHOMARD::HOMARD_Cas_var monCas = myHomardGen->GetCase(); SMESHHOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups(); SMESH_EditListGroup *aDlg = new SMESH_EditListGroup (this, true, SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen), - _aCaseName, _listeGroupesBoundary); + "Case_1", _listeGroupesBoundary); aDlg->show(); } diff --git a/src/SMESHGUI/SMESHGUI_HomardBoundaryDlg.h b/src/SMESHGUI/SMESHGUI_HomardBoundaryDlg.h index 208cd4509..b627d3f5b 100644 --- a/src/SMESHGUI/SMESHGUI_HomardBoundaryDlg.h +++ b/src/SMESHGUI/SMESHGUI_HomardBoundaryDlg.h @@ -25,7 +25,6 @@ #include #include -//#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) #include CORBA_CLIENT_HEADER(SMESH_Homard) #include @@ -45,8 +44,6 @@ class SMESHGUI_HomardAdaptDlg; -QT_BEGIN_NAMESPACE - class SMESH_Ui_CreateBoundaryAn { public: @@ -812,13 +809,8 @@ public: buttonApply->setText(QApplication::translate("CreateBoundaryAn", "Apply", nullptr)); buttonOk->setText(QApplication::translate("CreateBoundaryAn", "OK", nullptr)); } // retranslateUi - }; -namespace Ui { - class CreateBoundaryAn: public SMESH_Ui_CreateBoundaryAn {}; -} // namespace Ui - class SMESH_Ui_CreateBoundaryCAO { public: @@ -941,13 +933,8 @@ public: XAO->setText(QApplication::translate("CreateBoundaryCAO", "XAO", nullptr)); Name->setText(QApplication::translate("CreateBoundaryCAO", "Name", nullptr)); } // retranslateUi - }; -namespace Ui { - class CreateBoundaryCAO: public SMESH_Ui_CreateBoundaryCAO {}; -} // namespace Ui - class SMESH_Ui_CreateBoundaryDi { public: @@ -1070,60 +1057,52 @@ public: Mesh->setText(QApplication::translate("CreateBoundaryDi", "Mesh", nullptr)); Name->setText(QApplication::translate("CreateBoundaryDi", "Name", nullptr)); } // retranslateUi - }; -namespace Ui { - class CreateBoundaryDi: public SMESH_Ui_CreateBoundaryDi {}; -} // namespace Ui - -QT_END_NAMESPACE - class SMESHGUI_EXPORT SMESH_CreateBoundaryAn : public QDialog, public SMESH_Ui_CreateBoundaryAn { - Q_OBJECT + Q_OBJECT public: - SMESH_CreateBoundaryAn( SMESHGUI_HomardAdaptDlg* parent, bool modal, - SMESHHOMARD::HOMARD_Gen_var myHomardGen, - QString caseName); - virtual ~SMESH_CreateBoundaryAn(); + SMESH_CreateBoundaryAn (SMESHGUI_HomardAdaptDlg* parent, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen, + QString caseName); + virtual ~SMESH_CreateBoundaryAn(); protected : - SMESH_CreateBoundaryAn( SMESHGUI_HomardAdaptDlg* parent, - SMESHHOMARD::HOMARD_Gen_var myHomardGen, - QString caseName); - - SMESHGUI_HomardAdaptDlg * _parent; - - QString _Name; - QString _aCaseName; - - int _Type; - double _BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnRayon; - double _BoundaryAnXaxis, _BoundaryAnYaxis, _BoundaryAnZaxis; - double _Xcentre, _Ycentre, _Zcentre, _Rayon ; - double _Xmin, _Xmax, _Xincr, _Ymin, _Ymax, _Yincr, _Zmin, _Zmax, _Zincr, _DMax ; - double _BoundaryAnXcone1, _BoundaryAnYcone1, _BoundaryAnZcone1, _BoundaryAnRayon1; - double _BoundaryAnXcone2, _BoundaryAnYcone2, _BoundaryAnZcone2, _BoundaryAnRayon2; - double _BoundaryAnXaxisCone, _BoundaryAnYaxisCone, _BoundaryAnZaxisCone; - double _BoundaryAnXorigCone, _BoundaryAnYorigCone, _BoundaryAnZorigCone; - double _BoundaryAngle; - double _BoundaryAnToreXcentre, _BoundaryAnToreYcentre, _BoundaryAnToreZcentre; - double _BoundaryAnToreXaxe, _BoundaryAnToreYaxe, _BoundaryAnToreZaxe; - double _BoundaryAnToreRRev, _BoundaryAnToreRPri; - - bool Chgt; - - SMESHHOMARD::HOMARD_Boundary_var aBoundaryAn ; - SMESHHOMARD::HOMARD_Gen_var myHomardGen; - - virtual void InitConnect(); - virtual void InitValBoundaryAn(); - virtual void InitMinMax(); - virtual void SetNewName(); - virtual bool CreateOrUpdateBoundaryAn(); - virtual void convertRayonAngle(int option); + SMESH_CreateBoundaryAn (SMESHGUI_HomardAdaptDlg* parent, + SMESHHOMARD::HOMARD_Gen_var myHomardGen, + QString caseName); + + SMESHGUI_HomardAdaptDlg * _parent; + + QString _Name; + + int _Type; + double _BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnRayon; + double _BoundaryAnXaxis, _BoundaryAnYaxis, _BoundaryAnZaxis; + double _Xcentre, _Ycentre, _Zcentre, _Rayon ; + double _Xmin, _Xmax, _Xincr, _Ymin, _Ymax, _Yincr, _Zmin, _Zmax, _Zincr, _DMax ; + double _BoundaryAnXcone1, _BoundaryAnYcone1, _BoundaryAnZcone1, _BoundaryAnRayon1; + double _BoundaryAnXcone2, _BoundaryAnYcone2, _BoundaryAnZcone2, _BoundaryAnRayon2; + double _BoundaryAnXaxisCone, _BoundaryAnYaxisCone, _BoundaryAnZaxisCone; + double _BoundaryAnXorigCone, _BoundaryAnYorigCone, _BoundaryAnZorigCone; + double _BoundaryAngle; + double _BoundaryAnToreXcentre, _BoundaryAnToreYcentre, _BoundaryAnToreZcentre; + double _BoundaryAnToreXaxe, _BoundaryAnToreYaxe, _BoundaryAnToreZaxe; + double _BoundaryAnToreRRev, _BoundaryAnToreRPri; + + bool Chgt; + + SMESHHOMARD::HOMARD_Boundary_var aBoundaryAn; + SMESHHOMARD::HOMARD_Gen_var myHomardGen; + + virtual void InitConnect(); + virtual void InitValBoundaryAn(); + virtual void InitMinMax(); + virtual void SetNewName(); + virtual bool CreateOrUpdateBoundaryAn(); + virtual void convertRayonAngle(int option); public slots: virtual void SetCylinder(); @@ -1135,7 +1114,6 @@ public slots: virtual void PushOnOK(); virtual bool PushOnApply(); virtual void PushOnHelp(); - }; class SMESHGUI_EXPORT SMESH_EditBoundaryAn : public SMESH_CreateBoundaryAn @@ -1161,9 +1139,6 @@ protected : void InitValBoundaryAnConeR(); void InitValBoundaryAnConeA(); void InitValBoundaryAnTore(); - -public slots: - }; class SMESHGUI_EXPORT SMESH_CreateBoundaryCAO : public QDialog, public SMESH_Ui_CreateBoundaryCAO @@ -1182,8 +1157,6 @@ protected : SMESHGUI_HomardAdaptDlg *_parent; QString _aName; - QString _aCaseName; - SMESHHOMARD::HOMARD_Boundary_var aBoundary; SMESHHOMARD::HOMARD_Gen_var myHomardGen; @@ -1216,9 +1189,6 @@ protected : virtual void InitValEdit(); virtual bool PushOnApply(); virtual void SetFiltrage(); - -public slots: - }; class SMESHGUI_EXPORT SMESH_CreateBoundaryDi : public QDialog, public SMESH_Ui_CreateBoundaryDi @@ -1237,8 +1207,6 @@ protected : SMESHGUI_HomardAdaptDlg *_parent; QString _aName; - QString _aCaseName; - SMESHHOMARD::HOMARD_Boundary_var aBoundary; SMESHHOMARD::HOMARD_Gen_var myHomardGen; @@ -1271,9 +1239,6 @@ protected : virtual void InitValEdit(); virtual bool PushOnApply(); virtual void SetFiltrage(); - -public slots: - }; #endif // MON_CREATEBOUNDARY_H diff --git a/src/SMESHGUI/SMESHGUI_HomardListGroup.cxx b/src/SMESHGUI/SMESHGUI_HomardListGroup.cxx index afd42ebef..ab7050cd2 100644 --- a/src/SMESHGUI/SMESHGUI_HomardListGroup.cxx +++ b/src/SMESHGUI/SMESHGUI_HomardListGroup.cxx @@ -123,7 +123,7 @@ void SMESH_CreateListGroupCAO::InitGroupes() TWGroupe->removeRow(row); TWGroupe->setRowCount(0); if (_aCaseName == QString("")) { return; }; - SMESHHOMARD::HOMARD_Cas_var monCas= myHomardGen->GetCase(_aCaseName.toStdString().c_str()); + SMESHHOMARD::HOMARD_Cas_var monCas = myHomardGen->GetCase(); SMESHHOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups(); for ( int i = 0; i < _listeGroupesCas->length(); i++ ) { TWGroupe->insertRow(i); @@ -231,7 +231,7 @@ void SMESH_CreateListGroup::InitGroupes() TWGroupe->removeRow(row); TWGroupe->setRowCount(0); if (_aCaseName == QString("")) { return; }; - SMESHHOMARD::HOMARD_Cas_var monCas= myHomardGen->GetCase(_aCaseName.toStdString().c_str()); + SMESHHOMARD::HOMARD_Cas_var monCas = myHomardGen->GetCase(); SMESHHOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups(); for ( int i = 0; i < _listeGroupesCas->length(); i++ ) { diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index 2feb9c346..a2b347f0d 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -3029,6 +3029,10 @@ Check algorithm documentation for supported geometry ADAPT_PREF_NONE None + + ADAPT_WITH_HOMARD + Adaptation with HOMARD + ADAPT_PREF_MG_ADAPT Adaptation with MG-Adapt diff --git a/src/SMESHGUI/SMESH_msg_fr.ts b/src/SMESHGUI/SMESH_msg_fr.ts index 5ff731606..839175130 100644 --- a/src/SMESHGUI/SMESH_msg_fr.ts +++ b/src/SMESHGUI/SMESH_msg_fr.ts @@ -3011,6 +3011,10 @@ Référez-vous à la documentation sur l'algorithme et la géométrie supportée ADAPT_PREF_NONE Sans + + ADAPT_WITH_HOMARD + Adaptation avec HOMARD + ADAPT_PREF_MG_ADAPT Adaptation avec MG-Adapt diff --git a/src/SMESH_I/SMESH_Homard_i.cxx b/src/SMESH_I/SMESH_Homard_i.cxx index 613371d68..f547f2762 100644 --- a/src/SMESH_I/SMESH_Homard_i.cxx +++ b/src/SMESH_I/SMESH_Homard_i.cxx @@ -17,20 +17,11 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// Remarques : -// L'ordre de description des fonctions est le meme dans tous les fichiers -// HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx : -// 1. Les generalites : Name, Delete, DumpPython, Dump, Restore -// 2. Les caracteristiques -// 3. Le lien avec les autres structures -// -// Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier -// - #include "SMESH_Homard_i.hxx" #include "SMESH_Homard.hxx" #include +#include "SMESH_PythonDump.hxx" //#include "FrontTrack.hxx" @@ -85,23 +76,23 @@ namespace SMESHHOMARD_I */ //============================================================================= HOMARD_Boundary_i::HOMARD_Boundary_i() + : SALOME::GenericObj_i(SMESH_Gen_i::GetPOA()) { - MESSAGE( "Default constructor, not for use" ); - ASSERT( 0 ); + MESSAGE("Default constructor, not for use"); + ASSERT(0); } //============================================================================= /*! * standard constructor */ //============================================================================= -HOMARD_Boundary_i::HOMARD_Boundary_i( CORBA::ORB_ptr orb, - SMESHHOMARD::HOMARD_Gen_var engine ) +HOMARD_Boundary_i::HOMARD_Boundary_i(SMESHHOMARD::HOMARD_Gen_var engine) + : SALOME::GenericObj_i(SMESH_Gen_i::GetPOA()) { - MESSAGE( "HOMARD_Boundary_i" ); + MESSAGE("HOMARD_Boundary_i"); _gen_i = engine; - _orb = orb; myHomardBoundary = new SMESHHOMARDImpl::HOMARD_Boundary(); - ASSERT( myHomardBoundary ); + ASSERT(myHomardBoundary); } //============================================================================= /*! @@ -116,174 +107,153 @@ HOMARD_Boundary_i::~HOMARD_Boundary_i() // Generalites //============================================================================= //============================================================================= -void HOMARD_Boundary_i::SetName( const char* Name ) +void HOMARD_Boundary_i::SetName(const char* Name) { - ASSERT( myHomardBoundary ); - myHomardBoundary->SetName( Name ); + ASSERT(myHomardBoundary); + myHomardBoundary->SetName(Name); } //============================================================================= char* HOMARD_Boundary_i::GetName() { - ASSERT( myHomardBoundary ); - return CORBA::string_dup( myHomardBoundary->GetName().c_str() ); -} -//============================================================================= -CORBA::Long HOMARD_Boundary_i::Delete() -{ - ASSERT( myHomardBoundary ); - char* BoundaryName = GetName(); - MESSAGE ( "Delete : destruction de la frontiere " << BoundaryName ); - return _gen_i->DeleteBoundary(BoundaryName); + ASSERT(myHomardBoundary); + return CORBA::string_dup(myHomardBoundary->GetName().c_str()); } //============================================================================= char* HOMARD_Boundary_i::GetDumpPython() { - ASSERT( myHomardBoundary ); - return CORBA::string_dup( myHomardBoundary->GetDumpPython().c_str() ); -} -//============================================================================= -std::string HOMARD_Boundary_i::Dump() const -{ - return SMESHHOMARDImpl::Dump( *myHomardBoundary ); -} -//============================================================================= -bool HOMARD_Boundary_i::Restore( const std::string& stream ) -{ - return SMESHHOMARDImpl::Restore( *myHomardBoundary, stream ); + ASSERT(myHomardBoundary); + return CORBA::string_dup(myHomardBoundary->GetDumpPython().c_str()); } //============================================================================= //============================================================================= // Caracteristiques //============================================================================= //============================================================================= -void HOMARD_Boundary_i::SetType( CORBA::Long Type ) +void HOMARD_Boundary_i::SetType(CORBA::Long Type) { - ASSERT( myHomardBoundary ); - myHomardBoundary->SetType( Type ); + ASSERT(myHomardBoundary); + myHomardBoundary->SetType(Type); } //============================================================================= CORBA::Long HOMARD_Boundary_i::GetType() { - ASSERT( myHomardBoundary ); - return CORBA::Long( myHomardBoundary->GetType() ); + ASSERT(myHomardBoundary); + return CORBA::Long(myHomardBoundary->GetType()); } //============================================================================= -void HOMARD_Boundary_i::SetMeshName( const char* MeshName ) +void HOMARD_Boundary_i::SetMeshName(const char* MeshName) { - ASSERT( myHomardBoundary ); - myHomardBoundary->SetMeshName( MeshName ); + ASSERT(myHomardBoundary); + myHomardBoundary->SetMeshName(MeshName); } //============================================================================= char* HOMARD_Boundary_i::GetMeshName() { - ASSERT( myHomardBoundary ); - return CORBA::string_dup( myHomardBoundary->GetMeshName().c_str() ); + ASSERT(myHomardBoundary); + return CORBA::string_dup(myHomardBoundary->GetMeshName().c_str()); } //============================================================================= -void HOMARD_Boundary_i::SetDataFile( const char* DataFile ) +void HOMARD_Boundary_i::SetDataFile(const char* DataFile) { - ASSERT( myHomardBoundary ); - myHomardBoundary->SetDataFile( DataFile ); - int PublisMeshIN = _gen_i->GetPublisMeshIN (); - if ( PublisMeshIN != 0 ) { _gen_i->PublishResultInSmesh(DataFile, 0); } + ASSERT(myHomardBoundary); + myHomardBoundary->SetDataFile(DataFile); } //============================================================================= char* HOMARD_Boundary_i::GetDataFile() { - ASSERT( myHomardBoundary ); - return CORBA::string_dup( myHomardBoundary->GetDataFile().c_str() ); + ASSERT(myHomardBoundary); + return CORBA::string_dup(myHomardBoundary->GetDataFile().c_str()); } //============================================================================= -void HOMARD_Boundary_i::SetCylinder( double X0, double X1, double X2, double X3, double X4, double X5, double X6 ) +void HOMARD_Boundary_i::SetCylinder(double X0, double X1, double X2, double X3, double X4, double X5, double X6) { - ASSERT( myHomardBoundary ); - myHomardBoundary->SetCylinder( X0, X1, X2, X3, X4, X5, X6 ); + ASSERT(myHomardBoundary); + myHomardBoundary->SetCylinder(X0, X1, X2, X3, X4, X5, X6); } //============================================================================= -void HOMARD_Boundary_i::SetSphere( double Xcentre, double Ycentre, double ZCentre, double rayon ) +void HOMARD_Boundary_i::SetSphere(double Xcentre, double Ycentre, double ZCentre, double rayon) { - ASSERT( myHomardBoundary ); - myHomardBoundary->SetSphere( Xcentre, Ycentre, ZCentre, rayon ); + ASSERT(myHomardBoundary); + myHomardBoundary->SetSphere(Xcentre, Ycentre, ZCentre, rayon); } //============================================================================= -void HOMARD_Boundary_i::SetConeR( double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1, double Xcentre2, double Ycentre2, double Zcentre2, double Rayon2) +void HOMARD_Boundary_i::SetConeR(double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1, double Xcentre2, double Ycentre2, double Zcentre2, double Rayon2) { - ASSERT( myHomardBoundary ); - myHomardBoundary->SetConeR( Xcentre1, Ycentre1, Zcentre1, Rayon1, Xcentre2, Ycentre2, Zcentre2, Rayon2 ); + ASSERT(myHomardBoundary); + myHomardBoundary->SetConeR(Xcentre1, Ycentre1, Zcentre1, Rayon1, Xcentre2, Ycentre2, Zcentre2, Rayon2); } //============================================================================= -void HOMARD_Boundary_i::SetConeA( double Xaxe, double Yaxe, double Zaxe, double Angle, double Xcentre, double Ycentre, double Zcentre) +void HOMARD_Boundary_i::SetConeA(double Xaxe, double Yaxe, double Zaxe, double Angle, double Xcentre, double Ycentre, double Zcentre) { - ASSERT( myHomardBoundary ); - myHomardBoundary->SetConeA( Xaxe, Yaxe, Zaxe, Angle, Xcentre, Ycentre, Zcentre ); + ASSERT(myHomardBoundary); + myHomardBoundary->SetConeA(Xaxe, Yaxe, Zaxe, Angle, Xcentre, Ycentre, Zcentre); } //============================================================================= -void HOMARD_Boundary_i::SetTorus( double X0, double X1, double X2, double X3, double X4, double X5, double X6, double X7 ) +void HOMARD_Boundary_i::SetTorus(double X0, double X1, double X2, double X3, double X4, double X5, double X6, double X7) { - ASSERT( myHomardBoundary ); - myHomardBoundary->SetTorus( X0, X1, X2, X3, X4, X5, X6, X7 ); + ASSERT(myHomardBoundary); + myHomardBoundary->SetTorus(X0, X1, X2, X3, X4, X5, X6, X7); } //============================================================================= SMESHHOMARD::double_array* HOMARD_Boundary_i::GetCoords() { - ASSERT( myHomardBoundary ); + ASSERT(myHomardBoundary); SMESHHOMARD::double_array_var aResult = new SMESHHOMARD::double_array(); std::vector mesCoor = myHomardBoundary->GetCoords(); - aResult->length( mesCoor .size() ); + aResult->length(mesCoor .size()); std::vector::const_iterator it; int i = 0; - for ( it = mesCoor.begin(); it != mesCoor.end(); it++ ) + for (it = mesCoor.begin(); it != mesCoor.end(); it++) aResult[i++] = (*it); return aResult._retn(); } //============================================================================= -void HOMARD_Boundary_i::SetLimit( double Xincr, double Yincr, double Zincr ) +void HOMARD_Boundary_i::SetLimit(double Xincr, double Yincr, double Zincr) { - ASSERT( myHomardBoundary ); - myHomardBoundary->SetLimit( Xincr, Yincr, Zincr ); + ASSERT(myHomardBoundary); + myHomardBoundary->SetLimit(Xincr, Yincr, Zincr); } //============================================================================= SMESHHOMARD::double_array* HOMARD_Boundary_i::GetLimit() { - ASSERT( myHomardBoundary ); + ASSERT(myHomardBoundary); SMESHHOMARD::double_array_var aResult = new SMESHHOMARD::double_array(); std::vector mesCoor = myHomardBoundary->GetLimit(); - aResult->length( mesCoor .size() ); + aResult->length(mesCoor .size()); std::vector::const_iterator it; int i = 0; - for ( it = mesCoor.begin(); it != mesCoor.end(); it++ ) + for (it = mesCoor.begin(); it != mesCoor.end(); it++) aResult[i++] = (*it); return aResult._retn(); } //============================================================================= -void HOMARD_Boundary_i::AddGroup( const char* Group) +void HOMARD_Boundary_i::AddGroup(const char* Group) { - ASSERT( myHomardBoundary ); - myHomardBoundary->AddGroup( Group ); + ASSERT(myHomardBoundary); + myHomardBoundary->AddGroup(Group); } //============================================================================= void HOMARD_Boundary_i::SetGroups(const SMESHHOMARD::ListGroupType& ListGroup) { - ASSERT( myHomardBoundary ); + ASSERT(myHomardBoundary); std::list ListString; - for ( int i = 0; i < ListGroup.length(); i++ ) - { - ListString.push_back(std::string(ListGroup[i])); + for (unsigned int i = 0; i < ListGroup.length(); i++) { + ListString.push_back(std::string(ListGroup[i])); } - myHomardBoundary->SetGroups( ListString ); + myHomardBoundary->SetGroups(ListString); } //============================================================================= SMESHHOMARD::ListGroupType* HOMARD_Boundary_i::GetGroups() { - ASSERT( myHomardBoundary ); + ASSERT(myHomardBoundary); const std::list& ListString = myHomardBoundary->GetGroups(); SMESHHOMARD::ListGroupType_var aResult = new SMESHHOMARD::ListGroupType; - aResult->length( ListString.size() ); + aResult->length(ListString.size()); std::list::const_iterator it; int i = 0; - for ( it = ListString.begin(); it != ListString.end(); it++ ) + for (it = ListString.begin(); it != ListString.end(); it++) { - aResult[i++] = CORBA::string_dup( (*it).c_str() ); + aResult[i++] = CORBA::string_dup((*it).c_str()); } return aResult._retn(); } @@ -292,16 +262,16 @@ SMESHHOMARD::ListGroupType* HOMARD_Boundary_i::GetGroups() // Liens avec les autres structures //============================================================================= //============================================================================= -void HOMARD_Boundary_i::SetCaseCreation( const char* NomCaseCreation ) +void HOMARD_Boundary_i::SetCaseCreation(const char* NomCaseCreation) { - ASSERT( myHomardBoundary ); - myHomardBoundary->SetCaseCreation( NomCaseCreation ); + ASSERT(myHomardBoundary); + myHomardBoundary->SetCaseCreation(NomCaseCreation); } //============================================================================= char* HOMARD_Boundary_i::GetCaseCreation() { - ASSERT( myHomardBoundary ); - return CORBA::string_dup( myHomardBoundary->GetCaseCreation().c_str() ); + ASSERT(myHomardBoundary); + return CORBA::string_dup(myHomardBoundary->GetCaseCreation().c_str()); } //============================================================================= @@ -310,9 +280,10 @@ char* HOMARD_Boundary_i::GetCaseCreation() */ //============================================================================= HOMARD_Cas_i::HOMARD_Cas_i() + : SALOME::GenericObj_i(SMESH_Gen_i::GetPOA()) { - MESSAGE( "Default constructor, not for use" ); - ASSERT( 0 ); + MESSAGE("Default constructor, not for use"); + ASSERT(0); } //============================================================================= @@ -320,14 +291,14 @@ HOMARD_Cas_i::HOMARD_Cas_i() * standard constructor */ //============================================================================= -HOMARD_Cas_i::HOMARD_Cas_i( CORBA::ORB_ptr orb, - SMESHHOMARD::HOMARD_Gen_var engine ) +HOMARD_Cas_i::HOMARD_Cas_i(SMESHHOMARD::HOMARD_Gen_var engine) + : SALOME::GenericObj_i(SMESH_Gen_i::GetPOA()) { - MESSAGE( "HOMARD_Cas_i" ); + MESSAGE("HOMARD_Cas_i"); _gen_i = engine; - _orb = orb; myHomardCas = new SMESHHOMARDImpl::HOMARD_Cas(); - ASSERT( myHomardCas ); + ASSERT(myHomardCas); + myHomardCas->SetName("Case_1"); } //============================================================================= @@ -343,90 +314,54 @@ HOMARD_Cas_i::~HOMARD_Cas_i() // Generalites //============================================================================= //============================================================================= -void HOMARD_Cas_i::SetName( const char* Name ) -{ - ASSERT( myHomardCas ); - myHomardCas->SetName( Name ); -} -//============================================================================= char* HOMARD_Cas_i::GetName() { - ASSERT( myHomardCas ); - return CORBA::string_dup( myHomardCas->GetName().c_str() ); -} -//============================================================================= -CORBA::Long HOMARD_Cas_i::Delete( CORBA::Long Option ) -{ - ASSERT( myHomardCas ); - char* CaseName = GetName(); - MESSAGE ( "Delete : destruction du cas " << CaseName << ", Option = " << Option ); - return _gen_i->DeleteCase(CaseName, Option); + ASSERT(myHomardCas); + return CORBA::string_dup(myHomardCas->GetName().c_str()); } //============================================================================= char* HOMARD_Cas_i::GetDumpPython() { - ASSERT( myHomardCas ); - return CORBA::string_dup( myHomardCas->GetDumpPython().c_str() ); -} -//============================================================================= -std::string HOMARD_Cas_i::Dump() const -{ - return SMESHHOMARDImpl::Dump( *myHomardCas ); -} -//============================================================================= -bool HOMARD_Cas_i::Restore( const std::string& stream ) -{ - return SMESHHOMARDImpl::Restore( *myHomardCas, stream ); + ASSERT(myHomardCas); + return CORBA::string_dup(myHomardCas->GetDumpPython().c_str()); } //============================================================================= //============================================================================= // Caracteristiques //============================================================================= //============================================================================= -void HOMARD_Cas_i::SetDirName( const char* NomDir ) +void HOMARD_Cas_i::SetDirName(const char* NomDir) { - ASSERT( myHomardCas ); + ASSERT(myHomardCas); int codret; // A. recuperation du nom; on ne fait rien si c'est le meme char* oldrep = GetDirName(); - if ( strcmp(oldrep,NomDir) == 0 ) return; - MESSAGE ( "SetDirName : passage de oldrep = "<< oldrep << " a NomDir = "<VerifieDir(NomDir); - if ( ( std::string(casenamedir).size() > 0 ) & ( strcmp(CaseName,casenamedir)!=0 ) ) - { - INFOS ( "Le repertoire " << NomDir << " est deja utilise pour le cas "<< casenamedir ); - SALOME::ExceptionStruct es; - es.type = SALOME::BAD_PARAM; - std::string text; - text = "The directory " + std::string(NomDir) + " is already used for the case " + std::string(casenamedir); - es.text = CORBA::string_dup(text.c_str()); - throw SALOME::SALOME_Exception(es); - } + if (strcmp(oldrep,NomDir) == 0) return; + MESSAGE ("SetDirName : passage de oldrep = "<< oldrep << " a NomDir = "<SetDirName( NomDir ); - if ( codret != 0 ) - { + codret = myHomardCas->SetDirName(NomDir); + if (codret != 0) { SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; std::string text; - if ( codret == 1 ) { text = "The directory for the case cannot be modified because some iterations are already defined."; } - else { text = "The directory for the case cannot be reached."; } + if (codret == 1) + text = "The directory for the case cannot be modified because some iterations are already defined."; + else + text = "The directory for the case cannot be reached."; es.text = CORBA::string_dup(text.c_str()); throw SALOME::SALOME_Exception(es); } // D. En cas de reprise, deplacement du point de depart - if ( GetState() != 0 ) - { - MESSAGE ( "etat : " << GetState() ); + SMESHHOMARD::HOMARD_Iteration_ptr Iter0 = _gen_i->GetIteration(0); + int state = Iter0->GetNumber(); + if (state != 0) { // GetState() + MESSAGE ("etat : " << state); // D.1. Nom local du repertoire de l'iteration de depart dans le repertoire actuel du cas - SMESHHOMARD::HOMARD_Iteration_ptr Iter = GetIter0(); - char* DirNameIter = Iter->GetDirNameLoc(); - MESSAGE ( "SetDirName : nom actuel pour le repertoire de l iteration, DirNameIter = "<< DirNameIter); + char* DirNameIter = Iter0->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 - char* nomDirIter = _gen_i->CreateDirNameIter(NomDir, 0 ); - MESSAGE ( "SetDirName : nom futur pour le repertoire de l iteration, nomDirIter = "<< nomDirIter); + char* nomDirIter = _gen_i->CreateDirNameIter(NomDir, 0); + MESSAGE ("SetDirName : nom futur pour le repertoire de l iteration, nomDirIter = "<< nomDirIter); // D.3. Creation du futur repertoire local pour l'iteration de depart std::string nomDirIterTotal; nomDirIterTotal = std::string(NomDir) + "/" + std::string(nomDirIter); @@ -436,7 +371,7 @@ void HOMARD_Cas_i::SetDirName( const char* NomDir ) if (_mkdir(nomDirIterTotal.c_str()) != 0) #endif { - MESSAGE ( "nomDirIterTotal : " << nomDirIterTotal ); + MESSAGE ("nomDirIterTotal : " << nomDirIterTotal); SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; std::string text = "The directory for the starting iteration cannot be created."; @@ -448,7 +383,7 @@ void HOMARD_Cas_i::SetDirName( const char* NomDir ) oldnomDirIterTotal = std::string(oldrep) + "/" + std::string(DirNameIter); std::string commande = "mv " + std::string(oldnomDirIterTotal) + "/*" + " " + std::string(nomDirIterTotal); codret = system(commande.c_str()); - if ( codret != 0 ) + if (codret != 0) { SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; @@ -458,7 +393,7 @@ void HOMARD_Cas_i::SetDirName( const char* NomDir ) } commande = "rm -rf " + std::string(oldnomDirIterTotal); codret = system(commande.c_str()); - if ( codret != 0 ) + if (codret != 0) { SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; @@ -467,234 +402,201 @@ void HOMARD_Cas_i::SetDirName( const char* NomDir ) throw SALOME::SALOME_Exception(es); } // D.5. Memorisation du nom du repertoire de l'iteration - Iter->SetDirNameLoc(nomDirIter); + Iter0->SetDirNameLoc(nomDirIter); } } //============================================================================= char* HOMARD_Cas_i::GetDirName() { - ASSERT( myHomardCas ); - return CORBA::string_dup( myHomardCas->GetDirName().c_str() ); -} -//============================================================================= -CORBA::Long HOMARD_Cas_i::GetState() -{ - ASSERT( myHomardCas ); -// Nom de l'iteration initiale - char* Iter0Name = GetIter0Name(); - SMESHHOMARD::HOMARD_Iteration_ptr Iter = _gen_i->GetIteration(Iter0Name); - int state = Iter->GetNumber(); - return state; -} -//============================================================================= -CORBA::Long HOMARD_Cas_i::GetNumberofIter() -{ - ASSERT( myHomardCas ); - return myHomardCas->GetNumberofIter(); + ASSERT(myHomardCas); + return CORBA::string_dup(myHomardCas->GetDirName().c_str()); } //============================================================================= -void HOMARD_Cas_i::SetConfType( CORBA::Long ConfType ) +void HOMARD_Cas_i::SetConfType(CORBA::Long ConfType) { - ASSERT( myHomardCas ); -// VERIFICATION( (ConfType>=-2) && (ConfType<=3) ); - myHomardCas->SetConfType( ConfType ); + ASSERT(myHomardCas); + //VERIFICATION((ConfType>=-2) && (ConfType<=3)); + myHomardCas->SetConfType(ConfType); } //============================================================================= CORBA::Long HOMARD_Cas_i::GetConfType() { - ASSERT( myHomardCas ); + ASSERT(myHomardCas); return myHomardCas->GetConfType(); } //============================================================================= -void HOMARD_Cas_i::SetExtType( CORBA::Long ExtType ) -{ - ASSERT( myHomardCas ); -// VERIFICATION( (ExtType>=0) && (ExtType<=2) ); - myHomardCas->SetExtType( ExtType ); -} -//============================================================================= -CORBA::Long HOMARD_Cas_i::GetExtType() -{ - ASSERT( myHomardCas ); - return myHomardCas->GetExtType(); -} -//============================================================================= -void HOMARD_Cas_i::SetBoundingBox( const SMESHHOMARD::extrema& LesExtrema ) +void HOMARD_Cas_i::SetBoundingBox(const SMESHHOMARD::extrema& LesExtrema) { - ASSERT( myHomardCas ); + ASSERT(myHomardCas); std::vector VExtrema; - ASSERT( LesExtrema.length() == 10 ); - VExtrema.resize( LesExtrema.length() ); - for ( int i = 0; i < LesExtrema.length(); i++ ) - { + ASSERT(LesExtrema.length() == 10); + VExtrema.resize(LesExtrema.length()); + for (int i = 0; i < (int)LesExtrema.length(); i++) { VExtrema[i] = LesExtrema[i]; } - myHomardCas->SetBoundingBox( VExtrema ); + myHomardCas->SetBoundingBox(VExtrema); } //============================================================================= SMESHHOMARD::extrema* HOMARD_Cas_i::GetBoundingBox() { - ASSERT(myHomardCas ); + ASSERT(myHomardCas); SMESHHOMARD::extrema_var aResult = new SMESHHOMARD::extrema(); std::vector LesExtremes = myHomardCas->GetBoundingBox(); - ASSERT( LesExtremes.size() == 10 ); - aResult->length( 10 ); - for ( int i = 0; i < LesExtremes.size(); i++ ) - { + ASSERT(LesExtremes.size() == 10); + aResult->length(10); + for (int i = 0; i < (int)LesExtremes.size(); i++) { aResult[i] = LesExtremes[i]; } return aResult._retn(); } + //============================================================================= -void HOMARD_Cas_i::AddGroup( const char* Group) +void HOMARD_Cas_i::AddGroup(const char* Group) { - ASSERT( myHomardCas ); - myHomardCas->AddGroup( Group ); + ASSERT(myHomardCas); + myHomardCas->AddGroup(Group); } //============================================================================= -void HOMARD_Cas_i::SetGroups( const SMESHHOMARD::ListGroupType& ListGroup ) +void HOMARD_Cas_i::SetGroups(const SMESHHOMARD::ListGroupType& ListGroup) { - ASSERT( myHomardCas ); + ASSERT(myHomardCas); std::list ListString; - for ( int i = 0; i < ListGroup.length(); i++ ) + for (int i = 0; i < ListGroup.length(); i++) { ListString.push_back(std::string(ListGroup[i])); } - myHomardCas->SetGroups( ListString ); + myHomardCas->SetGroups(ListString); } //============================================================================= SMESHHOMARD::ListGroupType* HOMARD_Cas_i::GetGroups() { - ASSERT(myHomardCas ); + ASSERT(myHomardCas); const std::list& ListString = myHomardCas->GetGroups(); SMESHHOMARD::ListGroupType_var aResult = new SMESHHOMARD::ListGroupType(); - aResult->length( ListString.size() ); + aResult->length(ListString.size()); std::list::const_iterator it; int i = 0; - for ( it = ListString.begin(); it != ListString.end(); it++ ) - { - aResult[i++] = CORBA::string_dup( (*it).c_str() ); + for (it = ListString.begin(); it != ListString.end(); it++) { + aResult[i++] = CORBA::string_dup((*it).c_str()); } return aResult._retn(); } + //============================================================================= void HOMARD_Cas_i::AddBoundary(const char* BoundaryName) { - MESSAGE ("HOMARD_Cas_i::AddBoundary : BoundaryName = "<< BoundaryName ); + MESSAGE ("HOMARD_Cas_i::AddBoundary : BoundaryName = "<< BoundaryName); const char * Group = ""; - AddBoundaryGroup( BoundaryName, Group); + AddBoundaryGroup(BoundaryName, Group); } //============================================================================= -void HOMARD_Cas_i::AddBoundaryGroup( const char* BoundaryName, const char* Group) +void HOMARD_Cas_i::AddBoundaryGroup(const char* BoundaryName, const char* Group) { - MESSAGE ("HOMARD_Cas_i::AddBoundaryGroup : BoundaryName = "<< BoundaryName << ", Group = " << Group ); - ASSERT( myHomardCas ); + MESSAGE ("HOMARD_Cas_i::AddBoundaryGroup : BoundaryName = "<< BoundaryName << ", Group = " << Group); + ASSERT(myHomardCas); // A. Préalables // A.1. Caractéristiques de la frontière à ajouter SMESHHOMARD::HOMARD_Boundary_ptr myBoundary = _gen_i->GetBoundary(BoundaryName); ASSERT(!CORBA::is_nil(myBoundary)); int BoundaryType = myBoundary->GetType(); - MESSAGE ( ". BoundaryType = " << BoundaryType ); + MESSAGE (". BoundaryType = " << BoundaryType); // A.2. La liste des frontiere+groupes const std::list& ListBoundaryGroup = myHomardCas->GetBoundaryGroup(); std::list::const_iterator it; // B. Controles const char * boun; int erreur = 0; - while ( erreur == 0 ) + while (erreur == 0) { - // B.1. Si on ajoute une frontière CAO, elle doit être la seule frontière - if ( BoundaryType == -1 ) + // B.1. Si on ajoute une frontière CAO, elle doit être la seule frontière + if (BoundaryType == -1) { - for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ ) + for (it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++) { boun = (*it).c_str(); - MESSAGE (".. Frontiere enregistrée : "<< boun ); - if ( *it != BoundaryName ) + MESSAGE (".. Frontiere enregistrée : "<< boun); + if (*it != BoundaryName) { erreur = 1; break; } // On saute le nom du groupe it++; } } - if ( erreur != 0 ) { break; } - // B.2. Si on ajoute une frontière non CAO, il ne doit pas y avoir de frontière CAO - if ( BoundaryType != -1 ) + if (erreur != 0) { break; } + // B.2. Si on ajoute une frontière non CAO, il ne doit pas y avoir de frontière CAO + if (BoundaryType != -1) { - for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ ) + for (it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++) { boun = (*it).c_str(); - MESSAGE (".. Frontiere enregistrée : "<< boun ); + MESSAGE (".. Frontiere enregistrée : "<< boun); SMESHHOMARD::HOMARD_Boundary_ptr myBoundary_0 = _gen_i->GetBoundary(boun); int BoundaryType_0 = myBoundary_0->GetType(); - MESSAGE ( ".. BoundaryType_0 = " << BoundaryType_0 ); - if ( BoundaryType_0 == -1 ) + MESSAGE (".. BoundaryType_0 = " << BoundaryType_0); + if (BoundaryType_0 == -1) { erreur = 2; break; } // On saute le nom du groupe it++; } - if ( erreur != 0 ) { break; } + if (erreur != 0) { break; } } - // B.3. Si on ajoute une frontière discrète, il ne doit pas y avoir d'autre frontière discrète - if ( BoundaryType == 0 ) + // B.3. Si on ajoute une frontière discrète, il ne doit pas y avoir d'autre frontière discrète + if (BoundaryType == 0) { - for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ ) + for (it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++) { boun = (*it).c_str(); - MESSAGE (".. Frontiere enregistrée : "<< boun ); - if ( boun != BoundaryName ) + MESSAGE (".. Frontiere enregistrée : "<< boun); + if (boun != BoundaryName) { SMESHHOMARD::HOMARD_Boundary_ptr myBoundary_0 = _gen_i->GetBoundary(boun); int BoundaryType_0 = myBoundary_0->GetType(); - MESSAGE ( ".. BoundaryType_0 = " << BoundaryType_0 ); - if ( BoundaryType_0 == 0 ) + MESSAGE (".. BoundaryType_0 = " << BoundaryType_0); + if (BoundaryType_0 == 0) { erreur = 3; break; } } // On saute le nom du groupe it++; } - if ( erreur != 0 ) { break; } + if (erreur != 0) { break; } } - // B.4. Pour une nouvelle frontiere, publication dans l'arbre d'etudes sous le cas - bool existe = false; - for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ ) - { - MESSAGE (".. Frontiere : "<< *it ); - if ( *it == BoundaryName ) { existe = true; } + // B.4. Pour une nouvelle frontiere, publication dans l'arbre d'etudes sous le cas + for (it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++) { + MESSAGE (".. Frontiere : "<< *it); // On saute le nom du groupe it++; } - // B.5. Le groupe est-il deja enregistre pour une frontiere de ce cas ? - for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ ) - { + // B.5. Le groupe est-il deja enregistre pour une frontiere de ce cas ? + for (it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++) { boun = (*it).c_str(); it++; - MESSAGE (".. Groupe enregistré : "<< *it ); - if ( *it == Group ) - { erreur = 5; - break; } + MESSAGE (".. Groupe enregistré : "<< *it); + if (*it == Group) { + erreur = 5; + break; + } } - if ( erreur != 0 ) { break; } + if (erreur != 0) { break; } // break; } // F. Si aucune erreur, enregistrement du couple (frontiere,groupe) dans la reference du cas // Sinon, arrêt - if ( erreur == 0 ) - { myHomardCas->AddBoundaryGroup( BoundaryName, Group ); } - else - { + if (erreur == 0) { + myHomardCas->AddBoundaryGroup(BoundaryName, Group); + } + else { std::stringstream ss; ss << erreur; std::string str = ss.str(); std::string texte; texte = "Erreur numéro " + str + " pour la frontière à enregistrer : " + std::string(BoundaryName); - if ( erreur == 1 ) { texte += "\nIl existe déjà la frontière "; } - else if ( erreur == 2 ) { texte += "\nIl existe déjà la frontière CAO "; } - else if ( erreur == 3 ) { texte += "\nIl existe déjà une frontière discrète : "; } - else if ( erreur == 5 ) { texte += "\nLe groupe " + std::string(Group) + " est déjà enregistré pour la frontière "; } + if (erreur == 1) { texte += "\nIl existe déjà la frontière "; } + else if (erreur == 2) { texte += "\nIl existe déjà la frontière CAO "; } + else if (erreur == 3) { texte += "\nIl existe déjà une frontière discrète : "; } + else if (erreur == 5) { texte += "\nLe groupe " + std::string(Group) + " est déjà enregistré pour la frontière "; } texte += std::string(boun); // SALOME::ExceptionStruct es; @@ -711,15 +613,15 @@ void HOMARD_Cas_i::AddBoundaryGroup( const char* BoundaryName, const char* Group SMESHHOMARD::ListBoundaryGroupType* HOMARD_Cas_i::GetBoundaryGroup() { MESSAGE ("GetBoundaryGroup"); - ASSERT(myHomardCas ); + ASSERT(myHomardCas); const std::list& ListBoundaryGroup = myHomardCas->GetBoundaryGroup(); SMESHHOMARD::ListBoundaryGroupType_var aResult = new SMESHHOMARD::ListBoundaryGroupType(); - aResult->length( ListBoundaryGroup.size() ); + aResult->length(ListBoundaryGroup.size()); std::list::const_iterator it; int i = 0; - for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ ) + for (it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++) { - aResult[i++] = CORBA::string_dup( (*it).c_str() ); + aResult[i++] = CORBA::string_dup((*it).c_str()); } return aResult._retn(); } @@ -727,104 +629,14 @@ SMESHHOMARD::ListBoundaryGroupType* HOMARD_Cas_i::GetBoundaryGroup() void HOMARD_Cas_i::SupprBoundaryGroup() { MESSAGE ("SupprBoundaryGroup"); - ASSERT(myHomardCas ); + ASSERT(myHomardCas); myHomardCas->SupprBoundaryGroup(); } -//============================================================================= -void HOMARD_Cas_i::SetPyram( CORBA::Long Pyram ) -{ - MESSAGE ("SetPyram, Pyram = " << Pyram ); - ASSERT( myHomardCas ); - myHomardCas->SetPyram( Pyram ); -} -//============================================================================= -CORBA::Long HOMARD_Cas_i::GetPyram() -{ - MESSAGE ("GetPyram"); - ASSERT( myHomardCas ); - return myHomardCas->GetPyram(); -} -//============================================================================= -void HOMARD_Cas_i::MeshInfo(CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte) -{ - MESSAGE ( "MeshInfo : information sur le maillage initial du cas" ); - ASSERT( myHomardCas ); -// -// Nom de l'iteration - char* IterName = GetIter0Name(); - CORBA::Long etatMenage = -1; - CORBA::Long modeHOMARD = 7; - CORBA::Long Option1 = 1; - CORBA::Long Option2 = 1; - if ( Qual != 0 ) { modeHOMARD = modeHOMARD*5; } - if ( Diam != 0 ) { modeHOMARD = modeHOMARD*19; } - if ( Conn != 0 ) { modeHOMARD = modeHOMARD*11; } - if ( Tail != 0 ) { modeHOMARD = modeHOMARD*13; } - if ( Inte != 0 ) { modeHOMARD = modeHOMARD*3; } - CORBA::Long codret = _gen_i->Compute(IterName, etatMenage, modeHOMARD, Option1, Option2); - MESSAGE ( "MeshInfo : codret = " << codret ); -} -//============================================================================= -//============================================================================= -// Liens avec les autres structures -//============================================================================= -//============================================================================= -char* HOMARD_Cas_i::GetIter0Name() -{ - ASSERT( myHomardCas ); - return CORBA::string_dup( myHomardCas->GetIter0Name().c_str() ); -} -//============================================================================= -SMESHHOMARD::HOMARD_Iteration_ptr HOMARD_Cas_i::GetIter0() -{ - // Nom de l'iteration initiale - char* Iter0Name = GetIter0Name(); - MESSAGE ( "GetIter0 : Iter0Name = " << Iter0Name ); - return _gen_i->GetIteration(Iter0Name); -} -//============================================================================= -SMESHHOMARD::HOMARD_Iteration_ptr HOMARD_Cas_i::NextIteration( const char* IterName ) -{ - MESSAGE ( "NextIteration : IterName = " << IterName ); - // Nom de l'iteration parent - char* NomIterParent = GetIter0Name(); - MESSAGE ( "NextIteration : NomIterParent = " << NomIterParent ); - return _gen_i->CreateIteration(IterName, NomIterParent); -} -//============================================================================= -SMESHHOMARD::HOMARD_Iteration_ptr HOMARD_Cas_i::LastIteration( ) -{ - SMESHHOMARD::HOMARD_Iteration_ptr Iter; - SMESHHOMARD::listeIterFilles_var ListeIterFilles; - char* IterName; -// Iteration initiale du cas - IterName = GetIter0Name(); -// On va explorer la descendance de cette iteration initiale -// jusqu'a trouver celle qui n'a pas de filles - int nbiterfilles = 1; - while ( nbiterfilles == 1 ) - { -// L'iteration associee -// MESSAGE ( ".. IterName = " << IterName ); - Iter = _gen_i->GetIteration(IterName); -// Les filles de cette iteration - ListeIterFilles = Iter->GetIterations(); - nbiterfilles = ListeIterFilles->length(); -// MESSAGE ( ".. nbiterfilles = " << nbiterfilles ); -// S'il y a au moins 2 filles, arret : on ne sait pas faire - VERIFICATION( nbiterfilles <= 1 ); -// S'il y a une fille unique, on recupere le nom de la fille et on recommence - if ( nbiterfilles == 1 ) - { IterName = ListeIterFilles[0]; } - } -// - return Iter; -} -//============================================================================= -void HOMARD_Cas_i::AddIteration( const char* NomIteration ) + +void HOMARD_Cas_i::AddIteration(const char* NomIteration) { - ASSERT( myHomardCas ); - myHomardCas->AddIteration( NomIteration ); + ASSERT(myHomardCas); + myHomardCas->AddIteration(NomIteration); } //============================================================================= @@ -833,9 +645,10 @@ void HOMARD_Cas_i::AddIteration( const char* NomIteration ) */ //============================================================================= HOMARD_Hypothesis_i::HOMARD_Hypothesis_i() + : SALOME::GenericObj_i(SMESH_Gen_i::GetPOA()) { - MESSAGE( "Default constructor, not for use" ); - ASSERT( 0 ); + MESSAGE("Default constructor, not for use"); + ASSERT(0); } //============================================================================= @@ -843,14 +656,22 @@ HOMARD_Hypothesis_i::HOMARD_Hypothesis_i() * standard constructor */ //============================================================================= -HOMARD_Hypothesis_i::HOMARD_Hypothesis_i( CORBA::ORB_ptr orb, - SMESHHOMARD::HOMARD_Gen_var engine ) +HOMARD_Hypothesis_i::HOMARD_Hypothesis_i(SMESHHOMARD::HOMARD_Gen_var engine) + : SALOME::GenericObj_i(SMESH_Gen_i::GetPOA()) { - MESSAGE( "standard constructor" ); + MESSAGE("standard constructor"); _gen_i = engine; - _orb = orb; myHomardHypothesis = new SMESHHOMARDImpl::HOMARD_Hypothesis(); - ASSERT( myHomardHypothesis ); + ASSERT(myHomardHypothesis); + + // SetUnifRefinUnRef(1) + int RefinType = 1; + int UnRefType = 0; + myHomardHypothesis->SetAdapType(-1); + myHomardHypothesis->SetRefinTypeDera(RefinType, UnRefType); + + // Set name + myHomardHypothesis->SetName("Hypo_1"); } //============================================================================= @@ -861,385 +682,240 @@ HOMARD_Hypothesis_i::HOMARD_Hypothesis_i( CORBA::ORB_ptr orb, HOMARD_Hypothesis_i::~HOMARD_Hypothesis_i() { } + //============================================================================= -//============================================================================= -// Generalites -//============================================================================= -//============================================================================= -void HOMARD_Hypothesis_i::SetName( const char* Name ) -{ - ASSERT( myHomardHypothesis ); - myHomardHypothesis->SetName( Name ); -} -//============================================================================= -char* HOMARD_Hypothesis_i::GetName() -{ - ASSERT( myHomardHypothesis ); - return CORBA::string_dup( myHomardHypothesis->GetName().c_str() ); -} -//============================================================================= -CORBA::Long HOMARD_Hypothesis_i::Delete() -{ - ASSERT( myHomardHypothesis ); - char* HypoName = GetName(); - MESSAGE ( "Delete : destruction de l'hypothese " << HypoName ); - return _gen_i->DeleteHypo(HypoName); -} -//============================================================================= -char* HOMARD_Hypothesis_i::GetDumpPython() -{ - ASSERT( myHomardHypothesis ); - return CORBA::string_dup( myHomardHypothesis->GetDumpPython().c_str() ); -} -//============================================================================= -std::string HOMARD_Hypothesis_i::Dump() const +void HOMARD_Hypothesis_i::SetExtraOutput(CORBA::Long ExtraOutput) { - return SMESHHOMARDImpl::Dump( *myHomardHypothesis ); + ASSERT(myHomardHypothesis); + myHomardHypothesis->SetExtraOutput(ExtraOutput); } //============================================================================= -bool HOMARD_Hypothesis_i::Restore( const std::string& stream ) +CORBA::Long HOMARD_Hypothesis_i::GetExtraOutput() { - return SMESHHOMARDImpl::Restore( *myHomardHypothesis, stream ); + ASSERT(myHomardHypothesis); + return myHomardHypothesis->GetExtraOutput(); } + //============================================================================= //============================================================================= -// Caracteristiques +// Liens avec les autres structures //============================================================================= //============================================================================= -void HOMARD_Hypothesis_i::SetUnifRefinUnRef( CORBA::Long TypeRaffDera ) +void HOMARD_Hypothesis_i::LinkIteration(const char* NomIteration) { - ASSERT( myHomardHypothesis ); - VERIFICATION( (TypeRaffDera==1) || (TypeRaffDera==-1) ); - int TypeRaff, TypeDera; - if ( TypeRaffDera == 1 ) - { - TypeRaff = 1; - TypeDera = 0; - } - else if ( TypeRaffDera == -1 ) - { - TypeRaff = 0; - TypeDera = 1; - } - myHomardHypothesis->SetAdapType( -1 ); - myHomardHypothesis->SetRefinTypeDera( TypeRaff, TypeDera ); + ASSERT(myHomardHypothesis); + myHomardHypothesis->LinkIteration(NomIteration); } //============================================================================= -SMESHHOMARD::listeTypes* HOMARD_Hypothesis_i::GetAdapRefinUnRef() +void HOMARD_Hypothesis_i::UnLinkIteration(const char* NomIteration) { - ASSERT( myHomardHypothesis ); - SMESHHOMARD::listeTypes_var aResult = new SMESHHOMARD::listeTypes; - aResult->length( 3 ); - aResult[0] = CORBA::Long( myHomardHypothesis->GetAdapType() ); - aResult[1] = CORBA::Long( myHomardHypothesis->GetRefinType() ); - aResult[2] = CORBA::Long( myHomardHypothesis->GetUnRefType() ); - return aResult._retn(); + ASSERT(myHomardHypothesis); + myHomardHypothesis->UnLinkIteration(NomIteration); } + //============================================================================= -CORBA::Long HOMARD_Hypothesis_i::GetAdapType() -{ - ASSERT( myHomardHypothesis ); - return CORBA::Long( myHomardHypothesis->GetAdapType() ); -} +/*! + * standard constructor + */ //============================================================================= -CORBA::Long HOMARD_Hypothesis_i::GetRefinType() +HOMARD_Iteration_i::HOMARD_Iteration_i() + : SALOME::GenericObj_i(SMESH_Gen_i::GetPOA()) { - ASSERT( myHomardHypothesis ); - return CORBA::Long( myHomardHypothesis->GetRefinType() ); + MESSAGE("Default constructor, not for use"); + ASSERT(0); } //============================================================================= -CORBA::Long HOMARD_Hypothesis_i::GetUnRefType() -{ - ASSERT( myHomardHypothesis ); - return CORBA::Long( myHomardHypothesis->GetUnRefType() ); -} +/*! + * standard constructor + */ //============================================================================= -void HOMARD_Hypothesis_i::SetField( const char* FieldName ) +HOMARD_Iteration_i::HOMARD_Iteration_i(SMESHHOMARD::HOMARD_Gen_var engine) + : SALOME::GenericObj_i(SMESH_Gen_i::GetPOA()) { - myHomardHypothesis->SetField( FieldName ); + MESSAGE("constructor"); + _gen_i = engine; + myHomardIteration = new SMESHHOMARDImpl::HOMARD_Iteration(); + ASSERT(myHomardIteration); } //============================================================================= -char* HOMARD_Hypothesis_i::GetFieldName() -{ - ASSERT( myHomardHypothesis ); - return CORBA::string_dup( myHomardHypothesis->GetFieldName().c_str() ); -} +/*! + * standard destructor + */ //============================================================================= -void HOMARD_Hypothesis_i::SetUseField( CORBA::Long UsField ) +HOMARD_Iteration_i::~HOMARD_Iteration_i() { - myHomardHypothesis->SetUseField( UsField ); } //============================================================================= -SMESHHOMARD::InfosHypo* HOMARD_Hypothesis_i::GetField() +void HOMARD_Iteration_i::SetName(const char* Name) { - ASSERT( myHomardHypothesis ); - SMESHHOMARD::InfosHypo* aInfosHypo = new SMESHHOMARD::InfosHypo(); - aInfosHypo->FieldName = CORBA::string_dup( myHomardHypothesis->GetFieldName().c_str() ); - aInfosHypo->TypeThR = CORBA::Long( myHomardHypothesis->GetRefinThrType() ); - aInfosHypo->ThreshR = CORBA::Double( myHomardHypothesis->GetThreshR() ); - aInfosHypo->TypeThC = CORBA::Long( myHomardHypothesis->GetUnRefThrType() ); - aInfosHypo->ThreshC = CORBA::Double( myHomardHypothesis->GetThreshC() ); - aInfosHypo->UsField = CORBA::Long( myHomardHypothesis->GetUseField() ); - aInfosHypo->UsCmpI = CORBA::Long( myHomardHypothesis->GetUseComp() ); - return aInfosHypo; + ASSERT(myHomardIteration); + myHomardIteration->SetName(Name); } //============================================================================= -void HOMARD_Hypothesis_i::SetUseComp( CORBA::Long UsCmpI ) +char* HOMARD_Iteration_i::GetName() { - myHomardHypothesis->SetUseComp( UsCmpI ); + ASSERT(myHomardIteration); + return CORBA::string_dup(myHomardIteration->GetName().c_str()); } //============================================================================= -void HOMARD_Hypothesis_i::AddComp( const char* NomComp ) +void HOMARD_Iteration_i::SetDirNameLoc(const char* NomDir) { - ASSERT( myHomardHypothesis ); - myHomardHypothesis->AddComp( NomComp ); + ASSERT(myHomardIteration); + myHomardIteration->SetDirNameLoc(NomDir); } //============================================================================= -void HOMARD_Hypothesis_i::SupprComp( const char* NomComp ) +char* HOMARD_Iteration_i::GetDirNameLoc() { - ASSERT( myHomardHypothesis ); - myHomardHypothesis->SupprComp(NomComp); + ASSERT(myHomardIteration); + return CORBA::string_dup(myHomardIteration->GetDirNameLoc().c_str()); } //============================================================================= -void HOMARD_Hypothesis_i::SupprComps() +char* HOMARD_Iteration_i::GetDirName() { - ASSERT( myHomardHypothesis ); - myHomardHypothesis->SupprComps(); + ASSERT(myHomardIteration); + SMESHHOMARD::HOMARD_Cas_ptr caseiter = _gen_i->GetCase(); + std::string dirnamecase = caseiter->GetDirName(); + std::string dirname = dirnamecase + "/" + GetDirNameLoc(); + return CORBA::string_dup(dirname.c_str()); } //============================================================================= -SMESHHOMARD::listeComposantsHypo* HOMARD_Hypothesis_i::GetComps() +void HOMARD_Iteration_i::SetNumber(CORBA::Long NumIter) { - ASSERT( myHomardHypothesis ); - const std::list& ListString = myHomardHypothesis->GetComps(); - SMESHHOMARD::listeComposantsHypo_var aResult = new SMESHHOMARD::listeComposantsHypo; - aResult->length( ListString.size() ); - std::list::const_iterator it; - int i = 0; - for ( it = ListString.begin(); it != ListString.end(); it++ ) - { - aResult[i++] = CORBA::string_dup( (*it).c_str() ); - } - return aResult._retn(); + ASSERT(myHomardIteration); + myHomardIteration->SetNumber(NumIter); } //============================================================================= -void HOMARD_Hypothesis_i::SetRefinThr( CORBA::Long TypeThR, CORBA::Double ThreshR ) +CORBA::Long HOMARD_Iteration_i::GetNumber() { - myHomardHypothesis->SetAdapType( 1 ); - if ( TypeThR > 0 ) - { - int TypeDera = myHomardHypothesis->GetUnRefType(); - myHomardHypothesis->SetRefinTypeDera( 1, TypeDera ); - } - myHomardHypothesis->SetRefinThr( TypeThR, ThreshR ); + ASSERT(myHomardIteration); + return myHomardIteration->GetNumber(); } //============================================================================= -CORBA::Long HOMARD_Hypothesis_i::GetRefinThrType() +void HOMARD_Iteration_i::SetState(CORBA::Long Etat) { - ASSERT( myHomardHypothesis ); - return CORBA::Long( myHomardHypothesis->GetRefinThrType() ); + ASSERT(myHomardIteration); + myHomardIteration->SetState(Etat); } //============================================================================= -void HOMARD_Hypothesis_i::SetUnRefThr( CORBA::Long TypeThC, CORBA::Double ThreshC ) +CORBA::Long HOMARD_Iteration_i::GetState() { - myHomardHypothesis->SetAdapType( 1 ); - if ( TypeThC > 0 ) - { - int TypeRaff = myHomardHypothesis->GetRefinType(); - myHomardHypothesis->SetRefinTypeDera( TypeRaff, 1 ); - } - myHomardHypothesis->SetUnRefThr( TypeThC, ThreshC ); + ASSERT(myHomardIteration); + return myHomardIteration->GetState(); } //============================================================================= -CORBA::Long HOMARD_Hypothesis_i::GetUnRefThrType() +void HOMARD_Iteration_i::SetMeshName(const char* NomMesh) { - ASSERT( myHomardHypothesis ); - return CORBA::Long( myHomardHypothesis->GetUnRefThrType() ); + ASSERT(myHomardIteration); + myHomardIteration->SetMeshName(NomMesh); } //============================================================================= -void HOMARD_Hypothesis_i::SetNivMax( CORBA::Long NivMax ) +char* HOMARD_Iteration_i::GetMeshName() { - ASSERT( myHomardHypothesis ); - myHomardHypothesis->SetNivMax( NivMax ); + ASSERT(myHomardIteration); + return CORBA::string_dup(myHomardIteration->GetMeshName().c_str()); } //============================================================================= -CORBA::Long HOMARD_Hypothesis_i::GetNivMax() +void HOMARD_Iteration_i::SetMeshFile(const char* MeshFile) { - ASSERT( myHomardHypothesis ); - return myHomardHypothesis->GetNivMax(); + ASSERT(myHomardIteration); + myHomardIteration->SetMeshFile(MeshFile); } //============================================================================= -void HOMARD_Hypothesis_i::SetDiamMin( CORBA::Double DiamMin ) +char* HOMARD_Iteration_i::GetMeshFile() { - ASSERT( myHomardHypothesis ); - myHomardHypothesis->SetDiamMin( DiamMin ); + ASSERT(myHomardIteration); + return CORBA::string_dup(myHomardIteration->GetMeshFile().c_str()); } //============================================================================= -CORBA::Double HOMARD_Hypothesis_i::GetDiamMin() +void HOMARD_Iteration_i::SetLogFile(const char* LogFile) { - ASSERT( myHomardHypothesis ); - return myHomardHypothesis->GetDiamMin(); + ASSERT(myHomardIteration); + myHomardIteration->SetLogFile(LogFile); } //============================================================================= -void HOMARD_Hypothesis_i::SetAdapInit( CORBA::Long AdapInit ) +char* HOMARD_Iteration_i::GetLogFile() { - ASSERT( myHomardHypothesis ); - myHomardHypothesis->SetAdapInit( AdapInit ); + ASSERT(myHomardIteration); + return CORBA::string_dup(myHomardIteration->GetLogFile().c_str()); } //============================================================================= -CORBA::Long HOMARD_Hypothesis_i::GetAdapInit() +void HOMARD_Iteration_i::SetFileInfo(const char* FileInfo) { - ASSERT( myHomardHypothesis ); - return myHomardHypothesis->GetAdapInit(); + ASSERT(myHomardIteration); + myHomardIteration->SetFileInfo(FileInfo); } //============================================================================= -void HOMARD_Hypothesis_i::SetExtraOutput( CORBA::Long ExtraOutput ) +char* HOMARD_Iteration_i::GetFileInfo() { - ASSERT( myHomardHypothesis ); - myHomardHypothesis->SetExtraOutput( ExtraOutput ); + ASSERT(myHomardIteration); + return CORBA::string_dup(myHomardIteration->GetFileInfo().c_str()); } //============================================================================= -CORBA::Long HOMARD_Hypothesis_i::GetExtraOutput() -{ - ASSERT( myHomardHypothesis ); - return myHomardHypothesis->GetExtraOutput(); -} //============================================================================= -void HOMARD_Hypothesis_i::AddGroup( const char* Group) -{ - ASSERT( myHomardHypothesis ); - myHomardHypothesis->AddGroup( Group ); -} +// Liens avec les autres iterations //============================================================================= -void HOMARD_Hypothesis_i::SupprGroup( const char* Group ) -{ - ASSERT( myHomardHypothesis ); - myHomardHypothesis->SupprGroup(Group); -} //============================================================================= -void HOMARD_Hypothesis_i::SupprGroups() +void HOMARD_Iteration_i::LinkNextIteration(const char* NomIteration) { - ASSERT( myHomardHypothesis ); - myHomardHypothesis->SupprGroups(); + ASSERT(myHomardIteration); + myHomardIteration->LinkNextIteration(NomIteration); } //============================================================================= -void HOMARD_Hypothesis_i::SetGroups(const SMESHHOMARD::ListGroupType& ListGroup) +void HOMARD_Iteration_i::UnLinkNextIteration(const char* NomIteration) { - ASSERT( myHomardHypothesis ); - std::list ListString; - for ( int i = 0; i < ListGroup.length(); i++ ) - { - ListString.push_back(std::string(ListGroup[i])); - } - myHomardHypothesis->SetGroups( ListString ); + ASSERT(myHomardIteration); + myHomardIteration->UnLinkNextIteration(NomIteration); } //============================================================================= -SMESHHOMARD::ListGroupType* HOMARD_Hypothesis_i::GetGroups() +void HOMARD_Iteration_i::SetIterParentName(const char* NomIterParent) { - ASSERT( myHomardHypothesis ); - const std::list& ListString = myHomardHypothesis->GetGroups(); - SMESHHOMARD::ListGroupType_var aResult = new SMESHHOMARD::ListGroupType; - aResult->length( ListString.size() ); - std::list::const_iterator it; - int i = 0; - for ( it = ListString.begin(); it != ListString.end(); it++ ) - { - aResult[i++] = CORBA::string_dup( (*it).c_str() ); - } - return aResult._retn(); + ASSERT(myHomardIteration); + myHomardIteration->SetIterParentName(NomIterParent); } //============================================================================= -void HOMARD_Hypothesis_i::SetTypeFieldInterp( CORBA::Long TypeFieldInterp ) +char* HOMARD_Iteration_i::GetIterParentName() { - ASSERT( myHomardHypothesis ); - myHomardHypothesis->SetTypeFieldInterp( TypeFieldInterp ); + ASSERT(myHomardIteration); + return CORBA::string_dup(myHomardIteration->GetIterParentName().c_str()); } + //============================================================================= -CORBA::Long HOMARD_Hypothesis_i::GetTypeFieldInterp() -{ - ASSERT( myHomardHypothesis ); - return CORBA::Long( myHomardHypothesis->GetTypeFieldInterp() ); -} //============================================================================= -void HOMARD_Hypothesis_i::AddFieldInterp( const char* FieldInterp ) -{ - ASSERT( myHomardHypothesis ); - myHomardHypothesis->AddFieldInterpType( FieldInterp, 0 ); -} +// Liens avec les autres structures //============================================================================= -void HOMARD_Hypothesis_i::AddFieldInterpType( const char* FieldInterp, CORBA::Long TypeInterp ) -{ - ASSERT( myHomardHypothesis ); - myHomardHypothesis->AddFieldInterpType( FieldInterp, TypeInterp ); -} //============================================================================= -void HOMARD_Hypothesis_i::SupprFieldInterp( const char* FieldInterp ) +void HOMARD_Iteration_i::SetCaseName(const char* NomCas) { - ASSERT( myHomardHypothesis ); - myHomardHypothesis->SupprFieldInterp(FieldInterp); + ASSERT(myHomardIteration); + myHomardIteration->SetCaseName(NomCas); } //============================================================================= -void HOMARD_Hypothesis_i::SupprFieldInterps() +char* HOMARD_Iteration_i::GetCaseName() { - ASSERT( myHomardHypothesis ); - myHomardHypothesis->SupprFieldInterps(); + ASSERT(myHomardIteration); + return CORBA::string_dup(myHomardIteration->GetCaseName().c_str()); } //============================================================================= -SMESHHOMARD::listeFieldInterpsHypo* HOMARD_Hypothesis_i::GetFieldInterps() +void HOMARD_Iteration_i::SetHypoName(const char* NomHypo) { - ASSERT( myHomardHypothesis ); - const std::list& ListString = myHomardHypothesis->GetFieldInterps(); - SMESHHOMARD::listeFieldInterpsHypo_var aResult = new SMESHHOMARD::listeFieldInterpsHypo; - aResult->length( ListString.size() ); - std::list::const_iterator it; - int i = 0; - for ( it = ListString.begin(); it != ListString.end(); it++ ) - { - aResult[i++] = CORBA::string_dup( (*it).c_str() ); - } - return aResult._retn(); + ASSERT(myHomardIteration); + myHomardIteration->SetHypoName(NomHypo); } //============================================================================= //============================================================================= -// Liens avec les autres structures -//============================================================================= -//============================================================================= -void HOMARD_Hypothesis_i::SetCaseCreation( const char* NomCaseCreation ) -{ - ASSERT( myHomardHypothesis ); - myHomardHypothesis->SetCaseCreation( NomCaseCreation ); -} -//============================================================================= -char* HOMARD_Hypothesis_i::GetCaseCreation() -{ - ASSERT( myHomardHypothesis ); - return CORBA::string_dup( myHomardHypothesis->GetCaseCreation().c_str() ); -} +// Divers //============================================================================= -void HOMARD_Hypothesis_i::LinkIteration( const char* NomIteration ) -{ - ASSERT( myHomardHypothesis ); - myHomardHypothesis->LinkIteration( NomIteration ); -} //============================================================================= -void HOMARD_Hypothesis_i::UnLinkIteration( const char* NomIteration ) +void HOMARD_Iteration_i::SetInfoCompute(CORBA::Long MessInfo) { - ASSERT( myHomardHypothesis ); - myHomardHypothesis->UnLinkIteration( NomIteration ); + ASSERT(myHomardIteration); + myHomardIteration->SetInfoCompute(MessInfo); } //============================================================================= -SMESHHOMARD::listeIters* HOMARD_Hypothesis_i::GetIterations() +CORBA::Long HOMARD_Iteration_i::GetInfoCompute() { - ASSERT( myHomardHypothesis ); - const std::list& ListString = myHomardHypothesis->GetIterations(); - SMESHHOMARD::listeIters_var aResult = new SMESHHOMARD::listeIters; - aResult->length( ListString.size() ); - std::list::const_iterator it; - int i = 0; - for ( it = ListString.begin(); it != ListString.end(); it++ ) - { - aResult[i++] = CORBA::string_dup( (*it).c_str() ); - } - return aResult._retn(); + ASSERT(myHomardIteration); + return myHomardIteration->GetInfoCompute(); } //============================================================================= @@ -1247,847 +923,149 @@ SMESHHOMARD::listeIters* HOMARD_Hypothesis_i::GetIterations() * standard constructor */ //============================================================================= -HOMARD_Iteration_i::HOMARD_Iteration_i() -{ - MESSAGE( "Default constructor, not for use" ); - ASSERT( 0 ); -} -//============================================================================= -/*! - * standard constructor - */ -//============================================================================= -HOMARD_Iteration_i::HOMARD_Iteration_i( CORBA::ORB_ptr orb, - SMESHHOMARD::HOMARD_Gen_var engine ) +HOMARD_Gen_i::HOMARD_Gen_i() : SALOME::GenericObj_i(SMESH_Gen_i::GetPOA()), + _KeepMedOUT(true), + _PublishMeshOUT(false), + _KeepWorkingFiles(false), + _LogInFile(false), + _RemoveLogOnSuccess(false), + _VerboseLevel(0), + _MeshNameOUT(""), + _MeshFileOUT(""), + _LogFile(""), + _CaseOnMedFile(true) { - MESSAGE("constructor"); - _gen_i = engine; - _orb = orb; - myHomardIteration = new SMESHHOMARDImpl::HOMARD_Iteration(); - ASSERT( myHomardIteration ); + MESSAGE("constructor de HOMARD_Gen_i"); + myHomard = new SMESHHOMARDImpl::HOMARD_Gen; } + //============================================================================= /*! * standard destructor */ //============================================================================= -HOMARD_Iteration_i::~HOMARD_Iteration_i() +HOMARD_Gen_i::~HOMARD_Gen_i() { } + //============================================================================= //============================================================================= -// Generalites +// Destruction des structures identifiees par leurs noms //============================================================================= //============================================================================= -void HOMARD_Iteration_i::SetName( const char* Name ) +CORBA::Long HOMARD_Gen_i::DeleteBoundary(const char* BoundaryName) { - ASSERT( myHomardIteration ); - myHomardIteration->SetName( Name ); + MESSAGE ("DeleteBoundary : BoundaryName = " << BoundaryName); + SMESHHOMARD::HOMARD_Boundary_var myBoundary = _mesBoundarys[BoundaryName]; + if (CORBA::is_nil(myBoundary)) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid boundary"; + throw SALOME::SALOME_Exception(es); + } + + // Boundaries should be deleted only after all cases deletion!!! + + // comme on a un _var comme pointeur CORBA, on ne se preoccupe pas du delete + _mesBoundarys.erase(BoundaryName); + + return 0; } + //============================================================================= -char* HOMARD_Iteration_i::GetName() +CORBA::Long HOMARD_Gen_i::DeleteCase() { - ASSERT( myHomardIteration ); - return CORBA::string_dup( myHomardIteration->GetName().c_str() ); -} + MESSAGE ("DeleteCase"); + if (!CORBA::is_nil(myCase)) { + // Delete Iteration0 + if (DeleteIteration(0) != 0) return 2; - //============================================================================= - CORBA::Long HOMARD_Iteration_i::Delete( CORBA::Long Option, bool doRemoveWorkingFiles ) - { - ASSERT( myHomardIteration ); - char* IterName = GetName(); - MESSAGE ( "Delete : destruction de l'iteration " << IterName << ", Option = " << Option ); - return _gen_i->DeleteIteration(IterName, Option, doRemoveWorkingFiles); + myCase = SMESHHOMARD::HOMARD_Cas::_nil(); } + return 0; +} //============================================================================= -char* HOMARD_Iteration_i::GetDumpPython() +CORBA::Long HOMARD_Gen_i::DeleteIteration(int numIter) { - ASSERT( myHomardIteration ); - return CORBA::string_dup( myHomardIteration->GetDumpPython().c_str() ); -} -//============================================================================= -std::string HOMARD_Iteration_i::Dump() const -{ - return SMESHHOMARDImpl::Dump( *myHomardIteration ); -} -//============================================================================= -bool HOMARD_Iteration_i::Restore( const std::string& stream ) -{ - return SMESHHOMARDImpl::Restore( *myHomardIteration, stream ); -} -//============================================================================= -//============================================================================= -// Caracteristiques -//============================================================================= -//============================================================================= -void HOMARD_Iteration_i::SetDirNameLoc( const char* NomDir ) -{ - ASSERT( myHomardIteration ); - myHomardIteration->SetDirNameLoc( NomDir ); -} -//============================================================================= -char* HOMARD_Iteration_i::GetDirNameLoc() -{ - ASSERT( myHomardIteration ); - return CORBA::string_dup( myHomardIteration->GetDirNameLoc().c_str() ); -} -//============================================================================= -char* HOMARD_Iteration_i::GetDirName() -{ - ASSERT( myHomardIteration ); - std::string casename = myHomardIteration->GetCaseName(); - SMESHHOMARD::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() ); -} -//============================================================================= -void HOMARD_Iteration_i::SetNumber( CORBA::Long NumIter ) -{ - ASSERT( myHomardIteration ); - myHomardIteration->SetNumber( NumIter ); -} -//============================================================================= -CORBA::Long HOMARD_Iteration_i::GetNumber() -{ - ASSERT( myHomardIteration ); - return myHomardIteration->GetNumber(); -} -//============================================================================= -void HOMARD_Iteration_i::SetState( CORBA::Long Etat ) -{ - ASSERT( myHomardIteration ); - myHomardIteration->SetState( Etat ); -} -//============================================================================= -CORBA::Long HOMARD_Iteration_i::GetState() -{ - ASSERT( myHomardIteration ); - return myHomardIteration->GetState(); -} -//============================================================================= -void HOMARD_Iteration_i::SetMeshName( const char* NomMesh ) -{ - ASSERT( myHomardIteration ); - myHomardIteration->SetMeshName( NomMesh ); -} -//============================================================================= -char* HOMARD_Iteration_i::GetMeshName() -{ - ASSERT( myHomardIteration ); - return CORBA::string_dup( myHomardIteration->GetMeshName().c_str() ); -} -//============================================================================= -void HOMARD_Iteration_i::SetMeshFile( const char* MeshFile ) -{ - ASSERT( myHomardIteration ); - myHomardIteration->SetMeshFile( MeshFile ); -} -//============================================================================= -char* HOMARD_Iteration_i::GetMeshFile() -{ - ASSERT( myHomardIteration ); - return CORBA::string_dup( myHomardIteration->GetMeshFile().c_str() ); -} -//============================================================================= -void HOMARD_Iteration_i::SetFieldFile( const char* FieldFile ) -{ - ASSERT( myHomardIteration ); - myHomardIteration->SetFieldFile( FieldFile ); -} -//============================================================================= -char* HOMARD_Iteration_i::GetFieldFile() -{ - ASSERT( myHomardIteration ); - return CORBA::string_dup( myHomardIteration->GetFieldFile().c_str() ); -} -//============================================================================= -// Instants pour le champ de pilotage -//============================================================================= -void HOMARD_Iteration_i::SetTimeStep( CORBA::Long TimeStep ) -{ - ASSERT( myHomardIteration ); - myHomardIteration->SetTimeStep( TimeStep ); -} -//============================================================================= -void HOMARD_Iteration_i::SetTimeStepRank( CORBA::Long TimeStep, CORBA::Long Rank ) -{ - ASSERT( myHomardIteration ); - myHomardIteration->SetTimeStepRank( TimeStep, Rank ); -} -//============================================================================= -void HOMARD_Iteration_i::SetTimeStepRankLast() -{ - ASSERT( myHomardIteration ); - myHomardIteration->SetTimeStepRankLast(); -} -//============================================================================= -CORBA::Long HOMARD_Iteration_i::GetTimeStep() -{ - ASSERT( myHomardIteration ); - return CORBA::Long( myHomardIteration->GetTimeStep() ); -} -//============================================================================= -CORBA::Long HOMARD_Iteration_i::GetRank() -{ - ASSERT( myHomardIteration ); - return CORBA::Long( myHomardIteration->GetRank() ); -} -//============================================================================= -// Instants pour un champ a interpoler -//============================================================================= -void HOMARD_Iteration_i::SetFieldInterpTimeStep( const char* FieldInterp, CORBA::Long TimeStep ) -{ - SetFieldInterpTimeStepRank( FieldInterp, TimeStep, TimeStep ); -} -//============================================================================= -void HOMARD_Iteration_i::SetFieldInterpTimeStepRank( const char* FieldInterp, CORBA::Long TimeStep, CORBA::Long Rank ) -{ - ASSERT( myHomardIteration ); - myHomardIteration->SetFieldInterpTimeStepRank( FieldInterp, TimeStep, Rank ); -} -//============================================================================= -SMESHHOMARD::listeFieldInterpTSRsIter* HOMARD_Iteration_i::GetFieldInterpsTimeStepRank() -{ - ASSERT( myHomardIteration ); - const std::list& ListString = myHomardIteration->GetFieldInterpsTimeStepRank(); - SMESHHOMARD::listeFieldInterpTSRsIter_var aResult = new SMESHHOMARD::listeFieldInterpTSRsIter; - aResult->length( ListString.size() ); - std::list::const_iterator it; - int i = 0; - for ( it = ListString.begin(); it != ListString.end(); it++ ) - { - aResult[i++] = CORBA::string_dup( (*it).c_str() ); - } - return aResult._retn(); -} -//============================================================================= -void HOMARD_Iteration_i::SetFieldInterp( const char* FieldInterp ) -{ - myHomardIteration->SetFieldInterp( FieldInterp ); -} -//============================================================================= -SMESHHOMARD::listeFieldInterpsIter* HOMARD_Iteration_i::GetFieldInterps() -{ - ASSERT( myHomardIteration ); - const std::list& ListString = myHomardIteration->GetFieldInterps(); - SMESHHOMARD::listeFieldInterpsIter_var aResult = new SMESHHOMARD::listeFieldInterpsIter; - aResult->length( ListString.size() ); - std::list::const_iterator it; - int i = 0; - for ( it = ListString.begin(); it != ListString.end(); it++ ) - { - aResult[i++] = CORBA::string_dup( (*it).c_str() ); - } - return aResult._retn(); -} -//============================================================================= -void HOMARD_Iteration_i::SupprFieldInterps() -{ - ASSERT( myHomardIteration ); - myHomardIteration->SupprFieldInterps(); -} -//============================================================================= -void HOMARD_Iteration_i::SetLogFile( const char* LogFile ) -{ - ASSERT( myHomardIteration ); - myHomardIteration->SetLogFile( LogFile ); -} -//============================================================================= -char* HOMARD_Iteration_i::GetLogFile() -{ - ASSERT( myHomardIteration ); - return CORBA::string_dup( myHomardIteration->GetLogFile().c_str() ); -} -//============================================================================= -CORBA::Long HOMARD_Iteration_i::Compute(CORBA::Long etatMenage, CORBA::Long Option) -{ - MESSAGE ( "Compute : calcul d'une iteration, etatMenage = "<Compute(IterName, etatMenage, modeHOMARD, Option1, Option); -} -//============================================================================= -void HOMARD_Iteration_i::MeshInfo(CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte) -{ - MESSAGE ( "MeshInfo : information sur le maillage associe a une iteration" ); - ASSERT( myHomardIteration ); - // - int Option = 1; - MeshInfoOption( Qual, Diam, Conn, Tail, Inte, Option ); -} -//============================================================================= -void HOMARD_Iteration_i::MeshInfoOption(CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte, CORBA::Long Option) -{ - MESSAGE ( "MeshInfoOption : information sur le maillage associe a une iteration" ); - ASSERT( myHomardIteration ); -// -// Nom de l'iteration - char* IterName = GetName(); - CORBA::Long etatMenage = -1; - CORBA::Long modeHOMARD = 7; - if ( Qual != 0 ) { modeHOMARD = modeHOMARD*5; } - if ( Diam != 0 ) { modeHOMARD = modeHOMARD*19; } - if ( Conn != 0 ) { modeHOMARD = modeHOMARD*11; } - if ( Tail != 0 ) { modeHOMARD = modeHOMARD*13; } - if ( Inte != 0 ) { modeHOMARD = modeHOMARD*3; } - MESSAGE ( "MeshInfoOption : information sur le maillage de l'iteration " << IterName ); - CORBA::Long Option2 = 1; - CORBA::Long codret = _gen_i->Compute(IterName, etatMenage, modeHOMARD, Option, Option2); - MESSAGE ( "MeshInfoOption : codret = " << codret ); -} -//============================================================================= -void HOMARD_Iteration_i::SetFileInfo( const char* FileInfo ) -{ - ASSERT( myHomardIteration ); - myHomardIteration->SetFileInfo( FileInfo ); -} -//============================================================================= -char* HOMARD_Iteration_i::GetFileInfo() -{ - ASSERT( myHomardIteration ); - return CORBA::string_dup( myHomardIteration->GetFileInfo().c_str() ); -} -//============================================================================= -//============================================================================= -// Liens avec les autres iterations -//============================================================================= -//============================================================================= -SMESHHOMARD::HOMARD_Iteration_ptr HOMARD_Iteration_i::NextIteration( const char* IterName ) -{ -// Nom de l'iteration parent - char* NomIterParent = GetName(); - MESSAGE ( "NextIteration : creation de l'iteration " << IterName << " comme fille de " << NomIterParent ); - return _gen_i->CreateIteration(IterName, NomIterParent); -} -//============================================================================= -void HOMARD_Iteration_i::LinkNextIteration( const char* NomIteration ) -{ - ASSERT( myHomardIteration ); - myHomardIteration->LinkNextIteration( NomIteration ); -} -//============================================================================= -void HOMARD_Iteration_i::UnLinkNextIteration( const char* NomIteration ) -{ - ASSERT( myHomardIteration ); - myHomardIteration->UnLinkNextIteration( NomIteration ); -} -//============================================================================= -SMESHHOMARD::listeIterFilles* HOMARD_Iteration_i::GetIterations() -{ - ASSERT( myHomardIteration ); - const std::list& maListe = myHomardIteration->GetIterations(); - SMESHHOMARD::listeIterFilles_var aResult = new SMESHHOMARD::listeIterFilles; - aResult->length( maListe.size() ); - std::list::const_iterator it; - int i = 0; - for ( it = maListe.begin(); it != maListe.end(); it++ ) - { - aResult[i++] = CORBA::string_dup( (*it).c_str() ); - } - return aResult._retn(); -} -//============================================================================= -void HOMARD_Iteration_i::SetIterParentName( const char* NomIterParent ) -{ - ASSERT( myHomardIteration ); - myHomardIteration->SetIterParentName( NomIterParent ); -} -//============================================================================= -char* HOMARD_Iteration_i::GetIterParentName() -{ - ASSERT( myHomardIteration ); - return CORBA::string_dup( myHomardIteration->GetIterParentName().c_str() ); -} -//============================================================================= -SMESHHOMARD::HOMARD_Iteration_ptr HOMARD_Iteration_i::GetIterParent() -{ -// Nom de l'iteration parent - char* NomIterParent = GetIterParentName(); - MESSAGE ( "GetIterParent : NomIterParent = " << NomIterParent ); - return _gen_i->GetIteration(NomIterParent); -} -//============================================================================= -//============================================================================= -// Liens avec les autres structures -//============================================================================= -//============================================================================= -void HOMARD_Iteration_i::SetCaseName( const char* NomCas ) -{ - ASSERT( myHomardIteration ); - myHomardIteration->SetCaseName( NomCas ); -} -//============================================================================= -char* HOMARD_Iteration_i::GetCaseName() -{ - ASSERT( myHomardIteration ); - return CORBA::string_dup( myHomardIteration->GetCaseName().c_str() ); -} -//============================================================================= -void HOMARD_Iteration_i::AssociateHypo( const char* NomHypo ) -{ - ASSERT( myHomardIteration ); -// -// Nom de l'iteration - char* IterName = GetName(); - MESSAGE ( ". IterName = " << IterName ); - return _gen_i->AssociateIterHypo(IterName, NomHypo); -} -//============================================================================= -void HOMARD_Iteration_i::SetHypoName( const char* NomHypo ) -{ - ASSERT( myHomardIteration ); - myHomardIteration->SetHypoName( NomHypo ); -} -//============================================================================= -char* HOMARD_Iteration_i::GetHypoName() -{ - ASSERT( myHomardIteration ); - return CORBA::string_dup( myHomardIteration->GetHypoName().c_str() ); -} -//============================================================================= -//============================================================================= -// Divers -//============================================================================= -//============================================================================= -void HOMARD_Iteration_i::SetInfoCompute( CORBA::Long MessInfo ) -{ - ASSERT( myHomardIteration ); - myHomardIteration->SetInfoCompute( MessInfo ); -} -//============================================================================= -CORBA::Long HOMARD_Iteration_i::GetInfoCompute() -{ - ASSERT( myHomardIteration ); - return myHomardIteration->GetInfoCompute(); -} + MESSAGE ("DeleteIteration : numIter = " << numIter); -//============================================================================= -//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++; + if (numIter == 0) { + myIteration0 = SMESHHOMARD::HOMARD_Iteration::_nil(); } - return theScript; -} -//============================================================================= -/*! - * standard constructor - */ -//============================================================================= -HOMARD_Gen_i::HOMARD_Gen_i() : -SALOME::GenericObj_i( SMESH_Gen_i::GetPOA() ) -{ - MESSAGE("constructor de HOMARD_Gen_i"); - - myHomard = new SMESHHOMARDImpl::HOMARD_Gen; - - SetPreferences(); -} -//================================= -/*! - * standard destructor - */ -//================================ -HOMARD_Gen_i::~HOMARD_Gen_i() -{ -} - -//============================================================================= -//============================================================================= -// 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 ); - SMESHHOMARD::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); - } - - myIteration->SetState(Etat); -} -//============================================================================= -//============================================================================= -// -//============================================================================= -//============================================================================= -// Destruction des structures identifiees par leurs noms -//============================================================================= -//============================================================================= -CORBA::Long HOMARD_Gen_i::DeleteBoundary(const char* BoundaryName) -{ - MESSAGE ( "DeleteBoundary : BoundaryName = " << BoundaryName ); - SMESHHOMARD::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 - SMESHHOMARD::listeCases* maListe = GetAllCasesName(); - int numberOfCases = maListe->length(); - MESSAGE ( ".. Nombre de cas = " << numberOfCases ); - std::string CaseName; - SMESHHOMARD::ListBoundaryGroupType* ListBoundaryGroupType; - int numberOfitems; - SMESHHOMARD::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 ) - { + else { + if (!CORBA::is_nil(myIteration1)) { + if (CORBA::is_nil(myIteration0)) { SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; - es.text = "This boundary is used in a case and cannot be deleted."; + es.text = "Invalid iteration 0"; 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); + // Invalide Iteration + if (myIteration1->GetState() > 0) { + myIteration1->SetState(1); + if (!_KeepWorkingFiles) { + std::string nomDir = myIteration1->GetDirName(); + std::string commande = "rm -rf " + nomDir; + if (numIter > 0 && !_KeepMedOUT) { + // Remove associated mesh file + std::string nomFichier = myIteration1->GetMeshFile(); + commande = commande + ";rm -rf " + 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 0; -} -//============================================================================= -CORBA::Long HOMARD_Gen_i::DeleteCase(const char* nomCas, CORBA::Long Option) -{ - // Pour detruire un cas - MESSAGE ( "DeleteCase : nomCas = " << nomCas << ", avec option = " << Option ); - SMESHHOMARD::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; + // Unlink from the parent iteration and from the hypothesis + myIteration0->UnLinkNextIteration("Iter_1"); + ASSERT(!CORBA::is_nil(myHypothesis)); + myHypothesis->UnLinkIteration("Iter_1"); + myIteration1 = SMESHHOMARD::HOMARD_Iteration::_nil(); + } } - // 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, true) != 0 ) - { - return 2; - }; - - // comme on a un _var comme pointeur CORBA, on ne se preoccupe pas du delete - myStudyContext._mesCas.erase(nomCas); return 0; } -//============================================================================= -CORBA::Long HOMARD_Gen_i::DeleteHypo(const char* nomHypo) -{ - MESSAGE ( "DeleteHypo : nomHypo = " << nomHypo ); - SMESHHOMARD::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 - SMESHHOMARD::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; - }; - - // comme on a un _var comme pointeur CORBA, on ne se preoccupe pas du delete - myStudyContext._mesHypotheses.erase(nomHypo); - - return 0; -} - - //============================================================================= - CORBA::Long HOMARD_Gen_i::DeleteIteration(const char* nomIter, CORBA::Long Option, - bool doRemoveWorkingFiles) - { - // Option = 0 : On ne supprime pas le fichier du maillage associe - // Option = 1 : On supprime le fichier du maillage associe - MESSAGE ( "DeleteIteration : nomIter = " << nomIter << ", avec option = " << Option ); - CORBA::Long Option1 = 1; - return DeleteIterationOption(nomIter, Option1, Option, doRemoveWorkingFiles); - } - -//============================================================================= -CORBA::Long HOMARD_Gen_i::DeleteIterationOption(const char* nomIter, - CORBA::Long Option1, - CORBA::Long Option2, - bool doRemoveWorkingFiles) -{ - // 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 ); - SMESHHOMARD::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); - } - - 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); - } - - // On detruit recursivement toutes les filles - SMESHHOMARD::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, doRemoveWorkingFiles); - } - - // 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, doRemoveWorkingFiles); - - // Retrait dans la descendance de l'iteration parent - if ( numero > 0 ) - { - std::string nomIterationParent = myIteration->GetIterParentName(); - MESSAGE ( "Retrait dans la descendance de nomIterationParent " << nomIterationParent ); - SMESHHOMARD::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(); - SMESHHOMARD::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); - - // on peut aussi faire RemoveObject -// MESSAGE ( "Au final" ); -// SMESHHOMARD::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; -} //============================================================================= //============================================================================= // Invalidation des structures identifiees par leurs noms //============================================================================= -//============================================================================= -void HOMARD_Gen_i::InvalideBoundary(const char* BoundaryName) -{ - MESSAGE( "InvalideBoundary : BoundaryName = " << BoundaryName ); - SMESHHOMARD::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); - } - 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); - } -} -//============================================================================= -void HOMARD_Gen_i::InvalideHypo(const char* nomHypo) -{ - MESSAGE( "InvalideHypo : nomHypo = " << nomHypo ); - SMESHHOMARD::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); - } - - SMESHHOMARD::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, true); -} - - //============================================================================= - void HOMARD_Gen_i::InvalideIterOption(const char* nomIter, CORBA::Long Option, - bool doRemoveWorkingFiles) - { - // 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 ); - SMESHHOMARD::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); - } - - SMESHHOMARD::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 ); - - int etat = myIteration->GetState(); - if ( etat > 0 ) { - SetEtatIter(nomIter,1); - //const char * nomCas = myIteration->GetCaseName(); - //SMESHHOMARD::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); - //} - if (doRemoveWorkingFiles) { - 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); - } - } - // Suppression du maillage publie dans SMESH - //std::string MeshName = myIteration->GetMeshName(); - //DeleteResultInSmesh(nomFichier, MeshName); - } - } - -//============================================================================= -void HOMARD_Gen_i::InvalideIterInfo(const char* nomIter) +//============================================================================= +void HOMARD_Gen_i::InvalideBoundary(const char* BoundaryName) { - MESSAGE("InvalideIterInfo : nomIter = " << nomIter); - SMESHHOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[nomIter]; - if (CORBA::is_nil(myIteration)) { + MESSAGE("InvalideBoundary : BoundaryName = " << BoundaryName); + SMESHHOMARD::HOMARD_Boundary_var myBoundary = _mesBoundarys[BoundaryName]; + if (CORBA::is_nil(myBoundary)) { SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; - es.text = "Invalid iteration"; + es.text = "Invalid boundary"; throw SALOME::SALOME_Exception(es); } - - const char * nomCas = myIteration->GetCaseName(); - SMESHHOMARD::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); - }; - 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) - { + else { SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; - es.text = "The directory for the calculation cannot be cleared."; + es.text = "No change is allowed in a boundary. Ask for evolution."; throw SALOME::SALOME_Exception(es); } } + //============================================================================= //============================================================================= // Association de lien entre des structures identifiees par leurs noms //============================================================================= //============================================================================= -void HOMARD_Gen_i::AssociateCaseIter(const char* nomCas, const char* nomIter, const char* labelIter) +void HOMARD_Gen_i::AssociateCaseIter(int numIter, const char* labelIter) { - MESSAGE( "AssociateCaseIter : " << nomCas << ", " << nomIter << ", " << labelIter ); + MESSAGE("AssociateCaseIter : " << numIter << ", " << labelIter); - SMESHHOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; if (CORBA::is_nil(myCase)) { SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; @@ -2095,7 +1073,9 @@ void HOMARD_Gen_i::AssociateCaseIter(const char* nomCas, const char* nomIter, co throw SALOME::SALOME_Exception(es); } - SMESHHOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[nomIter]; + SMESHHOMARD::HOMARD_Iteration_var myIteration; + if (numIter == 0) myIteration = myIteration0; + else myIteration = myIteration1; if (CORBA::is_nil(myIteration)) { SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; @@ -2103,36 +1083,8 @@ void HOMARD_Gen_i::AssociateCaseIter(const char* nomCas, const char* nomIter, co throw SALOME::SALOME_Exception(es); } - myCase->AddIteration(nomIter); - myIteration->SetCaseName(nomCas); -} -//============================================================================= -void HOMARD_Gen_i::AssociateIterHypo(const char* nomIter, const char* nomHypo) -{ - MESSAGE("AssociateIterHypo : nomHypo = " << nomHypo << " nomIter = " << nomIter); - - // Verification de l'existence de l'hypothese - SMESHHOMARD::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypo]; - ASSERT(!CORBA::is_nil(myHypo)); - - // Verification de l'existence de l'iteration - SMESHHOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[nomIter]; - ASSERT(!CORBA::is_nil(myIteration)); - - // 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(); - SMESHHOMARD::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++; - } + myCase->AddIteration(myIteration->GetName()); + myIteration->SetCaseName("Case_1"); } //============================================================================= @@ -2145,63 +1097,11 @@ SMESHHOMARD::listeBoundarys* HOMARD_Gen_i::GetAllBoundarysName() MESSAGE("GetAllBoundarysName"); SMESHHOMARD::listeBoundarys_var ret = new SMESHHOMARD::listeBoundarys; - ret->length(myStudyContext._mesBoundarys.size()); + ret->length(_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(); -} -//============================================================================= -SMESHHOMARD::listeCases* HOMARD_Gen_i::GetAllCasesName() -{ - MESSAGE("GetAllCasesName"); - - SMESHHOMARD::listeCases_var ret = new SMESHHOMARD::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(); -} -//============================================================================= -SMESHHOMARD::listeHypotheses* HOMARD_Gen_i::GetAllHypothesesName() -{ - MESSAGE("GetAllHypothesesName"); - - SMESHHOMARD::listeHypotheses_var ret = new SMESHHOMARD::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(); -} -//============================================================================= -SMESHHOMARD::listeIterations* HOMARD_Gen_i::GetAllIterationsName() -{ - MESSAGE("GetAllIterationsName"); - - SMESHHOMARD::listeIterations_var ret = new SMESHHOMARD::listeIterations; - ret->length(myStudyContext._mesIterations.size()); - std::map::const_iterator it; - int i = 0; - for (it = myStudyContext._mesIterations.begin(); - it != myStudyContext._mesIterations.end(); it++) - { + for (it = _mesBoundarys.begin(); + it != _mesBoundarys.end(); it++) { ret[i++] = CORBA::string_dup((*it).first.c_str()); } @@ -2215,69 +1115,27 @@ SMESHHOMARD::listeIterations* HOMARD_Gen_i::GetAllIterationsName() //============================================================================= SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::GetBoundary(const char* nomBoundary) { - SMESHHOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[nomBoundary]; + SMESHHOMARD::HOMARD_Boundary_var myBoundary = _mesBoundarys[nomBoundary]; ASSERT(!CORBA::is_nil(myBoundary)); return SMESHHOMARD::HOMARD_Boundary::_duplicate(myBoundary); } //============================================================================= -SMESHHOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::GetCase(const char* nomCas) +SMESHHOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::GetCase() { - SMESHHOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; ASSERT(!CORBA::is_nil(myCase)); return SMESHHOMARD::HOMARD_Cas::_duplicate(myCase); } //============================================================================= -SMESHHOMARD::HOMARD_Hypothesis_ptr HOMARD_Gen_i::GetHypothesis(const char* nomHypothesis) -{ - SMESHHOMARD::HOMARD_Hypothesis_var myHypothesis = myStudyContext._mesHypotheses[nomHypothesis]; - ASSERT(!CORBA::is_nil(myHypothesis)); - return SMESHHOMARD::HOMARD_Hypothesis::_duplicate(myHypothesis); -} -//============================================================================= -SMESHHOMARD::HOMARD_Iteration_ptr HOMARD_Gen_i::GetIteration(const char* NomIterationation) -{ - SMESHHOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[NomIterationation]; - ASSERT(!CORBA::is_nil(myIteration)); - return SMESHHOMARD::HOMARD_Iteration::_duplicate(myIteration); -} -//============================================================================= -//============================================================================= -// 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) +SMESHHOMARD::HOMARD_Iteration_ptr HOMARD_Gen_i::GetIteration(int numIter) { - MESSAGE ( "MeshInfo : nomCas = " << nomCas << ", MeshName = " << MeshName << ", MeshFile = " << MeshFile ); - MESSAGE ( "Qual = " << Qual << ", Diam = " << Diam << ", Conn = " << Conn << ", Tail = " << Tail << ", Inte = " << Inte ); - - // Creation du cas - int option = 1; - if ( _PublisMeshIN != 0 ) option = 2; - SMESHHOMARD::HOMARD_Cas_ptr myCase = CreateCase0(nomCas, MeshName, MeshFile, 1, 0, option); - myCase->SetDirName(DirName); - // Analyse - myCase->MeshInfo(Qual, Diam, Conn, Tail, Inte); -} -//============================================================================= -//============================================================================= + if (numIter == 0) { + ASSERT(!CORBA::is_nil(myIteration0)); + return SMESHHOMARD::HOMARD_Iteration::_duplicate(myIteration0); + } -//============================================================================= -//============================================================================= -// Recuperation des structures par le contexte -//============================================================================= -//============================================================================= -SMESHHOMARD::HOMARD_Iteration_ptr HOMARD_Gen_i::LastIteration(const char* nomCas) -{ - SMESHHOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; - ASSERT(!CORBA::is_nil(myCase)); -// - SMESHHOMARD::HOMARD_Iteration_var myIteration = myCase->LastIteration(); - ASSERT(!CORBA::is_nil(myIteration)); -// - return SMESHHOMARD::HOMARD_Iteration::_duplicate(myIteration); + ASSERT(!CORBA::is_nil(myIteration1)); + return SMESHHOMARD::HOMARD_Iteration::_duplicate(myIteration1); } -//============================================================================= -//============================================================================= //============================================================================= //============================================================================= @@ -2287,32 +1145,26 @@ SMESHHOMARD::HOMARD_Iteration_ptr HOMARD_Gen_i::LastIteration(const char* nomCas SMESHHOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::newCase() { SMESHHOMARD::HOMARD_Gen_var engine = POA_SMESHHOMARD::HOMARD_Gen::_this(); - HOMARD_Cas_i* aServant = new HOMARD_Cas_i(SMESH_Gen_i::GetORB(), engine); + HOMARD_Cas_i* aServant = new HOMARD_Cas_i(engine); SMESHHOMARD::HOMARD_Cas_var aCase = SMESHHOMARD::HOMARD_Cas::_narrow(aServant->_this()); return aCase._retn(); } //============================================================================= -SMESHHOMARD::HOMARD_Hypothesis_ptr HOMARD_Gen_i::newHypothesis() -{ - SMESHHOMARD::HOMARD_Gen_var engine = POA_SMESHHOMARD::HOMARD_Gen::_this(); - HOMARD_Hypothesis_i* aServant = new HOMARD_Hypothesis_i(SMESH_Gen_i::GetORB(), engine); - SMESHHOMARD::HOMARD_Hypothesis_var aHypo = SMESHHOMARD::HOMARD_Hypothesis::_narrow(aServant->_this()); - return aHypo._retn(); -} -//============================================================================= SMESHHOMARD::HOMARD_Iteration_ptr HOMARD_Gen_i::newIteration() { SMESHHOMARD::HOMARD_Gen_var engine = POA_SMESHHOMARD::HOMARD_Gen::_this(); - HOMARD_Iteration_i* aServant = new HOMARD_Iteration_i(SMESH_Gen_i::GetORB(), engine); - SMESHHOMARD::HOMARD_Iteration_var aIter = SMESHHOMARD::HOMARD_Iteration::_narrow(aServant->_this()); + HOMARD_Iteration_i* aServant = new HOMARD_Iteration_i(engine); + SMESHHOMARD::HOMARD_Iteration_var aIter = + SMESHHOMARD::HOMARD_Iteration::_narrow(aServant->_this()); return aIter._retn(); } //============================================================================= SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::newBoundary() { SMESHHOMARD::HOMARD_Gen_var engine = POA_SMESHHOMARD::HOMARD_Gen::_this(); - HOMARD_Boundary_i* aServant = new HOMARD_Boundary_i(SMESH_Gen_i::GetORB(), engine); - SMESHHOMARD::HOMARD_Boundary_var aBoundary = SMESHHOMARD::HOMARD_Boundary::_narrow(aServant->_this()); + HOMARD_Boundary_i* aServant = new HOMARD_Boundary_i(engine); + SMESHHOMARD::HOMARD_Boundary_var aBoundary = + SMESHHOMARD::HOMARD_Boundary::_narrow(aServant->_this()); return aBoundary._retn(); } @@ -2321,383 +1173,235 @@ SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::newBoundary() // Creation des structures identifiees par leurs noms //============================================================================= //============================================================================= -SMESHHOMARD::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; - SMESHHOMARD::HOMARD_Cas_ptr myCase = CreateCase0(nomCas, MeshName, MeshFile, 0, 0, option); - // Valeurs par defaut des filtrages - myCase->SetPyram(0); - - return SMESHHOMARD::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 -// +// Creation of a case +// MeshName : name of the mesh +// smeshMesh : correspondent mesh +// theWorkingDir : path to working directory +//============================================================================= +SMESHHOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseOnMesh (const char* MeshName, + SMESH::SMESH_Mesh_ptr smeshMesh, + const char* theWorkingDir) { - MESSAGE ( "CreateCase1 : DirNameStart = " << DirNameStart << ", Number = " << Number ); - std::string nomDirWork = getenv("PWD"); - std::string DirNameStartIter; - int codret; - int NumeIterMax = -1; + INFOS("CreateCaseOnMesh"); - // 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; } - } - } + // A. Controles + // A.1. Controle du nom : + if (!myCase->_is_nil()) { + CleanCase(); } -#ifndef WIN32 - closedir(dp); -#else - FindClose(hFind); -#endif - CHDIR(nomDirWork.c_str()); - if ( ( Number >= 0 && ( !existe ) ) || ( Number < 0 && ( NumeIterMax == -1 ) ) ) - { + // A.2. Controle du objet maillage + if (CORBA::is_nil(smeshMesh)) { SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; - es.text = "The directory of the iteration does not exist."; + es.text = "The mesh object is null."; throw SALOME::SALOME_Exception(es); - return 0; - }; + } + MESSAGE("CreateCaseOnMesh : smeshMesh is not nil"); - return DirNameStartIter; -} -//============================================================================= -SMESHHOMARD::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.2. Controle du nom : - if ((myStudyContext._mesCas).find(nomCas)!=(myStudyContext._mesCas).end()) + // A.3. Write mesh object in a temporary file in the working directory + std::string aTmpMeshFile (theWorkingDir); + aTmpMeshFile += std::string("/") + std::string(MeshName) + "_saved_from_SMESH.med"; // TODO: unique + const char* MeshFile = aTmpMeshFile.c_str(); + bool toOverwrite = true; + bool toFindOutDim = true; + + // Prevent dump of ExportMED { + SMESH::TPythonDump pDump; // do not delete this line of code + smeshMesh->ExportMED(MeshFile, false, -1, toOverwrite, toFindOutDim); + } + + // A.4. Controle du fichier du maillage + med_idt medIdt = MEDfileOpen(MeshFile, MED_ACC_RDONLY); + bool existeMeshFile = medIdt >= 0; + if (existeMeshFile) MEDfileClose(medIdt); + MESSAGE("CreateCaseOnMesh : existeMeshFile = " << existeMeshFile); + if (!existeMeshFile) { SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; - es.text = "This case has already been defined."; + es.text = "The mesh file does not exist."; 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 - SMESHHOMARD::HOMARD_Cas_var myCase = newCase(); - myCase->SetName(nomCas); - myStudyContext._mesCas[nomCas] = myCase; + // B. Creation de l'objet cas + myCase = newCase(); + _CaseOnMedFile = false; + _SmeshMesh = SMESH::SMESH_Mesh::_duplicate(smeshMesh); // C. Caracteristiques du maillage - if ( existeMeshFile != 0 ) { + if (existeMeshFile) { // Les valeurs extremes des coordonnées - //MESSAGE ( "CreateCase0 : Les valeurs extremes des coordonnées" ); - std::vector LesExtremes =GetBoundingBoxInMedFile(MeshFile); + //MESSAGE ("CreateCaseOnMesh : Les valeurs extremes des coordonnées"); + std::vector LesExtremes = GetBoundingBoxInMedFile(MeshFile); SMESHHOMARD::extrema_var aSeq = new SMESHHOMARD::extrema(); - if (LesExtremes.size()!=10) { return 0; } + if (LesExtremes.size() != 10) { return 0; } aSeq->length(10); - for (int i =0; i< LesExtremes.size(); i++) - aSeq[i]=LesExtremes[i]; + 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); + //MESSAGE ("CreateCaseOnMesh : Les groupes"); + std::set LesGroupes = GetListeGroupesInMedFile(MeshFile); SMESHHOMARD::ListGroupType_var aSeqGroupe = new SMESHHOMARD::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(); + 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" ); + MESSAGE ("CreateCaseOnMesh : 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 ); + MESSAGE("CreateCaseOnMesh : ==> NomIteration = " << MeshName); - // D.2. Creation de l'iteration - SMESHHOMARD::HOMARD_Iteration_var anIter = newIteration(); - myStudyContext._mesIterations[NomIteration] = anIter; - anIter->SetName(NomIteration.c_str()); - AssociateCaseIter (nomCas, NomIteration.c_str(), "IterationHomard"); + // D.2. Creation de l'iteration 0 + myIteration0 = newIteration(); + myIteration0->SetName(MeshName); + AssociateCaseIter(0, "IterationHomard"); // D.4. Maillage correspondant - if ( existeMeshFile != 0 ) - { - anIter->SetMeshFile(MeshFile); - if ( Option % 2 == 0 ) { PublishResultInSmesh(MeshFile, 0); } + if (existeMeshFile) { + myIteration0->SetMeshFile(MeshFile); } - anIter->SetMeshName(MeshName); + myIteration0->SetMeshName(MeshName); + myIteration0->SetNumber(0); + myIteration0->SetState(0); - // D.5. Numero d'iteration - anIter->SetNumber(NumeIter); - - // D.6. Etat - SetEtatIter(NomIteration.c_str(), -NumeIter); -// + // Only after full initialization of Iteration0 + myCase->SetDirName(theWorkingDir); return SMESHHOMARD::HOMARD_Cas::_duplicate(myCase); } + +//============================================================================= +// Creation of a case +// MeshName : name of the mesh +// MeshFile : med file +// theWorkingDir : path to working directory //============================================================================= -SMESHHOMARD::HOMARD_Hypothesis_ptr HOMARD_Gen_i::CreateHypothesis(const char* nomHypothesis) +SMESHHOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCase(const char* MeshName, + const char* MeshFile, + const char* theWorkingDir) { - MESSAGE ( "CreateHypothesis : nomHypothesis = " << nomHypothesis ); + INFOS("CreateCase : MeshName = " << MeshName << ", MeshFile = " << MeshFile); - // 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; + // A. Controles + // A.1. Controle du nom : + if (!myCase->_is_nil()) { + CleanCase(); } - // B. Creation de l'objet - SMESHHOMARD::HOMARD_Hypothesis_var myHypothesis = newHypothesis(); - if (CORBA::is_nil(myHypothesis)) - { + // A.3. Controle du fichier du maillage + med_idt medIdt = MEDfileOpen(MeshFile, MED_ACC_RDONLY); + bool existeMeshFile = medIdt >= 0; + if (existeMeshFile) MEDfileClose(medIdt); + MESSAGE("CreateCase : existeMeshFile = " << existeMeshFile); + if (!existeMeshFile) { SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; - es.text = "Unable to create the hypothesis"; + es.text = "The mesh file does not exist."; throw SALOME::SALOME_Exception(es); - return 0; - }; - myHypothesis->SetName(nomHypothesis); + } + + // B. Creation de l'objet cas + myCase = newCase(); + _CaseOnMedFile = true; + + // C. Caracteristiques du maillage + if (existeMeshFile) { + // Les valeurs extremes des coordonnées + //MESSAGE ("CreateCase : Les valeurs extremes des coordonnées"); + std::vector LesExtremes = GetBoundingBoxInMedFile(MeshFile); + SMESHHOMARD::extrema_var aSeq = new SMESHHOMARD::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 ("CreateCase : Les groupes"); + std::set LesGroupes = GetListeGroupesInMedFile(MeshFile); + SMESHHOMARD::ListGroupType_var aSeqGroupe = new SMESHHOMARD::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 ("CreateCase : 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. + MESSAGE("CreateCas : ==> NomIteration = " << MeshName); + + // D.2. Creation de l'iteration + myIteration0 = newIteration(); + myIteration0->SetName(MeshName); + AssociateCaseIter(0, "IterationHomard"); - // C. Enregistrement - myStudyContext._mesHypotheses[nomHypothesis] = myHypothesis; + // D.4. Maillage correspondant + if (existeMeshFile) { + myIteration0->SetMeshFile(MeshFile); + } + myIteration0->SetMeshName(MeshName); + myIteration0->SetNumber(0); + myIteration0->SetState(0); - // D. Valeurs par defaut des options avancees - myHypothesis->SetNivMax(-1); - myHypothesis->SetDiamMin(-1.0); - myHypothesis->SetAdapInit(0); - myHypothesis->SetExtraOutput(1); + // Only after full initialization of Iteration0 + myCase->SetDirName(theWorkingDir); - return SMESHHOMARD::HOMARD_Hypothesis::_duplicate(myHypothesis); + return SMESHHOMARD::HOMARD_Cas::_duplicate(myCase); } //============================================================================= -SMESHHOMARD::HOMARD_Iteration_ptr HOMARD_Gen_i::CreateIteration(const char* NomIteration, const char* nomIterParent) +// Create Iteration1 //============================================================================= +SMESHHOMARD::HOMARD_Iteration_ptr HOMARD_Gen_i::CreateIteration() { - MESSAGE ("CreateIteration : NomIteration = " << NomIteration << ", nomIterParent = " << nomIterParent); - - SMESHHOMARD::HOMARD_Iteration_var myIterationParent = myStudyContext._mesIterations[nomIterParent]; - if (CORBA::is_nil(myIterationParent)) - { + if (CORBA::is_nil(myIteration0)) { 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); - SMESHHOMARD::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; + if (!myIteration1->_is_nil()) { + DeleteIteration(1); } - SMESHHOMARD::HOMARD_Iteration_var myIteration = newIteration(); - if (CORBA::is_nil(myIteration)) { + myIteration1 = newIteration(); + if (CORBA::is_nil(myIteration1)) { SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; - es.text = "Unable to create the iteration"; + es.text = "Unable to create the iteration 1"; 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); + myIteration1->SetName("Iter_1"); + myIteration1->SetMeshName("Iter_1"); + myIteration1->SetState(1); + myIteration1->SetNumber(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); + int nbitercase = 1; //myCase->GetNumberofIter() + char* nomDirIter = CreateDirNameIter(nomDirCase, nbitercase); + myIteration1->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 @@ -2706,67 +1410,87 @@ SMESHHOMARD::HOMARD_Iteration_ptr HOMARD_Gen_i::CreateIteration(const char* NomI // 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; } + 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()); + myIteration1->SetMeshFile(MeshFile.str().c_str()); // Association avec le cas - std::string label = "IterationHomard_" + std::string(nomIterParent); - AssociateCaseIter(nomCas, NomIteration, label.c_str()); + std::string nomIterParent = myIteration0->GetName(); + std::string label = "IterationHomard_" + nomIterParent; + AssociateCaseIter(1, label.c_str()); // Lien avec l'iteration precedente - myIterationParent->LinkNextIteration(NomIteration); - myIteration->SetIterParentName(nomIterParent); + myIteration0->LinkNextIteration("Iter_1"); + myIteration1->SetIterParentName(nomIterParent.c_str()); + + // Associate hypothesis + if (CORBA::is_nil(myHypothesis)) { + SMESHHOMARD::HOMARD_Gen_var engine = POA_SMESHHOMARD::HOMARD_Gen::_this(); + HOMARD_Hypothesis_i* aServant = new HOMARD_Hypothesis_i(engine); + myHypothesis = SMESHHOMARD::HOMARD_Hypothesis::_narrow(aServant->_this()); + 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); + } + //myHypothesis->SetNivMax(-1); + //myHypothesis->SetDiamMin(-1.0); + //myHypothesis->SetAdapInit(0); + //myHypothesis->SetExtraOutput(1); + } + myIteration1->SetHypoName("Hypo_1"); + myHypothesis->LinkIteration("Iter_1"); - return SMESHHOMARD::HOMARD_Iteration::_duplicate(myIteration); + return SMESHHOMARD::HOMARD_Iteration::_duplicate(myIteration1); } //============================================================================= -SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundary(const char* BoundaryName, CORBA::Long BoundaryType) +SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundary(const char* BoundaryName, + CORBA::Long BoundaryType) { - MESSAGE ("CreateBoundary : BoundaryName = " << BoundaryName << ", BoundaryType = " << BoundaryType); + MESSAGE ("CreateBoundary : BoundaryName = " << BoundaryName << + ", BoundaryType = " << BoundaryType); // Controle du nom : - if ((myStudyContext._mesBoundarys).find(BoundaryName)!=(myStudyContext._mesBoundarys).end()) - { + if ((_mesBoundarys).find(BoundaryName) != (_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; - }; + } SMESHHOMARD::HOMARD_Boundary_var myBoundary = newBoundary(); myBoundary->SetName(BoundaryName); myBoundary->SetType(BoundaryType); - myStudyContext._mesBoundarys[BoundaryName] = myBoundary; + _mesBoundarys[BoundaryName] = myBoundary; return SMESHHOMARD::HOMARD_Boundary::_duplicate(myBoundary); } //============================================================================= SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryCAO(const char* BoundaryName, const char* CAOFile) { - MESSAGE ("CreateBoundaryCAO : BoundaryName = " << BoundaryName << ", CAOFile = " << CAOFile ); + MESSAGE ("CreateBoundaryCAO : BoundaryName = " << BoundaryName << ", CAOFile = " << CAOFile); SMESHHOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, -1); - myBoundary->SetDataFile( CAOFile ); + myBoundary->SetDataFile(CAOFile); return SMESHHOMARD::HOMARD_Boundary::_duplicate(myBoundary); } //============================================================================= SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryDi(const char* BoundaryName, const char* MeshName, const char* MeshFile) { - MESSAGE ("CreateBoundaryDi : BoundaryName = " << BoundaryName << ", MeshName = " << MeshName << ", MeshFile = " << MeshFile ); + MESSAGE ("CreateBoundaryDi : BoundaryName = " << BoundaryName << ", MeshName = " << MeshName << ", MeshFile = " << MeshFile); SMESHHOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 0); - myBoundary->SetDataFile( MeshFile ); - myBoundary->SetMeshName( MeshName ); + myBoundary->SetDataFile(MeshFile); + myBoundary->SetMeshName(MeshName); return SMESHHOMARD::HOMARD_Boundary::_duplicate(myBoundary); } @@ -2776,18 +1500,18 @@ SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryCylinder(const char CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, CORBA::Double Rayon) { - MESSAGE ("CreateBoundaryCylinder : BoundaryName = " << BoundaryName ); + MESSAGE ("CreateBoundaryCylinder : BoundaryName = " << BoundaryName); // SALOME::ExceptionStruct es; int error = 0; - if ( Rayon <= 0.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 ) + if (daux < 0.0000001) { es.text = "The axis must be a non 0 vector."; error = 2; } - if ( error != 0 ) + if (error != 0) { es.type = SALOME::BAD_PARAM; throw SALOME::SALOME_Exception(es); @@ -2795,7 +1519,7 @@ SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryCylinder(const char }; // SMESHHOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 1); - myBoundary->SetCylinder( Xcentre, Ycentre, Zcentre, Xaxe, Yaxe, Zaxe, Rayon ); + myBoundary->SetCylinder(Xcentre, Ycentre, Zcentre, Xaxe, Yaxe, Zaxe, Rayon); return SMESHHOMARD::HOMARD_Boundary::_duplicate(myBoundary); } @@ -2804,14 +1528,14 @@ SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundarySphere(const char* CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, CORBA::Double Rayon) { - MESSAGE ("CreateBoundarySphere : BoundaryName = " << BoundaryName ); + MESSAGE ("CreateBoundarySphere : BoundaryName = " << BoundaryName); // SALOME::ExceptionStruct es; int error = 0; - if ( Rayon <= 0.0 ) + if (Rayon <= 0.0) { es.text = "The radius must be positive."; error = 1; } - if ( error != 0 ) + if (error != 0) { es.type = SALOME::BAD_PARAM; throw SALOME::SALOME_Exception(es); @@ -2819,7 +1543,7 @@ SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundarySphere(const char* }; // SMESHHOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 2); - myBoundary->SetSphere( Xcentre, Ycentre, Zcentre, Rayon ); + myBoundary->SetSphere(Xcentre, Ycentre, Zcentre, Rayon); return SMESHHOMARD::HOMARD_Boundary::_duplicate(myBoundary); } @@ -2828,18 +1552,18 @@ SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryConeA(const char* B CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, CORBA::Double Angle, CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre) { - MESSAGE ("CreateBoundaryConeA : BoundaryName = " << BoundaryName ); + MESSAGE ("CreateBoundaryConeA : BoundaryName = " << BoundaryName); // SALOME::ExceptionStruct es; int error = 0; - if ( Angle <= 0.0 || Angle >= 90.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 ) + if (daux < 0.0000001) { es.text = "The axis must be a non 0 vector."; error = 2; } - if ( error != 0 ) + if (error != 0) { es.type = SALOME::BAD_PARAM; throw SALOME::SALOME_Exception(es); @@ -2847,7 +1571,7 @@ SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryConeA(const char* B }; // SMESHHOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 3); - myBoundary->SetConeA( Xaxe, Yaxe, Zaxe, Angle, Xcentre, Ycentre, Zcentre ); + myBoundary->SetConeA(Xaxe, Yaxe, Zaxe, Angle, Xcentre, Ycentre, Zcentre); return SMESHHOMARD::HOMARD_Boundary::_duplicate(myBoundary); } @@ -2856,22 +1580,22 @@ SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryConeR(const char* B CORBA::Double Xcentre1, CORBA::Double Ycentre1, CORBA::Double Zcentre1, CORBA::Double Rayon1, CORBA::Double Xcentre2, CORBA::Double Ycentre2, CORBA::Double Zcentre2, CORBA::Double Rayon2) { - MESSAGE ("CreateBoundaryConeR : BoundaryName = " << BoundaryName ); + MESSAGE ("CreateBoundaryConeR : BoundaryName = " << BoundaryName); // SALOME::ExceptionStruct es; int error = 0; - if ( Rayon1 < 0.0 || Rayon2 < 0.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 ) + 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 ) + if (daux < 0.0000001) { es.text = "The centers must be different."; error = 3; } - if ( error != 0 ) + if (error != 0) { es.type = SALOME::BAD_PARAM; throw SALOME::SALOME_Exception(es); @@ -2879,7 +1603,7 @@ SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryConeR(const char* B }; // SMESHHOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 4); - myBoundary->SetConeR( Xcentre1, Ycentre1, Zcentre1, Rayon1, Xcentre2, Ycentre2, Zcentre2, Rayon2 ); + myBoundary->SetConeR(Xcentre1, Ycentre1, Zcentre1, Rayon1, Xcentre2, Ycentre2, Zcentre2, Rayon2); return SMESHHOMARD::HOMARD_Boundary::_duplicate(myBoundary); } @@ -2889,18 +1613,18 @@ SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryTorus(const char* B CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, CORBA::Double RayonRev, CORBA::Double RayonPri) { - MESSAGE ("CreateBoundaryTorus : BoundaryName = " << BoundaryName ); + MESSAGE ("CreateBoundaryTorus : BoundaryName = " << BoundaryName); // SALOME::ExceptionStruct es; int error = 0; - if ( ( RayonRev <= 0.0 ) || ( RayonPri <= 0.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 ) + if (daux < 0.0000001) { es.text = "The axis must be a non 0 vector."; error = 2; } - if ( error != 0 ) + if (error != 0) { es.type = SALOME::BAD_PARAM; throw SALOME::SALOME_Exception(es); @@ -2908,78 +1632,48 @@ SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryTorus(const char* B }; // SMESHHOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 5); - myBoundary->SetTorus( Xcentre, Ycentre, Zcentre, Xaxe, Yaxe, Zaxe, RayonRev, RayonPri ); + myBoundary->SetTorus(Xcentre, Ycentre, Zcentre, Xaxe, Yaxe, Zaxe, RayonRev, RayonPri); return SMESHHOMARD::HOMARD_Boundary::_duplicate(myBoundary); } - -//============================================================================= -//============================================================================= -// 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 - SMESHHOMARD::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 = "<SetInfoCompute(_VerboseLevel); + myIteration1->SetMeshName(_MeshNameOUT.c_str()); + myIteration1->SetMeshFile(_MeshFileOUT.c_str()); + if (_LogInFile) myIteration1->SetLogFile(_LogFile.c_str()); + + // A.1. L'objet iteration + ASSERT(!CORBA::is_nil(myIteration1)); + + // A.2. Controle de la possibilite d'agir + // A.2.1. Etat de l'iteration + int etat = myIteration1->GetState(); + MESSAGE ("etat = " << etat); + // A.2.2. On ne calcule pas l'iteration initiale, ni une iteration deja calculee + if (etat == 2) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This iteration is already computed."; + throw SALOME::SALOME_Exception(es); } // A.3. Numero de l'iteration // siterp1 : numero de l'iteration a traiter // Si adaptation : - // siter : numero de l'iteration parent, ou 0 si deja au debut mais cela ne servira pas ! + // siter: numero de l'iteration parent, ou 0 si deja au debut mais cela ne servira pas ! // Ou si information : // siter = siterp1 - int NumeIter = myIteration->GetNumber(); + int NumeIter = myIteration1->GetNumber(); std::string siterp1; std::stringstream saux1; saux1 << NumeIter; @@ -2987,207 +1681,183 @@ CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMena 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; } + std::stringstream saux0; + int iaux = max(0, NumeIter-1); + saux0 << iaux; + siter = saux0.str(); + if (NumeIter < 11) { siter = "0" + siter; } // A.4. Le cas - const char* nomCas = myIteration->GetCaseName(); - SMESHHOMARD::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 ); + char* DirCompute = ComputeDirManagement(myCase, myIteration1); + MESSAGE(". DirCompute = " << DirCompute); // C. Le fichier des messages // C.1. Le deroulement de l'execution de HOMARD - std::string LogFile = myIteration->GetLogFile(); + std::string LogFile = myIteration1->GetLogFile(); if (LogFile.empty()) { LogFile = DirCompute; - LogFile += "/Liste"; - if ( modeHOMARD == 1 ) { LogFile += "." + siter + ".vers." + siterp1; } - LogFile += ".log"; - if ( modeHOMARD == 1 ) myIteration->SetLogFile(LogFile.c_str()); + LogFile += "/Liste." + siter + ".vers." + siterp1 + ".log"; + myIteration1->SetLogFile(LogFile.c_str()); } MESSAGE (". LogFile = " << LogFile); // 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()); + FileInfo += "/apad." + siterp1 + ".bilan"; + myIteration1->SetFileInfo(FileInfo.c_str()); // D. On passe dans le répertoire de l'iteration a calculer - MESSAGE ( ". On passe dans DirCompute = " << DirCompute ); + 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 SMESHHOMARDImpl::HomardDriver* myDriver = new SMESHHOMARDImpl::HomardDriver(siter, siterp1); - myDriver->TexteInit(DirCompute, LogFile, _Langue); + myDriver->TexteInit(DirCompute, LogFile, "English"); // E.2. Le maillage associe a l'iteration - const char* NomMesh = myIteration->GetMeshName(); - MESSAGE ( ". NomMesh = " << NomMesh ); - const char* MeshFile = myIteration->GetMeshFile(); - MESSAGE ( ". MeshFile = " << MeshFile ); + const char* NomMesh = myIteration1->GetMeshName(); + MESSAGE (". NomMesh = " << NomMesh); + const char* MeshFile = myIteration1->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(); - } + iaux = 1; + myDriver->TexteMaillageHOMARD(DirCompute, siterp1, iaux); + myDriver->TexteMaillage(NomMesh, MeshFile, 1); + codret = ComputeAdap(myCase, myIteration1, myDriver); // 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 = "<ExecuteHomard(); + // + 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 - } + if (codretexec == 0) { myIteration1->SetState(2); } + else { myIteration1->SetState(1); } } // H. Gestion des resultats - if (codret == 0) - { + 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"; } + Commentaire += " " + siterp1; // H.2. Si tout s'est bien passe : - if (codretexec == 0) - { - // H.2.1. Le fichier de bilan + if (codretexec == 0) { + // H.2.1. Le fichier de bilan Commentaire = "Summary"; - if ( modeHOMARD == 1 ) { Commentaire += " " + siterp1; } - else { Commentaire += "Info"; } - // H.2.2. Le fichier de maillage obtenu - if ( modeHOMARD == 1 ) - { - std::stringstream saux0; - Commentaire = "Mesh"; - Commentaire += " " + siterp1; - if ( Option2 % 2 == 0 ) { PublishResultInSmesh(MeshFile, 1); } - } + Commentaire += " " + siterp1; + // H.2.2. Le fichier de maillage obtenu + std::stringstream saux0; + Commentaire = "Mesh"; + Commentaire += " " + siterp1; + if (_PublishMeshOUT) 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 = "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 ); + 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) - { + if (codret == 0) { delete myDriver; - MESSAGE ( ". On retourne dans nomDirWork = " << nomDirWork ); - + 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) ) - { - MESSAGE ( "Suivi de frontière CAO" ); - codret = ComputeCAO(myCase, myIteration, Option1, Option2); + if (codret == 0) { + if ((BoundaryOption % 5 == 0) && (codretexec == 0)) { + MESSAGE ("Suivi de frontière CAO"); + codret = ComputeCAO(myCase, myIteration1); + } + } + + if (codretexec == 0) { + // Python Dump + PythonDump(); + + // Delete log file, if required + MESSAGE("myIteration1->GetLogFile() = " << myIteration1->GetLogFile()); + if (_LogInFile && _RemoveLogOnSuccess) { + // Remove log file on success + // TODO: QFile(myIteration->GetLogFile()).remove(); } + + // Clean all data + CleanCase(); } return codretexec; } + +void HOMARD_Gen_i::CleanCase() +{ + // Delete all boundaries + std::map::const_iterator it_boundary; + for (it_boundary = _mesBoundarys.begin(); + it_boundary != _mesBoundarys.end(); ++it_boundary) { + DeleteBoundary((*it_boundary).first.c_str()); + } + + // Delete iteration + DeleteIteration(1); + + // Delete hypothesis + // Hypothesis should be deleted only after iteration deletion + myHypothesis = SMESHHOMARD::HOMARD_Hypothesis::_nil(); + + // Delete case + DeleteCase(); +} + //============================================================================= // Calcul d'une iteration : partie spécifique à l'adaptation //============================================================================= CORBA::Long HOMARD_Gen_i::ComputeAdap(SMESHHOMARD::HOMARD_Cas_var myCase, SMESHHOMARD::HOMARD_Iteration_var myIteration, - CORBA::Long etatMenage, - SMESHHOMARDImpl::HomardDriver* myDriver, - CORBA::Long Option1, - CORBA::Long Option2) + SMESHHOMARDImpl::HomardDriver* myDriver) { - MESSAGE ( "ComputeAdap avec Option1 = " << Option1 << ", Option2 = " << Option2 ); + MESSAGE ("ComputeAdap"); // A. Prealable // A.1. Bases @@ -3200,138 +1870,92 @@ CORBA::Long HOMARD_Gen_i::ComputeAdap(SMESHHOMARD::HOMARD_Cas_var myCase, 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; - }; - SMESHHOMARD::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypo]; - ASSERT(!CORBA::is_nil(myHypo)); + ASSERT(!CORBA::is_nil(myHypothesis)); // B. L'iteration parent - const char* nomIterationParent = myIteration->GetIterParentName(); - SMESHHOMARD::HOMARD_Iteration_var myIterationParent = myStudyContext._mesIterations[nomIterationParent]; + //const char* nomIterationParent = myIteration->GetIterParentName(); + SMESHHOMARD::HOMARD_Iteration_var myIterationParent = myIteration0; 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); - } - }; + //if (myIterationParent->GetState() == 1) { + // int codret = Compute(nomIterationParent); + // if (codret != 0) 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 ); + 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 ); + MESSAGE (". ConfType = " << ConfType); // D.3. Le maillage de depart const char* NomMeshParent = myIterationParent->GetMeshName(); - MESSAGE ( ". NomMeshParent = " << NomMeshParent ); + MESSAGE (". NomMeshParent = " << NomMeshParent); const char* MeshFileParent = myIterationParent->GetMeshFile(); - MESSAGE ( ". MeshFileParent = " << MeshFileParent ); + MESSAGE (". MeshFileParent = " << MeshFileParent); // D.4. Le maillage associe a l'iteration const char* MeshFile = myIteration->GetMeshFile(); - MESSAGE ( ". MeshFile = " << MeshFile ); + MESSAGE (". MeshFile = " << MeshFile); FILE *file = fopen(MeshFile,"r"); - if (file != NULL) - { + if (file != NULL) { fclose(file); - if (etatMenage == 0) - { + // CleanOption = 0 : report an error if output mesh file exists + // CleanOption = 1 : destruction du répertoire d'execution + int CleanOption = 0; + if (CleanOption == 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 - { + else { std::string commande = "rm -f " + std::string(MeshFile); codret = system(commande.c_str()); - if (codret != 0) - { + 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 - SMESHHOMARD::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 ); + //SMESHHOMARD::listeTypes* ListTypes = myHypothesis->GetAdapRefinUnRef(); + //ASSERT(ListTypes->length() == 3); + int TypeAdap = -1; // HomardHypothesis->GetAdapType() + int TypeRaff = 1; // HomardHypothesis->GetRefinType() + int TypeDera = 0; // HomardHypothesis->GetUnRefType() // E. Texte du fichier de configuration // E.1. Incontournables du texte - myDriver->TexteAdap(ExtType); + myDriver->TexteAdap(); int iaux = 0; - myDriver->TexteMaillageHOMARD( DirComputePa, siter, iaux ); + myDriver->TexteMaillageHOMARD(DirComputePa, siter, iaux); myDriver->TexteMaillage(NomMeshParent, MeshFileParent, 0); myDriver->TexteConfRaffDera(ConfType, TypeAdap, TypeRaff, TypeDera); - // 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 - SMESHHOMARD::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); + //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(NivMax, DiamMin, AdapInit, ExtraOutput); + myDriver->TexteAdvanced(-1, -1.0, 0, 1); // E.7. Ajout des informations sur le deroulement de l'execution int MessInfo = myIteration->GetInfoCompute(); - MESSAGE ( ". MessInfo = " << MessInfo ); + MESSAGE (". MessInfo = " << MessInfo); myDriver->TexteInfoCompute(MessInfo); return codret; @@ -3339,9 +1963,10 @@ CORBA::Long HOMARD_Gen_i::ComputeAdap(SMESHHOMARD::HOMARD_Cas_var myCase, //============================================================================= // Calcul d'une iteration : partie spécifique au suivi de frontière CAO //============================================================================= -CORBA::Long HOMARD_Gen_i::ComputeCAO(SMESHHOMARD::HOMARD_Cas_var myCase, SMESHHOMARD::HOMARD_Iteration_var myIteration, CORBA::Long Option1, CORBA::Long Option2) +CORBA::Long HOMARD_Gen_i::ComputeCAO(SMESHHOMARD::HOMARD_Cas_var myCase, + SMESHHOMARD::HOMARD_Iteration_var myIteration) { - MESSAGE ( "ComputeCAO avec Option1 = " << Option1 << ", Option2 = " << Option2 ); + MESSAGE ("ComputeCAO"); // A. Prealable // A.1. Bases @@ -3354,26 +1979,26 @@ CORBA::Long HOMARD_Gen_i::ComputeCAO(SMESHHOMARD::HOMARD_Cas_var myCase, SMESHHO // B. Les données pour FrontTrack // B.1. Le maillage à modifier const std::string theInputMedFile = MeshFile; - MESSAGE ( ". theInputMedFile = " << theInputMedFile ); + MESSAGE (". theInputMedFile = " << theInputMedFile); // B.2. Le maillage après modification : fichier identique const std::string theOutputMedFile = MeshFile; - MESSAGE ( ". theOutputMedFile = " << theInputMedFile ); + 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; + MESSAGE (". DirCompute = " << DirCompute); + std::basic_string::size_type bilan; int icpt = 0; #ifndef WIN32 DIR *dp; struct dirent *dirp; dp = opendir(DirCompute); - while ( (dirp = readdir(dp)) != NULL ) + while ((dirp = readdir(dp)) != NULL) { std::string file_name(dirp->d_name); bilan = file_name.find("fr"); - if ( bilan != string::npos ) + if (bilan != string::npos) { std::stringstream filename_total; filename_total << DirCompute << "/" << file_name; @@ -3389,7 +2014,7 @@ CORBA::Long HOMARD_Gen_i::ComputeCAO(SMESHHOMARD::HOMARD_Cas_var myCase, SMESHHO while (FindNextFile(hFind, &ffd) != 0) { std::string file_name(ffd.cFileName); bilan = file_name.find("fr"); - if ( bilan != string::npos ) + if (bilan != string::npos) { std::stringstream filename_total; filename_total << DirCompute << "/" << file_name; @@ -3400,44 +2025,39 @@ CORBA::Long HOMARD_Gen_i::ComputeCAO(SMESHHOMARD::HOMARD_Cas_var myCase, SMESHHO FindClose(hFind); } #endif - for ( int i = 0; i < icpt; i++ ) - { MESSAGE ( ". theInputNodeFiles["<< i << "] = " << theInputNodeFiles[i] ); } + for (int i = 0; i < icpt; i++) + { MESSAGE (". theInputNodeFiles["<< i << "] = " << theInputNodeFiles[i]); } // B.4. Le fichier de la CAO SMESHHOMARD::ListBoundaryGroupType* ListBoundaryGroupType = myCase->GetBoundaryGroup(); std::string BoundaryName = std::string((*ListBoundaryGroupType)[0]); - MESSAGE ( ". BoundaryName = " << BoundaryName ); - SMESHHOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; + MESSAGE (". BoundaryName = " << BoundaryName); + SMESHHOMARD::HOMARD_Boundary_var myBoundary = _mesBoundarys[BoundaryName]; const std::string theXaoFileName = myBoundary->GetDataFile(); - MESSAGE ( ". theXaoFileName = " << theXaoFileName ); + MESSAGE (". theXaoFileName = " << theXaoFileName); // B.5. Parallélisme - bool theIsParallel = false; + //bool theIsParallel = false; // C. Lancement des projections - MESSAGE ( ". 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); + MESSAGE (". Transfert des coordonnées"); + codret = ComputeCAObis(myIteration); 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(SMESHHOMARD::HOMARD_Iteration_var myIteration, CORBA::Long Option1, CORBA::Long Option2) +CORBA::Long HOMARD_Gen_i::ComputeCAObis(SMESHHOMARD::HOMARD_Iteration_var myIteration) { - MESSAGE ( "ComputeCAObis, avec Option1 = " << Option1 << ", Option2 = " << Option2 ); + MESSAGE ("ComputeCAObis"); // A. Prealable int codret = 0; @@ -3445,10 +2065,9 @@ CORBA::Long HOMARD_Gen_i::ComputeCAObis(SMESHHOMARD::HOMARD_Iteration_var myIter // A.1. Controle de la possibilite d'agir // A.1.1. Etat de l'iteration int etat = myIteration->GetState(); - MESSAGE ( "etat = "<TexteInit(DirCompute, LogFile, _Langue); + myDriver->TexteInit(DirCompute, LogFile, "English"); // E.2. Le maillage associe a l'iteration const char* NomMesh = myIteration->GetMeshName(); - MESSAGE ( ". NomMesh = " << NomMesh ); + MESSAGE (". NomMesh = " << NomMesh); const char* MeshFile = myIteration->GetMeshFile(); - MESSAGE ( ". MeshFile = " << MeshFile ); + MESSAGE (". MeshFile = " << MeshFile); // E.3. Les données du traitement HOMARD - int iaux; - myDriver->TexteMajCoords( NumeIter ); - iaux = 0; - myDriver->TexteMaillageHOMARD( DirCompute, siterp1, iaux ); + myDriver->TexteMajCoords(NumeIter); + int 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(); } + MESSAGE (". Ecriture du texte dans le fichier de configuration; codret = "<CreeFichier(); -// F. Execution -// + // F. Execution + // int codretexec = 1789; - if (codret == 0) - { - codretexec = myDriver->ExecuteHomard(Option1); - MESSAGE ( "Erreur en executant HOMARD : " << codretexec ); + if (codret == 0) { + codretexec = myDriver->ExecuteHomard(); + MESSAGE ("Erreur en executant HOMARD : " << codretexec); } // G. Gestion des resultats - if (codret == 0) - { + if (codret == 0) { // G.1. Le fichier des messages, dans tous les cas - const char* NomIteration = myIteration->GetName(); std::string Commentaire = "logmaj_coords"; // G.2 Message d'erreur - if (codretexec != 0) - { + if (codretexec != 0) { std::string text = "\n\nSee the file " + LogFile + "\n"; - INFOS ( text ); + INFOS (text); SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; es.text = CORBA::string_dup(text.c_str()); @@ -3547,34 +2158,31 @@ CORBA::Long HOMARD_Gen_i::ComputeCAObis(SMESHHOMARD::HOMARD_Iteration_var myIter // 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 ) +char* HOMARD_Gen_i::CreateDirNameIter(const char* nomrep, CORBA::Long num) { - MESSAGE ( "CreateDirNameIter : nomrep ="<< nomrep << ", num = "<d_name); #else @@ -3601,14 +2209,14 @@ char* HOMARD_Gen_i::CreateDirNameIter(const char* nomrep, CORBA::Long num ) if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories std::string file_name(ffd.cFileName); #endif - if ( file_name == DirNameA.str() ) { existe = true; } + if (file_name == DirNameA.str()) { existe = true; } } #ifndef WIN32 closedir(dp); #else FindClose(hFind); #endif - if ( !existe ) + if (!existe) { DirName = DirNameA.str(); a_chercher = false; @@ -3618,24 +2226,28 @@ char* HOMARD_Gen_i::CreateDirNameIter(const char* nomrep, CORBA::Long num ) num += 1; } - MESSAGE ( "==> DirName = " << DirName); - MESSAGE ( ". On retourne dans nomDirActuel = " << nomDirActuel ); + MESSAGE ("==> DirName = " << DirName); + MESSAGE (". On retourne dans nomDirActuel = " << nomDirActuel); CHDIR(nomDirActuel.c_str()); - return CORBA::string_dup( DirName.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(SMESHHOMARD::HOMARD_Cas_var myCase, SMESHHOMARD::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage) +char* HOMARD_Gen_i::ComputeDirManagement(SMESHHOMARD::HOMARD_Cas_var myCase, + SMESHHOMARD::HOMARD_Iteration_var myIteration) { - MESSAGE ( "ComputeDirManagement : répertoires pour le calcul" ); + MESSAGE ("ComputeDirManagement : répertoires pour le calcul"); + + //Si le sous-répertoire existe : + // CleanOption = 0 : on sort en erreur si le répertoire n'est pas vide + // CleanOption = 1 : on fait le menage du répertoire + // CleanOption = -1 : on ne fait rien + int CleanOption = 0; + // B.2. Le répertoire du cas const char* nomDirCase = myCase->GetDirName(); - MESSAGE ( ". nomDirCase = " << nomDirCase ); + 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 @@ -3644,7 +2256,7 @@ char* HOMARD_Gen_i::ComputeDirManagement(SMESHHOMARD::HOMARD_Cas_var myCase, SME // B.3.2. Le nom complet du sous-répertoire std::stringstream DirCompute; DirCompute << nomDirCase << "/" << nomDirIt; - MESSAGE (". DirCompute = " << DirCompute.str() ); + 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) @@ -3662,10 +2274,9 @@ char* HOMARD_Gen_i::ComputeDirManagement(SMESHHOMARD::HOMARD_Cas_var myCase, SME } else { -// Le répertoire existe -// On demande de faire le menage de son contenu : - if (etatMenage == 1) - { + // Le répertoire existe + // On demande de faire le menage de son contenu : + if (CleanOption == 1) { MESSAGE (". Menage du répertoire DirCompute = " << DirCompute.str()); std::string commande = "rm -rf " + DirCompute.str()+"/*"; int codret = system(commande.c_str()); @@ -3676,17 +2287,15 @@ char* HOMARD_Gen_i::ComputeDirManagement(SMESHHOMARD::HOMARD_Cas_var myCase, SME 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) - { + // On n'a pas demande de faire le menage de son contenu : on sort en erreur : + else { + if (CleanOption == 0) { #ifndef WIN32 DIR *dp; struct dirent *dirp; dp = opendir(DirCompute.str().c_str()); bool result = true; - while ((dirp = readdir(dp)) != NULL && result ) + 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 @@ -3706,7 +2315,7 @@ char* HOMARD_Gen_i::ComputeDirManagement(SMESHHOMARD::HOMARD_Cas_var myCase, SME } FindClose(hFind); #endif - if ( result == false) + if (result == false) { SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; @@ -3719,79 +2328,30 @@ char* HOMARD_Gen_i::ComputeDirManagement(SMESHHOMARD::HOMARD_Cas_var myCase, SME } } - return CORBA::string_dup( DirCompute.str().c_str() ); + 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(SMESHHOMARD::HOMARD_Cas_var myCase, SMESHHOMARD::HOMARD_Iteration_var myIteration) { - MESSAGE ( "ComputeDirPaManagement : répertoires pour le calcul" ); + MESSAGE ("ComputeDirPaManagement : répertoires pour le calcul"); // Le répertoire du cas const char* nomDirCase = myCase->GetDirName(); - MESSAGE ( ". nomDirCase = " << nomDirCase ); + MESSAGE (". nomDirCase = " << nomDirCase); // Le sous-répertoire de l'iteration precedente - const char* nomIterationParent = myIteration->GetIterParentName(); - SMESHHOMARD::HOMARD_Iteration_var myIterationParent = myStudyContext._mesIterations[nomIterationParent]; + SMESHHOMARD::HOMARD_Iteration_var myIterationParent = myIteration0; const char* nomDirItPa = myIterationParent->GetDirNameLoc(); std::stringstream DirComputePa; DirComputePa << nomDirCase << "/" << nomDirItPa; - MESSAGE( ". nomDirItPa = " << nomDirItPa); - MESSAGE( ". DirComputePa = " << DirComputePa.str() ); + MESSAGE(". nomDirItPa = " << nomDirItPa); + MESSAGE(". DirComputePa = " << DirComputePa.str()); - return CORBA::string_dup( DirComputePa.str().c_str() ); -} -//============================================================================= -// Calcul d'une iteration : ecriture des champs dans le fichier de configuration -//============================================================================= -void HOMARD_Gen_i::DriverTexteField(SMESHHOMARD::HOMARD_Iteration_var myIteration, SMESHHOMARD::HOMARD_Hypothesis_var myHypo, SMESHHOMARDImpl::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 - SMESHHOMARD::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 - SMESHHOMARD::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 CORBA::string_dup(DirComputePa.str().c_str()); } + //============================================================================= // Calcul d'une iteration : ecriture des frontieres dans le fichier de configuration // On ecrit dans l'ordre : @@ -3801,54 +2361,54 @@ void HOMARD_Gen_i::DriverTexteField(SMESHHOMARD::HOMARD_Iteration_var myIteratio //============================================================================= int HOMARD_Gen_i::DriverTexteBoundary(SMESHHOMARD::HOMARD_Cas_var myCase, SMESHHOMARDImpl::HomardDriver* myDriver) { - MESSAGE ( "... DriverTexteBoundary" ); + MESSAGE ("... DriverTexteBoundary"); // 1. Recuperation des frontieres std::list ListeBoundaryTraitees; SMESHHOMARD::ListBoundaryGroupType* ListBoundaryGroupType = myCase->GetBoundaryGroup(); int numberOfitems = ListBoundaryGroupType->length(); - MESSAGE ( "... number of string for Boundary+Group = " << numberOfitems); + 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); + 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; } + MESSAGE ("..... BoundaryNameTraitee = " << *it); + if (BoundaryName == *it) { A_faire = 0; } it++; } // 2.2. Ecriture de la frontiere - if ( A_faire == 1 ) + if (A_faire == 1) { // 2.2.1. Caracteristiques de la frontiere - SMESHHOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; + SMESHHOMARD::HOMARD_Boundary_var myBoundary = _mesBoundarys[BoundaryName]; ASSERT(!CORBA::is_nil(myBoundary)); int BoundaryType = myBoundary->GetType(); - MESSAGE ( "... BoundaryType = " << BoundaryType ); + 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; } +// 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 ); + MESSAGE (". MeshName = " << MeshName); const char* MeshFile = myBoundary->GetDataFile(); - MESSAGE ( ". MeshFile = " << MeshFile ); - myDriver->TexteBoundaryDi( MeshName, MeshFile); - if ( BoundaryOption % 2 != 0 ) { BoundaryOption = BoundaryOption*2; } + MESSAGE (". MeshFile = " << MeshFile); + myDriver->TexteBoundaryDi(MeshName, MeshFile); + if (BoundaryOption % 2 != 0) { BoundaryOption = BoundaryOption*2; } } // 2.2.2.3. Cas d une frontiere analytique else @@ -3858,31 +2418,31 @@ int HOMARD_Gen_i::DriverTexteBoundary(SMESHHOMARD::HOMARD_Cas_var myCase, SMESHH 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; } + 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; } + 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; } + 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; } + 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; } + if (BoundaryOption % 3 != 0) { BoundaryOption = BoundaryOption*3; } } } // 2.2.3. Memorisation du traitement - ListeBoundaryTraitees.push_back( BoundaryName ); + ListeBoundaryTraitees.push_back(BoundaryName); } } // 3. Parcours des frontieres pour ecrire les liens avec les groupes @@ -3890,29 +2450,29 @@ int HOMARD_Gen_i::DriverTexteBoundary(SMESHHOMARD::HOMARD_Cas_var myCase, SMESHH for (int NumBoundary = 0; NumBoundary< numberOfitems; NumBoundary=NumBoundary+2) { std::string BoundaryName = std::string((*ListBoundaryGroupType)[NumBoundary]); - MESSAGE ( "... BoundaryName = " << BoundaryName); - SMESHHOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; + MESSAGE ("... BoundaryName = " << BoundaryName); + SMESHHOMARD::HOMARD_Boundary_var myBoundary = _mesBoundarys[BoundaryName]; ASSERT(!CORBA::is_nil(myBoundary)); int BoundaryType = myBoundary->GetType(); - MESSAGE ( "... BoundaryType = " << BoundaryType ); + MESSAGE ("... BoundaryType = " << BoundaryType); // 3.1. Recuperation du nom du groupe std::string GroupName = std::string((*ListBoundaryGroupType)[NumBoundary+1]); - MESSAGE ( "... GroupName = " << GroupName); + MESSAGE ("... GroupName = " << GroupName); // 3.2. Cas d une frontiere CAO - if ( BoundaryType == -1 ) + if (BoundaryType == -1) { - if ( GroupName.size() > 0 ) { myDriver->TexteBoundaryCAOGr ( GroupName ); } + if (GroupName.size() > 0) { myDriver->TexteBoundaryCAOGr (GroupName); } } // 3.3. Cas d une frontiere discrete - else if ( BoundaryType == 0 ) + else if (BoundaryType == 0) { - if ( GroupName.size() > 0 ) { myDriver->TexteBoundaryDiGr ( GroupName ); } + if (GroupName.size() > 0) { myDriver->TexteBoundaryDiGr (GroupName); } } // 3.4. Cas d une frontiere analytique else { NumBoundaryAnalytical++; - myDriver->TexteBoundaryAnGr ( BoundaryName, NumBoundaryAnalytical, GroupName ); + myDriver->TexteBoundaryAnGr (BoundaryName, NumBoundaryAnalytical, GroupName); } } // 4. Ecriture de l'option finale @@ -3920,102 +2480,20 @@ int HOMARD_Gen_i::DriverTexteBoundary(SMESHHOMARD::HOMARD_Cas_var myCase, SMESHH // return BoundaryOption; } -//============================================================================= -// Calcul d'une iteration : ecriture des interpolations dans le fichier de configuration -//============================================================================= -void HOMARD_Gen_i::DriverTexteFieldInterp(SMESHHOMARD::HOMARD_Iteration_var myIteration, SMESHHOMARD::HOMARD_Hypothesis_var myHypo, SMESHHOMARDImpl::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 - SMESHHOMARD::listeFieldInterpTSRsIter* ListFieldTSR = myIteration->GetFieldInterpsTimeStepRank(); - int numberOfFieldsx3 = ListFieldTSR->length(); - MESSAGE( ". pour iteration, numberOfFields = " << numberOfFieldsx3/3 ); - // Les champs pour l'hypothese - SMESHHOMARD::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++; - } - } - } -} //=========================================================================== //=========================================================================== - -//=========================================================================== //=========================================================================== // Publications +// Option = 0 : fichier issu d'une importation +// Option = 1 : fichier issu d'une execution HOMARD //=========================================================================== -//===================================================================================== 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); + // Prevent dump of CreateMeshesFromMED + SMESH::TPythonDump pDump; // do not delete this line of code + + MESSAGE("PublishResultInSmesh " << NomFich << ", avec Option = " << Option); if (CORBA::is_nil(SMESH_Gen_i::GetSMESHGen()->getStudyServant())) { SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; @@ -4039,9 +2517,9 @@ void HOMARD_Gen_i::PublishResultInSmesh(const char* NomFich, CORBA::Long Option) 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." ); + MESSAGE ("PublishResultInSmesh : le fichier " << NomFich << " est deja publie."); // Pour un fichier importe, on ne republie pas - if ( Option == 0 ) { return; } + if (Option == 0) { return; } // Pour un fichier calcule, on commence par faire la depublication else { MESSAGE("PublishResultInSmesh : depublication"); @@ -4059,7 +2537,7 @@ void HOMARD_Gen_i::PublishResultInSmesh(const char* NomFich, CORBA::Long Option) } // On enregistre le fichier - MESSAGE( "Enregistrement du fichier"); + MESSAGE("Enregistrement du fichier"); // //SMESH::SMESH_Gen_var aSmeshEngine = this->retrieveSMESHInst(); SMESH_Gen_i* aSmeshEngine = SMESH_Gen_i::GetSMESHGen(); @@ -4070,7 +2548,7 @@ void HOMARD_Gen_i::PublishResultInSmesh(const char* NomFich, CORBA::Long Option) // 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++) { + for (int i = 0; i < (int)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 @@ -4084,18 +2562,19 @@ void HOMARD_Gen_i::PublishResultInSmesh(const char* NomFich, CORBA::Long Option) SALOMEDS::AttributeExternalFileDef::_narrow(aGAttr); anAttr->SetValue(NomFich); SALOMEDS::GenericAttribute_var aPixMap = - aStudyBuilder->FindOrCreateAttribute(aSO, "AttributePixMap" ); + aStudyBuilder->FindOrCreateAttribute(aSO, "AttributePixMap"); SALOMEDS::AttributePixMap_var anAttr2 = SALOMEDS::AttributePixMap::_narrow(aPixMap); const char* icone; - if ( Option == 0 ) { icone = "mesh_tree_importedmesh.png"; } + if (Option == 0) { icone = "mesh_tree_importedmesh.png"; } else { icone = "mesh_tree_mesh.png"; } - anAttr2->SetPixMap( icone ); + anAttr2->SetPixMap(icone); } } + //============================================================================= void HOMARD_Gen_i::DeleteResultInSmesh(std::string NomFich, std::string MeshName) { - MESSAGE ("DeleteResultInSmesh pour le maillage " << MeshName << " dans le fichier " << NomFich ); + MESSAGE ("DeleteResultInSmesh pour le maillage " << MeshName << " dans le fichier " << NomFich); if (CORBA::is_nil(SMESH_Gen_i::GetSMESHGen()->getStudyServant())) { SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; @@ -4125,402 +2604,116 @@ void HOMARD_Gen_i::DeleteResultInSmesh(std::string NomFich, std::string MeshName 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 ); + myBuilder->RemoveObjectWithChildren(aSO); } } } } } } -//============================================================================= -void HOMARD_Gen_i::PublishMeshIterInSmesh(const char* NomIter) -{ - MESSAGE( "PublishMeshIterInSmesh " << NomIter); - SMESHHOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[NomIter]; - SALOMEDS::SObject_var aIterSO = SALOMEDS::SObject::_narrow - (SMESH_Gen_i::GetSMESHGen()->getStudyServant()->FindObjectIOR - (SMESH_Gen_i::GetORB()->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); - } - 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::PythonDump() +{ + MESSAGE ("Begin PythonDump"); + SMESH::TPythonDump pd; -} + // SMESH_Homard + pd << "import SMESHHOMARD\n"; + pd << "smeshhomard = " << SMESH_Gen_i::GetSMESHGen() << ".CreateHOMARD_ADAPT()\n"; -/* -Engines::TMPFile* HOMARD_Gen_i::DumpPython(CORBA::Boolean isPublished, - CORBA::Boolean isMultiFile, - CORBA::Boolean& isValidScript) -{ - MESSAGE ("Entree dans DumpPython"); - isValidScript=1; - std::string aScript = "\"\"\"\n"; - - SALOMEDS::SObject_var aSO = myStudy->FindComponent("HOMARD"); - if(CORBA::is_nil(aSO)) - return new Engines::TMPFile(0); - - 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) - { + // Boundaries + if (_mesBoundarys.size() > 0) MESSAGE(". Creation of the boundaries"); + std::map::const_iterator it_boundary; + for (it_boundary = _mesBoundarys.begin(); + it_boundary != _mesBoundarys.end(); ++it_boundary) { SMESHHOMARD::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._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++) - { - SMESHHOMARD::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("\", \""); - - SMESHHOMARD::HOMARD_Cas_var myCase = (*it_cas).second; - CORBA::String_var cIter0= myCase->GetIter0Name(); - std::string iter0 = cIter0.in(); - - SMESHHOMARD::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) - { - SMESHHOMARD::HOMARD_Iteration_var aIter = (*it_iter).second; - CORBA::String_var dumpCorbaIter = aIter->GetDumpPython(); - std::string dumpIter = dumpCorbaIter.in(); - MESSAGE (dumpIter<<"\n"); - aScript += dumpIter; - } - - MESSAGE (". Ecritures finales"); - if( isMultiFile ) - aScript += "\n\tpass"; - aScript += "\n"; - - if( !isMultiFile ) // remove unnecessary tabulation - aScript = RemoveTabulation( aScript ); - - const size_t aLen = strlen(aScript.c_str()); - char* aBuffer = new char[aLen+1]; - strcpy(aBuffer, aScript.c_str()); - - CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer; - Engines::TMPFile_var aStreamFile = new Engines::TMPFile(aLen+1, aLen+1, anOctetBuf, 1); - - MESSAGE ("Sortie de DumpPython"); - return aStreamFile._retn(); -} -*/ - -//============================================================================= -//============================================================================= -// Utilitaires -//============================================================================= -//============================================================================= -char* HOMARD_Gen_i::VerifieDir(const char* nomDir) -{ - MESSAGE("HOMARD_Gen_i::VerifieDir"); - std::string casename = std::string(""); - std::map::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; - } + pd << maBoundary->GetDumpPython(); } - return CORBA::string_dup( casename.c_str() ); -} -//=============================================================================== -// 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 '"<GetMeshName(); + pd << "\", \"" << myIteration0->GetMeshFile(); + pd << "\", \"" << myCase->GetDirName() << "\")\n"; } - return chaine; -// -} -//============================================================================= -//============================================================================= -// Gestion des preferences -//============================================================================= -//============================================================================= -// Decodage du fichier d'arcihvage des preferences -// -void HOMARD_Gen_i::SetPreferences( ) -{ - MESSAGE ( "SetPreferences" ); - - std::string ligne, mot_cle, salome_version; - bool ok = true; - - // A. Les valeurs par defaut; elles doivent etre coherentes - std::string LanguageShort = "en"; - int PublisMeshIN = 0; - int PublisMeshOUT = 0; - - // B. La version de salome - // Cela se presente sous la forme : - // [SALOME KERNEL] : 7.3.0 - std::string File; - File = getenv("KERNEL_ROOT_DIR"); - File += "/bin/salome/VERSION"; - MESSAGE ( "File = "<> mot_cle; - if ( mot_cle == "[SALOME" ) - { - salome_version = GetStringInTexte ( ligne, " ", 3 ); -// MESSAGE ( "salome_version = "<GetMeshName(); + pd << "\", " << _SmeshMesh; + pd << ", \"" << myCase->GetDirName() << "\")\n"; } - else { ok = false; } - // B. Decodage du fichier de preferences - if ( ok ) - { - std::string PrefFile; - PrefFile = Kernel_Utils::HomePath(); - PrefFile += "/.config/salome/SalomeApprc." + salome_version; - MESSAGE ( "PrefFile = "<GetDumpPython(); - std::ifstream fichier( PrefFile.c_str() ); - if ( fichier ) // ce test échoue si le fichier n'est pas ouvert - { - bool section_langue = false; - bool section_homard = false; - while ( std::getline( fichier, ligne ) ) - { - std::string chaine; - // 1. Pour la ligne courante, on identifie le premier mot : le mot-cle eventuel - std::istringstream ligne_bis(ligne); // variable contenant chaque ligne sous forme de flux - ligne_bis >> mot_cle; - - // 2. Les sections - // 2.1. Debut d'une section - // MESSAGE(mot_cle); - if ( mot_cle == "> 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; } - } - } - } - } - } + // Preferences + pd << "smeshhomard.SetKeepMedOUT(" << _KeepMedOUT << ")\n"; + pd << "smeshhomard.SetPublishMeshOUT(" << _PublishMeshOUT << ")\n"; + pd << "smeshhomard.SetMeshNameOUT(\"" << _MeshNameOUT << "\")\n"; + pd << "smeshhomard.SetMeshFileOUT(\"" << _MeshFileOUT << "\")\n"; - // C. Enregistrements - MESSAGE ("Enregistrement de LanguageShort = " << LanguageShort ); - SetLanguageShort( LanguageShort.c_str() ); + pd << "smeshhomard.SetKeepWorkingFiles(" << _KeepWorkingFiles << ")\n"; + pd << "smeshhomard.SetLogInFile(" << _LogInFile << ")\n"; + if (_LogInFile) pd << "smeshhomard.SetLogFile(\"" << _LogFile << "\")\n"; + pd << "smeshhomard.SetRemoveLogOnSuccess(" << _RemoveLogOnSuccess << ")\n"; + pd << "smeshhomard.SetVerboseLevel(" << _VerboseLevel << ")\n"; - MESSAGE ("Enregistrement de PublisMeshIN = " << PublisMeshIN<<", PublisMeshOUT = "<< PublisMeshOUT); - SetPublisMesh(PublisMeshIN, PublisMeshOUT); + // Compute + pd << "smeshhomard.Compute()\n"; + MESSAGE ("End PythonDump"); } + //=============================================================================== -// Langue de SALOME +// Preferences //=============================================================================== -void HOMARD_Gen_i::SetLanguageShort(const char* LanguageShort) +void HOMARD_Gen_i::SetKeepMedOUT(bool theKeepMedOUT) { - //MESSAGE ("SetLanguageShort pour LanguageShort = " << LanguageShort ); - _LangueShort = LanguageShort; - if ( _LangueShort == "fr" ) { _Langue = "Francais"; } - else { _Langue = "English"; } + _KeepMedOUT = theKeepMedOUT; } -char* HOMARD_Gen_i::GetLanguageShort() +void HOMARD_Gen_i::SetPublishMeshOUT(bool thePublishMeshOUT) { - //MESSAGE ("GetLanguageShort"); - return CORBA::string_dup( _LangueShort.c_str() ); + _PublishMeshOUT = thePublishMeshOUT; } -//=============================================================================== -// Options de publications -//=============================================================================== -void HOMARD_Gen_i::SetPublisMesh(CORBA::Long PublisMeshIN, CORBA::Long PublisMeshOUT) +void HOMARD_Gen_i::SetKeepWorkingFiles(bool theKeepWorkingFiles) { - _PublisMeshIN = PublisMeshIN; - _PublisMeshOUT = PublisMeshOUT; + _KeepWorkingFiles = theKeepWorkingFiles; } -CORBA::Long HOMARD_Gen_i::GetPublisMeshIN() +void HOMARD_Gen_i::SetLogInFile(bool theLogInFile) { - return _PublisMeshIN; + _LogInFile = theLogInFile; } -CORBA::Long HOMARD_Gen_i::GetPublisMeshOUT() +void HOMARD_Gen_i::SetRemoveLogOnSuccess(bool theRemoveLogOnSuccess) { - return _PublisMeshOUT; + _RemoveLogOnSuccess = theRemoveLogOnSuccess; } - -// ======================================================================= -int MEDFileExist( const char * aFile ) -// Retourne 1 si le fichier existe, 0 sinon -// ======================================================================= +void HOMARD_Gen_i::SetVerboseLevel(CORBA::Long theVerboseLevel) +{ + _VerboseLevel = theVerboseLevel; +} +void HOMARD_Gen_i::SetMeshNameOUT(const char* theMeshNameOUT) +{ + _MeshNameOUT = theMeshNameOUT; +} +void HOMARD_Gen_i::SetMeshFileOUT(const char* theMeshFileOUT) +{ + _MeshFileOUT = theMeshFileOUT; +} +void HOMARD_Gen_i::SetLogFile(const char* theLogFile) { - int existe; - med_idt medIdt = MEDfileOpen(aFile,MED_ACC_RDONLY); - if ( medIdt < 0 ) { existe = 0; } - else { MEDfileClose(medIdt); - existe = 1; } - return existe; + _LogFile = theLogFile; } + // ======================================================================= std::set GetListeGroupesInMedFile(const char * aFile) -// ======================================================================= { std::set ListeGroupes; med_err erreur = 0; med_idt medIdt; - while ( erreur == 0 ) - { + while (erreur == 0) { // Ouverture du fichier medIdt = MEDfileOpen(aFile,MED_ACC_RDONLY); - if ( medIdt < 0 ) - { + if (medIdt < 0) { erreur = 1; break; } @@ -4551,28 +2744,24 @@ std::set GetListeGroupesInMedFile(const char * aFile) axisunit); delete[] axisname; delete[] axisunit; - if ( erreur < 0 ) { break; } + if (erreur < 0) { break; } // Nombre de familles med_int nfam; nfam = MEDnFamily(medIdt,meshname); - if ( nfam < 0 ) - { + if (nfam < 0) { erreur = 2; break; } - // Lecture des caracteristiques des familles - for (int i=0;i 0 ) - { + // Lecture de la famille + else if (ngro > 0) { char familyname[MED_NAME_SIZE+1]; med_int numfam; char* gro = (char*) malloc(MED_LNAME_SIZE*ngro+1); @@ -4582,16 +2771,13 @@ std::set GetListeGroupesInMedFile(const char * aFile) familyname, &numfam, gro); - if ( erreur < 0 ) - { + if (erreur < 0) { free(gro); break; } // Lecture des groupes pour une famille de mailles - if ( numfam < 0) - { - for (int j=0;j GetListeGroupesInMedFile(const char * aFile) break; } // Fermeture du fichier - if ( medIdt > 0 ) MEDfileClose(medIdt); + if (medIdt > 0) MEDfileClose(medIdt); return ListeGroupes; } // ======================================================================= -std::vector GetBoundingBoxInMedFile(const char * aFile) -// ======================================================================= -{ // Le vecteur en retour contiendra les informations suivantes : // en position 0 et 1 Xmin, Xmax et en position 2 Dx si < 0 2D // en position 3 et 4 Ymin, Ymax et en position 5 Dy si < 0 2D // en position 6 et 7 Zmin, Zmax et en position 8 Dz si < 0 2D // 9 distance max dans le maillage - +// ======================================================================= +std::vector GetBoundingBoxInMedFile(const char * aFile) +{ std::vector LesExtremes; med_err erreur = 0; med_idt medIdt; - while ( erreur == 0 ) - { + while (erreur == 0) { // Ouverture du fichier medIdt = MEDfileOpen(aFile,MED_ACC_RDONLY); - if ( medIdt < 0 ) - { + if (medIdt < 0) { erreur = 1; break; } //Nombre de maillage : on ne peut en lire qu'un seul med_int numberOfMeshes = MEDnMesh(medIdt); - if (numberOfMeshes != 1 ) - { + if (numberOfMeshes != 1) { erreur = 2; break; } @@ -4665,7 +2847,7 @@ std::vector GetBoundingBoxInMedFile(const char * aFile) axisunit); delete[] axisname; delete[] axisunit; - if ( erreur < 0 ) { break; } + if (erreur < 0) { break; } // Nombre de noeuds med_bool chgt,trsf; @@ -4679,14 +2861,13 @@ std::vector GetBoundingBoxInMedFile(const char * aFile) MED_NO_CMODE, &chgt, &trsf); - if ( nnoe < 0 ) - { + if (nnoe < 0) { erreur = 4; break; } // Les coordonnees - med_float* coo = (med_float*) malloc(sizeof(med_float)*nnoe*spacedim); + med_float* coo = (med_float*) malloc(sizeof(med_float)*nnoe*spacedim); erreur = MEDmeshNodeCoordinateRd(medIdt, meshname, @@ -4694,8 +2875,7 @@ std::vector GetBoundingBoxInMedFile(const char * aFile) MED_NO_IT, MED_NO_INTERLACE, coo); - if ( erreur < 0 ) - { + if (erreur < 0) { free(coo); break; } @@ -4703,51 +2883,46 @@ std::vector GetBoundingBoxInMedFile(const char * aFile) // Calcul des extremes med_float xmin,xmax,ymin,ymax,zmin,zmax; - xmin=coo[0]; - xmax=coo[0]; - for (int i=1;i 1) - { - ymin=coo[nnoe]; ymax=coo[nnoe]; - for (int i=nnoe+1;i<2*nnoe;i++) - { - ymin = std::min(ymin,coo[i]); - ymax = std::max(ymax,coo[i]); - } + // + if (spacedim > 1) { + ymin = coo[nnoe]; + ymax = coo[nnoe]; + for (int i = nnoe + 1; i < 2*nnoe; i++) { + ymin = std::min(ymin,coo[i]); + ymax = std::max(ymax,coo[i]); + } } - else - { - ymin=0; - ymax=0; - zmin=0; - zmax=0; + else { + ymin = 0; + ymax = 0; + zmin = 0; + zmax = 0; } -// - if (spacedim > 2) - { - zmin=coo[2*nnoe]; zmax=coo[2*nnoe]; - for (int i=2*nnoe+1;i<3*nnoe;i++) - { - zmin = std::min(zmin,coo[i]); - zmax = std::max(zmax,coo[i]); - } + // + if (spacedim > 2) { + zmin = coo[2*nnoe]; + zmax = coo[2*nnoe]; + for (int i = 2*nnoe + 1; i < 3*nnoe; i++) { + zmin = std::min(zmin,coo[i]); + zmax = std::max(zmax,coo[i]); + } } - else - { - zmin=0; - zmax=0; + else { + zmin = 0; + zmax = 0; } - MESSAGE( "_______________________________________"); - MESSAGE( "xmin : " << xmin << " xmax : " << xmax ); - MESSAGE( "ymin : " << ymin << " ymax : " << ymax ); - MESSAGE( "zmin : " << zmin << " zmax : " << zmax ); - MESSAGE( "_______________________________________" ); + MESSAGE("_______________________________________"); + MESSAGE("xmin : " << xmin << " xmax : " << xmax); + MESSAGE("ymin : " << ymin << " ymax : " << ymax); + MESSAGE("zmin : " << zmin << " zmax : " << zmax); + MESSAGE("_______________________________________"); double epsilon = 1.e-6; LesExtremes.push_back(xmin); LesExtremes.push_back(xmax); @@ -4759,46 +2934,45 @@ std::vector GetBoundingBoxInMedFile(const char * aFile) LesExtremes.push_back(zmax); LesExtremes.push_back(0); - - double max1=std::max ( LesExtremes[1] - LesExtremes[0] , LesExtremes[4] - LesExtremes[3] ); - double max2=std::max ( max1 , LesExtremes[7] - LesExtremes[6] ); - LesExtremes.push_back(max2); - -// LesExtremes[0] = Xmini du maillage -// LesExtremes[1] = Xmaxi du maillage -// LesExtremes[2] = increment de progression en X -// LesExtremes[3,4,5] : idem pour Y -// LesExtremes[6,7,8] : idem pour Z -// LesExtremes[9] = ecart maximal entre coordonnees -// On fait un traitement pour dans le cas d'une coordonnee constante -// inhiber ce cas en mettant un increment negatif -// + double max1 = std::max (LesExtremes[1] - LesExtremes[0], LesExtremes[4] - LesExtremes[3]); + double max2 = std::max (max1 , LesExtremes[7] - LesExtremes[6]); + LesExtremes.push_back(max2); + + // LesExtremes[0] = Xmini du maillage + // LesExtremes[1] = Xmaxi du maillage + // LesExtremes[2] = increment de progression en X + // LesExtremes[3,4,5] : idem pour Y + // LesExtremes[6,7,8] : idem pour Z + // LesExtremes[9] = ecart maximal entre coordonnees + // On fait un traitement pour dans le cas d'une coordonnee constante + // inhiber ce cas en mettant un increment negatif + // double diff = LesExtremes[1] - LesExtremes[0]; - if ( fabs(diff) > epsilon*max2 ) { LesExtremes[2] = diff/100.; } - else { LesExtremes[2] = -1.; } + if (fabs(diff) > epsilon*max2) { LesExtremes[2] = diff/100.; } + else { LesExtremes[2] = -1.; } diff = LesExtremes[4] - LesExtremes[3]; - if ( fabs(diff) > epsilon*max2 ) { LesExtremes[5]=diff/100.; } - else { LesExtremes[5] = -1.; } + if (fabs(diff) > epsilon*max2) { LesExtremes[5]=diff/100.; } + else { LesExtremes[5] = -1.; } diff = LesExtremes[7] - LesExtremes[6]; - if ( fabs(diff) > epsilon*max2 ) { LesExtremes[8]=diff/100.; } - else { LesExtremes[8] = -1.; } + if (fabs(diff) > epsilon*max2) { LesExtremes[8]=diff/100.; } + else { LesExtremes[8] = -1.; } - MESSAGE ( "_______________________________________" ); - MESSAGE ( "xmin : " << LesExtremes[0] << " xmax : " << LesExtremes[1] << " xincr : " << LesExtremes[2] ); - MESSAGE ( "ymin : " << LesExtremes[3] << " ymax : " << LesExtremes[4] << " yincr : " << LesExtremes[5] ); - MESSAGE ( "zmin : " << LesExtremes[6] << " zmax : " << LesExtremes[7] << " zincr : " << LesExtremes[8] ); - MESSAGE ( "dmax : " << LesExtremes[9] ); - MESSAGE ( "_______________________________________" ); + MESSAGE ("_______________________________________"); + MESSAGE ("xmin : " << LesExtremes[0] << " xmax : " << LesExtremes[1] << " xincr : " << LesExtremes[2]); + MESSAGE ("ymin : " << LesExtremes[3] << " ymax : " << LesExtremes[4] << " yincr : " << LesExtremes[5]); + MESSAGE ("zmin : " << LesExtremes[6] << " zmax : " << LesExtremes[7] << " zincr : " << LesExtremes[8]); + MESSAGE ("dmax : " << LesExtremes[9]); + MESSAGE ("_______________________________________"); free(coo); break; } // Fermeture du fichier - if ( medIdt > 0 ) MEDfileClose(medIdt); + if (medIdt > 0) MEDfileClose(medIdt); - return LesExtremes; + return LesExtremes; } }; // namespace SMESHHOMARD_I diff --git a/src/SMESH_I/SMESH_Homard_i.hxx b/src/SMESH_I/SMESH_Homard_i.hxx index 1a45e1878..3f08b4d2f 100644 --- a/src/SMESH_I/SMESH_Homard_i.hxx +++ b/src/SMESH_I/SMESH_Homard_i.hxx @@ -17,16 +17,6 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// Remarques : -// L'ordre de description des fonctions est le meme dans tous les fichiers -// HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx : -// 1. Les generalites : Name, Delete, DumpPython, Dump, Restore -// 2. Les caracteristiques -// 3. Le lien avec les autres structures -// -// Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier -// - #ifndef _SMESH_HOMARD_I_HXX_ #define _SMESH_HOMARD_I_HXX_ @@ -36,6 +26,7 @@ #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) #include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog) #include CORBA_CLIENT_HEADER(SMESH_Gen) +#include CORBA_CLIENT_HEADER(SMESH_Mesh) #include "SMESH.hxx" #include "SMESH_Homard.hxx" @@ -49,498 +40,312 @@ #include #include -//namespace SMESHHOMARDImpl -//{ -// class HOMARD_Boundary; -// class HOMARD_Cas; -// class HOMARD_Hypothesis; -// class HOMARD_Iteration; -//}; - namespace SMESHHOMARD_I { -class SMESH_I_EXPORT HOMARD_Boundary_i: - public virtual Engines_Component_i, - public virtual POA_SMESHHOMARD::HOMARD_Boundary, - public virtual PortableServer::ServantBase +class SMESH_I_EXPORT HOMARD_Boundary_i : public virtual SALOME::GenericObj_i, + public virtual POA_SMESHHOMARD::HOMARD_Boundary { public: - HOMARD_Boundary_i( CORBA::ORB_ptr orb, SMESHHOMARD::HOMARD_Gen_var gen_i ); + HOMARD_Boundary_i(SMESHHOMARD::HOMARD_Gen_var gen_i); HOMARD_Boundary_i(); virtual ~HOMARD_Boundary_i(); // Generalites - void SetName( const char* Name ); + void SetName(const char* Name); char* GetName(); - CORBA::Long Delete(); - char* GetDumpPython(); - std::string Dump() const; - bool Restore( const std::string& stream ); - // Caracteristiques - void SetType( CORBA::Long Type ); + void SetType(CORBA::Long Type); CORBA::Long GetType(); - void SetMeshName( const char* MeshName ); + void SetMeshName(const char* MeshName); char* GetMeshName(); - void SetDataFile( const char* DataFile ); + void SetDataFile(const char* DataFile); char* GetDataFile(); - void SetCylinder( double Xcentre, double Ycentre, double ZCentre, + void SetCylinder(double Xcentre, double Ycentre, double ZCentre, double Xaxe, double Yaxe, double Zaxe, - double rayon ); - void SetSphere( double Xcentre, double Ycentre, double ZCentre, - double rayon ); - void SetConeR( double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1, + double rayon); + void SetSphere(double Xcentre, double Ycentre, double ZCentre, + double rayon); + void SetConeR(double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1, double Xcentre2, double Ycentre2, double Zcentre2, double Rayon2); - void SetConeA( double Xaxe, double Yaxe, double Zaxe, double Angle, + void SetConeA(double Xaxe, double Yaxe, double Zaxe, double Angle, double Xcentre, double Ycentre, double ZCentre); - void SetTorus( double Xcentre, double Ycentre, double ZCentre, + void SetTorus(double Xcentre, double Ycentre, double ZCentre, double Xaxe, double Yaxe, double Zaxe, - double rayonRev, double rayonPri ); + double rayonRev, double rayonPri); SMESHHOMARD::double_array* GetCoords(); - void SetLimit( double Xincr, double Yincr, double Zincr); + void SetLimit(double Xincr, double Yincr, double Zincr); SMESHHOMARD::double_array* GetLimit(); - void AddGroup( const char* Group); + void AddGroup(const char* Group); void SetGroups(const SMESHHOMARD::ListGroupType& ListGroup); SMESHHOMARD::ListGroupType* GetGroups(); -// Liens avec les autres structures - void SetCaseCreation( const char* NomCaseCreation ); - char* GetCaseCreation(); + // Liens avec les autres structures + void SetCaseCreation(const char* NomCaseCreation); + char* GetCaseCreation(); private: - SMESHHOMARDImpl::HOMARD_Boundary* myHomardBoundary; - - CORBA::ORB_ptr _orb; + SMESHHOMARDImpl::HOMARD_Boundary* myHomardBoundary; SMESHHOMARD::HOMARD_Gen_var _gen_i; }; -class SMESH_I_EXPORT HOMARD_Cas_i: - public virtual Engines_Component_i, - public virtual POA_SMESHHOMARD::HOMARD_Cas, - public virtual PortableServer::ServantBase +class SMESH_I_EXPORT HOMARD_Cas_i : public virtual SALOME::GenericObj_i, + public virtual POA_SMESHHOMARD::HOMARD_Cas { public: - HOMARD_Cas_i( CORBA::ORB_ptr orb, SMESHHOMARD::HOMARD_Gen_var gen_i ); + HOMARD_Cas_i(SMESHHOMARD::HOMARD_Gen_var gen_i); HOMARD_Cas_i(); virtual ~HOMARD_Cas_i(); - // Generalites - void SetName( const char* Name ); - char* GetName(); - - CORBA::Long Delete( CORBA::Long Option ); - - char* GetDumpPython(); - - std::string Dump() const; - bool Restore( const std::string& stream ); + char* GetName(); + char* GetDumpPython(); // Caracteristiques - void SetDirName( const char* NomDir ); - char* GetDirName(); - - CORBA::Long GetState(); - - CORBA::Long GetNumberofIter(); + void SetDirName(const char* NomDir); + char* GetDirName(); - void SetConfType( CORBA::Long ConfType ); - CORBA::Long GetConfType(); + void SetConfType(CORBA::Long ConfType); + CORBA::Long GetConfType(); - void SetExtType( CORBA::Long ExtType ); - CORBA::Long GetExtType(); + void SetBoundingBox(const SMESHHOMARD::extrema& LesExtremes); + SMESHHOMARD::extrema* GetBoundingBox(); - void SetBoundingBox( const SMESHHOMARD::extrema& LesExtremes ); - SMESHHOMARD::extrema* GetBoundingBox(); - - void AddGroup( const char* Group); - void SetGroups(const SMESHHOMARD::ListGroupType& ListGroup); + void AddGroup(const char* Group); + void SetGroups(const SMESHHOMARD::ListGroupType& ListGroup); SMESHHOMARD::ListGroupType* GetGroups(); - void AddBoundary(const char* Boundary); - void AddBoundaryGroup(const char* Boundary, const char* Group); - SMESHHOMARD::ListBoundaryGroupType* GetBoundaryGroup(); - void SupprBoundaryGroup( ); - - void SetPyram( CORBA::Long Pyram ); - CORBA::Long GetPyram(); - - void MeshInfo(CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte); + void AddBoundary(const char* Boundary); + void AddBoundaryGroup(const char* Boundary, const char* Group); + SMESHHOMARD::ListBoundaryGroupType* GetBoundaryGroup(); + void SupprBoundaryGroup(); -// Liens avec les autres structures - char* GetIter0Name(); - SMESHHOMARD::HOMARD_Iteration_ptr GetIter0(); - - SMESHHOMARD::HOMARD_Iteration_ptr NextIteration( const char* Name ); - - SMESHHOMARD::HOMARD_Iteration_ptr LastIteration(); - - void AddIteration( const char* NomIteration ); + void AddIteration(const char* NomIteration); private: - SMESHHOMARDImpl::HOMARD_Cas* myHomardCas; - - CORBA::ORB_ptr _orb; + SMESHHOMARDImpl::HOMARD_Cas* myHomardCas; SMESHHOMARD::HOMARD_Gen_var _gen_i; }; -class SMESH_I_EXPORT HOMARD_Hypothesis_i: - public virtual Engines_Component_i, - public virtual POA_SMESHHOMARD::HOMARD_Hypothesis, - public virtual PortableServer::ServantBase +class SMESH_I_EXPORT HOMARD_Hypothesis_i : public virtual SALOME::GenericObj_i, + public virtual POA_SMESHHOMARD::HOMARD_Hypothesis { public: - HOMARD_Hypothesis_i( CORBA::ORB_ptr orb, SMESHHOMARD::HOMARD_Gen_var gen_i ); + HOMARD_Hypothesis_i(SMESHHOMARD::HOMARD_Gen_var gen_i); HOMARD_Hypothesis_i(); virtual ~HOMARD_Hypothesis_i(); -// Generalites - void SetName( const char* Name ); - char* GetName(); - - CORBA::Long Delete(); - - char* GetDumpPython(); - - std::string Dump() const; - bool Restore( const std::string& stream ); - -// Caracteristiques - void SetUnifRefinUnRef( CORBA::Long TypeRaffDera ); - SMESHHOMARD::listeTypes* GetAdapRefinUnRef(); - CORBA::Long GetAdapType(); - CORBA::Long GetRefinType(); - CORBA::Long GetUnRefType(); - - void SetField( const char* FieldName ); - char* GetFieldName(); - void SetUseField(CORBA::Long UsField); - SMESHHOMARD::InfosHypo* GetField(); - - void SetUseComp(CORBA::Long UsCmpI); - void AddComp( const char* NomComp ); - void SupprComp( const char* NomComp ); - void SupprComps(); - SMESHHOMARD::listeComposantsHypo* GetComps(); - - void SetRefinThr(CORBA::Long TypeThR, CORBA::Double ThreshR); - CORBA::Long GetRefinThrType(); - void SetUnRefThr(CORBA::Long TypeThC, CORBA::Double ThreshC); - CORBA::Long GetUnRefThrType(); - - void SetNivMax( CORBA::Long NivMax ); - CORBA::Long GetNivMax(); - - void SetDiamMin( CORBA::Double DiamMin ); - CORBA::Double GetDiamMin(); - - void SetAdapInit( CORBA::Long AdapInit ); - CORBA::Long GetAdapInit(); - - void SetExtraOutput( CORBA::Long ExtraOutput ); - CORBA::Long GetExtraOutput(); - - void AddGroup( const char* Group); - void SupprGroup( const char* Group ); - void SupprGroups(); - void SetGroups(const SMESHHOMARD::ListGroupType& ListGroup); - SMESHHOMARD::ListGroupType* GetGroups(); - - void SetTypeFieldInterp( CORBA::Long TypeFieldInterp ); - CORBA::Long GetTypeFieldInterp(); - void AddFieldInterp( const char* FieldInterp ); - void AddFieldInterpType( const char* FieldInterp, CORBA::Long TypeInterp ); - void SupprFieldInterp( const char* FieldInterp ); - void SupprFieldInterps(); - SMESHHOMARD::listeFieldInterpsHypo* GetFieldInterps(); - -// Liens avec les autres structures - void SetCaseCreation( const char* NomCaseCreation ); - char* GetCaseCreation(); + // Generalites + void SetExtraOutput(CORBA::Long ExtraOutput); + CORBA::Long GetExtraOutput(); - void LinkIteration( const char* NomIteration ); - void UnLinkIteration( const char* NomIteration ); - SMESHHOMARD::listeIters* GetIterations(); + void LinkIteration(const char* NomIteration); + void UnLinkIteration(const char* NomIteration); private: SMESHHOMARDImpl::HOMARD_Hypothesis* myHomardHypothesis; - - CORBA::ORB_ptr _orb; SMESHHOMARD::HOMARD_Gen_var _gen_i; }; -class SMESH_I_EXPORT HOMARD_Iteration_i: - public virtual Engines_Component_i, - public virtual POA_SMESHHOMARD::HOMARD_Iteration, - public virtual PortableServer::ServantBase +class SMESH_I_EXPORT HOMARD_Iteration_i : public virtual SALOME::GenericObj_i, + public virtual POA_SMESHHOMARD::HOMARD_Iteration { public: - HOMARD_Iteration_i( CORBA::ORB_ptr orb, - SMESHHOMARD::HOMARD_Gen_var gen_i ); + HOMARD_Iteration_i(SMESHHOMARD::HOMARD_Gen_var gen_i); HOMARD_Iteration_i(); virtual ~HOMARD_Iteration_i(); -// Generalites - void SetName( const char* Name ); + // Generalites + void SetName(const char* Name); char* GetName(); - CORBA::Long Delete( CORBA::Long Option, bool doRemoveWorkingFiles ); - - char* GetDumpPython(); - - std::string Dump() const; - bool Restore( const std::string& stream ); - -// Caracteristiques - void SetDirNameLoc( const char* NomDir ); + // Caracteristiques + void SetDirNameLoc(const char* NomDir); char* GetDirNameLoc(); char* GetDirName(); - void SetNumber( CORBA::Long NumIter ); + void SetNumber(CORBA::Long NumIter); CORBA::Long GetNumber(); - void SetState( CORBA::Long etat ); + void SetState(CORBA::Long etat); CORBA::Long GetState(); - void SetMeshName( const char* NomMesh ); + void SetMeshName(const char* NomMesh); char* GetMeshName(); - void SetMeshFile( const char* MeshFile ); + void SetMeshFile(const char* MeshFile); char* GetMeshFile(); - void SetFieldFile( const char* FieldFile ); - char* GetFieldFile(); -// Instants pour le champ de pilotage - void SetTimeStep( CORBA::Long TimeStep ); - void SetTimeStepRank( CORBA::Long TimeStep, CORBA::Long Rank ); - void SetTimeStepRankLast(); - CORBA::Long GetTimeStep(); - CORBA::Long GetRank(); -// 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 ); - SMESHHOMARD::listeFieldInterpTSRsIter* GetFieldInterpsTimeStepRank(); - void SetFieldInterp( const char* FieldInterp ); - SMESHHOMARD::listeFieldInterpsIter* GetFieldInterps(); - void SupprFieldInterps(); - - void SetLogFile( const char* LogFile ); + void SetLogFile(const char* LogFile); char* GetLogFile(); - CORBA::Long Compute(CORBA::Long etatMenage, CORBA::Long Option); - - void MeshInfo(CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte); - - void MeshInfoOption(CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte, CORBA::Long Option); - - void SetFileInfo( const char* FileInfo ); + void SetFileInfo(const char* FileInfo); char* GetFileInfo(); // Liens avec les autres iterations - SMESHHOMARD::HOMARD_Iteration_ptr NextIteration( const char* Name); - - void LinkNextIteration( const char* NomIteration ); - void UnLinkNextIteration( const char* NomIteration ); - SMESHHOMARD::listeIterFilles* GetIterations(); + void LinkNextIteration(const char* NomIteration); + void UnLinkNextIteration(const char* NomIteration); - void SetIterParentName( const char* NomIterParent ); + void SetIterParentName(const char* NomIterParent); char* GetIterParentName(); - SMESHHOMARD::HOMARD_Iteration_ptr GetIterParent(); -// Liens avec les autres structures - void SetCaseName( const char* NomCas ); + // Liens avec les autres structures + void SetCaseName(const char* NomCas); char* GetCaseName(); - void AssociateHypo( const char* NomHypo); - void SetHypoName( const char* NomHypo ); - char* GetHypoName(); + void SetHypoName(const char* NomHypo); -// Divers - void SetInfoCompute( CORBA::Long MessInfo ); + // Drivers + void SetInfoCompute(CORBA::Long MessInfo); CORBA::Long GetInfoCompute(); private: - SMESHHOMARDImpl::HOMARD_Iteration* myHomardIteration; - - CORBA::ORB_ptr _orb; + SMESHHOMARDImpl::HOMARD_Iteration* myHomardIteration; SMESHHOMARD::HOMARD_Gen_var _gen_i; }; class SMESH_I_EXPORT HOMARD_Gen_i : public virtual SALOME::GenericObj_i, - public virtual POA_SMESHHOMARD::HOMARD_Gen + public virtual POA_SMESHHOMARD::HOMARD_Gen { public: HOMARD_Gen_i(); virtual ~HOMARD_Gen_i(); - -// Generalites - -// Les creations - SMESHHOMARD::HOMARD_Boundary_ptr CreateBoundary (const char* nomBoundary, CORBA::Long typeBoundary); - SMESHHOMARD::HOMARD_Boundary_ptr CreateBoundaryCAO(const char* nomBoundary, - const char* DataFile); - SMESHHOMARD::HOMARD_Boundary_ptr CreateBoundaryDi (const char* nomBoundary, - const char* MeshName, const char* DataFile); - SMESHHOMARD::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); - SMESHHOMARD::HOMARD_Boundary_ptr CreateBoundarySphere (const char* nomBoundary, - CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, - CORBA::Double Rayon); - SMESHHOMARD::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); - SMESHHOMARD::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); - SMESHHOMARD::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); - - SMESHHOMARD::HOMARD_Cas_ptr CreateCase (const char* nomCas, const char* MeshName, - const char* FileName); - SMESHHOMARD::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); - - SMESHHOMARD::HOMARD_Hypothesis_ptr CreateHypothesis(const char* nomHypothesis); - - SMESHHOMARD::HOMARD_Iteration_ptr CreateIteration (const char* nomIter, const char* nomIterParent); + // Les creations + SMESHHOMARD::HOMARD_Boundary_ptr CreateBoundary (const char* nomBoundary, + CORBA::Long typeBoundary); + SMESHHOMARD::HOMARD_Boundary_ptr CreateBoundaryCAO (const char* nomBoundary, + const char* DataFile); + SMESHHOMARD::HOMARD_Boundary_ptr CreateBoundaryDi (const char* nomBoundary, + const char* MeshName, const char* DataFile); + SMESHHOMARD::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); + SMESHHOMARD::HOMARD_Boundary_ptr CreateBoundarySphere + (const char* nomBoundary, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Rayon); + SMESHHOMARD::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); + SMESHHOMARD::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); + SMESHHOMARD::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); + + SMESHHOMARD::HOMARD_Cas_ptr CreateCaseOnMesh (const char* MeshName, + SMESH::SMESH_Mesh_ptr smeshMesh, + const char* theWorkingDir); + SMESHHOMARD::HOMARD_Cas_ptr CreateCase (const char* MeshName, + const char* FileName, + const char* theWorkingDir); + + SMESHHOMARD::HOMARD_Iteration_ptr CreateIteration(); // Les informations - SMESHHOMARD::HOMARD_Boundary_ptr GetBoundary (const char* nomBoundary); - SMESHHOMARD::HOMARD_Cas_ptr GetCase (const char* nomCas); - SMESHHOMARD::HOMARD_Hypothesis_ptr GetHypothesis (const char* nomHypothesis); - SMESHHOMARD::HOMARD_Iteration_ptr GetIteration (const char* nomIteration); - - SMESHHOMARD::listeBoundarys* GetAllBoundarysName(); - SMESHHOMARD::listeCases* GetAllCasesName(); - SMESHHOMARD::listeHypotheses* GetAllHypothesesName(); - SMESHHOMARD::listeIterations* GetAllIterationsName(); - - 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); - - SMESHHOMARD::HOMARD_Iteration_ptr LastIteration (const char* nomCas); - - // 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, - bool doRemoveWorkingFiles); - void InvalideIterInfo(const char* nomIter); - - 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, - bool doRemoveWorkingFiles); - CORBA::Long DeleteIterationOption(const char* nomIter, - CORBA::Long Option1, - CORBA::Long Option2, - bool doRemoveWorkingFiles); - - void AssociateIterHypo(const char* nomIter, const char* nomHypothesis); - - 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); + SMESHHOMARD::HOMARD_Boundary_ptr GetBoundary (const char* nomBoundary); + SMESHHOMARD::HOMARD_Cas_ptr GetCase (); + SMESHHOMARD::HOMARD_Iteration_ptr GetIteration (CORBA::Long numIter); + + SMESHHOMARD::listeBoundarys* GetAllBoundarysName(); + + void InvalideBoundary(const char* nomBoundary); + + CORBA::Long DeleteBoundary(const char* nomBoundary); + CORBA::Long DeleteCase(); + CORBA::Long DeleteIteration(int numIter); + + void AssociateCaseIter(int numIter, const char* labelIter); + char* CreateDirNameIter(const char* nomrep, CORBA::Long num); + + CORBA::Long Compute(); CORBA::Long ComputeAdap(SMESHHOMARD::HOMARD_Cas_var myCase, SMESHHOMARD::HOMARD_Iteration_var myIteration, - CORBA::Long etatMenage, SMESHHOMARDImpl::HomardDriver* myDriver, - CORBA::Long Option1, CORBA::Long Option2); + SMESHHOMARDImpl::HomardDriver* myDriver); CORBA::Long ComputeCAO(SMESHHOMARD::HOMARD_Cas_var myCase, - SMESHHOMARD::HOMARD_Iteration_var myIteration, - CORBA::Long Option1, CORBA::Long Option2); - CORBA::Long ComputeCAObis(SMESHHOMARD::HOMARD_Iteration_var myIteration, - CORBA::Long Option1, CORBA::Long Option2); + SMESHHOMARD::HOMARD_Iteration_var myIteration); + CORBA::Long ComputeCAObis(SMESHHOMARD::HOMARD_Iteration_var myIteration); char* ComputeDirManagement(SMESHHOMARD::HOMARD_Cas_var myCase, - SMESHHOMARD::HOMARD_Iteration_var myIteration, - CORBA::Long etatMenage); + SMESHHOMARD::HOMARD_Iteration_var myIteration); char* ComputeDirPaManagement(SMESHHOMARD::HOMARD_Cas_var myCase, SMESHHOMARD::HOMARD_Iteration_var myIteration); - void DriverTexteField(SMESHHOMARD::HOMARD_Iteration_var myIteration, - SMESHHOMARD::HOMARD_Hypothesis_var myHypo, - SMESHHOMARDImpl::HomardDriver* myDriver); int DriverTexteBoundary(SMESHHOMARD::HOMARD_Cas_var myCase, SMESHHOMARDImpl::HomardDriver* myDriver); - void DriverTexteFieldInterp(SMESHHOMARD::HOMARD_Iteration_var myIteration, - SMESHHOMARD::HOMARD_Hypothesis_var myHypo, - SMESHHOMARDImpl::HomardDriver* myDriver); - char* VerifieDir(const char* nomDir); + void PublishResultInSmesh(const char* NomFich, CORBA::Long Option); + void DeleteResultInSmesh(std::string NomFich, std::string MeshName); - void PublishResultInSmesh(const char* NomFich, CORBA::Long Option); - void DeleteResultInSmesh(std::string NomFich, std::string MeshName); - void PublishMeshIterInSmesh(const char* NomIter); + void PythonDump(); // Preferences - void SetPreferences(); - void SetLanguageShort(const char* LanguageShort); - char* GetLanguageShort(); - void SetPublisMesh(CORBA::Long PublisMeshIN, CORBA::Long PublisMeshOUT); - CORBA::Long GetPublisMeshIN(); - CORBA::Long GetPublisMeshOUT(); - -private: - SMESHHOMARD::HOMARD_Boundary_ptr newBoundary(); - SMESHHOMARD::HOMARD_Cas_ptr newCase(); - SMESHHOMARD::HOMARD_Hypothesis_ptr newHypothesis(); - SMESHHOMARD::HOMARD_Iteration_ptr newIteration(); + void SetKeepMedOUT(bool theKeepMedOUT); + void SetPublishMeshOUT(bool thePublishMeshOUT); + void SetMeshNameOUT (const char* theMeshNameOUT); + void SetMeshFileOUT (const char* theMeshFileOUT); - std::string GetStringInTexte( const std::string Texte, const std::string String, int option ); + void SetVerboseLevel (CORBA::Long theVerboseLevel); + void SetKeepWorkingFiles(bool theKeepWorkingFiles); + void SetLogInFile(bool theLogInFile); + void SetLogFile (const char* theLogFile); + void SetRemoveLogOnSuccess(bool theRemoveLogOnSuccess); private: - struct StudyContext - { - std::map _mesBoundarys; - std::map _mesCas; - std::map _mesHypotheses; - std::map _mesIterations; - }; + SMESHHOMARD::HOMARD_Boundary_ptr newBoundary(); + SMESHHOMARD::HOMARD_Cas_ptr newCase(); + SMESHHOMARD::HOMARD_Iteration_ptr newIteration(); + void CleanCase(); +private: SMESHHOMARDImpl::HOMARD_Gen* myHomard; - StudyContext myStudyContext; + std::map _mesBoundarys; + SMESHHOMARD::HOMARD_Hypothesis_var myHypothesis; + SMESHHOMARD::HOMARD_Iteration_var myIteration0; + SMESHHOMARD::HOMARD_Iteration_var myIteration1; + SMESHHOMARD::HOMARD_Cas_var myCase; // Preferences - std::string _Langue; - std::string _LangueShort; - int _PublisMeshIN; - int _PublisMeshOUT; + bool _KeepMedOUT; + bool _PublishMeshOUT; + bool _KeepWorkingFiles; + bool _LogInFile; + bool _RemoveLogOnSuccess; + int _VerboseLevel; + std::string _MeshNameOUT; + std::string _MeshFileOUT; + std::string _LogFile; + + // Input data type + bool _CaseOnMedFile; + SMESH::SMESH_Mesh_var _SmeshMesh; }; -SMESH_I_EXPORT int MEDFileExist( const char * aFile ); -SMESH_I_EXPORT std::vector GetBoundingBoxInMedFile( const char * aFile); -SMESH_I_EXPORT std::set GetListeGroupesInMedFile(const char * aFile); +SMESH_I_EXPORT std::vector GetBoundingBoxInMedFile(const char * aFile); +SMESH_I_EXPORT std::set GetListeGroupesInMedFile(const char * aFile); }; // namespace SMESHHOMARD_I