From: jfa Date: Wed, 1 Dec 2021 16:12:39 +0000 (+0300) Subject: Implement bos #26453: [EDF] (2021) SMESH: uniform refinement X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b33bc07ec283e49acd5e9b162229a60d800db01d;hp=5254ada6efb07cb0b805fcc25f3d3f6982bda6f1;p=modules%2Fsmesh.git Implement bos #26453: [EDF] (2021) SMESH: uniform refinement --- diff --git a/idl/CMakeLists.txt b/idl/CMakeLists.txt index bd2569e2a..bc5326b53 100644 --- a/idl/CMakeLists.txt +++ b/idl/CMakeLists.txt @@ -40,6 +40,7 @@ SET(SalomeIDLSMESH_IDLSOURCES SMESH_Measurements.idl ${CMAKE_CURRENT_BINARY_DIR}/SMESH_smIdType.idl MG_ADAPT.idl + SMESH_Homard.idl ) SET(_idl_include_dirs diff --git a/idl/SMESH_Gen.idl b/idl/SMESH_Gen.idl index cfdca30f1..595f4eec3 100644 --- a/idl/SMESH_Gen.idl +++ b/idl/SMESH_Gen.idl @@ -35,6 +35,11 @@ #include "SMESH_Hypothesis.idl" #include "SMESH_smIdType.idl" +module SMESHHOMARD +{ + interface HOMARD_Gen; +}; + module SMESH { typedef sequence sobject_list; @@ -581,6 +586,7 @@ module SMESH in double theTolerance ); MG_ADAPT CreateMG_ADAPT(); + SMESHHOMARD::HOMARD_Gen CreateHOMARD_ADAPT(); MG_ADAPT_OBJECT Adaptation(in string adaptType); MG_ADAPT CreateAdaptationHypothesis(); }; diff --git a/idl/SMESH_Homard.idl b/idl/SMESH_Homard.idl new file mode 100644 index 000000000..80509b869 --- /dev/null +++ b/idl/SMESH_Homard.idl @@ -0,0 +1,430 @@ +// Copyright (C) 2011-2021 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef _SMESH_HOMARD_IDL +#define _SMESH_HOMARD_IDL + +#include "SALOME_Component.idl" +#include "SALOME_Exception.idl" +#include "SALOMEDS.idl" + +module SMESHHOMARD +{ + typedef sequence double_array; + 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 + { + // 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 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 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); + + void SetSphere (in double Xcentre, in double Ycentre, in double Zcentre, in double rayon) + 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 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) + raises (SALOME::SALOME_Exception); + SMESHHOMARD::double_array GetLimit() raises (SALOME::SALOME_Exception); + + void AddGroup(in string LeGroupe) raises (SALOME::SALOME_Exception); + void SetGroups(in ListGroupType ListGroup) raises (SALOME::SALOME_Exception); + ListGroupType GetGroups() raises (SALOME::SALOME_Exception); + + // 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 + { + // 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); + + // Caracteristiques + void SetDirNameLoc(in string NomDir) raises (SALOME::SALOME_Exception); + string GetDirNameLoc() 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 SetState(in long State) raises (SALOME::SALOME_Exception); + long GetState() raises (SALOME::SALOME_Exception); + + void SetMeshName(in string NomMesh) raises (SALOME::SALOME_Exception); + string GetMeshName() raises (SALOME::SALOME_Exception); + + 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); + + // 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 + void SetInfoCompute(in long MessInfo) raises (SALOME::SALOME_Exception); + long GetInfoCompute() raises (SALOME::SALOME_Exception); + }; + + interface HOMARD_Cas : Engines::EngineComponent + { + // 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); + + // 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 SetExtType(in long ExtType) raises (SALOME::SALOME_Exception); + long GetExtType() raises (SALOME::SALOME_Exception); + + void SetBoundingBox(in extrema LesExtremes) raises (SALOME::SALOME_Exception); + extrema GetBoundingBox() raises (SALOME::SALOME_Exception); + + void AddGroup(in string Group) raises (SALOME::SALOME_Exception); + 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 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); + }; + + interface HOMARD_Hypothesis : Engines::EngineComponent + { + // 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 ) + 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) + raises(SALOME::SALOME_Exception); + + long Compute (in string IterName, in long CleanOption, in long modeHOMARD, + in long Option1, in long Option2) + raises(SALOME::SALOME_Exception); + // + string CreateDirNameIter(in string NomDir, in long option ) + raises(SALOME::SALOME_Exception); + string VerifieDir (in string NomDir) raises (SALOME::SALOME_Exception); + // + void 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) + raises (SALOME::SALOME_Exception); + long GetPublisMeshIN () raises (SALOME::SALOME_Exception); + long GetPublisMeshOUT () raises (SALOME::SALOME_Exception); + }; + +}; // module SMESHHOMARD + +#endif diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index 7e0d62012..d1436578a 100644 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -23,6 +23,7 @@ SET(SMESH_RESOURCES_FILES ModuleMesh.png adapt_mg_adapt.png + adapt_homard.png advanced_mesh_info.png bare_border_face.png bare_border_volume.png diff --git a/resources/adapt_homard.png b/resources/adapt_homard.png new file mode 100644 index 000000000..95b4c139b Binary files /dev/null and b/resources/adapt_homard.png differ diff --git a/src/SMESH/CMakeLists.txt b/src/SMESH/CMakeLists.txt index ad34d18d8..9dd4e5fb2 100644 --- a/src/SMESH/CMakeLists.txt +++ b/src/SMESH/CMakeLists.txt @@ -89,6 +89,7 @@ SET(SMESHimpl_HEADERS SMESH_ProxyMesh.hxx SMESH_SMESH.hxx MG_ADAPT.hxx + SMESH_Homard.hxx ) # --- sources --- @@ -108,6 +109,7 @@ SET(SMESHimpl_SOURCES SMESH_ProxyMesh.cxx SMESH_MesherHelper.cxx MG_ADAPT.cxx + SMESH_Homard.cxx ) # --- rules --- diff --git a/src/SMESH/SMESH_Homard.cxx b/src/SMESH/SMESH_Homard.cxx new file mode 100644 index 000000000..dac77cf17 --- /dev/null +++ b/src/SMESH/SMESH_Homard.cxx @@ -0,0 +1,3162 @@ +// HOMARD HOMARD : implementation of HOMARD idl descriptions +// +// Copyright (C) 2011-2021 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : HOMARD_Boundary.cxx +// Author : Gerald NICOLAS, EDF +// Module : HOMARD +// +// 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.hxx" + +#include +#include + +#include +#include +#include +#include + +#ifndef WIN32 +#include +#else +#include +#endif + +namespace SMESHHOMARDImpl +{ + + std::string SEPARATOR = "|" ; + + /*! + \brief Read next chunk of data from the string + \internal + + The function tries to read next chunk of the data from the input string \a str. + The parameter \a start specifies the start position of next chunk. If the operation + read the chunk successfully, after its completion this parameter will refer to the + start position of the next chunk. The function returns resulting chunk as a string. + The status of the operation is returned via \a ok parameter. + + \param str source data stream string + \param start start position to get next chunk + \param ok in this variable the status of the chunk reading operation is returned + \return next chunk read from the string + */ + static std::string getNextChunk( const std::string& str, std::string::size_type& start, bool& ok ) + { + std::string chunk = ""; + ok = false; + if ( start <= str.size() ) { + std::string::size_type end = str.find( separator(), start ); + chunk = str.substr( start, end == std::string::npos ? std::string::npos : end-start ); + start = end == std::string::npos ? str.size()+1 : end + separator().size(); + ok = true; + } + return chunk; + } + + /*! + \brief Get persistence signature + \param type persistence entity type + \return persistence signature + */ + std::string GetSignature( SignatureType type ) + { + std::string signature = ""; + switch ( type ) { + case Case: signature = "CASE"; break; + case Zone: signature = "ZONE"; break; + case Hypothesis: signature = "HYPO"; break; + case Iteration: signature = "ITER"; break; + case Boundary: signature = "BOUNDARY"; break; + default: break; + } + signature += separator(); + return signature; + } + + /*! + \brief Get data separator + \return string that is used to separate data entities in the stream + */ + std::string separator() + { + return SEPARATOR ; + } + +// ======================= +// 1.1. Case +// ======================= + /*! + \brief Dump case to the string + \param cas case being dumped + \return string representation of the case + */ + std::string Dump( const HOMARD_Cas& cas ) + { + std::stringstream os; + std::string saux ; + // ... + MESSAGE( ". Sauvegarde du cas "< coor = cas.GetBoundingBox(); + os << separator() << coor.size(); + for ( int i = 0; i < coor.size(); i++ ) + os << separator() << coor[i]; + + std::list ListString = cas.GetIterations(); + os << separator() << ListString.size(); + std::list::const_iterator it; + for ( it = ListString.begin(); it != ListString.end(); ++it ) + os << separator() << *it; + + ListString = cas.GetGroups(); + os << separator() << ListString.size(); + for ( it = ListString.begin(); it != ListString.end(); ++it ) + os << separator() << *it; + ListString = cas.GetBoundaryGroup(); + os << separator() << ListString.size(); + for ( it = ListString.begin(); it != ListString.end(); ++it ) + os << separator() << *it; + + os << separator() << cas.GetPyram(); + + saux = os.str(); +// MESSAGE( ". Fin avec "< ListString = iteration.GetIterations(); + os << separator() << ListString.size(); + std::list::const_iterator it; + for ( it = ListString.begin(); it != ListString.end(); ++it ) + os << separator() << *it; + + os << separator() << iteration.GetHypoName(); + os << separator() << iteration.GetCaseName(); + os << separator() << iteration.GetDirNameLoc(); + + saux = os.str(); +// MESSAGE( ". Fin avec "< ListString = hypothesis.GetIterations(); + std::list::const_iterator it; + os << separator() << ListString.size(); + for ( it = ListString.begin(); it != ListString.end(); ++it ) + os << separator() << *it; + + ListString = hypothesis.GetZones(); + os << separator() << ListString.size(); + for ( it = ListString.begin(); it != ListString.end(); ++it ) + os << separator() << *it; + + ListString = hypothesis.GetComps(); + os << separator() << ListString.size(); + for ( it = ListString.begin(); it != ListString.end(); ++it ) + os << separator() << *it; + + ListString = hypothesis.GetGroups(); + os << separator() << ListString.size(); + for ( it = ListString.begin(); it != ListString.end(); ++it ) + os << separator() << *it; + + ListString = hypothesis.GetFieldInterps(); + os << separator() << ListString.size(); + for ( it = ListString.begin(); it != ListString.end(); ++it ) + os << separator() << *it; + + os << separator() << hypothesis.GetNivMax(); + os << separator() << hypothesis.GetDiamMin(); + os << separator() << hypothesis.GetAdapInit(); + os << separator() << hypothesis.GetExtraOutput(); + + saux = os.str(); +// MESSAGE( ". Fin avec "< coor = boundary.GetCoords() ; + for ( int i = 0; i < coor.size(); i++ ) + os << separator() << coor[i]; + std::vector limit = boundary.GetLimit(); + for ( int i = 0; i < limit.size(); i++ ) + os << separator() << limit[i]; + } + + std::list ListString = boundary.GetGroups(); + std::list::const_iterator it; + os << separator() << ListString.size(); + for ( it = ListString.begin(); it != ListString.end(); ++it ) + os << separator() << *it; + + saux = os.str(); +// MESSAGE( ". Fin avec "< boite; + boite.resize( size ); + for ( int i = 0; i < size; i++ ) { + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + boite[i] = strtod( chunk.c_str(), 0 ); + } + cas.SetBoundingBox( boite ); + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + + size = atoi( chunk.c_str() ); + for ( int i = 0; i < size; i++ ) { + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + cas.AddIteration( chunk.c_str() ); + } + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + size = atoi( chunk.c_str() ); + for ( int i = 0; i < size; i++ ) + { + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + cas.AddGroup( chunk.c_str() ); + } + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + size = atoi( chunk.c_str() ); + for ( int i = 0; i < size; i++ ) { + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + i++; + chunkNext = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + cas.AddBoundaryGroup( chunk.c_str(), chunkNext.c_str() ); + } + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + cas.SetPyram( atoi( chunk.c_str() ) ); + + return true; + } +// +// ============== +// 2.2. Iteration +// ============== + /*! + \brief Restore iteration from the string + \param iteration iteration being restored + \param stream string representation of the iteration + \return \c true if iteration is correctly restored or \c false otherwise + */ + bool Restore( HOMARD_Iteration& iteration, const std::string& stream ) + { + std::string::size_type start = 0; + std::string chunk; + bool ok; + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + + iteration.SetName( chunk.c_str() ); + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + iteration.SetState( atoi( chunk.c_str() ) ); + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + iteration.SetNumber( atoi( chunk.c_str() ) ); + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + iteration.SetMeshFile( chunk.c_str() ); + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + iteration.SetLogFile( chunk.c_str() ); + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + iteration.SetMeshName( chunk.c_str() ); + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + iteration.SetFieldFile( chunk.c_str() ); + // . + int timestep, rank; + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + timestep = atoi( chunk.c_str() ); + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + rank = atoi( chunk.c_str() ); + iteration.SetTimeStepRank( timestep, rank ); + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + iteration.SetIterParentName( chunk.c_str() ); + // + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + int size = atoi( chunk.c_str() ); + for ( int i = 0; i < size; i++ ) { + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + iteration.LinkNextIteration( chunk.c_str() ); + } + // + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + iteration.SetHypoName( chunk.c_str() ); + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + iteration.SetCaseName( chunk.c_str() ); + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + iteration.SetDirNameLoc( chunk.c_str() ); + return true; + } + +// +// ============== +// 2.3. hypothese +// ============== + /*! + \brief Restore hypothesis from the string + \param hypothesis hypothesis being restored + \param stream string representation of the hypothesis + \return \c true if hypothesis is correctly restored or \c false otherwise + */ + bool Restore( HOMARD_Hypothesis& hypothesis, const std::string& stream ) + { + std::string::size_type start = 0; + std::string chunk, chunkNext; + bool ok; + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + hypothesis.SetName( chunk.c_str() ); + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + hypothesis.SetCaseCreation( chunk.c_str() ); + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + hypothesis.SetAdapType( atoi( chunk.c_str() ) ); + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + int typeraff = atoi( chunk.c_str() ); + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + int typedera = atoi( chunk.c_str() ); + hypothesis.SetRefinTypeDera( typeraff, typedera ); + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + hypothesis.SetField( chunk.c_str() ); + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + int typethr = atoi( chunk.c_str() ); + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + double threshr = strtod( chunk.c_str(), 0 ); + hypothesis.SetRefinThr( typethr, threshr ); + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + int typethc = atoi( chunk.c_str() ); + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + double threshc = strtod( chunk.c_str(), 0 ); + hypothesis.SetUnRefThr( typethc, threshc ); + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + hypothesis.SetUseField(atoi(chunk.c_str())); + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + hypothesis.SetUseComp(atoi(chunk.c_str())); + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + hypothesis.SetTypeFieldInterp(atoi(chunk.c_str())); + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + int size = atoi( chunk.c_str() ); + for ( int i = 0; i < size; i++ ) { + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + hypothesis.LinkIteration( chunk.c_str() ); + } + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + size = atoi( chunk.c_str() ); + for ( int i = 0; i < size; i++ ) { + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + i++; + chunkNext = getNextChunk( stream, start, ok ); + int typeuse = atoi( chunkNext.c_str() ); + if ( !ok ) return false; + hypothesis.AddZone( chunk.c_str(), typeuse ); + } + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + size = atoi( chunk.c_str() ); + for ( int i = 0; i < size; i++ ) { + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + hypothesis.AddComp( chunk.c_str() ); + } + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + size = atoi( chunk.c_str() ); + for ( int i = 0; i < size; i++ ) { + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + hypothesis.AddGroup( chunk.c_str() ); + } + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + size = atoi( chunk.c_str() ); + for ( int i = 0; i < size; i++ ) { + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + i++; + chunkNext = getNextChunk( stream, start, ok ); + int TypeInterp = atoi( chunkNext.c_str() ); + if ( !ok ) return false; + hypothesis.AddFieldInterpType( chunk.c_str(), TypeInterp ); + } + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + hypothesis.SetNivMax( atoi( chunk.c_str() ) ); + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + hypothesis.SetDiamMin( strtod( chunk.c_str(), 0 ) ); + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + hypothesis.SetAdapInit( strtod( chunk.c_str(), 0 ) ); + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + hypothesis.SetExtraOutput( strtod( chunk.c_str(), 0 ) ); + + return true; + } + +// +// ================================= +// 2.5. Restauration d'une frontiere +// ================================= + + /*! + \brief Restore boundary from the string + \param boundary boundary being restored + \param stream string representation of the boundary + \return \c true if the boundary is correctly restored or \c false otherwise + */ + bool Restore( HOMARD_Boundary& boundary, const std::string& stream ) + { + std::string::size_type start = 0; + std::string chunk; + bool ok; + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + boundary.SetName( chunk.c_str() ); + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + int BoundaryType = atoi( chunk.c_str() ) ; + boundary.SetType( BoundaryType ); + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + boundary.SetCaseCreation( chunk.c_str() ); + + // Si analytique, les coordonnees des frontieres : le nombre depend du type + // Si discret, le maillage + // Si CAO, la géométrie + int lgcoords ; + if ( BoundaryType == -1 ) { lgcoords = -1 ; } + else if ( BoundaryType == 1 ) { lgcoords = 7 ; } + else if ( BoundaryType == 2 ) { lgcoords = 4 ; } + else { lgcoords = 0 ; } +// + if ( lgcoords == -1 ) + { + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + boundary.SetDataFile( chunk.c_str() ); + } + else if ( lgcoords == 0 ) + { + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + boundary.SetMeshName( chunk.c_str() ); + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + boundary.SetDataFile( chunk.c_str() ); + } + else + { std::vector coords; + coords.resize( lgcoords ); + for ( int i = 0; i < lgcoords; i++ ) { + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + coords[i] = strtod( chunk.c_str(), 0 ); + } + if ( BoundaryType == 1 ) + { boundary.SetCylinder(coords[0],coords[1],coords[2],coords[3],coords[4],coords[5],coords[6]); } + else if ( BoundaryType == 2 ) + { boundary.SetSphere( coords[0], coords[1], coords[2], coords[3]); } + else if ( BoundaryType == 3 ) + { boundary.SetConeA( coords[0], coords[1], coords[2], coords[3], coords[4], coords[5], coords[6]); } + else if ( BoundaryType == 4 ) + { boundary.SetConeR( coords[0], coords[1], coords[2], coords[3], coords[4], coords[5], coords[6], coords[7]); } + // Remarque : la taille de coords est suffisante pour les limites + for ( int i = 0; i < 3; i++ ) { + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + coords[i] = strtod( chunk.c_str(), 0 ); + } + boundary.SetLimit( coords[0], coords[1], coords[2]); + } + // Les groupes + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + int size = atoi( chunk.c_str() ); + for ( int i = 0; i < size; i++ ) { + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + boundary.AddGroup( chunk.c_str() ); + } + + return true; + } + +//============================================================================= +/*! + * default constructor: + */ +//============================================================================= +HOMARD_Boundary::HOMARD_Boundary(): + _Name( "" ),_Type( 1 ), + _Xmin( 0 ), _Xmax( 0 ), _Ymin( 0 ), _Ymax( 0 ), _Zmin( 0 ), _Zmax( 0 ), + _Xaxe( 0 ), _Yaxe( 0 ), _Zaxe( 0 ), + _Xcentre( 0 ), _Ycentre( 0 ), _Zcentre( 0 ), _rayon( 0 ), + _Xincr( 0 ), _Yincr( 0 ), _Zincr( 0 ) +{ + MESSAGE("HOMARD_Boundary"); +} + +//============================================================================= +HOMARD_Boundary::~HOMARD_Boundary() +{ + MESSAGE("~HOMARD_Boundary"); +} +//============================================================================= +//============================================================================= +// Generalites +//============================================================================= +//============================================================================= +void HOMARD_Boundary::SetName( const char* Name ) +{ + _Name = std::string( Name ); +} +//============================================================================= +std::string HOMARD_Boundary::GetName() const +{ + return _Name; +} +//============================================================================= +std::string HOMARD_Boundary::GetDumpPython() const +{ + std::ostringstream aScript; + aScript << "\n# Creation of the "; +// + switch (_Type) + { + case -1: + { + aScript << "CAO boundary " << _Name << "\n"; + aScript << "\t" << _Name << " = homard.CreateBoundaryCAO(\"" << _Name << "\", "; + aScript << "\"" << _DataFile << "\")\n"; + break ; + } + case 0: + { + aScript << "discrete boundary " << _Name << "\n"; + aScript << "\t" << _Name << " = homard.CreateBoundaryDi(\"" << _Name << "\", "; + aScript << "\"" << _MeshName << "\", "; + aScript << "\"" << _DataFile << "\")\n"; + break ; + } + case 1: + { + aScript << "cylinder " << _Name << "\n"; + aScript << "\t" << _Name << " = homard.CreateBoundaryCylinder(\"" << _Name << "\", "; + aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _rayon << ")\n"; + break ; + } + case 2: + { + aScript << "sphere " << _Name << "\n"; + aScript << "\t" << _Name << " = homard.CreateBoundarySphere(\"" << _Name << "\", "; + aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _rayon << ")\n"; + break ; + } + case 3: + { + aScript << "cone " << _Name << "\n"; + aScript << "\t" << _Name << " = homard.CreateBoundaryConeA(\"" << _Name << "\", "; + aScript << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _Angle << ", " << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ")\n"; + break ; + } + case 4: + { + aScript << "cone " << _Name << "\n"; + aScript << "\t" << _Name << " = homard.CreateBoundaryConeR(\"" << _Name << "\", "; + aScript << _Xcentre1 << ", " << _Ycentre1 << ", " << _Zcentre1 << ", " << _Rayon1 << ", " << _Xcentre2 << ", " << _Ycentre2 << ", " << _Zcentre2 << ", " << _Rayon2 << ")\n"; + break ; + } + case 5: + { + aScript << "tore " << _Name << "\n"; + aScript << "\t" << _Name << " = homard.CreateBoundaryTorus(\"" << _Name << "\", "; + aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _Rayon1 << ", " << _Rayon2 << ")\n"; + break ; + } + } + + return aScript.str(); +} +//============================================================================= +//============================================================================= +// Caracteristiques +//============================================================================= +//============================================================================= +void HOMARD_Boundary::SetType( int Type ) +{ + _Type = Type; +} +//============================================================================= +int HOMARD_Boundary::GetType() const +{ + return _Type; +} +//============================================================================= +void HOMARD_Boundary::SetMeshName( const char* MeshName ) +{ + _MeshName = std::string( MeshName ); +} +//============================================================================= +std::string HOMARD_Boundary::GetMeshName() const +{ + return _MeshName; +} +//============================================================================= +void HOMARD_Boundary::SetDataFile( const char* DataFile ) +{ + _DataFile = std::string( DataFile ); +} +//============================================================================= +std::string HOMARD_Boundary::GetDataFile() const +{ + return _DataFile; +} +//======================================================================================= +void HOMARD_Boundary::SetCylinder( double X0, double X1, double X2, + double X3, double X4, double X5, double X6 ) +{ + _Xcentre = X0; _Ycentre = X1; _Zcentre = X2; + _Xaxe = X3; _Yaxe = X4; _Zaxe = X5; + _rayon = X6; +} +//====================================================================== +void HOMARD_Boundary::SetSphere( double X0, double X1, double X2, double X3 ) +{ + _Xcentre = X0; _Ycentre = X1; _Zcentre = X2; + _rayon = X3; +} +//====================================================================== +void HOMARD_Boundary::SetConeR( double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1, + double Xcentre2, double Ycentre2, double Zcentre2, double Rayon2) +{ + _Xcentre1 = Xcentre1; _Ycentre1 = Ycentre1; _Zcentre1 = Zcentre1; + _Rayon1 = Rayon1; + _Xcentre2 = Xcentre2; _Ycentre2 = Ycentre2; _Zcentre2 = Zcentre2; + _Rayon2 = Rayon2; +} +//====================================================================== +void HOMARD_Boundary::SetConeA( double Xaxe, double Yaxe, double Zaxe, double Angle, + double Xcentre, double Ycentre, double Zcentre) +{ + _Xaxe = Xaxe; _Yaxe = Yaxe; _Zaxe = Zaxe; + _Angle = Angle; + _Xcentre = Xcentre; _Ycentre = Ycentre; _Zcentre = Zcentre; +} +//======================================================================================= +void HOMARD_Boundary::SetTorus( double X0, double X1, double X2, + double X3, double X4, double X5, double X6, double X7 ) +{ + _Xcentre = X0; _Ycentre = X1; _Zcentre = X2; + _Xaxe = X3; _Yaxe = X4; _Zaxe = X5; + _Rayon1 = X6; + _Rayon2 = X7; +} +//======================================================================================= +std::vector HOMARD_Boundary::GetCoords() const +{ + std::vector mesCoor; +// + switch (_Type) + { +// Cylindre + case 1: + { + mesCoor.push_back( _Xcentre ); + mesCoor.push_back( _Ycentre ); + mesCoor.push_back( _Zcentre ); + mesCoor.push_back( _Xaxe ); + mesCoor.push_back( _Yaxe ); + mesCoor.push_back( _Zaxe ); + mesCoor.push_back( _rayon ); + break ; + } +// Sphere + case 2: + { + mesCoor.push_back( _Xcentre ); + mesCoor.push_back( _Ycentre ); + mesCoor.push_back( _Zcentre ); + mesCoor.push_back( _rayon ); + break ; + } +// Cone defini par un axe et un angle + case 3: + { + mesCoor.push_back( _Xaxe ); + mesCoor.push_back( _Yaxe ); + mesCoor.push_back( _Zaxe ); + mesCoor.push_back( _Angle ); + mesCoor.push_back( _Xcentre ); + mesCoor.push_back( _Ycentre ); + mesCoor.push_back( _Zcentre ); + break ; + } +// Cone defini par les 2 rayons + case 4: + { + mesCoor.push_back( _Xcentre1 ); + mesCoor.push_back( _Ycentre1 ); + mesCoor.push_back( _Zcentre1 ); + mesCoor.push_back( _Rayon1 ); + mesCoor.push_back( _Xcentre2 ); + mesCoor.push_back( _Ycentre2 ); + mesCoor.push_back( _Zcentre2 ); + mesCoor.push_back( _Rayon2 ); + break ; + } +// Tore + case 5: + { + mesCoor.push_back( _Xcentre ); + mesCoor.push_back( _Ycentre ); + mesCoor.push_back( _Zcentre ); + mesCoor.push_back( _Xaxe ); + mesCoor.push_back( _Yaxe ); + mesCoor.push_back( _Zaxe ); + mesCoor.push_back( _Rayon1 ); + mesCoor.push_back( _Rayon2 ); + break ; + } + VERIFICATION( (_Type>=1) && (_Type<=5) ) ; + } + return mesCoor; +} +//====================================================================== +void HOMARD_Boundary::SetLimit( double X0, double X1, double X2 ) +{ + _Xincr = X0; _Yincr = X1; _Zincr = X2; +} +//======================================================================================= +std::vector HOMARD_Boundary::GetLimit() const +{ + std::vector mesLimit; + mesLimit.push_back( _Xincr ); + mesLimit.push_back( _Yincr ); + mesLimit.push_back( _Zincr ); + return mesLimit; +} +//============================================================================= +void HOMARD_Boundary::AddGroup( const char* Group) +{ + _ListGroupSelected.push_back(Group); +} +//============================================================================= +void HOMARD_Boundary::SetGroups( const std::list& ListGroup ) +{ + _ListGroupSelected.clear(); + std::list::const_iterator it = ListGroup.begin(); + while(it != ListGroup.end()) + _ListGroupSelected.push_back((*it++)); +} +//============================================================================= +const std::list& HOMARD_Boundary::GetGroups() const +{ + return _ListGroupSelected; +} +//============================================================================= +//============================================================================= +// Liens avec les autres structures +//============================================================================= +//============================================================================= +void HOMARD_Boundary::SetCaseCreation( const char* NomCasCreation ) +{ + _NomCasCreation = std::string( NomCasCreation ); +} +//============================================================================= +std::string HOMARD_Boundary::GetCaseCreation() const +{ + return _NomCasCreation; +} +//============================================================================= + +//============================================================================= +/*! + * default constructor: + * Par defaut, l'adaptation est conforme, sans suivi de frontiere + */ +//============================================================================= +HOMARD_Cas::HOMARD_Cas(): + _Name(""), _NomDir("/tmp"), _ConfType(0), _ExtType(0) +{ + MESSAGE("HOMARD_Cas"); +} +//============================================================================= +HOMARD_Cas::~HOMARD_Cas() +//============================================================================= +{ + MESSAGE("~HOMARD_Cas"); +} +//============================================================================= +//============================================================================= +// Generalites +//============================================================================= +//============================================================================= +void HOMARD_Cas::SetName( const char* Name ) +{ + _Name = std::string( Name ); +} +//============================================================================= +std::string HOMARD_Cas::GetName() const +{ + return _Name; +} +//============================================================================= +std::string HOMARD_Cas::GetDumpPython() const +{ + std::ostringstream aScript; + aScript << "\t" <<_Name << ".SetDirName(\""; + aScript << _NomDir << "\")\n"; + aScript << "\t" <<_Name << ".SetConfType("; + aScript << _ConfType << ")\n"; + aScript << "\t" <<_Name << ".SetExtType("; + aScript << _ExtType << ")\n"; +// Suivi de frontieres + std::list::const_iterator it = _ListBoundaryGroup.begin(); + while(it != _ListBoundaryGroup.end()) + { + aScript << "\t" <<_Name << ".AddBoundaryGroup(\""; + aScript << *it << "\", \""; + it++; + aScript << *it << "\")\n"; + it++; + } + if ( _Pyram > 0 ) + { + aScript << "\t" <<_Name << ".SetPyram("; + aScript << _Pyram << ")\n"; + } + + return aScript.str(); +} +//============================================================================= +//============================================================================= +// Caracteristiques +//============================================================================= +//============================================================================= +int HOMARD_Cas::SetDirName( const char* NomDir ) +{ +// MESSAGE("SetDirName, NomDir : "< 1 ) { erreur = 1 ; } + // Creation + if ( CHDIR(NomDir) == 0 ) + { _NomDir = std::string( NomDir ); } + else + { + +#ifndef WIN32 + if ( mkdir(NomDir, S_IRWXU|S_IRGRP|S_IXGRP) == 0 ) +#else + if ( _mkdir(NomDir) == 0 ) +#endif + { + if ( CHDIR(NomDir) == 0 ) { _NomDir = std::string( NomDir ); } + else { erreur = 2 ; } + } + else { erreur = 2 ; } + }; + return erreur ; +} +//============================================================================= +std::string HOMARD_Cas::GetDirName() const +{ + return _NomDir; +} +//============================================================================= +int HOMARD_Cas::GetNumberofIter() +{ + return _ListIter.size(); +} +// +// Le type de conformite ou non conformite +// +//============================================================================= +void HOMARD_Cas::SetConfType( int Conftype ) +{ +// VERIFICATION( (Conftype>=-2) && (Conftype<=3) ); + _ConfType = Conftype; +} +//============================================================================= +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 +// +//============================================================================= +void HOMARD_Cas::SetBoundingBox( const std::vector& extremas ) +{ + _Boite.clear(); + _Boite.resize( extremas.size() ); + for ( int i = 0; i < extremas.size(); i++ ) + _Boite[i] = extremas[i]; +} +//============================================================================= +const std::vector& HOMARD_Cas::GetBoundingBox() const +{ + return _Boite; +} +// +// Les groupes +// +//============================================================================= +void HOMARD_Cas::AddGroup( const char* Group ) +{ + _ListGroup.push_back(Group); +} +//============================================================================= +void HOMARD_Cas::SetGroups( const std::list& ListGroup ) +{ + _ListGroup.clear(); + std::list::const_iterator it = ListGroup.begin(); + while(it != ListGroup.end()) + { + _ListGroup.push_back((*it++)); + } +} +//============================================================================= +const std::list& HOMARD_Cas::GetGroups() const +{ + return _ListGroup; +} +//============================================================================= +void HOMARD_Cas::SupprGroups() +{ + _ListGroup.clear(); +} +// +// Les frontieres +// +//============================================================================= +void HOMARD_Cas::AddBoundary( const char* Boundary ) +{ +// MESSAGE ( ". HOMARD_Cas::AddBoundary : Boundary = " << Boundary ); + const char* Group = ""; + AddBoundaryGroup( Boundary, Group ); +} +//============================================================================= +void HOMARD_Cas::AddBoundaryGroup( const char* Boundary, const char* Group ) +{ +// MESSAGE ( ". HOMARD_Cas::AddBoundaryGroup : Boundary = " << Boundary ); +// MESSAGE ( ". HOMARD_Cas::AddBoundaryGroup : Group = " << Group ); + _ListBoundaryGroup.push_back( Boundary ); + _ListBoundaryGroup.push_back( Group ); +} +//============================================================================= +const std::list& HOMARD_Cas::GetBoundaryGroup() const +{ + return _ListBoundaryGroup; +} +//============================================================================= +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 +//============================================================================= +//============================================================================= +std::string HOMARD_Cas::GetIter0Name() const +{ +// Par construction de la liste, l'iteration a ete mise en tete. + return (*(_ListIter.begin())); +} +//============================================================================= +void HOMARD_Cas::AddIteration( const char* NomIteration ) +{ + _ListIter.push_back( std::string( NomIteration ) ); +} +//============================================================================= +const std::list& HOMARD_Cas::GetIterations() const +{ + return _ListIter; +} +//============================================================================= +void HOMARD_Cas::SupprIterations() +{ + _ListIter.clear(); +} + +//============================================================================= +//============================================================================= +HomardDriver::HomardDriver(const std::string siter, const std::string siterp1): + _HOMARD_Exec( "" ), _NomDir( "" ), _NomFichierConfBase( "HOMARD.Configuration" ), + _NomFichierConf( "" ), _NomFichierDonn( "" ), _siter( "" ), _siterp1( "" ), + _Texte( "" ), _bLu( false ) +{ + MESSAGE("siter = "< _HOMARD_Exec ="<<_HOMARD_Exec) ; +// + _siter = siter ; + _siterp1 = siterp1 ; +} +//============================================================================= +//============================================================================= +HomardDriver::~HomardDriver() +{ +} +//=============================================================================== +// A. Generalites +//=============================================================================== +void HomardDriver::TexteInit( const std::string DirCompute, const std::string LogFile, const std::string Langue ) +{ + MESSAGE("TexteInit, DirCompute ="<0 signifie que l'on raffinera les mailles contenues dans la zone, +// <0 signifie que l'on deraffinera +// + int ZoneTypeHOMARD ; + if ( ZoneType >= 11 && ZoneType <= 13 ) { ZoneTypeHOMARD = 1 ; } + else if ( ZoneType >= 31 && ZoneType <= 33 ) { ZoneTypeHOMARD = 3 ; } + else if ( ZoneType >= 61 && ZoneType <= 63 ) { ZoneTypeHOMARD = 6 ; } + else { ZoneTypeHOMARD = ZoneType ; } +// + if ( TypeUse < 0 ) { ZoneTypeHOMARD = -ZoneTypeHOMARD ; } +// + std::stringstream saux1 ; + saux1 << NumeZone ; + saux = "#\n# Zone numero " + saux1.str() + "\n" ; +// + { std::stringstream saux1 ; + saux1 << NumeZone << " " << ZoneTypeHOMARD ; + saux += "ZoRaType " + saux1.str() + "\n" ; + } +// +// Cas du rectangle +// + if ( ZoneType == 11 ) // Z est constant X Homard <=> X Salome +// Y Homard <=> Y Salome + { + saux += "#Rectangle\n" ; + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x0 ; + saux += "ZoRaXmin " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x1 ; + saux += "ZoRaXmax " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x2 ; + saux += "ZoRaYmin " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x3 ; + saux += "ZoRaYmax " + saux1.str() + "\n" ; + } + } +// + else if ( ZoneType == 12 ) // X est constant X Homard <=> Y Salome +// Y Homard <=> Z Salome + { + saux += "#Rectangle\n" ; + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x2 ; + saux += "ZoRaXmin " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x3 ; + saux += "ZoRaXmax " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x4 ; + saux += "ZoRaYmin " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x5 ; + saux += "ZoRaYmax " + saux1.str() + "\n" ; + } + } +// + else if ( ZoneType == 13 ) // Y est constant X Homard <=> X Salome +// Y Homard <=> Z Salome + { + saux += "#Rectangle\n" ; + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x0 ; + saux += "ZoRaXmin " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x1 ; + saux += "ZoRaXmax " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x4 ; + saux += "ZoRaYmin " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x5 ; + saux += "ZoRaYmax " + saux1.str() + "\n" ; + } + } +// +// Cas du parallelepipede +// + else if ( ZoneType == 2 ) + { + saux += "# Boite\n" ; + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x0 ; + saux += "ZoRaXmin " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x1 ; + saux += "ZoRaXmax " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x2 ; + saux += "ZoRaYmin " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x3 ; + saux += "ZoRaYmax " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x4 ; + saux += "ZoRaZmin " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x5 ; + saux += "ZoRaZmax " + saux1.str() + "\n" ; + } + } +// +// Cas du disque +// + else if ( ZoneType == 31 || ZoneType == 61 ) + { + saux += "# Sphere\n" ; + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x0 ; + saux += "ZoRaXCen " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x1 ; + saux += "ZoRaYCen " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x6 ; + saux2 = saux1.str() ; + if ( ZoneType == 61 ) { saux += "ZoRaRayE " + saux2 + "\n" ; } + else { saux += "ZoRaRayo " + saux2 + "\n" ; } + } + if ( ZoneType == 61 ) + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x8 ; + saux += "ZoRaRayI " + saux1.str() + "\n" ; + } + } + else if ( ZoneType == 32 || ZoneType == 62 ) + { + saux += "# Sphere\n" ; + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x1 ; + saux += "ZoRaXCen " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x2 ; + saux += "ZoRaYCen " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x6 ; + saux2 = saux1.str() ; + if ( ZoneType == 62 ) { saux += "ZoRaRayE " + saux2 + "\n" ; } + else { saux += "ZoRaRayo " + saux2 + "\n" ; } + } + if ( ZoneType == 62 ) + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x8 ; + saux += "ZoRaRayI " + saux1.str() + "\n" ; + } + } + else if ( ZoneType == 33 || ZoneType == 63 ) + { + saux += "# Sphere\n" ; + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x0 ; + saux += "ZoRaXCen " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x2 ; + saux += "ZoRaYCen " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x6 ; + saux2 = saux1.str() ; + if ( ZoneType == 63 ) { saux += "ZoRaRayE " + saux2 + "\n" ; } + else { saux += "ZoRaRayo " + saux2 + "\n" ; } + } + if ( ZoneType == 63 ) + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x8 ; + saux += "ZoRaRayI " + saux1.str() + "\n" ; + } + } +// +// Cas de la sphere +// + else if ( ZoneType == 4 ) + { + saux += "# Sphere\n" ; + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x0 ; + saux += "ZoRaXCen " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x1 ; + saux += "ZoRaYCen " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x2 ; + saux += "ZoRaZCen " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x3 ; + saux += "ZoRaRayo " + saux1.str() + "\n" ; + } + } +// +// Cas du cylindre ou du tuyau +// + else if ( ZoneType == 5 || ZoneType == 7 ) + { + if ( ZoneType == 5 ) { saux += "# Cylindre\n" ; } + else { saux += "# Tuyau\n" ; } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x0 ; + saux += "ZoRaXBas " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x1 ; + saux += "ZoRaYBas " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x2 ; + saux += "ZoRaZBas " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x3 ; + saux += "ZoRaXAxe " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x4 ; + saux += "ZoRaYAxe " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x5 ; + saux += "ZoRaZAxe " + saux1.str() + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x6 ; + saux2 = saux1.str() ; + if ( ZoneType == 5 ) { saux += "ZoRaRayo " + saux2 + "\n" ; } + else { saux += "ZoRaRayE " + saux2 + "\n" ; } + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x7 ; + saux += "ZoRaHaut " + saux1.str() + "\n" ; + } + if ( ZoneType == 7 ) + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x8 ; + saux += "ZoRaRayI " + saux1.str() + "\n" ; + } + } +// + _Texte += saux + "#\n" ; +// +// MESSAGE("A la fin de HomardDriver::TexteZone, _Texte ="<<_Texte); +} +//=============================================================================== +void HomardDriver::TexteField( const std::string FieldName, const std::string FieldFile, int TimeStep, int Rank, + int TypeThR, double ThreshR, int TypeThC, double ThreshC, + int UsField, int UsCmpI ) +{ + MESSAGE("TexteField, FieldName = "<= 0 ) + { + { + std::stringstream saux1 ; + saux1 << TimeStep ; + saux2 = saux1.str() ; + _Texte += "CCNumPTI " + saux2 + "\n" ; + } + if ( Rank >= 0 ) + { + std::stringstream saux1 ; + saux1 << Rank ; + saux2 = saux1.str() ; + _Texte += "CCNumOrI " + saux2 + "\n" ; + } + } +// + saux = " " ; + if ( TypeThR == 1 ) + { saux = "Hau" ; } + if ( TypeThR == 2 ) + { saux = "HRe" ; } + if ( TypeThR == 3 ) + { saux = "HPE" ; } + if ( TypeThR == 4 ) + { saux = "HMS" ; } + if ( saux != " " ) + { + std::stringstream saux1 ; + saux1 << ThreshR ; + _Texte += "Seuil" + saux + " " + saux1.str() + "\n" ; + } +// + saux = " " ; + if ( TypeThC == 1 ) + { saux = "Bas" ; } + if ( TypeThC == 2 ) + { saux = "BRe" ; } + if ( TypeThC == 3 ) + { saux = "BPE" ; } + if ( TypeThC == 4 ) + { saux = "BMS" ; } + if ( saux != " " ) + { + std::stringstream saux1 ; + saux1 << ThreshC ; + _Texte += "Seuil" + saux + " " + saux1.str() + "\n" ; + } +// + saux = " " ; + if ( UsField == 0 ) + { saux = "MAILLE" ; } + if ( UsField == 1 ) + { saux = "SAUT" ; } + if ( saux != " " ) + { + _Texte += "CCModeFI " + saux + "\n" ; + } +// + saux = " " ; + if ( UsCmpI == 0 ) + { saux = "L2" ; } + if ( UsCmpI == 1 ) + { saux = "INFINI" ; } + if ( UsCmpI == 2 ) + { saux = "RELATIF" ; } + if ( saux != " " ) + { + _Texte += "CCUsCmpI " + saux + "\n" ; + } +} +//=============================================================================== +void HomardDriver::TexteGroup( const std::string GroupName ) +{ + MESSAGE("TexteGroup, GroupName = "<0 si pas de precision) +// Rank : numero d'ordre retenu +// +void HomardDriver::TexteFieldInterpNameType( int NumeChamp, const std::string FieldName, const std::string TypeInterp, int TimeStep, int Rank) +{ + MESSAGE("TexteFieldInterpNameType, NumeChamp = "<= 0 ) + { + { + std::stringstream saux1 ; + saux1 << TimeStep ; + _Texte += "CCChaPdT " + saux + " " + saux1.str() + "\n" ; + } + { + std::stringstream saux1 ; + saux1 << Rank ; + _Texte += "CCChaNuO " + saux + " " + saux1.str() + "\n" ; + } + } +} +//=============================================================================== +// F. Les options avancees +//=============================================================================== +void HomardDriver::TexteAdvanced( int Pyram, int NivMax, double DiamMin, int AdapInit, int ExtraOutput ) +{ + MESSAGE("TexteAdvanced, Pyram ="< 0 ) + { + _Texte += "# Niveaux extremes\n" ; + { std::stringstream saux1 ; + saux1 << NivMax ; + _Texte += "NiveauMa " + saux1.str() + "\n" ; + } + } + if ( DiamMin > 0 ) + { + _Texte += "# Diametre minimal\n" ; + { std::stringstream saux1 ; + saux1 << DiamMin ; + _Texte += "DiametMi " + saux1.str() + "\n" ; + } + } + if ( AdapInit != 0 ) + { + if ( AdapInit > 0 ) + { _Texte += "# Raffinement" ; } + else + { _Texte += "# Deraffinement" ; } + _Texte += " des regions sans indicateur\n" ; + { std::stringstream saux1 ; + saux1 << AdapInit ; + _Texte += "AdapInit " + saux1.str() + "\n" ; + } + } + if ( ExtraOutput % 2 == 0 ) + { + _Texte += "# Sortie des niveaux de raffinement\n" ; + _Texte += "NCNiveau NIVEAU\n" ; + } + if ( ExtraOutput % 3 == 0 ) + { + _Texte += "# Sortie des qualités des mailles\n" ; + _Texte += "NCQualit QUAL\n" ; + } + if ( ExtraOutput % 5 == 0 ) + { + _Texte += "# Sortie des diamètres des mailles\n" ; + _Texte += "NCDiamet DIAM\n" ; + } + if ( ExtraOutput % 7 == 0 ) + { + _Texte += "# Sortie des parents des mailles\n" ; + _Texte += "NCParent PARENT\n" ; + } + if ( ExtraOutput % 11 == 0 ) + { + _Texte += "# Volumes voisins par recollement\n" ; + _Texte += "NCVoisRc Voisin-Recollement\n" ; + } +} +//=============================================================================== +// G. Les messages +//=============================================================================== +void HomardDriver::TexteInfoCompute( int MessInfo ) +{ + MESSAGE("TexteAdvanced, MessInfo ="<::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 +//============================================================================= +//============================================================================= +void HOMARD_Hypothesis::SetAdapType( int TypeAdap ) +{ + VERIFICATION( (TypeAdap>=-1) && (TypeAdap<=1) ); + _TypeAdap = TypeAdap; +} +//============================================================================= +int HOMARD_Hypothesis::GetAdapType() const +{ + return _TypeAdap; +} +//============================================================================= +void HOMARD_Hypothesis::SetRefinTypeDera( int TypeRaff, int TypeDera ) +{ + VERIFICATION( (TypeRaff>=-1) && (TypeRaff<=1) ); + _TypeRaff = TypeRaff; + VERIFICATION( (TypeDera>=-1) && (TypeDera<=1) ); + _TypeDera = TypeDera; +} +//============================================================================= +int HOMARD_Hypothesis::GetRefinType() const +{ + return _TypeRaff; +} +//============================================================================= +int HOMARD_Hypothesis::GetUnRefType() const +{ + return _TypeDera; +} +//============================================================================= +void HOMARD_Hypothesis::SetField( const char* FieldName ) +{ + _Field = std::string( FieldName ); + MESSAGE( "SetField : FieldName = " << FieldName ); +} +//============================================================================= +std::string HOMARD_Hypothesis::GetFieldName() const +{ + return _Field; +} +//============================================================================= +void HOMARD_Hypothesis::SetUseField( int UsField ) +{ + VERIFICATION( (UsField>=0) && (UsField<=1) ); + _UsField = UsField; +} +//============================================================================= +int HOMARD_Hypothesis::GetUseField() const +{ + return _UsField; +} +//============================================================================= +void HOMARD_Hypothesis::SetUseComp( int UsCmpI ) +{ + MESSAGE ("SetUseComp pour UsCmpI = "<=0) && (UsCmpI<=2) ); + _UsCmpI = UsCmpI; +} +//============================================================================= +int HOMARD_Hypothesis::GetUseComp() const +{ + return _UsCmpI; +} +//============================================================================= +void HOMARD_Hypothesis::AddComp( const char* NomComp ) +{ +// On commence par supprimer la composante au cas ou elle aurait deja ete inseree +// Cela peut se produire dans un schema YACS quand on repasse plusieurs fois par la +// definition de l'hypothese + SupprComp( NomComp ) ; +// Insertion veritable + _ListComp.push_back( std::string( NomComp ) ); +} +//============================================================================= +void HOMARD_Hypothesis::SupprComp( const char* NomComp ) +{ + MESSAGE ("SupprComp pour "<::iterator it = find( _ListComp.begin(), _ListComp.end(), NomComp ); + if ( it != _ListComp.end() ) { it = _ListComp.erase( it ); } +} +//============================================================================= +void HOMARD_Hypothesis::SupprComps() +{ + _ListComp.clear(); +} +//============================================================================= +const std::list& HOMARD_Hypothesis::GetComps() const +{ + return _ListComp; +} +//============================================================================= +void HOMARD_Hypothesis::SetRefinThr( int TypeThR, double ThreshR ) +{ + MESSAGE( "SetRefinThr : TypeThR = " << TypeThR << ", ThreshR = " << ThreshR ); + VERIFICATION( (TypeThR>=0) && (TypeThR<=4) ); + _TypeThR = TypeThR; + _ThreshR = ThreshR; +} +//============================================================================= +int HOMARD_Hypothesis::GetRefinThrType() const +{ + return _TypeThR; +} +//============================================================================= +double HOMARD_Hypothesis::GetThreshR() const +{ + return _ThreshR; +} +//============================================================================= +void HOMARD_Hypothesis::SetUnRefThr( int TypeThC, double ThreshC ) +{ + VERIFICATION( (TypeThC>=0) && (TypeThC<=4) ); + _TypeThC = TypeThC; + _ThreshC = ThreshC; +} +//============================================================================= +int HOMARD_Hypothesis::GetUnRefThrType() const +{ + return _TypeThC; +} +//============================================================================= +double HOMARD_Hypothesis::GetThreshC() const +{ + return _ThreshC; +} +//============================================================================= +void HOMARD_Hypothesis::SetNivMax( int NivMax ) +//============================================================================= +{ + _NivMax = NivMax; +} +//============================================================================= +const int HOMARD_Hypothesis::GetNivMax() const +//============================================================================= +{ + return _NivMax; +} +//============================================================================= +void HOMARD_Hypothesis::SetDiamMin( double DiamMin ) +//============================================================================= +{ + _DiamMin = DiamMin; +} +//============================================================================= +const double HOMARD_Hypothesis::GetDiamMin() const +//============================================================================= +{ + return _DiamMin; +} +//============================================================================= +void HOMARD_Hypothesis::SetAdapInit( int AdapInit ) +//============================================================================= +{ + _AdapInit = AdapInit; +} +//============================================================================= +const int HOMARD_Hypothesis::GetAdapInit() const +//============================================================================= +{ + return _AdapInit; +} +//============================================================================= +void HOMARD_Hypothesis::SetExtraOutput( int ExtraOutput ) +//============================================================================= +{ + _ExtraOutput = ExtraOutput; +} +//============================================================================= +const int HOMARD_Hypothesis::GetExtraOutput() const +//============================================================================= +{ + return _ExtraOutput; +} +//============================================================================= +void HOMARD_Hypothesis::AddGroup( const char* Group) +{ +// On commence par supprimer le groupe au cas ou il aurait deja ete insere +// Cela peut se produire dans un schema YACS quand on repasse plusieurs fois par la +// definition de l'hypothese + SupprGroup( Group ) ; +// Insertion veritable + _ListGroupSelected.push_back(Group); +} +//============================================================================= +void HOMARD_Hypothesis::SupprGroup( const char* Group ) +{ + MESSAGE ("SupprGroup pour "<::iterator it = find( _ListGroupSelected.begin(), _ListGroupSelected.end(), Group ); + if ( it != _ListGroupSelected.end() ) { it = _ListGroupSelected.erase( it ); } +} +//============================================================================= +void HOMARD_Hypothesis::SupprGroups() +{ + _ListGroupSelected.clear(); +} +//============================================================================= +void HOMARD_Hypothesis::SetGroups( const std::list& ListGroup ) +{ + _ListGroupSelected.clear(); + std::list::const_iterator it = ListGroup.begin(); + while(it != ListGroup.end()) + _ListGroupSelected.push_back((*it++)); +} +//============================================================================= +const std::list& HOMARD_Hypothesis::GetGroups() const +{ + return _ListGroupSelected; +} +//============================================================================= +// Type d'interpolation des champs : +// 0 : aucun champ n'est interpole +// 1 : tous les champs sont interpoles +// 2 : certains champs sont interpoles +void HOMARD_Hypothesis::SetTypeFieldInterp( int TypeFieldInterp ) +{ + VERIFICATION( (TypeFieldInterp>=0) && (TypeFieldInterp<=2) ); + _TypeFieldInterp = TypeFieldInterp; +} +//============================================================================= +int HOMARD_Hypothesis::GetTypeFieldInterp() const +{ + return _TypeFieldInterp; +} +//============================================================================= +void HOMARD_Hypothesis::AddFieldInterpType( const char* FieldInterp, int TypeInterp ) +{ + MESSAGE ("Dans AddFieldInterpType pour " << FieldInterp << " et TypeInterp = " << TypeInterp) ; +// On commence par supprimer le champ au cas ou il aurait deja ete insere +// Cela peut se produire dans un schema YACS quand on repasse plusieurs fois par la +// definition de l'hypothese + SupprFieldInterp( FieldInterp ) ; +// Insertion veritable +// . Nom du champ + _ListFieldInterp.push_back( std::string( FieldInterp ) ); +// . Usage du champ + std::stringstream saux1 ; + saux1 << TypeInterp ; + _ListFieldInterp.push_back( saux1.str() ); +// . Indication generale : certains champs sont a interpoler + SetTypeFieldInterp ( 2 ) ; +} +//============================================================================= +void HOMARD_Hypothesis::SupprFieldInterp( const char* FieldInterp ) +{ + MESSAGE ("Dans SupprFieldInterp pour " << FieldInterp) ; + std::list::iterator it = find( _ListFieldInterp.begin(), _ListFieldInterp.end(), FieldInterp ) ; +// Attention a supprimer le nom du champ et le type d'usage + if ( it != _ListFieldInterp.end() ) + { + it = _ListFieldInterp.erase( it ) ; + it = _ListFieldInterp.erase( it ) ; + } +// Decompte du nombre de champs restant a interpoler + it = _ListFieldInterp.begin() ; + int cpt = 0 ; + while(it != _ListFieldInterp.end()) + { + cpt += 1 ; + (*it++); + } + MESSAGE("Nombre de champ restants = "<& HOMARD_Hypothesis::GetFieldInterps() const +{ + return _ListFieldInterp; +} +//============================================================================= +//============================================================================= +// Liens avec les autres structures +//============================================================================= +//============================================================================= +void HOMARD_Hypothesis::SetCaseCreation( const char* NomCasCreation ) +{ + _NomCasCreation = std::string( NomCasCreation ); +} +//============================================================================= +std::string HOMARD_Hypothesis::GetCaseCreation() const +{ + return _NomCasCreation; +} +//============================================================================= +void HOMARD_Hypothesis::LinkIteration( const char* NomIteration ) +{ + _ListIter.push_back( std::string( NomIteration ) ); +} +//============================================================================= +void HOMARD_Hypothesis::UnLinkIteration( const char* NomIteration ) +{ + std::list::iterator it = find( _ListIter.begin(), _ListIter.end(), NomIteration ) ; + if ( it != _ListIter.end() ) + { + MESSAGE ("Dans UnLinkIteration pour " << NomIteration) ; + it = _ListIter.erase( it ) ; + } +} +//============================================================================= +void HOMARD_Hypothesis::UnLinkIterations() +{ + _ListIter.clear(); +} +//============================================================================= +const std::list& HOMARD_Hypothesis::GetIterations() const +{ + return _ListIter; +} +//============================================================================= +void HOMARD_Hypothesis::AddZone( const char* NomZone, int TypeUse ) +{ + MESSAGE ("Dans AddZone pour " << NomZone << " et TypeUse = " << TypeUse) ; +// On commence par supprimer la zone au cas ou elle aurait deja ete inseree +// Cela peut se produire dans un schema YACS quand on repasse plusieurs fois par la +// definition de l'hypothese + SupprZone( NomZone ) ; +// Insertion veritable +// . Nom de la zone + _ListZone.push_back( std::string( NomZone ) ); +// . Usage de la zone + std::stringstream saux1 ; + saux1 << TypeUse ; + _ListZone.push_back( saux1.str() ); +} +//============================================================================= +void HOMARD_Hypothesis::SupprZone( const char* NomZone ) +{ + MESSAGE ("Dans SupprZone pour " << NomZone) ; + std::list::iterator it = find( _ListZone.begin(), _ListZone.end(), NomZone ); +// Attention a supprimer le nom de zone et le type d'usage + if ( it != _ListZone.end() ) + { + it = _ListZone.erase( it ); + it = _ListZone.erase( it ); + } +} +//============================================================================= +void HOMARD_Hypothesis::SupprZones() +{ + _ListZone.clear(); +} +//============================================================================= +const std::list& HOMARD_Hypothesis::GetZones() const +{ + return _ListZone; +} + +//============================================================================= +/*! + * default constructor: + */ +//============================================================================= +HOMARD_Iteration::HOMARD_Iteration(): + _Name( "" ), _Etat( 0 ), + _NumIter( -1 ), + _NomMesh( "" ), _MeshFile( "" ), + _FieldFile( "" ), _TimeStep( -1 ), _Rank( -1 ), + _LogFile( "" ), + _IterParent( "" ), + _NomHypo( "" ), _NomCas( "" ), _NomDir( "" ), + _FileInfo( "" ), + _MessInfo( 1 ) +{ + MESSAGE("HOMARD_Iteration"); +} +//============================================================================= +/*! + * + */ +//============================================================================= +HOMARD_Iteration::~HOMARD_Iteration() +{ + MESSAGE("~HOMARD_Iteration"); +} +//============================================================================= +//============================================================================= +// Generalites +//============================================================================= +//============================================================================= +void HOMARD_Iteration::SetName( const char* Name ) +{ + _Name = std::string( Name ); +} +//============================================================================= +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 +//============================================================================= +//============================================================================= +void HOMARD_Iteration::SetDirNameLoc( const char* NomDir ) +{ + _NomDir = std::string( NomDir ); +} +//============================================================================= +std::string HOMARD_Iteration::GetDirNameLoc() const +{ + return _NomDir; +} +//============================================================================= +void HOMARD_Iteration::SetNumber( int NumIter ) +{ + _NumIter = NumIter; +} +//============================================================================= +int HOMARD_Iteration::GetNumber() const +{ + return _NumIter; +} +//============================================================================= +void HOMARD_Iteration::SetState( int etat ) +{ + _Etat = etat; +} +//============================================================================= +int HOMARD_Iteration::GetState() const +{ + return _Etat; +} +//============================================================================= +void HOMARD_Iteration::SetMeshName( const char* NomMesh ) +{ + _NomMesh = std::string( NomMesh ); +} +//============================================================================= +std::string HOMARD_Iteration::GetMeshName() const +{ + return _NomMesh; +} +//============================================================================= +void HOMARD_Iteration::SetMeshFile( const char* MeshFile ) +{ + _MeshFile = std::string( MeshFile ); +} +//============================================================================= +std::string HOMARD_Iteration::GetMeshFile() const +{ + return _MeshFile; +} +//============================================================================= +void HOMARD_Iteration::SetFieldFile( const char* FieldFile ) +{ + _FieldFile = std::string( FieldFile ); +} +//============================================================================= +std::string HOMARD_Iteration::GetFieldFile() const +{ + return _FieldFile; +} +//============================================================================= +// Instants pour le champ de pilotage +//============================================================================= +void HOMARD_Iteration::SetTimeStep( int TimeStep ) +{ + _TimeStep = TimeStep; +} +//============================================================================= +void HOMARD_Iteration::SetTimeStepRank( int TimeStep, int Rank ) +{ + _TimeStep = TimeStep; + _Rank = Rank; +} +//============================================================================= +void HOMARD_Iteration::SetTimeStepRankLast() +{ + _TimeStep = -2; +} +//============================================================================= +int HOMARD_Iteration::GetTimeStep() const +{ + return _TimeStep; +} +//============================================================================= +int HOMARD_Iteration::GetRank() const +{ + return _Rank; +} +//============================================================================= +// Instants pour un champ a interpoler +//============================================================================= +void HOMARD_Iteration::SetFieldInterpTimeStep( const char* FieldInterp, int TimeStep ) +{ + SetFieldInterpTimeStepRank( FieldInterp, TimeStep, TimeStep ) ; +} +//============================================================================= +void HOMARD_Iteration::SetFieldInterpTimeStepRank( const char* FieldInterp, int TimeStep, int Rank ) +{ + MESSAGE("Champ " << FieldInterp << ", hypothese " << _NomHypo ) +// Verification de la presence du champ dans l'hypothese + std::list::iterator it = find( _ListFieldInterp.begin(), _ListFieldInterp.end(), FieldInterp ); + if ( it == _ListFieldInterp.end() ) + { + INFOS("Champ " << FieldInterp << " ; hypothese " << _NomHypo ) + VERIFICATION("Le champ est inconnu dans l'hypothese associee a cette iteration." == 0); + } + +// . Nom du champ + _ListFieldInterpTSR.push_back( std::string( FieldInterp ) ); +// . Pas de temps + std::stringstream saux1 ; + saux1 << TimeStep ; + _ListFieldInterpTSR.push_back( saux1.str() ); +// . Numero d'ordre + std::stringstream saux2 ; + saux2 << Rank ; + _ListFieldInterpTSR.push_back( saux2.str() ); +} +//============================================================================= +const std::list& HOMARD_Iteration::GetFieldInterpsTimeStepRank() const +{ + return _ListFieldInterpTSR; +} +//============================================================================= +void HOMARD_Iteration::SetFieldInterp( const char* FieldInterp ) +{ + _ListFieldInterp.push_back( std::string( FieldInterp ) ); +} +//============================================================================= +const std::list& HOMARD_Iteration::GetFieldInterps() const +{ + return _ListFieldInterp; +} +//============================================================================= +void HOMARD_Iteration::SupprFieldInterps() +{ + _ListFieldInterp.clear(); +} +//============================================================================= +void HOMARD_Iteration::SetLogFile( const char* LogFile ) +{ + _LogFile = std::string( LogFile ); +} +//============================================================================= +std::string HOMARD_Iteration::GetLogFile() const +{ + return _LogFile; +} +//============================================================================= +void HOMARD_Iteration::SetFileInfo( const char* FileInfo ) +{ + _FileInfo = std::string( FileInfo ); +} +//============================================================================= +std::string HOMARD_Iteration::GetFileInfo() const +{ + return _FileInfo; +} +//============================================================================= +//============================================================================= +// Liens avec les autres iterations +//============================================================================= +//============================================================================= +void HOMARD_Iteration::LinkNextIteration( const char* NomIteration ) +{ + _mesIterFilles.push_back( std::string( NomIteration ) ); +} +//============================================================================= +void HOMARD_Iteration::UnLinkNextIteration( const char* NomIteration ) +{ + std::list::iterator it = find( _mesIterFilles.begin(), _mesIterFilles.end(), NomIteration ) ; + if ( it != _mesIterFilles.end() ) + { + MESSAGE ("Dans UnLinkNextIteration pour " << NomIteration) ; + it = _mesIterFilles.erase( it ) ; + } +} +//============================================================================= +void HOMARD_Iteration::UnLinkNextIterations() +{ + _mesIterFilles.clear(); +} +//============================================================================= +const std::list& HOMARD_Iteration::GetIterations() const +{ + return _mesIterFilles; +} +//============================================================================= +void HOMARD_Iteration::SetIterParentName( const char* IterParent ) +{ + _IterParent = IterParent; +} +//============================================================================= +std::string HOMARD_Iteration::GetIterParentName() const +{ + return _IterParent; +} +//============================================================================= +//============================================================================= +// Liens avec les autres structures +//============================================================================= +//============================================================================= +void HOMARD_Iteration::SetCaseName( const char* NomCas ) +{ + _NomCas = std::string( NomCas ); +} +//============================================================================= +std::string HOMARD_Iteration::GetCaseName() const +{ + return _NomCas; +} +//============================================================================= +void HOMARD_Iteration::SetHypoName( const char* NomHypo ) +{ + _NomHypo = std::string( NomHypo ); +} +//============================================================================= +std::string HOMARD_Iteration::GetHypoName() const +{ + return _NomHypo; +} +//============================================================================= +//============================================================================= +// Divers +//============================================================================= +//============================================================================= +void HOMARD_Iteration::SetInfoCompute( int MessInfo ) +{ + _MessInfo = MessInfo; +} +//============================================================================= +int HOMARD_Iteration::GetInfoCompute() const +{ + return _MessInfo; +} + +} // namespace SMESHHOMARDImpl /end/ diff --git a/src/SMESH/SMESH_Homard.hxx b/src/SMESH/SMESH_Homard.hxx new file mode 100644 index 000000000..d983675c8 --- /dev/null +++ b/src/SMESH/SMESH_Homard.hxx @@ -0,0 +1,491 @@ +// HOMARD HOMARD : implementation of HOMARD idl descriptions +// +// Copyright (C) 2011-2021 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : HOMARD.hxx +// Author : Gerald NICOLAS, EDF +// Module : HOMARD + +#ifndef _SMESH_HOMARD_ADAPT_HXX_ +#define _SMESH_HOMARD_ADAPT_HXX_ + +// C'est le ASSERT de SALOMELocalTrace/utilities.h dans KERNEL +#ifndef VERIFICATION +#define VERIFICATION(condition) \ + if (!(condition)){INTERRUPTION("CONDITION "<<#condition<<" NOT VERIFIED")} +#endif /* VERIFICATION */ + +#ifdef WIN32 + #if defined HOMARDIMPL_EXPORTS || defined HOMARDImpl_EXPORTS + #define HOMARDIMPL_EXPORT __declspec( dllexport ) + #else + #define HOMARDIMPL_EXPORT __declspec( dllimport ) + #endif +#else + #define HOMARDIMPL_EXPORT +#endif + +// La gestion des repertoires +#ifndef CHDIR + #ifdef WIN32 + #define CHDIR _chdir + #else + #define CHDIR chdir + #endif +#endif + +#include +#include +#include + +#include +#include + +#if defined WIN32 +#pragma warning ( disable: 4251 ) +#endif + +namespace SMESHHOMARDImpl +{ + +class HOMARDIMPL_EXPORT HOMARD_Boundary +{ +public: + HOMARD_Boundary(); + ~HOMARD_Boundary(); + +// Generalites + void SetName( const char* Name ); + std::string GetName() const; + + std::string GetDumpPython() const; + +// Caracteristiques + void SetType( int Type ); + int GetType() const; + + void SetMeshName( const char* MeshName ); + std::string GetMeshName() const; + + void SetDataFile( const char* DataFile ); + std::string GetDataFile() const; + + void SetCylinder( double X0, double X1, double X2, double X3, + double X4, double X5, double X6 ); + void SetSphere( double X0, double X1, double X2, double X3 ); + 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, + double Xcentre, double Ycentre, double ZCentre); + void SetTorus( double X0, double X1, double X2, double X3, + double X4, double X5, double X6, double X7 ); + + std::vector GetCoords() const; + + void SetLimit( double X0, double X1, double X2 ); + std::vector GetLimit() const; + + void AddGroup( const char* LeGroupe); + void SetGroups(const std::list& ListGroup ); + const std::list& GetGroups() const; + +// Liens avec les autres structures + std::string GetCaseCreation() const; + void SetCaseCreation( const char* NomCasCreation ); + +private: + std::string _Name; + std::string _NomCasCreation; + std::string _DataFile; + std::string _MeshName; + int _Type; + double _Xmin, _Xmax, _Ymin, _Ymax, _Zmin, _Zmax; + double _Xaxe, _Yaxe, _Zaxe; + double _Xcentre, _Ycentre, _Zcentre, _rayon; + double _Xincr, _Yincr, _Zincr; + double _Xcentre1, _Ycentre1, _Zcentre1, _Rayon1; + double _Xcentre2, _Ycentre2, _Zcentre2, _Rayon2; + double _Angle; + + std::list _ListGroupSelected; + +}; + +class HOMARDIMPL_EXPORT HOMARD_Cas +{ +public: + HOMARD_Cas(); + ~HOMARD_Cas(); + +// Generalites + void SetName( const char* Name ); + std::string GetName() const; + + std::string GetDumpPython() const; + +// Caracteristiques + int SetDirName( const char* NomDir ); + std::string GetDirName() const; + + int GetNumberofIter(); + + 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; + + void AddGroup( const char* Group); + void SetGroups( const std::list& ListGroup ); + const std::list& GetGroups() const; + void SupprGroups(); + + void AddBoundary( const char* Boundary ); + void AddBoundaryGroup( const char* Boundary, const char* Group ); + const std::list& GetBoundaryGroup() const; + void SupprBoundaryGroup(); + + void SetPyram( int Pyram ); + const int GetPyram() const; + +// Liens avec les autres structures + std::string GetIter0Name() const; + + void AddIteration( const char* NomIteration ); + const std::list& GetIterations() const; + void SupprIterations(); + +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; +}; + +class HOMARDIMPL_EXPORT HomardDriver +{ +public: + HomardDriver(const std::string siter, const std::string siterp1); + ~HomardDriver(); + // + void TexteInit( const std::string DirCompute, const std::string LogFile, const std::string Langue ); + void TexteInfo( int TypeBila, int NumeIter ); + void TexteMajCoords( int NumeIter ); + void CreeFichierDonn(); + void TexteAdap( int ExtType ); + 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 ); + void TexteConfRaffDera( int ConfType, int TypeAdap, int TypeRaff, int TypeDera ); + void TexteZone( int NumeZone, int ZoneType, int TypeUse, double x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8 ); + void TexteGroup( const std::string GroupName ); + void TexteField( const std::string FieldName, const std::string FieldFile, + int TimeStep, int Rank, + int TypeThR, double ThreshR, int TypeThC, double ThreshC, + int UsField, int UsCmpI ); + void TexteCompo( int NumeComp, const std::string NomCompo); + + void TexteBoundaryOption( int BoundaryOption ); + void TexteBoundaryCAOGr( const std::string GroupName ); + void TexteBoundaryDi( const std::string MeshName, const std::string MeshFile ); + void TexteBoundaryDiGr( const std::string GroupName ); + void TexteBoundaryAn( const std::string NameBoundary, int NumeBoundary, int BoundaryType, double x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7 ); + void TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName ); + + 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 TexteInfoCompute( int MessInfo ); + // + int ExecuteHomard(int option); + // + +public: + int _modeHOMARD; + std::string _HOMARD_Exec; + std::string _NomDir; + std::string _NomFichierConfBase; + std::string _NomFichierConf; + std::string _NomFichierDonn; + std::string _siter; + std::string _siterp1; + std::string _Texte; + int _TimeStep; + int _Rank; + bool _bLu; +}; + +class HOMARD_Iteration; +class HOMARD_Hypothesis; + + //! persistence entity type + typedef enum { Case, Zone, Hypothesis, Iteration, Boundary } SignatureType; + + //! get persistence signature + HOMARDIMPL_EXPORT std::string GetSignature( SignatureType type ); + + //! get data separator + HOMARDIMPL_EXPORT std::string separator(); + + //! dump boundary to the string + HOMARDIMPL_EXPORT std::string Dump( const SMESHHOMARDImpl::HOMARD_Boundary& boundary ); + //! dump case to the string + HOMARDIMPL_EXPORT std::string Dump( const SMESHHOMARDImpl::HOMARD_Cas& cas ); + //! dump iteration to the string + HOMARDIMPL_EXPORT std::string Dump( const SMESHHOMARDImpl::HOMARD_Iteration& iteration ); + //! dump hypothesis to the string + HOMARDIMPL_EXPORT std::string Dump( const SMESHHOMARDImpl::HOMARD_Hypothesis& hypothesis ); + + //! restore boundary from the string + HOMARDIMPL_EXPORT bool Restore( SMESHHOMARDImpl::HOMARD_Boundary& boundary, const std::string& stream ); + //! restore case from the string + HOMARDIMPL_EXPORT bool Restore( SMESHHOMARDImpl::HOMARD_Cas& cas, const std::string& stream ); + //! restore hypothesis from the string + HOMARDIMPL_EXPORT bool Restore( SMESHHOMARDImpl::HOMARD_Hypothesis& hypothesis, const std::string& stream ); + //! restore iteration from the string + HOMARDIMPL_EXPORT bool Restore( SMESHHOMARDImpl::HOMARD_Iteration& iteration, const std::string& stream ); + +class HOMARDIMPL_EXPORT HOMARD_Gen +{ +public : + HOMARD_Gen(); + ~HOMARD_Gen(); +}; + +class HOMARDIMPL_EXPORT HOMARD_Hypothesis +{ +public: + HOMARD_Hypothesis(); + ~HOMARD_Hypothesis(); + +// Generalites + void SetName( const char* Name ); + std::string GetName() const; + + std::string GetDumpPython() const; + +// Caracteristiques + void SetAdapType( int TypeAdap ); + int GetAdapType() const; + void SetRefinTypeDera( int TypeRaff, int TypeDera ); + int GetRefinType() const; + int GetUnRefType() const; + + void SetField( const char* FieldName ); + std::string GetFieldName() const; + void SetUseField( int UsField ); + int GetUseField() const; + + void SetUseComp( int UsCmpI ); + int GetUseComp() const; + void AddComp( const char* NomComp ); + void SupprComp( const char* NomComp ); + void SupprComps(); + const std::list& GetComps() const; + + void SetRefinThr( int TypeThR, double ThreshR ); + int GetRefinThrType() const; + double GetThreshR() const; + void SetUnRefThr( int TypeThC, double ThreshC ); + int GetUnRefThrType() const; + double GetThreshC() const; + + void SetNivMax( int NivMax ); + const int GetNivMax() const; + + void SetDiamMin( double DiamMin ); + const double GetDiamMin() const; + + void SetAdapInit( int AdapInit ); + const int GetAdapInit() const; + + void SetExtraOutput( int ExtraOutput ); + const int GetExtraOutput() const; + + void AddGroup( const char* Group); + void SupprGroup( const char* Group ); + void SupprGroups(); + void SetGroups(const std::list& ListGroup ); + const std::list& GetGroups() const; + + void SetTypeFieldInterp( int TypeFieldInterp ); + int GetTypeFieldInterp() const; + void AddFieldInterpType( const char* FieldInterp, int TypeInterp ); + void SupprFieldInterp( const char* FieldInterp ); + void SupprFieldInterps(); + const std::list& GetFieldInterps() const; + +// Liens avec les autres structures + void SetCaseCreation( const char* NomCasCreation ); + std::string GetCaseCreation() const; + + void LinkIteration( const char* NomIter ); + void UnLinkIteration( const char* NomIter ); + void UnLinkIterations(); + const std::list& GetIterations() const; + + void AddZone( const char* NomZone, int TypeUse ); + void SupprZone( const char* NomZone ); + void SupprZones(); + const std::list& GetZones() const; + +private: + std::string _Name; + std::string _NomCasCreation; + + int _TypeAdap; // -1 pour une adapation Uniforme, + // 0 si l adaptation depend des zones, + // 1 pour des champs + + int _TypeRaff; + int _TypeDera; + + std::string _Field; + int _TypeThR; + int _TypeThC; + double _ThreshR; + double _ThreshC; + int _UsField; + int _UsCmpI; + int _TypeFieldInterp; // 0 pour aucune interpolation, + // 1 pour interpolation de tous les champs, + // 2 pour une liste + int _NivMax; + double _DiamMin; + int _AdapInit; + int _ExtraOutput; + + std::list _ListIter; + std::list _ListZone; + std::list _ListComp; + std::list _ListGroupSelected; + std::list _ListFieldInterp; +}; + +class HOMARDIMPL_EXPORT HOMARD_Iteration +{ +public: + HOMARD_Iteration(); + ~HOMARD_Iteration(); + +// Generalites + void SetName( const char* Name ); + std::string GetName() const; + + std::string GetDumpPython() const; + +// Caracteristiques + void SetDirNameLoc( const char* NomDir ); + std::string GetDirNameLoc() const; + + void SetNumber( int NumIter ); + int GetNumber() const; + + void SetState( int etat ); + int GetState() const; + + void SetMeshName( const char* NomMesh ); + std::string GetMeshName() const; + + void SetMeshFile( const char* MeshFile ); + std::string GetMeshFile() const; + + void SetFieldFile( const char* FieldFile ); + std::string GetFieldFile() const; +// Instants pour le champ de pilotage + void SetTimeStep( int TimeStep ); + void SetTimeStepRank( int TimeStep, int Rank ); + void SetTimeStepRankLast(); + int GetTimeStep() const; + int GetRank() const; +// Instants pour un champ a interpoler + void SetFieldInterpTimeStep( const char* FieldInterp, int TimeStep ); + void SetFieldInterpTimeStepRank( const char* FieldInterp, int TimeStep, int Rank ); + const std::list& GetFieldInterpsTimeStepRank() const; + void SetFieldInterp( const char* FieldInterp ); + const std::list& GetFieldInterps() const; + void SupprFieldInterps(); + + void SetLogFile( const char* LogFile ); + std::string GetLogFile() const; + + void SetFileInfo( const char* FileInfo ); + std::string GetFileInfo() const; + +// Liens avec les autres iterations + void LinkNextIteration( const char* NomIteration ); + void UnLinkNextIteration( const char* NomIteration ); + void UnLinkNextIterations(); + const std::list& GetIterations() const; + + void SetIterParentName( const char* iterParent ); + std::string GetIterParentName() const; + +// Liens avec les autres structures + void SetCaseName( const char* NomCas ); + std::string GetCaseName() const; + + void SetHypoName( const char* NomHypo ); + std::string GetHypoName() const; + +// Divers + void SetInfoCompute( int MessInfo ); + int GetInfoCompute() const; + +private: + std::string _Name; + int _Etat; + int _NumIter; + std::string _NomMesh; + std::string _MeshFile; + std::string _FieldFile; + int _TimeStep; + int _Rank; + std::string _LogFile; + std::string _IterParent; + std::string _NomHypo; + std::string _NomCas; + std::string _NomDir; + std::list _mesIterFilles; + std::string _FileInfo; + int _MessInfo; + // La liste des champs retenus par l'hypothese + std::list _ListFieldInterp; + // La liste des triplets (champs, pas de temps, numero d'ordre) retenus par l'iteration + std::list _ListFieldInterpTSR; +}; + +}; // namespace SMESHHOMARDImpl + +#endif diff --git a/src/SMESHGUI/CMakeLists.txt b/src/SMESHGUI/CMakeLists.txt index 587ee89bd..267188814 100644 --- a/src/SMESHGUI/CMakeLists.txt +++ b/src/SMESHGUI/CMakeLists.txt @@ -150,6 +150,9 @@ SET(_moc_HEADERS SMESHGUI_PreVisualObj.h SMESHGUI_MG_ADAPTDRIVER.h SMESHGUI_MgAdaptDlg.h + SMESHGUI_HomardAdaptDlg.h + SMESHGUI_HomardBoundaryDlg.h + SMESHGUI_HomardListGroup.h ) # header files / no moc processing @@ -172,6 +175,7 @@ SET(_other_HEADERS SMESHGUI_FileValidator.h SMESHGUI_SelectionProxy.h SMESH_SMESHGUI.hxx + SMESHGUI_HomardUtils.h ) # header files / to install @@ -267,6 +271,10 @@ SET(_other_SOURCES SMESHGUI_IdPreview.cxx SMESHGUI_MG_ADAPTDRIVER.cxx SMESHGUI_MgAdaptDlg.cxx + SMESHGUI_HomardUtils.cxx + SMESHGUI_HomardAdaptDlg.cxx + SMESHGUI_HomardBoundaryDlg.cxx + SMESHGUI_HomardListGroup.cxx ) # sources / to compile @@ -280,6 +288,9 @@ SET(_ts_RESOURCES SMESH_msg_en.ts SMESH_msg_fr.ts SMESH_msg_ja.ts + HOMARD_msg_en.ts + HOMARD_msg_fr.ts + HOMARD_msg_ja.ts ) # --- rules --- diff --git a/src/SMESHGUI/HOMARD_msg_en.ts b/src/SMESHGUI/HOMARD_msg_en.ts new file mode 100644 index 000000000..dd267228a --- /dev/null +++ b/src/SMESHGUI/HOMARD_msg_en.ts @@ -0,0 +1,271 @@ + + + + + @default + + ADAPT_WITH_HOMARD + Adaptation with HOMARD + + + HOM_WARNING + Warning + + + HOM_ERROR + Error + + + HOM_INACTIVE_BUTTON + Inactive button + + + HOM_SELECT_OBJECT_1 + Select an object. + + + HOM_SELECT_OBJECT_2 + Select only one object. + + + HOM_SELECT_OBJECT_3 + Select an object with type %1. + + + HOM_SELECT_OBJECT_4 + The name of the object is already selected. Modify it or cancel. + + + HOM_SELECT_FILE_0 + File selection + + + HOM_SELECT_FILE_1 + Select a file. + + + HOM_SELECT_FILE_2 + Select only one file. + + + HOM_SELECT_FILE_3 + This file cannot be opened. + + + HOM_SCRIPT_FILE + A script file must be given. + + + HOM_MED_FILE_1 + This MED file cannot be read. + + + HOM_MED_FILE_2 + No mesh in this MED file. + + + HOM_MED_FILE_3 + More than one mesh in this MED file. + + + 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. + + + HOM_CASE_NAME + The case must be named. + + + HOM_CASE_DIRECTORY_1 + A directory for the case must be selected. + + + HOM_CASE_DIRECTORY_2 + This directory is already used by the case + + + HOM_CASE_DIRECTORY_3 + A valid directory for the case must be selected. + + + HOM_CASE_DIRECTORY_4 + A directory for the computation must be selected. + + + HOM_START_DIRECTORY_1 + A starting directory for the pursuit must be selected. + + + HOM_START_DIRECTORY_3 + A valid directory for the pursuit must be selected. + + + HOM_CASE_MESH + The file of the initial mesh must be selected. + + + HOM_CASE_GROUP + The group "%1" cannot be given for more than 1 boundary. + + + HOM_CASE_EDIT_WINDOW_TITLE + Edition of a case + + + HOM_CASE_EDIT_STATE_0 + Initial mesh. + + + HOM_CASE_EDIT_STATE + Pursuit of an iteration. + + + HOM_CASE_PURSUE_WINDOW_TITLE + Case: pursuit of a stored iteration + + + HOM_ITER_NAME + The iteration must be named. + + + HOM_ITER_STARTING_POINT + The previous iteration must be given. + + + HOM_ITER_MESH + Give a name for the final mesh. + + + 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 + + + HOM_ITER_STARTING_POINT_1 + First iteration of the case. + + + HOM_ITER_STARTING_POINT_2 + First iteration of the case for the pursuit. + + + HOM_ITER_EDIT_WINDOW_TITLE + Edition of an iteration + + + 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 + + + HOM_HYPO_NORM_INF + Infinite norm + + + HOM_HYPO_NORM_ABS + Absolute + + + HOM_HYPO_NORM_REL + Relative + + + HOM_HYPO_COMP + At least, one component must be selected. + + + HOM_HYPO_EDIT_WINDOW_TITLE + Edition of a hypothesis + + + HOM_BOUN_NAME + The boundary must be named. + + + HOM_BOUN_MESH + The file for the mesh of the boundary must be selected. + + + HOM_BOUN_CAO + The file for the CAO must be selected. + + + HOM_BOUN_CASE + The meshfile of the case is unknown. + + + HOM_AXE + The axis must be a non 0 vector. + + + HOM_BOUN_C_EDIT_WINDOW_TITLE + Edition of a CAO based boundary + + + HOM_BOUN_A_EDIT_WINDOW_TITLE + Edition of an analytical boundary + + + HOM_BOUN_D_EDIT_WINDOW_TITLE + Edition of a discrete boundary + + + HOM_GROU_EDIT_WINDOW_TITLE + Selected groups + + + HOM_MESH_INFO_0 + Mesh analysis + + + HOM_MESH_INFO_1 + Select at least one option. + + + HOM_MESH_INFO_2 + Analysis in the object browser, file + + + PREF_TAB_GENERAL + General + + + PREF_PUBLICATION + Publication + + + PREF_PUBLICATION_MAILLAGE_IN + IN meshes + + + PREF_PUBLICATION_MAILLAGE_OUT + OUT meshes + + + diff --git a/src/SMESHGUI/HOMARD_msg_fr.ts b/src/SMESHGUI/HOMARD_msg_fr.ts new file mode 100644 index 000000000..ffe28e3cb --- /dev/null +++ b/src/SMESHGUI/HOMARD_msg_fr.ts @@ -0,0 +1,947 @@ + + + + + @default + + HOM_WARNING + Avertissement + + + HOM_ERROR + Erreur + + + HOM_INACTIVE_BUTTON + Bouton inactif + + + OK + Appliquer et fermer + + + Apply + Appliquer + + + Cancel + Annuler + + + Help + Aide + + + New + Nouveau + + + Edit + Editer + + + Quit + Quitter + + + Name + Nom + + + Directory + Répertoire + + + Mesh + Maillage + + + Selection + Sélection + + + None + Aucun + + + All + Tout + + + HOM_SELECT_OBJECT_1 + Sélectionner un objet. + + + HOM_SELECT_OBJECT_2 + Sélectionner un seul objet. + + + HOM_SELECT_OBJECT_3 + Sélectionner un objet de type %1. + + + HOM_SELECT_OBJECT_4 + Le nom est déjà choisi. Modifiez le ou annulez la saisie. + + + HOM_SELECT_FILE_0 + Choix de fichier + + + HOM_SELECT_FILE_1 + Sélectionner un fichier. + + + HOM_SELECT_FILE_2 + Sélectionner un seul fichier. + + + HOM_SELECT_FILE_3 + Impossible d'ouvrir ce fichier. + + + HOM_SCRIPT_FILE + Il faut donner un fichier pour le script python. + + + HOM_MED_FILE_1 + Ce fichier MED est illisible. + + + HOM_MED_FILE_2 + Ce fichier MED ne contient aucun maillage. + + + HOM_MED_FILE_3 + Ce fichier MED contient plus d'un maillage. + + + 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. + + + HOM_CASE_DIRECTORY_4 + Il faut choisir un répertoire de travail pour le calcul. + + + HOM_START_DIRECTORY_1 + Il faut choisir un répertoire contenant l'itération à poursuivre. + + + HOM_START_DIRECTORY_3 + Un répertoire valide contenant l'itération à poursuivre doit être choisi. + + + HOM_CASE_MESH + Il faut choisir le maillage initial. + + + HOM_CASE_GROUP + Le groupe "%1" ne peut pas être attribué à plus d'une frontière. + + + HOM_CASE_EDIT_WINDOW_TITLE + Edition d'un cas + + + HOM_CASE_EDIT_STATE_0 + Maillage initial. + + + HOM_CASE_EDIT_STATE + Poursuite d'une itération. + + + HOM_CASE_PURSUE_WINDOW_TITLE + Cas de poursuite d'une itération + + + The configuration file cannot be found. + Le fichier de configuration de HOMARD est introuvable. + + + The configuration file cannot be read. + Le fichier de configuration de HOMARD est illisible. + + + The HOMARD mesh file cannot be found. + Le fichier de maillage de HOMARD est introuvable. + + + HOM_ITER_NAME + Il faut donner un nom à l'itération. + + + HOM_ITER_STARTING_POINT + Il faut désigner l'itération précédente. + + + HOM_ITER_MESH + Donner le nom du maillage final. + + + 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 + + + HOM_ITER_STARTING_POINT_1 + Itération initiale du cas. + + + HOM_ITER_STARTING_POINT_2 + Itération initiale du cas pour la poursuite. + + + HOM_ITER_EDIT_WINDOW_TITLE + Edition d'une itération + + + Boundary type + Type de frontière + + + No boundary + Pas de frontière + + + Non CAO + Autre que CAO + + + Discrete boundary + Frontière discrète + + + Analytical boundary + Frontière analytique + + + Conformity type + Type de conformité + + + Conformal + Conforme + + + Non conformal + Non conforme + + + Non conformal option + Option de non conformité + + + Conformity + + Conformité + + + + Free + Libre + + + 1 hanging node per mesh + 1 noeud pendant par maille + + + 1 node per edge + 1 noeud pendant par arête + + + Advanced options + Options avancées + + + Authorized pyramids + Pyramides autorisées + + + Minimal diameter + Diamètre minimal + + + Initialization of adaptation + Initialisation de l'adaptation + + + Maximal level + Niveau maximal + + + Output of the level of refinement + Sortie du niveau de raffinement + + + Output of the qualities + Sortie des qualités + + + Output of the diameters + Sortie des diamètres + + + Output of the parents + Sortie des parents + + + Output of the neighbours + Sortie des voisins + + + Create an iteration + Création d'une itération + + + Iteration Name + Nom de l'itération + + + Previous iteration + Itération précédente + + + Invalid boundary + Frontière non valable + + + Invalid case + Cas non valable + + + Invalid case context + Cas contextuel non valable + + + Invalid hypothesis + Hypothèse non valable + + + Invalid iteration + Itération non valable + + + This boundary has already been defined. + Cette frontière est déjà définie. + + + This case has already been defined. + Ce cas est déjà défini. + + + This hypothesis has already been defined. + Cette hypothèse est déjà définie. + + + This iteration has already been defined. + Cette itération est déjà définie. + + + The parent iteration is not defined. + L'itération parent n'est pas définie. + + + Unable to create the iteration. + Impossible de créer l'itération. + + + The directory for the computation cannot be created. + Impossible de créer le répertoire pour le calcul de l'itération. + + + This iteration is the first of the case and cannot be computed. + Cette itération définit le point de départ du cas. Elle ne peut pas être calculée. + + + This iteration does not have any associated hypothesis. + Cette itération n'est associée à aucune hypothèse. + + + The mesh file does not exist. + Le fichier du maillage n'existe pas. + + + The mesh file cannot be deleted. + Impossible de supprimer le fichier du maillage. + + + Mesh n + Maillage n + + + 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 + + + Hypothesis + Hypothèse + + + Create a hypothesis + Création d'une hypothèse + + + 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 + + + HOM_HYPO_NORM_INF + Norme infinie + + + HOM_HYPO_NORM_ABS + Absolu + + + HOM_HYPO_NORM_REL + Relatif + + + HOM_HYPO_COMP + Il faut choisir au moins une composante. + + + HOM_HYPO_EDIT_WINDOW_TITLE + Edition d'une hypothèse + + + Type of adaptation + Type d'adaptation + + + Uniform + Uniforme + + + Driven by a field + Pilotage par un champ + + + Uniform adaptation + Adaptation uniforme + + + Coarsening + Déraffinement + + + Refinement + Raffinement + + + 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 + + + Component + Composante + + + Refinement threshold + Seuil de raffinement + + + Coarsening threshold + Seuil de déraffinement + + + Percentage of meshes + Pourcentage de mailles + + + Mean + n*(std deviation) + Moyenne + n*(ecart-type) + + + No refinement + Sans raffinement + + + Mean - n*(std deviation) + Moyenne - n*(ecart-type) + + + No coarsening + Sans déraffinement + + + Field Interpolation + Interpolation des champs + + + Chosen + Choisi + + + Box + Boîte + + + Sphere + Sphère + + + Cylinder + Cylindre + + + Disk + Disque + + + Disk with hole + Disque avec trou + + + Pipe + Tuyau + + + Coordinates + Coordonnées + + + Get CAO + Acquisition de la CAO + + + Create an analytical boundary + Création d'une frontière analytique + + + Create a discrete boundary + Création d'une frontière discrète + + + Type of boundary + Type de la frontière + + + Torus + Tore + + + Radius + Rayon + + + Radius 1 + Rayon 1 + + + Radius 2 + Rayon 2 + + + External radius + Rayon externe + + + Internal radius + Rayon interne + + + Height + Hauteur + + + X axis + X axe + + + Y axis + Y axe + + + Z axis + Z axe + + + R revolution + R révolution + + + Primary R + R primaire + + + HOM_BOUN_NAME + Il faut donner un nom à la frontière. + + + HOM_BOUN_MESH + Il faut choisir le fichier qui contient le maillage de la frontière discrète. + + + HOM_BOUN_CAO + Il faut choisir le fichier qui contient la CAO. + + + HOM_BOUN_CASE + Le fichier du maillage du cas est inconnu. + + + HOM_AXE + L'axe doit être un vecteur non nul. + + + HOM_BOUN_C_EDIT_WINDOW_TITLE + Edition d'une frontière basée sur une CAO + + + HOM_BOUN_A_EDIT_WINDOW_TITLE + Edition d'une frontière analytique + + + HOM_BOUN_D_EDIT_WINDOW_TITLE + Edition d'une frontière discrète + + + HOM_GROU_EDIT_WINDOW_TITLE + Groupes choisis + + + The height must be positive. + La hauteur doit être positive. + + + The radius must be positive. + Un rayon doit être positif. + + + The axis must be a non 0 vector. + L'axe doit être un vecteur non nul. + + + The angle must be included higher than 0 degree and lower than 90 degrees. + L'angle doit être compris entre 0 et 90 degrés. + + + The radius must be different. + Les rayons doivent être différents. + + + The centers must be different. + Les centres doivent être différents. + + + The external radius must be higher than the internal radius. + Le rayon externe doit être supérieur au rayon interne. + + + The X coordinates are not coherent. + Les coordonnées en X ne sont pas cohérentes. + + + The Y coordinates are not coherent. + Les coordonnées en Y ne sont pas cohérentes. + + + The Z coordinates are not coherent. + Les coordonnées en Z ne sont pas cohérentes. + + + The first coordinates are not coherent. + Les premières coordonnées ne sont pas cohérentes. + + + The second coordinates are not coherent. + Les secondes coordonnées ne sont pas cohérentes. + + + The orientation must be 1, 2 or 3. + L'orientation vaut 1, 2 ou 3. + + + HOM_MESH_INFO_0 + Analyse de maillage + + + HOM_MESH_INFO_1 + Choisir au moins une option. + + + HOM_MESH_INFO_2 + Bilan de l'analyse dans l'arbre d'études, fichier + + + Filtering with groups + Filtrage par les groupes + + + Selection of groups + Choix des groupes + + + Selected groups + Groupes choisis + + + Group + Groupe + + + Information on a mesh + Analyse d'un maillage + + + Group size + Taille des domaines + + + Quality + Qualité + + + Connection + Connexité + + + Diametre + Diamètre + + + Entanglement + Interpénétration + + + No change is allowed in a boundary. Ask for evolution. + Impossible de changer une donnée dans une frontière. Demander une évolution. + + + This boundary is used in a case and cannot be deleted. + Cette frontière est utilisée dans un cas ; elle ne peut pas être détruite. + + + This hypothesis is used and cannot be deleted. + Cette hypothèse est utilisée dans une itération ; elle ne peut pas être détruite. + + + This iteration cannot be deleted. + Cette itération ne peut pas être détruite. + + + The directory for the calculation cannot be cleared. + Menage du repertoire de calcul impossible + + + Starting point + Point de départ + + + From an iteration + A partir d'une itération + + + From a case + A partir d'un cas + + + Iteration into the case + Choix d'une itération dans le cas + + + Last iteration + A partir de la dernière itération + + + Iteration number + A partir d'une itération numérotée + + + The directory of the case does not exist. + Le répertoire du cas n'existe pas. + + + The directory for the case cannot be modified because some iterations are already defined. + Impossible de changer le répertoire du cas car des itérations ont déjà été définies. + + + The directory for the case cannot be reached. + Impossible d'atteindre ce répertoire pour le cas. + + + The starting point for the case cannot be copied into the working directory. + Impossible de copier le point de départ du cas dans le répertoire de travail. + + + The starting point for the case cannot be moved into the new directory. + Impossible de déplacer le point de départ du cas dans le nouveau répertoire. + + + The directory of the case for the pursuit does not exist. + Le répertoire du cas de reprise n'existe pas. + + + The directory of the iteration does not exist. + Le répertoire de l'itération de reprise n'existe pas. + + + The number of iteration must be positive. + Le numéro de l'itération doit etre positif. + + + Number of iteration + Numéro de l'itération + + + Case + Cas + + + Mesh file + Maillage initial + + + Constant + Constant + + + Variable + Variable + + + Type of schema + Type de schema + + + Maximum of ... + Maximum de ... + + + Iterations + Itérations + + + Nodes + Noeuds + + + Elements + Eléments + + + Test of convergence + Test de convergence + + + Edit a file + Affichage d'un fichier + + + Print + Imprimer + + + Invalid study context + Etude contextuelle non valable + + + PREF_TAB_GENERAL + Général + + + PREF_PUBLICATION + Publication + + + PREF_PUBLICATION_MAILLAGE_IN + Les maillages d'entrée + + + PREF_PUBLICATION_MAILLAGE_OUT + Les maillages de sortie + + + diff --git a/src/SMESHGUI/HOMARD_msg_ja.ts b/src/SMESHGUI/HOMARD_msg_ja.ts new file mode 100644 index 000000000..bf7fe028e --- /dev/null +++ b/src/SMESHGUI/HOMARD_msg_ja.ts @@ -0,0 +1,920 @@ + + + + + @default + + HOM_WARNING + 警告 + + + HOM_ERROR + エラー + + + HOM_INACTIVE_BUTTON + アクティブでないボタン + + + OK + Ok + + + Apply + 適用 + + + Cancel + キャンセル + + + Help + ヘルプ + + + New + 新規 + + + Edit + 編集 + + + Quit + 終了 + + + Name + 名前 + + + Directory + ディレクトリ + + + Mesh + メッシュ + + + Selection + 選択 + + + None + なし + + + All + 全て + + + HOM_SELECT_OBJECT_1 + オブジェクトを選択します。 + + + HOM_SELECT_OBJECT_2 + 1 つのオブジェクトを選択します。 + + + HOM_SELECT_OBJECT_3 + 型 %1 のオブジェクトを選択します。 + + + HOM_SELECT_OBJECT_4 + The name of the object is already selected. Modify it or cancel. + + + HOM_SELECT_FILE_0 + ファイル選択 + + + HOM_SELECT_FILE_1 + ファイルを選択します。 + + + HOM_SELECT_FILE_2 + 1 つのファイルを選択します。 + + + HOM_SELECT_FILE_3 + このファイルを開くことができません。 + + + HOM_SCRIPT_FILE + 我々 は python スクリプトにファイルを与える必要があります。 + + + HOM_MED_FILE_1 + この医学ファイルは読み取り不可能です。 + + + HOM_MED_FILE_2 + この医学のファイルには、メッシュが含まれていません。 + + + HOM_MED_FILE_3 + この医学のファイルにはよりも 1 つのメッシュが含まれています。 + + + HOM_MED_FILE_4 + 音楽配信マック & ファイルのメッシュを読み取れませんでした。 + + + HOM_MED_FILE_5 + この医学のファイルには、フィールドが含まれていません。 + + + HOM_MED_FILE_6 + 医学ファイル (秒) (秒) フィールドを読み取ることができません。 + + + HOM_SELECT_STUDY + 研究医 associe + のファイルを選択または医学ファイルを選択します。 + + + Create a case + ケースの作成 + + + HOM_CASE_NAME + 場合に名前を付ける必要があります。 + + + HOM_CASE_DIRECTORY_1 + 1 つの場合を動作するようにディレクトリを選択する必要があります。 + + + HOM_CASE_DIRECTORY_2 + このディレクトリは、既に使用中です。 + + + HOM_CASE_DIRECTORY_3 + 有効なディレクトリを選択する必要があります。 + + + HOM_CASE_DIRECTORY_4 + 計算のための作業ディレクトリを選択する必要があります。 + + + HOM_START_DIRECTORY_1 + 追跡のため開始点を選択する必要があります。 + + + HOM_START_DIRECTORY_3 + 追跡のため有効な方向を選択する必要があります。 + + + HOM_CASE_MESH + 1 つは、初期のメッシュを選択する必要があります。 + + + HOM_CASE_GROUP + グループ"%1"は、以上の境界線に割り当てることはできません。 + + + HOM_CASE_EDIT_WINDOW_TITLE + 場合の編集 + + + HOM_CASE_EDIT_STATE_0 + 初期メッシュ。 + + + HOM_CASE_EDIT_STATE + イテレーションの継続。 + + + HOM_CASE_PURSUE_WINDOW_TITLE + イテレーションの追跡 + + + The configuration file cannot be found. + コンフィギュレーションファイルが見つかりません。 + + + The configuration file cannot be read. + コンフィギュレーションファイルが読み込めません。 + + + The HOMARD mesh file cannot be found. + HOMARDメッシュファイルが見つかりません。 + + + HOM_ITER_NAME + 名前を反復処理する必要があります。 + + + HOM_ITER_STARTING_POINT + これは、前のイテレーションを指定する必要があります。 + + + HOM_ITER_MESH + 最終的なメッシュの名前。 + + + HOM_ITER_HYPO + 仮説を選択します。 + + + HOM_ITER_FIELD_FILE + この前提には、ファイルのフィールドを指定する必要があります。 + + + HOM_ITER_STARTING_POINT_0 + メッシュ + + + HOM_ITER_STARTING_POINT_1 + ケースの最初のイテレーションです。 + + + HOM_ITER_STARTING_POINT_2 + 検察側の事件の最初のイテレーションです。 + + + HOM_ITER_EDIT_WINDOW_TITLE + イテレーションの編集 + + + Discrete boundary + 離散境界 + + + Analytical boundary + 解析的境界 + + + Conformity type + 適合タイプ + + + Conformal + 等角 + + + Non conformal + 非共形 + + + Non conformal option + 非共形オプション + + + Conformity + + 適合性 + + + + Free + Free + + + 1 hanging node per mesh + メッシュあたりの1接続節点 + + + 1 node per edge + エッジ辺りの1節点 + + + Advanced options + 詳細オプション + + + Authorized pyramids + 認定済みピラミッド + + + Minimal diameter + 最小径 + + + Initialization of adaptation + 適応の初期化 + + + Maximal level + 最大レベル + + + Output of the level of refinement + リファインレベルの出力 + + + Output of the qualities + 品質の出力 + + + Output of the diameters + 直径の出力 + + + Output of the parents + 親直径の出力 + + + Output of the neighbours + 隣の直径の出力 + + + Create an iteration + イテレーションの作成 + + + Iteration Name + イテレーションの名前 + + + Previous iteration + 以前のイテレーション + + + Invalid boundary + 無効な境界 + + + Invalid case + 無効なケース + + + Invalid case context + ケースの内容が無効です + + + Invalid hypothesis + 無効なhypothesis + + + Invalid iteration + 無効なイテレーション + + + This boundary has already been defined. + この境界は既に定義されています。 + + + This case has already been defined. + このケースは既に定義されています。 + + + This hypothesis has already been defined. + このhypothesisは既に定義されています。 + + + This iteration has already been defined. + このイテレーションは既に定義されています。 + + + The parent iteration is not defined. + 親イテレーションは、定義されていません。 + + + Unable to create the iteration. + イテレーションを作成することができません。 + + + The directory for the computation cannot be created. + 計算のためのディレクトリを作成できません。 + + + This iteration is the first of the case and cannot be computed. + このイタレーションはケースの最初であり、計算できません。 + + + This iteration does not have any associated hypothesis. + このイタレーションは関連した hypothesis がありません。 + + + The mesh file does not exist. + メッシュ ファイルは存在しません。 + + + The mesh file cannot be deleted. + メッシュ ファイルを削除できません。 + + + Mesh n + メッシュ n + + + Mesh n+1 + メッシュ n + 1 + + + Field information + フィールド情報 + + + Field file + フィールド ファイル + + + No time step + タイムステップなし + + + Last time step + 最終タイムステップ + + + Chosen time step + 選択されたタイムステップ + + + Time step + タイムステップ + + + Rank + ランク + + + Hypothesis + Hypothesis + + + Create a hypothesis + hypothesis の作成 + + + HOM_HYPO_NAME + 仮説に名前を付ける必要があります。 + + + HOM_HYPO_FIELD_FILE + それはフィールドのファイルを提供する必要があります。 + + + HOM_HYPO_NORM_L2 + 標準の L2 + + + HOM_HYPO_NORM_INF + 無限の標準 + + + HOM_HYPO_NORM_ABS + 絶対値 + + + HOM_HYPO_NORM_REL + 関係 + + + HOM_HYPO_COMP + 1 つ以上のコンポーネントを選択する必要があります。 + + + HOM_HYPO_EDIT_WINDOW_TITLE + 仮説の編集 + + + Type of adaptation + 適合のタイプ + + + Uniform + 均一 + + + Driven by a field + フィールドによって駆動 + + + Uniform adaptation + 均一な適応 + + + Refinement + リファインメント + + + Nothing + なし + + + File of the fields + フィールドファイル + + + Governing field for the adaptation + 適合のためにフィールドを管理 + + + Field name + フィールド名 + + + Jump between elements + 要素間ジャンプ + + + Component + コンポーネント + + + Refinement threshold + リファインメント閾値 + + + Coarsening threshold + 粗大化閾値 + + + Percentage of meshes + メッシュの割合 + + + Mean + n*(std deviation) + 平均 + n * (標準偏差) + + + No refinement + リファインメントなし + + + Mean - n*(std deviation) + 平均 - n * (標準偏差) + + + No coarsening + 粗大化なし + + + Field Interpolation + フィールド補間 + + + Chosen + 選択済み + + + Box + Box + + + Sphere + 球 + + + Cylinder + 円筒 + + + Disk + 円盤 + + + Disk with hole + 穴付き円盤 + + + Pipe + パイプ + + + Coordinates + 座標 + + + Create an analytical boundary + 分析境界の作成 + + + Create a discrete boundary + 離散境界の作成 + + + Type of boundary + 境界のタイプ + + + Torus + 環状体 + + + Radius + 半径 + + + Radius 1 + 半径1 + + + Radius 2 + 半径2 + + + External radius + 外半径 + + + Internal radius + 内半径 + + + Height + 高さ + + + X axis + X 軸 + + + Y axis + Y 軸 + + + Z axis + Z 軸 + + + R revolution + R 回転 + + + Primary R + 主 R + + + HOM_BOUN_NAME + 名前の国境に与えする必要があります。 + + + HOM_BOUN_MESH + 1 つの枠を含むメッシュを選択する必要があります。 + + + HOM_BOUN_CASE + 場合ファイルのメッシュが知られています。 + + + HOM_AXE + 軸は、ゼロ以外のベクトルでなければなりません。 + + + HOM_BOUN_A_EDIT_WINDOW_TITLE + 分析のフロンティアの編集 + + + HOM_BOUN_D_EDIT_WINDOW_TITLE + 離散境界の編集 + + + HOM_GROU_EDIT_WINDOW_TITLE + 選択したグループ + + + The height must be positive. + 高さは正でなければなりません。 + + + The radius must be positive. + 半径は正でなければなりません。 + + + The axis must be a non 0 vector. + 軸は非 0 のベクトルでなければなりません。 + + + The angle must be included higher than 0 degree and lower than 90 degrees. + 角度は0 °よりも大きく 90 °未満である必要があります。 + + + The radius must be different. + 半径が異なる必要があります。 + + + The centers must be different. + 中心が異なる必要があります。 + + + The external radius must be higher than the internal radius. + 外部の半径は内部の半径より大きい必要があります。 + + + The X coordinates are not coherent. + X座標は論理上問題があります。 + + + The Y coordinates are not coherent. + Y座標は論理上問題があります。 + + + The Z coordinates are not coherent. + Z座標は論理上問題があります。 + + + The first coordinates are not coherent. + 最初の座標に論理上問題があります。 + + + The second coordinates are not coherent. + 2番目の座標に論理上問題があります。 + + + The orientation must be 1, 2 or 3. + 方向は1、2、3のどれかにする必要があります。 + + + HOM_MESH_INFO_0 + メッシュの解析 + + + HOM_MESH_INFO_1 + 少なくとも 1 つのオプションを選択します。 + + + HOM_MESH_INFO_2 + バランス シート分析結果をスタディ ツリーで、ファイル + + + Filtering with groups + グループでフィルタリング + + + Selection of groups + グループの選択 + + + Selected groups + 選択されたグループ + + + Group + グループ : + + + Information on a mesh + メッシュに関する情報 + + + Group size + グループのサイズ + + + Quality + 品質 + + + Connection + 接続 + + + Diametre + 直径 + + + Entanglement + 縺れ合い + + + No change is allowed in a boundary. Ask for evolution. + 境界内に許可された変更はありません。旋回について尋ねます。 + + + This boundary is used in a case and cannot be deleted. + この境界はケースで使用されており、削除できません。 + + + This hypothesis is used and cannot be deleted. + このhypothesisは使用されており、削除できません。 + + + This iteration cannot be deleted. + このイテレーションは削除できません。 + + + The directory for the calculation cannot be cleared. + 計算用ディレクトリは削除できません。 + + + Starting point + 始点 + + + From an iteration + イテレーションから + + + From a case + ケースから + + + Iteration into the case + ケースへのイテレーション + + + Last iteration + 最後のイテレーション + + + Iteration number + イテレーション数 + + + The directory of the case does not exist. + ケースのディレクトリは存在しません。 + + + The directory for the case cannot be modified because some iterations are already defined. + いくつかのイテレーションが既に定義されているため、ケースのディレクトリを変更できません。 + + + The directory for the case cannot be reached. + ケースのディレクトリに到達できません。 + + + The starting point for the case cannot be copied into the working directory. + ケースの開始点は作業ディレクトリにコピーできません。 + + + The starting point for the case cannot be moved into the new directory. + ケースの開始点は新しいディレクトリに移動できません。 + + + The directory of the case for the pursuit does not exist. + 追跡用ケースのディレクトリは存在しません。 + + + The directory of the iteration does not exist. + イテレーションのディレクトリが存在しません。 + + + The number of iteration must be positive. + イテレーション数は正である必要があります。 + + + Number of iteration + イテレーション数 + + + Case + ケース + + + Mesh file + メッシュファイル + + + Constant + 定数 + + + Variable + 変数 + + + Type of schema + スキーマタイプ + + + Maximum of ... + 最大の... + + + Iterations + イテレーション + + + Nodes + 節点 + + + Elements + 要素 + + + Test of convergence + 収束テスト + + + Edit a file + ファイルの編集 + + + Print + 印刷 + + + Invalid study context + 無効なスタディの内容 + + + PREF_TAB_GENERAL + 一般的な + + + PREF_PUBLICATION + 発行 + + + PREF_PUBLICATION_MAILLAGE_IN + メッシュ入力 + + + PREF_PUBLICATION_MAILLAGE_OUT + メッシュ出力 + + + diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 531901fd1..d07a85fd4 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -61,6 +61,7 @@ #include "SMESHGUI_Hypotheses.h" #include "SMESHGUI_HypothesesUtils.h" #include "SMESHGUI_MG_ADAPTDRIVER.h" +#include "SMESHGUI_HomardAdaptDlg.h" #include "SMESHGUI_Make2DFrom3DOp.h" #include "SMESHGUI_MakeNodeAtPointDlg.h" #include "SMESHGUI_Measurements.h" @@ -145,6 +146,7 @@ #include CORBA_CLIENT_HEADER(SMESH_MeshEditor) #include CORBA_CLIENT_HEADER(SMESH_Measurements) #include CORBA_CLIENT_HEADER(SMESH_Mesh) +#include CORBA_CLIENT_HEADER(SMESH_Homard) // Qt includes // #define INCLUDE_MENUITEM_DEF // VSR commented ???????? @@ -3015,6 +3017,18 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) break; } #endif + case SMESHOp::OpHomardAdapt: + { + if ( isStudyLocked() ) + break; + EmitSignalDeactivateDialog(); + + SALOME::GenericObj_wrap< SMESHHOMARD::HOMARD_Gen > homardGen = + GetSMESHGen()->CreateHOMARD_ADAPT(); + SMESHGUI_HomardAdaptDlg *aDlg = new SMESHGUI_HomardAdaptDlg(homardGen); + aDlg->show(); + break; + } // Adaptation - end case SMESHOp::OpSplitBiQuadratic: case SMESHOp::OpConvertMeshToQuadratic: @@ -4253,6 +4267,7 @@ void SMESHGUI::initialize( CAM_Application* app ) #ifndef DISABLE_MG_ADAPT createSMESHAction( SMESHOp::OpMGAdapt, "MG_ADAPT", "ICON_MG_ADAPT" ); #endif + createSMESHAction( SMESHOp::OpHomardAdapt, "HOMARD_ADAPT", "ICON_HOMARD_ADAPT" ); // Adaptation - end createSMESHAction( SMESHOp::OpMinimumDistance, "MEASURE_MIN_DIST", "ICON_MEASURE_MIN_DIST" ); @@ -4473,6 +4488,7 @@ void SMESHGUI::initialize( CAM_Application* app ) #ifndef DISABLE_MG_ADAPT createMenu( SMESHOp::OpMGAdapt, adaptId, -1 ); #endif + createMenu( SMESHOp::OpHomardAdapt, adaptId, -1 ); // Adaptation - end createMenu( SMESHOp::OpMinimumDistance, measureId, -1 ); @@ -4623,6 +4639,7 @@ void SMESHGUI::initialize( CAM_Application* app ) int adaptTb = createTool( tr( "TB_ADAPTATION" ), QString( "SMESHAdaptationToolbar" ) ) ; createTool( SMESHOp::OpMGAdapt, adaptTb ); #endif + createTool( SMESHOp::OpHomardAdapt, adaptTb ); // Adaptation - end int measuremTb = createTool( tr( "TB_MEASUREM" ), QString( "SMESHMeasurementsToolbar" ) ) ; @@ -4706,11 +4723,12 @@ void SMESHGUI::initialize( CAM_Application* app ) createPopupItem( SMESHOp::OpCreateBoundaryElements, OB, mesh_group, "&& selcount=1 && dim>=2"); // Adaptation - begin -#ifndef DISABLE_MG_ADAPT popupMgr()->insert( separator(), -1, 0 ); +#ifndef DISABLE_MG_ADAPT createPopupItem( SMESHOp::OpMGAdapt, OB, mesh ); - popupMgr()->insert( separator(), -1, 0 ); #endif + createPopupItem( SMESHOp::OpHomardAdapt, OB, mesh ); + popupMgr()->insert( separator(), -1, 0 ); // Adaptation - end QString only_one_non_empty = QString( " && %1=1 && numberOfNodes>0" ).arg( dc ); diff --git a/src/SMESHGUI/SMESHGUI_HomardAdaptDlg.cxx b/src/SMESHGUI/SMESHGUI_HomardAdaptDlg.cxx new file mode 100644 index 000000000..e15a1bfd7 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_HomardAdaptDlg.cxx @@ -0,0 +1,1247 @@ +// Copyright (C) 2011-2021 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "SMESHGUI_HomardAdaptDlg.h" + +#include "SMESHGUI.h" +#include "SMESHGUI_HomardBoundaryDlg.h" +#include "SMESHGUI_HomardUtils.h" +#include "SMESHGUI_Utils.h" +#include "SMESHGUI_VTKUtils.h" +#include "SMESHGUI_MeshUtils.h" +#include "SMESH_TryCatch.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#ifdef WIN32 +#include +#endif + +using namespace std; + +// La gestion des repertoires +#ifndef CHDIR + #ifdef WIN32 + #define CHDIR _chdir + #else + #define CHDIR chdir + #endif +#endif + +const int SPACING = 6; // layout spacing +const int MARGIN = 9; // layout margin + +//================================================================================ +/*! + * \brief Constructor + */ +//================================================================================ +SMESHGUI_HomardAdaptDlg::SMESHGUI_HomardAdaptDlg(SMESHHOMARD::HOMARD_Gen_ptr myHomardGen0) + : QDialog(SMESHGUI::desktop()), + myWorkingDir("") +{ + MESSAGE("Debut du constructeur de SMESHGUI_HomardAdaptDlg"); + myHomardGen = SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + myHomardGen->Register(); + + setModal(false); + setAttribute( Qt::WA_DeleteOnClose, true ); + setWindowTitle( tr( "ADAPT_WITH_HOMARD" ) ); + setSizeGripEnabled( true ); + + QTabWidget* myTabWidget = new QTabWidget( this ); + + // Arguments + myArgs = new SMESHGUI_HomardAdaptArguments(myTabWidget); + + // Advanced options + myAdvOpt = new SMESHGUI_HomardAdaptAdvanced(myTabWidget); + + myTabWidget->addTab( myArgs, tr( "Args" ) ); + //myTabWidget->addTab( myAdvOpt, tr( "ADVOP" ) ); + myTabWidget->addTab( myAdvOpt, tr( "LOG_GROUP_TITLE" ) ); + + //myAdvOpt->logGroupBox ->setTitle(tr( "LOG_GROUP_TITLE" )); + myAdvOpt->workingDirectoryLabel ->setText (tr( "WORKING_DIR" )); + myAdvOpt->workingDirectoryPushButton->setText (tr( "SELECT_DIR" )); + myAdvOpt->verboseLevelLabel ->setText (tr( "VERBOSE_LEVEL" )); + myAdvOpt->logInFileCheck ->setText (tr( "LOG_IN_FILE" )); + myAdvOpt->removeLogOnSuccessCheck ->setText (tr( "REMOVE_LOG_ON_SUCCESS" )); + myAdvOpt->keepWorkingFilesCheck ->setText (tr( "KEEP_WORKING_FILES" )); + + // disable // TODO??? + myAdvOpt->logInFileCheck->setChecked(true); + myAdvOpt->removeLogOnSuccessCheck->setChecked(false); + + // Working directory + myWorkingDir = QDir::tempPath(); + char *aTmp_dir = getenv("SALOME_TMP_DIR"); + if (aTmp_dir != NULL) { + QDir aTmpDir (aTmp_dir); + if (aTmpDir.exists()) { + myWorkingDir = aTmpDir.absolutePath(); + } + } + myAdvOpt->workingDirectoryLineEdit->setText(myWorkingDir); + QFileInfo anOutMedFile (QDir(myWorkingDir), "Uniform_01_R.med"); + + // Out med file and/or mesh publication + myArgs->myOutMedFileChk->setChecked(true); + myArgs->mySelectOutMedFileLineEdit->setText(anOutMedFile.absoluteFilePath()); + myArgs->myOutPublishChk->setChecked(true); + + // buttons + QHBoxLayout* btnLayout = new QHBoxLayout; + btnLayout->setSpacing( 6 ); + btnLayout->setMargin( 0 ); + + buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), this); + buttonOk->setAutoDefault(false); + btnLayout->addWidget(buttonOk); + btnLayout->addStretch( 10 ); + + buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), this); + buttonApply->setAutoDefault(false); + btnLayout->addWidget(buttonApply); + btnLayout->addStretch( 10 ); + + buttonCancel = new QPushButton(tr( "SMESH_BUT_CANCEL" ), this); + buttonCancel->setAutoDefault(false); + btnLayout->addWidget(buttonCancel); + btnLayout->addStretch( 10 ); + + buttonHelp = new QPushButton(tr( "SMESH_BUT_HELP" ), this); + buttonHelp->setAutoDefault(false); + btnLayout->addWidget(buttonHelp); + + // dialog layout + QVBoxLayout* l = new QVBoxLayout ( this ); + l->setMargin( 9 ); + l->setSpacing( 6 ); + l->addWidget( myTabWidget ); + l->addStretch(); + l->addLayout( btnLayout ); + + // dialog name and size + /* + resize(600, 1150); + QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth()); + setSizePolicy(sizePolicy); + setMinimumSize(QSize(600, 320)); + setSizeIncrement(QSize(1, 1)); + setBaseSize(QSize(600, 320)); + setAutoFillBackground(true); + */ + + SetBoundaryNo(); + InitConnect(); + + myArgs->GBBoundaryC->setVisible(0); + myArgs->GBBoundaryN->setVisible(0); + myArgs->GBBoundaryA->setVisible(0); + myArgs->GBBoundaryD->setVisible(0); + + adjustSize(); + + //MESSAGE("Fin du constructeur de SMESHGUI_HomardAdaptDlg"); +} + +//================================================================================= +// function : ~SMESHGUI_HomardAdaptDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +SMESHGUI_HomardAdaptDlg::~SMESHGUI_HomardAdaptDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + +//================================================================================= +// function : InitConnect +// purpose : +//================================================================================= +void SMESHGUI_HomardAdaptDlg::InitConnect() +{ + connect( myArgs->mySelectInMedFileButton, SIGNAL(pressed()), this, SLOT(SetFileName())); + + connect( myArgs->RBBoundaryNo, SIGNAL(clicked()), this, SLOT(SetBoundaryNo())); + connect( myArgs->RBBoundaryCAO, SIGNAL(clicked()), this, SLOT(SetBoundaryCAO())); + connect( myArgs->RBBoundaryNonCAO, SIGNAL(clicked()), this, SLOT(SetBoundaryNonCAO())); + + connect( myArgs->PBBoundaryCAONew, SIGNAL(pressed()), this, SLOT(PushBoundaryCAONew())); + connect( myArgs->PBBoundaryCAOEdit, SIGNAL(pressed()), this, SLOT(PushBoundaryCAOEdit()) ); + connect( myArgs->PBBoundaryCAOHelp, SIGNAL(pressed()), this, SLOT(PushBoundaryCAOHelp()) ); + connect( myArgs->CBBoundaryD, SIGNAL(stateChanged(int)), this, SLOT(SetBoundaryD())); + connect( myArgs->PBBoundaryDiNew, SIGNAL(pressed()), this, SLOT(PushBoundaryDiNew())); + connect( myArgs->PBBoundaryDiEdit, SIGNAL(pressed()), this, SLOT(PushBoundaryDiEdit()) ); + connect( myArgs->PBBoundaryDiHelp, SIGNAL(pressed()), this, SLOT(PushBoundaryDiHelp()) ); + connect( myArgs->CBBoundaryA, SIGNAL(stateChanged(int)), this, SLOT(SetBoundaryA())); + connect( myArgs->PBBoundaryAnNew, SIGNAL(pressed()), this, SLOT(PushBoundaryAnNew())); + connect( myArgs->PBBoundaryAnEdit, SIGNAL(pressed()), this, SLOT(PushBoundaryAnEdit()) ); + connect( myArgs->PBBoundaryAnHelp, SIGNAL(pressed()), this, SLOT(PushBoundaryAnHelp()) ); + + connect( buttonOk, SIGNAL(pressed()), this, SLOT(PushOnOK())); + connect( buttonApply, SIGNAL(pressed()), this, SLOT(PushOnApply())); + connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close())); + connect( buttonHelp, SIGNAL(pressed()), this, SLOT(PushOnHelp())); + + connect(myArgs, SIGNAL(updateSelection()), this, SLOT(updateSelection())); + connect(myArgs, SIGNAL(toExportMED(const char*)), this, SLOT(exportMED(const char*))); +} + +//================================================================================= +// function : InitBoundarys +// purpose : Initialisation des menus avec les frontieres deja enregistrees +//================================================================================= +void SMESHGUI_HomardAdaptDlg::InitBoundarys() +{ + MESSAGE("InitBoundarys"); + // Pour les frontieres analytiques : la colonne des groupes + SMESHHOMARD::ListGroupType_var _listeGroupesCas = myCase->GetGroups(); + QTableWidgetItem *__colItem = new QTableWidgetItem(); + __colItem->setText(QApplication::translate("CreateCase", "", 0)); + myArgs->TWBoundary->setHorizontalHeaderItem(0, __colItem); + for ( int i = 0; i < (int)_listeGroupesCas->length(); i++ ) { + myArgs->TWBoundary->insertRow(i); + myArgs->TWBoundary->setItem( i, 0, new QTableWidgetItem(QString((_listeGroupesCas)[i]).trimmed())); + myArgs->TWBoundary->item( i, 0 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable ); + } + // Pour les frontieres CAO : la liste a saisir + // Pour les frontieres discretes : la liste a saisir + // Pour les frontieres analytiques : les colonnes de chaque frontiere + SMESHHOMARD::HOMARD_Boundary_var myBoundary ; + SMESHHOMARD::listeBoundarys_var mesBoundarys = myHomardGen->GetAllBoundarysName(); + //MESSAGE("Nombre de frontieres enregistrees : "<length()); + for (int i=0; i < (int)mesBoundarys->length(); i++) { + myBoundary = myHomardGen->GetBoundary(mesBoundarys[i]); + int type_obj = myBoundary->GetType() ; + if ( type_obj==-1 ) { myArgs->CBBoundaryCAO->addItem(QString(mesBoundarys[i])); } + else if ( type_obj==0 ) { myArgs->CBBoundaryDi->addItem(QString(mesBoundarys[i])); } + else { AddBoundaryAn(QString(mesBoundarys[i])); } + } + // Ajustement + myArgs->TWBoundary->resizeColumnsToContents(); + myArgs->TWBoundary->resizeRowsToContents(); + myArgs->TWBoundary->clearSelection(); +} + +//================================================================================= +// function : CheckCase +// purpose : +//================================================================================= +bool SMESHGUI_HomardAdaptDlg::CheckCase() +{ + MESSAGE("CheckCase"); + QString aCaseName = "Case_1"; + + QString aWorkingDir = myAdvOpt->workingDirectoryLineEdit->text().trimmed(); + if (aWorkingDir == QString("")) { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + 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"), + QObject::tr("HOM_CASE_DIRECTORY_3") ); + 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; + } + + // 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; + } + + // Out mesh name (initialize, if not yet) + if (myArgs->myOutMeshNameLineEdit->text().isEmpty()) { + myArgs->myOutMeshNameLineEdit->setText(aMeshName); + } + + // On verifie qu'un groupe n'est pas associe a deux frontieres differentes + if (myArgs->CBBoundaryA->isChecked()) { + 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 + 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())); + } + 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(); + 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(); + + return true; +} + +//================================================================================= +// function : PushOnApply +// purpose : +//================================================================================= +bool SMESHGUI_HomardAdaptDlg::PushOnApply() +{ + MESSAGE("PushOnApply"); + + // Check data, create Case if not yet + if (!CheckCase()) + return false; + + MESSAGE("PushOnApply: *** aaajfa *** 11"); + + // Create boundaries + if (myArgs->RBBoundaryCAO->isChecked()) { + QString monBoundaryCAOName = myArgs->CBBoundaryCAO->currentText(); + if (monBoundaryCAOName != "" ) { + myCase->AddBoundary(monBoundaryCAOName.toStdString().c_str()); + } + } + if (myArgs->CBBoundaryD->isChecked()) { + QString monBoundaryDiName = myArgs->CBBoundaryDi->currentText(); + if (monBoundaryDiName != "" ) { + myCase->AddBoundary(monBoundaryDiName.toStdString().c_str()); + } + } + if (myArgs->CBBoundaryA->isChecked()) { + 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 + NomGroup = QString(myArgs->TWBoundary->item(row, 0)->text()) ; + // Nom de la frontiere + QTableWidgetItem *__colItem = new QTableWidgetItem(); + __colItem = myArgs->TWBoundary->horizontalHeaderItem(col); + myCase->AddBoundaryGroup(QString(__colItem->text()).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 + 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"); + anOutMed = aFileInfo.absoluteFilePath(); + // show it + myArgs->mySelectOutMedFileLineEdit->setText(anOutMed); + } + else { + QFileInfo aFileInfo (anOutMed); + anOutMed = aFileInfo.absoluteFilePath(); + } + myIteration->SetMeshFile(anOutMed.toStdString().c_str()); + } + // 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 anOutLog = aFileInfo.absoluteFilePath(); + MESSAGE("myIteration->SetLogFile(" << anOutLog.toStdString().c_str() << ")"); + myIteration->SetLogFile(anOutLog.toStdString().c_str()); + MESSAGE("myIteration->GetLogFile() = " << myIteration->GetLogFile()); + } + MESSAGE("PushOnApply: *** aaajfa *** 14"); + + // 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; + } + catch( SALOME::SALOME_Exception& S_ex ) { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr(CORBA::string_dup(S_ex.details.text)) ); + 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) + 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(); + } + 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); + + 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; +} + +//================================================================================= +// function : PushOnOK +// purpose : +//================================================================================= +void SMESHGUI_HomardAdaptDlg::PushOnOK() +{ + bool bOK = PushOnApply(); + if ( bOK ) this->close(); +} + +void SMESHGUI_HomardAdaptDlg::PushOnHelp() +{ + //SMESH::ShowHelpFile(QString("gui_create_case.html")); + SMESH::ShowHelpFile("adaptation.html#_homard_adapt_anchor"); +} + +void SMESHGUI_HomardAdaptDlg::updateSelection() +{ + LightApp_SelectionMgr *selMgr = SMESHGUI::selectionMgr(); + 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() )); + selectionChanged(); + } + +} +void SMESHGUI_HomardAdaptDlg::selectionChanged() +{ + LightApp_SelectionMgr *selMgr = SMESHGUI::selectionMgr(); + + //~ 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; + } + 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")); + } +} + +void SMESHGUI_HomardAdaptDlg::setMyMesh(SMESH::SMESH_Mesh_var mesh) +{ + myMesh = mesh; +} + +SMESH::SMESH_Mesh_var SMESHGUI_HomardAdaptDlg::getMyMesh() +{ + return myMesh; +} + +void SMESHGUI_HomardAdaptDlg::SetFileName() +{ + // Input med file + QString fileName0 = myArgs->mySelectInMedFileLineEdit->text().trimmed(); + QString fileName = SMESH_HOMARD_QT_COMMUN::PushNomFichier(false, QString("med")); + if (fileName.isEmpty()) { + fileName = fileName0; + if (fileName.isEmpty()) return; + } + QFileInfo aFileInfo (fileName); + fileName = aFileInfo.absoluteFilePath(); + myArgs->mySelectInMedFileLineEdit->setText(fileName); + + // 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); + } + + // Check data + CheckCase(); +} + +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::SetBoundaryNo() +{ + myArgs->GBBoundaryC->setVisible(0); + myArgs->GBBoundaryN->setVisible(0); + adjustSize(); +} + +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::SetBoundaryCAO() +{ + myArgs->GBBoundaryC->setVisible(1); + myArgs->GBBoundaryN->setVisible(0); + adjustSize(); +} +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::SetBoundaryNonCAO() +{ + myArgs->GBBoundaryC->setVisible(0); + myArgs->GBBoundaryN->setVisible(1); + adjustSize(); +} +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::AddBoundaryCAO(QString newBoundary) +// ------------------------------------------------------------------------ +{ + myArgs->CBBoundaryCAO->insertItem(0,newBoundary); + myArgs->CBBoundaryCAO->setCurrentIndex(0); +} +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::PushBoundaryCAONew() +// ------------------------------------------------------------------------ +{ + SMESH_CreateBoundaryCAO *BoundaryDlg = new SMESH_CreateBoundaryCAO + (this, true, SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen), "Case_1", ""); + BoundaryDlg->show(); +} +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::PushBoundaryCAOEdit() +// ------------------------------------------------------------------------ +{ + if (myArgs->CBBoundaryCAO->currentText() == QString("")) return; + SMESH_EditBoundaryCAO *BoundaryDlg = new SMESH_EditBoundaryCAO + (this, true, SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen), + "Case_1", myArgs->CBBoundaryCAO->currentText()); + BoundaryDlg->show(); +} + +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::PushBoundaryCAOHelp() +{ + SMESH::ShowHelpFile(QString("gui_create_boundary.html")); +} + +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::SetBoundaryD() +{ + MESSAGE("Debut de SetBoundaryD "); + if (myArgs->CBBoundaryD->isChecked()) { + bool bOK = CheckCase(); + if (bOK) { + myArgs->GBBoundaryD->setVisible(1); + } + else { + myArgs->GBBoundaryD->setVisible(0); + myArgs->CBBoundaryD->setChecked(0); + myArgs->CBBoundaryD->setCheckState(Qt::Unchecked); + } + } + else { + myArgs->GBBoundaryD->setVisible(0); + } + + myArgs->mySelectInMedFileLineEdit->setReadOnly(true); + myArgs->mySelectInMedFileButton->hide(); + + adjustSize(); +} +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::AddBoundaryDi(QString newBoundary) +// ------------------------------------------------------------------------ +{ + myArgs->CBBoundaryDi->insertItem(0,newBoundary); + myArgs->CBBoundaryDi->setCurrentIndex(0); +} +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::PushBoundaryDiNew() +// ------------------------------------------------------------------------ +{ + SMESH_CreateBoundaryDi *BoundaryDlg = new SMESH_CreateBoundaryDi(this, true, + SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen), "Case_1", ""); + BoundaryDlg->show(); +} +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::PushBoundaryDiEdit() +// ------------------------------------------------------------------------ +{ + if (myArgs->CBBoundaryDi->currentText() == QString("")) return; + SMESH_EditBoundaryDi *BoundaryDlg = new SMESH_EditBoundaryDi + (this, true, SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen), + "Case_1", myArgs->CBBoundaryDi->currentText()); + BoundaryDlg->show(); +} + +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::PushBoundaryDiHelp() +{ + SMESH::ShowHelpFile(QString("gui_create_boundary.html")); + //std::string LanguageShort = myHomardGen->GetLanguageShort(); + //HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("frontiere-discrete"), QString(LanguageShort.c_str())); +} + +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::SetBoundaryA() +{ + MESSAGE("Debut de SetBoundaryA "); + if (myArgs->CBBoundaryA->isChecked()) { + bool bOK = CheckCase(); + if (bOK) { + myArgs->GBBoundaryA->setVisible(1); + } + else { + myArgs->GBBoundaryA->setVisible(0); + myArgs->CBBoundaryA->setChecked(0); + myArgs->CBBoundaryA->setCheckState(Qt::Unchecked); + } + } + else { + myArgs->GBBoundaryA->setVisible(0); + } + + myArgs->mySelectInMedFileLineEdit->setReadOnly(true); + myArgs->mySelectInMedFileButton->hide(); + + adjustSize(); +} +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::AddBoundaryAn(QString newBoundary) +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de AddBoundaryAn "); +// Ajout d'une nouvelle colonne + int nbcol = myArgs->TWBoundary->columnCount(); +// MESSAGE("nbcol " << nbcol); + nbcol += 1 ; + myArgs->TWBoundary->setColumnCount ( nbcol ) ; + QTableWidgetItem *__colItem = new QTableWidgetItem(); + __colItem->setText(QApplication::translate("CreateCase", newBoundary.toStdString().c_str(), 0)); + myArgs->TWBoundary->setHorizontalHeaderItem(nbcol-1, __colItem); +/* TWBoundary->horizontalHeaderItem(nbcol-1)->setFlags( Qt::ItemIsSelectable|Qt::ItemIsEnabled );*/ +// Chaque case est a cocher + int nbrow = myArgs->TWBoundary->rowCount(); +// MESSAGE("nbrow " << nbrow); + for ( int i = 0; i < nbrow; i++ ) + { + myArgs->TWBoundary->setItem( i, nbcol-1, new QTableWidgetItem( QString ("") ) ); + myArgs->TWBoundary->item( i, nbcol-1 )->setFlags( 0 ); + myArgs->TWBoundary->item( i, nbcol-1 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled ); + myArgs->TWBoundary->item( i, nbcol-1 )->setCheckState( Qt::Unchecked ); + } + myArgs->TWBoundary->resizeColumnToContents(nbcol-1); +// TWBoundary->resizeRowsToContents(); +// MESSAGE("Fin de AddBoundaryAn "); +} +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::PushBoundaryAnNew() +// ------------------------------------------------------------------------ +{ + SMESH_CreateBoundaryAn *BoundaryDlg = new SMESH_CreateBoundaryAn + (this, true, SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen), "Case_1"); + BoundaryDlg->show(); +} +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::PushBoundaryAnEdit() +// ------------------------------------------------------------------------ +{ + QString nom=""; + int nbcol = myArgs->TWBoundary->columnCount(); + for ( int i = 1; i < nbcol; i++ ) { + QTableWidgetItem *__colItem = new QTableWidgetItem(); + __colItem = myArgs->TWBoundary->horizontalHeaderItem(i); + nom = QString(__colItem->text()) ; + MESSAGE("nom "<show(); + } + } +} +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::PushBoundaryAnHelp() +// ------------------------------------------------------------------------ +{ + SMESH::ShowHelpFile(QString("gui_create_boundary.html")); + //std::string LanguageShort = myHomardGen->GetLanguageShort(); + //HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("frontiere-analytique"), QString(LanguageShort.c_str())); +} + +//================================================================================= +// function : SMESHGUI_HomardAdaptArguments() +// purpose : +//================================================================================= +SMESHGUI_HomardAdaptArguments::SMESHGUI_HomardAdaptArguments(QWidget* parent) + : QWidget(parent) +{ + setupUi(this); +} + +SMESHGUI_HomardAdaptArguments::~SMESHGUI_HomardAdaptArguments() +{ +} + +void SMESHGUI_HomardAdaptArguments::setupUi(QWidget *CreateCase) +{ + // Mesh in + QGroupBox* aMeshIn = new QGroupBox( tr( "MeshIn" ), this ); + myInMedFileRadio = new QRadioButton( tr( "MEDFile" ), aMeshIn ); + myInBrowserRadio = new QRadioButton( tr( "Browser" ), aMeshIn ); + myInBrowserObject = new QLineEdit( aMeshIn ); + mySelectInMedFileButton = new QPushButton("...", aMeshIn); + mySelectInMedFileLineEdit = new QLineEdit( aMeshIn ); + + QGridLayout* meshIn = new QGridLayout( aMeshIn ); + + meshIn->setMargin( 9 ); + meshIn->setSpacing( 6 ); + meshIn->addWidget( myInMedFileRadio, 0, 0, 1, 1 ); + meshIn->addWidget( myInBrowserRadio, 0, 1, 1, 1 ); + meshIn->addWidget( mySelectInMedFileButton, 1, 0, 1, 1 ); + meshIn->addWidget( mySelectInMedFileLineEdit, 1, 1, 1, 2 ); + meshIn->addWidget( myInBrowserObject, 0, 2, 1, 1 ); + + myInMeshGroup = new QButtonGroup( this ); + myInMeshGroup->addButton( myInMedFileRadio, 0 ); + myInMeshGroup->addButton( myInBrowserRadio, 1 ); + + // Mesh out + QGroupBox* aMeshOut = new QGroupBox( tr( "MeshOut" ), this ); + QLabel* meshName = new QLabel(tr("MeshName"), aMeshOut); + QSpacerItem* secondHspacer = new QSpacerItem(100, 30); + myOutMeshNameLineEdit = new QLineEdit(aMeshOut); + myOutMedFileChk = new QCheckBox(tr("MEDFile"), aMeshOut); + mySelectOutMedFileButton = new QPushButton("...", aMeshOut); + mySelectOutMedFileLineEdit = new QLineEdit(aMeshOut); + myOutPublishChk = new QCheckBox(tr("Publish_MG_ADAPT"), aMeshOut); + + QGridLayout* meshOut = new QGridLayout( aMeshOut ); + + meshOut->setMargin( 9 ); + meshOut->setSpacing( 6 ); + meshOut->addWidget( meshName, 0, 0, 1,1 ); + meshOut->addItem( secondHspacer, 0, 1, 1, 1 ); + meshOut->addWidget( myOutMeshNameLineEdit, 0, 2,1,1); + meshOut->addWidget( myOutMedFileChk, 1, 0,1,1 ); + meshOut->addWidget( mySelectOutMedFileButton, 1, 1,1,1 ); + meshOut->addWidget( mySelectOutMedFileLineEdit, 1, 2,1,1); + meshOut->addWidget( myOutPublishChk, 2, 0,1,1 ); + + // Conformity type + QGroupBox *GBTypeConf = new QGroupBox(tr("Conformity type"), CreateCase); + RBConforme = new QRadioButton(tr("Conformal"), GBTypeConf); + RBNonConforme = new QRadioButton(tr("Non conformal"), GBTypeConf); + RBConforme->setChecked(true); + + QHBoxLayout *hboxLayout2 = new QHBoxLayout(GBTypeConf); + hboxLayout2->setSpacing(6); + hboxLayout2->setContentsMargins(9, 9, 9, 9); + hboxLayout2->addWidget(RBConforme); + hboxLayout2->addWidget(RBNonConforme); + + // Boundary type + GBTypeBoun = new QGroupBox(tr("Boundary type"), CreateCase); + + RBBoundaryNo = new QRadioButton(tr("No boundary"), GBTypeBoun); + RBBoundaryCAO = new QRadioButton(tr("CAO"), GBTypeBoun); + RBBoundaryNonCAO = new QRadioButton(tr("Non CAO"), GBTypeBoun); + RBBoundaryNo->setChecked(true); + + // CAO + GBBoundaryC = new QGroupBox(tr("CAO"), GBTypeBoun); + QSizePolicy sizePolicy1(QSizePolicy::Fixed, QSizePolicy::Fixed); + sizePolicy1.setHorizontalStretch(0); + sizePolicy1.setVerticalStretch(0); + sizePolicy1.setHeightForWidth(GBBoundaryC->sizePolicy().hasHeightForWidth()); + GBBoundaryC->setSizePolicy(sizePolicy1); + + CBBoundaryCAO = new QComboBox(GBBoundaryC); + CBBoundaryCAO->setSizeAdjustPolicy(QComboBox::AdjustToContents); + + PBBoundaryCAONew = new QPushButton(tr("CAO_NEW_BTN"), GBBoundaryC); + PBBoundaryCAOEdit = new QPushButton(tr("CAO_EDIT_BTN"), GBBoundaryC); + PBBoundaryCAOHelp = new QPushButton(tr("CAO_HELP_BTN"), GBBoundaryC); + + PBBoundaryCAONew->setAutoDefault(false); + PBBoundaryCAOEdit->setAutoDefault(false); + PBBoundaryCAOHelp->setAutoDefault(false); + + _2 = new QGridLayout(GBBoundaryC); + _2->setSpacing(6); + _2->setContentsMargins(9, 9, 9, 9); + _2->addWidget(CBBoundaryCAO, 0, 0, 1, 1); + QSpacerItem* spacerItem3 = new QSpacerItem(40, 13, QSizePolicy::Fixed, QSizePolicy::Minimum); + _2->addItem(spacerItem3, 0, 1, 1, 1); + _2->addWidget(PBBoundaryCAONew, 0, 2, 1, 1); + _2->addWidget(PBBoundaryCAOEdit, 0, 3, 1, 1); + _2->addWidget(PBBoundaryCAOHelp, 0, 4, 1, 1); + + // Non CAO (discrete / analytical) + GBBoundaryN = new QGroupBox(GBTypeBoun); + 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); + + // discrete + GBBoundaryD = new QGroupBox(tr("Discrete boundary"), GBBoundaryN); + sizePolicy1.setHeightForWidth(GBBoundaryD->sizePolicy().hasHeightForWidth()); + GBBoundaryD->setSizePolicy(sizePolicy1); + gridLayout = new QGridLayout(GBBoundaryD); + gridLayout->setSpacing(6); + gridLayout->setContentsMargins(9, 9, 9, 9); + gridLayout->setObjectName(QString::fromUtf8("gridLayout")); + CBBoundaryDi = new QComboBox(GBBoundaryD); + CBBoundaryDi->setObjectName(QString::fromUtf8("CBBoundaryDi")); + CBBoundaryDi->setSizeAdjustPolicy(QComboBox::AdjustToContents); + + gridLayout->addWidget(CBBoundaryDi, 0, 0, 1, 1); + + QSpacerItem* spacerItem5 = new QSpacerItem(40, 13, QSizePolicy::Fixed, QSizePolicy::Minimum); + gridLayout->addItem(spacerItem5, 0, 1, 1, 1); + + PBBoundaryDiEdit = new QPushButton(GBBoundaryD); + PBBoundaryDiEdit->setObjectName(QString::fromUtf8("PBBoundaryDiEdit")); + PBBoundaryDiEdit->setAutoDefault(false); + + gridLayout->addWidget(PBBoundaryDiEdit, 0, 3, 1, 1); + + PBBoundaryDiHelp = new QPushButton(GBBoundaryD); + PBBoundaryDiHelp->setObjectName(QString::fromUtf8("PBBoundaryDiHelp")); + PBBoundaryDiHelp->setAutoDefault(false); + + gridLayout->addWidget(PBBoundaryDiHelp, 0, 4, 1, 1); + + PBBoundaryDiNew = new QPushButton(GBBoundaryD); + PBBoundaryDiNew->setAutoDefault(false); + + gridLayout->addWidget(PBBoundaryDiNew, 0, 2, 1, 1); + + // analytical + GBBoundaryA = new QGroupBox(tr("Analytical boundary"), GBBoundaryN); + GBBoundaryA->setMinimumSize(QSize(548, 200)); + formLayout = new QFormLayout(GBBoundaryA); + formLayout->setObjectName(QString::fromUtf8("formLayout")); + TWBoundary = new QTableWidget(GBBoundaryA); + if (TWBoundary->columnCount() < 1) + TWBoundary->setColumnCount(1); + QTableWidgetItem *__qtablewidgetitem = new QTableWidgetItem(); + TWBoundary->setHorizontalHeaderItem(0, __qtablewidgetitem); + TWBoundary->setObjectName(QString::fromUtf8("TWBoundary")); + TWBoundary->setEditTriggers(QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked); + TWBoundary->setShowGrid(true); + TWBoundary->setRowCount(0); + TWBoundary->setColumnCount(1); + + formLayout->setWidget(0, QFormLayout::LabelRole, TWBoundary); + + gridLayout1 = new QGridLayout(); + gridLayout1->setSpacing(6); + gridLayout1->setContentsMargins(0, 0, 0, 0); + gridLayout1->setObjectName(QString::fromUtf8("gridLayout1")); + PBBoundaryAnEdit = new QPushButton(GBBoundaryA); + PBBoundaryAnEdit->setObjectName(QString::fromUtf8("PBBoundaryAnEdit")); + PBBoundaryAnEdit->setAutoDefault(false); + + gridLayout1->addWidget(PBBoundaryAnEdit, 1, 0, 1, 1); + + PBBoundaryAnNew = new QPushButton(GBBoundaryA); + PBBoundaryAnNew->setObjectName(QString::fromUtf8("PBBoundaryAnNew")); + PBBoundaryAnNew->setAutoDefault(false); + + gridLayout1->addWidget(PBBoundaryAnNew, 0, 0, 1, 1); + + PBBoundaryAnHelp = new QPushButton(GBBoundaryA); + PBBoundaryAnHelp->setObjectName(QString::fromUtf8("PBBoundaryAnHelp")); + PBBoundaryAnHelp->setAutoDefault(false); + + gridLayout1->addWidget(PBBoundaryAnHelp, 2, 0, 1, 1); + + formLayout->setLayout(0, QFormLayout::FieldRole, gridLayout1); + + // Boundary type Layout + QGridLayout* aBoundTypeLayout = new QGridLayout(GBTypeBoun); + aBoundTypeLayout->addWidget(RBBoundaryNo, 0, 0); + aBoundTypeLayout->addWidget(RBBoundaryCAO, 0, 1); + aBoundTypeLayout->addWidget(RBBoundaryNonCAO, 0, 2); + + aBoundTypeLayout->addWidget(GBBoundaryC, 1, 0, 1, 3); + aBoundTypeLayout->addWidget(GBBoundaryN, 2, 0, 1, 3); + + // Arguments layout + QGridLayout *argumentsLayout = new QGridLayout(CreateCase); + argumentsLayout->addWidget(aMeshIn, 0, 0, 1, 3); + argumentsLayout->addWidget(aMeshOut, 1, 0, 1, 3); + argumentsLayout->addWidget(GBTypeConf, 2, 0, 1, 3); + argumentsLayout->addWidget(GBTypeBoun, 3, 0, 1, 3); + argumentsLayout->setColumnStretch( 1, 5 ); + argumentsLayout->setRowStretch( 4, 5 ); + + mySelectInMedFileButton->setText(QString()); + CBBoundaryD->setText(QApplication::translate("CreateCase", "Discrete boundary", nullptr)); + CBBoundaryA->setText(QApplication::translate("CreateCase", "Analytical boundary", nullptr)); + PBBoundaryCAOEdit->setText(QApplication::translate("CreateCase", "Edit", nullptr)); + PBBoundaryCAOHelp->setText(QApplication::translate("CreateCase", "Help", nullptr)); + PBBoundaryCAONew->setText(QApplication::translate("CreateCase", "New", nullptr)); + PBBoundaryDiEdit->setText(QApplication::translate("CreateCase", "Edit", nullptr)); + PBBoundaryDiHelp->setText(QApplication::translate("CreateCase", "Help", nullptr)); + PBBoundaryDiNew->setText(QApplication::translate("CreateCase", "New", nullptr)); + QTableWidgetItem *___qtablewidgetitem = TWBoundary->horizontalHeaderItem(0); + ___qtablewidgetitem->setText(QApplication::translate("CreateCase", "a_virer", nullptr)); + PBBoundaryAnEdit->setText(QApplication::translate("CreateCase", "Edit", nullptr)); + PBBoundaryAnNew->setText(QApplication::translate("CreateCase", "New", nullptr)); + PBBoundaryAnHelp->setText(QApplication::translate("CreateCase", "Help", nullptr)); + + // Initial state + myInMedFileRadio->setChecked( true ); + modeInChanged( MedFile ); + RBBoundaryNo->setChecked( true ); + //SetBoundaryNo(); + + myOutMedFileChk->setChecked(true); + CBBoundaryCAO->setCurrentIndex(-1); + CBBoundaryDi->setCurrentIndex(-1); + + // Connections + QMetaObject::connectSlotsByName(CreateCase); + connect(myInMeshGroup, SIGNAL(buttonClicked(int)), this, SLOT(modeInChanged(int))); + connect(myOutMedFileChk, SIGNAL(stateChanged(int)), this, SLOT(onOutMedFileChk(int))); + connect(myOutPublishChk, SIGNAL(stateChanged(int)), this, SLOT(onOutPublishChk(int))); + connect(mySelectOutMedFileButton, SIGNAL(pressed()), this, SLOT(onSelectOutMedFileButton())); + emit updateSelection(); +} + +void SMESHGUI_HomardAdaptArguments::modeInChanged( int theMode ) +{ + clear(); + if (theMode == MedFile) { + mySelectInMedFileLineEdit->show(); + mySelectInMedFileButton->show(); + myInBrowserObject->hide(); + } + else { + mySelectInMedFileLineEdit->hide(); + mySelectInMedFileButton->hide(); + myInBrowserObject->show(); + emit updateSelection(); + } +} + +void SMESHGUI_HomardAdaptArguments::onSelectOutMedFileButton() +{ + // Current value + QString fileName0 = mySelectOutMedFileLineEdit->text().trimmed(); + + // Ask user for the new value + QString filtre = QString("Med"); + filtre += QString(" files (*.") + QString("med") + QString(");;"); + QString fileName = QFileDialog::getSaveFileName(this, tr("SAVE_MED"), QString(""), filtre); + + // Check the new value + if (fileName.isEmpty()) fileName = fileName0; + + QFileInfo aFileInfo (fileName); + mySelectOutMedFileLineEdit->setText(aFileInfo.absoluteFilePath()); +} + +void SMESHGUI_HomardAdaptArguments::clear() +{ + mySelectInMedFileLineEdit->clear(); + myInBrowserObject->clear(); + + myOutMeshNameLineEdit->clear(); + mySelectOutMedFileLineEdit->clear(); +} + +void SMESHGUI_HomardAdaptArguments::onOutMedFileChk(int state) +{ + if (state == Qt::Checked) { + mySelectOutMedFileButton->show(); + mySelectOutMedFileLineEdit->show(); + mySelectOutMedFileButton->setEnabled(true); + mySelectOutMedFileLineEdit->setEnabled(true); + } + else { + mySelectOutMedFileButton->setEnabled(false); + mySelectOutMedFileLineEdit->setEnabled(false); + myOutPublishChk->setChecked(true); + } +} + +void SMESHGUI_HomardAdaptArguments::onOutPublishChk(int state) +{ + if (state == Qt::Unchecked) { + myOutMedFileChk->setChecked(true); + } +} + +////////////////////////////////////////// +// SMESHGUI_HomardAdaptAdvanced +////////////////////////////////////////// + +SMESHGUI_HomardAdaptAdvanced::SMESHGUI_HomardAdaptAdvanced( QWidget* parent, Qt::WindowFlags f ) + : QWidget( parent, f ) +{ + setupWidget(); + connect(workingDirectoryPushButton, SIGNAL(pressed()), this, SLOT(onWorkingDirectoryPushButton())); +} + +SMESHGUI_HomardAdaptAdvanced::~SMESHGUI_HomardAdaptAdvanced() +{ +} + +void SMESHGUI_HomardAdaptAdvanced::setupWidget() +{ + if (this->objectName().isEmpty()) + this->setObjectName(QString(tr("MG-ADAPT-ADV"))); + this->resize(337, 369); + + // Logs and debug + logGroupBox = new QGroupBox(this); + logGroupBox->setObjectName(QString("logGroupBox")); + + QGridLayout* logsLayout = new QGridLayout(logGroupBox); + logsLayout->setObjectName(QString("logsLayout")); + + // Working directory + Verbose level layout + QGridLayout* gridLayout = new QGridLayout(); + gridLayout->setObjectName(QString("gridLayout")); + + // Working directory + workingDirectoryLabel = new QLabel(logGroupBox); + workingDirectoryLabel->setObjectName(QString("workingDirectoryLabel")); + + gridLayout->addWidget(workingDirectoryLabel, 0, 0, 1, 1); + + workingDirectoryLineEdit = new QLineEdit(logGroupBox); + workingDirectoryLineEdit->setObjectName(QString("workingDirectoryLineEdit")); + + gridLayout->addWidget(workingDirectoryLineEdit, 0, 1, 1, 1); + + workingDirectoryPushButton = new QPushButton(logGroupBox); + workingDirectoryPushButton->setObjectName(QString("workingDirectoryPushButton")); + + gridLayout->addWidget(workingDirectoryPushButton, 0, 2, 1, 1); + + // Verbose level + verboseLevelLabel = new QLabel(logGroupBox); + verboseLevelLabel->setObjectName(QString("verboseLevelLabel")); + + gridLayout->addWidget(verboseLevelLabel, 1, 0, 1, 1); + + verboseLevelSpin = new QSpinBox(logGroupBox); + verboseLevelSpin->setObjectName(QString("verboseLevelSpin")); + + gridLayout->addWidget(verboseLevelSpin, 1, 1, 1, 1); + + logsLayout->addLayout(gridLayout, 0, 0, 1, 1); + + // logInFileCheck + removeLogOnSuccessCheck + QHBoxLayout* horizontalLayout = new QHBoxLayout(); + horizontalLayout->setObjectName(QString("horizontalLayout")); + + // Log In File Check + logInFileCheck = new QCheckBox(logGroupBox); + logInFileCheck->setObjectName(QString("logInFileCheck")); + logInFileCheck->setChecked(true); + + horizontalLayout->addWidget(logInFileCheck); + + // Remove Log On Success Check + removeLogOnSuccessCheck = new QCheckBox(logGroupBox); + removeLogOnSuccessCheck->setObjectName(QString("removeLogOnSuccessCheck")); + removeLogOnSuccessCheck->setChecked(true); + + horizontalLayout->addWidget(removeLogOnSuccessCheck); + + logsLayout->addLayout(horizontalLayout, 1, 0, 1, 1); + + // Keep Working Files Check + keepWorkingFilesCheck = new QCheckBox(logGroupBox); + keepWorkingFilesCheck->setObjectName(QString("keepWorkingFilesCheck")); + keepWorkingFilesCheck->setAutoExclusive(false); + keepWorkingFilesCheck->setChecked(false); + + logsLayout->addWidget(keepWorkingFilesCheck, 2, 0, 1, 1); +} + +void SMESHGUI_HomardAdaptAdvanced::onWorkingDirectoryPushButton() +{ + QString aWorkingDir = QFileDialog::getExistingDirectory(); + if (!(aWorkingDir.isEmpty())) workingDirectoryLineEdit->setText(aWorkingDir); +} diff --git a/src/SMESHGUI/SMESHGUI_HomardAdaptDlg.h b/src/SMESHGUI/SMESHGUI_HomardAdaptDlg.h new file mode 100644 index 000000000..64242c133 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_HomardAdaptDlg.h @@ -0,0 +1,241 @@ +// Copyright (C) 2011-2021 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef SMESHGUI_HOMARDADAPTDLG_HXX +#define SMESHGUI_HOMARDADAPTDLG_HXX + +#include "SMESH_SMESHGUI.hxx" + +#include +#include CORBA_CLIENT_HEADER(SMESH_Homard) +#include CORBA_SERVER_HEADER(SMESH_Mesh) +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class SMESHGUI_HomardAdaptArguments; +class SMESHGUI_HomardAdaptAdvanced; + +//================================================================================= +// class : SMESHGUI_HomardAdaptDlg +// purpose : +//================================================================================= +class SMESHGUI_EXPORT SMESHGUI_HomardAdaptDlg : public QDialog +{ + Q_OBJECT + + public: + 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); + + protected: + 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(); + virtual void InitBoundarys(); + + public slots: + virtual void SetFileName(); + + virtual void SetBoundaryNo(); + virtual void SetBoundaryCAO(); + virtual void SetBoundaryNonCAO(); + + virtual void PushBoundaryCAONew(); + virtual void PushBoundaryCAOEdit(); + virtual void PushBoundaryCAOHelp(); + + virtual void SetBoundaryD(); + virtual void PushBoundaryDiNew(); + virtual void PushBoundaryDiEdit(); + virtual void PushBoundaryDiHelp(); + + virtual void SetBoundaryA(); + virtual void PushBoundaryAnNew(); + virtual void PushBoundaryAnEdit(); + virtual void PushBoundaryAnHelp(); + + bool CheckCase(); + + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); + + void selectionChanged(); + void updateSelection(); + + private: + SMESHGUI_HomardAdaptArguments* myArgs; + SMESHGUI_HomardAdaptAdvanced* myAdvOpt; + + SMESH::SMESH_Mesh_var myMesh; + + QPushButton *buttonHelp; + QPushButton *buttonApply; + QPushButton *buttonOk; + QPushButton *buttonCancel; +}; + +//================================================================================= +// class : SMESHGUI_HomardAdaptArguments +// purpose : +//================================================================================= +class SMESHGUI_HomardAdaptArguments : public QWidget +{ + Q_OBJECT + +public: + enum ModeIn { MedFile, Browser }; + + SMESHGUI_HomardAdaptArguments (QWidget* parent); + ~SMESHGUI_HomardAdaptArguments(); + + void setupUi(QWidget *CreateCase); + +public: + // Mesh In + QButtonGroup* myInMeshGroup; + QRadioButton* myInMedFileRadio; + QRadioButton* myInBrowserRadio; + + QPushButton* mySelectInMedFileButton; + QLineEdit* mySelectInMedFileLineEdit; // LEFileName + + QLineEdit* myInBrowserObject; + + // Mesh Out + QLineEdit* myOutMeshNameLineEdit; + QCheckBox* myOutMedFileChk; + + QPushButton* mySelectOutMedFileButton; + QLineEdit* mySelectOutMedFileLineEdit; + + QCheckBox* myOutPublishChk; + + // Conformity type + QRadioButton *RBConforme; + QRadioButton *RBNonConforme; + + // Boundary type + QGroupBox *GBTypeBoun; + QRadioButton *RBBoundaryNo; + QRadioButton *RBBoundaryCAO; + QRadioButton *RBBoundaryNonCAO; + QHBoxLayout *hboxLayout3; + QCheckBox *CBBoundaryD; + QCheckBox *CBBoundaryA; + + QGroupBox *GBBoundaryC; // CAO boundary + QGridLayout *_2; + QPushButton *PBBoundaryCAOEdit; + QPushButton *PBBoundaryCAOHelp; + QComboBox *CBBoundaryCAO; + QPushButton *PBBoundaryCAONew; + QGroupBox *GBBoundaryN; // Non CAO boundary + QGroupBox *GBBoundaryD; + QGridLayout *gridLayout; + QComboBox *CBBoundaryDi; + QPushButton *PBBoundaryDiEdit; + QPushButton *PBBoundaryDiHelp; + QPushButton *PBBoundaryDiNew; + QGroupBox *GBBoundaryA; + QFormLayout *formLayout; + QTableWidget *TWBoundary; + QGridLayout *gridLayout1; + QPushButton *PBBoundaryAnEdit; + QPushButton *PBBoundaryAnNew; + QPushButton *PBBoundaryAnHelp; + +signals: + void updateSelection(); + +private slots: + void modeInChanged(int); + void clear(); + void onOutMedFileChk(int); + void onOutPublishChk(int); + void onSelectOutMedFileButton(); +}; + +//================================================================================= +// class : SMESHGUI_HomardAdaptAdvanced +// purpose : +//================================================================================= +class SMESHGUI_HomardAdaptAdvanced : public QWidget +{ + Q_OBJECT + +public: + SMESHGUI_HomardAdaptAdvanced(QWidget* = 0, Qt::WindowFlags = 0); + ~SMESHGUI_HomardAdaptAdvanced(); + + void setupWidget(); + +public: + QGroupBox *logGroupBox; + + QLabel *workingDirectoryLabel; + QLineEdit *workingDirectoryLineEdit; + QPushButton *workingDirectoryPushButton; + + QLabel *verboseLevelLabel; + QSpinBox *verboseLevelSpin; + + QCheckBox *logInFileCheck; + QCheckBox *removeLogOnSuccessCheck; + + QCheckBox *keepWorkingFilesCheck; + +private slots: + void onWorkingDirectoryPushButton(); +}; + +#endif // SMESHGUI_HOMARDADAPTDLG_HXX diff --git a/src/SMESHGUI/SMESHGUI_HomardBoundaryDlg.cxx b/src/SMESHGUI/SMESHGUI_HomardBoundaryDlg.cxx new file mode 100644 index 000000000..67c18a5ae --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_HomardBoundaryDlg.cxx @@ -0,0 +1,1682 @@ +// Copyright (C) 2011-2021 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "SMESHGUI_HomardBoundaryDlg.h" + +#include "SMESHGUI_HomardAdaptDlg.h" +#include "SMESHGUI_HomardListGroup.h" + +#include "SMESHGUI_Utils.h" + +#include +#include + +#include "SalomeApp_Tools.h" +#include "SMESHGUI_HomardUtils.h" +#include + +#include +#include +#include +#include +#include + +#include "math.h" +#define PI 3.141592653589793 + +using namespace std; + +// ---------------------------------------------------------------------------------- +SMESH_CreateBoundaryAn::SMESH_CreateBoundaryAn(SMESHGUI_HomardAdaptDlg* parent, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName) : +/* Constructs a SMESH_CreateBoundaryAn + appele pour une vraie creation + initialise un cylindre et non une sphere +*/ + 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), + _Xcentre(0), _Ycentre(0), _Zcentre(0), _Rayon(0), + _Xmin(0), _Xmax(0), _Xincr(0), _Ymin(0), _Ymax(0), _Yincr(0), _Zmin(0), _Zmax(0), _Zincr(0), _DMax(0), + _BoundaryAnXcone1(0), _BoundaryAnYcone1(0), _BoundaryAnZcone1(0), _BoundaryAnRayon1(0), + _BoundaryAnXcone2(0), _BoundaryAnYcone2(0), _BoundaryAnZcone2(0), _BoundaryAnRayon2(0), + _BoundaryAnXaxisCone(0), _BoundaryAnYaxisCone(0), _BoundaryAnZaxisCone(0), + _BoundaryAnXorigCone(0), _BoundaryAnYorigCone(0), _BoundaryAnZorigCone(0), + _BoundaryAngle(0), + _BoundaryAnToreXcentre(0), _BoundaryAnToreYcentre(0), _BoundaryAnToreZcentre(0), + _BoundaryAnToreXaxe(0), _BoundaryAnToreYaxe(0), _BoundaryAnToreZaxe(0), + _BoundaryAnToreRRev(0), _BoundaryAnToreRPri(0), + Chgt (false) + { + MESSAGE("Constructeur") ; + myHomardGen = SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + setupUi(this); + setModal(modal); + + // Gestion des icones + QPixmap pix ; + QIcon IS ; + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + pix = resMgr->loadPixmap( "HOMARD", "spherepoint.png" ); + IS=QIcon(pix); + RBSphere->setIcon(IS); + pix = resMgr->loadPixmap( "HOMARD", "cylinderpointvector.png" ); + IS=QIcon(pix); + RBCylindre->setIcon(IS); + pix = resMgr->loadPixmap( "HOMARD", "cone.png" ); + IS=QIcon(pix); + RBCone->setIcon(IS); + pix = resMgr->loadPixmap( "HOMARD", "conepointvector.png" ); + IS=QIcon(pix); + RB_Def_angle->setIcon(IS); + pix = resMgr->loadPixmap( "HOMARD", "conedxyz.png" ); + IS=QIcon(pix); + RB_Def_radius->setIcon(IS); + pix = resMgr->loadPixmap( "HOMARD", "toruspointvector.png" ); + IS=QIcon(pix); + RBTore->setIcon(IS); + + InitConnect( ); + + SetNewName() ; + InitValBoundaryAn(); // Cherche les valeurs de la boite englobante le maillage + InitMinMax(); // Initialise les bornes des boutons + SetCylinder(); // Propose un cylindre en premier choix + } + +// ------------------------------------------------------------------------------- +SMESH_CreateBoundaryAn::SMESH_CreateBoundaryAn(SMESHGUI_HomardAdaptDlg* parent, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName): + 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), + // Pour affichage lors de l edition d une BoundaryAn sans nom de Cas + _Xcentre(0), _Ycentre(0), _Zcentre(0), _Rayon(0), + _Xmin(1), _Xmax(1), _Xincr(1), _Ymin(1), _Ymax(1), _Yincr(1), _Zmin(1), _Zmax(1), _Zincr(1), _DMax(1), + Chgt (false), + myHomardGen(myHomardGen0) + { + // MESSAGE("Debut de SMESH_CreateBoundaryAn") + setupUi(this); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + QPixmap pix = resMgr->loadPixmap( "HOMARD", "spherepoint.png" ); + QIcon IS=QIcon(pix); + RBSphere->setIcon(IS); + QPixmap pix2 = resMgr->loadPixmap( "HOMARD", "cylinderpointvector.png" ); + QIcon IS2=QIcon(pix2); + RBCylindre->setIcon(IS2); + QPixmap pix3 = resMgr->loadPixmap( "HOMARD", "cone.png" ); + QIcon IS3=QIcon(pix3); + RBCone->setIcon(IS3); + QPixmap pix4 = resMgr->loadPixmap( "HOMARD", "conepointvector.png" ); + QIcon IS4=QIcon(pix4); + RB_Def_angle->setIcon(IS4); + QPixmap pix5 = resMgr->loadPixmap( "HOMARD", "conedxyz.png" ); + QIcon IS5=QIcon(pix5); + RB_Def_radius->setIcon(IS5); + setModal(true); + InitConnect(); + } + +// ------------------------------------------------------------------------ +SMESH_CreateBoundaryAn::~SMESH_CreateBoundaryAn() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryAn::InitConnect() +// ------------------------------------------------------------------------ +{ + connect( RBCylindre, SIGNAL(clicked()) , this, SLOT(SetCylinder()) ) ; + connect( RBSphere, SIGNAL(clicked()) , this, SLOT(SetSphere()) ) ; + connect( RBCone, SIGNAL(clicked()) , this, SLOT(SetCone()) ) ; + connect( RB_Def_radius, SIGNAL(clicked()) , this, SLOT(SetConeR()) ); + connect( RB_Def_angle, SIGNAL(clicked()) , this, SLOT(SetConeA()) ); + connect( RBTore, SIGNAL(clicked()) , this, SLOT(SetTore()) ) ; + connect( buttonOk, SIGNAL( pressed() ), this, SLOT( PushOnOK() ) ); + connect( buttonApply, SIGNAL( pressed() ), this, SLOT( PushOnApply() ) ); + connect( buttonCancel, SIGNAL( pressed() ), this, SLOT( close() ) ); + connect( buttonHelp, SIGNAL( pressed() ), this, SLOT( PushOnHelp() ) ); +} +// ------------------------------------------------------------------------ +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()); + SMESHHOMARD::extrema_var MesExtremes = aCas->GetBoundingBox(); + int num = MesExtremes->length() ; + ASSERT(num == 10); + _Xmin=MesExtremes[0]; _Xmax=MesExtremes[1]; _Xincr=MesExtremes[2]; + _Ymin=MesExtremes[3]; _Ymax=MesExtremes[4]; _Yincr=MesExtremes[5]; + _Zmin=MesExtremes[6]; _Zmax=MesExtremes[7]; _Zincr=MesExtremes[8]; + _DMax=MesExtremes[9]; + MESSAGE ("_Xmin : " << _Xmin << " _Xmax : " << _Xmax << " _Xincr : " << _Xincr ) ; + MESSAGE ("_Ymin : " << _Ymin << " _Ymax : " << _Ymax << " _Yincr : " << _Yincr ) ; + MESSAGE ("_Zmin : " << _Zmin << " _Zmax : " << _Zmax << " _Zincr : " << _Zincr) ; + MESSAGE ("_DMax : " << _DMax); + +// 2. Caracteristiques des frontieres +// en X + _Xcentre=(_Xmin + _Xmax)/2.; +// en Y + _Ycentre=(_Ymin + _Ymax)/2.; +// en Z + _Zcentre=(_Zmin + _Zmax)/2.; +// Rayon + _Rayon= _DMax/4.; +} + +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryAn::InitMinMax() +// ------------------------------------------------------------------------ +{ + // Cylindre + // . X du centre + SpinBox_Xcent->setValue(_Xcentre); + SpinBox_Xcent->setSingleStep(_Xincr); + // . Y du centre + SpinBox_Ycent->setValue(_Ycentre); + SpinBox_Ycent->setSingleStep(_Yincr); + // . Z du centre + SpinBox_Zcent->setValue(_Zcentre); + SpinBox_Zcent->setSingleStep(_Zincr); + // . X de l'axe + SpinBox_Xaxis->setValue(0.); + SpinBox_Xaxis->setSingleStep(0.1); + // . Y de l'axe + SpinBox_Yaxis->setValue(0.); + SpinBox_Yaxis->setSingleStep(0.1); + // . Z de l'axe + SpinBox_Zaxis->setValue(1.); + SpinBox_Zaxis->setSingleStep(0.1); + // . Rayon + SpinBox_Radius->setValue(_Rayon); + SpinBox_Radius->setSingleStep(_Rayon/10.); + + // Sphere + // . X du centre + SpinBox_Xcentre->setValue(_Xcentre); + SpinBox_Xcentre->setSingleStep(_Xincr); + // . Y du centre + SpinBox_Ycentre->setValue(_Ycentre); + SpinBox_Ycentre->setSingleStep(_Yincr); + // . Z du centre + SpinBox_Zcentre->setValue(_Zcentre); + SpinBox_Zcentre->setSingleStep(_Zincr); + // . Rayon + SpinBox_Rayon->setValue(_Rayon); + SpinBox_Rayon->setSingleStep(_Rayon/10.); + + // Cone en rayons + // . X des centres + _BoundaryAnXcone1 = _Xcentre ; + SpinBox_Cone_X1->setSingleStep(_Xincr); + _BoundaryAnXcone2 = _Xcentre ; + SpinBox_Cone_X2->setSingleStep(_Xincr); + // . Y des centres + _BoundaryAnYcone1 = _Ycentre ; + SpinBox_Cone_Y1->setSingleStep(_Yincr); + _BoundaryAnYcone2 = _Ycentre ; + SpinBox_Cone_Y2->setSingleStep(_Yincr); + // . Z des centres + _BoundaryAnZcone1 = _Zmin ; + SpinBox_Cone_Z1->setSingleStep(_Zincr); + _BoundaryAnZcone2 = _Zmax ; + SpinBox_Cone_Z2->setSingleStep(_Zincr); + // . Rayons/Angles + _BoundaryAnRayon1 = 0. ; + _BoundaryAnRayon2 = _Rayon ; + SpinBox_Cone_V2->setSingleStep(_Rayon/10.); + + // Cone en angle + convertRayonAngle(1) ; + SpinBox_Cone_X1->setValue(_BoundaryAnXaxisCone); + SpinBox_Cone_Y1->setValue(_BoundaryAnYaxisCone); + SpinBox_Cone_Z1->setValue(_BoundaryAnZaxisCone); + SpinBox_Cone_V1->setValue(_BoundaryAngle); + SpinBox_Cone_X2->setValue(_BoundaryAnXorigCone); + SpinBox_Cone_Y2->setValue(_BoundaryAnYorigCone); + SpinBox_Cone_Z2->setValue(_BoundaryAnZorigCone); + + // Tore + // . X du centre + SpinBoxToreXcent->setValue(_Xcentre); + SpinBoxToreXcent->setSingleStep(_Xincr); + // . Y du centre + SpinBoxToreYcent->setValue(_Ycentre); + SpinBoxToreYcent->setSingleStep(_Yincr); + // . Z du centre + SpinBoxToreZcent->setValue(_Zcentre); + SpinBoxToreZcent->setSingleStep(_Zincr); + // . X de l'axe + SpinBoxToreXaxe->setValue(0.); + SpinBoxToreXaxe->setSingleStep(0.1); + // . Y de l'axe + SpinBoxToreYaxe->setValue(0.); + SpinBoxToreYaxe->setSingleStep(0.1); + // . Z de l'axe + SpinBoxToreZaxe->setValue(1.); + SpinBoxToreZaxe->setSingleStep(0.1); + // . Rayon de revolution + SpinBoxToreRRev->setValue(_Rayon); + SpinBoxToreRRev->setSingleStep(_Rayon/10.); + // . Rayon primaire + SpinBoxToreRPri->setValue(_Rayon/3.); + SpinBoxToreRPri->setSingleStep(_Rayon/20.); +} +// ------------------------------------------------------------------------ +bool SMESH_CreateBoundaryAn::PushOnApply() +// ------------------------------------------------------------------------ +// Appele lorsque l'un des boutons Ok ou Apply est presse +// +{ + if (LEName->text().trimmed()=="") + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_BOUN_NAME") ); + return false; + } + + switch (_Type) + { + case 1 : // il s agit d un cylindre + { + if ((_BoundaryAnXcentre != SpinBox_Xcent->value()) || + (_BoundaryAnYcentre != SpinBox_Ycent->value()) || + (_BoundaryAnZcentre != SpinBox_Zcent->value()) || + (_BoundaryAnRayon != SpinBox_Radius->value()) || + (_BoundaryAnXaxis != SpinBox_Xaxis->value()) || + (_BoundaryAnYaxis != SpinBox_Yaxis->value()) || + (_BoundaryAnZaxis != SpinBox_Zaxis->value()) ) + { + Chgt = true; + _BoundaryAnXaxis= SpinBox_Xaxis->value(); + _BoundaryAnYaxis= SpinBox_Yaxis->value(); + _BoundaryAnZaxis= SpinBox_Zaxis->value(); + _BoundaryAnXcentre=SpinBox_Xcent->value(); + _BoundaryAnYcentre=SpinBox_Ycent->value(); + _BoundaryAnZcentre=SpinBox_Zcent->value(); + _BoundaryAnRayon=SpinBox_Radius->value(); + } + break; + } + + case 2 : // il s agit d une sphere + { + if ((_BoundaryAnXcentre != SpinBox_Xcentre->value()) || + (_BoundaryAnYcentre != SpinBox_Ycentre->value()) || + (_BoundaryAnZcentre != SpinBox_Zcentre->value()) || + (_BoundaryAnRayon != SpinBox_Rayon->value()) ) + { + Chgt = true; + _BoundaryAnXcentre=SpinBox_Xcentre->value(); + _BoundaryAnYcentre=SpinBox_Ycentre->value(); + _BoundaryAnZcentre=SpinBox_Zcentre->value(); + _BoundaryAnRayon=SpinBox_Rayon->value(); + } + break; + } + + case 3 : // il s agit d un cone defini par un axe et un angle + { + if ((_BoundaryAnXaxisCone != SpinBox_Cone_X1->value()) || + (_BoundaryAnYaxisCone != SpinBox_Cone_Y1->value()) || + (_BoundaryAnZaxisCone != SpinBox_Cone_Z1->value()) || + (_BoundaryAnXorigCone != SpinBox_Cone_X2->value()) || + (_BoundaryAnYorigCone != SpinBox_Cone_Y2->value()) || + (_BoundaryAnZorigCone != SpinBox_Cone_Z2->value()) || + (_BoundaryAngle != SpinBox_Cone_V1->value()) ) + { + Chgt = true; + _BoundaryAnXaxisCone = SpinBox_Cone_X1->value() ; + _BoundaryAnYaxisCone = SpinBox_Cone_Y1->value() ; + _BoundaryAnZaxisCone = SpinBox_Cone_Z1->value() ; + _BoundaryAnXorigCone = SpinBox_Cone_X2->value() ; + _BoundaryAnYorigCone = SpinBox_Cone_Y2->value() ; + _BoundaryAnZorigCone = SpinBox_Cone_Z2->value() ; + _BoundaryAngle = SpinBox_Cone_V1->value() ; + } + break; + } + + case 4 : // il s agit d un cone defini par les 2 rayons + { + if ((_BoundaryAnXcone1 != SpinBox_Cone_X1->value()) || + (_BoundaryAnYcone1 != SpinBox_Cone_Y1->value()) || + (_BoundaryAnZcone1 != SpinBox_Cone_Z1->value()) || + (_BoundaryAnRayon1 != SpinBox_Cone_V1->value()) || + (_BoundaryAnXcone2 != SpinBox_Cone_X2->value()) || + (_BoundaryAnYcone2 != SpinBox_Cone_Y2->value()) || + (_BoundaryAnZcone2 != SpinBox_Cone_Z2->value()) || + (_BoundaryAnRayon2 != SpinBox_Cone_V2->value()) ) + { + Chgt = true; + _BoundaryAnXcone1 = SpinBox_Cone_X1->value() ; + _BoundaryAnYcone1 = SpinBox_Cone_Y1->value() ; + _BoundaryAnZcone1 = SpinBox_Cone_Z1->value() ; + _BoundaryAnRayon1 = SpinBox_Cone_V1->value() ; + _BoundaryAnXcone2 = SpinBox_Cone_X2->value() ; + _BoundaryAnYcone2 = SpinBox_Cone_Y2->value() ; + _BoundaryAnZcone2 = SpinBox_Cone_Z2->value() ; + _BoundaryAnRayon2 = SpinBox_Cone_V2->value() ; + } + break; + } + case 5 : // il s agit d un tore + { + if ((_BoundaryAnToreXcentre != SpinBoxToreXcent->value()) || + (_BoundaryAnToreYcentre != SpinBoxToreYcent->value()) || + (_BoundaryAnToreZcentre != SpinBoxToreZcent->value()) || + (_BoundaryAnToreRRev != SpinBoxToreRRev->value()) || + (_BoundaryAnToreRPri != SpinBoxToreRPri->value()) || + (_BoundaryAnToreXaxe != SpinBoxToreXaxe->value()) || + (_BoundaryAnToreYaxe != SpinBoxToreYaxe->value()) || + (_BoundaryAnToreZaxe != SpinBoxToreZaxe->value()) ) + { + Chgt = true; + _BoundaryAnToreXcentre= SpinBoxToreXcent->value(); + _BoundaryAnToreYcentre= SpinBoxToreYcent->value(); + _BoundaryAnToreZcentre= SpinBoxToreZcent->value(); + _BoundaryAnToreRRev=SpinBoxToreRRev->value(); + _BoundaryAnToreRPri=SpinBoxToreRPri->value(); + _BoundaryAnToreXaxe=SpinBoxToreXaxe->value(); + _BoundaryAnToreYaxe=SpinBoxToreYaxe->value(); + _BoundaryAnToreZaxe=SpinBoxToreZaxe->value(); + } + break; + } + + } + +// Controles +// L'axe pour un cylindre + if ( _Type == 5 ) + { + double daux = _BoundaryAnXaxis*_BoundaryAnXaxis + _BoundaryAnYaxis*_BoundaryAnYaxis + _BoundaryAnZaxis*_BoundaryAnZaxis ; + if ( daux < 0.0000001 ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_AXE") ); + return false; + } + } + + // + // Création ou mise à jour de la frontière + // + bool bOK = CreateOrUpdateBoundaryAn(); + + //if ( bOK ) { HOMARD_UTILS::updateObjBrowser() ; } + + return bOK; + +} +// --------------------------------------------------- +bool SMESH_CreateBoundaryAn::CreateOrUpdateBoundaryAn() +//---------------------------------------------------- +// Creation de l'objet boundary +{ + MESSAGE("Debut de CreateOrUpdateBoundaryAn avec _Type ="<<_Type<<", _Name ="<<_Name.toStdString().c_str()<<" et LEName ="<text().trimmed().toStdString().c_str()); +// + if (_Name != LEName->text().trimmed()) + { + _Name = LEName->text().trimmed() ; + try + { + switch (_Type) + { + case 1 : // il s agit d un cylindre + { aBoundaryAn = myHomardGen->CreateBoundaryCylinder(CORBA::string_dup(_Name.toStdString().c_str()), \ + _BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnXaxis, _BoundaryAnYaxis, _BoundaryAnZaxis, _BoundaryAnRayon ); + break; + } + case 2 : // il s agit d une sphere + { aBoundaryAn = myHomardGen->CreateBoundarySphere(CORBA::string_dup(_Name.toStdString().c_str()), \ + _BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnRayon); + break; + } + case 3 : // il s agit d un cone defini par un axe et un angle + { aBoundaryAn = myHomardGen->CreateBoundaryConeA(CORBA::string_dup(_Name.toStdString().c_str()), \ + _BoundaryAnXaxisCone, _BoundaryAnYaxisCone, _BoundaryAnZaxisCone, _BoundaryAngle, \ + _BoundaryAnXorigCone, _BoundaryAnYorigCone, _BoundaryAnYorigCone); + break; + } + case 4 : // il s agit d un cone defini par les 2 rayons + { aBoundaryAn = myHomardGen->CreateBoundaryConeR(CORBA::string_dup(_Name.toStdString().c_str()), \ + _BoundaryAnXcone1, _BoundaryAnYcone1, _BoundaryAnZcone1, _BoundaryAnRayon1, \ + _BoundaryAnXcone2, _BoundaryAnYcone2, _BoundaryAnZcone2, _BoundaryAnRayon2); + break; + } + case 5 : // il s agit d un tore + { aBoundaryAn = myHomardGen->CreateBoundaryTorus(CORBA::string_dup(_Name.toStdString().c_str()), \ + _BoundaryAnToreXcentre, _BoundaryAnToreYcentre, _BoundaryAnToreZcentre, _BoundaryAnToreXaxe, _BoundaryAnToreYaxe, _BoundaryAnToreZaxe, _BoundaryAnToreRRev, _BoundaryAnToreRPri ); + break; + } + } + } + catch( SALOME::SALOME_Exception& S_ex ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr(CORBA::string_dup(S_ex.details.text)) ); + return false ; + } + _parent->AddBoundaryAn(_Name); + + return true; + } + else { + QMessageBox::warning( 0, QObject::tr("HOM_WARNING"), + QObject::tr("HOM_SELECT_OBJECT_4") ); + return false ; + } + MESSAGE("Fin de CreateOrUpdateBoundaryAn"); +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryAn::PushOnOK() +// ------------------------------------------------------------------------ +{ + if (PushOnApply()) this->close(); +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryAn::PushOnHelp() +// ------------------------------------------------------------------------ +{ + SMESH::ShowHelpFile(QString("gui_create_boundary.html")); + //std::string LanguageShort = myHomardGen->GetLanguageShort(); + //HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("un-cylindre"), QString(LanguageShort.c_str())); +} + +// ----------------------------------- +void SMESH_CreateBoundaryAn::SetNewName() +// ----------------------------------- +{ +// Recherche d'un nom par defaut qui n'existe pas encore + + SMESHHOMARD::listeBoundarys_var MyObjects = myHomardGen->GetAllBoundarysName(); + int num = 0; QString aName=""; + while (aName=="" ) + { + aName.setNum(num+1) ; + aName.insert(0, QString("Boun_")) ; + for ( int i=0; ilength(); i++) + { + if ( aName == QString(MyObjects[i])) + { + num ++ ; + aName = "" ; + break ; + } + } + } + LEName->setText(aName); +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryAn::SetCylinder() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetCylinder") + gBCylindre->setVisible(1); + gBSphere->setVisible(0); + gBCone->setVisible(0); + gBTore->setVisible(0); +// + _Type=1; +// + adjustSize(); +// MESSAGE("Fin de SetCylinder") +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryAn::SetSphere() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetSphere") + gBCylindre->setVisible(0); + gBSphere->setVisible(1); + gBCone->setVisible(0); + gBTore->setVisible(0); +// + _Type=2; +// + adjustSize(); +// MESSAGE("Fin de SetSphere") +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryAn::SetConeR() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetConeR") +// +// Stockage et conversion des valeurs si elles ont change + if ((_BoundaryAnXaxisCone != SpinBox_Cone_X1->value()) || + (_BoundaryAnYaxisCone != SpinBox_Cone_Y1->value()) || + (_BoundaryAnZaxisCone != SpinBox_Cone_Z1->value()) || + (_BoundaryAnXorigCone != SpinBox_Cone_X2->value()) || + (_BoundaryAnYorigCone != SpinBox_Cone_Y2->value()) || + (_BoundaryAnZorigCone != SpinBox_Cone_Z2->value()) || + (_BoundaryAngle != SpinBox_Cone_V1->value()) ) + { + MESSAGE("Stockage et conversion") + _BoundaryAnXaxisCone = SpinBox_Cone_X1->value() ; + _BoundaryAnYaxisCone = SpinBox_Cone_Y1->value() ; + _BoundaryAnZaxisCone = SpinBox_Cone_Z1->value() ; + _BoundaryAnXorigCone = SpinBox_Cone_X2->value() ; + _BoundaryAnYorigCone = SpinBox_Cone_Y2->value() ; + _BoundaryAnZorigCone = SpinBox_Cone_Z2->value() ; + _BoundaryAngle = SpinBox_Cone_V1->value() ; + convertRayonAngle(-1) ; + } +// + _Type=4; +// + TLCone_X1->setText(QApplication::translate("CreateBoundaryAn", "X centre 1", 0)); + SpinBox_Cone_X1->setValue(_BoundaryAnXcone1); + TLCone_Y1->setText(QApplication::translate("CreateBoundaryAn", "Y centre 1", 0)); + SpinBox_Cone_Y1->setValue(_BoundaryAnYcone1); + TLCone_Z1->setText(QApplication::translate("CreateBoundaryAn", "Z centre 1", 0)); + SpinBox_Cone_Z1->setValue(_BoundaryAnZcone1); +// + TLCone_V1->setText(QApplication::translate("CreateBoundaryAn", "Radius 1", 0)); + SpinBox_Cone_V1->setSingleStep(_Rayon/10.); + SpinBox_Cone_V1->setMaximum(100000.*_DMax); + SpinBox_Cone_V1->setValue(_BoundaryAnRayon1); +// + TLCone_X2->setText(QApplication::translate("CreateBoundaryAn", "X centre 2", 0)); + SpinBox_Cone_X2->setValue(_BoundaryAnXcone2); + TLCone_Y2->setText(QApplication::translate("CreateBoundaryAn", "Y centre 2", 0)); + SpinBox_Cone_Y2->setValue(_BoundaryAnYcone2); + TLCone_Z2->setText(QApplication::translate("CreateBoundaryAn", "Z centre 2", 0)); + SpinBox_Cone_Z2->setValue(_BoundaryAnZcone2); +// + TLCone_V2->setVisible(1); + SpinBox_Cone_V2->setVisible(1); + TLCone_V2->setText(QApplication::translate("CreateBoundaryAn", "Radius 2", 0)); + SpinBox_Cone_V2->setValue(_BoundaryAnRayon2); +// +// MESSAGE("Fin de SetConeR") +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryAn::SetConeA() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetConeA") +// Stockage et conversion des valeurs si elles ont change + if ((_BoundaryAnXcone1 != SpinBox_Cone_X1->value()) || + (_BoundaryAnYcone1 != SpinBox_Cone_Y1->value()) || + (_BoundaryAnZcone1 != SpinBox_Cone_Z1->value()) || + (_BoundaryAnRayon1 != SpinBox_Cone_V1->value()) || + (_BoundaryAnXcone2 != SpinBox_Cone_X2->value()) || + (_BoundaryAnYcone2 != SpinBox_Cone_Y2->value()) || + (_BoundaryAnZcone2 != SpinBox_Cone_Z2->value()) || + (_BoundaryAnRayon2 != SpinBox_Cone_V2->value()) ) + { + MESSAGE("Stockage et conversion") + _BoundaryAnXcone1 = SpinBox_Cone_X1->value() ; + _BoundaryAnYcone1 = SpinBox_Cone_Y1->value() ; + _BoundaryAnZcone1 = SpinBox_Cone_Z1->value() ; + _BoundaryAnRayon1 = SpinBox_Cone_V1->value() ; + _BoundaryAnXcone2 = SpinBox_Cone_X2->value() ; + _BoundaryAnYcone2 = SpinBox_Cone_Y2->value() ; + _BoundaryAnZcone2 = SpinBox_Cone_Z2->value() ; + _BoundaryAnRayon2 = SpinBox_Cone_V2->value() ; + convertRayonAngle(1) ; + } +// + _Type=3; +// + TLCone_X1->setText(QApplication::translate("CreateBoundaryAn", "X axis", 0)); + SpinBox_Cone_X1->setValue(_BoundaryAnXaxisCone); + TLCone_Y1->setText(QApplication::translate("CreateBoundaryAn", "Y axis", 0)); + SpinBox_Cone_Y1->setValue(_BoundaryAnYaxisCone); + TLCone_Z1->setText(QApplication::translate("CreateBoundaryAn", "Z axis", 0)); + SpinBox_Cone_Z1->setValue(_BoundaryAnZaxisCone); +// + TLCone_X2->setText(QApplication::translate("CreateBoundaryAn", "X centre", 0)); + SpinBox_Cone_X2->setValue(_BoundaryAnXorigCone); + TLCone_Y2->setText(QApplication::translate("CreateBoundaryAn", "Y centre", 0)); + SpinBox_Cone_Y2->setValue(_BoundaryAnYorigCone); + TLCone_Z2->setText(QApplication::translate("CreateBoundaryAn", "Z centre", 0)); + SpinBox_Cone_Z2->setValue(_BoundaryAnZorigCone); +// + TLCone_V1->setText(QApplication::translate("CreateBoundaryAn", "Angle", 0)); + SpinBox_Cone_V1->setValue(_BoundaryAngle); + SpinBox_Cone_V1->setSingleStep(1.); + SpinBox_Cone_V1->setMaximum(90.); +// + TLCone_V2->setVisible(0); + SpinBox_Cone_V2->setVisible(0); +// MESSAGE("Fin de SetConeA") +} + + +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryAn::SetCone() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetCone") + gBCylindre->setVisible(0); + gBSphere->setVisible(0); + gBCone->setVisible(1); + gBTore->setVisible(0); +// + if ( RB_Def_radius->isChecked() ) + { + SetConeR(); + } + else + { + SetConeA(); + } +// + adjustSize(); +// MESSAGE("Fin de SetCone") +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryAn::SetTore() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetTore") + gBCylindre->setVisible(0); + gBSphere->setVisible(0); + gBCone->setVisible(0); + gBTore->setVisible(1); +// + _Type=5; +// + adjustSize(); +// MESSAGE("Fin de SetTore") +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryAn::convertRayonAngle(int option) +// ------------------------------------------------------------------------ +// Conversion entre les deux formulations du cone : +// par deux rayons ou avec un axe et un angle. +// Voir sfcoi1 de HOMARD +{ + MESSAGE("Debut de convertRayonAngle, option = "< BO = AB*RB/(RA-RB) +// Angle : tg(alpha) = RA/AO +// + double daux ; +// De rayon vers angle : + if ( option == 1 ) + { + double xa, ya, za, ra ; + double xb, yb, zb, rb ; +// Positionnement de A vers B, avec RA>RB + if ( _BoundaryAnRayon1 > _BoundaryAnRayon2 ) + { + xa = _BoundaryAnXcone1 ; + ya = _BoundaryAnYcone1 ; + za = _BoundaryAnZcone1 ; + ra = _BoundaryAnRayon1 ; + xb = _BoundaryAnXcone2 ; + yb = _BoundaryAnYcone2 ; + zb = _BoundaryAnZcone2 ; + rb = _BoundaryAnRayon2 ; + } + else + { + xa = _BoundaryAnXcone2 ; + ya = _BoundaryAnYcone2 ; + za = _BoundaryAnZcone2 ; + ra = _BoundaryAnRayon2 ; + xb = _BoundaryAnXcone1 ; + yb = _BoundaryAnYcone1 ; + zb = _BoundaryAnZcone1 ; + rb = _BoundaryAnRayon1 ; + } +// Axe : relie les deux centres, de A vers B. L'axe est normalise + _BoundaryAnXaxisCone = xb - xa ; + _BoundaryAnYaxisCone = yb - ya ; + _BoundaryAnZaxisCone = zb - za ; + daux = sqrt ( _BoundaryAnXaxisCone*_BoundaryAnXaxisCone + _BoundaryAnYaxisCone*_BoundaryAnYaxisCone + _BoundaryAnZaxisCone*_BoundaryAnZaxisCone ) ; + _BoundaryAnXaxisCone = _BoundaryAnXaxisCone/daux ; + _BoundaryAnYaxisCone = _BoundaryAnYaxisCone/daux ; + _BoundaryAnZaxisCone = _BoundaryAnZaxisCone/daux ; +// Origine + daux = daux * rb / (ra-rb) ; + _BoundaryAnXorigCone = xb + daux*_BoundaryAnXaxisCone ; + _BoundaryAnYorigCone = yb + daux*_BoundaryAnYaxisCone ; + _BoundaryAnZorigCone = zb + daux*_BoundaryAnZaxisCone ; +// Angle en degre + daux = ra / sqrt((_BoundaryAnXorigCone-xa)*(_BoundaryAnXorigCone-xa) + (_BoundaryAnYorigCone-ya)*(_BoundaryAnYorigCone-ya) + (_BoundaryAnZorigCone-za)*(_BoundaryAnZorigCone-za) ) ; + _BoundaryAngle = atan(daux)*180./PI ; + } +// D'angle vers rayon : + else + { + double xax, yax, zax ; +// L'axe est normalise + daux = sqrt ( _BoundaryAnXaxisCone*_BoundaryAnXaxisCone + _BoundaryAnYaxisCone*_BoundaryAnYaxisCone + _BoundaryAnZaxisCone*_BoundaryAnZaxisCone ) ; + xax = _BoundaryAnXaxisCone/daux ; + yax = _BoundaryAnYaxisCone/daux ; + zax = _BoundaryAnZaxisCone/daux ; +// Centre 1 : l'origine + _BoundaryAnXcone1 = _BoundaryAnXorigCone ; + _BoundaryAnYcone1 = _BoundaryAnYorigCone ; + _BoundaryAnZcone1 = _BoundaryAnZorigCone ; +// Rayon 1 : nul + _BoundaryAnRayon1 = 0. ; +// Centre 2 : l'origine decalee d'une longueur arbitraire le long de l'axe + _BoundaryAnXcone2 = _BoundaryAnXorigCone + _DMax*xax ; + _BoundaryAnYcone2 = _BoundaryAnYorigCone + _DMax*yax ; + _BoundaryAnZcone2 = _BoundaryAnZorigCone + _DMax*zax ; +// Rayon 2 : a calculer + _BoundaryAnRayon2 = _DMax*tan(_BoundaryAngle*PI/180.) ; + } +// MESSAGE("Fin de convertRayonAngle") +} + +// ------------------------------------------------------------------------------- +SMESH_CreateBoundaryCAO::SMESH_CreateBoundaryCAO(SMESHGUI_HomardAdaptDlg* parent, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName, QString aName) +// --------------------------------------------------------------------------------- +/* Constructs a SMESH_CreateBoundaryCAO */ + : + QDialog(0), SMESH_Ui_CreateBoundaryCAO(), + _parent(parent), _aName(aName), + myHomardGen(SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen0)), + _aCaseName(caseName) + { + MESSAGE("Constructeur") ; + setupUi(this); + setModal(modal); + InitConnect(); + + if ( _aName == QString("") ) {SetNewName();}; + } + +// ------------------------------------------------------------------------ +SMESH_CreateBoundaryCAO::~SMESH_CreateBoundaryCAO() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryCAO::InitConnect() +// ------------------------------------------------------------------------ +{ + connect( PushFichier, SIGNAL(pressed()), this, SLOT(SetCAOFile())); + connect( buttonOk, SIGNAL(pressed()), this, SLOT( PushOnOK())); + connect( buttonApply, SIGNAL(pressed()), this, SLOT( PushOnApply())); + connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close())); + connect( buttonHelp, SIGNAL(pressed()), this, SLOT( PushOnHelp())); + connect( CBGroupe, SIGNAL(stateChanged(int)), this, SLOT( SetFiltrage())); +} + +// ------------------------------------------------------------------------ +bool SMESH_CreateBoundaryCAO::PushOnApply() +// ------------------------------------------------------------------------ +// Appele lorsque l'un des boutons Ok ou Apply est presse +// +{ +// Verifications + + QString aName=LEName->text().trimmed(); + if (aName=="") { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_BOUN_NAME") ); + return false; + } + +// La CAO + QString aCAOFile=LEFileName->text().trimmed(); + if (aCAOFile ==QString("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_BOUN_CAO") ); + return false; + } + +// Creation de l'objet CORBA si ce n'est pas deja fait sous le meme nom + if ( _aName != aName ) + { + try + { + _aName=aName; + aBoundary=myHomardGen->CreateBoundaryCAO(CORBA::string_dup(_aName.toStdString().c_str()), aCAOFile.toStdString().c_str()); + _parent->AddBoundaryCAO(_aName); + aBoundary->SetCaseCreation(_aCaseName.toStdString().c_str()); + } + catch( SALOME::SALOME_Exception& S_ex ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr(CORBA::string_dup(S_ex.details.text)) ); + return false; + } + } + +// Les groupes + AssocieLesGroupes(); + + //HOMARD_UTILS::updateObjBrowser(); + return true; +} + + +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryCAO::PushOnOK() +// ------------------------------------------------------------------------ +{ + if (PushOnApply()) this->close(); + if ( _parent ) { _parent->raise(); _parent->activateWindow(); }; +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryCAO::PushOnHelp() +// ------------------------------------------------------------------------ +{ + SMESH::ShowHelpFile(QString("gui_create_boundary.html")); + //std::string LanguageShort = myHomardGen->GetLanguageShort(); + //HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("CAO"), QString(LanguageShort.c_str())); +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryCAO::AssocieLesGroupes() +// ------------------------------------------------------------------------ +{ + SMESHHOMARD::ListGroupType_var aSeqGroupe = new SMESHHOMARD::ListGroupType; + aSeqGroupe->length(_listeGroupesBoundary.size()); + QStringList::const_iterator it; + int i=0; + for (it = _listeGroupesBoundary.constBegin(); it != _listeGroupesBoundary.constEnd(); it++) + aSeqGroupe[i++]=(*it).toStdString().c_str(); + aBoundary->SetGroups(aSeqGroupe); + +} + +// ------------------------------------------------- +void SMESH_CreateBoundaryCAO::SetNewName() +// -------------------------------------------------- +{ + + SMESHHOMARD::listeBoundarys_var MyObjects = myHomardGen->GetAllBoundarysName(); + int num = 0; QString aName=""; + while (aName == QString("") ) + { + aName.setNum(num+1) ; + aName.insert(0, QString("Boun_")) ; + for ( int i=0; ilength(); i++) + { + if ( aName == QString(MyObjects[i])) + { + num ++ ; + aName = "" ; + break ; + } + } + } + LEName->setText(aName); +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryCAO::SetCAOFile() +// ------------------------------------------------------------------------ +{ + QString aCAOFile = SMESH_HOMARD_QT_COMMUN::PushNomFichier( false, QString("xao") ); + if (!(aCAOFile.isEmpty())) LEFileName->setText(aCAOFile); +} + +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryCAO::setGroups (QStringList listGroup) +// ------------------------------------------------------------------------ +{ + _listeGroupesBoundary = listGroup; +} +// ------------------------------------------------------------------------ +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) ; + aDlg->show(); +} + +// ------------------------------------------------------------------------------- +SMESH_CreateBoundaryDi::SMESH_CreateBoundaryDi(SMESHGUI_HomardAdaptDlg* parent, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName, QString aName) +// --------------------------------------------------------------------------------- +/* Constructs a SMESH_CreateBoundaryDi */ + : + QDialog(0), SMESH_Ui_CreateBoundaryDi(), + _parent(parent), _aName(aName), + myHomardGen(SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen0)), + _aCaseName(caseName) + { + MESSAGE("Constructeur") ; + setupUi(this); + setModal(modal); + InitConnect(); + + if ( _aName == QString("") ) {SetNewName();}; + } + +// ------------------------------------------------------------------------ +SMESH_CreateBoundaryDi::~SMESH_CreateBoundaryDi() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryDi::InitConnect() +// ------------------------------------------------------------------------ +{ + connect( PushFichier, SIGNAL(pressed()), this, SLOT(SetMeshFile())); + connect( buttonOk, SIGNAL(pressed()), this, SLOT( PushOnOK())); + connect( buttonApply, SIGNAL(pressed()), this, SLOT( PushOnApply())); + connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close())); + connect( buttonHelp, SIGNAL(pressed()), this, SLOT( PushOnHelp())); + connect( CBGroupe, SIGNAL(stateChanged(int)), this, SLOT( SetFiltrage())); +} + +// ------------------------------------------------------------------------ +bool SMESH_CreateBoundaryDi::PushOnApply() +// ------------------------------------------------------------------------ +// Appele lorsque l'un des boutons Ok ou Apply est presse +// +{ +// Verifications + + QString aName=LEName->text().trimmed(); + if (aName=="") { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_BOUN_NAME") ); + return false; + } + +// Le maillage de la frontiere discrete + QString aMeshFile=LEFileName->text().trimmed(); + if (aMeshFile ==QString("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_BOUN_MESH") ); + return false; + } + + // Le nom du maillage de la frontiere discrete + QString aMeshName = SMESH_HOMARD_QT_COMMUN::LireNomMaillage(aMeshFile); + if (aMeshName == "" ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MED_FILE_2") ); + return false; + } + +// Creation de l'objet CORBA si ce n'est pas deja fait sous le meme nom + if ( _aName != aName ) + { + try + { + _aName=aName; + aBoundary=myHomardGen->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()); + } + catch( SALOME::SALOME_Exception& S_ex ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr(CORBA::string_dup(S_ex.details.text)) ); + return false; + } + } + +// Les groupes + AssocieLesGroupes(); + + //HOMARD_UTILS::updateObjBrowser(); + return true; +} + + +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryDi::PushOnOK() +// ------------------------------------------------------------------------ +{ + if (PushOnApply()) this->close(); + if ( _parent ) { _parent->raise(); _parent->activateWindow(); }; +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryDi::PushOnHelp() +// ------------------------------------------------------------------------ +{ + SMESH::ShowHelpFile(QString("gui_create_boundary.html")); + //std::string LanguageShort = myHomardGen->GetLanguageShort(); + //HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("frontiere-discrete"), QString(LanguageShort.c_str())); +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryDi::AssocieLesGroupes() +// ------------------------------------------------------------------------ +{ + SMESHHOMARD::ListGroupType_var aSeqGroupe = new SMESHHOMARD::ListGroupType; + aSeqGroupe->length(_listeGroupesBoundary.size()); + QStringList::const_iterator it; + int i=0; + for (it = _listeGroupesBoundary.constBegin(); it != _listeGroupesBoundary.constEnd(); it++) + aSeqGroupe[i++]=(*it).toStdString().c_str(); + aBoundary->SetGroups(aSeqGroupe); + +} + +// ------------------------------------------------- +void SMESH_CreateBoundaryDi::SetNewName() +// -------------------------------------------------- +{ + + SMESHHOMARD::listeBoundarys_var MyObjects = myHomardGen->GetAllBoundarysName(); + int num = 0; QString aName=""; + while (aName == QString("") ) + { + aName.setNum(num+1) ; + aName.insert(0, QString("Boun_")) ; + for ( int i=0; ilength(); i++) + { + if ( aName == QString(MyObjects[i])) + { + num ++ ; + aName = "" ; + break ; + } + } + } + LEName->setText(aName); +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryDi::SetMeshFile() +// ------------------------------------------------------------------------ +{ + QString aMeshFile = SMESH_HOMARD_QT_COMMUN::PushNomFichier( false, QString("med") ); + if (!(aMeshFile.isEmpty())) LEFileName->setText(aMeshFile); +} + +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryDi::setGroups (QStringList listGroup) +// ------------------------------------------------------------------------ +{ + _listeGroupesBoundary = listGroup; +} +// ------------------------------------------------------------------------ +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); + aDlg->show(); +} + +// ------------------------------------------------------------------------ +SMESH_EditBoundaryAn::SMESH_EditBoundaryAn( SMESHGUI_HomardAdaptDlg* parent, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen, + QString caseName, QString Name ): +// ------------------------------------------------------------------------ +/* Constructs a SMESH_EditBoundaryAn + herite de SMESH_CreateBoundaryAn +*/ + SMESH_CreateBoundaryAn(parent, myHomardGen, caseName) +{ + MESSAGE("Debut de SMESH_EditBoundaryAn pour " << Name.toStdString().c_str()); + setWindowTitle(QObject::tr("HOM_BOUN_A_EDIT_WINDOW_TITLE")); + _Name=Name; + aBoundaryAn = myHomardGen->GetBoundary(_Name.toStdString().c_str()); + InitValEdit(); +} +// ------------------------------------------------------------------------ +SMESH_EditBoundaryAn::~SMESH_EditBoundaryAn() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryAn::InitValEdit() +// ------------------------------------------------------------------------ +{ + LEName->setText(_Name); + LEName->setReadOnly(true); + _Type = aBoundaryAn->GetType(); + MESSAGE("_Type : "<<_Type); + InitValBoundaryAnLimit(); + if (_aCaseName != QString("")) InitValBoundaryAn(); + switch (_Type) + { + case 1 : // il s agit d un cylindre + { + InitValBoundaryAnCylindre(); + SetCylinder(); + break; + } + case 2: // il s agit d une sphere + { + InitValBoundaryAnSphere(); + SetSphere(); + break; + } + case 3: // il s agit d un cone defini par un axe et un angle + { + InitValBoundaryAnConeA(); + SetConeA(); + break; + } + case 4: // il s agit d un cone defini par les 2 rayons + { + InitValBoundaryAnConeR(); + SetConeR(); + break; + } + case 5: // il s agit d un tore + { + InitValBoundaryAnTore(); + SetTore(); + break; + } + }; +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryAn::InitValBoundaryAnLimit() +// ------------------------------------------------------------------------ +{ + SMESHHOMARD::double_array_var mesCoordLimits = aBoundaryAn->GetLimit(); + ASSERT(mesCoordLimits->length() == 3 ); + _Xincr=mesCoordLimits[0]; + _Yincr=mesCoordLimits[1]; + _Zincr=mesCoordLimits[2]; +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryAn::InitValBoundaryAnCylindre() +// ------------------------------------------------------------------------ +{ + SMESHHOMARD::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords(); + ASSERT(mesCoordBoundary->length() == 7 ); + _BoundaryAnXcentre=mesCoordBoundary[0]; + _BoundaryAnYcentre=mesCoordBoundary[1]; + _BoundaryAnZcentre=mesCoordBoundary[2]; + _BoundaryAnXaxis=mesCoordBoundary[3]; + _BoundaryAnYaxis=mesCoordBoundary[4]; + _BoundaryAnZaxis=mesCoordBoundary[5]; + _BoundaryAnRayon=mesCoordBoundary[6]; +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryAn::InitValBoundaryAnSphere() +// ------------------------------------------------------------------------ +{ + SMESHHOMARD::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords(); + ASSERT(mesCoordBoundary->length() == 4 ); + _BoundaryAnXcentre=mesCoordBoundary[0]; + _BoundaryAnYcentre=mesCoordBoundary[1]; + _BoundaryAnZcentre=mesCoordBoundary[2]; + _BoundaryAnRayon=mesCoordBoundary[3]; +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryAn::InitValBoundaryAnConeA() +// ------------------------------------------------------------------------ +{ + SMESHHOMARD::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords(); + ASSERT(mesCoordBoundary->length() == 7 ); + _BoundaryAnXaxisCone=mesCoordBoundary[0]; + _BoundaryAnYaxisCone=mesCoordBoundary[1]; + _BoundaryAnZaxisCone=mesCoordBoundary[2]; + _BoundaryAngle=mesCoordBoundary[3]; + _BoundaryAnXorigCone=mesCoordBoundary[4]; + _BoundaryAnYorigCone=mesCoordBoundary[5]; + _BoundaryAnZorigCone=mesCoordBoundary[6]; + convertRayonAngle(-1) ; +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryAn::InitValBoundaryAnConeR() +// ------------------------------------------------------------------------ +{ + SMESHHOMARD::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords(); + ASSERT(mesCoordBoundary->length() == 8 ); + _BoundaryAnXcone1=mesCoordBoundary[0]; + _BoundaryAnYcone1=mesCoordBoundary[1]; + _BoundaryAnZcone1=mesCoordBoundary[2]; + _BoundaryAnRayon1=mesCoordBoundary[3]; + _BoundaryAnXcone2=mesCoordBoundary[4]; + _BoundaryAnYcone2=mesCoordBoundary[5]; + _BoundaryAnZcone2=mesCoordBoundary[6]; + _BoundaryAnRayon2=mesCoordBoundary[7]; + convertRayonAngle(1) ; +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryAn::InitValBoundaryAnTore() +// ------------------------------------------------------------------------ +{ + SMESHHOMARD::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords(); + ASSERT(mesCoordBoundary->length() == 8 ); + _BoundaryAnXcentre=mesCoordBoundary[0]; + _BoundaryAnYcentre=mesCoordBoundary[1]; + _BoundaryAnZcentre=mesCoordBoundary[2]; + _BoundaryAnXaxis=mesCoordBoundary[3]; + _BoundaryAnYaxis=mesCoordBoundary[4]; + _BoundaryAnZaxis=mesCoordBoundary[5]; + _BoundaryAnRayon1=mesCoordBoundary[6]; + _BoundaryAnRayon2=mesCoordBoundary[7]; +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryAn::SetCylinder() +// ------------------------------------------------------------------------ +{ + gBCylindre->setVisible(1); + gBSphere->setVisible(0); + gBCone->setVisible(0); + gBTore->setVisible(0); + RBCylindre->setChecked(1); + _Type=1; + RBSphere->setDisabled(true); + RBCone->setDisabled(true); + RBTore->setDisabled(true); + + SpinBox_Xcent->setValue(_BoundaryAnXcentre); + SpinBox_Ycent->setValue(_BoundaryAnYcentre); + SpinBox_Zcent->setValue(_BoundaryAnZcentre); + + SpinBox_Xaxis->setValue(_BoundaryAnXaxis); + SpinBox_Yaxis->setValue(_BoundaryAnYaxis); + SpinBox_Zaxis->setValue(_BoundaryAnZaxis); + + + SpinBox_Xaxis->setSingleStep(0.1); + SpinBox_Xcentre->setSingleStep(_Xincr); + SpinBox_Yaxis->setSingleStep(0.1); + SpinBox_Ycentre->setSingleStep(_Yincr); + SpinBox_Zaxis->setSingleStep(0.1); + SpinBox_Zcentre->setSingleStep(_Zincr); +// Rayon + SpinBox_Radius->setValue(_BoundaryAnRayon); + SpinBox_Radius->setSingleStep(_BoundaryAnRayon/10.); +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryAn::SetSphere() +// ------------------------------------------------------------------------ +{ + gBCylindre->setVisible(0); + gBSphere->setVisible(1); + RBSphere->setChecked(1); + gBCone->setVisible(0); + gBTore->setVisible(0); + RBCylindre->setDisabled(true); + RBCone->setDisabled(true); + RBTore->setDisabled(true); + _Type=2 ; + + SpinBox_Xcentre->setValue(_BoundaryAnXcentre); + if ( _Xincr > 0) { SpinBox_Xcentre->setSingleStep(_Xincr); } + else { SpinBox_Xcentre->setSingleStep(1) ; } + + SpinBox_Ycentre->setValue(_BoundaryAnYcentre); + if ( _Yincr > 0) { SpinBox_Ycentre->setSingleStep(_Yincr); } + else { SpinBox_Ycentre->setSingleStep(1) ; } + + SpinBox_Zcentre->setValue(_BoundaryAnZcentre); + if ( _Zincr > 0) { SpinBox_Zcentre->setSingleStep(_Zincr); } + else { SpinBox_Zcentre->setSingleStep(1);} + + SpinBox_Rayon->setValue(_BoundaryAnRayon); +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryAn::SetConeA() +// ------------------------------------------------------------------------ +{ + gBCylindre->setVisible(0); + gBSphere->setVisible(0); + gBCone->setVisible(1); + RBCone->setChecked(1); + gBTore->setVisible(0); + RB_Def_angle->setChecked(1); + RBCylindre->setDisabled(true); + RBSphere->setDisabled(true); + RBTore->setDisabled(true); + _Type=3; +// + TLCone_X1->setText(QApplication::translate("CreateBoundaryAn", "X axis", 0)); + SpinBox_Cone_X1->setValue(_BoundaryAnXaxisCone); + TLCone_Y1->setText(QApplication::translate("CreateBoundaryAn", "Y axis", 0)); + SpinBox_Cone_Y1->setValue(_BoundaryAnYaxisCone); + TLCone_Z1->setText(QApplication::translate("CreateBoundaryAn", "Z axis", 0)); + SpinBox_Cone_Z1->setValue(_BoundaryAnZaxisCone); +// + TLCone_X2->setText(QApplication::translate("CreateBoundaryAn", "X centre", 0)); + SpinBox_Cone_X2->setValue(_BoundaryAnXorigCone); + TLCone_Y2->setText(QApplication::translate("CreateBoundaryAn", "Y centre", 0)); + SpinBox_Cone_Y2->setValue(_BoundaryAnYorigCone); + TLCone_Z2->setText(QApplication::translate("CreateBoundaryAn", "Z centre", 0)); + SpinBox_Cone_Z2->setValue(_BoundaryAnZorigCone); +// + TLCone_V1->setText(QApplication::translate("CreateBoundaryAn", "Angle", 0)); + SpinBox_Cone_V1->setValue(_BoundaryAngle); + SpinBox_Cone_V1->setSingleStep(1.); + SpinBox_Cone_V1->setMaximum(90.); +// + TLCone_V2->setVisible(0); + SpinBox_Cone_V2->setVisible(0); +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryAn::SetConeR() +// ------------------------------------------------------------------------ +{ + gBCylindre->setVisible(0); + gBSphere->setVisible(0); + gBCone->setVisible(1); + gBTore->setVisible(0); + RBCone->setChecked(1); + RB_Def_radius->setChecked(1); + RBCylindre->setDisabled(true); + RBSphere->setDisabled(true); + RBTore->setDisabled(true); + _Type=4; +// + TLCone_X1->setText(QApplication::translate("CreateBoundaryAn", "X centre 1", 0)); + SpinBox_Cone_X1->setValue(_BoundaryAnXcone1); + TLCone_Y1->setText(QApplication::translate("CreateBoundaryAn", "Y centre 1", 0)); + SpinBox_Cone_Y1->setValue(_BoundaryAnYcone1); + TLCone_Z1->setText(QApplication::translate("CreateBoundaryAn", "Z centre 1", 0)); + SpinBox_Cone_Z1->setValue(_BoundaryAnZcone1); +// + TLCone_V1->setText(QApplication::translate("CreateBoundaryAn", "Radius 1", 0)); + SpinBox_Cone_V1->setSingleStep(_Rayon/10.); + SpinBox_Cone_V1->setMaximum(100000.*_DMax); + SpinBox_Cone_V1->setValue(_BoundaryAnRayon1); +// + TLCone_X2->setText(QApplication::translate("CreateBoundaryAn", "X centre 2", 0)); + SpinBox_Cone_X2->setValue(_BoundaryAnXcone2); + TLCone_Y2->setText(QApplication::translate("CreateBoundaryAn", "Y centre 2", 0)); + SpinBox_Cone_Y2->setValue(_BoundaryAnYcone2); + TLCone_Z2->setText(QApplication::translate("CreateBoundaryAn", "Z centre 2", 0)); + SpinBox_Cone_Z2->setValue(_BoundaryAnZcone2); +// + TLCone_V2->setVisible(1); + SpinBox_Cone_V2->setVisible(1); + TLCone_V2->setText(QApplication::translate("CreateBoundaryAn", "Radius 2", 0)); + SpinBox_Cone_V2->setValue(_BoundaryAnRayon2); +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryAn::SetTore() +// ------------------------------------------------------------------------ +{ + gBCylindre->setVisible(0); + gBSphere->setVisible(0); + gBCone->setVisible(0); + gBTore->setVisible(1); + RBTore->setChecked(1); + _Type=5; + RBCylindre->setDisabled(true); + RBSphere->setDisabled(true); + RBCone->setDisabled(true); + + SpinBoxToreXcent->setValue(_BoundaryAnXcentre); + SpinBoxToreYcent->setValue(_BoundaryAnYcentre); + SpinBoxToreZcent->setValue(_BoundaryAnZcentre); + + SpinBoxToreXaxe->setValue(_BoundaryAnXaxis); + SpinBoxToreYaxe->setValue(_BoundaryAnYaxis); + SpinBoxToreZaxe->setValue(_BoundaryAnZaxis); + + + SpinBoxToreXaxe->setSingleStep(0.1); + SpinBoxToreXcent->setSingleStep(_Xincr); + SpinBoxToreYaxe->setSingleStep(0.1); + SpinBoxToreYcent->setSingleStep(_Yincr); + SpinBoxToreZaxe->setSingleStep(0.1); + SpinBoxToreZcent->setSingleStep(_Zincr); +// Rayon de revolution + SpinBoxToreRRev->setValue(_BoundaryAnRayon1); + SpinBoxToreRRev->setSingleStep(_BoundaryAnRayon1/10.); +// Rayon primaire + SpinBoxToreRPri->setValue(_BoundaryAnRayon2); + SpinBoxToreRPri->setSingleStep(_BoundaryAnRayon2/10.); +// + adjustSize(); +} +// --------------------------------------------------- +bool SMESH_EditBoundaryAn::CreateOrUpdateBoundaryAn() +//---------------------------------------------------- +// Mise a jour des attributs de la BoundaryAn +{ + switch (_Type) + { + case 1 : // il s agit d un cylindre + { + aBoundaryAn->SetCylinder(_BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnXaxis, _BoundaryAnYaxis, _BoundaryAnZaxis, _BoundaryAnRayon ); + break; + } + case 2 : // il s agit d une sphere + { + aBoundaryAn->SetSphere(_BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnRayon); + break; + } + case 3 : // il s agit d un cone defini par un axe et un angle + { + aBoundaryAn = myHomardGen->CreateBoundaryConeA(CORBA::string_dup(_Name.toStdString().c_str()), \ + _BoundaryAnXaxisCone, _BoundaryAnYaxisCone, _BoundaryAnZaxisCone, _BoundaryAngle, \ + _BoundaryAnXorigCone, _BoundaryAnYorigCone, _BoundaryAnYorigCone); + break; + } + case 4 : // il s agit d un cone defini par les 2 rayons + { + aBoundaryAn = myHomardGen->CreateBoundaryConeR(CORBA::string_dup(_Name.toStdString().c_str()), \ + _BoundaryAnXcone1, _BoundaryAnYcone1, _BoundaryAnZcone1, _BoundaryAnRayon1, \ + _BoundaryAnXcone2, _BoundaryAnYcone2, _BoundaryAnZcone2, _BoundaryAnRayon2); + break; + } + case 5 : // il s agit d un tore + { + aBoundaryAn->SetTorus(_BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnXaxis, _BoundaryAnYaxis, _BoundaryAnZaxis, _BoundaryAnRayon1, _BoundaryAnRayon2 ); + break; + } + } + if (Chgt) myHomardGen->InvalideBoundary(_Name.toStdString().c_str()); + //HOMARD_UTILS::updateObjBrowser(); + return true; +} + +// -------------------------------------------------------------------------------------- +/* Constructs a SMESH_EditBoundaryCAO + herite de SMESH_CreateBoundaryCAO +*/ +// -------------------------------------------------------------------------------------- +SMESH_EditBoundaryCAO::SMESH_EditBoundaryCAO( SMESHGUI_HomardAdaptDlg* parent, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen, + QString caseName, QString Name): + SMESH_CreateBoundaryCAO(parent, modal, myHomardGen, caseName, Name) +{ + MESSAGE("Debut de Boundary pour " << Name.toStdString().c_str()); + setWindowTitle(QObject::tr("HOM_BOUN_C_EDIT_WINDOW_TITLE")); + try + { + aBoundary=myHomardGen->GetBoundary(CORBA::string_dup(_aName.toStdString().c_str())); + if (caseName==QString("")) { _aCaseName=aBoundary->GetCaseCreation();} + InitValEdit(); + } + catch( SALOME::SALOME_Exception& S_ex ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr(CORBA::string_dup(S_ex.details.text)) ); + return; + } + + SMESHHOMARD::ListGroupType_var maListe = aBoundary->GetGroups(); + for ( int i = 0; i < maListe->length(); i++ ) + _listeGroupesBoundary << QString(maListe[i]); + +} +// ------------------------------ +SMESH_EditBoundaryCAO::~SMESH_EditBoundaryCAO() +// ------------------------------ +{ +} +// ------------------------------ +void SMESH_EditBoundaryCAO::InitValEdit() +// ------------------------------ +{ + LEName->setText(_aName); + LEName->setReadOnly(true); + + QString aDataFile = aBoundary->GetDataFile(); + LEFileName->setText(aDataFile); + LEFileName->setReadOnly(1); + PushFichier->setVisible(0); +// + adjustSize(); +} +// ------------------------------ +bool SMESH_EditBoundaryCAO::PushOnApply() +// ------------------------------ +{ + return true; +} +// ------------------------------------------------------------------------ +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::ListGroupType_var _listeGroupesCas = monCas->GetGroups(); + + SMESH_EditListGroupCAO *aDlg = new SMESH_EditListGroupCAO + (this, true, SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen), + _aCaseName, _listeGroupesBoundary) ; + aDlg->show(); +} + +// ------------------------------------------------------------------------------------------------------------------------------------- +SMESH_EditBoundaryDi::SMESH_EditBoundaryDi( SMESHGUI_HomardAdaptDlg* parent, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen, + QString caseName, QString Name): +// ------------------------------------------------------------------------------------------------------------------------------------- +/* Constructs a SMESH_EditBoundaryDi + herite de SMESH_CreateBoundaryDi +*/ + SMESH_CreateBoundaryDi(parent, modal, myHomardGen, caseName, Name) +{ + 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(); + } + catch( SALOME::SALOME_Exception& S_ex ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr(CORBA::string_dup(S_ex.details.text)) ); + return; + } + + SMESHHOMARD::ListGroupType_var maListe = aBoundary->GetGroups(); + for ( int i = 0; i < maListe->length(); i++ ) + _listeGroupesBoundary << QString(maListe[i]); + +} +// ------------------------------ +SMESH_EditBoundaryDi::~SMESH_EditBoundaryDi() +// ------------------------------ +{ +} +// ------------------------------ +void SMESH_EditBoundaryDi::InitValEdit() +// ------------------------------ +{ + LEName->setText(_aName); + LEName->setReadOnly(true); + + QString aDataFile = aBoundary->GetDataFile(); + LEFileName->setText(aDataFile); + LEFileName->setReadOnly(1); + PushFichier->setVisible(0); +// + adjustSize(); +} +// ------------------------------ +bool SMESH_EditBoundaryDi::PushOnApply() +// ------------------------------ +{ + return true; +} +// ------------------------------------------------------------------------ +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::ListGroupType_var _listeGroupesCas = monCas->GetGroups(); + + SMESH_EditListGroup *aDlg = new SMESH_EditListGroup + (this, true, SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen), + _aCaseName, _listeGroupesBoundary); + aDlg->show(); +} diff --git a/src/SMESHGUI/SMESHGUI_HomardBoundaryDlg.h b/src/SMESHGUI/SMESHGUI_HomardBoundaryDlg.h new file mode 100644 index 000000000..208cd4509 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_HomardBoundaryDlg.h @@ -0,0 +1,1279 @@ +// Copyright (C) 2011-2021 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_CREATEBOUNDARY_H +#define MON_CREATEBOUNDARY_H + +#include "SMESH_SMESHGUI.hxx" + +#include +#include + +//#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(SMESH_Homard) + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class SMESHGUI_HomardAdaptDlg; + +QT_BEGIN_NAMESPACE + +class SMESH_Ui_CreateBoundaryAn +{ +public: + QGridLayout *gridLayout_5; + QLabel *Name; + QLineEdit *LEName; + QGroupBox *TypeBoundary; + QGridLayout *gridLayout; + QRadioButton *RBCylindre; + QRadioButton *RBSphere; + QRadioButton *RBCone; + QRadioButton *RBTore; + QGroupBox *gBCylindre; + QGridLayout *gridLayout1; + QDoubleSpinBox *SpinBox_Xcent; + QLabel *TLXcent; + QDoubleSpinBox *SpinBox_Radius; + QDoubleSpinBox *SpinBox_Zcent; + QLabel *TLradius; + QLabel *TLZcent; + QLabel *TLYcent; + QDoubleSpinBox *SpinBox_Ycent; + QLabel *TLXaxis; + QLabel *TLYaxis; + QLabel *TLZaxis; + QDoubleSpinBox *SpinBox_Zaxis; + QDoubleSpinBox *SpinBox_Yaxis; + QDoubleSpinBox *SpinBox_Xaxis; + QGroupBox *gBSphere; + QGridLayout *gridLayout2; + QDoubleSpinBox *SpinBox_Rayon; + QDoubleSpinBox *SpinBox_Zcentre; + QLabel *TLRayon; + QLabel *TLZcentre; + QLabel *TLYcentre; + QDoubleSpinBox *SpinBox_Ycentre; + QDoubleSpinBox *SpinBox_Xcentre; + QLabel *TLXcentre; + QGroupBox *gBCone; + QGridLayout *gridLayout_3; + QGroupBox *groupBox; + QGridLayout *gridLayout_2; + QRadioButton *RB_Def_radius; + QRadioButton *RB_Def_angle; + QLabel *TLCone_X1; + QDoubleSpinBox *SpinBox_Cone_X1; + QLabel *TLCone_X2; + QDoubleSpinBox *SpinBox_Cone_X2; + QLabel *TLCone_Y1; + QDoubleSpinBox *SpinBox_Cone_Y1; + QLabel *TLCone_Y2; + QDoubleSpinBox *SpinBox_Cone_Y2; + QLabel *TLCone_Z1; + QDoubleSpinBox *SpinBox_Cone_Z1; + QLabel *TLCone_Z2; + QDoubleSpinBox *SpinBox_Cone_Z2; + QLabel *TLCone_V1; + QDoubleSpinBox *SpinBox_Cone_V1; + QLabel *TLCone_V2; + QDoubleSpinBox *SpinBox_Cone_V2; + QGroupBox *gBTore; + QGridLayout *gridLayout_4; + QLabel *TLToreXcent; + QDoubleSpinBox *SpinBoxToreXcent; + QLabel *TLToreXaxe; + QDoubleSpinBox *SpinBoxToreXaxe; + QLabel *TLToreYcent; + QDoubleSpinBox *SpinBoxToreYcent; + QLabel *TLToreYaxe; + QDoubleSpinBox *SpinBoxToreYaxe; + QLabel *TLToreZcent; + QDoubleSpinBox *SpinBoxToreZcent; + QLabel *TLToreZaxe; + QDoubleSpinBox *SpinBoxToreZaxe; + QLabel *TLToreRayRev; + QDoubleSpinBox *SpinBoxToreRRev; + QLabel *TLToreRayPri; + QDoubleSpinBox *SpinBoxToreRPri; + QGroupBox *GBButtons; + QGridLayout *gridLayout3; + QPushButton *buttonHelp; + QPushButton *buttonCancel; + QPushButton *buttonApply; + QPushButton *buttonOk; + + void setupUi(QDialog *CreateBoundaryAn) + { + if (CreateBoundaryAn->objectName().isEmpty()) + CreateBoundaryAn->setObjectName(QString::fromUtf8("CreateBoundaryAn")); + CreateBoundaryAn->resize(522, 835); + CreateBoundaryAn->setAutoFillBackground(true); + CreateBoundaryAn->setSizeGripEnabled(true); + gridLayout_5 = new QGridLayout(CreateBoundaryAn); + gridLayout_5->setObjectName(QString::fromUtf8("gridLayout_5")); + Name = new QLabel(CreateBoundaryAn); + Name->setObjectName(QString::fromUtf8("Name")); + + gridLayout_5->addWidget(Name, 0, 0, 1, 1); + + LEName = new QLineEdit(CreateBoundaryAn); + LEName->setObjectName(QString::fromUtf8("LEName")); + LEName->setMaxLength(32); + + gridLayout_5->addWidget(LEName, 0, 1, 1, 1); + + TypeBoundary = new QGroupBox(CreateBoundaryAn); + TypeBoundary->setObjectName(QString::fromUtf8("TypeBoundary")); + QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(TypeBoundary->sizePolicy().hasHeightForWidth()); + TypeBoundary->setSizePolicy(sizePolicy); + TypeBoundary->setMinimumSize(QSize(340, 0)); + gridLayout = new QGridLayout(TypeBoundary); + gridLayout->setObjectName(QString::fromUtf8("gridLayout")); + RBCylindre = new QRadioButton(TypeBoundary); + RBCylindre->setObjectName(QString::fromUtf8("RBCylindre")); + QIcon icon; + icon.addFile(QString::fromUtf8("../../resources/cylinderpointvector.png"), QSize(), QIcon::Normal, QIcon::Off); + RBCylindre->setIcon(icon); + RBCylindre->setCheckable(true); + RBCylindre->setChecked(true); + + gridLayout->addWidget(RBCylindre, 0, 0, 1, 1); + + RBSphere = new QRadioButton(TypeBoundary); + RBSphere->setObjectName(QString::fromUtf8("RBSphere")); + QIcon icon1; + icon1.addFile(QString::fromUtf8("../../resources/zone_spherepoint.png"), QSize(), QIcon::Normal, QIcon::Off); + RBSphere->setIcon(icon1); + + gridLayout->addWidget(RBSphere, 0, 1, 1, 1); + + RBCone = new QRadioButton(TypeBoundary); + RBCone->setObjectName(QString::fromUtf8("RBCone")); + QIcon icon2; + icon2.addFile(QString::fromUtf8("../../resources/cone.png"), QSize(), QIcon::Normal, QIcon::Off); + RBCone->setIcon(icon2); + + gridLayout->addWidget(RBCone, 0, 2, 1, 1); + + RBTore = new QRadioButton(TypeBoundary); + RBTore->setObjectName(QString::fromUtf8("RBTore")); + QIcon icon3; + icon3.addFile(QString::fromUtf8("../../resources/toruspointvector.png"), QSize(), QIcon::Normal, QIcon::Off); + RBTore->setIcon(icon3); + RBTore->setCheckable(true); + RBTore->setChecked(false); + + gridLayout->addWidget(RBTore, 0, 3, 1, 1); + + + gridLayout_5->addWidget(TypeBoundary, 1, 0, 1, 2); + + gBCylindre = new QGroupBox(CreateBoundaryAn); + gBCylindre->setObjectName(QString::fromUtf8("gBCylindre")); + sizePolicy.setHeightForWidth(gBCylindre->sizePolicy().hasHeightForWidth()); + gBCylindre->setSizePolicy(sizePolicy); + gridLayout1 = new QGridLayout(gBCylindre); +#ifndef Q_OS_MAC + gridLayout1->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout1->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout1->setObjectName(QString::fromUtf8("gridLayout1")); + SpinBox_Xcent = new QDoubleSpinBox(gBCylindre); + SpinBox_Xcent->setObjectName(QString::fromUtf8("SpinBox_Xcent")); + SpinBox_Xcent->setDecimals(5); + SpinBox_Xcent->setMinimum(-999999999.000000000000000); + SpinBox_Xcent->setMaximum(999999999.000000000000000); + SpinBox_Xcent->setValue(0.000000000000000); + + gridLayout1->addWidget(SpinBox_Xcent, 0, 1, 1, 1); + + TLXcent = new QLabel(gBCylindre); + TLXcent->setObjectName(QString::fromUtf8("TLXcent")); + sizePolicy.setHeightForWidth(TLXcent->sizePolicy().hasHeightForWidth()); + TLXcent->setSizePolicy(sizePolicy); + TLXcent->setWordWrap(false); + + gridLayout1->addWidget(TLXcent, 0, 0, 1, 1); + + SpinBox_Radius = new QDoubleSpinBox(gBCylindre); + SpinBox_Radius->setObjectName(QString::fromUtf8("SpinBox_Radius")); + SpinBox_Radius->setDecimals(5); + SpinBox_Radius->setMaximum(1000000000.000000000000000); + + gridLayout1->addWidget(SpinBox_Radius, 3, 1, 1, 2); + + SpinBox_Zcent = new QDoubleSpinBox(gBCylindre); + SpinBox_Zcent->setObjectName(QString::fromUtf8("SpinBox_Zcent")); + SpinBox_Zcent->setDecimals(5); + SpinBox_Zcent->setMinimum(-999999999.000000000000000); + SpinBox_Zcent->setMaximum(999999999.000000000000000); + SpinBox_Zcent->setValue(0.000000000000000); + + gridLayout1->addWidget(SpinBox_Zcent, 2, 1, 1, 1); + + TLradius = new QLabel(gBCylindre); + TLradius->setObjectName(QString::fromUtf8("TLradius")); + sizePolicy.setHeightForWidth(TLradius->sizePolicy().hasHeightForWidth()); + TLradius->setSizePolicy(sizePolicy); + TLradius->setWordWrap(false); + + gridLayout1->addWidget(TLradius, 3, 0, 1, 1); + + TLZcent = new QLabel(gBCylindre); + TLZcent->setObjectName(QString::fromUtf8("TLZcent")); + sizePolicy.setHeightForWidth(TLZcent->sizePolicy().hasHeightForWidth()); + TLZcent->setSizePolicy(sizePolicy); + TLZcent->setWordWrap(false); + + gridLayout1->addWidget(TLZcent, 2, 0, 1, 1); + + TLYcent = new QLabel(gBCylindre); + TLYcent->setObjectName(QString::fromUtf8("TLYcent")); + sizePolicy.setHeightForWidth(TLYcent->sizePolicy().hasHeightForWidth()); + TLYcent->setSizePolicy(sizePolicy); + TLYcent->setWordWrap(false); + + gridLayout1->addWidget(TLYcent, 1, 0, 1, 1); + + SpinBox_Ycent = new QDoubleSpinBox(gBCylindre); + SpinBox_Ycent->setObjectName(QString::fromUtf8("SpinBox_Ycent")); + SpinBox_Ycent->setDecimals(5); + SpinBox_Ycent->setMinimum(-999999999.000000000000000); + SpinBox_Ycent->setMaximum(999999999.000000000000000); + SpinBox_Ycent->setValue(0.000000000000000); + + gridLayout1->addWidget(SpinBox_Ycent, 1, 1, 1, 1); + + TLXaxis = new QLabel(gBCylindre); + TLXaxis->setObjectName(QString::fromUtf8("TLXaxis")); + sizePolicy.setHeightForWidth(TLXaxis->sizePolicy().hasHeightForWidth()); + TLXaxis->setSizePolicy(sizePolicy); + TLXaxis->setWordWrap(false); + + gridLayout1->addWidget(TLXaxis, 0, 2, 1, 1); + + TLYaxis = new QLabel(gBCylindre); + TLYaxis->setObjectName(QString::fromUtf8("TLYaxis")); + sizePolicy.setHeightForWidth(TLYaxis->sizePolicy().hasHeightForWidth()); + TLYaxis->setSizePolicy(sizePolicy); + TLYaxis->setWordWrap(false); + + gridLayout1->addWidget(TLYaxis, 1, 2, 1, 1); + + TLZaxis = new QLabel(gBCylindre); + TLZaxis->setObjectName(QString::fromUtf8("TLZaxis")); + sizePolicy.setHeightForWidth(TLZaxis->sizePolicy().hasHeightForWidth()); + TLZaxis->setSizePolicy(sizePolicy); + TLZaxis->setWordWrap(false); + + gridLayout1->addWidget(TLZaxis, 2, 2, 1, 1); + + SpinBox_Zaxis = new QDoubleSpinBox(gBCylindre); + SpinBox_Zaxis->setObjectName(QString::fromUtf8("SpinBox_Zaxis")); + SpinBox_Zaxis->setDecimals(5); + SpinBox_Zaxis->setMinimum(-999999999.000000000000000); + SpinBox_Zaxis->setMaximum(999999999.000000000000000); + SpinBox_Zaxis->setValue(0.000000000000000); + + gridLayout1->addWidget(SpinBox_Zaxis, 2, 3, 1, 1); + + SpinBox_Yaxis = new QDoubleSpinBox(gBCylindre); + SpinBox_Yaxis->setObjectName(QString::fromUtf8("SpinBox_Yaxis")); + SpinBox_Yaxis->setDecimals(5); + SpinBox_Yaxis->setMinimum(-999999999.000000000000000); + SpinBox_Yaxis->setMaximum(999999999.000000000000000); + SpinBox_Yaxis->setValue(0.000000000000000); + + gridLayout1->addWidget(SpinBox_Yaxis, 1, 3, 1, 1); + + SpinBox_Xaxis = new QDoubleSpinBox(gBCylindre); + SpinBox_Xaxis->setObjectName(QString::fromUtf8("SpinBox_Xaxis")); + SpinBox_Xaxis->setDecimals(5); + SpinBox_Xaxis->setMinimum(-999999999.000000000000000); + SpinBox_Xaxis->setMaximum(999999999.000000000000000); + SpinBox_Xaxis->setValue(0.000000000000000); + + gridLayout1->addWidget(SpinBox_Xaxis, 0, 3, 1, 1); + + + gridLayout_5->addWidget(gBCylindre, 2, 0, 1, 2); + + gBSphere = new QGroupBox(CreateBoundaryAn); + gBSphere->setObjectName(QString::fromUtf8("gBSphere")); + sizePolicy.setHeightForWidth(gBSphere->sizePolicy().hasHeightForWidth()); + gBSphere->setSizePolicy(sizePolicy); + gridLayout2 = new QGridLayout(gBSphere); +#ifndef Q_OS_MAC + gridLayout2->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout2->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout2->setObjectName(QString::fromUtf8("gridLayout2")); + SpinBox_Rayon = new QDoubleSpinBox(gBSphere); + SpinBox_Rayon->setObjectName(QString::fromUtf8("SpinBox_Rayon")); + SpinBox_Rayon->setDecimals(5); + SpinBox_Rayon->setMinimum(0.000000000000000); + SpinBox_Rayon->setMaximum(999999999.000000000000000); + SpinBox_Rayon->setValue(0.000000000000000); + + gridLayout2->addWidget(SpinBox_Rayon, 1, 3, 1, 1); + + SpinBox_Zcentre = new QDoubleSpinBox(gBSphere); + SpinBox_Zcentre->setObjectName(QString::fromUtf8("SpinBox_Zcentre")); + SpinBox_Zcentre->setDecimals(5); + SpinBox_Zcentre->setMinimum(-999999999.000000000000000); + SpinBox_Zcentre->setMaximum(999999999.000000000000000); + SpinBox_Zcentre->setValue(0.000000000000000); + + gridLayout2->addWidget(SpinBox_Zcentre, 2, 1, 1, 1); + + TLRayon = new QLabel(gBSphere); + TLRayon->setObjectName(QString::fromUtf8("TLRayon")); + sizePolicy.setHeightForWidth(TLRayon->sizePolicy().hasHeightForWidth()); + TLRayon->setSizePolicy(sizePolicy); + TLRayon->setWordWrap(false); + + gridLayout2->addWidget(TLRayon, 1, 2, 1, 1); + + TLZcentre = new QLabel(gBSphere); + TLZcentre->setObjectName(QString::fromUtf8("TLZcentre")); + sizePolicy.setHeightForWidth(TLZcentre->sizePolicy().hasHeightForWidth()); + TLZcentre->setSizePolicy(sizePolicy); + TLZcentre->setWordWrap(false); + + gridLayout2->addWidget(TLZcentre, 2, 0, 1, 1); + + TLYcentre = new QLabel(gBSphere); + TLYcentre->setObjectName(QString::fromUtf8("TLYcentre")); + sizePolicy.setHeightForWidth(TLYcentre->sizePolicy().hasHeightForWidth()); + TLYcentre->setSizePolicy(sizePolicy); + TLYcentre->setWordWrap(false); + + gridLayout2->addWidget(TLYcentre, 1, 0, 1, 1); + + SpinBox_Ycentre = new QDoubleSpinBox(gBSphere); + SpinBox_Ycentre->setObjectName(QString::fromUtf8("SpinBox_Ycentre")); + SpinBox_Ycentre->setDecimals(5); + SpinBox_Ycentre->setMinimum(-999999999.000000000000000); + SpinBox_Ycentre->setMaximum(999999999.000000000000000); + SpinBox_Ycentre->setValue(0.000000000000000); + + gridLayout2->addWidget(SpinBox_Ycentre, 1, 1, 1, 1); + + SpinBox_Xcentre = new QDoubleSpinBox(gBSphere); + SpinBox_Xcentre->setObjectName(QString::fromUtf8("SpinBox_Xcentre")); + SpinBox_Xcentre->setDecimals(5); + SpinBox_Xcentre->setMinimum(-999999999.000000000000000); + SpinBox_Xcentre->setMaximum(999999999.000000000000000); + SpinBox_Xcentre->setValue(0.000000000000000); + + gridLayout2->addWidget(SpinBox_Xcentre, 0, 1, 1, 1); + + TLXcentre = new QLabel(gBSphere); + TLXcentre->setObjectName(QString::fromUtf8("TLXcentre")); + sizePolicy.setHeightForWidth(TLXcentre->sizePolicy().hasHeightForWidth()); + TLXcentre->setSizePolicy(sizePolicy); + TLXcentre->setWordWrap(false); + + gridLayout2->addWidget(TLXcentre, 0, 0, 1, 1); + + + gridLayout_5->addWidget(gBSphere, 3, 0, 1, 2); + + gBCone = new QGroupBox(CreateBoundaryAn); + gBCone->setObjectName(QString::fromUtf8("gBCone")); + sizePolicy.setHeightForWidth(gBCone->sizePolicy().hasHeightForWidth()); + gBCone->setSizePolicy(sizePolicy); + gridLayout_3 = new QGridLayout(gBCone); + gridLayout_3->setObjectName(QString::fromUtf8("gridLayout_3")); + groupBox = new QGroupBox(gBCone); + groupBox->setObjectName(QString::fromUtf8("groupBox")); + gridLayout_2 = new QGridLayout(groupBox); + gridLayout_2->setObjectName(QString::fromUtf8("gridLayout_2")); + RB_Def_radius = new QRadioButton(groupBox); + RB_Def_radius->setObjectName(QString::fromUtf8("RB_Def_radius")); + QIcon icon4; + icon4.addFile(QString::fromUtf8("../../resources/conedxyz.png"), QSize(), QIcon::Normal, QIcon::Off); + RB_Def_radius->setIcon(icon4); + RB_Def_radius->setChecked(true); + + gridLayout_2->addWidget(RB_Def_radius, 0, 0, 1, 1); + + RB_Def_angle = new QRadioButton(groupBox); + RB_Def_angle->setObjectName(QString::fromUtf8("RB_Def_angle")); + QIcon icon5; + icon5.addFile(QString::fromUtf8("../../resources/conepointvector.png"), QSize(), QIcon::Normal, QIcon::Off); + RB_Def_angle->setIcon(icon5); + + gridLayout_2->addWidget(RB_Def_angle, 0, 1, 1, 1); + + + gridLayout_3->addWidget(groupBox, 0, 0, 1, 2); + + TLCone_X1 = new QLabel(gBCone); + TLCone_X1->setObjectName(QString::fromUtf8("TLCone_X1")); + sizePolicy.setHeightForWidth(TLCone_X1->sizePolicy().hasHeightForWidth()); + TLCone_X1->setSizePolicy(sizePolicy); + TLCone_X1->setWordWrap(false); + + gridLayout_3->addWidget(TLCone_X1, 1, 0, 1, 1); + + SpinBox_Cone_X1 = new QDoubleSpinBox(gBCone); + SpinBox_Cone_X1->setObjectName(QString::fromUtf8("SpinBox_Cone_X1")); + SpinBox_Cone_X1->setDecimals(5); + SpinBox_Cone_X1->setMinimum(-999999999.000000000000000); + SpinBox_Cone_X1->setMaximum(999999999.000000000000000); + SpinBox_Cone_X1->setValue(0.000000000000000); + + gridLayout_3->addWidget(SpinBox_Cone_X1, 1, 1, 1, 1); + + TLCone_X2 = new QLabel(gBCone); + TLCone_X2->setObjectName(QString::fromUtf8("TLCone_X2")); + sizePolicy.setHeightForWidth(TLCone_X2->sizePolicy().hasHeightForWidth()); + TLCone_X2->setSizePolicy(sizePolicy); + TLCone_X2->setWordWrap(false); + + gridLayout_3->addWidget(TLCone_X2, 1, 2, 1, 1); + + SpinBox_Cone_X2 = new QDoubleSpinBox(gBCone); + SpinBox_Cone_X2->setObjectName(QString::fromUtf8("SpinBox_Cone_X2")); + SpinBox_Cone_X2->setDecimals(5); + SpinBox_Cone_X2->setMinimum(-999999999.000000000000000); + SpinBox_Cone_X2->setMaximum(999999999.000000000000000); + SpinBox_Cone_X2->setValue(0.000000000000000); + + gridLayout_3->addWidget(SpinBox_Cone_X2, 1, 3, 1, 1); + + TLCone_Y1 = new QLabel(gBCone); + TLCone_Y1->setObjectName(QString::fromUtf8("TLCone_Y1")); + sizePolicy.setHeightForWidth(TLCone_Y1->sizePolicy().hasHeightForWidth()); + TLCone_Y1->setSizePolicy(sizePolicy); + TLCone_Y1->setWordWrap(false); + + gridLayout_3->addWidget(TLCone_Y1, 2, 0, 1, 1); + + SpinBox_Cone_Y1 = new QDoubleSpinBox(gBCone); + SpinBox_Cone_Y1->setObjectName(QString::fromUtf8("SpinBox_Cone_Y1")); + SpinBox_Cone_Y1->setDecimals(5); + SpinBox_Cone_Y1->setMinimum(-999999999.000000000000000); + SpinBox_Cone_Y1->setMaximum(999999999.000000000000000); + SpinBox_Cone_Y1->setValue(0.000000000000000); + + gridLayout_3->addWidget(SpinBox_Cone_Y1, 2, 1, 1, 1); + + TLCone_Y2 = new QLabel(gBCone); + TLCone_Y2->setObjectName(QString::fromUtf8("TLCone_Y2")); + sizePolicy.setHeightForWidth(TLCone_Y2->sizePolicy().hasHeightForWidth()); + TLCone_Y2->setSizePolicy(sizePolicy); + TLCone_Y2->setWordWrap(false); + + gridLayout_3->addWidget(TLCone_Y2, 2, 2, 1, 1); + + SpinBox_Cone_Y2 = new QDoubleSpinBox(gBCone); + SpinBox_Cone_Y2->setObjectName(QString::fromUtf8("SpinBox_Cone_Y2")); + SpinBox_Cone_Y2->setDecimals(5); + SpinBox_Cone_Y2->setMinimum(-999999999.000000000000000); + SpinBox_Cone_Y2->setMaximum(999999999.000000000000000); + SpinBox_Cone_Y2->setValue(0.000000000000000); + + gridLayout_3->addWidget(SpinBox_Cone_Y2, 2, 3, 1, 1); + + TLCone_Z1 = new QLabel(gBCone); + TLCone_Z1->setObjectName(QString::fromUtf8("TLCone_Z1")); + sizePolicy.setHeightForWidth(TLCone_Z1->sizePolicy().hasHeightForWidth()); + TLCone_Z1->setSizePolicy(sizePolicy); + TLCone_Z1->setWordWrap(false); + + gridLayout_3->addWidget(TLCone_Z1, 3, 0, 1, 1); + + SpinBox_Cone_Z1 = new QDoubleSpinBox(gBCone); + SpinBox_Cone_Z1->setObjectName(QString::fromUtf8("SpinBox_Cone_Z1")); + SpinBox_Cone_Z1->setDecimals(5); + SpinBox_Cone_Z1->setMinimum(-999999999.000000000000000); + SpinBox_Cone_Z1->setMaximum(999999999.000000000000000); + SpinBox_Cone_Z1->setValue(0.000000000000000); + + gridLayout_3->addWidget(SpinBox_Cone_Z1, 3, 1, 1, 1); + + TLCone_Z2 = new QLabel(gBCone); + TLCone_Z2->setObjectName(QString::fromUtf8("TLCone_Z2")); + sizePolicy.setHeightForWidth(TLCone_Z2->sizePolicy().hasHeightForWidth()); + TLCone_Z2->setSizePolicy(sizePolicy); + TLCone_Z2->setWordWrap(false); + + gridLayout_3->addWidget(TLCone_Z2, 3, 2, 1, 1); + + SpinBox_Cone_Z2 = new QDoubleSpinBox(gBCone); + SpinBox_Cone_Z2->setObjectName(QString::fromUtf8("SpinBox_Cone_Z2")); + SpinBox_Cone_Z2->setDecimals(5); + SpinBox_Cone_Z2->setMinimum(-999999999.000000000000000); + SpinBox_Cone_Z2->setMaximum(999999999.000000000000000); + SpinBox_Cone_Z2->setValue(0.000000000000000); + + gridLayout_3->addWidget(SpinBox_Cone_Z2, 3, 3, 1, 1); + + TLCone_V1 = new QLabel(gBCone); + TLCone_V1->setObjectName(QString::fromUtf8("TLCone_V1")); + sizePolicy.setHeightForWidth(TLCone_V1->sizePolicy().hasHeightForWidth()); + TLCone_V1->setSizePolicy(sizePolicy); + TLCone_V1->setWordWrap(false); + + gridLayout_3->addWidget(TLCone_V1, 4, 0, 1, 1); + + SpinBox_Cone_V1 = new QDoubleSpinBox(gBCone); + SpinBox_Cone_V1->setObjectName(QString::fromUtf8("SpinBox_Cone_V1")); + SpinBox_Cone_V1->setDecimals(5); + SpinBox_Cone_V1->setMaximum(1000000000.000000000000000); + + gridLayout_3->addWidget(SpinBox_Cone_V1, 4, 1, 1, 1); + + TLCone_V2 = new QLabel(gBCone); + TLCone_V2->setObjectName(QString::fromUtf8("TLCone_V2")); + sizePolicy.setHeightForWidth(TLCone_V2->sizePolicy().hasHeightForWidth()); + TLCone_V2->setSizePolicy(sizePolicy); + TLCone_V2->setWordWrap(false); + + gridLayout_3->addWidget(TLCone_V2, 4, 2, 1, 1); + + SpinBox_Cone_V2 = new QDoubleSpinBox(gBCone); + SpinBox_Cone_V2->setObjectName(QString::fromUtf8("SpinBox_Cone_V2")); + SpinBox_Cone_V2->setDecimals(5); + SpinBox_Cone_V2->setMaximum(1000000000.000000000000000); + + gridLayout_3->addWidget(SpinBox_Cone_V2, 4, 3, 1, 1); + + + gridLayout_5->addWidget(gBCone, 4, 0, 1, 2); + + gBTore = new QGroupBox(CreateBoundaryAn); + gBTore->setObjectName(QString::fromUtf8("gBTore")); + sizePolicy.setHeightForWidth(gBTore->sizePolicy().hasHeightForWidth()); + gBTore->setSizePolicy(sizePolicy); + gridLayout_4 = new QGridLayout(gBTore); + gridLayout_4->setObjectName(QString::fromUtf8("gridLayout_4")); + TLToreXcent = new QLabel(gBTore); + TLToreXcent->setObjectName(QString::fromUtf8("TLToreXcent")); + sizePolicy.setHeightForWidth(TLToreXcent->sizePolicy().hasHeightForWidth()); + TLToreXcent->setSizePolicy(sizePolicy); + TLToreXcent->setWordWrap(false); + + gridLayout_4->addWidget(TLToreXcent, 0, 0, 1, 1); + + SpinBoxToreXcent = new QDoubleSpinBox(gBTore); + SpinBoxToreXcent->setObjectName(QString::fromUtf8("SpinBoxToreXcent")); + SpinBoxToreXcent->setDecimals(5); + SpinBoxToreXcent->setMinimum(-999999999.000000000000000); + SpinBoxToreXcent->setMaximum(999999999.000000000000000); + SpinBoxToreXcent->setValue(0.000000000000000); + + gridLayout_4->addWidget(SpinBoxToreXcent, 0, 1, 1, 1); + + TLToreXaxe = new QLabel(gBTore); + TLToreXaxe->setObjectName(QString::fromUtf8("TLToreXaxe")); + sizePolicy.setHeightForWidth(TLToreXaxe->sizePolicy().hasHeightForWidth()); + TLToreXaxe->setSizePolicy(sizePolicy); + TLToreXaxe->setWordWrap(false); + + gridLayout_4->addWidget(TLToreXaxe, 0, 2, 1, 1); + + SpinBoxToreXaxe = new QDoubleSpinBox(gBTore); + SpinBoxToreXaxe->setObjectName(QString::fromUtf8("SpinBoxToreXaxe")); + SpinBoxToreXaxe->setDecimals(5); + SpinBoxToreXaxe->setMinimum(-999999999.000000000000000); + SpinBoxToreXaxe->setMaximum(999999999.000000000000000); + SpinBoxToreXaxe->setValue(0.000000000000000); + + gridLayout_4->addWidget(SpinBoxToreXaxe, 0, 3, 1, 1); + + TLToreYcent = new QLabel(gBTore); + TLToreYcent->setObjectName(QString::fromUtf8("TLToreYcent")); + sizePolicy.setHeightForWidth(TLToreYcent->sizePolicy().hasHeightForWidth()); + TLToreYcent->setSizePolicy(sizePolicy); + TLToreYcent->setWordWrap(false); + + gridLayout_4->addWidget(TLToreYcent, 1, 0, 1, 1); + + SpinBoxToreYcent = new QDoubleSpinBox(gBTore); + SpinBoxToreYcent->setObjectName(QString::fromUtf8("SpinBoxToreYcent")); + SpinBoxToreYcent->setDecimals(5); + SpinBoxToreYcent->setMinimum(-999999999.000000000000000); + SpinBoxToreYcent->setMaximum(999999999.000000000000000); + SpinBoxToreYcent->setValue(0.000000000000000); + + gridLayout_4->addWidget(SpinBoxToreYcent, 1, 1, 1, 1); + + TLToreYaxe = new QLabel(gBTore); + TLToreYaxe->setObjectName(QString::fromUtf8("TLToreYaxe")); + sizePolicy.setHeightForWidth(TLToreYaxe->sizePolicy().hasHeightForWidth()); + TLToreYaxe->setSizePolicy(sizePolicy); + TLToreYaxe->setWordWrap(false); + + gridLayout_4->addWidget(TLToreYaxe, 1, 2, 1, 1); + + SpinBoxToreYaxe = new QDoubleSpinBox(gBTore); + SpinBoxToreYaxe->setObjectName(QString::fromUtf8("SpinBoxToreYaxe")); + SpinBoxToreYaxe->setDecimals(5); + SpinBoxToreYaxe->setMinimum(-999999999.000000000000000); + SpinBoxToreYaxe->setMaximum(999999999.000000000000000); + SpinBoxToreYaxe->setValue(0.000000000000000); + + gridLayout_4->addWidget(SpinBoxToreYaxe, 1, 3, 1, 1); + + TLToreZcent = new QLabel(gBTore); + TLToreZcent->setObjectName(QString::fromUtf8("TLToreZcent")); + sizePolicy.setHeightForWidth(TLToreZcent->sizePolicy().hasHeightForWidth()); + TLToreZcent->setSizePolicy(sizePolicy); + TLToreZcent->setWordWrap(false); + + gridLayout_4->addWidget(TLToreZcent, 2, 0, 1, 1); + + SpinBoxToreZcent = new QDoubleSpinBox(gBTore); + SpinBoxToreZcent->setObjectName(QString::fromUtf8("SpinBoxToreZcent")); + SpinBoxToreZcent->setDecimals(5); + SpinBoxToreZcent->setMinimum(-999999999.000000000000000); + SpinBoxToreZcent->setMaximum(999999999.000000000000000); + SpinBoxToreZcent->setValue(0.000000000000000); + + gridLayout_4->addWidget(SpinBoxToreZcent, 2, 1, 1, 1); + + TLToreZaxe = new QLabel(gBTore); + TLToreZaxe->setObjectName(QString::fromUtf8("TLToreZaxe")); + sizePolicy.setHeightForWidth(TLToreZaxe->sizePolicy().hasHeightForWidth()); + TLToreZaxe->setSizePolicy(sizePolicy); + TLToreZaxe->setWordWrap(false); + + gridLayout_4->addWidget(TLToreZaxe, 2, 2, 1, 1); + + SpinBoxToreZaxe = new QDoubleSpinBox(gBTore); + SpinBoxToreZaxe->setObjectName(QString::fromUtf8("SpinBoxToreZaxe")); + SpinBoxToreZaxe->setDecimals(5); + SpinBoxToreZaxe->setMinimum(-999999999.000000000000000); + SpinBoxToreZaxe->setMaximum(999999999.000000000000000); + SpinBoxToreZaxe->setValue(0.000000000000000); + + gridLayout_4->addWidget(SpinBoxToreZaxe, 2, 3, 1, 1); + + TLToreRayRev = new QLabel(gBTore); + TLToreRayRev->setObjectName(QString::fromUtf8("TLToreRayRev")); + sizePolicy.setHeightForWidth(TLToreRayRev->sizePolicy().hasHeightForWidth()); + TLToreRayRev->setSizePolicy(sizePolicy); + TLToreRayRev->setWordWrap(false); + + gridLayout_4->addWidget(TLToreRayRev, 3, 0, 1, 1); + + SpinBoxToreRRev = new QDoubleSpinBox(gBTore); + SpinBoxToreRRev->setObjectName(QString::fromUtf8("SpinBoxToreRRev")); + SpinBoxToreRRev->setDecimals(5); + SpinBoxToreRRev->setMaximum(1000000000.000000000000000); + + gridLayout_4->addWidget(SpinBoxToreRRev, 3, 1, 1, 1); + + TLToreRayPri = new QLabel(gBTore); + TLToreRayPri->setObjectName(QString::fromUtf8("TLToreRayPri")); + sizePolicy.setHeightForWidth(TLToreRayPri->sizePolicy().hasHeightForWidth()); + TLToreRayPri->setSizePolicy(sizePolicy); + TLToreRayPri->setWordWrap(false); + + gridLayout_4->addWidget(TLToreRayPri, 3, 2, 1, 1); + + SpinBoxToreRPri = new QDoubleSpinBox(gBTore); + SpinBoxToreRPri->setObjectName(QString::fromUtf8("SpinBoxToreRPri")); + SpinBoxToreRPri->setDecimals(5); + SpinBoxToreRPri->setMaximum(1000000000.000000000000000); + + gridLayout_4->addWidget(SpinBoxToreRPri, 3, 3, 1, 1); + + + gridLayout_5->addWidget(gBTore, 5, 0, 1, 2); + + GBButtons = new QGroupBox(CreateBoundaryAn); + GBButtons->setObjectName(QString::fromUtf8("GBButtons")); + sizePolicy.setHeightForWidth(GBButtons->sizePolicy().hasHeightForWidth()); + GBButtons->setSizePolicy(sizePolicy); + gridLayout3 = new QGridLayout(GBButtons); +#ifndef Q_OS_MAC + gridLayout3->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout3->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout3->setObjectName(QString::fromUtf8("gridLayout3")); + buttonHelp = new QPushButton(GBButtons); + buttonHelp->setObjectName(QString::fromUtf8("buttonHelp")); + + gridLayout3->addWidget(buttonHelp, 0, 3, 1, 1); + + buttonCancel = new QPushButton(GBButtons); + buttonCancel->setObjectName(QString::fromUtf8("buttonCancel")); + + gridLayout3->addWidget(buttonCancel, 0, 2, 1, 1); + + buttonApply = new QPushButton(GBButtons); + buttonApply->setObjectName(QString::fromUtf8("buttonApply")); + + gridLayout3->addWidget(buttonApply, 0, 1, 1, 1); + + buttonOk = new QPushButton(GBButtons); + buttonOk->setObjectName(QString::fromUtf8("buttonOk")); + + gridLayout3->addWidget(buttonOk, 0, 0, 1, 1); + + + gridLayout_5->addWidget(GBButtons, 6, 0, 1, 2); + + + retranslateUi(CreateBoundaryAn); + + QMetaObject::connectSlotsByName(CreateBoundaryAn); + } // setupUi + + void retranslateUi(QDialog *CreateBoundaryAn) + { + CreateBoundaryAn->setWindowTitle(QApplication::translate("CreateBoundaryAn", "Create an analytical boundary", nullptr)); + Name->setText(QApplication::translate("CreateBoundaryAn", "Name", nullptr)); + TypeBoundary->setTitle(QApplication::translate("CreateBoundaryAn", "Type of boundary", nullptr)); + RBCylindre->setText(QApplication::translate("CreateBoundaryAn", "Cylinder", nullptr)); + RBSphere->setText(QApplication::translate("CreateBoundaryAn", "Sphere", nullptr)); + RBCone->setText(QApplication::translate("CreateBoundaryAn", "Cone", nullptr)); + RBTore->setText(QApplication::translate("CreateBoundaryAn", "Torus", nullptr)); + gBCylindre->setTitle(QApplication::translate("CreateBoundaryAn", "Coordinates", nullptr)); + TLXcent->setText(QApplication::translate("CreateBoundaryAn", "X centre", nullptr)); + TLradius->setText(QApplication::translate("CreateBoundaryAn", "Radius", nullptr)); + TLZcent->setText(QApplication::translate("CreateBoundaryAn", "Z centre", nullptr)); + TLYcent->setText(QApplication::translate("CreateBoundaryAn", "Y centre", nullptr)); + TLXaxis->setText(QApplication::translate("CreateBoundaryAn", "X axis", nullptr)); + TLYaxis->setText(QApplication::translate("CreateBoundaryAn", "Y axis", nullptr)); + TLZaxis->setText(QApplication::translate("CreateBoundaryAn", "Z axis", nullptr)); + gBSphere->setTitle(QApplication::translate("CreateBoundaryAn", "Coordinates", nullptr)); + TLRayon->setText(QApplication::translate("CreateBoundaryAn", "Radius", nullptr)); + TLZcentre->setText(QApplication::translate("CreateBoundaryAn", "Z centre", nullptr)); + TLYcentre->setText(QApplication::translate("CreateBoundaryAn", "Y centre", nullptr)); + TLXcentre->setText(QApplication::translate("CreateBoundaryAn", "X centre", nullptr)); + gBCone->setTitle(QApplication::translate("CreateBoundaryAn", "Coordinates", nullptr)); + groupBox->setTitle(QApplication::translate("CreateBoundaryAn", "Definition", nullptr)); + RB_Def_radius->setText(QApplication::translate("CreateBoundaryAn", "Radius", nullptr)); + RB_Def_angle->setText(QApplication::translate("CreateBoundaryAn", "Angle", nullptr)); + TLCone_X1->setText(QApplication::translate("CreateBoundaryAn", "X 1", nullptr)); + TLCone_X2->setText(QApplication::translate("CreateBoundaryAn", "X 2", nullptr)); + TLCone_Y1->setText(QApplication::translate("CreateBoundaryAn", "Y 1", nullptr)); + TLCone_Y2->setText(QApplication::translate("CreateBoundaryAn", "Y 2", nullptr)); + TLCone_Z1->setText(QApplication::translate("CreateBoundaryAn", "Z 1", nullptr)); + TLCone_Z2->setText(QApplication::translate("CreateBoundaryAn", "Z 2", nullptr)); + TLCone_V1->setText(QApplication::translate("CreateBoundaryAn", "V 1", nullptr)); + TLCone_V2->setText(QApplication::translate("CreateBoundaryAn", "V 2", nullptr)); + gBTore->setTitle(QApplication::translate("CreateBoundaryAn", "Coordinates", nullptr)); + TLToreXcent->setText(QApplication::translate("CreateBoundaryAn", "X centre", nullptr)); + TLToreXaxe->setText(QApplication::translate("CreateBoundaryAn", "X axis", nullptr)); + TLToreYcent->setText(QApplication::translate("CreateBoundaryAn", "Y centre", nullptr)); + TLToreYaxe->setText(QApplication::translate("CreateBoundaryAn", "Y axis", nullptr)); + TLToreZcent->setText(QApplication::translate("CreateBoundaryAn", "Z centre", nullptr)); + TLToreZaxe->setText(QApplication::translate("CreateBoundaryAn", "Z axis", nullptr)); + TLToreRayRev->setText(QApplication::translate("CreateBoundaryAn", "R revolution", nullptr)); + TLToreRayPri->setText(QApplication::translate("CreateBoundaryAn", "Primary R", nullptr)); + GBButtons->setTitle(QString()); + buttonHelp->setText(QApplication::translate("CreateBoundaryAn", "Help", nullptr)); + buttonCancel->setText(QApplication::translate("CreateBoundaryAn", "Cancel", nullptr)); + 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: + QGridLayout *gridLayout; + QGroupBox *GBButtons; + QGridLayout *gridLayout1; + QPushButton *buttonHelp; + QPushButton *buttonCancel; + QPushButton *buttonApply; + QPushButton *buttonOk; + QCheckBox *CBGroupe; + QLineEdit *LEFileName; + QPushButton *PushFichier; + QLabel *XAO; + QLineEdit *LEName; + QLabel *Name; + + void setupUi(QDialog *CreateBoundaryCAO) + { + if (CreateBoundaryCAO->objectName().isEmpty()) + CreateBoundaryCAO->setObjectName(QString::fromUtf8("CreateBoundaryCAO")); + CreateBoundaryCAO->resize(566, 195); + QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(CreateBoundaryCAO->sizePolicy().hasHeightForWidth()); + CreateBoundaryCAO->setSizePolicy(sizePolicy); + CreateBoundaryCAO->setAutoFillBackground(true); + CreateBoundaryCAO->setSizeGripEnabled(true); + gridLayout = new QGridLayout(CreateBoundaryCAO); +#ifndef Q_OS_MAC + gridLayout->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout->setObjectName(QString::fromUtf8("gridLayout")); + GBButtons = new QGroupBox(CreateBoundaryCAO); + GBButtons->setObjectName(QString::fromUtf8("GBButtons")); + gridLayout1 = new QGridLayout(GBButtons); +#ifndef Q_OS_MAC + gridLayout1->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout1->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout1->setObjectName(QString::fromUtf8("gridLayout1")); + buttonHelp = new QPushButton(GBButtons); + buttonHelp->setObjectName(QString::fromUtf8("buttonHelp")); + + gridLayout1->addWidget(buttonHelp, 0, 3, 1, 1); + + buttonCancel = new QPushButton(GBButtons); + buttonCancel->setObjectName(QString::fromUtf8("buttonCancel")); + + gridLayout1->addWidget(buttonCancel, 0, 2, 1, 1); + + buttonApply = new QPushButton(GBButtons); + buttonApply->setObjectName(QString::fromUtf8("buttonApply")); + + gridLayout1->addWidget(buttonApply, 0, 1, 1, 1); + + buttonOk = new QPushButton(GBButtons); + buttonOk->setObjectName(QString::fromUtf8("buttonOk")); + + gridLayout1->addWidget(buttonOk, 0, 0, 1, 1); + + + gridLayout->addWidget(GBButtons, 3, 0, 1, 3); + + CBGroupe = new QCheckBox(CreateBoundaryCAO); + CBGroupe->setObjectName(QString::fromUtf8("CBGroupe")); + + gridLayout->addWidget(CBGroupe, 2, 0, 1, 3); + + LEFileName = new QLineEdit(CreateBoundaryCAO); + LEFileName->setObjectName(QString::fromUtf8("LEFileName")); + LEFileName->setMinimumSize(QSize(370, 21)); + + gridLayout->addWidget(LEFileName, 1, 2, 1, 1); + + PushFichier = new QPushButton(CreateBoundaryCAO); + PushFichier->setObjectName(QString::fromUtf8("PushFichier")); + + gridLayout->addWidget(PushFichier, 1, 1, 1, 1); + + XAO = new QLabel(CreateBoundaryCAO); + XAO->setObjectName(QString::fromUtf8("XAO")); + + gridLayout->addWidget(XAO, 1, 0, 1, 1); + + LEName = new QLineEdit(CreateBoundaryCAO); + LEName->setObjectName(QString::fromUtf8("LEName")); + LEName->setMinimumSize(QSize(382, 21)); + LEName->setMaxLength(32); + + gridLayout->addWidget(LEName, 0, 1, 1, 2); + + Name = new QLabel(CreateBoundaryCAO); + Name->setObjectName(QString::fromUtf8("Name")); + + gridLayout->addWidget(Name, 0, 0, 1, 1); + + + retranslateUi(CreateBoundaryCAO); + + QMetaObject::connectSlotsByName(CreateBoundaryCAO); + } // setupUi + + void retranslateUi(QDialog *CreateBoundaryCAO) + { + CreateBoundaryCAO->setWindowTitle(QApplication::translate("CreateBoundaryCAO", "Get CAO", nullptr)); + GBButtons->setTitle(QString()); + buttonHelp->setText(QApplication::translate("CreateBoundaryCAO", "Help", nullptr)); + buttonCancel->setText(QApplication::translate("CreateBoundaryCAO", "Cancel", nullptr)); + buttonApply->setText(QApplication::translate("CreateBoundaryCAO", "Apply", nullptr)); + buttonOk->setText(QApplication::translate("CreateBoundaryCAO", "OK", nullptr)); + CBGroupe->setText(QApplication::translate("CreateBoundaryCAO", "Filtering with groups", nullptr)); + PushFichier->setText(QString()); + 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: + QGridLayout *gridLayout; + QGroupBox *GBButtons; + QGridLayout *gridLayout1; + QPushButton *buttonHelp; + QPushButton *buttonCancel; + QPushButton *buttonApply; + QPushButton *buttonOk; + QCheckBox *CBGroupe; + QLineEdit *LEFileName; + QPushButton *PushFichier; + QLabel *Mesh; + QLineEdit *LEName; + QLabel *Name; + + void setupUi(QDialog *CreateBoundaryDi) + { + if (CreateBoundaryDi->objectName().isEmpty()) + CreateBoundaryDi->setObjectName(QString::fromUtf8("CreateBoundaryDi")); + CreateBoundaryDi->resize(566, 169); + QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(CreateBoundaryDi->sizePolicy().hasHeightForWidth()); + CreateBoundaryDi->setSizePolicy(sizePolicy); + CreateBoundaryDi->setAutoFillBackground(true); + CreateBoundaryDi->setSizeGripEnabled(true); + gridLayout = new QGridLayout(CreateBoundaryDi); +#ifndef Q_OS_MAC + gridLayout->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout->setObjectName(QString::fromUtf8("gridLayout")); + GBButtons = new QGroupBox(CreateBoundaryDi); + GBButtons->setObjectName(QString::fromUtf8("GBButtons")); + gridLayout1 = new QGridLayout(GBButtons); +#ifndef Q_OS_MAC + gridLayout1->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout1->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout1->setObjectName(QString::fromUtf8("gridLayout1")); + buttonHelp = new QPushButton(GBButtons); + buttonHelp->setObjectName(QString::fromUtf8("buttonHelp")); + + gridLayout1->addWidget(buttonHelp, 0, 3, 1, 1); + + buttonCancel = new QPushButton(GBButtons); + buttonCancel->setObjectName(QString::fromUtf8("buttonCancel")); + + gridLayout1->addWidget(buttonCancel, 0, 2, 1, 1); + + buttonApply = new QPushButton(GBButtons); + buttonApply->setObjectName(QString::fromUtf8("buttonApply")); + + gridLayout1->addWidget(buttonApply, 0, 1, 1, 1); + + buttonOk = new QPushButton(GBButtons); + buttonOk->setObjectName(QString::fromUtf8("buttonOk")); + + gridLayout1->addWidget(buttonOk, 0, 0, 1, 1); + + + gridLayout->addWidget(GBButtons, 3, 0, 1, 3); + + CBGroupe = new QCheckBox(CreateBoundaryDi); + CBGroupe->setObjectName(QString::fromUtf8("CBGroupe")); + + gridLayout->addWidget(CBGroupe, 2, 0, 1, 3); + + LEFileName = new QLineEdit(CreateBoundaryDi); + LEFileName->setObjectName(QString::fromUtf8("LEFileName")); + LEFileName->setMinimumSize(QSize(370, 21)); + + gridLayout->addWidget(LEFileName, 1, 2, 1, 1); + + PushFichier = new QPushButton(CreateBoundaryDi); + PushFichier->setObjectName(QString::fromUtf8("PushFichier")); + + gridLayout->addWidget(PushFichier, 1, 1, 1, 1); + + Mesh = new QLabel(CreateBoundaryDi); + Mesh->setObjectName(QString::fromUtf8("Mesh")); + + gridLayout->addWidget(Mesh, 1, 0, 1, 1); + + LEName = new QLineEdit(CreateBoundaryDi); + LEName->setObjectName(QString::fromUtf8("LEName")); + LEName->setMinimumSize(QSize(382, 21)); + LEName->setMaxLength(32); + + gridLayout->addWidget(LEName, 0, 1, 1, 2); + + Name = new QLabel(CreateBoundaryDi); + Name->setObjectName(QString::fromUtf8("Name")); + + gridLayout->addWidget(Name, 0, 0, 1, 1); + + + retranslateUi(CreateBoundaryDi); + + QMetaObject::connectSlotsByName(CreateBoundaryDi); + } // setupUi + + void retranslateUi(QDialog *CreateBoundaryDi) + { + CreateBoundaryDi->setWindowTitle(QApplication::translate("CreateBoundaryDi", "Create a discrete boundary", nullptr)); + GBButtons->setTitle(QString()); + buttonHelp->setText(QApplication::translate("CreateBoundaryDi", "Help", nullptr)); + buttonCancel->setText(QApplication::translate("CreateBoundaryDi", "Cancel", nullptr)); + buttonApply->setText(QApplication::translate("CreateBoundaryDi", "Apply", nullptr)); + buttonOk->setText(QApplication::translate("CreateBoundaryDi", "OK", nullptr)); + CBGroupe->setText(QApplication::translate("CreateBoundaryDi", "Filtering with groups", nullptr)); + PushFichier->setText(QString()); + 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 + +public: + 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); + +public slots: + virtual void SetCylinder(); + virtual void SetSphere(); + virtual void SetCone(); + virtual void SetConeR(); + virtual void SetConeA(); + virtual void SetTore(); + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); + +}; + +class SMESHGUI_EXPORT SMESH_EditBoundaryAn : public SMESH_CreateBoundaryAn +{ + Q_OBJECT +public: + SMESH_EditBoundaryAn( SMESHGUI_HomardAdaptDlg* parent, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen, + QString caseName, QString Name); + virtual ~SMESH_EditBoundaryAn(); + +protected : + bool CreateOrUpdateBoundaryAn(); + void InitValEdit(); + void InitValBoundaryAnLimit(); + void SetCylinder(); + void SetSphere(); + void SetConeR(); + void SetConeA(); + void SetTore(); + void InitValBoundaryAnCylindre(); + void InitValBoundaryAnSphere(); + void InitValBoundaryAnConeR(); + void InitValBoundaryAnConeA(); + void InitValBoundaryAnTore(); + +public slots: + +}; + +class SMESHGUI_EXPORT SMESH_CreateBoundaryCAO : public QDialog, public SMESH_Ui_CreateBoundaryCAO +{ + Q_OBJECT + +public: + SMESH_CreateBoundaryCAO( SMESHGUI_HomardAdaptDlg* parent, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen, + QString caseName, QString BoundaryName ); + ~SMESH_CreateBoundaryCAO(); + virtual void setGroups (QStringList listGroup); + +protected : + + SMESHGUI_HomardAdaptDlg *_parent; + + QString _aName; + QString _aCaseName; + + + SMESHHOMARD::HOMARD_Boundary_var aBoundary; + SMESHHOMARD::HOMARD_Gen_var myHomardGen; + + QStringList _listeGroupesBoundary; + + virtual void AssocieLesGroupes(); + virtual void InitConnect(); + virtual void SetNewName(); + +public slots: + + virtual void SetCAOFile(); + virtual void SetFiltrage(); + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); +}; + +class SMESHGUI_EXPORT SMESH_EditBoundaryCAO : public SMESH_CreateBoundaryCAO +{ + Q_OBJECT +public: + SMESH_EditBoundaryCAO( SMESHGUI_HomardAdaptDlg* parent, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen, + QString caseName, QString Name ); + virtual ~SMESH_EditBoundaryCAO(); + +protected : + virtual void InitValEdit(); + virtual bool PushOnApply(); + virtual void SetFiltrage(); + +public slots: + +}; + +class SMESHGUI_EXPORT SMESH_CreateBoundaryDi : public QDialog, public SMESH_Ui_CreateBoundaryDi +{ + Q_OBJECT + +public: + SMESH_CreateBoundaryDi( SMESHGUI_HomardAdaptDlg* parent, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen, + QString caseName, QString BoundaryName ); + ~SMESH_CreateBoundaryDi(); + virtual void setGroups (QStringList listGroup); + +protected : + + SMESHGUI_HomardAdaptDlg *_parent; + + QString _aName; + QString _aCaseName; + + + SMESHHOMARD::HOMARD_Boundary_var aBoundary; + SMESHHOMARD::HOMARD_Gen_var myHomardGen; + + QStringList _listeGroupesBoundary; + + virtual void AssocieLesGroupes(); + virtual void InitConnect(); + virtual void SetNewName(); + +public slots: + + virtual void SetMeshFile(); + virtual void SetFiltrage(); + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); +}; + +class SMESHGUI_EXPORT SMESH_EditBoundaryDi : public SMESH_CreateBoundaryDi +{ + Q_OBJECT +public: + SMESH_EditBoundaryDi( SMESHGUI_HomardAdaptDlg* parent, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen, + QString caseName, QString Name ); + virtual ~SMESH_EditBoundaryDi(); + +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 new file mode 100644 index 000000000..afd42ebef --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_HomardListGroup.cxx @@ -0,0 +1,325 @@ +// Copyright (C) 2011-2021 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "SMESHGUI_HomardListGroup.h" + +#include "SMESHGUI_HomardBoundaryDlg.h" +#include "SMESHGUI_HomardUtils.h" +#include "SMESHGUI_Utils.h" + +#include "SalomeApp_Tools.h" + +#include +#include +#include +#include +#include + +#include + +#include + +using namespace std; + +// ------------------------------------------------------------------------------------ +SMESH_CreateListGroupCAO::SMESH_CreateListGroupCAO(SMESH_CreateBoundaryCAO* parentBound, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString aCaseName, + QStringList listeGroupesHypo) + : QDialog(0), SMESH_Ui_CreateListGroup(), + _aCaseName (aCaseName), + _listeGroupesHypo (listeGroupesHypo), + _parentBound(parentBound) +{ + MESSAGE("Debut de SMESH_CreateListGroupCAO"); + myHomardGen = SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + setupUi(this); + setModal(modal); + InitConnect(); + InitGroupes(); +} +// -------------------------------------------------------------------------------------------------------------- +SMESH_CreateListGroupCAO::SMESH_CreateListGroupCAO(SMESH_CreateBoundaryCAO* parentBound, + SMESHHOMARD::HOMARD_Gen_var myHomardGen, + QString aCaseName, + QStringList listeGroupesHypo) + : QDialog(0), SMESH_Ui_CreateListGroup(), + _aCaseName (aCaseName), + _listeGroupesHypo (listeGroupesHypo), + _parentBound(parentBound) +{ + myHomardGen = SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen); + setupUi(this); + InitConnect(); +} + +// ------------------------------------------------------------------------ +SMESH_CreateListGroupCAO::~SMESH_CreateListGroupCAO() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void SMESH_CreateListGroupCAO::InitConnect() +// ------------------------------------------------------------------------ +{ + connect( buttonOk, SIGNAL( pressed() ), this, SLOT( PushOnOK() ) ); + connect( buttonApply, SIGNAL( pressed() ), this, SLOT( PushOnApply() ) ); + connect( buttonCancel, SIGNAL( pressed() ), this, SLOT( close() ) ); + connect( buttonHelp, SIGNAL( pressed() ), this, SLOT( PushOnHelp() ) ); +} +// ------------------------------------------------------------------------ +bool SMESH_CreateListGroupCAO::PushOnApply() +// ------------------------------------------------------------------------ +// Appele lorsque l'un des boutons Ok ou Apply est presse +// +{ + QStringList ListeGroup ; + for ( int row=0; row< TWGroupe->rowCount(); row++) + { + if ( TWGroupe->item( row, 0 )->checkState() == Qt::Checked ) + ListeGroup.insert(0, QString(TWGroupe->item(row, 1)->text()) ); + } + if ( _parentBound ) { _parentBound->setGroups(ListeGroup);}; + return true; +} + + +// ------------------------------------------------------------------------ +void SMESH_CreateListGroupCAO::PushOnOK() +// ------------------------------------------------------------------------ +{ + if (PushOnApply()) this->close(); + if ( _parentBound ) { _parentBound->raise(); _parentBound->activateWindow(); }; +} +// ------------------------------------------------------------------------ +void SMESH_CreateListGroupCAO::PushOnHelp() +// ------------------------------------------------------------------------ +{ + SMESH::ShowHelpFile(QString("gui_create_hypothese.html")); +} +// ------------------------------------------------------------------------ +void SMESH_CreateListGroupCAO::InitGroupes() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SMESH_CreateListGroupCAO::InitGroupes "); + for ( int row=0; row< TWGroupe->rowCount(); row++) + TWGroupe->removeRow(row); + TWGroupe->setRowCount(0); + if (_aCaseName == QString("")) { return; }; + SMESHHOMARD::HOMARD_Cas_var monCas= myHomardGen->GetCase(_aCaseName.toStdString().c_str()); + SMESHHOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups(); + for ( int i = 0; i < _listeGroupesCas->length(); i++ ) { + TWGroupe->insertRow(i); + TWGroupe->setItem( i, 0, new QTableWidgetItem( QString ("") ) ); + TWGroupe->item( i, 0 )->setFlags( 0 ); + TWGroupe->item( i, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled ); + if (_listeGroupesHypo.contains (QString((_listeGroupesCas)[i]))) + {TWGroupe->item( i, 0 )->setCheckState( Qt::Checked );} + else + {TWGroupe->item( i, 0 )->setCheckState( Qt::Unchecked );} + TWGroupe->setItem( i, 1, new QTableWidgetItem(QString((_listeGroupesCas)[i]).trimmed())); + TWGroupe->item( i, 1 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable ); + } + TWGroupe->resizeColumnsToContents(); + TWGroupe->resizeRowsToContents(); + TWGroupe->clearSelection(); +// MESSAGE("Fin de SMESH_CreateListGroupCAO::InitGroupes "); +} + + +// ------------------------------------------------------------------------ +SMESH_CreateListGroup::SMESH_CreateListGroup(SMESH_CreateBoundaryDi* parentBound, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString aCaseName, QStringList listeGroupesHypo) + : QDialog(0), SMESH_Ui_CreateListGroup(), + _aCaseName (aCaseName), + _listeGroupesHypo (listeGroupesHypo), + _parentBound(parentBound) +{ + MESSAGE("Debut de SMESH_CreateListGroup"); + myHomardGen = SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + setupUi(this); + setModal(modal); + InitConnect(); + InitGroupes(); +} + +// ------------------------------------------------------------------------ +SMESH_CreateListGroup::SMESH_CreateListGroup(SMESH_CreateBoundaryDi* parentBound, + SMESHHOMARD::HOMARD_Gen_var myHomardGen, + QString aCaseName, QStringList listeGroupesHypo) + : QDialog(0), SMESH_Ui_CreateListGroup(), + _aCaseName (aCaseName), + _listeGroupesHypo (listeGroupesHypo), + _parentBound(parentBound) +{ + myHomardGen = SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen); + setupUi(this); + InitConnect(); +} + +// ------------------------------------------------------------------------ +SMESH_CreateListGroup::~SMESH_CreateListGroup() +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void SMESH_CreateListGroup::InitConnect() +// ------------------------------------------------------------------------ +{ + connect( buttonOk, SIGNAL( pressed() ), this, SLOT( PushOnOK() ) ); + connect( buttonApply, SIGNAL( pressed() ), this, SLOT( PushOnApply() ) ); + connect( buttonCancel, SIGNAL( pressed() ), this, SLOT( close() ) ); + connect( buttonHelp, SIGNAL( pressed() ), this, SLOT( PushOnHelp() ) ); +} +// ------------------------------------------------------------------------ +bool SMESH_CreateListGroup::PushOnApply() +// ------------------------------------------------------------------------ +// Appele lorsque l'un des boutons Ok ou Apply est presse +// +{ + QStringList ListeGroup ; + for ( int row=0; row< TWGroupe->rowCount(); row++) + { + if ( TWGroupe->item( row, 0 )->checkState() == Qt::Checked ) + ListeGroup.insert(0, QString(TWGroupe->item(row, 1)->text()) ); + } + if ( _parentBound ) { _parentBound->setGroups(ListeGroup);}; + return true; +} + + +// ------------------------------------------------------------------------ +void SMESH_CreateListGroup::PushOnOK() +// ------------------------------------------------------------------------ +{ + if (PushOnApply()) + { + this->close(); + if ( _parentBound ) { _parentBound->raise(); _parentBound->activateWindow(); }; + } +} +// ------------------------------------------------------------------------ +void SMESH_CreateListGroup::PushOnHelp() +// ------------------------------------------------------------------------ +{ + SMESH::ShowHelpFile(QString("gui_create_hypothese.html")); +} +// ------------------------------------------------------------------------ +void SMESH_CreateListGroup::InitGroupes() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SMESH_CreateListGroup::InitGroupes "); + for ( int row=0; row< TWGroupe->rowCount(); row++) + TWGroupe->removeRow(row); + TWGroupe->setRowCount(0); + if (_aCaseName == QString("")) { return; }; + SMESHHOMARD::HOMARD_Cas_var monCas= myHomardGen->GetCase(_aCaseName.toStdString().c_str()); + SMESHHOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups(); + for ( int i = 0; i < _listeGroupesCas->length(); i++ ) + { + TWGroupe->insertRow(i); + TWGroupe->setItem( i, 0, new QTableWidgetItem( QString ("") ) ); + TWGroupe->item( i, 0 )->setFlags( 0 ); + TWGroupe->item( i, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled ); + if (_listeGroupesHypo.contains (QString((_listeGroupesCas)[i]))) + {TWGroupe->item( i, 0 )->setCheckState( Qt::Checked );} + else + {TWGroupe->item( i, 0 )->setCheckState( Qt::Unchecked );} + TWGroupe->setItem( i, 1, new QTableWidgetItem(QString((_listeGroupesCas)[i]).trimmed())); + TWGroupe->item( i, 1 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable ); + } + TWGroupe->resizeColumnsToContents(); + TWGroupe->resizeRowsToContents(); + TWGroupe->clearSelection(); +// MESSAGE("Fin de SMESH_CreateListGroup::InitGroupes "); +} + +//--------------------------------------------------------------------- +SMESH_EditListGroupCAO::SMESH_EditListGroupCAO( SMESH_CreateBoundaryCAO* parentBound, + bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen, + QString aCaseName, + QStringList listeGroupesHypo): +//--------------------------------------------------------------------- +SMESH_CreateListGroupCAO(parentBound,myHomardGen,aCaseName,listeGroupesHypo) +{ + MESSAGE("Debut de SMESH_EditListGroupCAO"); + setWindowTitle(QObject::tr("HOM_GROU_EDIT_WINDOW_TITLE")); + setModal(true); + InitGroupes(); +} + +//------------------------------------ +SMESH_EditListGroupCAO:: ~SMESH_EditListGroupCAO() +//------------------------------------ +{ +} +// ------------------------------------- +void SMESH_EditListGroupCAO:: InitGroupes() +// ------------------------------------- +{ + for (int i = 0; i < _listeGroupesHypo.size(); i++ ) + { + std::cerr << _listeGroupesHypo[i].toStdString().c_str() << std::endl; + TWGroupe->insertRow(i); + TWGroupe->setItem( i, 0, new QTableWidgetItem( QString ("") ) ); + TWGroupe->item( i, 0 )->setFlags( 0 ); + TWGroupe->item( i, 0 )->setCheckState( Qt::Checked ); + TWGroupe->setItem( i, 1, new QTableWidgetItem(_listeGroupesHypo[i])); + } + TWGroupe->resizeRowsToContents(); +} + +//--------------------------------------------------------------------- +SMESH_EditListGroup::SMESH_EditListGroup( SMESH_CreateBoundaryDi* parentBound, + bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen, + QString aCaseName, + QStringList listeGroupesHypo): +//--------------------------------------------------------------------- +SMESH_CreateListGroup(parentBound,myHomardGen,aCaseName,listeGroupesHypo) +{ + MESSAGE("Debut de SMESH_EditListGroup"); + setWindowTitle(QObject::tr("HOM_GROU_EDIT_WINDOW_TITLE")); + setModal(true); + InitGroupes(); +} + +//------------------------------------ +SMESH_EditListGroup::~SMESH_EditListGroup() +//------------------------------------ +{ +} +// ------------------------------------- +void SMESH_EditListGroup::InitGroupes() +// ------------------------------------- +{ + for (int i = 0; i < _listeGroupesHypo.size(); i++ ) + { + std::cerr << _listeGroupesHypo[i].toStdString().c_str() << std::endl; + TWGroupe->insertRow(i); + TWGroupe->setItem( i, 0, new QTableWidgetItem( QString ("") ) ); + TWGroupe->item( i, 0 )->setFlags( 0 ); + TWGroupe->item( i, 0 )->setCheckState( Qt::Checked ); + TWGroupe->setItem( i, 1, new QTableWidgetItem(_listeGroupesHypo[i])); + } + TWGroupe->resizeRowsToContents(); +} diff --git a/src/SMESHGUI/SMESHGUI_HomardListGroup.h b/src/SMESHGUI/SMESHGUI_HomardListGroup.h new file mode 100644 index 000000000..67e46b94d --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_HomardListGroup.h @@ -0,0 +1,254 @@ +// Copyright (C) 2011-2021 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_CREATELISTGROUPCAO_H +#define MON_CREATELISTGROUPCAO_H + +#include "SMESH_SMESHGUI.hxx" + +#include +#include + +//#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(SMESH_Homard) + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class SMESH_CreateBoundaryCAO; +class SMESH_CreateBoundaryDi; + + +QT_BEGIN_NAMESPACE + +class SMESH_Ui_CreateListGroup +{ +public: + QGridLayout *gridLayout; + QGroupBox *GBButtons; + QGridLayout *gridLayout1; + QPushButton *buttonHelp; + QPushButton *buttonCancel; + QPushButton *buttonApply; + QPushButton *buttonOk; + QGroupBox *GBOptions; + QGridLayout *gridLayout2; + QTableWidget *TWGroupe; + + void setupUi(QDialog *CreateListGroup) + { + if (CreateListGroup->objectName().isEmpty()) + CreateListGroup->setObjectName(QString::fromUtf8("CreateListGroup")); + CreateListGroup->resize(717, 600); + QSizePolicy sizePolicy(static_cast(0), static_cast(0)); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(CreateListGroup->sizePolicy().hasHeightForWidth()); + CreateListGroup->setSizePolicy(sizePolicy); + CreateListGroup->setAutoFillBackground(true); + CreateListGroup->setSizeGripEnabled(true); + gridLayout = new QGridLayout(CreateListGroup); +#ifndef Q_OS_MAC + gridLayout->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout->setObjectName(QString::fromUtf8("gridLayout")); + GBButtons = new QGroupBox(CreateListGroup); + GBButtons->setObjectName(QString::fromUtf8("GBButtons")); + gridLayout1 = new QGridLayout(GBButtons); +#ifndef Q_OS_MAC + gridLayout1->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout1->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout1->setObjectName(QString::fromUtf8("gridLayout1")); + buttonHelp = new QPushButton(GBButtons); + buttonHelp->setObjectName(QString::fromUtf8("buttonHelp")); + + gridLayout1->addWidget(buttonHelp, 0, 3, 1, 1); + + buttonCancel = new QPushButton(GBButtons); + buttonCancel->setObjectName(QString::fromUtf8("buttonCancel")); + + gridLayout1->addWidget(buttonCancel, 0, 2, 1, 1); + + buttonApply = new QPushButton(GBButtons); + buttonApply->setObjectName(QString::fromUtf8("buttonApply")); + + gridLayout1->addWidget(buttonApply, 0, 1, 1, 1); + + buttonOk = new QPushButton(GBButtons); + buttonOk->setObjectName(QString::fromUtf8("buttonOk")); + + gridLayout1->addWidget(buttonOk, 0, 0, 1, 1); + + + gridLayout->addWidget(GBButtons, 1, 0, 1, 1); + + GBOptions = new QGroupBox(CreateListGroup); + GBOptions->setObjectName(QString::fromUtf8("GBOptions")); + gridLayout2 = new QGridLayout(GBOptions); +#ifndef Q_OS_MAC + gridLayout2->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout2->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout2->setObjectName(QString::fromUtf8("gridLayout2")); + TWGroupe = new QTableWidget(GBOptions); + if (TWGroupe->columnCount() < 2) + TWGroupe->setColumnCount(2); + QTableWidgetItem *__qtablewidgetitem = new QTableWidgetItem(); + TWGroupe->setHorizontalHeaderItem(0, __qtablewidgetitem); + QTableWidgetItem *__qtablewidgetitem1 = new QTableWidgetItem(); + TWGroupe->setHorizontalHeaderItem(1, __qtablewidgetitem1); + TWGroupe->setObjectName(QString::fromUtf8("TWGroupe")); + TWGroupe->setShowGrid(true); + TWGroupe->setRowCount(0); + TWGroupe->setColumnCount(2); + + gridLayout2->addWidget(TWGroupe, 0, 0, 1, 1); + + + gridLayout->addWidget(GBOptions, 0, 0, 1, 1); + + + retranslateUi(CreateListGroup); + + QMetaObject::connectSlotsByName(CreateListGroup); + } // setupUi + + void retranslateUi(QDialog *CreateListGroup) + { + CreateListGroup->setWindowTitle(QApplication::translate("CreateListGroup", "Selection of groups", nullptr)); + GBButtons->setTitle(QString()); + buttonHelp->setText(QApplication::translate("CreateListGroup", "Help", nullptr)); + buttonCancel->setText(QApplication::translate("CreateListGroup", "Cancel", nullptr)); + buttonApply->setText(QApplication::translate("CreateListGroup", "Apply", nullptr)); + buttonOk->setText(QApplication::translate("CreateListGroup", "OK", nullptr)); + GBOptions->setTitle(QApplication::translate("CreateListGroup", "Selected groups", nullptr)); + QTableWidgetItem *___qtablewidgetitem = TWGroupe->horizontalHeaderItem(0); + ___qtablewidgetitem->setText(QApplication::translate("CreateListGroup", "Selection", nullptr)); + QTableWidgetItem *___qtablewidgetitem1 = TWGroupe->horizontalHeaderItem(1); + ___qtablewidgetitem1->setText(QApplication::translate("CreateListGroup", "Group", nullptr)); + } // retranslateUi + +}; + +namespace Ui { + class CreateListGroup: public SMESH_Ui_CreateListGroup {}; +} // namespace Ui + +QT_END_NAMESPACE + +class SMESHGUI_EXPORT SMESH_CreateListGroupCAO : public QDialog, public SMESH_Ui_CreateListGroup +{ + Q_OBJECT + +public: + SMESH_CreateListGroupCAO( SMESH_CreateBoundaryCAO* parentBound, bool modal, SMESHHOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); + SMESH_CreateListGroupCAO( SMESH_CreateBoundaryCAO* parentBound, SMESHHOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); + virtual ~SMESH_CreateListGroupCAO(); + +protected : + + SMESHHOMARD::HOMARD_Gen_var myHomardGen; + + SMESH_CreateBoundaryCAO * _parentBound; + QString _aCaseName; + QStringList _listeGroupesHypo; + + virtual void InitConnect(); + virtual void InitGroupes(); + +public slots: + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); + +}; + +class SMESHGUI_EXPORT SMESH_CreateListGroup : public QDialog, public SMESH_Ui_CreateListGroup +{ + Q_OBJECT + +public: + SMESH_CreateListGroup( SMESH_CreateBoundaryDi* parentBound, bool modal, SMESHHOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); + SMESH_CreateListGroup( SMESH_CreateBoundaryDi* parentBound, SMESHHOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); + virtual ~SMESH_CreateListGroup(); + +protected : + + SMESHHOMARD::HOMARD_Gen_var myHomardGen; + + SMESH_CreateBoundaryDi * _parentBound; + QString _aCaseName; + QStringList _listeGroupesHypo; + + virtual void InitConnect(); + virtual void InitGroupes(); + +public slots: + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); + +}; + +class SMESHGUI_EXPORT SMESH_EditListGroupCAO : public SMESH_CreateListGroupCAO +{ + Q_OBJECT + +public: + SMESH_EditListGroupCAO( SMESH_CreateBoundaryCAO* parentBound, bool modal, SMESHHOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); + virtual ~SMESH_EditListGroupCAO(); + +protected : + + virtual void InitGroupes(); + +}; + +class SMESHGUI_EXPORT SMESH_EditListGroup : public SMESH_CreateListGroup +{ + Q_OBJECT + +public: + SMESH_EditListGroup( SMESH_CreateBoundaryDi* parentBound, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen, + QString aCaseName, QStringList listeGroupesHypo); + virtual ~SMESH_EditListGroup(); + +protected : + + virtual void InitGroupes(); + +}; + +#endif // MON_CREATELISTGROUPCAO_H diff --git a/src/SMESHGUI/SMESHGUI_HomardUtils.cxx b/src/SMESHGUI/SMESHGUI_HomardUtils.cxx new file mode 100644 index 000000000..6d18e19b4 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_HomardUtils.cxx @@ -0,0 +1,658 @@ +// Copyright (C) 2011-2021 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + + +#include "SMESHGUI_HomardUtils.h" + +#include + +#include "OB_Browser.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Application.h" +#include "SUIT_Session.h" + +#include "LightApp_SelectionMgr.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_Module.h" +#include "SalomeApp_Study.h" + +#include "SALOME_ListIO.hxx" + +#include "SALOMEconfig.h" +#include + +#include +#include +#include +#include +#include +#include + +#include +#ifndef WIN32 +#include +#include +#endif + +#include "SalomeApp_Tools.h" + +#include + +SALOME_ListIO SMESH_HOMARD_UTILS::mySelected; + +//================================================================ +// Function : GetActiveStudy +// Returne un pointeur sur l'etude active +//================================================================ +SUIT_Study* SMESH_HOMARD_UTILS::GetActiveStudy() +{ + SUIT_Application* app = SUIT_Session::session()->activeApplication(); + if (app) + return app->activeStudy(); + else + return NULL; +} + +//================================================================ +// Function : getStudy +// Returne un pointeur sur l'etude active +//================================================================ +_PTR(Study) SMESH_HOMARD_UTILS::getStudy() +{ + static _PTR(Study) _study; + if(!_study) + _study = SalomeApp_Application::getStudy(); + return _study; +} + +//================================================================ +// Function : updateObjBrowser +// Purpose : met a jour l arbre d 'etude pour Homard +//================================================================ +void SMESH_HOMARD_UTILS::updateObjBrowser() +{ + SalomeApp_Application* app = dynamic_cast(SUIT_Session::session()->activeApplication()); + if (app) { + // Le nom identifiant doit etre la valeur du parametre + // name de la section HOMARD du fichier SalomeApp.xml + CAM_Module* module = app->module("Homard" ); + SalomeApp_Module* appMod = dynamic_cast( module ); + if ( appMod ) { + app->updateObjectBrowser(); + appMod->updateObjBrowser( true ); + } + else + MESSAGE( "--- SMESHHOMARD::updateObjBrowser: appMod = NULL"); + } +} + +//================================================================ +// Function : selectedIO +// Return the list of selected SALOME_InteractiveObject's +//================================================================ +const SALOME_ListIO& SMESH_HOMARD_UTILS::selectedIO() +{ + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* > ( SUIT_Session::session()->activeApplication() ); + LightApp_SelectionMgr* aSelectionMgr = app->selectionMgr(); + if( aSelectionMgr ) + { + aSelectionMgr->selectedObjects( mySelected ); + for (SALOME_ListIteratorOfListIO it (mySelected); it.More(); it.Next()) + SCRUTE(it.Value()->getEntry()); + }; + return mySelected; +} + +//================================================================ +// Function : IObjectCount +// Return the number of selected objects +//================================================================ +int SMESH_HOMARD_UTILS::IObjectCount() +{ + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + LightApp_SelectionMgr* aSelectionMgr = app->selectionMgr(); + if( aSelectionMgr ) + { + aSelectionMgr->selectedObjects( mySelected ); + SCRUTE(mySelected.Extent()); + return mySelected.Extent(); + } + return 0; +} + +//================================================================ +// Function : firstIObject +// Purpose : Return the first selected object in the selected object list +//================================================================ +Handle(SALOME_InteractiveObject) SMESH_HOMARD_UTILS::firstIObject() +{ + const SALOME_ListIO& aList = selectedIO(); + return aList.Extent() > 0 ? aList.First() : Handle(SALOME_InteractiveObject)(); +} + +//================================================================ +// Function : lastIObject +// Return the last selected object in the selected object list +//================================================================ +Handle(SALOME_InteractiveObject) SMESH_HOMARD_UTILS::lastIObject() +{ + const SALOME_ListIO& aList = selectedIO(); + return aList.Extent() > 0 ? aList.Last() : Handle(SALOME_InteractiveObject)(); +} + +//================================================================ +// Retourne vrai si l'objet est du type voulu +// . Dans le cas d'un cas, d'une hypothese, d'une zone, on se contente +// d'une comparaison simple entre le type stocke et TypeObject. +// . Pour l'iteration, le type stocke en attribut est sous la forme +// "IterationHomard" + le nom de l'iteration precedente. +// Il faut donc regarder si la chaine commence par TypeObject. +// . Idem pour le fichier de messages : "Mess " + numero d'iteration +// +// On filtre ce genre de situation avec option : +// -1 : comparaison totale +// 0 : comparaison sur le debut de la chaine +//================================================================ +bool SMESH_HOMARD_UTILS::isObject(_PTR(SObject) MonObj, QString TypeObject, int option) +{ +// MESSAGE("isObject, TypeObject = "<Value().c_str()); +// MESSAGE("Type = "< 1 ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_SELECT_OBJECT_2") ); + return QString(""); + } +// + Handle(SALOME_InteractiveObject) aIO = SMESH_HOMARD_UTILS::firstIObject(); + if ( aIO->hasEntry() ) + { +// MESSAGE("aIO->getEntry() = " << aIO->getEntry()); + _PTR(Study) aStudy = SMESH_HOMARD_UTILS::getStudy(); + _PTR(SObject) aSO ( aStudy->FindObjectID( aIO->getEntry() ) ); + _PTR(GenericAttribute) anAttr; + if (aSO->FindAttribute(anAttr, "AttributeComment") ) + { + if ( commentaire != "" ) + { + _PTR(AttributeComment) attributComment = anAttr; + QString aComment= QString(attributComment->Value().data()); +// MESSAGE("... aComment = " << aComment.toStdString().c_str()); + int iaux = aComment.lastIndexOf(commentaire); +// MESSAGE("... iaux = " << iaux); + if ( iaux !=0 ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_SELECT_OBJECT_3").arg(commentaire) ); + return QString(""); + } + } + if (aSO->FindAttribute(anAttr, "AttributeName") ) + { + _PTR(AttributeName) attributName = anAttr; + QString aName= QString(attributName->Value().data()); + return aName; + } + } + } +// + return QString(""); +} + +// ======================================================================= +QString SMESH_HOMARD_QT_COMMUN::SelectionCasEtude() +// ======================================================================= +{ + QString aName = QString(""); + int nbSel = SMESH_HOMARD_UTILS::IObjectCount() ; + if ( nbSel == 0 ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_SELECT_OBJECT_1") ); + return QString(""); + } + if ( nbSel > 1 ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_SELECT_OBJECT_2") ); + return QString(""); + } + Handle(SALOME_InteractiveObject) aIO = SMESH_HOMARD_UTILS::firstIObject(); + if ( aIO->hasEntry() ) + { + _PTR(Study) aStudy = SMESH_HOMARD_UTILS::getStudy(); + _PTR(SObject) aSO ( aStudy->FindObjectID( aIO->getEntry() ) ); + _PTR(SObject) aSObjCas = aSO->GetFather(); + _PTR(GenericAttribute) anAttr; + if (aSObjCas->FindAttribute(anAttr, "AttributeName") ) + { + _PTR(AttributeName) attributName = anAttr; + aName= QString(attributName->Value().data()); + } + return aName; + } + return QString(""); +} + +// ======================================================================= +QString SMESH_HOMARD_QT_COMMUN::PushNomFichier(bool avertir, QString TypeFichier) +// ======================================================================= +// Gestion les boutons qui permettent de +// 1) retourne le nom d'un fichier par une fenetre de dialogue si aucun +// objet est selectionne dans l arbre d etude +// 2) retourne le nom du fichier asocie a l objet +// selectionne dans l arbre d etude +{ +// MESSAGE("PushNomFichier avec avertir "<hasEntry() ) + { + _PTR(Study) aStudy = SMESH_HOMARD_UTILS::getStudy(); + _PTR(SObject) aSO ( aStudy->FindObjectID( aIO->getEntry() ) ); + _PTR(GenericAttribute) anAttr; + _PTR(AttributeFileType) aFileType; + _PTR(AttributeExternalFileDef) aFileName; + if (aSO) { + if (aSO->FindAttribute(anAttr, "AttributeFileType") ) { + aFileType=anAttr; + QString fileType=QString(aFileType->Value().data()); + if ( fileType==QString("FICHIERMED")) { + if (aSO->FindAttribute(anAttr,"AttributeExternalFileDef")) { + aFileName=anAttr; + aFile= QString(aFileName->Value().data()); } + } + } + } + } + + if ( aFile==QString::null ) + { + if ( avertir ) { + QMessageBox::warning( 0, QObject::tr("HOM_WARNING"), + QObject::tr("HOM_SELECT_STUDY") ); + } + aFile = QFileDialog::getOpenFileName(0, QObject::tr("HOM_SELECT_FILE_0"), QString(""), filtre ); + } + } + // B.3. Bizarre + else + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_SELECT_FILE_2") ); + } + + return aFile; +} +// ======================================================================= +med_idt SMESH_HOMARD_QT_COMMUN::OuvrirFichier(QString aFile) +// ======================================================================= +// renvoie le medId associe au fichier Med apres ouverture +{ + med_idt medIdt = MEDfileOpen(aFile.toStdString().c_str(),MED_ACC_RDONLY); + if (medIdt <0) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MED_FILE_1") ); + } + return medIdt; +} + +// ====================================================== +QString SMESH_HOMARD_QT_COMMUN::LireNomMaillage(QString aFile) +// ======================================================== +{ + QString nomMaillage = "" ; + int erreur = 0 ; + med_idt medIdt ; + while ( erreur == 0 ) + { + // Ouverture du fichier + medIdt = SMESH_HOMARD_QT_COMMUN::OuvrirFichier(aFile); + if ( medIdt < 0 ) + { + erreur = 1 ; + break ; + } + med_int numberOfMeshes = MEDnMesh(medIdt) ; + if (numberOfMeshes == 0 ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MED_FILE_2") ); + erreur = 2 ; + break ; + } + if (numberOfMeshes > 1 ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MED_FILE_3") ); + erreur = 3 ; + break ; + } + + nomMaillage = SMESH_HOMARD_QT_COMMUN::LireNomMaillage2(medIdt,1); + break ; + } + // Fermeture du fichier + if ( medIdt > 0 ) MEDfileClose(medIdt); + + return nomMaillage; +} +// ======================================================================= +QString SMESH_HOMARD_QT_COMMUN::LireNomMaillage2(med_idt medIdt ,int meshId) +// ======================================================================= +{ + QString NomMaillage=QString::null; + char meshname[MED_NAME_SIZE+1]; + med_int spacedim,meshdim; + med_mesh_type meshtype; + char descriptionription[MED_COMMENT_SIZE+1]; + char dtunit[MED_SNAME_SIZE+1]; + med_sorting_type sortingtype; + med_int nstep; + med_axis_type axistype; + int naxis = MEDmeshnAxis(medIdt,1); + char *axisname=new char[naxis*MED_SNAME_SIZE+1]; + char *axisunit=new char[naxis*MED_SNAME_SIZE+1]; + med_err aRet = MEDmeshInfo(medIdt, + meshId, + meshname, + &spacedim, + &meshdim, + &meshtype, + descriptionription, + dtunit, + &sortingtype, + &nstep, + &axistype, + axisname, + axisunit); + + if ( aRet < 0 ) { QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), \ + QObject::tr("HOM_MED_FILE_4") ); } + else { NomMaillage=QString(meshname); } + + delete[] axisname ; + delete[] axisunit ; + + return NomMaillage; +} + + +// ======================================================================= +std::list SMESH_HOMARD_QT_COMMUN::GetListeChamps(QString aFile) +// ======================================================================= +{ +// Il faut voir si plusieurs maillages + + MESSAGE("GetListeChamps"); + std::list ListeChamp ; + + med_err erreur = 0 ; + med_idt medIdt ; + + while ( erreur == 0 ) + { + // Ouverture du fichier + SCRUTE(aFile.toStdString()); + medIdt = SMESH_HOMARD_QT_COMMUN::OuvrirFichier(aFile); + if ( medIdt < 0 ) + { + erreur = 1 ; + break ; + } + // Lecture du nombre de champs + med_int ncha = MEDnField(medIdt) ; + if (ncha < 1 ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MED_FILE_5") ); + erreur = 2 ; + break ; + } + // Lecture des caracteristiques des champs + for (int i=0; i< ncha; i++) + { +// Lecture du nombre de composantes + med_int ncomp = MEDfieldnComponent(medIdt,i+1); +// Lecture du type du champ, des noms des composantes et du nom de l'unite + char nomcha [MED_NAME_SIZE+1]; + char meshname[MED_NAME_SIZE+1]; + char * comp = (char*) malloc(ncomp*MED_SNAME_SIZE+1); + char * unit = (char*) malloc(ncomp*MED_SNAME_SIZE+1); + char dtunit[MED_SNAME_SIZE+1]; + med_bool local; + med_field_type typcha; + med_int nbofcstp; + erreur = MEDfieldInfo(medIdt,i+1,nomcha,meshname,&local,&typcha,comp,unit,dtunit,&nbofcstp) ; + free(comp); + free(unit); + if ( erreur < 0 ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MED_FILE_6") ); + break ; + } + ListeChamp.push_back(QString(nomcha)); + } + break ; + } + // Fermeture du fichier + if ( medIdt > 0 ) MEDfileClose(medIdt); + + return ListeChamp; +} + +// ====================================================================================== +std::list SMESH_HOMARD_QT_COMMUN::GetListeComposants(QString aFile, QString aChamp) +// ====================================================================================== +{ + MESSAGE ( "GetListeComposants pour le fichier " << aFile.toStdString().c_str()); + MESSAGE ( "GetListeComposants pour le champ " << aChamp.toStdString().c_str()); + + std::list ListeComposants; + + med_err erreur = 0 ; + med_idt medIdt ; + + while ( erreur == 0 ) + { + // Ouverture du fichier + SCRUTE(aFile.toStdString()); + medIdt = SMESH_HOMARD_QT_COMMUN::OuvrirFichier(aFile); + if ( medIdt < 0 ) + { + erreur = 1 ; + break ; + } + // Lecture du nombre de champs + med_int ncha = MEDnField(medIdt) ; + if (ncha < 1 ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MED_FILE_5") ); + erreur = 2 ; + break ; + } + // Lecture des caracteristiques des champs + for (int i=0; i< ncha; i++) + { +// Lecture du nombre de composantes + med_int ncomp = MEDfieldnComponent(medIdt,i+1); +// Lecture du type du champ, des noms des composantes et du nom de l'unite + char nomcha [MED_NAME_SIZE+1]; + char meshname[MED_NAME_SIZE+1]; + char * comp = (char*) malloc(ncomp*MED_SNAME_SIZE+1); + char * unit = (char*) malloc(ncomp*MED_SNAME_SIZE+1); + char dtunit[MED_SNAME_SIZE+1]; + med_bool local; + med_field_type typcha; + med_int nbofcstp; + erreur = MEDfieldInfo(medIdt,i+1,nomcha,meshname,&local,&typcha,comp,unit,dtunit,&nbofcstp) ; + free(unit); + if ( erreur < 0 ) + { + free(comp); + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MED_FILE_6") ); + break ; + } + // Lecture des composantes si c'est le bon champ + if ( QString(nomcha) == aChamp ) + { + for (int j = 0; j 0 ) MEDfileClose(medIdt); + + return ListeComposants; +} diff --git a/src/SMESHGUI/SMESHGUI_HomardUtils.h b/src/SMESHGUI/SMESHGUI_HomardUtils.h new file mode 100644 index 000000000..14b13343c --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_HomardUtils.h @@ -0,0 +1,112 @@ +// Copyright (C) 2011-2021 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef SMESH_HOMARD_H_UTILS +#define SMESH_HOMARD_H_UTILS + +#include "SMESH_SMESHGUI.hxx" + +#include + +#include +//#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(SMESH_Homard) + +#include +#include +#include +#include +#include +//#include +#include + +#include + +#include +#include +#include + +class QString; +class QStringList; +class QComboBox; + +class SUIT_ViewWindow; +class SUIT_Desktop; +class SUIT_Study; +class SUIT_ResourceMgr; + +class CAM_Module; + +class SALOMEDSClient_Study; +class SALOMEDSClient_SObject; + +class SalomeApp_Study; +class SalomeApp_Module; +class LightApp_SelectionMgr; + +namespace SMESH_HOMARD_UTILS { + + SMESHGUI_EXPORT SUIT_Study* GetActiveStudy(); + SMESHGUI_EXPORT _PTR(Study) getStudy(); + + SMESHGUI_EXPORT void updateObjBrowser(); + + // Function returns a list of SALOME_InteractiveObject's from + // selection manager in GUI + SMESHGUI_EXPORT const SALOME_ListIO& selectedIO(); + + // Function returns the number of selected objects + SMESHGUI_EXPORT int IObjectCount(); + + // Function returns the first selected object in the list + // of selected objects + SMESHGUI_EXPORT Handle(SALOME_InteractiveObject) firstIObject() ; + + // Function returns the last selected object in the list + // of selected objects + SMESHGUI_EXPORT Handle(SALOME_InteractiveObject) lastIObject() ; + + SMESHGUI_EXPORT bool isBoundaryCAO(_PTR(SObject) MonObj); + SMESHGUI_EXPORT bool isBoundaryAn(_PTR(SObject) MonObj); + SMESHGUI_EXPORT bool isBoundaryDi(_PTR(SObject) MonObj); + SMESHGUI_EXPORT bool isCase(_PTR(SObject) MonObj); + SMESHGUI_EXPORT bool isHypo(_PTR(SObject) MonObj); + SMESHGUI_EXPORT bool isIter(_PTR(SObject) MonObj); + SMESHGUI_EXPORT bool isFileType(_PTR(SObject) MonObj, QString TypeFile); + SMESHGUI_EXPORT bool isObject(_PTR(SObject) MonObj, QString TypeObject, int option ); + + extern SALOME_ListIO mySelected; +} + +namespace SMESH_HOMARD_QT_COMMUN +{ + SMESHGUI_EXPORT QString PushNomFichier(bool avertir, QString TypeFichier=""); + SMESHGUI_EXPORT QString LireNomMaillage(QString aFile); + SMESHGUI_EXPORT QString LireNomMaillage2(med_idt Medidt,int MeshId); + + SMESHGUI_EXPORT med_idt OuvrirFichier(QString aFile); + + SMESHGUI_EXPORT std::list GetListeChamps(QString aFile); + SMESHGUI_EXPORT std::list GetListeComposants(QString aFile, QString aChamp); + + SMESHGUI_EXPORT QString SelectionArbreEtude(QString commentaire, int grave ); + SMESHGUI_EXPORT QString SelectionCasEtude(); +}; + +#endif // ifndef SMESH_HOMARD_H_UTILS diff --git a/src/SMESHGUI/SMESHGUI_Operations.h b/src/SMESHGUI/SMESHGUI_Operations.h index e24bcd558..b91a92787 100644 --- a/src/SMESHGUI/SMESHGUI_Operations.h +++ b/src/SMESHGUI/SMESHGUI_Operations.h @@ -184,6 +184,7 @@ namespace SMESHOp { OpSplitBiQuadratic = 4515, // MENU MODIFICATION - SPLIT BI-QUADRATIC TO LINEAR // Adaptation ---------------------//-------------------------------- OpMGAdapt = 8020, // MENU ADAPTATION - MG-ADAPT + OpHomardAdapt = 8021, // MENU ADAPTATION - HOMARD-ADAPT // Measurements -------------------//-------------------------------- OpPropertiesLength = 5000, // MENU MEASUREMENTS - BASIC PROPERTIES - LENGTH OpPropertiesArea = 5001, // MENU MEASUREMENTS - BASIC PROPERTIES - AREA diff --git a/src/SMESHGUI/SMESH_images.ts b/src/SMESHGUI/SMESH_images.ts index 74697d463..676c0aad8 100644 --- a/src/SMESHGUI/SMESH_images.ts +++ b/src/SMESHGUI/SMESH_images.ts @@ -87,6 +87,10 @@ ICON_MG_ADAPT adapt_mg_adapt.png + + ICON_HOMARD_ADAPT + adapt_homard.png + ICON_CONV_TO_QUAD mesh_conv_to_quad.png diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index 67ca49fe5..2feb9c346 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -340,6 +340,10 @@ MEN_MG_ADAPT Remesh with MG_Adapt + + MEN_HOMARD_ADAPT + Remesh with HOMARD + Args Arguments @@ -3312,6 +3316,10 @@ Use Display Entity menu command to show them. STB_MG_ADAPT Remesh with MG_Adapt + + STB_HOMARD_ADAPT + Remesh with HOMARD + STB_CONV_TO_QUAD Convert to/from quadratic @@ -4008,6 +4016,10 @@ Use Display Entity menu command to show them. TOP_MG_ADAPT Remesh with MG_Adapt + + TOP_HOMARD_ADAPT + Remesh with HOMARD + TOP_CONV_TO_QUAD Convert to/from quadratic diff --git a/src/SMESH_I/CMakeLists.txt b/src/SMESH_I/CMakeLists.txt index e04e4a604..0ce820e3a 100644 --- a/src/SMESH_I/CMakeLists.txt +++ b/src/SMESH_I/CMakeLists.txt @@ -115,6 +115,7 @@ SET(SMESHEngine_HEADERS SMESH.hxx SMESH_Component_Generator.hxx MG_ADAPT_i.hxx + SMESH_Homard_i.hxx ) # --- sources --- @@ -144,6 +145,7 @@ SET(SMESHEngine_SOURCES SMESH_PreMeshInfo.cxx SMESH_Component_Generator.cxx MG_ADAPT_i.cxx + SMESH_Homard_i.cxx ) # --- rules --- diff --git a/src/SMESH_I/SMESH_Gen_i.hxx b/src/SMESH_I/SMESH_Gen_i.hxx index 9caaa543c..64ccdf1d0 100644 --- a/src/SMESH_I/SMESH_Gen_i.hxx +++ b/src/SMESH_I/SMESH_Gen_i.hxx @@ -477,6 +477,7 @@ public: int CountInPyDump(const TCollection_AsciiString& text); SMESH::MG_ADAPT_ptr CreateMG_ADAPT(); + SMESHHOMARD::HOMARD_Gen_ptr CreateHOMARD_ADAPT(); SMESH::MG_ADAPT_ptr CreateAdaptationHypothesis(); SMESH::MG_ADAPT_OBJECT_ptr Adaptation( const char* adaptationType); diff --git a/src/SMESH_I/SMESH_Homard_i.cxx b/src/SMESH_I/SMESH_Homard_i.cxx new file mode 100644 index 000000000..613371d68 --- /dev/null +++ b/src/SMESH_I/SMESH_Homard_i.cxx @@ -0,0 +1,4804 @@ +// Copyright (C) 2011-2021 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// 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 "FrontTrack.hxx" + +#include "utilities.h" +#include "Basics_Utils.hxx" +#include "Basics_DirUtils.hxx" +#include "Utils_SINGLETON.hxx" +#include "Utils_CorbaException.hxx" +#include "SALOMEDS_Tool.hxx" +#include "SALOME_LifeCycleCORBA.hxx" +#include "SALOMEconfig.h" + +#include +#include +#include +#include +#include +#include + +#include + +#ifdef WIN32 +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +SMESHHOMARD::HOMARD_Gen_ptr SMESH_Gen_i::CreateHOMARD_ADAPT() +{ + SMESHHOMARD_I::HOMARD_Gen_i* aHomardGen = new SMESHHOMARD_I::HOMARD_Gen_i(); + SMESHHOMARD::HOMARD_Gen_var anObj = aHomardGen->_this(); + return anObj._retn(); +} + +namespace SMESHHOMARD_I +{ + +//============================================================================= +/*! + * standard constructor + */ +//============================================================================= +HOMARD_Boundary_i::HOMARD_Boundary_i() +{ + 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 ) +{ + MESSAGE( "HOMARD_Boundary_i" ); + _gen_i = engine; + _orb = orb; + myHomardBoundary = new SMESHHOMARDImpl::HOMARD_Boundary(); + ASSERT( myHomardBoundary ); +} +//============================================================================= +/*! + * standard destructor + */ +//============================================================================= +HOMARD_Boundary_i::~HOMARD_Boundary_i() +{ +} +//============================================================================= +//============================================================================= +// Generalites +//============================================================================= +//============================================================================= +void HOMARD_Boundary_i::SetName( const char* 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); +} +//============================================================================= +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 ); +} +//============================================================================= +//============================================================================= +// Caracteristiques +//============================================================================= +//============================================================================= +void HOMARD_Boundary_i::SetType( CORBA::Long Type ) +{ + ASSERT( myHomardBoundary ); + myHomardBoundary->SetType( Type ); +} +//============================================================================= +CORBA::Long HOMARD_Boundary_i::GetType() +{ + ASSERT( myHomardBoundary ); + return CORBA::Long( myHomardBoundary->GetType() ); +} +//============================================================================= +void HOMARD_Boundary_i::SetMeshName( const char* MeshName ) +{ + ASSERT( myHomardBoundary ); + myHomardBoundary->SetMeshName( MeshName ); +} +//============================================================================= +char* HOMARD_Boundary_i::GetMeshName() +{ + ASSERT( myHomardBoundary ); + return CORBA::string_dup( myHomardBoundary->GetMeshName().c_str() ); +} +//============================================================================= +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); } +} +//============================================================================= +char* HOMARD_Boundary_i::GetDataFile() +{ + 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 ) +{ + ASSERT( myHomardBoundary ); + myHomardBoundary->SetCylinder( X0, X1, X2, X3, X4, X5, X6 ); +} +//============================================================================= +void HOMARD_Boundary_i::SetSphere( double Xcentre, double Ycentre, double ZCentre, double 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) +{ + 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) +{ + 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 ) +{ + ASSERT( myHomardBoundary ); + myHomardBoundary->SetTorus( X0, X1, X2, X3, X4, X5, X6, X7 ); +} +//============================================================================= +SMESHHOMARD::double_array* HOMARD_Boundary_i::GetCoords() +{ + ASSERT( myHomardBoundary ); + SMESHHOMARD::double_array_var aResult = new SMESHHOMARD::double_array(); + std::vector mesCoor = myHomardBoundary->GetCoords(); + aResult->length( mesCoor .size() ); + std::vector::const_iterator it; + int i = 0; + 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 ) +{ + ASSERT( myHomardBoundary ); + myHomardBoundary->SetLimit( Xincr, Yincr, Zincr ); +} +//============================================================================= +SMESHHOMARD::double_array* HOMARD_Boundary_i::GetLimit() +{ + ASSERT( myHomardBoundary ); + SMESHHOMARD::double_array_var aResult = new SMESHHOMARD::double_array(); + std::vector mesCoor = myHomardBoundary->GetLimit(); + aResult->length( mesCoor .size() ); + std::vector::const_iterator it; + int i = 0; + for ( it = mesCoor.begin(); it != mesCoor.end(); it++ ) + aResult[i++] = (*it); + return aResult._retn(); +} +//============================================================================= +void HOMARD_Boundary_i::AddGroup( const char* Group) +{ + ASSERT( myHomardBoundary ); + myHomardBoundary->AddGroup( Group ); +} +//============================================================================= +void HOMARD_Boundary_i::SetGroups(const SMESHHOMARD::ListGroupType& ListGroup) +{ + ASSERT( myHomardBoundary ); + std::list ListString; + for ( int i = 0; i < ListGroup.length(); i++ ) + { + ListString.push_back(std::string(ListGroup[i])); + } + myHomardBoundary->SetGroups( ListString ); +} +//============================================================================= +SMESHHOMARD::ListGroupType* HOMARD_Boundary_i::GetGroups() +{ + ASSERT( myHomardBoundary ); + const std::list& ListString = myHomardBoundary->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(); +} +//============================================================================= +//============================================================================= +// Liens avec les autres structures +//============================================================================= +//============================================================================= +void HOMARD_Boundary_i::SetCaseCreation( const char* NomCaseCreation ) +{ + ASSERT( myHomardBoundary ); + myHomardBoundary->SetCaseCreation( NomCaseCreation ); +} +//============================================================================= +char* HOMARD_Boundary_i::GetCaseCreation() +{ + ASSERT( myHomardBoundary ); + return CORBA::string_dup( myHomardBoundary->GetCaseCreation().c_str() ); +} + +//============================================================================= +/*! + * standard constructor + */ +//============================================================================= +HOMARD_Cas_i::HOMARD_Cas_i() +{ + MESSAGE( "Default constructor, not for use" ); + ASSERT( 0 ); +} + +//============================================================================= +/*! + * standard constructor + */ +//============================================================================= +HOMARD_Cas_i::HOMARD_Cas_i( CORBA::ORB_ptr orb, + SMESHHOMARD::HOMARD_Gen_var engine ) +{ + MESSAGE( "HOMARD_Cas_i" ); + _gen_i = engine; + _orb = orb; + myHomardCas = new SMESHHOMARDImpl::HOMARD_Cas(); + ASSERT( myHomardCas ); +} + +//============================================================================= +/*! + * standard destructor + */ +//============================================================================= +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); +} +//============================================================================= +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 ); +} +//============================================================================= +//============================================================================= +// Caracteristiques +//============================================================================= +//============================================================================= +void HOMARD_Cas_i::SetDirName( const char* NomDir ) +{ + 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); + } + // C. Changement/creation du repertoire + 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."; } + 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() ); + // 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); + // 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); + // D.3. Creation du futur repertoire local pour l'iteration de depart + std::string nomDirIterTotal; + nomDirIterTotal = std::string(NomDir) + "/" + std::string(nomDirIter); +#ifndef WIN32 + if (mkdir(nomDirIterTotal.c_str(), S_IRWXU|S_IRGRP|S_IXGRP) != 0) +#else + if (_mkdir(nomDirIterTotal.c_str()) != 0) +#endif + { + MESSAGE ( "nomDirIterTotal : " << nomDirIterTotal ); + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "The directory for the starting iteration cannot be created."; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + // D.4. Deplacement du contenu du repertoire + std::string oldnomDirIterTotal; + 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 ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "The starting point for the case cannot be moved into the new directory."; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + commande = "rm -rf " + std::string(oldnomDirIterTotal); + codret = system(commande.c_str()); + if ( codret != 0 ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "The starting point for the case cannot be deleted."; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + // D.5. Memorisation du nom du repertoire de l'iteration + Iter->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(); +} +//============================================================================= +void HOMARD_Cas_i::SetConfType( CORBA::Long ConfType ) +{ + ASSERT( myHomardCas ); +// VERIFICATION( (ConfType>=-2) && (ConfType<=3) ); + myHomardCas->SetConfType( ConfType ); +} +//============================================================================= +CORBA::Long HOMARD_Cas_i::GetConfType() +{ + 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 ) +{ + ASSERT( myHomardCas ); + std::vector VExtrema; + ASSERT( LesExtrema.length() == 10 ); + VExtrema.resize( LesExtrema.length() ); + for ( int i = 0; i < LesExtrema.length(); i++ ) + { + VExtrema[i] = LesExtrema[i]; + } + myHomardCas->SetBoundingBox( VExtrema ); +} +//============================================================================= +SMESHHOMARD::extrema* HOMARD_Cas_i::GetBoundingBox() +{ + 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++ ) + { + aResult[i] = LesExtremes[i]; + } + return aResult._retn(); +} +//============================================================================= +void HOMARD_Cas_i::AddGroup( const char* Group) +{ + ASSERT( myHomardCas ); + myHomardCas->AddGroup( Group ); +} +//============================================================================= +void HOMARD_Cas_i::SetGroups( const SMESHHOMARD::ListGroupType& ListGroup ) +{ + ASSERT( myHomardCas ); + std::list ListString; + for ( int i = 0; i < ListGroup.length(); i++ ) + { + ListString.push_back(std::string(ListGroup[i])); + } + myHomardCas->SetGroups( ListString ); +} +//============================================================================= +SMESHHOMARD::ListGroupType* HOMARD_Cas_i::GetGroups() +{ + ASSERT(myHomardCas ); + const std::list& ListString = myHomardCas->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(); +} +//============================================================================= +void HOMARD_Cas_i::AddBoundary(const char* BoundaryName) +{ + MESSAGE ("HOMARD_Cas_i::AddBoundary : BoundaryName = "<< BoundaryName ); + const char * Group = ""; + AddBoundaryGroup( BoundaryName, Group); +} +//============================================================================= +void HOMARD_Cas_i::AddBoundaryGroup( const char* BoundaryName, const char* Group) +{ + MESSAGE ("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 ); + // 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 ) + { + // B.1. Si on ajoute une frontière CAO, elle doit être la seule frontière + if ( BoundaryType == -1 ) + { + for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ ) + { + boun = (*it).c_str(); + MESSAGE (".. Frontiere enregistrée : "<< boun ); + if ( *it != BoundaryName ) + { erreur = 1; + break; } + // On saute le nom du groupe + it++; + } + } + if ( erreur != 0 ) { break; } + // B.2. Si on ajoute une frontière non CAO, il ne doit pas y avoir de frontière CAO + if ( BoundaryType != -1 ) + { + for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ ) + { + boun = (*it).c_str(); + MESSAGE (".. Frontiere enregistrée : "<< boun ); + 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 ) + { erreur = 2; + break; } + // On saute le nom du groupe + it++; + } + if ( erreur != 0 ) { break; } + } + // B.3. Si on ajoute une frontière discrète, il ne doit pas y avoir d'autre frontière discrète + if ( BoundaryType == 0 ) + { + for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ ) + { + boun = (*it).c_str(); + MESSAGE (".. Frontiere enregistrée : "<< boun ); + if ( boun != BoundaryName ) + { + 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 ) + { erreur = 3; + break; } + } + // On saute le nom du groupe + it++; + } + if ( erreur != 0 ) { break; } + } + // B.4. Pour une nouvelle frontiere, publication dans l'arbre d'etudes sous le cas + bool existe = false; + for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ ) + { + MESSAGE (".. Frontiere : "<< *it ); + if ( *it == BoundaryName ) { existe = true; } + // On saute le nom du groupe + it++; + } + // B.5. Le groupe est-il deja enregistre pour une frontiere de ce cas ? + for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ ) + { + boun = (*it).c_str(); + it++; + MESSAGE (".. Groupe enregistré : "<< *it ); + if ( *it == Group ) + { erreur = 5; + break; } + } + if ( erreur != 0 ) { break; } + // + break; + } + // F. Si aucune erreur, enregistrement du couple (frontiere,groupe) dans la reference du cas + // Sinon, arrêt + if ( erreur == 0 ) + { myHomardCas->AddBoundaryGroup( BoundaryName, Group ); } + else + { + std::stringstream ss; + ss << erreur; + std::string str = ss.str(); + std::string texte; + texte = "Erreur numéro " + str + " pour la frontière à enregistrer : " + std::string(BoundaryName); + if ( erreur == 1 ) { texte += "\nIl existe déjà la frontière "; } + else if ( erreur == 2 ) { texte += "\nIl existe déjà la frontière CAO "; } + else if ( erreur == 3 ) { texte += "\nIl existe déjà une frontière discrète : "; } + else if ( erreur == 5 ) { texte += "\nLe groupe " + std::string(Group) + " est déjà enregistré pour la frontière "; } + texte += std::string(boun); + // + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; +#ifdef _DEBUG_ + texte += "\nInvalid AddBoundaryGroup"; +#endif + INFOS(texte); + es.text = CORBA::string_dup(texte.c_str()); + throw SALOME::SALOME_Exception(es); + } +} +//============================================================================= +SMESHHOMARD::ListBoundaryGroupType* HOMARD_Cas_i::GetBoundaryGroup() +{ + MESSAGE ("GetBoundaryGroup"); + ASSERT(myHomardCas ); + const std::list& ListBoundaryGroup = myHomardCas->GetBoundaryGroup(); + SMESHHOMARD::ListBoundaryGroupType_var aResult = new SMESHHOMARD::ListBoundaryGroupType(); + aResult->length( ListBoundaryGroup.size() ); + std::list::const_iterator it; + int i = 0; + for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ ) + { + aResult[i++] = CORBA::string_dup( (*it).c_str() ); + } + return aResult._retn(); +} +//============================================================================= +void HOMARD_Cas_i::SupprBoundaryGroup() +{ + MESSAGE ("SupprBoundaryGroup"); + 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 ) +{ + ASSERT( myHomardCas ); + myHomardCas->AddIteration( NomIteration ); +} + +//============================================================================= +/*! + * standard constructor + */ +//============================================================================= +HOMARD_Hypothesis_i::HOMARD_Hypothesis_i() +{ + MESSAGE( "Default constructor, not for use" ); + ASSERT( 0 ); +} + +//============================================================================= +/*! + * standard constructor + */ +//============================================================================= +HOMARD_Hypothesis_i::HOMARD_Hypothesis_i( CORBA::ORB_ptr orb, + SMESHHOMARD::HOMARD_Gen_var engine ) +{ + MESSAGE( "standard constructor" ); + _gen_i = engine; + _orb = orb; + myHomardHypothesis = new SMESHHOMARDImpl::HOMARD_Hypothesis(); + ASSERT( myHomardHypothesis ); +} + +//============================================================================= +/*! + * standard destructor + */ +//============================================================================= +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 +{ + return SMESHHOMARDImpl::Dump( *myHomardHypothesis ); +} +//============================================================================= +bool HOMARD_Hypothesis_i::Restore( const std::string& stream ) +{ + return SMESHHOMARDImpl::Restore( *myHomardHypothesis, stream ); +} +//============================================================================= +//============================================================================= +// Caracteristiques +//============================================================================= +//============================================================================= +void HOMARD_Hypothesis_i::SetUnifRefinUnRef( CORBA::Long TypeRaffDera ) +{ + 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 ); +} +//============================================================================= +SMESHHOMARD::listeTypes* HOMARD_Hypothesis_i::GetAdapRefinUnRef() +{ + 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(); +} +//============================================================================= +CORBA::Long HOMARD_Hypothesis_i::GetAdapType() +{ + ASSERT( myHomardHypothesis ); + return CORBA::Long( myHomardHypothesis->GetAdapType() ); +} +//============================================================================= +CORBA::Long HOMARD_Hypothesis_i::GetRefinType() +{ + ASSERT( myHomardHypothesis ); + return CORBA::Long( myHomardHypothesis->GetRefinType() ); +} +//============================================================================= +CORBA::Long HOMARD_Hypothesis_i::GetUnRefType() +{ + ASSERT( myHomardHypothesis ); + return CORBA::Long( myHomardHypothesis->GetUnRefType() ); +} +//============================================================================= +void HOMARD_Hypothesis_i::SetField( const char* FieldName ) +{ + myHomardHypothesis->SetField( FieldName ); +} +//============================================================================= +char* HOMARD_Hypothesis_i::GetFieldName() +{ + ASSERT( myHomardHypothesis ); + return CORBA::string_dup( myHomardHypothesis->GetFieldName().c_str() ); +} +//============================================================================= +void HOMARD_Hypothesis_i::SetUseField( CORBA::Long UsField ) +{ + myHomardHypothesis->SetUseField( UsField ); +} +//============================================================================= +SMESHHOMARD::InfosHypo* HOMARD_Hypothesis_i::GetField() +{ + 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; +} +//============================================================================= +void HOMARD_Hypothesis_i::SetUseComp( CORBA::Long UsCmpI ) +{ + myHomardHypothesis->SetUseComp( UsCmpI ); +} +//============================================================================= +void HOMARD_Hypothesis_i::AddComp( const char* NomComp ) +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->AddComp( NomComp ); +} +//============================================================================= +void HOMARD_Hypothesis_i::SupprComp( const char* NomComp ) +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SupprComp(NomComp); +} +//============================================================================= +void HOMARD_Hypothesis_i::SupprComps() +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SupprComps(); +} +//============================================================================= +SMESHHOMARD::listeComposantsHypo* HOMARD_Hypothesis_i::GetComps() +{ + 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(); +} +//============================================================================= +void HOMARD_Hypothesis_i::SetRefinThr( CORBA::Long TypeThR, CORBA::Double ThreshR ) +{ + myHomardHypothesis->SetAdapType( 1 ); + if ( TypeThR > 0 ) + { + int TypeDera = myHomardHypothesis->GetUnRefType(); + myHomardHypothesis->SetRefinTypeDera( 1, TypeDera ); + } + myHomardHypothesis->SetRefinThr( TypeThR, ThreshR ); +} +//============================================================================= +CORBA::Long HOMARD_Hypothesis_i::GetRefinThrType() +{ + ASSERT( myHomardHypothesis ); + return CORBA::Long( myHomardHypothesis->GetRefinThrType() ); +} +//============================================================================= +void HOMARD_Hypothesis_i::SetUnRefThr( CORBA::Long TypeThC, CORBA::Double ThreshC ) +{ + myHomardHypothesis->SetAdapType( 1 ); + if ( TypeThC > 0 ) + { + int TypeRaff = myHomardHypothesis->GetRefinType(); + myHomardHypothesis->SetRefinTypeDera( TypeRaff, 1 ); + } + myHomardHypothesis->SetUnRefThr( TypeThC, ThreshC ); +} +//============================================================================= +CORBA::Long HOMARD_Hypothesis_i::GetUnRefThrType() +{ + ASSERT( myHomardHypothesis ); + return CORBA::Long( myHomardHypothesis->GetUnRefThrType() ); +} +//============================================================================= +void HOMARD_Hypothesis_i::SetNivMax( CORBA::Long NivMax ) +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SetNivMax( NivMax ); +} +//============================================================================= +CORBA::Long HOMARD_Hypothesis_i::GetNivMax() +{ + ASSERT( myHomardHypothesis ); + return myHomardHypothesis->GetNivMax(); +} +//============================================================================= +void HOMARD_Hypothesis_i::SetDiamMin( CORBA::Double DiamMin ) +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SetDiamMin( DiamMin ); +} +//============================================================================= +CORBA::Double HOMARD_Hypothesis_i::GetDiamMin() +{ + ASSERT( myHomardHypothesis ); + return myHomardHypothesis->GetDiamMin(); +} +//============================================================================= +void HOMARD_Hypothesis_i::SetAdapInit( CORBA::Long AdapInit ) +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SetAdapInit( AdapInit ); +} +//============================================================================= +CORBA::Long HOMARD_Hypothesis_i::GetAdapInit() +{ + ASSERT( myHomardHypothesis ); + return myHomardHypothesis->GetAdapInit(); +} +//============================================================================= +void HOMARD_Hypothesis_i::SetExtraOutput( CORBA::Long ExtraOutput ) +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SetExtraOutput( ExtraOutput ); +} +//============================================================================= +CORBA::Long HOMARD_Hypothesis_i::GetExtraOutput() +{ + ASSERT( myHomardHypothesis ); + return myHomardHypothesis->GetExtraOutput(); +} +//============================================================================= +void HOMARD_Hypothesis_i::AddGroup( const char* Group) +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->AddGroup( Group ); +} +//============================================================================= +void HOMARD_Hypothesis_i::SupprGroup( const char* Group ) +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SupprGroup(Group); +} +//============================================================================= +void HOMARD_Hypothesis_i::SupprGroups() +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SupprGroups(); +} +//============================================================================= +void HOMARD_Hypothesis_i::SetGroups(const SMESHHOMARD::ListGroupType& ListGroup) +{ + ASSERT( myHomardHypothesis ); + std::list ListString; + for ( int i = 0; i < ListGroup.length(); i++ ) + { + ListString.push_back(std::string(ListGroup[i])); + } + myHomardHypothesis->SetGroups( ListString ); +} +//============================================================================= +SMESHHOMARD::ListGroupType* HOMARD_Hypothesis_i::GetGroups() +{ + 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(); +} +//============================================================================= +void HOMARD_Hypothesis_i::SetTypeFieldInterp( CORBA::Long TypeFieldInterp ) +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SetTypeFieldInterp( TypeFieldInterp ); +} +//============================================================================= +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 ); +} +//============================================================================= +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 ) +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SupprFieldInterp(FieldInterp); +} +//============================================================================= +void HOMARD_Hypothesis_i::SupprFieldInterps() +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SupprFieldInterps(); +} +//============================================================================= +SMESHHOMARD::listeFieldInterpsHypo* HOMARD_Hypothesis_i::GetFieldInterps() +{ + 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(); +} +//============================================================================= +//============================================================================= +// 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() ); +} +//============================================================================= +void HOMARD_Hypothesis_i::LinkIteration( const char* NomIteration ) +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->LinkIteration( NomIteration ); +} +//============================================================================= +void HOMARD_Hypothesis_i::UnLinkIteration( const char* NomIteration ) +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->UnLinkIteration( NomIteration ); +} +//============================================================================= +SMESHHOMARD::listeIters* HOMARD_Hypothesis_i::GetIterations() +{ + 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(); +} + +//============================================================================= +/*! + * 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 ) +{ + MESSAGE("constructor"); + _gen_i = engine; + _orb = orb; + myHomardIteration = new SMESHHOMARDImpl::HOMARD_Iteration(); + ASSERT( myHomardIteration ); +} +//============================================================================= +/*! + * standard destructor + */ +//============================================================================= +HOMARD_Iteration_i::~HOMARD_Iteration_i() +{ +} +//============================================================================= +//============================================================================= +// Generalites +//============================================================================= +//============================================================================= +void HOMARD_Iteration_i::SetName( const char* Name ) +{ + ASSERT( myHomardIteration ); + myHomardIteration->SetName( Name ); +} +//============================================================================= +char* HOMARD_Iteration_i::GetName() +{ + ASSERT( myHomardIteration ); + return CORBA::string_dup( myHomardIteration->GetName().c_str() ); +} + + //============================================================================= + 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); + } + +//============================================================================= +char* HOMARD_Iteration_i::GetDumpPython() +{ + 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(); +} + +//============================================================================= +//functions +//============================================================================= +std::string RemoveTabulation( std::string theScript ) +{ + std::string::size_type aPos = 0; + while( aPos < theScript.length() ) + { + aPos = theScript.find( "\n\t", aPos ); + if( aPos == std::string::npos ) + break; + theScript.replace( aPos, 2, "\n" ); + aPos++; + } + return theScript; +} +//============================================================================= +/*! + * standard constructor + */ +//============================================================================= +HOMARD_Gen_i::HOMARD_Gen_i() : +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 ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This boundary is used in a case and cannot be deleted."; + throw SALOME::SALOME_Exception(es); + return 2; + }; + }; + } + + // comme on a un _var comme pointeur CORBA, on ne se preoccupe pas du delete + myStudyContext._mesBoundarys.erase(BoundaryName); + + 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; + } + // 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) +{ + MESSAGE("InvalideIterInfo : nomIter = " << 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); + } + + 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) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The directory for the calculation cannot be cleared."; + 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) +{ + MESSAGE( "AssociateCaseIter : " << nomCas << ", " << nomIter << ", " << labelIter ); + + 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"; + throw SALOME::SALOME_Exception(es); + } + + 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); + } + + 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++; + } +} + +//============================================================================= +//============================================================================= +// Recuperation des listes +//============================================================================= +//============================================================================= +SMESHHOMARD::listeBoundarys* HOMARD_Gen_i::GetAllBoundarysName() +{ + MESSAGE("GetAllBoundarysName"); + + SMESHHOMARD::listeBoundarys_var ret = new SMESHHOMARD::listeBoundarys; + ret->length(myStudyContext._mesBoundarys.size()); + std::map::const_iterator it; + int i = 0; + for (it = myStudyContext._mesBoundarys.begin(); + it != myStudyContext._mesBoundarys.end(); it++) + { + ret[i++] = CORBA::string_dup((*it).first.c_str()); + } + + return ret._retn(); +} +//============================================================================= +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++) + { + ret[i++] = CORBA::string_dup((*it).first.c_str()); + } + + return ret._retn(); +} + +//============================================================================= +//============================================================================= +// Recuperation des structures identifiees par leurs noms +//============================================================================= +//============================================================================= +SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::GetBoundary(const char* nomBoundary) +{ + SMESHHOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._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_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) +{ + 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); +} +//============================================================================= +//============================================================================= + +//============================================================================= +//============================================================================= +// 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); +} +//============================================================================= +//============================================================================= + +//============================================================================= +//============================================================================= +// Nouvelles structures +//============================================================================= +//============================================================================= +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); + 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()); + 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()); + return aBoundary._retn(); +} + +//============================================================================= +//============================================================================= +// 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 +// +{ + MESSAGE ( "CreateCase1 : DirNameStart = " << DirNameStart << ", Number = " << Number ); + std::string nomDirWork = getenv("PWD"); + std::string DirNameStartIter; + int codret; + int NumeIterMax = -1; + + // A.1. Controle du répertoire de depart du cas + codret = CHDIR(DirNameStart); + if ( codret != 0 ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The directory of the case for the pursuit does not exist."; + throw SALOME::SALOME_Exception(es); + return 0; + }; + // A.2. Reperage des sous-répertoire du répertoire de reprise + bool existe = false; +#ifndef WIN32 + DIR *dp; + struct dirent *dirp; + dp = opendir(DirNameStart); + while ( (dirp = readdir(dp)) != NULL ) { + std::string DirName_1(dirp->d_name); +#else + HANDLE hFind = INVALID_HANDLE_VALUE; + WIN32_FIND_DATA ffd; + hFind = FindFirstFile(DirNameStart, &ffd); + if (INVALID_HANDLE_VALUE != hFind) { + while (FindNextFile(hFind, &ffd) != 0) { + std::string DirName_1 = ""; + if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + DirName_1 = std::string(ffd.cFileName); + } +#endif + if ( ( DirName_1 != "." ) && ( DirName_1 != ".." ) ) + { + if ( CHDIR(DirName_1.c_str()) == 0 ) + { +// On cherche le fichier de configuration dans ce sous-répertoire + codret = CHDIR(DirNameStart); +#ifndef WIN32 + DIR *dp_1; + struct dirent *dirp_1; + dp_1 = opendir(DirName_1.c_str()); + while ( (dirp_1 = readdir(dp_1)) != NULL ) + { + std::string file_name_1(dirp_1->d_name); +#else + HANDLE hFind1 = INVALID_HANDLE_VALUE; + WIN32_FIND_DATA ffd1; + hFind1 = FindFirstFile(DirName_1.c_str(), &ffd1); + while (FindNextFile(hFind1, &ffd1) != 0) + { + if (ffd1.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories + std::string file_name_1(ffd1.cFileName); +#endif + int bilan = file_name_1.find("HOMARD.Configuration."); + if ( bilan != string::npos ) + { + // Decodage du fichier pour trouver le numero d'iteration + CHDIR(DirName_1.c_str()); + + std::ifstream fichier( file_name_1.c_str() ); + if ( fichier ) // ce test échoue si le fichier n'est pas ouvert + { + int NumeIter; + std::string ligne; // variable contenant chaque ligne lue + std::string mot_cle; + // cette boucle sur les lignes s'arrête dès qu'une erreur de lecture survient + while ( std::getline( fichier, ligne ) ) + { + // B.1. Pour la ligne courante, on identifie le premier mot : le mot-cle + std::istringstream ligne_bis(ligne); // variable contenant chaque ligne sous forme de flux + ligne_bis >> mot_cle; + if ( mot_cle == "NumeIter" ) + { + ligne_bis >> NumeIter; + NumeIter += 1; +// MESSAGE ( "==> NumeIter : " << NumeIter ); + if ( Number == - 1 ) + { + if ( NumeIter >= NumeIterMax ) + { + NumeIterMax = NumeIter; + DirNameStartIter = DirName_1; + } + } + else + { + if ( NumeIter == Number ) + { + DirNameStartIter = DirName_1; + existe = true; + break; + } + } + } + } + } + else + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "The configuration file cannot be read."; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + CHDIR(DirNameStart); + } + if ( existe ) { break; } + } +#ifndef WIN32 + closedir(dp_1); +#else + FindClose(hFind1); +#endif + if ( existe ) { break; } + } + } + } +#ifndef WIN32 + closedir(dp); +#else + FindClose(hFind); +#endif + CHDIR(nomDirWork.c_str()); + + if ( ( Number >= 0 && ( !existe ) ) || ( Number < 0 && ( NumeIterMax == -1 ) ) ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The directory of the iteration does not exist."; + throw SALOME::SALOME_Exception(es); + return 0; + }; + + return DirNameStartIter; +} +//============================================================================= +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()) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This case has already been defined."; + throw SALOME::SALOME_Exception(es); + return 0; + }; + + // A.3. Controle du fichier du maillage + int existeMeshFile; + if ( MeshOption >= 0 ) + { + existeMeshFile = MEDFileExist ( MeshFile ); + MESSAGE ( "CreateCase0 : existeMeshFile = " << existeMeshFile ); + if ( ( existeMeshFile == 0 ) && ( MeshOption == 0 ) ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The mesh file does not exist."; + throw SALOME::SALOME_Exception(es); + return 0; + } + } + else { existeMeshFile = 0; } + + // B. Creation de l'objet cas et publication + SMESHHOMARD::HOMARD_Cas_var myCase = newCase(); + myCase->SetName(nomCas); + myStudyContext._mesCas[nomCas] = myCase; + + // C. Caracteristiques du maillage + if ( existeMeshFile != 0 ) { + // Les valeurs extremes des coordonnées + //MESSAGE ( "CreateCase0 : Les valeurs extremes des coordonnées" ); + std::vector LesExtremes =GetBoundingBoxInMedFile(MeshFile); + 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 ( "CreateCase0 : 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 ( "CreateCase0 : iteration initiale du cas" ); + // D.1. Recherche d'un nom : par defaut, on prend le nom du maillage correspondant. + // Si ce nom d'iteration existe deja, on incremente avec 0, 1, 2, etc. + int monNum = 0; + std::string NomIteration = std::string(MeshName); + while ( (myStudyContext._mesIterations).find(NomIteration) != (myStudyContext._mesIterations.end()) ) + { + std::ostringstream nom; + nom << MeshName << monNum; + NomIteration = nom.str(); + monNum += 1; + } + MESSAGE ( "CreateCas0 : ==> NomIteration = " << NomIteration ); + + // D.2. Creation de l'iteration + SMESHHOMARD::HOMARD_Iteration_var anIter = newIteration(); + myStudyContext._mesIterations[NomIteration] = anIter; + anIter->SetName(NomIteration.c_str()); + AssociateCaseIter (nomCas, NomIteration.c_str(), "IterationHomard"); + + // D.4. Maillage correspondant + if ( existeMeshFile != 0 ) + { + anIter->SetMeshFile(MeshFile); + if ( Option % 2 == 0 ) { PublishResultInSmesh(MeshFile, 0); } + } + anIter->SetMeshName(MeshName); + + // D.5. Numero d'iteration + anIter->SetNumber(NumeIter); + + // D.6. Etat + SetEtatIter(NomIteration.c_str(), -NumeIter); +// + + return SMESHHOMARD::HOMARD_Cas::_duplicate(myCase); +} +//============================================================================= +SMESHHOMARD::HOMARD_Hypothesis_ptr HOMARD_Gen_i::CreateHypothesis(const char* nomHypothesis) +{ + MESSAGE ( "CreateHypothesis : nomHypothesis = " << nomHypothesis ); + + // A. Controle du nom : + if ((myStudyContext._mesHypotheses).find(nomHypothesis) != (myStudyContext._mesHypotheses).end()) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This hypothesis has already been defined."; + throw SALOME::SALOME_Exception(es); + return 0; + } + + // B. Creation de l'objet + SMESHHOMARD::HOMARD_Hypothesis_var myHypothesis = newHypothesis(); + if (CORBA::is_nil(myHypothesis)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Unable to create the hypothesis"; + throw SALOME::SALOME_Exception(es); + return 0; + }; + myHypothesis->SetName(nomHypothesis); + + // C. Enregistrement + myStudyContext._mesHypotheses[nomHypothesis] = myHypothesis; + + // D. Valeurs par defaut des options avancees + myHypothesis->SetNivMax(-1); + myHypothesis->SetDiamMin(-1.0); + myHypothesis->SetAdapInit(0); + myHypothesis->SetExtraOutput(1); + + return SMESHHOMARD::HOMARD_Hypothesis::_duplicate(myHypothesis); +} + +//============================================================================= +SMESHHOMARD::HOMARD_Iteration_ptr HOMARD_Gen_i::CreateIteration(const char* NomIteration, const char* nomIterParent) +//============================================================================= +{ + MESSAGE ("CreateIteration : NomIteration = " << NomIteration << ", nomIterParent = " << nomIterParent); + + SMESHHOMARD::HOMARD_Iteration_var myIterationParent = myStudyContext._mesIterations[nomIterParent]; + if (CORBA::is_nil(myIterationParent)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The parent iteration is not defined."; + throw SALOME::SALOME_Exception(es); + return 0; + }; + + const char* nomCas = myIterationParent->GetCaseName(); + MESSAGE ("CreateIteration : nomCas = " << nomCas); + 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; + } + + SMESHHOMARD::HOMARD_Iteration_var myIteration = newIteration(); + if (CORBA::is_nil(myIteration)) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Unable to create the iteration"; + throw SALOME::SALOME_Exception(es); + return 0; + } + + myStudyContext._mesIterations[std::string(NomIteration)] = myIteration; + // Nom de l'iteration et du maillage + myIteration->SetName(NomIteration); + myIteration->SetMeshName(NomIteration); + myIteration->SetState(1); + + int numero = myIterationParent->GetNumber() + 1; + myIteration->SetNumber(numero); + + // Nombre d'iterations deja connues pour le cas, permettant + // la creation d'un sous-répertoire unique + int nbitercase = myCase->GetNumberofIter(); + char* nomDirIter = CreateDirNameIter(nomDirCase, nbitercase ); + myIteration->SetDirNameLoc(nomDirIter); + + // Le nom du fichier du maillage MED est indice par le nombre d'iterations du cas. + // Si on a une chaine unique depuis le depart, ce nombre est le meme que le + // numero d'iteration dans la sucession : maill.01.med, maill.02.med, etc... C'est la + // situation la plus frequente. + // Si on a plusieurs branches, donc des iterations du meme niveau d'adaptation, utiliser + // le nombre d'iterations du cas permet d'eviter les collisions. + int jaux; + if ( nbitercase < 100 ) { jaux = 2; } + else if ( nbitercase < 1000 ) { jaux = 3; } + else if ( nbitercase < 10000 ) { jaux = 4; } + else if ( nbitercase < 100000 ) { jaux = 5; } + else { jaux = 9; } + std::ostringstream iaux; + iaux << std::setw(jaux) << std::setfill('0') << nbitercase; + std::stringstream MeshFile; + MeshFile << nomDirCase << "/maill." << iaux.str() << ".med"; + myIteration->SetMeshFile(MeshFile.str().c_str()); + + // Association avec le cas + std::string label = "IterationHomard_" + std::string(nomIterParent); + AssociateCaseIter(nomCas, NomIteration, label.c_str()); + + // Lien avec l'iteration precedente + myIterationParent->LinkNextIteration(NomIteration); + myIteration->SetIterParentName(nomIterParent); + + return SMESHHOMARD::HOMARD_Iteration::_duplicate(myIteration); +} +//============================================================================= +SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundary(const char* BoundaryName, CORBA::Long BoundaryType) +{ + MESSAGE ("CreateBoundary : BoundaryName = " << BoundaryName << ", BoundaryType = " << BoundaryType); + + // Controle du nom : + if ((myStudyContext._mesBoundarys).find(BoundaryName)!=(myStudyContext._mesBoundarys).end()) + { + MESSAGE ("CreateBoundary : la frontiere " << BoundaryName << " existe deja"); + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This boundary has already been defined"; + throw SALOME::SALOME_Exception(es); + return 0; + }; + + SMESHHOMARD::HOMARD_Boundary_var myBoundary = newBoundary(); + myBoundary->SetName(BoundaryName); + myBoundary->SetType(BoundaryType); + + myStudyContext._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 ); + SMESHHOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, -1); + 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 ); + SMESHHOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 0); + myBoundary->SetDataFile( MeshFile ); + myBoundary->SetMeshName( MeshName ); + + return SMESHHOMARD::HOMARD_Boundary::_duplicate(myBoundary); +} +//============================================================================= +SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryCylinder(const char* BoundaryName, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, + CORBA::Double Rayon) +{ + MESSAGE ("CreateBoundaryCylinder : BoundaryName = " << BoundaryName ); +// + SALOME::ExceptionStruct es; + int error = 0; + if ( Rayon <= 0.0 ) + { es.text = "The radius must be positive."; + error = 1; } + double daux = fabs(Xaxe) + fabs(Yaxe) + fabs(Zaxe); + if ( daux < 0.0000001 ) + { es.text = "The axis must be a non 0 vector."; + error = 2; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + SMESHHOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 1); + myBoundary->SetCylinder( Xcentre, Ycentre, Zcentre, Xaxe, Yaxe, Zaxe, Rayon ); + + return SMESHHOMARD::HOMARD_Boundary::_duplicate(myBoundary); +} +//============================================================================= +SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundarySphere(const char* BoundaryName, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Rayon) +{ + MESSAGE ("CreateBoundarySphere : BoundaryName = " << BoundaryName ); +// + SALOME::ExceptionStruct es; + int error = 0; + if ( Rayon <= 0.0 ) + { es.text = "The radius must be positive."; + error = 1; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + SMESHHOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 2); + myBoundary->SetSphere( Xcentre, Ycentre, Zcentre, Rayon ); + + return SMESHHOMARD::HOMARD_Boundary::_duplicate(myBoundary); +} +//============================================================================= +SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryConeA(const char* BoundaryName, + CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, CORBA::Double Angle, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre) +{ + MESSAGE ("CreateBoundaryConeA : BoundaryName = " << BoundaryName ); +// + SALOME::ExceptionStruct es; + int error = 0; + if ( Angle <= 0.0 || Angle >= 90.0 ) + { es.text = "The angle must be included higher than 0 degree and lower than 90 degrees."; + error = 1; } + double daux = fabs(Xaxe) + fabs(Yaxe) + fabs(Zaxe); + if ( daux < 0.0000001 ) + { es.text = "The axis must be a non 0 vector."; + error = 2; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + SMESHHOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 3); + myBoundary->SetConeA( Xaxe, Yaxe, Zaxe, Angle, Xcentre, Ycentre, Zcentre ); + + return SMESHHOMARD::HOMARD_Boundary::_duplicate(myBoundary); +} +//============================================================================= +SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryConeR(const char* BoundaryName, + CORBA::Double Xcentre1, CORBA::Double Ycentre1, CORBA::Double Zcentre1, CORBA::Double Rayon1, + CORBA::Double Xcentre2, CORBA::Double Ycentre2, CORBA::Double Zcentre2, CORBA::Double Rayon2) +{ + MESSAGE ("CreateBoundaryConeR : BoundaryName = " << BoundaryName ); +// + SALOME::ExceptionStruct es; + int error = 0; + if ( Rayon1 < 0.0 || Rayon2 < 0.0 ) + { es.text = "The radius must be positive."; + error = 1; } + double daux = fabs(Rayon2-Rayon1); + if ( daux < 0.0000001 ) + { es.text = "The radius must be different."; + error = 2; } + daux = fabs(Xcentre2-Xcentre1) + fabs(Ycentre2-Ycentre1) + fabs(Zcentre2-Zcentre1); + if ( daux < 0.0000001 ) + { es.text = "The centers must be different."; + error = 3; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + SMESHHOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 4); + myBoundary->SetConeR( Xcentre1, Ycentre1, Zcentre1, Rayon1, Xcentre2, Ycentre2, Zcentre2, Rayon2 ); + + return SMESHHOMARD::HOMARD_Boundary::_duplicate(myBoundary); +} +//============================================================================= +SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryTorus(const char* BoundaryName, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, + CORBA::Double RayonRev, CORBA::Double RayonPri) +{ + MESSAGE ("CreateBoundaryTorus : BoundaryName = " << BoundaryName ); +// + SALOME::ExceptionStruct es; + int error = 0; + if ( ( RayonRev <= 0.0 ) || ( RayonPri <= 0.0 ) ) + { es.text = "The radius must be positive."; + error = 1; } + double daux = fabs(Xaxe) + fabs(Yaxe) + fabs(Zaxe); + if ( daux < 0.0000001 ) + { es.text = "The axis must be a non 0 vector."; + error = 2; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + SMESHHOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 5); + 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 = "<GetNumber(); + std::string siterp1; + std::stringstream saux1; + saux1 << NumeIter; + siterp1 = saux1.str(); + if (NumeIter < 10) { siterp1 = "0" + siterp1; } + + std::string siter; + if ( modeHOMARD==1 ) + { + std::stringstream saux0; + int iaux = max(0, NumeIter-1); + saux0 << iaux; + siter = saux0.str(); + if (NumeIter < 11) { siter = "0" + siter; } + } + else + { siter = siterp1; } + + // A.4. Le cas + const char* nomCas = myIteration->GetCaseName(); + 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 ); + + // C. Le fichier des messages + // C.1. Le deroulement de l'execution de HOMARD + std::string LogFile = myIteration->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()); + } + 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()); + + // D. On passe dans le répertoire de l'iteration a calculer + MESSAGE ( ". On passe dans DirCompute = " << DirCompute ); + CHDIR(DirCompute); + + // E. Les données de l'exécution HOMARD + // E.1. L'objet du texte du fichier de configuration + SMESHHOMARDImpl::HomardDriver* myDriver = new SMESHHOMARDImpl::HomardDriver(siter, siterp1); + myDriver->TexteInit(DirCompute, LogFile, _Langue); + + // E.2. Le maillage associe a l'iteration + const char* NomMesh = myIteration->GetMeshName(); + MESSAGE ( ". NomMesh = " << NomMesh ); + const char* MeshFile = myIteration->GetMeshFile(); + MESSAGE ( ". MeshFile = " << MeshFile ); + + // E.3. Les données du traitement HOMARD + int iaux; + if ( modeHOMARD == 1 ) + { + iaux = 1; + myDriver->TexteMaillageHOMARD( DirCompute, siterp1, iaux ); + myDriver->TexteMaillage(NomMesh, MeshFile, 1); + codret = ComputeAdap(myCase, myIteration, etatMenage, myDriver, Option1, Option2); + } + else + { + InvalideIterInfo(NomIteration); + myDriver->TexteInfo( modeHOMARD, NumeIter ); + iaux = 0; + myDriver->TexteMaillageHOMARD( DirCompute, siterp1, iaux ); + myDriver->TexteMaillage(NomMesh, MeshFile, 0); + myDriver->CreeFichierDonn(); + } + + // E.4. Ajout des informations liees a l'eventuel suivi de frontiere + int BoundaryOption = DriverTexteBoundary(myCase, myDriver); + + // E.5. Ecriture du texte dans le fichier + MESSAGE ( ". Ecriture du texte dans le fichier de configuration; codret = "<CreeFichier(); } + +// G. Execution +// + int codretexec = 1789; + if (codret == 0) + { + codretexec = myDriver->ExecuteHomard(Option1); +// + MESSAGE ( "Erreur en executant HOMARD : " << codretexec ); + // En mode adaptation, on ajuste l'etat de l'iteration + if ( modeHOMARD == 1 ) + { + if (codretexec == 0) { SetEtatIter(NomIteration,2); } + else { SetEtatIter(NomIteration,1); } + // GERALD -- QMESSAGE BOX + } + } + + // H. Gestion des resultats + if (codret == 0) + { + std::string Commentaire; + // H.1. Le fichier des messages, dans tous les cas + Commentaire = "log"; + if ( modeHOMARD == 1 ) { Commentaire += " " + siterp1; } + else { Commentaire += "Info"; } + + // H.2. Si tout s'est bien passe : + if (codretexec == 0) + { + // H.2.1. Le fichier de bilan + Commentaire = "Summary"; + if ( modeHOMARD == 1 ) { Commentaire += " " + siterp1; } + else { Commentaire += "Info"; } + // 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); } + } + } + // H.3 Message d'erreur + if (codretexec != 0) { + std::string text = ""; + // Message d'erreur en cas de probleme en adaptation + if ( modeHOMARD == 1 ) { + text = "Error during the adaptation.\n"; + bool stopvu = false; + std::ifstream fichier( LogFile.c_str() ); + if ( fichier ) // ce test échoue si le fichier n'est pas ouvert + { + std::string ligne; // variable contenant chaque ligne lue + while ( std::getline( fichier, ligne ) ) + { +// INFOS(ligne); + if ( stopvu ) + { text += ligne+ "\n"; } + else + { + int position = ligne.find( "===== HOMARD ===== STOP =====" ); + if ( position > 0 ) { stopvu = true; } + } + } + } + } + text += "\n\nSee the file " + LogFile + "\n"; + INFOS ( text ); + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); +// + // En mode information, on force le succes pour pouvoir consulter le fichier log + if ( modeHOMARD != 1 ) { codretexec = 0; } + } + } + + // I. Menage et retour dans le répertoire du cas + if (codret == 0) + { + delete myDriver; + MESSAGE ( ". On retourne dans nomDirWork = " << nomDirWork ); + + CHDIR(nomDirWork.c_str()); + } + + // J. Suivi de la frontière CAO +// std::cout << "- codret : " << codret << std::endl; +// std::cout << "- modeHOMARD : " << modeHOMARD << std::endl; +// std::cout << "- BoundaryOption : " << BoundaryOption << std::endl; +// std::cout << "- codretexec : " << codretexec << std::endl; + if (codret == 0) + { + if ( ( modeHOMARD == 1 ) && ( BoundaryOption % 5 == 0 ) && (codretexec == 0) ) + { + MESSAGE ( "Suivi de frontière CAO" ); + codret = ComputeCAO(myCase, myIteration, Option1, Option2); + } + } + + return codretexec; +} +//============================================================================= +// Calcul d'une iteration : partie spécifique à l'adaptation +//============================================================================= +CORBA::Long HOMARD_Gen_i::ComputeAdap(SMESHHOMARD::HOMARD_Cas_var myCase, + SMESHHOMARD::HOMARD_Iteration_var myIteration, + CORBA::Long etatMenage, + SMESHHOMARDImpl::HomardDriver* myDriver, + CORBA::Long Option1, + CORBA::Long Option2) +{ + MESSAGE ( "ComputeAdap avec Option1 = " << Option1 << ", Option2 = " << Option2 ); + + // A. Prealable + // A.1. Bases + int codret = 0; + // Numero de l'iteration + int NumeIter = myIteration->GetNumber(); + std::stringstream saux0; + saux0 << NumeIter-1; + std::string siter = saux0.str(); + if (NumeIter < 11) { siter = "0" + siter; } + + // A.2. On verifie qu il y a une hypothese (erreur improbable); + const char* nomHypo = myIteration->GetHypoName(); + if (std::string(nomHypo) == std::string("")) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This iteration does not have any associated hypothesis."; + throw SALOME::SALOME_Exception(es); + return 2; + }; + SMESHHOMARD::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypo]; + ASSERT(!CORBA::is_nil(myHypo)); + + // B. L'iteration parent + const char* nomIterationParent = myIteration->GetIterParentName(); + SMESHHOMARD::HOMARD_Iteration_var myIterationParent = myStudyContext._mesIterations[nomIterationParent]; + ASSERT(!CORBA::is_nil(myIterationParent)); + // Si l'iteration parent n'est pas calculee, on le fait (recursivite amont) + if ( myIterationParent->GetState() == 1 ) + { + int iaux = 1; + int codret = Compute(nomIterationParent, etatMenage, iaux, Option1, Option2); + if (codret != 0) + { + // GERALD -- QMESSAGE BOX + VERIFICATION("Pb au calcul de l'iteration precedente" == 0); + } + }; + + // C. Le sous-répertoire de l'iteration precedente + char* DirComputePa = ComputeDirPaManagement(myCase, myIteration); + MESSAGE( ". DirComputePa = " << DirComputePa ); + + // D. Les données de l'adaptation HOMARD + // D.1. Le type de conformite + int ConfType = myCase->GetConfType(); + MESSAGE ( ". ConfType = " << ConfType ); + + // D.1. Le type externe + int ExtType = myCase->GetExtType(); + MESSAGE ( ". ExtType = " << ExtType ); + + // D.3. Le maillage de depart + const char* NomMeshParent = myIterationParent->GetMeshName(); + MESSAGE ( ". NomMeshParent = " << NomMeshParent ); + const char* MeshFileParent = myIterationParent->GetMeshFile(); + MESSAGE ( ". MeshFileParent = " << MeshFileParent ); + + // D.4. Le maillage associe a l'iteration + const char* MeshFile = myIteration->GetMeshFile(); + MESSAGE ( ". MeshFile = " << MeshFile ); + FILE *file = fopen(MeshFile,"r"); + if (file != NULL) + { + fclose(file); + if (etatMenage == 0) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "MeshFile : " + std::string(MeshFile) + " already exists "; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + return 4; + } + else + { + std::string commande = "rm -f " + std::string(MeshFile); + codret = system(commande.c_str()); + if (codret != 0) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The mesh file cannot be deleted."; + throw SALOME::SALOME_Exception(es); + return 5; + } + } + } + + // D.5. Les types de raffinement et de deraffinement + // Les appels corba sont lourds, il vaut mieux les grouper + 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 ); + + // E. Texte du fichier de configuration + // E.1. Incontournables du texte + myDriver->TexteAdap(ExtType); + int iaux = 0; + myDriver->TexteMaillageHOMARD( DirComputePa, siter, iaux ); + myDriver->TexteMaillage(NomMeshParent, MeshFileParent, 0); + myDriver->TexteConfRaffDera(ConfType, TypeAdap, TypeRaff, TypeDera); + + // E.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); + + // E.7. Ajout des informations sur le deroulement de l'execution + int MessInfo = myIteration->GetInfoCompute(); + MESSAGE ( ". MessInfo = " << MessInfo ); + myDriver->TexteInfoCompute(MessInfo); + + return codret; +} +//============================================================================= +// Calcul d'une iteration : partie spécifique au suivi de frontière CAO +//============================================================================= +CORBA::Long HOMARD_Gen_i::ComputeCAO(SMESHHOMARD::HOMARD_Cas_var myCase, SMESHHOMARD::HOMARD_Iteration_var myIteration, CORBA::Long Option1, CORBA::Long Option2) +{ + MESSAGE ( "ComputeCAO avec Option1 = " << Option1 << ", Option2 = " << Option2 ); + + // A. Prealable + // A.1. Bases + int codret = 0; + // A.2. Le sous-répertoire de l'iteration en cours de traitement + char* DirCompute = myIteration->GetDirName(); + // A.3. Le maillage résultat de l'iteration en cours de traitement + char* MeshFile = myIteration->GetMeshFile(); + + // B. Les données pour FrontTrack + // B.1. Le maillage à modifier + const std::string theInputMedFile = MeshFile; + MESSAGE ( ". theInputMedFile = " << theInputMedFile ); + + // B.2. Le maillage après modification : fichier identique + const std::string theOutputMedFile = MeshFile; + MESSAGE ( ". theOutputMedFile = " << theInputMedFile ); + + // B.3. La liste des fichiers contenant les numéros des noeuds à bouger + std::vector< std::string > theInputNodeFiles; + MESSAGE ( ". DirCompute = " << DirCompute ); + int bilan; + int icpt = 0; +#ifndef WIN32 + DIR *dp; + struct dirent *dirp; + dp = opendir(DirCompute); + while ( (dirp = readdir(dp)) != NULL ) + { + std::string file_name(dirp->d_name); + bilan = file_name.find("fr"); + if ( bilan != string::npos ) + { + std::stringstream filename_total; + filename_total << DirCompute << "/" << file_name; + theInputNodeFiles.push_back(filename_total.str()); + icpt += 1; + } + } +#else + HANDLE hFind = INVALID_HANDLE_VALUE; + WIN32_FIND_DATA ffd; + hFind = FindFirstFile(DirNameStart, &ffd); + if (INVALID_HANDLE_VALUE != hFind) { + while (FindNextFile(hFind, &ffd) != 0) { + std::string file_name(ffd.cFileName); + bilan = file_name.find("fr"); + if ( bilan != string::npos ) + { + std::stringstream filename_total; + filename_total << DirCompute << "/" << file_name; + theInputNodeFiles.push_back(filename_total.str()); + icpt += 1; + } + } + FindClose(hFind); + } +#endif + for ( int i = 0; i < icpt; i++ ) + { MESSAGE ( ". theInputNodeFiles["<< i << "] = " << theInputNodeFiles[i] ); } + + // B.4. Le fichier de la CAO + SMESHHOMARD::ListBoundaryGroupType* ListBoundaryGroupType = myCase->GetBoundaryGroup(); + std::string BoundaryName = std::string((*ListBoundaryGroupType)[0]); + MESSAGE ( ". BoundaryName = " << BoundaryName ); + SMESHHOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; + const std::string theXaoFileName = myBoundary->GetDataFile(); + MESSAGE ( ". theXaoFileName = " << theXaoFileName ); + + // B.5. Parallélisme + bool theIsParallel = false; + + // C. Lancement des projections + MESSAGE ( ". Lancement des projections" ); + //FrontTrack* myFrontTrack = new FrontTrack(); + //myFrontTrack->track(theInputMedFile, theOutputMedFile, theInputNodeFiles, theXaoFileName, theIsParallel); + + // D. Transfert des coordonnées modifiées dans le fichier historique de HOMARD + // On lance une exécution spéciale de HOMARD en attendant de savoir le faire avec MEDCoupling + MESSAGE ( ". Transfert des coordonnées" ); + codret = ComputeCAObis(myIteration, Option1, Option2); + + return codret; +} +//============================================================================= +//============================================================================= +// Transfert des coordonnées en suivi de frontière CAO +// Option1 >0 : appel depuis python +// <0 : appel depuis GUI +// Option2 : multiple de nombres premiers +// 1 : aucune option +// x2 : publication du maillage dans SMESH +//============================================================================= +CORBA::Long HOMARD_Gen_i::ComputeCAObis(SMESHHOMARD::HOMARD_Iteration_var myIteration, CORBA::Long Option1, CORBA::Long Option2) +{ + MESSAGE ( "ComputeCAObis, avec Option1 = " << Option1 << ", Option2 = " << Option2 ); + + // A. Prealable + int codret = 0; + + // A.1. Controle de la possibilite d'agir + // A.1.1. Etat de l'iteration + int etat = myIteration->GetState(); + MESSAGE ( "etat = "<GetNumber(); + std::string siterp1; + std::stringstream saux1; + saux1 << NumeIter; + siterp1 = saux1.str(); + if (NumeIter < 10) { siterp1 = "0" + siterp1; } + MESSAGE ( "siterp1 = "<GetCaseName(); + SMESHHOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[CaseName]; + ASSERT(!CORBA::is_nil(myCase)); + + // A.4. Le sous-répertoire de l'iteration a traiter + char* DirCompute = myIteration->GetDirName(); + MESSAGE( ". DirCompute = " << DirCompute ); + + // C. Le fichier des messages + std::string LogFile = DirCompute; + LogFile += "/Liste." + siterp1 + ".maj_coords.log"; + MESSAGE (". LogFile = " << LogFile); + myIteration->SetFileInfo(LogFile.c_str()); + + // D. On passe dans le répertoire de l'iteration a calculer + MESSAGE ( ". On passe dans DirCompute = " << DirCompute ); + CHDIR(DirCompute); + + // E. Les données de l'exécution HOMARD + // E.1. L'objet du texte du fichier de configuration + SMESHHOMARDImpl::HomardDriver* myDriver = new SMESHHOMARDImpl::HomardDriver("", siterp1); + myDriver->TexteInit(DirCompute, LogFile, _Langue); + + // E.2. Le maillage associe a l'iteration + const char* NomMesh = myIteration->GetMeshName(); + MESSAGE ( ". NomMesh = " << NomMesh ); + const char* MeshFile = myIteration->GetMeshFile(); + MESSAGE ( ". MeshFile = " << MeshFile ); + + // E.3. Les données du traitement HOMARD + int iaux; + myDriver->TexteMajCoords( NumeIter ); + iaux = 0; + myDriver->TexteMaillageHOMARD( DirCompute, siterp1, iaux ); + myDriver->TexteMaillage(NomMesh, MeshFile, 0); +// + // E.4. Ecriture du texte dans le fichier + MESSAGE ( ". Ecriture du texte dans le fichier de configuration; codret = "<CreeFichier(); } + +// F. Execution +// + int codretexec = 1789; + if (codret == 0) + { + codretexec = myDriver->ExecuteHomard(Option1); + MESSAGE ( "Erreur en executant HOMARD : " << codretexec ); + } + + // G. Gestion des resultats + if (codret == 0) + { + // G.1. Le fichier des messages, dans tous les cas + const char* NomIteration = myIteration->GetName(); + std::string Commentaire = "logmaj_coords"; + // G.2 Message d'erreur + if (codretexec != 0) + { + std::string text = "\n\nSee the file " + LogFile + "\n"; + INFOS ( text ); + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + + // On force le succes pour pouvoir consulter le fichier log + codretexec = 0; + } + } + + // H. Menage et retour dans le répertoire du cas + if (codret == 0) { delete myDriver; } + + return codret; +} +//============================================================================= +// Creation d'un nom de sous-répertoire pour l'iteration au sein d'un répertoire parent +// nomrep : nom du répertoire parent +// num : le nom du sous-répertoire est sous la forme 'In', n est >= num +//============================================================================= +char* HOMARD_Gen_i::CreateDirNameIter(const char* nomrep, CORBA::Long num ) +{ + MESSAGE ( "CreateDirNameIter : nomrep ="<< nomrep << ", num = "<d_name); +#else + HANDLE hFind = INVALID_HANDLE_VALUE; + WIN32_FIND_DATA ffd; + hFind = FindFirstFile(nomrep, &ffd); + if (INVALID_HANDLE_VALUE != hFind) { + while (FindNextFile(hFind, &ffd) != 0) { + if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories + std::string file_name(ffd.cFileName); +#endif + if ( file_name == DirNameA.str() ) { existe = true; } + } +#ifndef WIN32 + closedir(dp); +#else + FindClose(hFind); +#endif + if ( !existe ) + { + DirName = DirNameA.str(); + a_chercher = false; + break; + } + } + num += 1; + } + + MESSAGE ( "==> DirName = " << DirName); + MESSAGE ( ". On retourne dans nomDirActuel = " << nomDirActuel ); + CHDIR(nomDirActuel.c_str()); + return CORBA::string_dup( DirName.c_str() ); +} +//============================================================================= +// Calcul d'une iteration : gestion du répertoire de calcul +// Si le sous-répertoire existe : +// etatMenage = 0 : on sort en erreur si le répertoire n'est pas vide +// etatMenage = 1 : on fait le menage du répertoire +// etatMenage = -1 : on ne fait rien +//============================================================================= +char* HOMARD_Gen_i::ComputeDirManagement(SMESHHOMARD::HOMARD_Cas_var myCase, SMESHHOMARD::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage) +{ + MESSAGE ( "ComputeDirManagement : répertoires pour le calcul" ); + // B.2. Le répertoire du cas + const char* nomDirCase = myCase->GetDirName(); + MESSAGE ( ". nomDirCase = " << nomDirCase ); + + // B.3. Le sous-répertoire de l'iteration a calculer, puis le répertoire complet a creer + // B.3.1. Le nom du sous-répertoire + const char* nomDirIt = myIteration->GetDirNameLoc(); + + // B.3.2. Le nom complet du sous-répertoire + std::stringstream DirCompute; + DirCompute << nomDirCase << "/" << nomDirIt; + MESSAGE (". DirCompute = " << DirCompute.str() ); + + // B.3.3. Si le sous-répertoire n'existe pas, on le cree + if (CHDIR(DirCompute.str().c_str()) != 0) + { +#ifndef WIN32 + if (mkdir(DirCompute.str().c_str(), S_IRWXU|S_IRGRP|S_IXGRP) != 0) +#else + if (_mkdir(DirCompute.str().c_str()) != 0) +#endif + { + // GERALD -- QMESSAGE BOX + std::cerr << "Pb Creation du répertoire DirCompute = " << DirCompute.str() << std::endl; + VERIFICATION("Pb a la creation du répertoire" == 0); + } + } + else + { +// Le répertoire existe +// On demande de faire le menage de son contenu : + if (etatMenage == 1) + { + MESSAGE (". Menage du répertoire DirCompute = " << DirCompute.str()); + std::string commande = "rm -rf " + DirCompute.str()+"/*"; + int codret = system(commande.c_str()); + if (codret != 0) + { + // GERALD -- QMESSAGE BOX + std::cerr << ". Menage du répertoire de calcul" << DirCompute.str() << std::endl; + VERIFICATION("Pb au menage du répertoire de calcul" == 0); + } + } +// On n'a pas demande de faire le menage de son contenu : on sort en erreur : + else + { + if (etatMenage == 0) + { +#ifndef WIN32 + DIR *dp; + struct dirent *dirp; + dp = opendir(DirCompute.str().c_str()); + bool result = true; + while ((dirp = readdir(dp)) != NULL && result ) + { + std::string file_name(dirp->d_name); + result = file_name.empty() || file_name == "." || file_name == ".."; //if any file - break and return false + } + closedir(dp); +#else + HANDLE hFind = INVALID_HANDLE_VALUE; + WIN32_FIND_DATA ffd; + hFind = FindFirstFile(DirCompute.str().c_str(), &ffd); + bool result = true; + if (INVALID_HANDLE_VALUE != hFind) { + while (FindNextFile(hFind, &ffd) != 0) { + if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories + std::string file_name(ffd.cFileName); + result = file_name.empty() || file_name == "." || file_name == ".."; //if any file - break and return false + } + } + FindClose(hFind); +#endif + if ( result == false) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "Directory : " + DirCompute.str() + " is not empty"; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + VERIFICATION("Directory is not empty" == 0); + } + } + } + } + + return CORBA::string_dup( DirCompute.str().c_str() ); +} +//============================================================================= +// Calcul d'une iteration : gestion du répertoire de calcul de l'iteration parent +//============================================================================= +char* HOMARD_Gen_i::ComputeDirPaManagement(SMESHHOMARD::HOMARD_Cas_var myCase, SMESHHOMARD::HOMARD_Iteration_var myIteration) +{ + MESSAGE ( "ComputeDirPaManagement : répertoires pour le calcul" ); + // Le répertoire du cas + const char* nomDirCase = myCase->GetDirName(); + MESSAGE ( ". nomDirCase = " << nomDirCase ); + + // Le sous-répertoire de l'iteration precedente + + const char* nomIterationParent = myIteration->GetIterParentName(); + SMESHHOMARD::HOMARD_Iteration_var myIterationParent = myStudyContext._mesIterations[nomIterationParent]; + const char* nomDirItPa = myIterationParent->GetDirNameLoc(); + std::stringstream DirComputePa; + DirComputePa << nomDirCase << "/" << nomDirItPa; + MESSAGE( ". nomDirItPa = " << nomDirItPa); + MESSAGE( ". DirComputePa = " << DirComputePa.str() ); + + return CORBA::string_dup( DirComputePa.str().c_str() ); +} +//============================================================================= +// Calcul d'une iteration : ecriture des 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); + } +} +//============================================================================= +// Calcul d'une iteration : ecriture des frontieres dans le fichier de configuration +// On ecrit dans l'ordre : +// 1. la definition des frontieres +// 2. les liens avec les groupes +// 3. un entier resumant le type de comportement pour les frontieres +//============================================================================= +int HOMARD_Gen_i::DriverTexteBoundary(SMESHHOMARD::HOMARD_Cas_var myCase, SMESHHOMARDImpl::HomardDriver* myDriver) +{ + 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); + int BoundaryOption = 1; + // 2. Parcours des frontieres pour ecrire leur description + int NumBoundaryAnalytical = 0; + for (int NumBoundary = 0; NumBoundary< numberOfitems; NumBoundary=NumBoundary+2) + { + std::string BoundaryName = std::string((*ListBoundaryGroupType)[NumBoundary]); + MESSAGE ( "... BoundaryName = " << BoundaryName); + // 2.1. La frontiere a-t-elle deja ete ecrite ? + // Cela arrive quand elle est liee a plusieurs groupes. Il ne faut l'ecrire que la premiere fois + int A_faire = 1; + std::list::const_iterator it = ListeBoundaryTraitees.begin(); + while (it != ListeBoundaryTraitees.end()) + { + MESSAGE ( "..... BoundaryNameTraitee = " << *it); + if ( BoundaryName == *it ) { A_faire = 0; } + it++; + } + // 2.2. Ecriture de la frontiere + if ( A_faire == 1 ) + { + // 2.2.1. Caracteristiques de la frontiere + SMESHHOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; + ASSERT(!CORBA::is_nil(myBoundary)); + int BoundaryType = myBoundary->GetType(); + MESSAGE ( "... BoundaryType = " << BoundaryType ); + // 2.2.2. Ecriture selon le type + // 2.2.2.1. Cas d une frontiere CAO + if (BoundaryType == -1) + { +// const char* CAOFile = myBoundary->GetDataFile(); +// MESSAGE ( ". CAOFile = " << CAOFile ); + if ( BoundaryOption % 5 != 0 ) { BoundaryOption = BoundaryOption*5; } + } + // 2.2.2.2. Cas d une frontiere discrete + else if (BoundaryType == 0) + { + const char* MeshName = myBoundary->GetMeshName(); + MESSAGE ( ". MeshName = " << MeshName ); + const char* MeshFile = myBoundary->GetDataFile(); + MESSAGE ( ". MeshFile = " << MeshFile ); + myDriver->TexteBoundaryDi( MeshName, MeshFile); + if ( BoundaryOption % 2 != 0 ) { BoundaryOption = BoundaryOption*2; } + } + // 2.2.2.3. Cas d une frontiere analytique + else + { + NumBoundaryAnalytical++; + SMESHHOMARD::double_array* coor = myBoundary->GetCoords(); + if (BoundaryType == 1) // Cas d un cylindre + { + myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], (*coor)[4], (*coor)[5], (*coor)[6], 0.); + if ( BoundaryOption % 3 != 0 ) { BoundaryOption = BoundaryOption*3; } + } + else if (BoundaryType == 2) // Cas d une sphere + { + myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], 0., 0., 0., 0.); + if ( BoundaryOption % 3 != 0 ) { BoundaryOption = BoundaryOption*3; } + } + else if (BoundaryType == 3) // Cas d un cone defini par un axe et un angle + { + myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], (*coor)[4], (*coor)[5], (*coor)[6], 0.); + if ( BoundaryOption % 3 != 0 ) { BoundaryOption = BoundaryOption*3; } + } + else if (BoundaryType == 4) // Cas d un cone defini par les 2 rayons + { + myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], (*coor)[4], (*coor)[5], (*coor)[6], (*coor)[7]); + if ( BoundaryOption % 3 != 0 ) { BoundaryOption = BoundaryOption*3; } + } + else if (BoundaryType == 5) // Cas d un tore + { + myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], (*coor)[4], (*coor)[5], (*coor)[6], (*coor)[7]); + if ( BoundaryOption % 3 != 0 ) { BoundaryOption = BoundaryOption*3; } + } + } + // 2.2.3. Memorisation du traitement + ListeBoundaryTraitees.push_back( BoundaryName ); + } + } + // 3. Parcours des frontieres pour ecrire les liens avec les groupes + NumBoundaryAnalytical = 0; + for (int NumBoundary = 0; NumBoundary< numberOfitems; NumBoundary=NumBoundary+2) + { + std::string BoundaryName = std::string((*ListBoundaryGroupType)[NumBoundary]); + MESSAGE ( "... BoundaryName = " << BoundaryName); + SMESHHOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; + ASSERT(!CORBA::is_nil(myBoundary)); + int BoundaryType = myBoundary->GetType(); + MESSAGE ( "... BoundaryType = " << BoundaryType ); + // 3.1. Recuperation du nom du groupe + std::string GroupName = std::string((*ListBoundaryGroupType)[NumBoundary+1]); + MESSAGE ( "... GroupName = " << GroupName); + // 3.2. Cas d une frontiere CAO + if ( BoundaryType == -1 ) + { + if ( GroupName.size() > 0 ) { myDriver->TexteBoundaryCAOGr ( GroupName ); } + } + // 3.3. Cas d une frontiere discrete + else if ( BoundaryType == 0 ) + { + if ( GroupName.size() > 0 ) { myDriver->TexteBoundaryDiGr ( GroupName ); } + } + // 3.4. Cas d une frontiere analytique + else + { + NumBoundaryAnalytical++; + myDriver->TexteBoundaryAnGr ( BoundaryName, NumBoundaryAnalytical, GroupName ); + } + } + // 4. Ecriture de l'option finale + myDriver->TexteBoundaryOption(BoundaryOption); +// + return BoundaryOption; +} +//============================================================================= +// Calcul d'une iteration : ecriture des interpolations dans le fichier de configuration +//============================================================================= +void HOMARD_Gen_i::DriverTexteFieldInterp(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 +//=========================================================================== +//===================================================================================== +void HOMARD_Gen_i::PublishResultInSmesh(const char* NomFich, CORBA::Long Option) +// Option = 0 : fichier issu d'une importation +// Option = 1 : fichier issu d'une execution HOMARD +{ + MESSAGE( "PublishResultInSmesh " << NomFich << ", avec Option = " << Option); + if (CORBA::is_nil(SMESH_Gen_i::GetSMESHGen()->getStudyServant())) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid study context"; + throw SALOME::SALOME_Exception(es); + } + + // Le module SMESH est-il actif ? + SALOMEDS::SObject_var aSmeshSO = + SMESH_Gen_i::GetSMESHGen()->getStudyServant()->FindComponent("SMESH"); + // + if (!CORBA::is_nil(aSmeshSO)) { + // On verifie que le fichier n est pas deja publie + SALOMEDS::ChildIterator_var aIter = + SMESH_Gen_i::GetSMESHGen()->getStudyServant()->NewChildIterator(aSmeshSO); + for (; aIter->More(); aIter->Next()) { + SALOMEDS::SObject_var aSO = aIter->Value(); + SALOMEDS::GenericAttribute_var aGAttr; + if (aSO->FindAttribute(aGAttr, "AttributeExternalFileDef")) { + SALOMEDS::AttributeExternalFileDef_var anAttr = + SALOMEDS::AttributeExternalFileDef::_narrow(aGAttr); + CORBA::String_var value = anAttr->Value(); + if (strcmp((const char*)value, NomFich) == 0) { + MESSAGE ( "PublishResultInSmesh : le fichier " << NomFich << " est deja publie." ); + // Pour un fichier importe, on ne republie pas + if ( Option == 0 ) { return; } + // Pour un fichier calcule, on commence par faire la depublication + else { + MESSAGE("PublishResultInSmesh : depublication"); + if (aSO->FindAttribute(aGAttr, "AttributeName")) { + SALOMEDS::AttributeName_var anAttr2 = SALOMEDS::AttributeName::_narrow(aGAttr); + CORBA::String_var value2 = anAttr2->Value(); + std::string MeshName = string(value2); + MESSAGE("PublishResultInSmesh : depublication de " << MeshName); + DeleteResultInSmesh(NomFich, MeshName); + } + } + } + } + } + } + + // On enregistre le fichier + MESSAGE( "Enregistrement du fichier"); + // + //SMESH::SMESH_Gen_var aSmeshEngine = this->retrieveSMESHInst(); + SMESH_Gen_i* aSmeshEngine = SMESH_Gen_i::GetSMESHGen(); + // + //ASSERT(!CORBA::is_nil(aSmeshEngine)); + aSmeshEngine->UpdateStudy(); + SMESH::DriverMED_ReadStatus theStatus; + + // On met a jour les attributs AttributeExternalFileDef et AttributePixMap + SMESH::mesh_array* mesMaillages = aSmeshEngine->CreateMeshesFromMED(NomFich, theStatus); + for (int i = 0; i < mesMaillages->length(); i++) { + MESSAGE(". Mise a jour des attributs du maillage"); + SMESH::SMESH_Mesh_var monMaillage = (*mesMaillages)[i]; + SALOMEDS::SObject_var aSO = SALOMEDS::SObject::_narrow + (SMESH_Gen_i::GetSMESHGen()->getStudyServant()->FindObjectIOR + (SMESH_Gen_i::GetORB()->object_to_string(monMaillage))); + SALOMEDS::StudyBuilder_var aStudyBuilder = + SMESH_Gen_i::GetSMESHGen()->getStudyServant()->NewBuilder(); + SALOMEDS::GenericAttribute_var aGAttr = + aStudyBuilder->FindOrCreateAttribute(aSO, "AttributeExternalFileDef"); + SALOMEDS::AttributeExternalFileDef_var anAttr = + SALOMEDS::AttributeExternalFileDef::_narrow(aGAttr); + anAttr->SetValue(NomFich); + SALOMEDS::GenericAttribute_var aPixMap = + aStudyBuilder->FindOrCreateAttribute(aSO, "AttributePixMap" ); + SALOMEDS::AttributePixMap_var anAttr2 = SALOMEDS::AttributePixMap::_narrow(aPixMap); + const char* icone; + if ( Option == 0 ) { icone = "mesh_tree_importedmesh.png"; } + else { icone = "mesh_tree_mesh.png"; } + anAttr2->SetPixMap( icone ); + } +} +//============================================================================= +void HOMARD_Gen_i::DeleteResultInSmesh(std::string NomFich, std::string MeshName) +{ + MESSAGE ("DeleteResultInSmesh pour le maillage " << MeshName << " dans le fichier " << NomFich ); + if (CORBA::is_nil(SMESH_Gen_i::GetSMESHGen()->getStudyServant())) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid study context"; + throw SALOME::SALOME_Exception(es); + } + + // Le module SMESH est-il actif ? + SALOMEDS::SObject_var aSmeshSO = + SMESH_Gen_i::GetSMESHGen()->getStudyServant()->FindComponent("SMESH"); + // + if (CORBA::is_nil(aSmeshSO)) return; + // On verifie que le fichier est deja publie + SALOMEDS::StudyBuilder_var myBuilder = + SMESH_Gen_i::GetSMESHGen()->getStudyServant()->NewBuilder(); + SALOMEDS::ChildIterator_var aIter = + SMESH_Gen_i::GetSMESHGen()->getStudyServant()->NewChildIterator(aSmeshSO); + for (; aIter->More(); aIter->Next()) { + SALOMEDS::SObject_var aSO = aIter->Value(); + SALOMEDS::GenericAttribute_var aGAttr; + if (aSO->FindAttribute(aGAttr, "AttributeExternalFileDef")) { + SALOMEDS::AttributeExternalFileDef_var anAttr = + SALOMEDS::AttributeExternalFileDef::_narrow(aGAttr); + CORBA::String_var value = anAttr->Value(); + if (strcmp((const char*)value, NomFich.c_str()) == 0) { + if (aSO->FindAttribute(aGAttr, "AttributeName")) { + SALOMEDS::AttributeName_var anAttr2 = SALOMEDS::AttributeName::_narrow(aGAttr); + CORBA::String_var value2 = anAttr2->Value(); + if (strcmp((const char*)value2, MeshName.c_str()) == 0) { + myBuilder->RemoveObjectWithChildren( aSO ); + } + } + } + } + } +} +//============================================================================= +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); + } + +} + +/* +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) + { + 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; + } + } + 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 '"<> 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; } + } + } + } + } + } + + // C. Enregistrements + MESSAGE ("Enregistrement de LanguageShort = " << LanguageShort ); + SetLanguageShort( LanguageShort.c_str() ); + + MESSAGE ("Enregistrement de PublisMeshIN = " << PublisMeshIN<<", PublisMeshOUT = "<< PublisMeshOUT); + SetPublisMesh(PublisMeshIN, PublisMeshOUT); +} +//=============================================================================== +// Langue de SALOME +//=============================================================================== +void HOMARD_Gen_i::SetLanguageShort(const char* LanguageShort) +{ + //MESSAGE ("SetLanguageShort pour LanguageShort = " << LanguageShort ); + _LangueShort = LanguageShort; + if ( _LangueShort == "fr" ) { _Langue = "Francais"; } + else { _Langue = "English"; } +} +char* HOMARD_Gen_i::GetLanguageShort() +{ + //MESSAGE ("GetLanguageShort"); + return CORBA::string_dup( _LangueShort.c_str() ); +} +//=============================================================================== +// Options de publications +//=============================================================================== +void HOMARD_Gen_i::SetPublisMesh(CORBA::Long PublisMeshIN, CORBA::Long PublisMeshOUT) +{ + _PublisMeshIN = PublisMeshIN; + _PublisMeshOUT = PublisMeshOUT; +} +CORBA::Long HOMARD_Gen_i::GetPublisMeshIN() +{ + return _PublisMeshIN; +} +CORBA::Long HOMARD_Gen_i::GetPublisMeshOUT() +{ + return _PublisMeshOUT; +} + +// ======================================================================= +int MEDFileExist( const char * aFile ) +// Retourne 1 si le fichier existe, 0 sinon +// ======================================================================= +{ + int existe; + med_idt medIdt = MEDfileOpen(aFile,MED_ACC_RDONLY); + if ( medIdt < 0 ) { existe = 0; } + else { MEDfileClose(medIdt); + existe = 1; } + return existe; +} +// ======================================================================= +std::set GetListeGroupesInMedFile(const char * aFile) +// ======================================================================= +{ + std::set ListeGroupes; + med_err erreur = 0; + med_idt medIdt; + while ( erreur == 0 ) + { + // Ouverture du fichier + medIdt = MEDfileOpen(aFile,MED_ACC_RDONLY); + if ( medIdt < 0 ) + { + erreur = 1; + break; + } + // Caracteristiques du maillage + char meshname[MED_NAME_SIZE+1]; + med_int spacedim,meshdim; + med_mesh_type meshtype; + char descriptionription[MED_COMMENT_SIZE+1]; + char dtunit[MED_SNAME_SIZE+1]; + med_sorting_type sortingtype; + med_int nstep; + med_axis_type axistype; + int naxis = MEDmeshnAxis(medIdt,1); + char *axisname=new char[naxis*MED_SNAME_SIZE+1]; + char *axisunit=new char[naxis*MED_SNAME_SIZE+1]; + erreur = MEDmeshInfo(medIdt, + 1, + meshname, + &spacedim, + &meshdim, + &meshtype, + descriptionription, + dtunit, + &sortingtype, + &nstep, + &axistype, + axisname, + axisunit); + delete[] axisname; + delete[] axisunit; + if ( erreur < 0 ) { break; } + // Nombre de familles + med_int nfam; + nfam = MEDnFamily(medIdt,meshname); + if ( nfam < 0 ) + { + erreur = 2; + break; + } + // Lecture des caracteristiques des familles + for (int i=0;i 0 ) + { + char familyname[MED_NAME_SIZE+1]; + med_int numfam; + char* gro = (char*) malloc(MED_LNAME_SIZE*ngro+1); + erreur = MEDfamilyInfo(medIdt, + meshname, + i+1, + familyname, + &numfam, + gro); + if ( erreur < 0 ) + { + free(gro); + break; + } + // Lecture des groupes pour une famille de mailles + if ( numfam < 0) + { + for (int j=0;j 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 LesExtremes; + med_err erreur = 0; + med_idt medIdt; + while ( erreur == 0 ) + { + // Ouverture du fichier + medIdt = MEDfileOpen(aFile,MED_ACC_RDONLY); + 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 ) + { + erreur = 2; + break; + } + // Caracteristiques du maillage + char meshname[MED_NAME_SIZE+1]; + med_int spacedim,meshdim; + med_mesh_type meshtype; + char descriptionription[MED_COMMENT_SIZE+1]; + char dtunit[MED_SNAME_SIZE+1]; + med_sorting_type sortingtype; + med_int nstep; + med_axis_type axistype; + int naxis = MEDmeshnAxis(medIdt,1); + char *axisname=new char[naxis*MED_SNAME_SIZE+1]; + char *axisunit=new char[naxis*MED_SNAME_SIZE+1]; + erreur = MEDmeshInfo(medIdt, + 1, + meshname, + &spacedim, + &meshdim, + &meshtype, + descriptionription, + dtunit, + &sortingtype, + &nstep, + &axistype, + axisname, + axisunit); + delete[] axisname; + delete[] axisunit; + if ( erreur < 0 ) { break; } + + // Nombre de noeuds + med_bool chgt,trsf; + med_int nnoe = MEDmeshnEntity(medIdt, + meshname, + MED_NO_DT, + MED_NO_IT, + MED_NODE, + MED_NO_GEOTYPE, + MED_COORDINATE, + MED_NO_CMODE, + &chgt, + &trsf); + if ( nnoe < 0 ) + { + erreur = 4; + break; + } + + // Les coordonnees + med_float* coo = (med_float*) malloc(sizeof(med_float)*nnoe*spacedim); + + erreur = MEDmeshNodeCoordinateRd(medIdt, + meshname, + MED_NO_DT, + MED_NO_IT, + MED_NO_INTERLACE, + coo); + if ( erreur < 0 ) + { + free(coo); + break; + } + + // 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]); + } + } + 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]); + } + } + else + { + zmin=0; + zmax=0; + } + + 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); + LesExtremes.push_back(0); + LesExtremes.push_back(ymin); + LesExtremes.push_back(ymax); + LesExtremes.push_back(0); + LesExtremes.push_back(zmin); + 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 diff = LesExtremes[1] - LesExtremes[0]; + 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.; } + + diff = LesExtremes[7] - LesExtremes[6]; + 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 ( "_______________________________________" ); + + free(coo); + break; + } + // Fermeture du fichier + if ( medIdt > 0 ) MEDfileClose(medIdt); + + return LesExtremes; +} + +}; // namespace SMESHHOMARD_I diff --git a/src/SMESH_I/SMESH_Homard_i.hxx b/src/SMESH_I/SMESH_Homard_i.hxx new file mode 100644 index 000000000..1a45e1878 --- /dev/null +++ b/src/SMESH_I/SMESH_Homard_i.hxx @@ -0,0 +1,547 @@ +// Copyright (C) 2011-2021 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// 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_ + +#include +#include CORBA_SERVER_HEADER(SMESH_Homard) +#include CORBA_CLIENT_HEADER(SALOMEDS) +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog) +#include CORBA_CLIENT_HEADER(SMESH_Gen) + +#include "SMESH.hxx" +#include "SMESH_Homard.hxx" +//#include "FrontTrack.hxx" +#include "SALOME_Component_i.hxx" +#include "SALOME_NamingService.hxx" +#include "Utils_CorbaException.hxx" + +#include +#include +#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 +{ +public: + HOMARD_Boundary_i( CORBA::ORB_ptr orb, SMESHHOMARD::HOMARD_Gen_var gen_i ); + HOMARD_Boundary_i(); + + virtual ~HOMARD_Boundary_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 SetType( CORBA::Long Type ); + CORBA::Long GetType(); + + void SetMeshName( const char* MeshName ); + char* GetMeshName(); + + void SetDataFile( const char* DataFile ); + char* GetDataFile(); + + 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 Xcentre2, double Ycentre2, double Zcentre2, double Rayon2); + void SetConeA( double Xaxe, double Yaxe, double Zaxe, double Angle, + double Xcentre, double Ycentre, double ZCentre); + void SetTorus( double Xcentre, double Ycentre, double ZCentre, + double Xaxe, double Yaxe, double Zaxe, + double rayonRev, double rayonPri ); + + SMESHHOMARD::double_array* GetCoords(); + + void SetLimit( double Xincr, double Yincr, double Zincr); + SMESHHOMARD::double_array* GetLimit(); + + 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(); + + +private: + SMESHHOMARDImpl::HOMARD_Boundary* myHomardBoundary; + + CORBA::ORB_ptr _orb; + 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 +{ +public: + HOMARD_Cas_i( CORBA::ORB_ptr orb, 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 ); + + // Caracteristiques + void SetDirName( const char* NomDir ); + char* GetDirName(); + + CORBA::Long GetState(); + + CORBA::Long GetNumberofIter(); + + 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 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); + +// 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 ); + +private: + SMESHHOMARDImpl::HOMARD_Cas* myHomardCas; + + CORBA::ORB_ptr _orb; + 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 +{ +public: + HOMARD_Hypothesis_i( CORBA::ORB_ptr orb, 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(); + + void LinkIteration( const char* NomIteration ); + void UnLinkIteration( const char* NomIteration ); + SMESHHOMARD::listeIters* GetIterations(); + +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 +{ +public: + HOMARD_Iteration_i( CORBA::ORB_ptr orb, + SMESHHOMARD::HOMARD_Gen_var gen_i ); + HOMARD_Iteration_i(); + + virtual ~HOMARD_Iteration_i(); + +// 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 ); + char* GetDirNameLoc(); + + char* GetDirName(); + + void SetNumber( CORBA::Long NumIter ); + CORBA::Long GetNumber(); + + void SetState( CORBA::Long etat ); + CORBA::Long GetState(); + + void SetMeshName( const char* NomMesh ); + char* GetMeshName(); + + 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 ); + 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 ); + 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 SetIterParentName( const char* NomIterParent ); + char* GetIterParentName(); + SMESHHOMARD::HOMARD_Iteration_ptr GetIterParent(); + +// Liens avec les autres structures + void SetCaseName( const char* NomCas ); + char* GetCaseName(); + + void AssociateHypo( const char* NomHypo); + void SetHypoName( const char* NomHypo ); + char* GetHypoName(); + +// Divers + void SetInfoCompute( CORBA::Long MessInfo ); + CORBA::Long GetInfoCompute(); + +private: + SMESHHOMARDImpl::HOMARD_Iteration* myHomardIteration; + + CORBA::ORB_ptr _orb; + 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: + 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 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); + 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); + 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); + char* ComputeDirManagement(SMESHHOMARD::HOMARD_Cas_var myCase, + SMESHHOMARD::HOMARD_Iteration_var myIteration, + CORBA::Long etatMenage); + 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 PublishMeshIterInSmesh(const char* NomIter); + + // 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(); + + std::string GetStringInTexte( const std::string Texte, const std::string String, int option ); + +private: + struct StudyContext + { + std::map _mesBoundarys; + std::map _mesCas; + std::map _mesHypotheses; + std::map _mesIterations; + }; + + SMESHHOMARDImpl::HOMARD_Gen* myHomard; + StudyContext myStudyContext; + + // Preferences + std::string _Langue; + std::string _LangueShort; + int _PublisMeshIN; + int _PublisMeshOUT; +}; + +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); + +}; // namespace SMESHHOMARD_I + +#endif