From a174b69248f13abe64bb0939dfec3fc55ae78aec Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=A9rald=20NICOLAS?= Date: Wed, 20 May 2020 17:28:22 +0200 Subject: [PATCH] Transfert brutal des sources du module HOMARD --- CMakeLists.txt | 10 + src/ADAPT/CMakeLists.txt | 75 + src/ADAPT/HOMARD.hxx | 53 + src/ADAPT/HOMARD_Boundary.cxx | 324 ++ src/ADAPT/HOMARD_Boundary.hxx | 111 + src/ADAPT/HOMARD_Cas.cxx | 283 ++ src/ADAPT/HOMARD_Cas.hxx | 112 + src/ADAPT/HOMARD_DriverTools.cxx | 840 ++++ src/ADAPT/HOMARD_DriverTools.hxx | 76 + src/ADAPT/HOMARD_Gen.cxx | 41 + src/ADAPT/HOMARD_Gen.hxx | 37 + src/ADAPT/HOMARD_Hypothesis.cxx | 524 +++ src/ADAPT/HOMARD_Hypothesis.hxx | 157 + src/ADAPT/HOMARD_Iteration.cxx | 394 ++ src/ADAPT/HOMARD_Iteration.hxx | 139 + src/ADAPT/HOMARD_YACS.cxx | 219 + src/ADAPT/HOMARD_YACS.hxx | 103 + src/ADAPT/HOMARD_Zone.cxx | 325 ++ src/ADAPT/HOMARD_Zone.hxx | 95 + src/ADAPT/HomardDriver.cxx | 1106 +++++ src/ADAPT/HomardDriver.hxx | 85 + src/ADAPT/YACSDriver.cxx | 684 +++ src/ADAPT/YACSDriver.hxx | 68 + src/ADAPTGUI/ADAPT_msg_en.ts | 459 ++ src/ADAPTGUI/ADAPT_msg_fr.ts | 1171 +++++ src/ADAPTGUI/ADAPT_msg_ja.ts | 1148 +++++ src/ADAPTGUI/CMakeLists.txt | 177 + src/ADAPTGUI/CreateBoundaryAn.ui | 1107 +++++ src/ADAPTGUI/CreateBoundaryCAO.ui | 133 + src/ADAPTGUI/CreateBoundaryDi.ui | 133 + src/ADAPTGUI/CreateCase.ui | 777 ++++ src/ADAPTGUI/CreateHypothesis.ui | 1111 +++++ src/ADAPTGUI/CreateIteration.ui | 600 +++ src/ADAPTGUI/CreateListGroup.ui | 121 + src/ADAPTGUI/CreateYACS.ui | 526 +++ src/ADAPTGUI/CreateZone.ui | 1139 +++++ src/ADAPTGUI/EditFile.ui | 115 + src/ADAPTGUI/HOMARDGUI.cxx | 909 ++++ src/ADAPTGUI/HOMARDGUI.h | 105 + src/ADAPTGUI/HOMARDGUI_Exports.hxx | 35 + src/ADAPTGUI/HOMARDGUI_Utils.cxx | 278 ++ src/ADAPTGUI/HOMARDGUI_Utils.h | 90 + src/ADAPTGUI/HomardQtCommun.cxx | 453 ++ src/ADAPTGUI/HomardQtCommun.h | 58 + src/ADAPTGUI/IterInfo.ui | 129 + src/ADAPTGUI/MeshInfo.ui | 285 ++ src/ADAPTGUI/MonCreateBoundaryAn.cxx | 809 ++++ src/ADAPTGUI/MonCreateBoundaryAn.h | 96 + src/ADAPTGUI/MonCreateBoundaryCAO.cxx | 202 + src/ADAPTGUI/MonCreateBoundaryCAO.h | 73 + src/ADAPTGUI/MonCreateBoundaryDi.cxx | 211 + src/ADAPTGUI/MonCreateBoundaryDi.h | 73 + src/ADAPTGUI/MonCreateCase.cxx | 694 +++ src/ADAPTGUI/MonCreateCase.h | 102 + src/ADAPTGUI/MonCreateHypothesis.cxx | 945 +++++ src/ADAPTGUI/MonCreateHypothesis.h | 138 + src/ADAPTGUI/MonCreateIteration.cxx | 339 ++ src/ADAPTGUI/MonCreateIteration.h | 78 + src/ADAPTGUI/MonCreateListGroup.cxx | 153 + src/ADAPTGUI/MonCreateListGroup.h | 64 + src/ADAPTGUI/MonCreateListGroupCAO.cxx | 150 + src/ADAPTGUI/MonCreateListGroupCAO.h | 64 + src/ADAPTGUI/MonCreateYACS.cxx | 342 ++ src/ADAPTGUI/MonCreateYACS.h | 84 + src/ADAPTGUI/MonCreateZone.cxx | 713 ++++ src/ADAPTGUI/MonCreateZone.h | 87 + src/ADAPTGUI/MonEditBoundaryAn.cxx | 399 ++ src/ADAPTGUI/MonEditBoundaryAn.h | 61 + src/ADAPTGUI/MonEditBoundaryCAO.cxx | 105 + src/ADAPTGUI/MonEditBoundaryCAO.h | 51 + src/ADAPTGUI/MonEditBoundaryDi.cxx | 105 + src/ADAPTGUI/MonEditBoundaryDi.h | 51 + src/ADAPTGUI/MonEditCase.cxx | 269 ++ src/ADAPTGUI/MonEditCase.h | 50 + src/ADAPTGUI/MonEditFile.cxx | 119 + src/ADAPTGUI/MonEditFile.h | 64 + src/ADAPTGUI/MonEditHypothesis.cxx | 463 ++ src/ADAPTGUI/MonEditHypothesis.h | 56 + src/ADAPTGUI/MonEditIteration.cxx | 186 + src/ADAPTGUI/MonEditIteration.h | 57 + src/ADAPTGUI/MonEditListGroup.cxx | 61 + src/ADAPTGUI/MonEditListGroup.h | 49 + src/ADAPTGUI/MonEditListGroupCAO.cxx | 61 + src/ADAPTGUI/MonEditListGroupCAO.h | 49 + src/ADAPTGUI/MonEditYACS.cxx | 148 + src/ADAPTGUI/MonEditYACS.h | 50 + src/ADAPTGUI/MonEditZone.cxx | 432 ++ src/ADAPTGUI/MonEditZone.h | 59 + src/ADAPTGUI/MonIterInfo.cxx | 175 + src/ADAPTGUI/MonIterInfo.h | 78 + src/ADAPTGUI/MonMeshInfo.cxx | 281 ++ src/ADAPTGUI/MonMeshInfo.h | 76 + src/ADAPTGUI/MonPursueIteration.cxx | 288 ++ src/ADAPTGUI/MonPursueIteration.h | 72 + src/ADAPTGUI/PursueIteration.ui | 252 ++ src/ADAPT_I/CMakeLists.txt | 93 + src/ADAPT_I/HOMARD_Boundary_i.cxx | 262 ++ src/ADAPT_I/HOMARD_Boundary_i.hxx | 112 + src/ADAPT_I/HOMARD_Cas_i.cxx | 599 +++ src/ADAPT_I/HOMARD_Cas_i.hxx | 119 + src/ADAPT_I/HOMARD_Gen_i.cxx | 5432 ++++++++++++++++++++++++ src/ADAPT_I/HOMARD_Gen_i.hxx | 347 ++ src/ADAPT_I/HOMARD_Hypothesis_i.cxx | 506 +++ src/ADAPT_I/HOMARD_Hypothesis_i.hxx | 138 + src/ADAPT_I/HOMARD_Iteration_i.cxx | 465 ++ src/ADAPT_I/HOMARD_Iteration_i.hxx | 145 + src/ADAPT_I/HOMARD_YACS_i.cxx | 279 ++ src/ADAPT_I/HOMARD_YACS_i.hxx | 112 + src/ADAPT_I/HOMARD_Zone_i.cxx | 218 + src/ADAPT_I/HOMARD_Zone_i.hxx | 104 + src/ADAPT_I/HOMARD_i.hxx | 35 + src/ADAPT_I/HomardMedCommun.cxx | 335 ++ src/ADAPT_I/HomardMedCommun.h | 32 + src/CMakeLists.txt | 3 + 114 files changed, 35840 insertions(+) create mode 100644 src/ADAPT/CMakeLists.txt create mode 100644 src/ADAPT/HOMARD.hxx create mode 100644 src/ADAPT/HOMARD_Boundary.cxx create mode 100644 src/ADAPT/HOMARD_Boundary.hxx create mode 100644 src/ADAPT/HOMARD_Cas.cxx create mode 100644 src/ADAPT/HOMARD_Cas.hxx create mode 100644 src/ADAPT/HOMARD_DriverTools.cxx create mode 100644 src/ADAPT/HOMARD_DriverTools.hxx create mode 100644 src/ADAPT/HOMARD_Gen.cxx create mode 100644 src/ADAPT/HOMARD_Gen.hxx create mode 100644 src/ADAPT/HOMARD_Hypothesis.cxx create mode 100644 src/ADAPT/HOMARD_Hypothesis.hxx create mode 100644 src/ADAPT/HOMARD_Iteration.cxx create mode 100644 src/ADAPT/HOMARD_Iteration.hxx create mode 100644 src/ADAPT/HOMARD_YACS.cxx create mode 100644 src/ADAPT/HOMARD_YACS.hxx create mode 100644 src/ADAPT/HOMARD_Zone.cxx create mode 100644 src/ADAPT/HOMARD_Zone.hxx create mode 100644 src/ADAPT/HomardDriver.cxx create mode 100644 src/ADAPT/HomardDriver.hxx create mode 100644 src/ADAPT/YACSDriver.cxx create mode 100644 src/ADAPT/YACSDriver.hxx create mode 100644 src/ADAPTGUI/ADAPT_msg_en.ts create mode 100644 src/ADAPTGUI/ADAPT_msg_fr.ts create mode 100644 src/ADAPTGUI/ADAPT_msg_ja.ts create mode 100644 src/ADAPTGUI/CMakeLists.txt create mode 100644 src/ADAPTGUI/CreateBoundaryAn.ui create mode 100644 src/ADAPTGUI/CreateBoundaryCAO.ui create mode 100644 src/ADAPTGUI/CreateBoundaryDi.ui create mode 100644 src/ADAPTGUI/CreateCase.ui create mode 100644 src/ADAPTGUI/CreateHypothesis.ui create mode 100644 src/ADAPTGUI/CreateIteration.ui create mode 100644 src/ADAPTGUI/CreateListGroup.ui create mode 100644 src/ADAPTGUI/CreateYACS.ui create mode 100644 src/ADAPTGUI/CreateZone.ui create mode 100644 src/ADAPTGUI/EditFile.ui create mode 100644 src/ADAPTGUI/HOMARDGUI.cxx create mode 100644 src/ADAPTGUI/HOMARDGUI.h create mode 100644 src/ADAPTGUI/HOMARDGUI_Exports.hxx create mode 100644 src/ADAPTGUI/HOMARDGUI_Utils.cxx create mode 100644 src/ADAPTGUI/HOMARDGUI_Utils.h create mode 100644 src/ADAPTGUI/HomardQtCommun.cxx create mode 100644 src/ADAPTGUI/HomardQtCommun.h create mode 100644 src/ADAPTGUI/IterInfo.ui create mode 100644 src/ADAPTGUI/MeshInfo.ui create mode 100644 src/ADAPTGUI/MonCreateBoundaryAn.cxx create mode 100644 src/ADAPTGUI/MonCreateBoundaryAn.h create mode 100644 src/ADAPTGUI/MonCreateBoundaryCAO.cxx create mode 100644 src/ADAPTGUI/MonCreateBoundaryCAO.h create mode 100644 src/ADAPTGUI/MonCreateBoundaryDi.cxx create mode 100644 src/ADAPTGUI/MonCreateBoundaryDi.h create mode 100644 src/ADAPTGUI/MonCreateCase.cxx create mode 100644 src/ADAPTGUI/MonCreateCase.h create mode 100644 src/ADAPTGUI/MonCreateHypothesis.cxx create mode 100644 src/ADAPTGUI/MonCreateHypothesis.h create mode 100644 src/ADAPTGUI/MonCreateIteration.cxx create mode 100644 src/ADAPTGUI/MonCreateIteration.h create mode 100644 src/ADAPTGUI/MonCreateListGroup.cxx create mode 100644 src/ADAPTGUI/MonCreateListGroup.h create mode 100644 src/ADAPTGUI/MonCreateListGroupCAO.cxx create mode 100644 src/ADAPTGUI/MonCreateListGroupCAO.h create mode 100644 src/ADAPTGUI/MonCreateYACS.cxx create mode 100644 src/ADAPTGUI/MonCreateYACS.h create mode 100644 src/ADAPTGUI/MonCreateZone.cxx create mode 100644 src/ADAPTGUI/MonCreateZone.h create mode 100644 src/ADAPTGUI/MonEditBoundaryAn.cxx create mode 100644 src/ADAPTGUI/MonEditBoundaryAn.h create mode 100644 src/ADAPTGUI/MonEditBoundaryCAO.cxx create mode 100644 src/ADAPTGUI/MonEditBoundaryCAO.h create mode 100644 src/ADAPTGUI/MonEditBoundaryDi.cxx create mode 100644 src/ADAPTGUI/MonEditBoundaryDi.h create mode 100644 src/ADAPTGUI/MonEditCase.cxx create mode 100644 src/ADAPTGUI/MonEditCase.h create mode 100644 src/ADAPTGUI/MonEditFile.cxx create mode 100644 src/ADAPTGUI/MonEditFile.h create mode 100644 src/ADAPTGUI/MonEditHypothesis.cxx create mode 100644 src/ADAPTGUI/MonEditHypothesis.h create mode 100644 src/ADAPTGUI/MonEditIteration.cxx create mode 100644 src/ADAPTGUI/MonEditIteration.h create mode 100644 src/ADAPTGUI/MonEditListGroup.cxx create mode 100644 src/ADAPTGUI/MonEditListGroup.h create mode 100644 src/ADAPTGUI/MonEditListGroupCAO.cxx create mode 100644 src/ADAPTGUI/MonEditListGroupCAO.h create mode 100644 src/ADAPTGUI/MonEditYACS.cxx create mode 100644 src/ADAPTGUI/MonEditYACS.h create mode 100644 src/ADAPTGUI/MonEditZone.cxx create mode 100644 src/ADAPTGUI/MonEditZone.h create mode 100644 src/ADAPTGUI/MonIterInfo.cxx create mode 100644 src/ADAPTGUI/MonIterInfo.h create mode 100644 src/ADAPTGUI/MonMeshInfo.cxx create mode 100644 src/ADAPTGUI/MonMeshInfo.h create mode 100644 src/ADAPTGUI/MonPursueIteration.cxx create mode 100644 src/ADAPTGUI/MonPursueIteration.h create mode 100644 src/ADAPTGUI/PursueIteration.ui create mode 100644 src/ADAPT_I/CMakeLists.txt create mode 100644 src/ADAPT_I/HOMARD_Boundary_i.cxx create mode 100644 src/ADAPT_I/HOMARD_Boundary_i.hxx create mode 100644 src/ADAPT_I/HOMARD_Cas_i.cxx create mode 100644 src/ADAPT_I/HOMARD_Cas_i.hxx create mode 100644 src/ADAPT_I/HOMARD_Gen_i.cxx create mode 100644 src/ADAPT_I/HOMARD_Gen_i.hxx create mode 100644 src/ADAPT_I/HOMARD_Hypothesis_i.cxx create mode 100644 src/ADAPT_I/HOMARD_Hypothesis_i.hxx create mode 100644 src/ADAPT_I/HOMARD_Iteration_i.cxx create mode 100644 src/ADAPT_I/HOMARD_Iteration_i.hxx create mode 100644 src/ADAPT_I/HOMARD_YACS_i.cxx create mode 100644 src/ADAPT_I/HOMARD_YACS_i.hxx create mode 100644 src/ADAPT_I/HOMARD_Zone_i.cxx create mode 100644 src/ADAPT_I/HOMARD_Zone_i.hxx create mode 100644 src/ADAPT_I/HOMARD_i.hxx create mode 100644 src/ADAPT_I/HomardMedCommun.cxx create mode 100644 src/ADAPT_I/HomardMedCommun.h diff --git a/CMakeLists.txt b/CMakeLists.txt index e2434f379..f41109eb9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -276,6 +276,16 @@ MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED) MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC) MARK_AS_ADVANCED(SALOME_SMESH_INSTALL_RES_DATA SALOME_SMESH_INSTALL_PLUGINS) +# Specific to ADAPT: +# SET(SALOME_ADAPT_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/adapt" CACHE PATH +# "Install path: SALOME ADAPT specific data") +SET(SALOME_ADAPT_INSTALL_SAMPLES share/salome/adaptsamples CACHE PATH + "Install path: SALOME ADAPT samples") +SET(SALOME_ADAPT_INSTALL_TEST ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test CACHE PATH + "Install path: SALOME ADAPT Test files") +SET(SALOME_ADAPT_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/adapt" CACHE PATH + "Install path: SALOME ADAPT specific data") + # Accumulate environment variables for SMESH module SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS} ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON} diff --git a/src/ADAPT/CMakeLists.txt b/src/ADAPT/CMakeLists.txt new file mode 100644 index 000000000..bc90a1aa0 --- /dev/null +++ b/src/ADAPT/CMakeLists.txt @@ -0,0 +1,75 @@ +# Copyright (C) 2012-2020 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# --- options --- +# additional include directories +INCLUDE_DIRECTORIES( + ${KERNEL_INCLUDE_DIRS} +) + +# additional preprocessor / compiler flags +ADD_DEFINITIONS( + ${KERNEL_DEFINITIONS} +) + +# libraries to link to +SET(_link_LIBRARIES + ${KERNEL_SALOMELocalTrace} +) + +# --- headers --- + +# header files +SET(ADAPTImpl_HEADERS + HOMARD.hxx + HOMARD_Cas.hxx + HOMARD_Boundary.hxx + HOMARD_Hypothesis.hxx + HOMARD_Iteration.hxx + HOMARD_Zone.hxx + HOMARD_Gen.hxx + HOMARD_DriverTools.hxx + HOMARD_YACS.hxx + HomardDriver.hxx + YACSDriver.hxx +) + +# --- sources --- + +# sources / static +SET(ADAPTImpl_SOURCES + HOMARD_Cas.cxx + HOMARD_Boundary.cxx + HOMARD_Hypothesis.cxx + HOMARD_Iteration.cxx + HOMARD_Zone.cxx + HOMARD_Gen.cxx + HOMARD_DriverTools.cxx + HOMARD_YACS.cxx + HomardDriver.cxx + YACSDriver.cxx +) + +# --- rules --- + +ADD_LIBRARY(ADAPTImpl ${ADAPTImpl_SOURCES}) +TARGET_LINK_LIBRARIES(ADAPTImpl ${_link_LIBRARIES} ) +INSTALL(TARGETS ADAPTImpl EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) + +INSTALL(FILES ${ADAPTImpl_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) diff --git a/src/ADAPT/HOMARD.hxx b/src/ADAPT/HOMARD.hxx new file mode 100644 index 000000000..012f212b4 --- /dev/null +++ b/src/ADAPT/HOMARD.hxx @@ -0,0 +1,53 @@ +// HOMARD HOMARD : implementation of HOMARD idl descriptions +// +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : HOMARD.hxx +// Author : Gerald NICOLAS, EDF +// Module : HOMARD + +#ifndef _HOMARD_HXX_ +#define _HOMARD_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 + +#endif diff --git a/src/ADAPT/HOMARD_Boundary.cxx b/src/ADAPT/HOMARD_Boundary.cxx new file mode 100644 index 000000000..0115278db --- /dev/null +++ b/src/ADAPT/HOMARD_Boundary.cxx @@ -0,0 +1,324 @@ +// HOMARD HOMARD : implementation of HOMARD idl descriptions +// +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : HOMARD_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 "HOMARD_Boundary.hxx" +#include "HOMARD.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * 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; +} +//============================================================================= diff --git a/src/ADAPT/HOMARD_Boundary.hxx b/src/ADAPT/HOMARD_Boundary.hxx new file mode 100644 index 000000000..ddbffae6b --- /dev/null +++ b/src/ADAPT/HOMARD_Boundary.hxx @@ -0,0 +1,111 @@ +// HOMARD HOMARD : implementation of HOMARD idl descriptions +// +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : HOMARD_Boundary.hxx +// 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 + +#ifndef _HOMARD_Boundary_HXX_ +#define _HOMARD_Boundary_HXX_ + +#include "HOMARD.hxx" + +#include +#include +#include + +#if defined WIN32 +#pragma warning ( disable: 4251 ) +#endif + +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; + +}; + + +#endif diff --git a/src/ADAPT/HOMARD_Cas.cxx b/src/ADAPT/HOMARD_Cas.cxx new file mode 100644 index 000000000..1493c8ff1 --- /dev/null +++ b/src/ADAPT/HOMARD_Cas.cxx @@ -0,0 +1,283 @@ +// HOMARD HOMARD : implementation of HOMARD idl descriptions +// +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : HOMARD_Cas.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 "HOMARD_Cas.hxx" +#include "utilities.h" +#include "HOMARD.hxx" +#include +#include + +#ifndef WIN32 +#include +#else +#include +#endif + +//============================================================================= +/*! + * 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(); +} + + diff --git a/src/ADAPT/HOMARD_Cas.hxx b/src/ADAPT/HOMARD_Cas.hxx new file mode 100644 index 000000000..71127136e --- /dev/null +++ b/src/ADAPT/HOMARD_Cas.hxx @@ -0,0 +1,112 @@ +// HOMARD HOMARD : implementation of HOMARD idl descriptions +// +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : HOMARD_Cas.hxx +// 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 + +#ifndef _HOMARD_CAS_HXX_ +#define _HOMARD_CAS_HXX_ + +#include "HOMARD.hxx" + +#include +#include +#include + +#if defined WIN32 +#pragma warning ( disable: 4251 ) +#endif + +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; +}; + +#endif diff --git a/src/ADAPT/HOMARD_DriverTools.cxx b/src/ADAPT/HOMARD_DriverTools.cxx new file mode 100644 index 000000000..df7c5e6b2 --- /dev/null +++ b/src/ADAPT/HOMARD_DriverTools.cxx @@ -0,0 +1,840 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : HOMARD_DriverTools.cxx +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) +// +// ---------------------------------------------------------------------------- + +#include "HOMARD_DriverTools.hxx" +#include "HOMARD_Boundary.hxx" +#include "HOMARD_Cas.hxx" +#include "HOMARD_Hypothesis.hxx" +#include "HOMARD_Iteration.hxx" +#include "HOMARD_Zone.hxx" +#include "HOMARD_YACS.hxx" +#include +#include +#include "utilities.h" + +namespace HOMARD +{ + + 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; + case YACS: signature = "YACS"; 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 "< coords = zone.GetCoords(); + for ( int i = 0; i < coords.size(); i++ ) + os << separator() << ( i < coords.size() ? coords[i] : 0. ); + + std::vector limit = zone.GetLimit(); + for ( int i = 0; i < 3; i++ ) + os << separator() << ( i < limit.size() ? limit[i] : 0. ); + + std::list hypos = zone.GetHypo(); + os << separator() << hypos.size(); + std::list::const_iterator it; + for ( it = hypos.begin(); it != hypos.end(); ++it ) + os << separator() << *it; + + 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.4. Zone +// ========= + /*! + \brief Restore zone from the string + \param zone zone being restored + \param stream string representation of the zone + \return \c true if zone is correctly restored or \c false otherwise + */ + bool Restore( HOMARD_Zone& zone, const std::string& stream ) + { + std::string::size_type start = 0; + std::string chunk; + bool ok; + // + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + zone.SetName( chunk.c_str() ); + // + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + int ZoneType = atoi( chunk.c_str() ) ; + zone.SetType( ZoneType ); + // Les coordonnees des zones : le nombre depend du type + std::vector coords; + int lgcoords ; + if ( ZoneType == 2 || ( ZoneType >= 11 && ZoneType <= 13 ) ) { lgcoords = 6 ; } + else if ( ZoneType == 4 ) { lgcoords = 4 ; } + else if ( ZoneType == 5 || ( ZoneType >= 31 && ZoneType <= 33 ) ) { lgcoords = 8 ; } + else if ( ZoneType == 7 || ( ZoneType >= 61 && ZoneType <= 63 ) ) { lgcoords = 9 ; } + else return false; + 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 ( ZoneType == 2 || ( ZoneType >= 11 && ZoneType <= 13 ) ) + { zone.SetBox( coords[0], coords[1], coords[2], coords[3], coords[4], coords[5] ); } + else if ( ZoneType == 4 ) + { zone.SetSphere( coords[0], coords[1], coords[2], coords[3] ); } + else if ( ZoneType == 5 || ( ZoneType >= 31 && ZoneType <= 33 ) ) + { zone.SetCylinder( coords[0], coords[1], coords[2], coords[3], coords[4], coords[5], coords[6], coords[7] ); } + else if ( ZoneType == 7 || ( ZoneType >= 61 && ZoneType <= 63 ) ) + { zone.SetPipe( coords[0], coords[1], coords[2], coords[3], coords[4], coords[5], coords[6], coords[7], coords[8] ); } + // 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 ); + } + zone.SetLimit( coords[0], coords[1], coords[2]); + + 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; + zone.AddHypo( chunk.c_str() ); + } + 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; + } + +// +// ================================== +// 2.6. Restauration d'un schema YACS +// ================================== + + /*! + \brief Restore a schema YACS from the string + \param yacs yacs being restored + \param stream string representation of the schema yacs + \return \c true if yacs is correctly restored or \c false otherwise + */ + bool Restore( HOMARD_YACS& yacs, const std::string& stream ) + { + std::string::size_type start = 0; + std::string chunk; + bool ok; + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + yacs.SetName( chunk.c_str() ); + + chunk = getNextChunk( stream, start, ok ); + if ( !ok ) return false; + int YACSType = atoi( chunk.c_str() ) ; + yacs.SetType( YACSType ); + + return true; + } + +} // namespace HOMARD /end/ diff --git a/src/ADAPT/HOMARD_DriverTools.hxx b/src/ADAPT/HOMARD_DriverTools.hxx new file mode 100644 index 000000000..887d5f35b --- /dev/null +++ b/src/ADAPT/HOMARD_DriverTools.hxx @@ -0,0 +1,76 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : HOMARD_DriverTools.hxx +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) +// +// ---------------------------------------------------------------------------- + +#ifndef HOMARD_DRIVERTOOLS_H +#define HOMARD_DRIVERTOOLS_H + +#include "HOMARD.hxx" + +#include + +class HOMARD_Boundary; +class HOMARD_Cas; +class HOMARD_Iteration; +class HOMARD_Hypothesis; +class HOMARD_Zone; +class HOMARD_YACS; + +namespace HOMARD +{ + //! persistence entity type + typedef enum { Case, Zone, Hypothesis, Iteration, Boundary, YACS } 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 ::HOMARD_Boundary& boundary ); + //! dump case to the string + HOMARDIMPL_EXPORT std::string Dump( const ::HOMARD_Cas& cas ); + //! dump iteration to the string + HOMARDIMPL_EXPORT std::string Dump( const ::HOMARD_Iteration& iteration ); + //! dump hypothesis to the string + HOMARDIMPL_EXPORT std::string Dump( const ::HOMARD_Hypothesis& hypothesis ); + //! dump zone to the string + HOMARDIMPL_EXPORT std::string Dump( const ::HOMARD_Zone& zone ); + //! dump yacs to the string + HOMARDIMPL_EXPORT std::string Dump( const ::HOMARD_YACS& yacs ); + + //! restore boundary from the string + HOMARDIMPL_EXPORT bool Restore( ::HOMARD_Boundary& boundary, const std::string& stream ); + //! restore case from the string + HOMARDIMPL_EXPORT bool Restore( ::HOMARD_Cas& cas, const std::string& stream ); + //! restore hypothesis from the string + HOMARDIMPL_EXPORT bool Restore( ::HOMARD_Hypothesis& hypothesis, const std::string& stream ); + //! restore iteration from the string + HOMARDIMPL_EXPORT bool Restore( ::HOMARD_Iteration& iteration, const std::string& stream ); + //! restore zone from the string + HOMARDIMPL_EXPORT bool Restore( ::HOMARD_Zone& zone, const std::string& stream ); + //! restore yacs from the string + HOMARDIMPL_EXPORT bool Restore( ::HOMARD_YACS& yacs, const std::string& stream ); +}; + +#endif // HOMARD_DRIVERTOOLS_H diff --git a/src/ADAPT/HOMARD_Gen.cxx b/src/ADAPT/HOMARD_Gen.cxx new file mode 100644 index 000000000..a9059a6ad --- /dev/null +++ b/src/ADAPT/HOMARD_Gen.cxx @@ -0,0 +1,41 @@ +// HOMARD HOMARD : implementation of HOMARD idl descriptions +// +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : HOMARD_Gen.cxx +// Author : Gerald NICOLAS, EDF +// Module : HOMARD + +#include "HOMARD_Gen.hxx" +#include "utilities.h" + +//============================================================================= +//============================================================================= +HOMARD_Gen::HOMARD_Gen() +{ + MESSAGE("HOMARD_Gen"); +} + +//============================================================================= +//============================================================================= +HOMARD_Gen::~HOMARD_Gen() +{ + MESSAGE("~HOMARD_Gen"); +} +//============================================================================= diff --git a/src/ADAPT/HOMARD_Gen.hxx b/src/ADAPT/HOMARD_Gen.hxx new file mode 100644 index 000000000..3ff864a14 --- /dev/null +++ b/src/ADAPT/HOMARD_Gen.hxx @@ -0,0 +1,37 @@ +// HOMARD HOMARD : implementation of HOMARD idl descriptions +// +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : HOMARD_Gen.hxx +// Author : Gerald NICOLAS, EDF +// Module : HOMARD + +#ifndef _HOMARD_GEN_HXX_ +#define _HOMARD_GEN_HXX_ + +#include "HOMARD.hxx" + +class HOMARDIMPL_EXPORT HOMARD_Gen +{ +public : + HOMARD_Gen(); + ~HOMARD_Gen(); +}; + +#endif diff --git a/src/ADAPT/HOMARD_Hypothesis.cxx b/src/ADAPT/HOMARD_Hypothesis.cxx new file mode 100644 index 000000000..a957b57ba --- /dev/null +++ b/src/ADAPT/HOMARD_Hypothesis.cxx @@ -0,0 +1,524 @@ +// HOMARD HOMARD : implementation of HOMARD idl descriptions +// +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : HOMARD_Hypothesis.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 "HOMARD_Hypothesis.hxx" +#include "HOMARD.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * default constructor: + */ +//============================================================================= +HOMARD_Hypothesis::HOMARD_Hypothesis(): + _Name(""), _NomCasCreation(""), + _TypeAdap(-1), _TypeRaff(0), _TypeDera(0), + _Field(""), + _TypeThR(0), _ThreshR(0), + _TypeThC(0), _ThreshC(0), + _UsField(0), _UsCmpI(0), _TypeFieldInterp(0) +{ + MESSAGE("HOMARD_Hypothesis"); +} + +//============================================================================= +/*! + */ +//============================================================================= +HOMARD_Hypothesis::~HOMARD_Hypothesis() +{ + MESSAGE("~HOMARD_Hypothesis"); +} +//============================================================================= +//============================================================================= +// Generalites +//============================================================================= +//============================================================================= +void HOMARD_Hypothesis::SetName( const char* Name ) +{ + _Name = std::string( Name ); +} +//============================================================================= +std::string HOMARD_Hypothesis::GetName() const +{ + return _Name; +} +//============================================================================= +std::string HOMARD_Hypothesis::GetDumpPython() const +{ + std::ostringstream aScript; + aScript << "\n# Creation of the hypothesis " << _Name << "\n" ; + aScript << "\t" << _Name << " = homard.CreateHypothesis(\"" << _Name << "\")\n"; + if ( _TypeAdap == -1 ) + { + int TypeRaffDera ; + if ( _TypeRaff == 1 ) { TypeRaffDera = 1 ; } + else { TypeRaffDera = -1 ; } + aScript << "\t" << _Name << ".SetUnifRefinUnRef(" << TypeRaffDera << ")\n"; + } + +// Raffinement selon des zones geometriques + std::list::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; +} diff --git a/src/ADAPT/HOMARD_Hypothesis.hxx b/src/ADAPT/HOMARD_Hypothesis.hxx new file mode 100644 index 000000000..8dd0492ab --- /dev/null +++ b/src/ADAPT/HOMARD_Hypothesis.hxx @@ -0,0 +1,157 @@ +// HOMARD HOMARD : implementation of HOMARD idl descriptions +// +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : HOMARD_Hypothesis.hxx +// 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 + +#ifndef _HOMARD_HYPOTHESIS_HXX_ +#define _HOMARD_HYPOTHESIS_HXX_ + +#include "HOMARD.hxx" + +#include +#include + +#if defined WIN32 +#pragma warning ( disable: 4251 ) +#endif + +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; + +}; + +#endif diff --git a/src/ADAPT/HOMARD_Iteration.cxx b/src/ADAPT/HOMARD_Iteration.cxx new file mode 100644 index 000000000..713a6b066 --- /dev/null +++ b/src/ADAPT/HOMARD_Iteration.cxx @@ -0,0 +1,394 @@ +// HOMARD HOMARD : implementation of HOMARD idl descriptions +// +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : HOMARD_Iteration.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 "HOMARD_Iteration.hxx" +#include "HOMARD.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * 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; +} diff --git a/src/ADAPT/HOMARD_Iteration.hxx b/src/ADAPT/HOMARD_Iteration.hxx new file mode 100644 index 000000000..cb0e3c72d --- /dev/null +++ b/src/ADAPT/HOMARD_Iteration.hxx @@ -0,0 +1,139 @@ +// HOMARD HOMARD : implementation of HOMARD idl descriptions +// +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : HOMARD_Iteration.hxx +// 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 + +#ifndef _HOMARD_ITER_HXX_ +#define _HOMARD_ITER_HXX_ + +#include "HOMARD.hxx" + +#include +#include + +#if defined WIN32 +#pragma warning ( disable: 4251 ) +#endif + +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; +}; + +#endif diff --git a/src/ADAPT/HOMARD_YACS.cxx b/src/ADAPT/HOMARD_YACS.cxx new file mode 100644 index 000000000..69c2a8189 --- /dev/null +++ b/src/ADAPT/HOMARD_YACS.cxx @@ -0,0 +1,219 @@ +// HOMARD HOMARD : implementation of HOMARD idl descriptions +// +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : HOMARD_YACS.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 "HOMARD_YACS.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * default constructor: + */ +//============================================================================= +HOMARD_YACS::HOMARD_YACS(): + _Name( "" ), + _NomCas( "" ), + _NomDir( "" ), + _MeshFile( "" ), + _ScriptFile( "" ) +{ + MESSAGE("HOMARD_YACS"); +} +//============================================================================= +/*! + * + */ +//============================================================================= +HOMARD_YACS::~HOMARD_YACS() +{ + MESSAGE("~HOMARD_YACS"); +} +//============================================================================= +//============================================================================= +// Generalites +//============================================================================= +//============================================================================= +void HOMARD_YACS::SetName( const char* Name ) +{ + _Name = std::string( Name ); +} +//============================================================================= +std::string HOMARD_YACS::GetName() const +{ + return _Name; +} +//============================================================================= +std::string HOMARD_YACS::GetDumpPython() const +{ + MESSAGE (". Ecriture du schema " << _Name ); + std::ostringstream aScript; + aScript << "\n# Creation of the schema " << _Name << "\n"; +// Creation du schema + aScript << "\t" << _Name << " = " << _NomCas << ".CreateYACSSchema(\"" << _Name << "\", \"" << _ScriptFile << "\", \"" << _NomDir << "\", \"" << _MeshFile << "\")\n"; +// Le type de schema + aScript << "\t" << _Name << ".SetType(" << _Type << ")\n"; +// Les controles de convergences + if ( _MaxIter > 0 ) { aScript << "\t" << _Name << ".SetMaxIter(" << _MaxIter << ")\n"; } + if ( _MaxNode > 0 ) { aScript << "\t" << _Name << ".SetMaxNode(" << _MaxNode << ")\n"; } + if ( _MaxElem > 0 ) { aScript << "\t" << _Name << ".SetMaxElem(" << _MaxElem << ")\n"; } + +// L'ecriture du schema + aScript << "\tcodret = " << _Name << ".Write()\n"; + + MESSAGE (". Fin de l ecriture du schema " << _Name ); + + return aScript.str(); +} +//============================================================================= +//============================================================================= +// Caracteristiques de la convergence +//============================================================================= +//============================================================================= +void HOMARD_YACS::SetType( int Type ) +{ + _Type = Type; +} +//============================================================================= +int HOMARD_YACS::GetType() const +{ + return _Type; +} +//============================================================================= +void HOMARD_YACS::SetMaxIter( int MaxIter ) +{ + _MaxIter = MaxIter; +} +//============================================================================= +int HOMARD_YACS::GetMaxIter() const +{ + return _MaxIter; +} +//============================================================================= +void HOMARD_YACS::SetMaxNode( int MaxNode ) +{ + _MaxNode = MaxNode; +} +//============================================================================= +int HOMARD_YACS::GetMaxNode() const +{ + return _MaxNode; +} +//============================================================================= +void HOMARD_YACS::SetMaxElem( int MaxElem ) +{ + _MaxElem = MaxElem; +} +//============================================================================= +int HOMARD_YACS::GetMaxElem() const +{ + return _MaxElem; +} +//============================================================================= +void HOMARD_YACS::SetTestConvergence( int TypeTest, double VRef ) +{ + _TypeTest = TypeTest; + _VRef = VRef; +} +//============================================================================= +int HOMARD_YACS::GetTestConvergenceType() const +{ + return _TypeTest; +} +//============================================================================= +double HOMARD_YACS::GetTestConvergenceVRef() const +{ + return _VRef; +} +//============================================================================= +//============================================================================= +// Repertoire et fichiers +//============================================================================= +//============================================================================= +//============================================================================= +void HOMARD_YACS::SetDirName( const char* NomDir ) +{ + _NomDir = std::string( NomDir ); +} +//============================================================================= +std::string HOMARD_YACS::GetDirName() const +{ + return _NomDir; +} +//============================================================================= +void HOMARD_YACS::SetMeshFile( const char* MeshFile ) +{ + _MeshFile = std::string( MeshFile ); +} +//============================================================================= +std::string HOMARD_YACS::GetMeshFile() const +{ + return _MeshFile; +} +//============================================================================= +void HOMARD_YACS::SetScriptFile( const char* ScriptFile ) +{ + _ScriptFile = std::string( ScriptFile ); +} +//============================================================================= +std::string HOMARD_YACS::GetScriptFile() const +{ + return _ScriptFile; +} +//============================================================================= +void HOMARD_YACS::SetXMLFile( const char* XMLFile ) +{ + _XMLFile = std::string( XMLFile ); +} +//============================================================================= +std::string HOMARD_YACS::GetXMLFile() const +{ + return _XMLFile; +} +//============================================================================= +//============================================================================= +// Liens avec les autres structures +//============================================================================= +//============================================================================= +void HOMARD_YACS::SetCaseName( const char* NomCas ) +{ + _NomCas = std::string( NomCas ); +} +//============================================================================= +std::string HOMARD_YACS::GetCaseName() const +{ + return _NomCas; +} +//============================================================================= +//============================================================================= +// Divers +//============================================================================= +//============================================================================= diff --git a/src/ADAPT/HOMARD_YACS.hxx b/src/ADAPT/HOMARD_YACS.hxx new file mode 100644 index 000000000..5f9141997 --- /dev/null +++ b/src/ADAPT/HOMARD_YACS.hxx @@ -0,0 +1,103 @@ +// HOMARD HOMARD : implementation of HOMARD idl descriptions +// +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : HOMARD_YACS.hxx +// 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 + +#ifndef _HOMARD_YACS_HXX_ +#define _HOMARD_YACS_HXX_ + +#include "HOMARD.hxx" + +#include +#include + +class HOMARDIMPL_EXPORT HOMARD_YACS +{ +public: + HOMARD_YACS(); + ~HOMARD_YACS(); + +// Generalites + void SetName( const char* Name ); + std::string GetName() const; + + std::string GetDumpPython() const; + +// Caracteristiques + void SetType( int Type ); + int GetType() const; + + void SetMaxIter( int MaxIter ); + int GetMaxIter() const; + void SetMaxNode( int MaxNode ); + int GetMaxNode() const; + void SetMaxElem( int MaxElem ); + int GetMaxElem() const; + + void SetTestConvergence( int TypeTest, double VRef ); + int GetTestConvergenceType() const; + double GetTestConvergenceVRef() const; + + void SetDirName( const char* NomDir ); + std::string GetDirName() const; + + void SetMeshFile( const char* MeshFile ); + std::string GetMeshFile() const; + + void SetScriptFile( const char* ScriptFile ); + std::string GetScriptFile() const; + + void SetXMLFile( const char* XMLFile ); + std::string GetXMLFile() const; + +// Liens avec les autres structures + void SetCaseName( const char* NomCas ); + std::string GetCaseName() const; + + +// Divers + +private: + std::string _Name; + std::string _NomCas; + std::string _NomDir; + std::string _MeshFile; + std::string _ScriptFile; + int _Type; + int _MaxIter; + int _MaxNode; + int _MaxElem; + int _TypeTest; + double _VRef; + std::string _XMLFile; +}; + +#endif diff --git a/src/ADAPT/HOMARD_Zone.cxx b/src/ADAPT/HOMARD_Zone.cxx new file mode 100644 index 000000000..0d938a53b --- /dev/null +++ b/src/ADAPT/HOMARD_Zone.cxx @@ -0,0 +1,325 @@ +// HOMARD HOMARD : implementation of HOMARD idl descriptions +// +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : HOMARD_Zone.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 "HOMARD_Zone.hxx" +#include "HOMARD.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * default constructor: + */ +//============================================================================= +HOMARD_Zone::HOMARD_Zone(): + _Name( "" ),_Type( 2 ), + _Xmin( 0 ), _Xmax( 0 ), _Ymin( 0 ), _Ymax( 0 ), _Zmin( 0 ), _Zmax( 0 ), + _Xcentre( 0 ), _Ycentre( 0 ), _Zcentre( 0 ), _Rayon( 0 ), + _Xaxe( 0 ), _Yaxe( 0 ), _Zaxe( 0 ), _Haut( 0 ), + _Xincr( 0 ), _Yincr( 0 ), _Zincr( 0 ) +{ + MESSAGE("HOMARD_Zone") ; +} + +//============================================================================= +HOMARD_Zone::~HOMARD_Zone() +{ + MESSAGE("~HOMARD_Zone") ; +} +//============================================================================= +//============================================================================= +// Generalites +//============================================================================= +//============================================================================= +void HOMARD_Zone::SetName( const char* Name ) +{ + _Name = std::string( Name ); +} +//============================================================================= +std::string HOMARD_Zone::GetName() const +{ + return _Name; +} +//============================================================================= +std::string HOMARD_Zone::GetDumpPython() const +{ +// MESSAGE("GetDumpPython avec _Type " << _Type) ; +// MESSAGE("GetDumpPython avec _Name " << _Name) ; + std::ostringstream aScript; + aScript << "\n# Creation of the "; + if ( _Type >= 11 && _Type <= 13 ) { aScript << "rectangle " ; } + else if ( _Type == 2 ) { aScript << "box " ;} + else if ( _Type >= 31 && _Type <= 33 ) { aScript << "disk " ;} + else if ( _Type == 4 ) { aScript << "sphere " ; } + else if ( _Type == 5 ) { aScript << "cylinder " ; } + else if ( _Type >= 61 && _Type <= 63 ) { aScript << "disk with hole " ;} + else if ( _Type == 7 ) { aScript << "pipe " ; } + aScript << _Name << "\n" ; +// + aScript << "\t" << _Name << " = homard.CreateZone" ; +// + switch (_Type) + { + case 11: + { aScript << "Box2D( \"" << _Name << "\", " << _Xmin << ", " << _Xmax << ", " << _Ymin << ", " << _Ymax << ", 1 )\n"; + break ; + } + case 12: + { aScript << "Box2D( \"" << _Name << "\", " << _Ymin << ", " << _Ymax << ", " << _Zmin << ", " << _Zmax << ", 2 )\n"; + break ; + } + case 13: + { aScript << "Box2D( \"" << _Name << "\", " << _Zmin << ", " << _Zmax << ", " << _Xmin << ", " << _Xmax << ", 3 )\n"; + break ; + } + case 2: + { aScript << "Box( \"" << _Name << "\", " << _Xmin << ", " << _Xmax << ", " << _Ymin << ", " << _Ymax << ", " << _Zmin << ", " << _Zmax << ")\n"; + break ; + } + + case 4: + { aScript << "Sphere( \"" << _Name << "\", " << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _Rayon << ")\n"; + break ; + } + + case 31: + { aScript << "Disk( \"" << _Name << "\", " << _Xcentre << ", " << _Ycentre << ", " << _Rayon << ", 1 )\n"; + break ; + } + case 32: + { aScript << "Disk( \"" << _Name << "\", " << _Ycentre << ", " << _Zcentre << ", " << _Rayon << ", 2 )\n"; + break ; + } + case 33: + { aScript << "Disk( \"" << _Name << "\", " << _Zcentre << ", " << _Xcentre << ", " << _Rayon << ", 3 )\n"; + break ; + } + case 5: + { aScript << "Cylinder( \"" << _Name << "\", " << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _Rayon << ", " << _Haut << ")\n"; + break ; + } + + case 61: + { aScript << "DiskWithHole( \"" << _Name << "\", " << _Xcentre << ", " << _Ycentre << ", " << _Rayon << ", " << _Rayonint << ", 1 )\n"; + break ; + } + case 62: + { aScript << "DiskWithHole( \"" << _Name << "\", " << _Ycentre << ", " << _Zcentre << ", " << _Rayon << ", " << _Rayonint << ", 2 )\n"; + break ; + } + case 63: + { aScript << "DiskWithHole( \"" << _Name << "\", " << _Zcentre << ", " << _Xcentre << ", " << _Rayon << ", " << _Rayonint << ", 3 )\n"; + break ; + } + case 7: + { aScript << "Pipe( \"" << _Name << "\", " << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _Rayon << ", " << _Haut << ", " << _Rayonint << ")\n"; + break ; + } + } + + return aScript.str() ; +} +//============================================================================= +//============================================================================= +// Caracteristiques +//============================================================================= +//============================================================================= +void HOMARD_Zone::SetType( int Type ) +{ + _Type = Type; +} +//============================================================================= +int HOMARD_Zone::GetType() const +{ + return _Type; +} +//======================================================================================= +void HOMARD_Zone::SetBox( double X0, double X1, double X2, double X3, double X4, double X5 ) +{ + _Xmin = X0; _Xmax = X1; + _Ymin = X2; _Ymax = X3; + _Zmin = X4; _Zmax = X5; +} +//======================================================================================= +void HOMARD_Zone::SetCylinder( 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; + _Rayon = X6; + _Haut = X7; +} +//======================================================================================= +void HOMARD_Zone::SetPipe( double X0, double X1, double X2, + double X3, double X4, double X5, double X6, double X7, double X8 ) +{ + _Xcentre = X0; + _Ycentre = X1; + _Zcentre = X2; + _Xaxe = X3; + _Yaxe = X4; + _Zaxe = X5; + _Rayon = X6; + _Haut = X7; + _Rayonint = X8; +} +//====================================================================== +void HOMARD_Zone::SetSphere( double X0, double X1, double X2, double X3 ) +{ + _Xcentre = X0; + _Ycentre = X1; + _Zcentre = X2; + _Rayon = X3; +} +//======================================================================================= +std::vector HOMARD_Zone::GetCoords() const +{ + std::vector mesCoor; +// + switch (_Type) + { +// Rectangle ou parallelepipede + case 11: + { } + case 12: + { } + case 13: + { } + case 2: + { + mesCoor.push_back( _Xmin ) ; + mesCoor.push_back( _Xmax ) ; + mesCoor.push_back( _Ymin ) ; + mesCoor.push_back( _Ymax ) ; + mesCoor.push_back( _Zmin ) ; + mesCoor.push_back( _Zmax ) ; + break ; + } +// Sphere + case 4: + { + mesCoor.push_back( _Xcentre ) ; + mesCoor.push_back( _Ycentre ) ; + mesCoor.push_back( _Zcentre ) ; + mesCoor.push_back( _Rayon ) ; + break ; + } +// Disque ou cylindre + case 31: + { } + case 32: + { } + case 33: + { } + 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( _Rayon ) ; + mesCoor.push_back( _Haut ) ; + break ; + } +// Disque avec trou ou tuyau + case 61: + { } + case 62: + { } + case 63: + { } + case 7: + { + 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 ) ; + mesCoor.push_back( _Haut ) ; + mesCoor.push_back( _Rayonint ) ; + break ; + } + VERIFICATION ( ( (_Type>10) && (_Type<14) ) || (_Type==2) || ( (_Type>30) && (_Type<34) ) || (_Type==4) || (_Type==5) || ( (_Type>60) && (_Type<64) ) || (_Type==7) ) ; + } + return mesCoor; +} +//====================================================================== +void HOMARD_Zone::SetLimit( double X0, double X1, double X2 ) +{ + _Xincr = X0; _Yincr = X1; _Zincr = X2; +} +//======================================================================================= +std::vector HOMARD_Zone::GetLimit() const +{ + std::vector mesLimit; + mesLimit.push_back( _Xincr ) ; + mesLimit.push_back( _Yincr ) ; + mesLimit.push_back( _Zincr ) ; + return mesLimit; +} +//============================================================================= +//============================================================================= +// Liens avec les autres structures +//============================================================================= +//============================================================================= +void HOMARD_Zone::AddHypo( const char* NomHypo ) +{ + _ListHypo.push_back( std::string( NomHypo ) ) ; +} +//============================================================================= +const std::list& HOMARD_Zone::GetHypo() const +{ + return _ListHypo; +} +//============================================================================= +void HOMARD_Zone::SupprHypo( const char* NomHypo ) +{ + std::list::iterator it = find( _ListHypo.begin(), _ListHypo.end(), NomHypo ) ; + if ( it != _ListHypo.end() ) + { + MESSAGE ("Dans SupprHypo pour " << NomHypo) ; + it = _ListHypo.erase( it ) ; + } +} +//============================================================================= +void HOMARD_Zone::SupprHypos() +{ + _ListHypo.clear() ; +} diff --git a/src/ADAPT/HOMARD_Zone.hxx b/src/ADAPT/HOMARD_Zone.hxx new file mode 100644 index 000000000..ace77905d --- /dev/null +++ b/src/ADAPT/HOMARD_Zone.hxx @@ -0,0 +1,95 @@ +// HOMARD HOMARD : implementation of HOMARD idl descriptions +// +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : HOMARD_Zone.hxx +// 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 + +#ifndef _HOMARD_Zone_HXX_ +#define _HOMARD_Zone_HXX_ + +#include "HOMARD.hxx" + +#include +#include +#include + +#if defined WIN32 +#pragma warning ( disable: 4251 ) +#endif + +class HOMARDIMPL_EXPORT HOMARD_Zone +{ +public: + HOMARD_Zone(); + ~HOMARD_Zone(); + +// Generalites + void SetName( const char* Name ); + std::string GetName() const; + + std::string GetDumpPython() const; + +// Caracteristiques + void SetType( int Type ); + int GetType() const; + + void SetBox( double X0, double X1, double X2, + double X3, double X4, double X5 ); + + void SetCylinder( double X0, double X1, double X2, double X3, + double X4, double X5, double X6, double X7 ); + + void SetPipe( double X0, double X1, double X2, double X3, + double X4, double X5, double X6, double X7, double X8 ); + + void SetSphere( double X0, double X1, double X2, double X3 ); + + std::vector GetCoords() const; + + void SetLimit( double X0, double X1, double X2 ); + std::vector GetLimit() const; + +// Liens avec les autres structures + void AddHypo( const char* NomHypo ); + const std::list& GetHypo() const; + void SupprHypo( const char* NomHypo ); + void SupprHypos(); + +private: + std::string _Name; + int _Type; + std::list _ListHypo; + double _Xmin, _Xmax, _Ymin, _Ymax, _Zmin, _Zmax; + double _Xcentre, _Ycentre, _Zcentre, _Rayon, _Rayonint; + double _Xaxe, _Yaxe, _Zaxe, _Haut; + double _Xincr, _Yincr, _Zincr; +}; + +#endif diff --git a/src/ADAPT/HomardDriver.cxx b/src/ADAPT/HomardDriver.cxx new file mode 100644 index 000000000..f11b7a5e7 --- /dev/null +++ b/src/ADAPT/HomardDriver.cxx @@ -0,0 +1,1106 @@ +// HOMARD HOMARD : implementation of HOMARD idl descriptions +// +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// Pilote l'ecriture du fichier de configuration pour lancer l'execution de HOMARD + +#include +#ifndef WIN32 +#include +#endif +#include + +#include "HomardDriver.hxx" +#include "Utils_SALOME_Exception.hxx" +#include "utilities.h" + +//============================================================================= +//============================================================================= +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 ="< +#include + +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; + +}; + +# endif /* # ifndef _HOMARDDRIVER_HXX_ */ diff --git a/src/ADAPT/YACSDriver.cxx b/src/ADAPT/YACSDriver.cxx new file mode 100644 index 000000000..27910535d --- /dev/null +++ b/src/ADAPT/YACSDriver.cxx @@ -0,0 +1,684 @@ +// HOMARD HOMARD : implementation of HOMARD idl descriptions +// +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// Pilote l'ecriture du fichier xml pour lancer un schema YACS + +#include +#ifndef WIN32 +#include +#endif +#include + +#include "YACSDriver.hxx" +#include "HOMARD.hxx" +#include "Utils_SALOME_Exception.hxx" +#include "utilities.h" + +//============================================================================= +//============================================================================= +YACSDriver::YACSDriver(const std::string XMLFile, const std::string DirName, const std::string LangueShort): + _XMLFile( "" ), _DirName( "" ), + _Texte( "" ), + _Texte_parametres( "" ), + _noeud_1( "CreateCase" ), + _LangueShort( "" ), + _bLu( false ) +{ + MESSAGE("XMLFile = "<" ; + _Texte += Meshfile ; + _Texte += "\n" ; +// +} +//=============================================================================== +// Le repertoire de calcul +// Le script de lancement +//=============================================================================== +void YACSDriver::Texte_Alternance_Calcul_HOMARD_Calcul( const std::string FileName ) +{ + MESSAGE("Texte_Alternance_Calcul_HOMARD_Calcul, FileName : "<\n" ; + INFOS("_LangueShort = "<<_LangueShort ); + if ( _LangueShort == "fr" ) { motcle = "Etude_Initialisation" ; } + else { motcle = "Study_Initialisation" ; } + INFOS("motcle = "<\n" ; + _Texte += " " + methode + "\n" ; +// 4. Les inports +// 4.1. Le nom de la zone + _Texte += Texte_inport( "string", "ZoneName" ) ; + TexteParametre( node, "ZoneName", "string", ZoneName ) ; +// 4.2. Les valeurs numeriques +// ATTENTION : les noms doivent etre les memes que dans Gen.xml, donc HOMARD_Gen.idl +// 4.2.1. Decodage des valeurs +// La chaine pythonStructure est de ce genre : +// CreateZoneBox( "Zone_1", 0.144, 0.216, 0.096, 0.1464, 0.076, 0.12) + std::string ligne = pythonStructure ; +// On commence par ne garder que ce qui suit la premiere virgule + ligne = GetStringInTexte( ligne, ",", 1 ); +// On boucle pour isoler toutes les chaines dans les virgules + std::string lignebis ; + std::string x0, x1, x2, x3, x4, x5, x6, x7, x8 ; + int iaux = 0 ; + while ( ligne != lignebis ) + { + lignebis = GetStringInTexte ( ligne, ",", 0 ) ; +// MESSAGE("lignebis = "< 10 ) && ( ZoneType < 14 ) ) + { + _Texte += Texte_inport( "double", "Umini" ) ; + _Texte += Texte_inport( "double", "Umaxi" ) ; + _Texte += Texte_inport( "double", "Vmini" ) ; + _Texte += Texte_inport( "double", "Vmaxi" ) ; + _Texte += Texte_inport( "long", "Orient" ) ; + TexteParametre( node, "Umini", "double", x0 ) ; + TexteParametre( node, "Umaxi", "double", x1 ) ; + TexteParametre( node, "Vmini", "double", x2 ) ; + TexteParametre( node, "Vmaxi", "double", x3 ) ; + TexteParametre( node, "Orient", "int", x8 ) ; + } +// +// 4.2.4. Cas du disque (31, 32, 33) ou du disque perce (61, 62, 63) + else if ( ( ( ZoneType > 30 ) && ( ZoneType < 34 ) ) || ( ( ZoneType > 60 ) && ( ZoneType < 64 ) ) ) + { + _Texte += Texte_inport( "double", "Ucentre" ) ; + _Texte += Texte_inport( "double", "Vcentre" ) ; + _Texte += Texte_inport( "double", "Radius" ) ; + TexteParametre( node, "Ucentre", "double", x0 ) ; + TexteParametre( node, "Vcentre", "double", x1 ) ; + TexteParametre( node, "Radius", "double", x2 ) ; + if ( ZoneType > 60 ) + { + _Texte += Texte_inport( "double", "InternalRadius" ) ; + TexteParametre( node, "InternalRadius", "double", x3 ) ; + } + _Texte += Texte_inport( "long", "Orient" ) ; + TexteParametre( node, "Orient", "int", x8 ) ; + } +// +// 4.2.5. Cas de la sphere (4) + else if ( ZoneType == 4 ) + { + _Texte += Texte_inport( "double", "Xcentre" ) ; + _Texte += Texte_inport( "double", "Ycentre" ) ; + _Texte += Texte_inport( "double", "Zcentre" ) ; + _Texte += Texte_inport( "double", "Radius" ) ; + TexteParametre( node, "Xcentre", "double", x0 ) ; + TexteParametre( node, "Ycentre", "double", x1 ) ; + TexteParametre( node, "Zcentre", "double", x2 ) ; + TexteParametre( node, "Radius", "double", x8 ) ; + } +// +// 4.2.6. Cas du cylindre (5) ou du tuyau (7) + else if ( ZoneType == 5 || ZoneType == 7 ) + { + _Texte += Texte_inport( "double", "Xcentre" ) ; + _Texte += Texte_inport( "double", "Ycentre" ) ; + _Texte += Texte_inport( "double", "Zcentre" ) ; + _Texte += Texte_inport( "double", "Xaxis" ) ; + _Texte += Texte_inport( "double", "Yaxis" ) ; + _Texte += Texte_inport( "double", "Zaxis" ) ; + _Texte += Texte_inport( "double", "Radius" ) ; + _Texte += Texte_inport( "double", "Height" ) ; + TexteParametre( node, "Xcentre", "double", x0 ) ; + TexteParametre( node, "Ycentre", "double", x1 ) ; + TexteParametre( node, "Zcentre", "double", x2 ) ; + TexteParametre( node, "Xaxis", "double", x3 ) ; + TexteParametre( node, "Yaxis", "double", x4 ) ; + TexteParametre( node, "Zaxis", "double", x5 ) ; + TexteParametre( node, "Radius", "double", x6 ) ; + if ( ZoneType == 5 ) + { + TexteParametre( node, "Height", "double", x8 ) ; + } + else + { + _Texte += Texte_inport( "double", "InternalRadius" ) ; + TexteParametre( node, "Height", "double", x7 ) ; + TexteParametre( node, "InternalRadius", "double", x8 ) ; + } + } +// +// 4.2.7. Erreur + else + { VERIFICATION("Type de zone inconnu." == 0); } + +// +// 5. La fin + _Texte += " \n" ; + _Texte += " \n" ; +// + return texte_control ; +// +} +//=============================================================================== +// La description des frontieres +// BoundaryType : le type de la frontiere +// pythonStructure : le python correspondant a la frontiere +// methode : methode associee a la creation de la frontiere +// BoundaryName : nom de la frontiere +// MeshName : nom du maillage dans le cas d'une frontiere discrete +// MeshFile : nom du fichier du maillage dans le cas d'une frontiere discrete +//=============================================================================== +std::string YACSDriver::Texte_Iter_1_Boundary( int BoundaryType, const std::string pythonStructure, const std::string methode, const std::string BoundaryName, const std::string MeshName, const std::string MeshFile ) +{ + MESSAGE("Texte_Iter_1_Boundary, BoundaryType = "<\n" ; + if ( _LangueShort == "fr" ) { motcle = "Etude_Initialisation" ; } + else { motcle = "Study_Initialisation" ; } + _Texte += " " + motcle + ".UpdateStudy\n" ; + _Texte += " " + methode + "\n" ; +// 4. Les inports +// ATTENTION : les noms doivent etre les memes que dans Gen.xml, donc HOMARD_Gen.idl +// 4.1. Le nom de la frontiere + _Texte += Texte_inport( "string", "BoundaryName" ) ; + TexteParametre( node, "BoundaryName", "string", BoundaryName ) ; +// 4.2. Cas d une frontiere discrete + if (BoundaryType == 0) + { + _Texte += Texte_inport( "string", "MeshName" ) ; + TexteParametre( node, "MeshName", "string", MeshName ) ; + _Texte += Texte_inport( "string", "FileName" ) ; + TexteParametre( node, "FileName", "string", MeshFile ) ; + } +// 4.3. Cas d'une frontiere analytique : les valeurs numeriques + else + { +// 4.3.1. Decodage des valeurs +// La chaine pythonStructure est de ce genre : +// CreateBoundaryCylinder('cyl_2', 17.5, -2.5, -12.5, -100., -75., -25., 50.) +// CreateBoundaryDi("intersection", "PIQUAGE", "/scratch/D68518/Salome/script/sfr_2d_piquage.fr.med") + std::string ligne = pythonStructure ; +// On commence par ne garder que ce qui suit la premiere virgule + ligne = GetStringInTexte( ligne, ",", 1 ); +// On boucle pour isoler toutes les chaines dans les virgules + std::string lignebis ; + std::string x0, x1, x2, x3, x4, x5, x6, x7 ; + int iaux = 0 ; + while ( ligne != lignebis ) + { + lignebis = GetStringInTexte ( ligne, ",", 0 ) ; +// MESSAGE("lignebis = "<\n" ; + _Texte += " \n" ; +// + return texte_control ; +// +} +//=============================================================================== +// Fin du controle des enchainements de noeud dans le noeud Iter_1 +//=============================================================================== + std::string YACSDriver::Texte_Iter_1_control() +{ + MESSAGE("Texte_Iter_1_control"); +// + std::string texte ; + texte = Texte_control (_noeud_1, "CreateHypothesis", 1) ; + texte += Texte_control ("CreateHypothesis", "Case_Options", 0) ; +// + return texte ; +// +} +//=============================================================================== +// Controle des enchainements de noeuds +// noeud_1 : noeud de depart +// noeud_2 : noeud d'arrivee +// option : 0 : sans caractere de saut de ligne a la fin +// 1 : avec caractere de saut de ligne a la fin +//=============================================================================== + std::string YACSDriver::Texte_control( const std::string noeud_1, const std::string noeud_2, int option ) +{ + MESSAGE("Texte_control, noeud_1 = "< " ; + texte += "" + noeud_1 + "" ; + texte += " " + noeud_2 + "" ; + texte += " " ; + if ( option == 1 ) { texte += "\n" ; } + + return texte ; +// +} +//=============================================================================== +// Inport +// inport_type : type de la donnee a importer +// inport_nom : nom de la donnee a importer +//=============================================================================== + std::string YACSDriver::Texte_inport( const std::string inport_type, const std::string inport_nom ) +{ +// MESSAGE("Texte_inport, inport_type = "< indice ) + { + int position = ligne.find_first_of( "." ) ; + MESSAGE("\nposition : "<< position); + if ( position > 0 ) + { + ligne_bis = ligne.substr( position ); + MESSAGE("\nligne_bis : "<< ligne_bis); + _Texte += concept + ligne_bis + "\n" ; + } + } + cptr += 1 ; + } +// +} +//=============================================================================== +// Manipulation des instructions python - 2 +// pythonTexte : le texte des instructions python a manipuler +// mot_cle : mot-cle dans les lignes a inserer +// concept : nom du concept a inserer +//=============================================================================== +void YACSDriver::Texte_python_2( const std::string pythonTexte, const std::string mot_cle, const std::string concept ) +{ + MESSAGE("Texte_python_2, pythonTexte\n"< 0 ) + { + int position = ligne.find_first_of( "." ) ; +// MESSAGE("\nposition : "<< position); + if ( position > 0 ) + { + ligne_bis = ligne.substr( position ); +// MESSAGE("\nligne_bis : "<< ligne_bis); + _Texte += concept + ligne_bis + "\n" ; + } + } + } +// +} +//=============================================================================== +// Parametres de tests de convergence +//=============================================================================== +void YACSDriver::TexteAnalyse_Test_Convergence( int MaxIter, int MaxNode, int MaxElem ) +{ +// +// MESSAGE("TexteAnalyse_Test_Convergence"); + std::string chaine ; + std::ostringstream oss1; + oss1 << MaxIter; + chaine = oss1.str(); + _Texte += "MaxIter = " + chaine + "\n" ; + std::ostringstream oss2; + oss2 << MaxNode; + chaine = oss2.str(); + _Texte += "MaxNode = " + chaine + "\n" ; + std::ostringstream oss3; + oss3 << MaxElem; + chaine = oss3.str(); + _Texte += "MaxElem = " + chaine + "\n" ; +// +} +//=============================================================================== +// Creation d'un parametre +//=============================================================================== +void YACSDriver::TexteParametre( const std::string node, const std::string port, const std::string type_value, const std::string value ) +{ +// +// MESSAGE("TexteParametre"); + _Texte_parametres += " \n" ; + _Texte_parametres += " " + node + "" ; + _Texte_parametres += "" + port + "\n" ; + _Texte_parametres += " <" + type_value + ">" + value + "\n" ; + _Texte_parametres += " \n" ; +// +} +//=============================================================================== +// Ajout des parametres +//=============================================================================== +void YACSDriver::TexteAddParametres( ) +{ +// + MESSAGE("TexteAddParametres"); + TexteAdd(_Texte_parametres) ; +// +} +//=============================================================================== +void YACSDriver::CreeFichier( ) +{ +// + MESSAGE("CreeFichier sur le fichier "<<_XMLFile); + std::ofstream Fic(_XMLFile.c_str(), std::ios::out ) ; + if (Fic.is_open() == true) { Fic << _Texte << std::endl ; } + Fic.close() ; +// +} +//=============================================================================== +// REMARQUE : on devrait utiliser le GetStringInTexte de HOMARD_Gen_i mais je ne sais pas +// comment l'appeler. ALors je clone. +// Recuperation de la chaine de caracteres par rapport l'apparition d'un texte +// ligne : la ligne a manipuler +// texte : le texte a reperer +// option : 0 : la chaine avant le texte +// 1 : la chaine apres le texte +// Si le texte est absent, on retourne la chaine totale +//=============================================================================== +std::string YACSDriver::GetStringInTexte( const std::string ligne, const std::string texte, int option ) +{ +// MESSAGE("GetStringInTexte, recherche de '"< +#include + +class HOMARDIMPL_EXPORT YACSDriver +{ +public: + YACSDriver(const std::string XMLFile, const std::string DirName, const std::string LangueShort) ; + ~YACSDriver() ; + // + void TexteAdd( const std::string ligne ) ; + void Texte_DataInit_MeshFile( const std::string Meshfile ) ; + void Texte_Alternance_Calcul_HOMARD_Calcul( const std::string FileName ) ; + void Texte_Iter_1_Case_Options( const std::string pythonCas ) ; + std::string Texte_Iter_1_Boundary( int BoundaryType, const std::string pythonStructure, const std::string methode, const std::string BoundaryName, const std::string MeshName, const std::string MeshFile ) ; + std::string Texte_Iter_1_Zone( int ZoneType, const std::string pythonStructure, const std::string methode, const std::string ZoneName ) ; + std::string Texte_Iter_1_control() ; + std::string Texte_control( const std::string noeud_1, const std::string noeud_2, int option ) ; + std::string Texte_inport( const std::string inport_type, const std::string inport_nom ) ; + void Texte_HOMARD_Exec_DirName( ) ; + void Texte_HOMARD_Exec_MeshName( const std::string MeshName ) ; + void Texte_python_1( const std::string pythonTexte, int indice, const std::string concept ) ; + void Texte_python_2( const std::string pythonTexte, const std::string mot_cle, const std::string concept ) ; + void TexteParametre( const std::string node, const std::string port, const std::string type_value, const std::string value ) ; + void TexteAnalyse_Test_Convergence( int MaxIter, int MaxNode, int MaxElem ) ; + void TexteAddParametres( ) ; + void CreeFichier() ; + // + +public: + std::string _XMLFile ; + std::string _DirName ; + std::string _Texte ; + std::string _Texte_parametres ; + std::string _noeud_1 ; + std::string _LangueShort ; + bool _bLu; + +private : + std::string GetStringInTexte( const std::string Texte, const std::string String, int option ) ; +}; + +# endif /* # ifndef __YACSDRIVER_H__ */ diff --git a/src/ADAPTGUI/ADAPT_msg_en.ts b/src/ADAPTGUI/ADAPT_msg_en.ts new file mode 100644 index 000000000..4d40ad891 --- /dev/null +++ b/src/ADAPTGUI/ADAPT_msg_en.ts @@ -0,0 +1,459 @@ + + + + + @default + + HOM_MEN_HOMARD + HOMARD + + + HOM_MEN_MODIFICATION + Modification + + + HOM_MEN_INFORMATION + Information + + + HOM_MEN_YACS + YACS + + + HOM_MEN_NEW_CASE + New case + + + HOM_MEN_NEW_ITERATION + Next iteration + + + HOM_MEN_PURSUE_ITERATION + Case: pursuit of a stored iteration + + + HOM_MEN_COMPUTE + Compute + + + HOM_MEN_COMPUTE_PUBLISH + Compute and publish + + + HOM_MEN_EDIT + Edit + + + HOM_MEN_DELETE + Delete + + + HOM_MEN_MESH_INFO + Mesh analysis + + + HOM_MEN_MESH_PUBLICATION + Mesh publication + + + HOM_MEN_EDIT_MESS_FILE + Show the file + + + HOM_MEN_WRITE + Write + + + HOM_TOP_HOMARD + HOMARD + + + HOM_TOP_NEW_CASE + New case + + + HOM_TOP_NEW_ITERATION + Next iteration + + + HOM_TOP_PURSUE_ITERATION + Case: pursuit of a stored iteration + + + HOM_TOP_COMPUTE + Compute + + + HOM_TOP_COMPUTE_PUBLISH + Compute and publish + + + HOM_TOP_EDIT + Edit + + + HOM_TOP_DELETE + Delete + + + HOM_TOP_EDIT_MESS_FILE + Show the file + + + HOM_STB_HOMARD + HOMARD + + + HOM_STB_NEW_CASE + New case + + + HOM_STB_NEW_ITERATION + Next iteration + + + HOM_STB_PURSUE_ITERATION + Case: pursuit of a stored iteration + + + HOM_STB_COMPUTE + Compute + + + HOM_STB_COMPUTE_PUBLISH + Compute and publish + + + HOM_STB_EDIT + Edit + + + HOM_STB_DELETE + Delete + + + HOM_STB_EDIT_MESS_FILE + Show the file + + + 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_ZONE_1 + A zone must be selected. + + + HOM_HYPO_ZONE_2 + At least, one zone must be selected. + + + HOM_HYPO_ZONE_3 + Either refinement or coarsening, but not both. + + + 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_ZONE_NAME + The zone must be named. + + + HOM_ZONE_LIMIT + %1 maxi must be greater than %1 mini. + + + HOM_ZONE_RAYON + The external radius must be greater than the internal radius. + + + HOM_ZONE_EDIT_WINDOW_TITLE + Edition of a zone + + + 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 + + + HOM_YACS_EDIT_WINDOW_TITLE + Edition of a schema YACS + + + PREF_TAB_GENERAL + General + + + PREF_PUBLICATION + Publication + + + PREF_PUBLICATION_MAILLAGE_IN + IN meshes + + + PREF_PUBLICATION_MAILLAGE_OUT + OUT meshes + + + PREF_YACS + YACS + + + PREF_YACS_MAX + Maximum numbers + + + PREF_YACS_MAX_ITER + Iterations + + + PREF_YACS_MAX_NODE + Nodes + + + PREF_YACS_MAX_ELEM + Elements + + + PREF_YACS_CONVERGENCE + Convergence + + + PREF_YACS_TYPE_TEST + Test type + + + diff --git a/src/ADAPTGUI/ADAPT_msg_fr.ts b/src/ADAPTGUI/ADAPT_msg_fr.ts new file mode 100644 index 000000000..3306a69e7 --- /dev/null +++ b/src/ADAPTGUI/ADAPT_msg_fr.ts @@ -0,0 +1,1171 @@ + + + + + @default + + HOM_MEN_HOMARD + HOMARD + + + HOM_MEN_MODIFICATION + Modification + + + HOM_MEN_INFORMATION + Information + + + HOM_MEN_YACS + YACS + + + HOM_MEN_NEW_CASE + Nouveau cas + + + HOM_MEN_NEW_ITERATION + Itération suivante + + + HOM_MEN_PURSUE_ITERATION + Cas de poursuite d'une itération + + + HOM_MEN_COMPUTE + Calculer + + + HOM_MEN_COMPUTE_PUBLISH + Calculer et publier + + + HOM_MEN_EDIT + Editer + + + HOM_MEN_DELETE + Supprimer + + + HOM_MEN_MESH_INFO + Analyse de maillage + + + HOM_MEN_MESH_PUBLICATION + Publication du maillage + + + HOM_MEN_EDIT_MESS_FILE + Afficher le fichier + + + HOM_MEN_WRITE + Ecrire + + + HOM_TOP_HOMARD + HOMARD + + + HOM_TOP_NEW_CASE + Nouveau cas + + + HOM_TOP_NEW_ITERATION + Itération suivante + + + HOM_TOP_PURSUE_ITERATION + Cas de poursuite d'une itération + + + HOM_TOP_COMPUTE + Calculer + + + HOM_TOP_COMPUTE_PUBLISH + Calculer et publier + + + HOM_TOP_EDIT + Editer + + + HOM_TOP_DELETE + Supprimer + + + HOM_TOP_EDIT_MESS_FILE + Afficher le fichier + + + HOM_STB_HOMARD + HOMARD + + + HOM_STB_NEW_CASE + Nouveau cas + + + HOM_STB_NEW_ITERATION + Itération suivante + + + HOM_STB_PURSUE_ITERATION + Cas de poursuite d'une itération + + + HOM_STB_COMPUTE + Calculer + + + HOM_STB_COMPUTE_PUBLISH + Calculer et publier + + + HOM_STB_EDIT + Editer + + + HOM_STB_DELETE + Supprimer + + + HOM_STB_EDIT_MESS_FILE + Afficher le fichier + + + 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 + + + Invalid zone + Zone 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. + + + This zone has already been defined. + Cette zone 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_ZONE_1 + Choisir une zone. + + + HOM_HYPO_ZONE_2 + Il faut choisir au moins une zone. + + + HOM_HYPO_ZONE_3 + Raffinement ou déraffinement, mais pas les deux. + + + 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 + + + With geometrical zones + Selon des zones géométriques + + + 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 + + + Zone management + Gestion des zones + + + Zone name + Nom de la zone + + + Field Interpolation + Interpolation des champs + + + Chosen + Choisi + + + Create a zone + Création d'une zone + + + HOM_ZONE_NAME + Il faut donner un nom à la zone. + + + HOM_ZONE_LIMIT + %1 maxi doit être plus grand que %1 mini. + + + HOM_ZONE_RAYON + Le rayon externe doit être supérieur au rayon interne. + + + HOM_ZONE_EDIT_WINDOW_TITLE + Edition d'une zone + + + Type of zone + Type de la zone + + + 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. + + + This zone is used in a hypothesis and cannot be deleted. + Cette zone est utilisée dans une hypothèse ; elle 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 + + + HOM_YACS_EDIT_WINDOW_TITLE + Edition d'un schéma YACS + + + 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 + + + PREF_YACS + YACS + + + PREF_YACS_MAX + Nombres maximum + + + PREF_YACS_MAX_ITER + Itérations + + + PREF_YACS_MAX_NODE + Noeuds + + + PREF_YACS_MAX_ELEM + Eléments + + + PREF_YACS_CONVERGENCE + Convergence + + + PREF_YACS_TYPE_TEST + Type de test + + + diff --git a/src/ADAPTGUI/ADAPT_msg_ja.ts b/src/ADAPTGUI/ADAPT_msg_ja.ts new file mode 100644 index 000000000..e60a20c76 --- /dev/null +++ b/src/ADAPTGUI/ADAPT_msg_ja.ts @@ -0,0 +1,1148 @@ + + + + + @default + + HOM_MEN_HOMARD + ロブスター + + + HOM_MEN_MODIFICATION + 変更 + + + HOM_MEN_INFORMATION + 情報 + + + HOM_MEN_YACS + YACS + + + HOM_MEN_NEW_CASE + 新しいケース + + + HOM_MEN_NEW_ITERATION + 新しいイテレーション + + + HOM_MEN_PURSUE_ITERATION + イテレーションの追跡 + + + HOM_MEN_COMPUTE + 計算します。 + + + HOM_MEN_COMPUTE_PUBLISH + 計算と発行 + + + HOM_MEN_EDIT + 編集(&E) + + + HOM_MEN_DELETE + 削除 + + + HOM_MEN_MESH_INFO + メッシュの解析 + + + HOM_MEN_MESH_PUBLICATION + メッシュ発行 + + + HOM_MEN_EDIT_MESS_FILE + ファイルを表示します。 + + + HOM_MEN_WRITE + 書き込み + + + HOM_TOP_HOMARD + ロブスター + + + HOM_TOP_NEW_CASE + 新しいケース + + + HOM_TOP_NEW_ITERATION + 新しいイテレーション + + + HOM_TOP_PURSUE_ITERATION + イテレーションの追跡 + + + HOM_TOP_COMPUTE + 計算します。 + + + HOM_TOP_COMPUTE_PUBLISH + 計算と発行 + + + HOM_TOP_EDIT + 編集 + + + HOM_TOP_DELETE + 削除 + + + HOM_TOP_EDIT_MESS_FILE + ファイルを表示します。 + + + HOM_STB_HOMARD + ロブスター + + + HOM_STB_NEW_CASE + 新しいケース + + + HOM_STB_NEW_ITERATION + 新しいイテレーション + + + HOM_STB_PURSUE_ITERATION + イテレーションの追跡 + + + HOM_STB_COMPUTE + 計算 + + + HOM_STB_COMPUTE_PUBLISH + 計算と発行 + + + HOM_STB_EDIT + 編集 + + + HOM_STB_DELETE + 削除 + + + HOM_STB_EDIT_MESS_FILE + ファイルを表示します。 + + + 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 + 無効なイテレーション + + + Invalid zone + 無効なゾーン + + + 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. + このイテレーションは既に定義されています。 + + + This zone 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_ZONE_1 + ゾーンを選択します。 + + + HOM_HYPO_ZONE_2 + 1 つは、少なくとも 1 つのゾーンを選択する必要があります。 + + + HOM_HYPO_ZONE_3 + 洗練された、または deraffinement、両方ではないです。 + + + 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 + フィールドによって駆動 + + + With geometrical zones + 幾何学的ゾーン使用 + + + Uniform adaptation + 均一な適応 + + + Coarsening + 粗大化 + + + 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 + 粗大化なし + + + Zone management + ゾーン管理 + + + Zone name + ゾーン名 + + + Field Interpolation + フィールド補間 + + + Chosen + 選択済み + + + Create a zone + ゾーンの作成 + + + HOM_ZONE_NAME + 領域に名前を必要があります。 + + + HOM_ZONE_LIMIT + 最大 %1 は %1 のミニよりも大きい必要があります。 + + + HOM_ZONE_RAYON + 外側の半径は、内側の半径よりも大きい必要があります。 + + + HOM_ZONE_EDIT_WINDOW_TITLE + 領域の編集 + + + Type of zone + ゾーンのタイプ + + + 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. + このイテレーションは削除できません。 + + + This zone is used in a hypothesis and cannot be deleted. + このゾーンはhypothesisで使用されており、削除できません。 + + + 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 + 無効なスタディの内容 + + + HOM_YACS_EDIT_WINDOW_TITLE + YACS スキーマ編集スキーマへんしゅう + + + PREF_TAB_GENERAL + 一般的な + + + PREF_PUBLICATION + 発行 + + + PREF_PUBLICATION_MAILLAGE_IN + メッシュ入力 + + + PREF_PUBLICATION_MAILLAGE_OUT + メッシュ出力 + + + PREF_YACS + YACS + + + PREF_YACS_MAX + 最大の数 + + + PREF_YACS_MAX_ITER + 繰り返し + + + PREF_YACS_MAX_NODE + 節点 + + + PREF_YACS_MAX_ELEM + 要素 + + + PREF_YACS_CONVERGENCE + 収束 + + + PREF_YACS_TYPE_TEST + テストタイプ + + + diff --git a/src/ADAPTGUI/CMakeLists.txt b/src/ADAPTGUI/CMakeLists.txt new file mode 100644 index 000000000..54cb7d0ff --- /dev/null +++ b/src/ADAPTGUI/CMakeLists.txt @@ -0,0 +1,177 @@ +# Copyright (C) 2012-2020 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +INCLUDE(UseQtExt) +INCLUDE(UsePyQt) + +# --- options --- + +# additional include directories +INCLUDE_DIRECTORIES( + ${QT_INCLUDES} + ${OpenCASCADE_INCLUDE_DIR} + ${PYTHON_INCLUDE_DIRS} + ${MEDFILE_INCLUDE_DIRS} + ${HDF5_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIR} + ${KERNEL_INCLUDE_DIRS} + ${GUI_INCLUDE_DIRS} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${PROJECT_BINARY_DIR} + ${PROJECT_BINARY_DIR}/idl + ${PROJECT_BINARY_DIR}/adm_local/unix + ${PROJECT_SOURCE_DIR}/src/ADAPT + ${PROJECT_SOURCE_DIR}/src/ADAPT_I +) + +# additional preprocessor / compiler flags +ADD_DEFINITIONS( + ${OMNIORB_DEFINITIONS} + ${OpenCASCADE_DEFINITIONS} + ${KERNEL_DEFINITIONS} +) + +# libraries to link to +SET(_link_LIBRARIES + ${MEDFILE_C_LIBRARIES} + ${KERNEL_SalomeLifeCycleCORBA} + ${KERNEL_SalomeDS} + ${GUI_SalomeApp} + SalomeIDLADAPT + ADAPTEngine +) + +# --- resources --- + +# resource files / to be processed by lrelease +SET(_ts_RESOURCES + ADAPT_msg_en.ts + ADAPT_msg_fr.ts + ADAPT_msg_ja.ts +) + +# resource files / to be processed by uic +SET(_uic_FILES + CreateBoundaryCAO.ui + CreateBoundaryAn.ui + CreateBoundaryDi.ui + CreateCase.ui + CreateHypothesis.ui + CreateIteration.ui + CreateListGroup.ui + CreateYACS.ui + CreateZone.ui + EditFile.ui + IterInfo.ui + MeshInfo.ui + PursueIteration.ui +) + +# --- headers --- + +# header files / to be processed by moc +SET(_moc_HEADERS + HOMARDGUI.h + MonCreateBoundaryCAO.h + MonCreateBoundaryAn.h + MonCreateBoundaryDi.h + MonEditBoundaryCAO.h + MonEditBoundaryAn.h + MonEditBoundaryDi.h + MonCreateCase.h + MonEditCase.h + MonCreateZone.h + MonEditZone.h + MonCreateHypothesis.h + MonEditHypothesis.h + MonCreateListGroup.h + MonCreateListGroupCAO.h + MonEditListGroup.h + MonEditListGroupCAO.h + MonCreateIteration.h + MonEditIteration.h + MonPursueIteration.h + MonMeshInfo.h + MonIterInfo.h + MonCreateYACS.h + MonEditYACS.h + MonEditFile.h +) + +# header files / uic wrappings +QT_WRAP_UIC(_uic_HEADERS ${_uic_FILES}) + +# header files / static +SET(_other_HEADERS + HOMARDGUI_Utils.h + HomardQtCommun.h + HOMARDGUI_Exports.hxx +) + +# header files / to install +SET(ADAPT_HEADERS ${_other_HEADERS} ${_moc_HEADERS} ${_uic_HEADERS}) + +# --- sources --- + +# sources / moc wrappings +QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS}) + +# sources / static +SET(_other_SOURCES + HOMARDGUI.cxx + HOMARDGUI_Utils.cxx + MonCreateBoundaryCAO.cxx + MonCreateBoundaryAn.cxx + MonCreateBoundaryDi.cxx + MonEditBoundaryCAO.cxx + MonEditBoundaryAn.cxx + MonEditBoundaryDi.cxx + MonCreateCase.cxx + MonEditCase.cxx + MonCreateHypothesis.cxx + MonEditHypothesis.cxx + MonCreateListGroup.cxx + MonCreateListGroupCAO.cxx + MonEditListGroup.cxx + MonEditListGroupCAO.cxx + MonCreateIteration.cxx + MonEditIteration.cxx + MonPursueIteration.cxx + MonCreateZone.cxx + MonEditZone.cxx + MonMeshInfo.cxx + MonIterInfo.cxx + MonCreateYACS.cxx + MonEditYACS.cxx + MonEditFile.cxx + HomardQtCommun.cxx +) + +# sources / to compile +SET(ADAPT_SOURCES ${_other_SOURCES} ${_moc_SOURCES} ${_uic_HEADERS}) + +# --- rules --- + +ADD_LIBRARY(ADAPT ${ADAPT_SOURCES}) +TARGET_LINK_LIBRARIES(ADAPT ${_link_LIBRARIES} ) +INSTALL(TARGETS ADAPT EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) + +INSTALL(FILES ${ADAPT_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) +QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_ADAPT_INSTALL_RES_DATA}") diff --git a/src/ADAPTGUI/CreateBoundaryAn.ui b/src/ADAPTGUI/CreateBoundaryAn.ui new file mode 100644 index 000000000..ac291082d --- /dev/null +++ b/src/ADAPTGUI/CreateBoundaryAn.ui @@ -0,0 +1,1107 @@ + + + CreateBoundaryAn + + + + 0 + 0 + 522 + 835 + + + + Create an analytical boundary + + + true + + + true + + + + + + Name + + + + + + + 32 + + + + + + + + 0 + 0 + + + + + 340 + 0 + + + + Type of boundary + + + + + + Cylinder + + + + ../../resources/cylinderpointvector.png../../resources/cylinderpointvector.png + + + true + + + true + + + + + + + Sphere + + + + ../../resources/zone_spherepoint.png../../resources/zone_spherepoint.png + + + + + + + Cone + + + + ../../resources/cone.png../../resources/cone.png + + + + + + + Torus + + + + ../../resources/toruspointvector.png../../resources/toruspointvector.png + + + true + + + false + + + + + + + + + + + 0 + 0 + + + + Coordinates + + + + 9 + + + 6 + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + X centre + + + false + + + + + + + 5 + + + 1000000000.000000000000000 + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + Radius + + + false + + + + + + + + 0 + 0 + + + + Z centre + + + false + + + + + + + + 0 + 0 + + + + Y centre + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + X axis + + + false + + + + + + + + 0 + 0 + + + + Y axis + + + false + + + + + + + + 0 + 0 + + + + Z axis + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + + + + 0 + 0 + + + + Coordinates + + + + 9 + + + 6 + + + + + 5 + + + 0.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + Radius + + + false + + + + + + + + 0 + 0 + + + + Z centre + + + false + + + + + + + + 0 + 0 + + + + Y centre + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + X centre + + + false + + + + + + + + + + + 0 + 0 + + + + Coordinates + + + + + + Definition + + + + + + Radius + + + + ../../resources/conedxyz.png../../resources/conedxyz.png + + + true + + + + + + + Angle + + + + ../../resources/conepointvector.png../../resources/conepointvector.png + + + + + + + + + + + 0 + 0 + + + + X 1 + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + X 2 + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + Y 1 + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + Y 2 + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + Z 1 + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + Z 2 + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + V 1 + + + false + + + + + + + 5 + + + 1000000000.000000000000000 + + + + + + + + 0 + 0 + + + + V 2 + + + false + + + + + + + 5 + + + 1000000000.000000000000000 + + + + + + + + + + + 0 + 0 + + + + Coordinates + + + + + + + 0 + 0 + + + + X centre + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + X axis + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + Y centre + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + Y axis + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + Z centre + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + Z axis + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + R revolution + + + false + + + + + + + 5 + + + 1000000000.000000000000000 + + + + + + + + 0 + 0 + + + + Primary R + + + false + + + + + + + 5 + + + 1000000000.000000000000000 + + + + + + + + + + + 0 + 0 + + + + + + + + 9 + + + 6 + + + + + Help + + + + + + + Cancel + + + + + + + Apply + + + + + + + OK + + + + + + + + + + + diff --git a/src/ADAPTGUI/CreateBoundaryCAO.ui b/src/ADAPTGUI/CreateBoundaryCAO.ui new file mode 100644 index 000000000..c74c60122 --- /dev/null +++ b/src/ADAPTGUI/CreateBoundaryCAO.ui @@ -0,0 +1,133 @@ + + + CreateBoundaryCAO + + + + 0 + 0 + 566 + 195 + + + + + 0 + 0 + + + + Get CAO + + + true + + + true + + + + 9 + + + 6 + + + + + + + + + 9 + + + 6 + + + + + Help + + + + + + + Cancel + + + + + + + Apply + + + + + + + OK + + + + + + + + + + Filtering with groups + + + + + + + + 370 + 21 + + + + + + + + + + + + + + + XAO + + + + + + + + 382 + 21 + + + + 32 + + + + + + + Name + + + + + + + + diff --git a/src/ADAPTGUI/CreateBoundaryDi.ui b/src/ADAPTGUI/CreateBoundaryDi.ui new file mode 100644 index 000000000..b505ff869 --- /dev/null +++ b/src/ADAPTGUI/CreateBoundaryDi.ui @@ -0,0 +1,133 @@ + + + CreateBoundaryDi + + + + 0 + 0 + 566 + 169 + + + + + 0 + 0 + + + + Create a discrete boundary + + + true + + + true + + + + 9 + + + 6 + + + + + + + + + 9 + + + 6 + + + + + Help + + + + + + + Cancel + + + + + + + Apply + + + + + + + OK + + + + + + + + + + Filtering with groups + + + + + + + + 370 + 21 + + + + + + + + + + + + + + + Mesh + + + + + + + + 382 + 21 + + + + 32 + + + + + + + Name + + + + + + + + diff --git a/src/ADAPTGUI/CreateCase.ui b/src/ADAPTGUI/CreateCase.ui new file mode 100644 index 000000000..14fe44db9 --- /dev/null +++ b/src/ADAPTGUI/CreateCase.ui @@ -0,0 +1,777 @@ + + + CreateCase + + + + 0 + 0 + 600 + 1150 + + + + + 0 + 0 + + + + + 600 + 320 + + + + + 1 + 1 + + + + + 600 + 320 + + + + Create a case + + + true + + + + + + + + + Name + + + + + + + + + + + + + Qt::Horizontal + + + + 199 + 20 + + + + + + + + 6 + + + 0 + + + + + Directory + + + + + + + + + + false + + + + + + + + 382 + 21 + + + + + + + + + + Qt::Vertical + + + + 20 + 18 + + + + + + + + 6 + + + 0 + + + + + Mesh + + + + + + + + + + false + + + + + + + + 382 + 21 + + + + + + + + + + Qt::Vertical + + + + 20 + 0 + + + + + + + + Conformity type + + + + 6 + + + 9 + + + + + Conformal + + + true + + + + + + + Non conformal + + + + + + + + + + Boundary type + + + + 6 + + + 9 + + + + + No boundary + + + true + + + + + + + CAO + + + false + + + + + + + Non CAO + + + + + + + + + + Qt::Vertical + + + + 20 + 1 + + + + + + + + 6 + + + 0 + + + + + Discrete boundary + + + + + + + Analytical boundary + + + + + + + + + + 0 + 0 + + + + CAO + + + + 9 + + + 6 + + + + + Edit + + + false + + + + + + + Help + + + false + + + + + + + -1 + + + QComboBox::AdjustToContents + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 13 + + + + + + + + New + + + false + + + + + + + + + + Qt::Vertical + + + + 20 + 2 + + + + + + + + + 0 + 0 + + + + Discrete boundary + + + + 9 + + + 6 + + + + + -1 + + + QComboBox::AdjustToContents + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 13 + + + + + + + + Edit + + + false + + + + + + + Help + + + false + + + + + + + New + + + false + + + + + + + + + + + 548 + 200 + + + + Analytical boundary + + + + + + QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked + + + true + + + 0 + + + 1 + + + + a_virer + + + + + + + + 0 + + + 6 + + + + + Edit + + + false + + + + + + + New + + + false + + + + + + + Help + + + false + + + + + + + + + + + + Qt::Vertical + + + + 239 + 41 + + + + + + + + Advanced options + + + + + + + Advanced options + + + + + + Authorized pyramids + + + + + + + Conformity + + + + + + + + + Standard + + + true + + + + + + + Box + + + false + + + + + + + 1 node per edge + + + + + + + Free + + + + + + + + + Format + + + + + + MED + + + true + + + + + + + Saturne + + + + + + + Saturne 2D + + + + + + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 128 + 13 + + + + + + + + Qt::Vertical + + + + 239 + 41 + + + + + + + + No comment. + + + + + + + Qt::Vertical + + + + 20 + 35 + + + + + + + + + + + + 9 + + + 6 + + + + + Help + + + false + + + + + + + Apply + + + false + + + + + + + OK + + + false + + + + + + + Cancel + + + false + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 128 + 25 + + + + + + WName + GBTypeConf + GBBoundaryD + GBBoundaryA + CBAdvanced + GBAdvancedOptions + Comment + GroupButtons + GBBoundaryC + GBTypeBoun + + + + diff --git a/src/ADAPTGUI/CreateHypothesis.ui b/src/ADAPTGUI/CreateHypothesis.ui new file mode 100644 index 000000000..53698b548 --- /dev/null +++ b/src/ADAPTGUI/CreateHypothesis.ui @@ -0,0 +1,1111 @@ + + + CreateHypothesis + + + + 0 + 0 + 848 + 1650 + + + + + 0 + 0 + + + + + 800 + 600 + + + + + 1 + 1 + + + + + 800 + 1200 + + + + Create a hypothesis + + + true + + + + + 0 + 0 + 844 + 1646 + + + + true + + + + + + + + + Name + + + + + + + + 282 + 31 + + + + + + + + + + + Qt::Horizontal + + + + 224 + 20 + + + + + + + + Type of adaptation + + + + 6 + + + 9 + + + + + Uniform + + + true + + + + + + + Driven by a field + + + + + + + With geometrical zones + + + + + + + + + + Qt::Horizontal + + + + 20 + 20 + + + + + + + + Filtering with groups + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Uniform adaptation + + + + 9 + + + 6 + + + + + Coarsening + + + + + + + Refinement + + + true + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 9 + + + 6 + + + + + File of the fields + + + + + + + + 282 + 31 + + + + + + + + + + + + 0 + 0 + + + + Governing field for the adaptation + + + + 9 + + + 6 + + + + + 6 + + + 0 + + + + + Field name + + + + + + + + 0 + 0 + + + + false + + + QComboBox::AdjustToContents + + + + + + + Qt::Horizontal + + + + 48 + 20 + + + + + + + + + + 6 + + + 0 + + + + + QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked + + + true + + + 0 + + + 2 + + + + Selection + + + + + Component + + + + + + + + Qt::Horizontal + + + + 60 + 20 + + + + + + + + 6 + + + 0 + + + + + 6 + + + 0 + + + + + L2 norm + + + true + + + + + + + Infinite norm + + + false + + + + + + + + + Jump between elements + + + + + + + + + + + 6 + + + 0 + + + + + + 0 + 0 + + + + Refinement threshold + + + + 9 + + + 6 + + + + + Percentage of meshes + + + true + + + true + + + + + + + % + + + 3 + + + 100.000000000000000 + + + 0.100000000000000 + + + 2.000000000000000 + + + + + + + Relative + + + + + + + false + + + % + + + 3 + + + 100.000000000000000 + + + 0.100000000000000 + + + + + + + Absolute + + + + + + + false + + + 8 + + + -1000000000000.000000000000000 + + + 1000000000000.000000000000000 + + + 0.100000000000000 + + + + + + + Mean + n*(std deviation) + + + + + + + false + + + 8 + + + -1000000000000.000000000000000 + + + 1000000000000.000000000000000 + + + 0.100000000000000 + + + 3.000000000000000 + + + + + + + No refinement + + + + + + + + + + Coarsening threshold + + + + 9 + + + 6 + + + + + Percentage of meshes + + + true + + + false + + + + + + + false + + + % + + + 3 + + + 100.000000000000000 + + + 0.100000000000000 + + + + + + + Relative + + + + + + + false + + + % + + + 3 + + + 100.000000000000000 + + + 0.100000000000000 + + + + + + + Absolute + + + + + + + false + + + 8 + + + -1000000000000.000000000000000 + + + 1000000000000.000000000000000 + + + 0.100000000000000 + + + + + + + Mean - n*(std deviation) + + + + + + + false + + + 8 + + + -1000000000000.000000000000000 + + + 1000000000000.000000000000000 + + + 0.100000000000000 + + + 4.000000000000000 + + + + + + + No coarsening + + + true + + + + + + + + + + + + + + + + 0 + 0 + + + + Zone management + + + + + + + 400 + 0 + + + + QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked + + + true + + + 0 + + + 3 + + + + Refinement + + + + + Coarsening + + + + + Zone name + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 6 + + + 0 + + + + + 6 + + + 0 + + + + + New + + + + + + + Edit + + + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 48 + + + + + + + + + + + + + Field Interpolation + + + + 9 + + + 6 + + + + + 0 + + + 6 + + + + + None + + + true + + + + + + + All + + + false + + + + + + + Chosen + + + false + + + + + + + + + + Selection + + + + + Field Name + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Advanced options + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Advanced options + + + + + + + 0 + 0 + + + + Minimal diameter + + + false + + + + + + + 7 + + + + + + + + 0 + 0 + + + + Maximal level + + + false + + + + + + + 99 + + + + + + + Initialization of adaptation + + + + + + Nothing + + + true + + + + + + + Refinement + + + + + + + Coarsening + + + + + + + + + + Output of the level of refinement + + + + + + + Output of the qualities + + + + + + + Output of the diameters + + + + + + + Output of the parents + + + + + + + Output of the neighbours + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 9 + + + 6 + + + + + OK + + + + + + + Apply + + + + + + + Cancel + + + + + + + Help + + + + + + + + + + + + diff --git a/src/ADAPTGUI/CreateIteration.ui b/src/ADAPTGUI/CreateIteration.ui new file mode 100644 index 000000000..2cc2827c6 --- /dev/null +++ b/src/ADAPTGUI/CreateIteration.ui @@ -0,0 +1,600 @@ + + + CreateIteration + + + + 0 + 0 + 777 + 668 + + + + + 0 + 0 + + + + + 750 + 400 + + + + + 1 + 1 + + + + + 750 + 400 + + + + Create an iteration + + + true + + + + + 0 + 0 + 773 + 664 + + + + true + + + + + + Iteration Name + + + + + + + Qt::Horizontal + + + + 117 + 20 + + + + + + + + + 290 + 21 + + + + 64 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Previous iteration + + + + + + + true + + + + 50 + 27 + + + + + + + + + + + + 0 + 21 + + + + 64 + + + true + + + + + + + Mesh n + + + + + + + Qt::Horizontal + + + + 117 + 20 + + + + + + + + + 290 + 21 + + + + 64 + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Mesh n+1 + + + + + + + Qt::Horizontal + + + + 117 + 20 + + + + + + + + + 290 + 21 + + + + 64 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Vertical + + + + 20 + 62 + + + + + + + + Field information + + + + 9 + + + 6 + + + + + + 282 + 21 + + + + + + + + Qt::Vertical + + + + 138 + 18 + + + + + + + + Chosen time step + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 255 + 13 + + + + + + + + -1 + + + 1010000 + + + -1 + + + + + + + Rank + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 13 + + + + + + + + -2 + + + 100000 + + + -1 + + + + + + + Time step + + + + + + + Qt::Vertical + + + + 138 + 28 + + + + + + + + Last time step + + + + + + + No time step + + + true + + + true + + + + + + + + + + + + + + Field file + + + + + + + + + + Qt::Horizontal + + + + 69 + 20 + + + + + + + + Qt::Vertical + + + + 20 + 22 + + + + + + + + Hypothesis + + + + 9 + + + 6 + + + + + -1 + + + QComboBox::AdjustToContents + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 13 + + + + + + + + Edit + + + + + + + New + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Vertical + + + + 20 + 21 + + + + + + + + + + + + 9 + + + 6 + + + + + OK + + + false + + + false + + + + + + + Apply + + + + + + + Cancel + + + + + + + Help + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 139 + 20 + + + + + + + + + + diff --git a/src/ADAPTGUI/CreateListGroup.ui b/src/ADAPTGUI/CreateListGroup.ui new file mode 100644 index 000000000..06c606110 --- /dev/null +++ b/src/ADAPTGUI/CreateListGroup.ui @@ -0,0 +1,121 @@ + + CreateListGroup + + + + 0 + 0 + 717 + 600 + + + + + 0 + 0 + 0 + 0 + + + + Selection of groups + + + true + + + true + + + + 9 + + + 6 + + + + + + + + + 9 + + + 6 + + + + + Help + + + + + + + Cancel + + + + + + + Apply + + + + + + + OK + + + + + + + + + + Selected groups + + + + 9 + + + 6 + + + + + true + + + 0 + + + 2 + + + + Selection + + + + + Group + + + + + + + + + + + + diff --git a/src/ADAPTGUI/CreateYACS.ui b/src/ADAPTGUI/CreateYACS.ui new file mode 100644 index 000000000..0e8f76c25 --- /dev/null +++ b/src/ADAPTGUI/CreateYACS.ui @@ -0,0 +1,526 @@ + + + CreateYACS + + + + 0 + 0 + 684 + 649 + + + + + 0 + 0 + + + + + 600 + 500 + + + + + 1 + 1 + + + + + 600 + 500 + + + + Create YACS + + + true + + + + + 0 + 0 + 680 + 645 + + + + true + + + + + + + + + Name + + + + + + + 32 + + + + + + + + + + Qt::Horizontal + + + + 131 + 20 + + + + + + + + + + Case + + + + + + + true + + + + 50 + 27 + + + + + + + + + + + + 382 + 21 + + + + + + + + + + 6 + + + 0 + + + + + Script + + + + + + + + + + false + + + + + + + + 382 + 21 + + + + + + + + + + 6 + + + 0 + + + + + Directory + + + + + + + + + + false + + + + + + + + 382 + 21 + + + + + + + + + + 6 + + + 0 + + + + + Mesh file + + + + + + + + + + false + + + + + + + + 382 + 21 + + + + + + + + + + Type of schema + + + + 6 + + + 9 + + + + + Constant + + + true + + + + + + + Variable + + + + + + + + + + Maximum of ... + + + + + + + 0 + 0 + + + + Iterations + + + false + + + + + + + 0 + + + 999999999 + + + 0 + + + + + + + + 0 + 0 + + + + Nodes + + + false + + + + + + + 0 + + + 999999999 + + + 1000 + + + 0 + + + + + + + + 0 + 0 + + + + Elements + + + false + + + + + + + 0 + + + 999999999 + + + 1000 + + + 0 + + + + + + + + + + Qt::Horizontal + + + + 269 + 20 + + + + + + + + Test of convergence + + + + + + None + + + true + + + + + + + Vtest > Vref + + + + + + + Vtest < Vref + + + + + + + Vref + + + + + + + 4 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + + + + + + + + Qt::Horizontal + + + + 269 + 20 + + + + + + + + + + + + 9 + + + 6 + + + + + Help + + + false + + + + + + + Apply + + + false + + + + + + + OK + + + false + + + + + + + Cancel + + + false + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 128 + 25 + + + + + + + + + + diff --git a/src/ADAPTGUI/CreateZone.ui b/src/ADAPTGUI/CreateZone.ui new file mode 100644 index 000000000..84a607516 --- /dev/null +++ b/src/ADAPTGUI/CreateZone.ui @@ -0,0 +1,1139 @@ + + + CreateZone + + + + 0 + 0 + 545 + 778 + + + + + 1 + 1 + + + + + 550 + 400 + + + + Create a zone + + + true + + + true + + + + + + Name + + + + + + + 32 + + + + + + + Qt::Horizontal + + + + 142 + 20 + + + + + + + + + 0 + 0 + + + + + 340 + 0 + + + + Type of zone + + + + 9 + + + 6 + + + + + Sphere + + + + ../../resources/zone_spherepoint.png../../resources/zone_spherepoint.png + + + + + + + Pipe + + + + ../../resources/pipe.png../../resources/pipe.png + + + + + + + Cylinder + + + + ../../resources/cylinderpointvector.png../../resources/cylinderpointvector.png + + + + + + + Box + + + + ../../resources/zone_boxdxyz.png../../resources/zone_boxdxyz.png + + + true + + + true + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + Coordinates + + + + 9 + + + 6 + + + + + + 0 + 0 + + + + X mini + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + Y mini + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + Z mini + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + X maxi + + + false + + + + + + + + 0 + 0 + + + + Z maxi + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + Y maxi + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + + + + 0 + 0 + + + + Coordinates + + + + 9 + + + 6 + + + + + + 0 + 0 + + + + X centre + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + Y centre + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + Radius + + + false + + + + + + + 5 + + + 0.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + Z centre + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + + + + 0 + 0 + + + + Qt::TabFocus + + + Coordinates + + + + 9 + + + 6 + + + + + 5 + + + 1000000000.000000000000000 + + + + + + + + 0 + 0 + + + + Height + + + false + + + + + + + + 0 + 0 + + + + Radius + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + Z axis + + + false + + + + + + + + 0 + 0 + + + + Y axis + + + false + + + + + + + + 0 + 0 + + + + X axis + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + Y base + + + false + + + + + + + + 0 + 0 + + + + Z base + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + 5 + + + 1000000000.000000000000000 + + + + + + + + 0 + 0 + + + + X base + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + + + + 0 + 0 + + + + Coordinates + + + + 9 + + + 6 + + + + + + 0 + 0 + + + + Height + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + X base + + + false + + + + + + + 5 + + + 1000000000.000000000000000 + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + Internal radius + + + false + + + + + + + + 0 + 0 + + + + Z base + + + false + + + + + + + + 0 + 0 + + + + Y base + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + X axis + + + false + + + + + + + + 0 + 0 + + + + Y axis + + + false + + + + + + + + 0 + 0 + + + + Z axis + + + false + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + 5 + + + -999999999.000000000000000 + + + 999999999.000000000000000 + + + 0.000000000000000 + + + + + + + 5 + + + 1000000000.000000000000000 + + + + + + + + 0 + 0 + + + + External radius + + + false + + + + + + + 5 + + + 1000000000.000000000000000 + + + + + + + + + + + 0 + 0 + + + + + + + + 9 + + + 6 + + + + + Help + + + + + + + Cancel + + + + + + + Apply + + + + + + + OK + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + diff --git a/src/ADAPTGUI/EditFile.ui b/src/ADAPTGUI/EditFile.ui new file mode 100644 index 000000000..bfccdc178 --- /dev/null +++ b/src/ADAPTGUI/EditFile.ui @@ -0,0 +1,115 @@ + + + EditFile + + + + 0 + 0 + 675 + 901 + + + + Edit a file + + + + 9 + + + 6 + + + + + Qt::Horizontal + + + + 331 + 49 + + + + + + + + + + + + 9 + + + 6 + + + + + Print + + + false + + + false + + + false + + + + + + + Quit + + + false + + + true + + + false + + + + + + + + + + Qt::Vertical + + + + 20 + 14 + + + + + + + + + 530 + 800 + + + + + Courier New + + + + + + + + + diff --git a/src/ADAPTGUI/HOMARDGUI.cxx b/src/ADAPTGUI/HOMARDGUI.cxx new file mode 100644 index 000000000..8a726faac --- /dev/null +++ b/src/ADAPTGUI/HOMARDGUI.cxx @@ -0,0 +1,909 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File : HOMARDGUI.cxx +// Author : Gerald NICOLAS, EDF +// Module : HOMARD + +#include "HOMARDGUI.h" + +// SALOME Includes +#include "Utils_ORB_INIT.hxx" +#include "Utils_SINGLETON.hxx" +#include "SALOME_LifeCycleCORBA.hxx" + +#include "SUIT_ResourceMgr.h" +#include "SUIT_MessageBox.h" +#include "SUIT_Session.h" +#include "SUIT_ViewWindow.h" +#include "SUIT_ViewManager.h" +#include + +#include "CAM_Module.h" +#include "OB_Browser.h" + +#include "SALOME_ListIO.hxx" + +#include "SalomeApp_Application.h" +#include "SalomeApp_DataModel.h" +#include "SalomeApp_Study.h" +#include "LightApp_SelectionMgr.h" +#include "LightApp_Selection.h" +#include +#include "SalomeApp_Module.h" +#include "SALOMEconfig.h" +#include + +#include + + +// QT Includes +#include +#include "MonCreateCase.h" +#include "MonCreateIteration.h" +#include "MonPursueIteration.h" +#include "MonCreateYACS.h" +#include "MonEditBoundaryCAO.h" +#include "MonEditBoundaryAn.h" +#include "MonEditBoundaryDi.h" +#include "MonEditCase.h" +#include "MonEditHypothesis.h" +#include "MonEditIteration.h" +#include "MonEditYACS.h" +#include "MonEditZone.h" +#include "MonMeshInfo.h" +#include "MonIterInfo.h" +#include "MonEditFile.h" +#include "HomardQtCommun.h" + +// BOOST Includes +#include + +//Pour le _CAST +#include "SALOMEDS_Study.hxx" +#include "HOMARDGUI_Utils.h" + +using namespace std; + +static CORBA::ORB_var _orb; + +//======================================================================= +// function : HOMARDGUI() +// purpose : Constructor +//======================================================================= +HOMARDGUI::HOMARDGUI(const QString&) : + SalomeApp_Module( "HOMARD" ) // default name +{ +} +//======================================================================= +// function : ~HOMARDGUI() +// purpose : Destructor +//======================================================================= +HOMARDGUI::~HOMARDGUI() +{ +} + +//======================================================================= +// function : InitHOMARDGen +// launch HOMARD component and return a handle +//======================================================================= +HOMARD::HOMARD_Gen_var HOMARDGUI::InitHOMARDGen(SalomeApp_Application* app) +{ + Engines::EngineComponent_var comp = app->lcc()->FindOrLoad_Component( "FactoryServer","HOMARD" ); + HOMARD::HOMARD_Gen_var clr = HOMARD::HOMARD_Gen::_narrow(comp); + ASSERT(!CORBA::is_nil(clr)); + return clr; +} + +//======================================================================= +// Module's initialization +void HOMARDGUI::initialize( CAM_Application* app ) +//======================================================================= +{ + SalomeApp_Module::initialize( app ); + InitHOMARDGen(dynamic_cast( app )); + anId = 0; + createActions(); + createMenus(); + recupPreferences(); +} + +//================================================ +// function : createHOMARDAction +// create an item in status bar and Homard menu +//================================================ +void HOMARDGUI::createHOMARDAction( const int id, const QString& po_id, const QString& icon_id, const int key, const bool toggle ) +{ +// MESSAGE("createHOMARDAction"); + QIcon icon; + QWidget* parent = application()->desktop(); + SUIT_ResourceMgr* resMgr = application()->resourceMgr(); + QPixmap pix; + if ( icon_id.length() ) + pix = resMgr->loadPixmap( "HOMARD", tr( icon_id .toLatin1().data()) ); + else + pix = resMgr->loadPixmap( "HOMARD", tr( QString( "ICO_%1" ).arg( po_id ).toLatin1().data()), false ); + if ( !pix.isNull() ) + icon = QIcon( pix ); + + QString tooltip = tr(QString( "HOM_TOP_%1" ).arg( po_id ).toLatin1().data()), + menu = tr(QString( "HOM_MEN_%1" ).arg( po_id ).toLatin1().data()), + status_bar = tr(QString( "HOM_STB_%1" ).arg( po_id ).toLatin1().data()); + + createAction( id, tooltip, icon, menu, status_bar, key, parent, toggle, this, SLOT( OnGUIEvent() ) ); +} + +//================================================ +// function : createAction +// constructs Homard menu +// calls createHOMARDAction for each item +//================================================ +void HOMARDGUI::createActions(){ +// + createHOMARDAction( 1101, "NEW_CASE", "cas_calcule.png" ); + createHOMARDAction( 1102, "PURSUE_ITERATION", "iter_poursuite.png" ); + createHOMARDAction( 1103, "NEW_ITERATION", "iter_next.png" ); + createHOMARDAction( 1111, "COMPUTE", "mesh_compute.png" ); + createHOMARDAction( 1112, "COMPUTE_PUBLISH", "mesh_compute.png" ); + createHOMARDAction( 1121, "MESH_INFO", "advanced_mesh_info.png" ); + createHOMARDAction( 1131, "MESH_PUBLICATION", "mesh_tree_mesh.png" ); +// + createHOMARDAction( 1201, "EDIT", "loop.png" ); + createHOMARDAction( 1211, "DELETE", "delete.png" ); +// + createHOMARDAction( 1301, "MESH_INFO", "advanced_mesh_info.png" ); + createHOMARDAction( 1302, "EDIT_MESS_FILE", "texte.png" ); +// + createHOMARDAction( 1401, "YACS", "table_view.png" ); +// +} + +//================================================ +// function : createPreferences +//================================================ +void HOMARDGUI::createPreferences() +{ + MESSAGE("createPreferences") + + int Onglet, Bloc, Pref ; + // 1. Generalites + Onglet = addPreference( tr( "PREF_TAB_GENERAL" ) ); +// Onglet = addPreference( tr( "PREF_TAB_SETTINGS" ) ) ; + + Bloc = addPreference( tr( "PREF_PUBLICATION" ), Onglet ); + setPreferenceProperty( Bloc, "columns", 1 ); + + Pref = addPreference( tr( "PREF_PUBLICATION_MAILLAGE_IN" ), Bloc, LightApp_Preferences::Bool, "HOMARD", "publish_mesh_in" ); + + Pref = addPreference( tr( "PREF_PUBLICATION_MAILLAGE_OUT" ), Bloc, LightApp_Preferences::Bool, "HOMARD", "publish_mesh_out" ); + + // 2. YACS + Onglet = addPreference( tr( "PREF_YACS" ) ) ; + + Bloc = addPreference( tr( "PREF_YACS_MAX" ), Onglet ); + setPreferenceProperty( Bloc, "columns", 1 ); + + Pref = addPreference( tr( "PREF_YACS_MAX_ITER" ), Bloc, LightApp_Preferences::IntSpin, "HOMARD", "yacs_max_iter" ); + setPreferenceProperty( Pref, "min", 0 ); + setPreferenceProperty( Pref, "max", 100000000 ); + setPreferenceProperty( Pref, "step", 1 ); + + Pref = addPreference( tr( "PREF_YACS_MAX_NODE" ), Bloc, LightApp_Preferences::IntSpin, "HOMARD", "yacs_max_node" ); + setPreferenceProperty( Pref, "min", 0 ); + setPreferenceProperty( Pref, "max", 100000000 ); + setPreferenceProperty( Pref, "step", 1000 ); + + Pref = addPreference( tr( "PREF_YACS_MAX_ELEM" ), Bloc, LightApp_Preferences::IntSpin, "HOMARD", "yacs_max_elem" ); + setPreferenceProperty( Pref, "min", 0 ); + setPreferenceProperty( Pref, "max", 100000000 ); + setPreferenceProperty( Pref, "step", 1000 ); + + Bloc = addPreference( tr( "PREF_YACS_CONVERGENCE" ), Onglet ); + setPreferenceProperty( Bloc, "columns", 1 ); + + Pref = addPreference( tr( "PREF_YACS_TYPE_TEST" ), Bloc, LightApp_Preferences::Selector, "HOMARD", "yacs_type_test" ); + QStringList aListOfTypeTest; + aListOfTypeTest << "None"; + aListOfTypeTest << "VTest > VRef"; + aListOfTypeTest << "VTest < VRef"; + setPreferenceProperty( Pref, "strings", aListOfTypeTest ); +} + + +//================================================ +// function : createMenus +//================================================ +void HOMARDGUI::createMenus() +{ + MESSAGE("createMenus") +// + int HOMARD_Id = createMenu( tr( "HOM_MEN_HOMARD" ), -1, 5, 10 ); + createMenu( 1101, HOMARD_Id, -1 ); //Create_Case + createMenu( 1102, HOMARD_Id, -1 ); //Pursue_Iteration + createMenu( separator(), HOMARD_Id,-1); + createMenu( 1103, HOMARD_Id, -1 ); //Create_Iteration + createMenu( 1111, HOMARD_Id, -1 ); //Compute + createMenu( 1112, HOMARD_Id, -1 ); //Compute and publish +// + HOMARD_Id = createMenu( tr( "HOM_MEN_MODIFICATION" ), -1, 5, 10 ); + createMenu( 1201, HOMARD_Id, -1 ); //Edit + createMenu( 1211, HOMARD_Id, -1 ); //Delete +// + HOMARD_Id = createMenu( tr( "HOM_MEN_INFORMATION" ), -1, 5, 10 ); + createMenu( 1301, HOMARD_Id, -1 ); //Information sur un maillage + createMenu( 1131, HOMARD_Id, -1 ); //Mesh publication + createMenu( separator(), HOMARD_Id,-1); + createMenu( 1302, HOMARD_Id, -1 ); //EditAsciiFile pour le fichier listeStd ou bilan + createMenu( separator(), HOMARD_Id,-1); + createMenu( 1201, HOMARD_Id, -1 ); //Edit + createMenu( separator(), HOMARD_Id,-1); +// + HOMARD_Id = createMenu( tr( "HOM_MEN_YACS" ), -1, 5, 10 ); + createMenu( 1401, HOMARD_Id, -1 ); // Création d'un schéma YACS + createMenu( separator(), HOMARD_Id,-1); +} + +//================================================ +// function : recupPreferences +// Pour chaque valeur, le defaut est la valeur definie dans HOMARD_Gen +// . Si la recuperation dans config/salome s'est bien passee a la creation de HOMARD_Gen, +// ces valeurs sont les valeurs definies. +// . Si cela ne s'est pas bien passe, ce sont les valeurs par defaut de HOMARD_Gen +//================================================ +void HOMARDGUI::recupPreferences() +{ + MESSAGE("recupPreferences") +// +// A. Declarations +// + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( application() ); + HOMARD::HOMARD_Gen_var homardGen = HOMARDGUI::InitHOMARDGen(app); + int defaut_i ; + std::string defaut_s ; + QString QString_v ; +// +// B. Les valeurs +// B.1. La langue +// + defaut_s = homardGen->GetLanguageShort(); + SUIT_ResourceMgr* resMgr = getApp()->resourceMgr(); + _LanguageShort = resMgr->stringValue("language", "language", QString(defaut_s.c_str()) ); +// +// B.2. Les publications + bool publish_mesh ; +// + _PublisMeshIN = homardGen->GetPublisMeshIN(); + if ( _PublisMeshIN == 1 ) { publish_mesh = true ; } + else { publish_mesh = false ; } + publish_mesh = resMgr->booleanValue("HOMARD", "publish_mesh_in", publish_mesh ); + if ( publish_mesh ) { _PublisMeshIN = 1 ; } + else { _PublisMeshIN = 0 ; } +// + _PublisMeshOUT = homardGen->GetPublisMeshOUT(); + if ( _PublisMeshOUT == 1 ) { publish_mesh = true ; } + else { publish_mesh = false ; } + publish_mesh = resMgr->booleanValue("HOMARD", "publish_mesh_out", publish_mesh ); + if ( publish_mesh ) { _PublisMeshOUT = 1 ; } + else { _PublisMeshOUT = 0 ; } +// +// B.3. Les maximum pour YACS +// + defaut_i = homardGen->GetYACSMaxIter(); + _YACSMaxIter = resMgr->integerValue("HOMARD", "yacs_max_iter", defaut_i ); +// + defaut_i = homardGen->GetYACSMaxNode(); + _YACSMaxNode = resMgr->integerValue("HOMARD", "yacs_max_node", defaut_i ); +// + defaut_i = homardGen->GetYACSMaxElem(); + _YACSMaxElem = resMgr->integerValue("HOMARD", "yacs_max_elem", defaut_i ); +// +// B.4. La convergence pour YACS +// + defaut_i = homardGen->GetYACSConvergenceType(); + if ( defaut_i == 1 ) { QString_v = tr("VTest > VRef") ; } + else if ( defaut_i == 2 ) { QString_v = tr("VTest < VRef") ; } + else { QString_v = tr("None") ; } + QString_v = resMgr->stringValue ( "HOMARD", "yacs_type_test", QString_v ); + if ( ( QString_v == "VTest > VRef" ) || ( QString_v == "VTest > VRef" ) ) { _YACSTypeTest = 1 ; } + else if ( ( QString_v == "VTest < VRef" ) || ( QString_v == "VTest < VRef" ) ) { _YACSTypeTest = 2 ; } + else { _YACSTypeTest = 0 ; } +// +// C. Enregistrement dans l'objet general +// + MESSAGE ("Enregistrement de LanguageShort = " << _LanguageShort.toStdString().c_str() ); + MESSAGE ("Enregistrement de PublisMeshIN = " << _PublisMeshIN<<", PublisMeshOUT = "<< _PublisMeshOUT); + MESSAGE ("Enregistrement de YACSMaxIter = " << _YACSMaxIter<<", YACSMaxNode = "<< _YACSMaxNode<<", YACSMaxElem = "<< _YACSMaxElem); + MESSAGE ("Enregistrement de YACSTypeTest = " << _YACSTypeTest); +// + homardGen->SetLanguageShort(_LanguageShort.toStdString().c_str()); + homardGen->SetPublisMesh(_PublisMeshIN, _PublisMeshOUT); + homardGen->SetYACSMaximum(_YACSMaxIter, _YACSMaxNode, _YACSMaxElem); +// + homardGen->SetYACSConvergenceType(_YACSTypeTest); +} + +//================================================ +void HOMARDGUI::OnGUIEvent() +//================================================ +{ + MESSAGE("OnGUIEvent()") + setOrb(); + const QObject* obj = sender(); + if ( !obj || !obj->inherits( "QAction" ) ) { return; } + int id = actionId((QAction*)obj); + if ( id != -1 ) { bool ret = OnGUIEvent( id ); } + MESSAGE("Fin de OnGUIEvent()"); +} + +//======================================================================= +// Method OnGUIEvent pour Homard +//======================================================================= +bool HOMARDGUI::OnGUIEvent (int theCommandID) +{ + MESSAGE("OnGUIEvent avec theCommandID = "<( application() ); + if ( !app ) return false; + + SalomeApp_Study* stud = dynamic_cast ( app->activeStudy() ); + if ( !stud ) + { + MESSAGE ( "FAILED to cast active study to SalomeApp_Study" ); + return false; + } + + SUIT_Desktop* parent = application()->desktop(); + + HOMARD::HOMARD_Gen_var homardGen = HOMARDGUI::InitHOMARDGen(app); + + if (!CORBA::is_nil(homardGen)) + homardGen->UpdateStudy(); + + getApp()->updateObjectBrowser(); + +// B. Choix selon les commandes + SCRUTE(theCommandID); + switch (theCommandID) + { + case 1101: // Creation d un Cas + { + MESSAGE("command " << theCommandID << " activated"); + MonCreateCase *aDlg = new MonCreateCase( true, + HOMARD::HOMARD_Gen::_duplicate(homardGen) ) ; + aDlg->show(); + break; + } + + case 1102: // Poursuite d une iteration + { + MESSAGE("command " << theCommandID << " activated"); + MonPursueIteration *aDlg = new MonPursueIteration( true, + HOMARD::HOMARD_Gen::_duplicate(homardGen) ) ; + aDlg->show(); + break; + } + + case 1103: // Creation d une Iteration + { + MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() ); + MonCreateIteration *IterDlg = new MonCreateIteration( parent, true, + HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ; + IterDlg->show(); + break; + } + + case 1111: // Compute une iteration + { + MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() ); + try { homardGen->Compute(_ObjectName.toStdString().c_str(), 0, 1, -1, 1); } + catch( SALOME::SALOME_Exception& S_ex ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr(CORBA::string_dup(S_ex.details.text)) ); + getApp()->updateObjectBrowser(); + return false; + } + break; + } + + case 1112: // Compute une iteration et publication + { + MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() ); + try { homardGen->Compute(_ObjectName.toStdString().c_str(), 0, 1, -1, 2); } + catch( SALOME::SALOME_Exception& S_ex ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr(CORBA::string_dup(S_ex.details.text)) ); + getApp()->updateObjectBrowser(); + return false; + } + break; + } + + case 1121: // Information sur le maillage de l'iteration + { + MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() ); + MonIterInfo *IterDlg = new MonIterInfo( parent, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ; + IterDlg->show(); + break; + } + + case 1131: // Publication du maillage de l'iteration + { + MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() ); + homardGen->PublishMeshIterInSmesh(_ObjectName.toStdString().c_str()); + break; + } + + case 1132: // Publication du maillage de l'iteration a partir du fichier + { + MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() ); + homardGen->PublishResultInSmesh(_ObjectName.toStdString().c_str(), 1); + break; + } + + case 1201: // Edition d'un objet + { + MESSAGE("command " << theCommandID << " activated"); + QString nomObjet = HOMARD_QT_COMMUN::SelectionArbreEtude(QString(""), 1); + if (nomObjet == QString("")) break; + _PTR(SObject) obj = chercheMonObjet(); + if (obj) + { + // Edition d'une frontiere CAO + if (HOMARD_UTILS::isBoundaryCAO(obj)) + { + MonEditBoundaryCAO *aDlg = new MonEditBoundaryCAO(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ; + aDlg->show(); + } + // Edition d'une frontiere discrete + else if (HOMARD_UTILS::isBoundaryDi(obj)) + { + MonEditBoundaryDi *aDlg = new MonEditBoundaryDi(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ; + aDlg->show(); + } + // Edition d'une frontiere analytique + else if (HOMARD_UTILS::isBoundaryAn(obj)) + { + MonEditBoundaryAn *aDlg = new MonEditBoundaryAn(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ; + aDlg->show(); + } + // Edition d'un cas + else if (HOMARD_UTILS::isCase(obj)) + { + MonEditCase *aDlg = new MonEditCase(true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ; + aDlg->show(); + } + // Edition d'une hypothese + else if (HOMARD_UTILS::isHypo(obj)) + { + MonEditHypothesis *aDlg = new MonEditHypothesis(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName, QString(""), QString("")) ; + aDlg->show(); + } + // Edition d'une iteration + else if (HOMARD_UTILS::isIter(obj)) + { + MonEditIteration *aDlg = new MonEditIteration(parent, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ; + aDlg->show(); + } + // Edition d'un schema YACS + else if (HOMARD_UTILS::isYACS(obj)) + { + MESSAGE("appel de MonEditYACS"); + MonEditYACS *aDlg = new MonEditYACS(true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName) ; + aDlg->show(); + } + // Edition d'une zone + else if (HOMARD_UTILS::isZone(obj)) + { + MonEditZone *aDlg = new MonEditZone(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ; + aDlg->show(); + } + } + break; + } + + case 1211: // Suppression d'un objet + { + MESSAGE("command " << theCommandID << " activated"); + QString nomObjet = HOMARD_QT_COMMUN::SelectionArbreEtude(QString(""), 1); + if (nomObjet == QString("")) break; + _PTR(SObject) obj = chercheMonObjet(); + if (obj) + { + // Suppression d'une frontiere + if ( HOMARD_UTILS::isBoundaryCAO(obj) || HOMARD_UTILS::isBoundaryDi(obj) || HOMARD_UTILS::isBoundaryAn(obj) ) + { + try + { homardGen->DeleteBoundary(_ObjectName.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)) ); + getApp()->updateObjectBrowser(); + return false; + } + } + // Suppression d'un cas + else if (HOMARD_UTILS::isCase(obj)) + { + try + { homardGen->DeleteCase(_ObjectName.toStdString().c_str(), 1); } + catch( SALOME::SALOME_Exception& S_ex ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr(CORBA::string_dup(S_ex.details.text)) ); + getApp()->updateObjectBrowser(); + return false; + } + } + // Suppression d'une hypothese + else if (HOMARD_UTILS::isHypo(obj)) + { + try + { homardGen->DeleteHypo(_ObjectName.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)) ); + getApp()->updateObjectBrowser(); + return false; + } + } + // Suppression d'une iteration + else if (HOMARD_UTILS::isIter(obj)) + { + try + { homardGen->DeleteIteration(_ObjectName.toStdString().c_str(), 1); } + catch( SALOME::SALOME_Exception& S_ex ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr(CORBA::string_dup(S_ex.details.text)) ); + getApp()->updateObjectBrowser(); + return false; + } + } + // Suppression d'un schema YACS + else if (HOMARD_UTILS::isYACS(obj)) + { + try + { homardGen->DeleteYACS(_ObjectName.toStdString().c_str(), 1); } + catch( SALOME::SALOME_Exception& S_ex ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr(CORBA::string_dup(S_ex.details.text)) ); + getApp()->updateObjectBrowser(); + return false; + } + } + // Suppression d'une zone + else if (HOMARD_UTILS::isZone(obj)) + { + try + { homardGen->DeleteZone(_ObjectName.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)) ); + getApp()->updateObjectBrowser(); + return false; + } + } + } + break; + } + + case 1301: // Information sur un maillage + { + MESSAGE("etape 1301") + MESSAGE("command " << theCommandID << " activated"); + MonMeshInfo *aDlg = new MonMeshInfo( parent, true, HOMARD::HOMARD_Gen::_duplicate(homardGen) ) ; + aDlg->show(); + break; + } + + case 1302: // Affichage de fichier texte + { + MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() ); + _PTR(SObject) obj = chercheMonObjet(); + if ( (obj) && ( HOMARD_UTILS::isFileType(obj,QString("log")) || HOMARD_UTILS::isFileType(obj,QString("Summary")) || HOMARD_UTILS::isFileType(obj,QString("xml")) ) ) + { + MonEditFile *aDlg = new MonEditFile( 0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName, 0 ) ; + if ( aDlg->_codret == 0 ) { aDlg->show(); } + } + break; + } + + case 1401: // Création d'un schema YACS + { + MESSAGE("etape 1401") + MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() ); + MonCreateYACS *aDlg = new MonCreateYACS( true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ; + aDlg->show(); + break; + } + + case 1402: // Ecriture d'un schéma YACS + { + MESSAGE("etape 1402") + MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() ); + try { homardGen->YACSWrite(_ObjectName.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)) ); + getApp()->updateObjectBrowser(); + return false; + } + break; + } + + } + getApp()->updateObjectBrowser(); + return true; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +// Module's engine IOR +//============================================================================= +QString HOMARDGUI::engineIOR() const +//============================================================================= +{ + CORBA::String_var anIOR = getApp()->orb()->object_to_string( InitHOMARDGen(getApp()) ); + return QString( anIOR.in() ); +} + +// Module's activation +//============================================================================= +bool HOMARDGUI::activateModule( SUIT_Study* theStudy ) +//============================================================================= +{ + bool bOk = SalomeApp_Module::activateModule( theStudy ); + + setMenuShown( true ); + setToolShown( true ); + + return bOk; +} + +// Module's deactivation +//============================================================================= +bool HOMARDGUI::deactivateModule( SUIT_Study* theStudy ) +//============================================================================= +{ + setMenuShown( false ); + setToolShown( false ); + + return SalomeApp_Module::deactivateModule( theStudy ); +} + +// Default windows +//============================================================================= +void HOMARDGUI::windows( QMap& theMap ) const +//============================================================================= +{ + theMap.clear(); + theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea ); +#ifndef DISABLE_PYCONSOLE + theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea ); +#endif +} + +//============================================================================= +void HOMARDGUI::setOrb() +//============================================================================= +{ + try + { + ORB_INIT &init = *SINGLETON_::Instance(); + ASSERT(SINGLETON_::IsAlreadyExisting()); + _orb = init( 0 , 0 ); + } + catch (...) + { + INFOS("internal error : orb not found"); + _orb = 0; + } + ASSERT(! CORBA::is_nil(_orb)); +} +//======================================== +_PTR(SObject) HOMARDGUI::chercheMonObjet() +//======================================== +{ + SALOMEDSClient_SObject* aSO = NULL; + _PTR(SObject) obj; + SALOME_ListIO lst; + getApp()->selectionMgr()->selectedObjects( lst ); + if ( lst.Extent() == 1 ) + { + Handle(SALOME_InteractiveObject) io = lst.First(); + SalomeApp_Study* appStudy = dynamic_cast( application()->activeStudy() ); + _PTR(Study) study = appStudy->studyDS(); + _PTR(SObject) obj = study->FindObjectID( io->getEntry() ); + _ObjectName = QString( obj->GetName().c_str() ); + return obj; + } + else { return _PTR(SObject)(aSO); } +} +//============================================================================= +void HOMARDGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& title ) +//============================================================================= +{ + MESSAGE("Debut de contextMenuPopup"); + _PTR(SObject) obj = chercheMonObjet(); + if ( obj ) + { + title = QString( obj->GetName().c_str() ); + _ObjectName = title; + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); +// + QPixmap pix ; + bool DeleteObject = false ; + bool EditObject = false ; +// + if ( HOMARD_UTILS::isBoundaryCAO(obj) ) + { + EditObject = true ; + DeleteObject = true ; + } + else if ( HOMARD_UTILS::isBoundaryAn(obj) ) + { + EditObject = true ; + DeleteObject = true ; + } + else if ( HOMARD_UTILS::isBoundaryDi(obj) ) + { + EditObject = true ; + DeleteObject = true ; + } + else if ( HOMARD_UTILS::isCase(obj) ) + { + pix = resMgr->loadPixmap( "HOMARD", "table_view.png" ); + menu->addAction(QIcon(pix), tr(QString("HOM_MEN_YACS").toLatin1().data()), this, SLOT(YACSCreate())); + EditObject = true ; + DeleteObject = true ; + } + else if ( HOMARD_UTILS::isHypo(obj) ) + { + EditObject = true ; + DeleteObject = true ; + } + else if ( HOMARD_UTILS::isIter(obj) ) + { + pix = resMgr->loadPixmap( "HOMARD", "iter_next.png" ); + menu->addAction(QIcon(pix), tr(QString("HOM_MEN_NEW_ITERATION").toLatin1().data()), this, SLOT(NextIter())); + pix = resMgr->loadPixmap( "HOMARD", "mesh_compute.png" ); + menu->addAction(QIcon(pix), tr(QString("HOM_MEN_COMPUTE").toLatin1().data()), this, SLOT(LanceCalcul0())); + pix = resMgr->loadPixmap( "HOMARD", "mesh_compute.png" ); + menu->addAction(QIcon(pix), tr(QString("HOM_MEN_COMPUTE_PUBLISH").toLatin1().data()), this, SLOT(LanceCalcul1())); + pix = resMgr->loadPixmap( "HOMARD", "advanced_mesh_info.png" ); + menu->addAction(QIcon(pix), tr(QString("HOM_MEN_MESH_INFO").toLatin1().data()), this, SLOT(IterInfo())); + pix = resMgr->loadPixmap( "HOMARD", "mesh_tree_mesh.png" ); + menu->addAction(QIcon(pix), tr(QString("HOM_MEN_MESH_PUBLICATION").toLatin1().data()), this, SLOT(MeshPublish0())); + EditObject = true ; + DeleteObject = true ; + } + else if ( HOMARD_UTILS::isYACS(obj) ) + { + pix = resMgr->loadPixmap( "HOMARD", "write.png" ); + menu->addAction(QIcon(pix), tr(QString("HOM_MEN_WRITE").toLatin1().data()), this, SLOT(YACSWrite())); + EditObject = true ; + DeleteObject = true ; + } + else if ( HOMARD_UTILS::isZone(obj) ) + { + EditObject = true ; + DeleteObject = true ; + } + else if ( HOMARD_UTILS::isFileType(obj,QString("log")) || HOMARD_UTILS::isFileType(obj,QString("Summary")) || HOMARD_UTILS::isFileType(obj,QString("xml")) ) + { + pix = resMgr->loadPixmap( "HOMARD", "texte.png" ); + menu->addAction(QIcon(pix), tr(QString("HOM_MEN_EDIT_MESS_FILE").toLatin1().data()), this, SLOT(EditAsciiFile())); + } + else if ( HOMARD_UTILS::isFileType(obj,QString("Mesh")) ) + { + pix = resMgr->loadPixmap( "HOMARD", "mesh_tree_mesh.png" ); + menu->addAction(QIcon(pix), tr(QString("HOM_MEN_MESH_PUBLICATION").toLatin1().data()), this, SLOT(MeshPublish1())); + } +// Ajout d'un menu d'edition pour les objets qui le proposent + if ( EditObject ) + { + pix = resMgr->loadPixmap( "HOMARD", "loop.png" ); + menu->addAction(QIcon(pix), tr(QString("HOM_MEN_EDIT").toLatin1().data()), this, SLOT(Edit())); + } +// Ajout d'un menu de destruction pour les objets qui le proposent + if ( DeleteObject ) + { + pix = resMgr->loadPixmap( "HOMARD", "delete.png" ); + menu->addAction(QIcon(pix), tr(QString("HOM_MEN_DELETE").toLatin1().data()), this, SLOT(Delete())); + } + } +} + +void HOMARDGUI::NextIter() +{ + this->OnGUIEvent(1103); +} + +void HOMARDGUI::LanceCalcul0() +{ + this->OnGUIEvent(1111); +} + +void HOMARDGUI::LanceCalcul1() +{ + this->OnGUIEvent(1112); +} + +void HOMARDGUI::IterInfo() +{ + this->OnGUIEvent(1121); +} + +void HOMARDGUI::MeshPublish0() +{ + this->OnGUIEvent(1131); +} + +void HOMARDGUI::MeshPublish1() +{ + this->OnGUIEvent(1132); +} + +void HOMARDGUI::Edit() +{ + this->OnGUIEvent(1201); +} + +void HOMARDGUI::Delete() +{ + this->OnGUIEvent(1211); +} + +void HOMARDGUI::EditAsciiFile() +{ + this->OnGUIEvent(1302); +} + +void HOMARDGUI::YACSCreate() +{ + this->OnGUIEvent(1401); +} +void HOMARDGUI::YACSWrite() +{ + this->OnGUIEvent(1402); +} + + +// +//============================================================================= +// Export the module +//============================================================================= +extern "C" { + Standard_EXPORT CAM_Module* createModule() + { + return new HOMARDGUI(""); + } +} + diff --git a/src/ADAPTGUI/HOMARDGUI.h b/src/ADAPTGUI/HOMARDGUI.h new file mode 100644 index 000000000..0c0a36bdd --- /dev/null +++ b/src/ADAPTGUI/HOMARDGUI.h @@ -0,0 +1,105 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// HOMARDGUI : HOMARD component GUI implemetation +// + +#ifndef _HOMARDGUI_H_ +#define _HOMARDGUI_H_ + +#include "HOMARDGUI_Exports.hxx" + +#include +#include "SalomeApp_Study.h" + +#include +#include +#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(HOMARD_Cas) +#include CORBA_CLIENT_HEADER(HOMARD_Hypothesis) + +#include + +class SalomeApp_Application; + +class HOMARD_EXPORT HOMARDGUI: public SalomeApp_Module +{ + Q_OBJECT + +public: + HOMARDGUI(const QString&); + ~HOMARDGUI(); + + + + virtual bool OnGUIEvent (int theCommandID); + void initialize( CAM_Application* ); + QString engineIOR() const; + void windows( QMap& ) const; + + static HOMARD::HOMARD_Gen_var InitHOMARDGen(SalomeApp_Application* ); + + +public slots: + bool deactivateModule( SUIT_Study* ); + bool activateModule( SUIT_Study* ); + static void setOrb(); + +private slots: + void OnGUIEvent(); + void EditAsciiFile(); + void LanceCalcul0(); + void LanceCalcul1(); + void IterInfo(); + void NextIter(); + void MeshPublish0(); + void MeshPublish1(); + void YACSCreate(); + void YACSWrite(); + void Edit(); + void Delete(); + +public: + virtual void contextMenuPopup( const QString&, QMenu*, QString& ); + + +private: + void createHOMARDAction( const int id, const QString& po_id, const QString& icon_id = QString(""), + const int key = 0, const bool toggle = false ); + void createActions(); + void createMenus(); + void recupPreferences(); + void createPopupMenus(); + _PTR(SObject) chercheMonObjet(); + + virtual void createPreferences(); + HOMARD::HOMARD_Gen_var myComponentHomard; + + int anId; + QString _ObjectName; + QString _LanguageShort ; + int _PublisMeshIN ; + int _PublisMeshOUT ; + int _YACSMaxIter ; + int _YACSMaxNode ; + int _YACSMaxElem ; + int _YACSTypeTest ; +}; + +#endif diff --git a/src/ADAPTGUI/HOMARDGUI_Exports.hxx b/src/ADAPTGUI/HOMARDGUI_Exports.hxx new file mode 100644 index 000000000..193b8124b --- /dev/null +++ b/src/ADAPTGUI/HOMARDGUI_Exports.hxx @@ -0,0 +1,35 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef _HOMARDGUI_EXPORTS_H_ +#define _HOMARDGUI_EXPORTS_H_ + +#ifdef WIN32 + #if defined HOMARD_EXPORTS || defined Homard_EXPORTS + #define HOMARD_EXPORT __declspec( dllexport ) + #else + #define HOMARD_EXPORT __declspec( dllimport ) + #endif +#else + #define HOMARD_EXPORT +#endif + + +#endif //_HOMARDGUI_EXPORTS_H_ + diff --git a/src/ADAPTGUI/HOMARDGUI_Utils.cxx b/src/ADAPTGUI/HOMARDGUI_Utils.cxx new file mode 100644 index 000000000..f57ed0ef9 --- /dev/null +++ b/src/ADAPTGUI/HOMARDGUI_Utils.cxx @@ -0,0 +1,278 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + + +#include "HOMARDGUI_Utils.h" + +#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 "utilities.h" +#include +#include + + +#include +#include +#include +#ifndef WIN32 +#include +#endif + +SALOME_ListIO HOMARD_UTILS::mySelected; + +//================================================================ +// Function : GetActiveStudy +// Returne un pointeur sur l'etude active +//================================================================ +SUIT_Study* 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) 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 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( "--- HOMARD::updateObjBrowser: appMod = NULL"); + } +} + +//================================================================ +// Function : selectedIO +// Return the list of selected SALOME_InteractiveObject's +//================================================================ +const SALOME_ListIO& 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 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) 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) 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 HOMARD_UTILS::isObject(_PTR(SObject) MonObj, QString TypeObject, int option) +{ +// MESSAGE("isObject, TypeObject = "<Value().c_str()); +// MESSAGE("Type = "<moduleName(aHomardGUI->moduleName()) : QString("") ; + // WARNING/ATTENTION : si on savait recuperer la langue depuis les preferences, on ne ferait pas le passage par argument +// SUIT_ResourceMgr* resMgr = getApp()->resourceMgr(); +// SUIT_ResourceMgr* resMgr = myModule->getApp()->resourceMgr(); +// QString langue = resMgr->stringValue("language", "language", "en"); +// QString langue = "fr" ; + MESSAGE(". LanguageShort " << LanguageShort.toStdString().c_str()) ; + // Complement du fichier + QString fichier = QString(LanguageShort+"/"+monFichierAide) ; + MESSAGE(". Appel de onHelpContextModule avec :"); + MESSAGE(" rep = "<< rep.toStdString().c_str()); + MESSAGE(" fichier = "<< fichier.toStdString().c_str()); + MESSAGE(" contexte = "<< contexte.toStdString().c_str()); + + app->onHelpContextModule(rep, fichier, contexte); + } +} +//========================================================================================================= diff --git a/src/ADAPTGUI/HOMARDGUI_Utils.h b/src/ADAPTGUI/HOMARDGUI_Utils.h new file mode 100644 index 000000000..d257dbb6f --- /dev/null +++ b/src/ADAPTGUI/HOMARDGUI_Utils.h @@ -0,0 +1,90 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef HOMARD_H_UTILS +#define HOMARD_H_UTILS + +#include "HOMARDGUI_Exports.hxx" + +#include + +#include +#include CORBA_CLIENT_HEADER(HOMARD_Cas) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) + +#include "SALOMEDSClient_definitions.hxx" +#include "SALOME_InteractiveObject.hxx" +#include "LightApp_DataOwner.h" +#include "SalomeApp_Application.h" +#include + +class QString; +class QStringList; + +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 HOMARD_UTILS { + + HOMARD_EXPORT SUIT_Study* GetActiveStudy(); + HOMARD_EXPORT _PTR(Study) getStudy(); + + HOMARD_EXPORT void updateObjBrowser(); + + HOMARD_EXPORT const SALOME_ListIO& selectedIO(); // Function returns a list of SALOME_InteractiveObject's from + // selection manager in GUI + + HOMARD_EXPORT int IObjectCount() ; // Function returns the number of selected objects + + HOMARD_EXPORT Handle(SALOME_InteractiveObject) firstIObject() ; + // Function returns the first selected object in the list + // of selected objects + + HOMARD_EXPORT Handle(SALOME_InteractiveObject) lastIObject() ; + // Function returns the last selected object in the list + // of selected objects + + HOMARD_EXPORT bool isBoundaryCAO(_PTR(SObject) MonObj); + HOMARD_EXPORT bool isBoundaryAn(_PTR(SObject) MonObj); + HOMARD_EXPORT bool isBoundaryDi(_PTR(SObject) MonObj); + HOMARD_EXPORT bool isCase(_PTR(SObject) MonObj); + HOMARD_EXPORT bool isHypo(_PTR(SObject) MonObj); + HOMARD_EXPORT bool isIter(_PTR(SObject) MonObj); + HOMARD_EXPORT bool isYACS(_PTR(SObject) MonObj); + HOMARD_EXPORT bool isZone(_PTR(SObject) MonObj); + HOMARD_EXPORT bool isFileType(_PTR(SObject) MonObj, QString TypeFile); + HOMARD_EXPORT bool isObject(_PTR(SObject) MonObj, QString TypeObject, int option ); + + HOMARD_EXPORT void PushOnHelp(QString monFichierAide, QString contexte, QString LanguageShort); + + extern SALOME_ListIO mySelected; +} + +#endif // ifndef HOMARD_H_UTILS diff --git a/src/ADAPTGUI/HomardQtCommun.cxx b/src/ADAPTGUI/HomardQtCommun.cxx new file mode 100644 index 000000000..a5762d03f --- /dev/null +++ b/src/ADAPTGUI/HomardQtCommun.cxx @@ -0,0 +1,453 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "HomardQtCommun.h" +#include "HOMARDGUI_Utils.h" + +#include + +#include +#include +#include +#include +#include +#ifndef WIN32 +#include +#endif +#include + + +#include "SalomeApp_Tools.h" + +using namespace std; + +#include + +// ============================================================================ +QString HOMARD_QT_COMMUN::SelectionArbreEtude(QString commentaire, int option ) +// ============================================================================ +// Retourne l'objet selectionne dans l'arbre d'etudes +// commentaire : +// . si le commentaire est une chaine vide, on ne tient pas compte du type de l'objet +// et on retourne le nom de cet objet +// . sinon : +// . si l'objet est du type defini par commentaire, retourne le nom de cet objet +// . sinon on retourne une QString("") +// option : +// . Si option = 0, ce n'est pas grave de ne rien trouver ; aucun message n'est emis +// . Si option = 1, ce n'est pas grave de ne rien trouver mais on emet un message +{ +// MESSAGE("SelectionArbreEtude : commentaire = " << commentaire.toStdString().c_str() << " et option = " << option); + int nbSel = HOMARD_UTILS::IObjectCount() ; + if ( nbSel == 0 ) + { + if ( option == 1 ) + { + QMessageBox::warning( 0, QObject::tr("HOM_WARNING"), + 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 = HOMARD_UTILS::firstIObject(); + if ( aIO->hasEntry() ) + { +// MESSAGE("aIO->getEntry() = " << aIO->getEntry()); + _PTR(Study) aStudy = 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 HOMARD_QT_COMMUN::SelectionCasEtude() +// ======================================================================= +{ + QString aName = QString(""); + int nbSel = 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 = HOMARD_UTILS::firstIObject(); + if ( aIO->hasEntry() ) + { + _PTR(Study) aStudy = 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 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 = 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 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 HOMARD_QT_COMMUN::LireNomMaillage(QString aFile) +// ======================================================== +{ + QString nomMaillage = "" ; + int erreur = 0 ; + med_idt medIdt ; + while ( erreur == 0 ) + { + // Ouverture du fichier + medIdt = 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 = HOMARD_QT_COMMUN::LireNomMaillage2(medIdt,1); + break ; + } + // Fermeture du fichier + if ( medIdt > 0 ) MEDfileClose(medIdt); + + return nomMaillage; +} +// ======================================================================= +QString 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 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 = 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 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 = 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/ADAPTGUI/HomardQtCommun.h b/src/ADAPTGUI/HomardQtCommun.h new file mode 100644 index 000000000..4587833e2 --- /dev/null +++ b/src/ADAPTGUI/HomardQtCommun.h @@ -0,0 +1,58 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef HOMARDQTCOMMUN_H +#define HOMARDQTCOMMUN_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include "SALOME_Selection.h" +#include + +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(HOMARD_Cas) + +#include +#include +#include + +class QComboBox; + + +namespace HOMARD_QT_COMMUN +{ + HOMARD_EXPORT QString PushNomFichier(bool avertir, QString TypeFichier=""); + HOMARD_EXPORT QString LireNomMaillage(QString aFile); + HOMARD_EXPORT QString LireNomMaillage2(med_idt Medidt,int MeshId); + + HOMARD_EXPORT med_idt OuvrirFichier(QString aFile); + + HOMARD_EXPORT std::list GetListeChamps(QString aFile); + HOMARD_EXPORT std::list GetListeComposants(QString aFile, QString aChamp); + + HOMARD_EXPORT QString SelectionArbreEtude(QString commentaire, int grave ); + HOMARD_EXPORT QString SelectionCasEtude(); + +}; + +#endif // HOMARDQTCOMMUN_H diff --git a/src/ADAPTGUI/IterInfo.ui b/src/ADAPTGUI/IterInfo.ui new file mode 100644 index 000000000..04b2664ae --- /dev/null +++ b/src/ADAPTGUI/IterInfo.ui @@ -0,0 +1,129 @@ + + + IterInfo + + + + 0 + 0 + 420 + 220 + + + + + 0 + 0 + + + + Information on a mesh + + + true + + + + + + Options + + + + + + Quality + + + + + + + Connection + + + + + + + Diametre + + + + + + + Group size + + + + + + + Entanglement + + + + + + + + + + + + + + 9 + + + 6 + + + + + Help + + + false + + + + + + + Apply + + + false + + + + + + + OK + + + false + + + + + + + Cancel + + + false + + + + + + + + + + + diff --git a/src/ADAPTGUI/MeshInfo.ui b/src/ADAPTGUI/MeshInfo.ui new file mode 100644 index 000000000..c3e55aa07 --- /dev/null +++ b/src/ADAPTGUI/MeshInfo.ui @@ -0,0 +1,285 @@ + + + MeshInfo + + + + 0 + 0 + 536 + 372 + + + + + 0 + 0 + + + + Information on a mesh + + + true + + + + + + 6 + + + 0 + + + + + Name + + + + + + + + 382 + 21 + + + + + + + + + + 6 + + + 0 + + + + + Directory + + + + + + + + + + false + + + + + + + + 382 + 21 + + + + + + + + + + Qt::Vertical + + + + 20 + 18 + + + + + + + + 6 + + + 0 + + + + + Mesh + + + + + + + + + + false + + + + + + + + 382 + 21 + + + + + + + + + + Qt::Vertical + + + + 20 + 1 + + + + + + + + Options + + + + + + Quality + + + + + + + Connection + + + + + + + Diametre + + + + + + + Group size + + + + + + + Entanglement + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + 9 + + + 6 + + + + + Help + + + false + + + + + + + Apply + + + false + + + + + + + OK + + + false + + + + + + + Cancel + + + false + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 128 + 25 + + + + + + + + + diff --git a/src/ADAPTGUI/MonCreateBoundaryAn.cxx b/src/ADAPTGUI/MonCreateBoundaryAn.cxx new file mode 100644 index 000000000..40fa47f4b --- /dev/null +++ b/src/ADAPTGUI/MonCreateBoundaryAn.cxx @@ -0,0 +1,809 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonCreateBoundaryAn.h" +#include "MonCreateCase.h" + +#include +#include + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include + +#include +#include +#include +#include +#include + +#include "math.h" +#define PI 3.141592653589793 + +using namespace std; + +// ------------------------------------------------------------------------------------------------------------------------ +MonCreateBoundaryAn::MonCreateBoundaryAn(MonCreateCase* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName) : +// ------------------------------------------------------------------------------------------------------------------------------ +/* Constructs a MonCreateBoundaryAn + appele pour une vraie creation + initialise un cylindre et non une sphere +*/ + QDialog(0), Ui_CreateBoundaryAn(), + _parent(parent), + _Name (""), + _aCaseName(caseName), + _Xmin(0), _Xmax(0), _Xincr(0), _Ymin(0), _Ymax(0), _Yincr(0), _Zmin(0), _Zmax(0), _Zincr(0), _DMax(0), + _Type(1), + _BoundaryAnXcentre(0), _BoundaryAnYcentre(0), _BoundaryAnZcentre(0), _BoundaryAnRayon(0), + _BoundaryAnXaxis(0), _BoundaryAnYaxis(0), _BoundaryAnZaxis(0), + _Xcentre(0), _Ycentre(0), _Zcentre(0), _Rayon(0), + _BoundaryAnXcone1(0), _BoundaryAnYcone1(0), _BoundaryAnZcone1(0), _BoundaryAnRayon1(0), + _BoundaryAnXcone2(0), _BoundaryAnYcone2(0), _BoundaryAnZcone2(0), _BoundaryAnRayon2(0), + _BoundaryAnXaxisCone(0), _BoundaryAnYaxisCone(0), _BoundaryAnZaxisCone(0), + _BoundaryAngle(0), + _BoundaryAnToreXcentre(0), _BoundaryAnToreYcentre(0), _BoundaryAnToreZcentre(0), + _BoundaryAnToreXaxe(0), _BoundaryAnToreYaxe(0), _BoundaryAnToreZaxe(0), + _BoundaryAnToreRRev(0), _BoundaryAnToreRPri(0), + Chgt (false) + { + MESSAGE("Constructeur") ; + myHomardGen=HOMARD::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 + } +// -------------------------------------------------------------------------------------------------------------- +MonCreateBoundaryAn::MonCreateBoundaryAn(MonCreateCase* parent, + HOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName): +// -------------------------------------------------------------------------------------------------------------- +// + QDialog(0), Ui_CreateBoundaryAn(), + myHomardGen(myHomardGen0), + _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) + { + // MESSAGE("Debut de MonCreateBoundaryAn") + 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(); + } + +// ------------------------------------------------------------------------ +MonCreateBoundaryAn::~MonCreateBoundaryAn() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void MonCreateBoundaryAn::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 MonCreateBoundaryAn::InitValBoundaryAn() +// ------------------------------------------------------------------------ +{ +// +// 1. Les coordonnees extremes du maillage +// + if (_aCaseName == QString("")) { return; } + + HOMARD::HOMARD_Cas_var aCas = myHomardGen->GetCase(_aCaseName.toStdString().c_str()); + HOMARD::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 MonCreateBoundaryAn::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 MonCreateBoundaryAn::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 MonCreateBoundaryAn::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 MonCreateBoundaryAn::PushOnOK() +// ------------------------------------------------------------------------ +{ + if (PushOnApply()) this->close(); +} +// ------------------------------------------------------------------------ +void MonCreateBoundaryAn::PushOnHelp() +// ------------------------------------------------------------------------ +{ + std::string LanguageShort = myHomardGen->GetLanguageShort(); + HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("un-cylindre"), QString(LanguageShort.c_str())); +} + +// ----------------------------------- +void MonCreateBoundaryAn::SetNewName() +// ----------------------------------- +{ +// Recherche d'un nom par defaut qui n'existe pas encore + + HOMARD::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 MonCreateBoundaryAn::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 MonCreateBoundaryAn::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 MonCreateBoundaryAn::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 MonCreateBoundaryAn::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 MonCreateBoundaryAn::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 MonCreateBoundaryAn::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 MonCreateBoundaryAn::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") +} + + diff --git a/src/ADAPTGUI/MonCreateBoundaryAn.h b/src/ADAPTGUI/MonCreateBoundaryAn.h new file mode 100644 index 000000000..46c838ac9 --- /dev/null +++ b/src/ADAPTGUI/MonCreateBoundaryAn.h @@ -0,0 +1,96 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_CREATEBOUNDARYAN_H +#define MON_CREATEBOUNDARYAN_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(HOMARD_Boundary) + +#include "ui_CreateBoundaryAn.h" +#include + +class MonCreateCase; +class HOMARD_EXPORT MonCreateBoundaryAn : public QDialog, public Ui_CreateBoundaryAn +{ + Q_OBJECT + +public: + MonCreateBoundaryAn( MonCreateCase* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString caseName); + virtual ~MonCreateBoundaryAn(); + +protected : + MonCreateBoundaryAn( MonCreateCase* parent, + HOMARD::HOMARD_Gen_var myHomardGen, + QString caseName); + + MonCreateCase * _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; + + HOMARD::HOMARD_Boundary_var aBoundaryAn ; + HOMARD::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(); + +}; + +#endif // MON_CREATEBOUNDARYAN_H diff --git a/src/ADAPTGUI/MonCreateBoundaryCAO.cxx b/src/ADAPTGUI/MonCreateBoundaryCAO.cxx new file mode 100644 index 000000000..da07e84a5 --- /dev/null +++ b/src/ADAPTGUI/MonCreateBoundaryCAO.cxx @@ -0,0 +1,202 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonCreateBoundaryCAO.h" +#include "MonCreateListGroupCAO.h" +#include "MonCreateCase.h" + +#include +#include + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include + +using namespace std; + +// ------------------------------------------------------------------------------- +MonCreateBoundaryCAO::MonCreateBoundaryCAO(MonCreateCase* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName, QString aName) +// --------------------------------------------------------------------------------- +/* Constructs a MonCreateBoundaryCAO */ + : + QDialog(0), Ui_CreateBoundaryCAO(), + _parent(parent), _aName(aName), + myHomardGen(HOMARD::HOMARD_Gen::_duplicate(myHomardGen0)), + _aCaseName(caseName) + { + MESSAGE("Constructeur") ; + setupUi(this); + setModal(modal); + InitConnect(); + + if ( _aName == QString("") ) {SetNewName();}; + } + +// ------------------------------------------------------------------------ +MonCreateBoundaryCAO::~MonCreateBoundaryCAO() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void MonCreateBoundaryCAO::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 MonCreateBoundaryCAO::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 MonCreateBoundaryCAO::PushOnOK() +// ------------------------------------------------------------------------ +{ + if (PushOnApply()) this->close(); + if ( _parent ) { _parent->raise(); _parent->activateWindow(); }; +} +// ------------------------------------------------------------------------ +void MonCreateBoundaryCAO::PushOnHelp() +// ------------------------------------------------------------------------ +{ + std::string LanguageShort = myHomardGen->GetLanguageShort(); + HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("CAO"), QString(LanguageShort.c_str())); +} +// ------------------------------------------------------------------------ +void MonCreateBoundaryCAO::AssocieLesGroupes() +// ------------------------------------------------------------------------ +{ + HOMARD::ListGroupType_var aSeqGroupe = new HOMARD::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 MonCreateBoundaryCAO::SetNewName() +// -------------------------------------------------- +{ + + HOMARD::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 MonCreateBoundaryCAO::SetCAOFile() +// ------------------------------------------------------------------------ +{ + QString aCAOFile = HOMARD_QT_COMMUN::PushNomFichier( false, QString("xao") ); + if (!(aCAOFile.isEmpty())) LEFileName->setText(aCAOFile); +} + +// ------------------------------------------------------------------------ +void MonCreateBoundaryCAO::setGroups (QStringList listGroup) +// ------------------------------------------------------------------------ +{ + _listeGroupesBoundary = listGroup; +} +// ------------------------------------------------------------------------ +void MonCreateBoundaryCAO::SetFiltrage() +// // ------------------------------------------------------------------------ +{ + if (!CBGroupe->isChecked()) return; + if (_aCaseName.toStdString().c_str() == QString()) { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_BOUN_CASE") ); + return; + } + + MonCreateListGroupCAO *aDlg = new MonCreateListGroupCAO(NULL, this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), + _aCaseName, _listeGroupesBoundary) ; + aDlg->show(); +} + diff --git a/src/ADAPTGUI/MonCreateBoundaryCAO.h b/src/ADAPTGUI/MonCreateBoundaryCAO.h new file mode 100644 index 000000000..1b6eff095 --- /dev/null +++ b/src/ADAPTGUI/MonCreateBoundaryCAO.h @@ -0,0 +1,73 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_CREATEBOUNDARYCAO_H +#define MON_CREATEBOUNDARYCAO_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(HOMARD_Boundary) + +#include "ui_CreateBoundaryCAO.h" +#include + +class MonCreateCase; +class HOMARD_EXPORT MonCreateBoundaryCAO : public QDialog, public Ui_CreateBoundaryCAO +{ + Q_OBJECT + +public: + MonCreateBoundaryCAO( MonCreateCase* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString caseName, QString BoundaryName ); + ~MonCreateBoundaryCAO(); + virtual void setGroups (QStringList listGroup); + +protected : + + MonCreateCase *_parent; + + QString _aName; + QString _aCaseName; + + + HOMARD::HOMARD_Boundary_var aBoundary; + HOMARD::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(); +}; + +#endif // MON_CREATEBOUNDARYCAO_H diff --git a/src/ADAPTGUI/MonCreateBoundaryDi.cxx b/src/ADAPTGUI/MonCreateBoundaryDi.cxx new file mode 100644 index 000000000..f61b7653f --- /dev/null +++ b/src/ADAPTGUI/MonCreateBoundaryDi.cxx @@ -0,0 +1,211 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonCreateBoundaryDi.h" +#include "MonCreateListGroup.h" +#include "MonCreateCase.h" + +#include +#include + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include + +using namespace std; + +// ------------------------------------------------------------------------------- +MonCreateBoundaryDi::MonCreateBoundaryDi(MonCreateCase* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName, QString aName) +// --------------------------------------------------------------------------------- +/* Constructs a MonCreateBoundaryDi */ + : + QDialog(0), Ui_CreateBoundaryDi(), + _parent(parent), _aName(aName), + myHomardGen(HOMARD::HOMARD_Gen::_duplicate(myHomardGen0)), + _aCaseName(caseName) + { + MESSAGE("Constructeur") ; + setupUi(this); + setModal(modal); + InitConnect(); + + if ( _aName == QString("") ) {SetNewName();}; + } + +// ------------------------------------------------------------------------ +MonCreateBoundaryDi::~MonCreateBoundaryDi() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void MonCreateBoundaryDi::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 MonCreateBoundaryDi::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 = 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 MonCreateBoundaryDi::PushOnOK() +// ------------------------------------------------------------------------ +{ + if (PushOnApply()) this->close(); + if ( _parent ) { _parent->raise(); _parent->activateWindow(); }; +} +// ------------------------------------------------------------------------ +void MonCreateBoundaryDi::PushOnHelp() +// ------------------------------------------------------------------------ +{ + std::string LanguageShort = myHomardGen->GetLanguageShort(); + HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("frontiere-discrete"), QString(LanguageShort.c_str())); +} +// ------------------------------------------------------------------------ +void MonCreateBoundaryDi::AssocieLesGroupes() +// ------------------------------------------------------------------------ +{ + HOMARD::ListGroupType_var aSeqGroupe = new HOMARD::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 MonCreateBoundaryDi::SetNewName() +// -------------------------------------------------- +{ + + HOMARD::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 MonCreateBoundaryDi::SetMeshFile() +// ------------------------------------------------------------------------ +{ + QString aMeshFile = HOMARD_QT_COMMUN::PushNomFichier( false, QString("med") ); + if (!(aMeshFile.isEmpty())) LEFileName->setText(aMeshFile); +} + +// ------------------------------------------------------------------------ +void MonCreateBoundaryDi::setGroups (QStringList listGroup) +// ------------------------------------------------------------------------ +{ + _listeGroupesBoundary = listGroup; +} +// ------------------------------------------------------------------------ +void MonCreateBoundaryDi::SetFiltrage() +// // ------------------------------------------------------------------------ +{ + if (!CBGroupe->isChecked()) return; + if (_aCaseName.toStdString().c_str() == QString()) { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_BOUN_CASE") ); + return; + } + + MonCreateListGroup *aDlg = new MonCreateListGroup(NULL, this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), + _aCaseName, _listeGroupesBoundary) ; + aDlg->show(); +} + diff --git a/src/ADAPTGUI/MonCreateBoundaryDi.h b/src/ADAPTGUI/MonCreateBoundaryDi.h new file mode 100644 index 000000000..b81ef6a7c --- /dev/null +++ b/src/ADAPTGUI/MonCreateBoundaryDi.h @@ -0,0 +1,73 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_CREATEBOUNDARYDI_H +#define MON_CREATEBOUNDARYDI_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(HOMARD_Boundary) + +#include "ui_CreateBoundaryDi.h" +#include + +class MonCreateCase; +class HOMARD_EXPORT MonCreateBoundaryDi : public QDialog, public Ui_CreateBoundaryDi +{ + Q_OBJECT + +public: + MonCreateBoundaryDi( MonCreateCase* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString caseName, QString BoundaryName ); + ~MonCreateBoundaryDi(); + virtual void setGroups (QStringList listGroup); + +protected : + + MonCreateCase *_parent; + + QString _aName; + QString _aCaseName; + + + HOMARD::HOMARD_Boundary_var aBoundary; + HOMARD::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(); +}; + +#endif // MON_CREATEBOUNDARYDI_H diff --git a/src/ADAPTGUI/MonCreateCase.cxx b/src/ADAPTGUI/MonCreateCase.cxx new file mode 100644 index 000000000..fa451efa7 --- /dev/null +++ b/src/ADAPTGUI/MonCreateCase.cxx @@ -0,0 +1,694 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonCreateCase.h" +#include "MonCreateBoundaryCAO.h" +#include "MonEditBoundaryCAO.h" +#include "MonCreateBoundaryAn.h" +#include "MonEditBoundaryAn.h" +#include "MonCreateBoundaryDi.h" +#include "MonEditBoundaryDi.h" +#include "HOMARD.hxx" + +#include +#include + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include + +#ifdef WIN32 +#include +#endif + +using namespace std; + +// ----------------------------------------------------------------------------------------- +/* Constructs a MonCreateCase + * Inherits from CasHomard + * Sets attributes to default values + */ +// ----------------------------------------------------------------------------------------- +MonCreateCase::MonCreateCase( bool modal, HOMARD::HOMARD_Gen_var myHomardGen0 ) + : + Ui_CreateCase(), + _aCaseName(""),_aDirName(""), + _ConfType(0), + _ExtType(0), + _Pyram(0) +{ + MESSAGE("Debut du constructeur de MonCreateCase"); + myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + setupUi(this); + setModal(modal); + InitConnect(); + + SetNewName() ; + + GBBoundaryC->setVisible(0); + GBBoundaryA->setVisible(0); + GBBoundaryD->setVisible(0); + + CBBoundaryA->setVisible(0); + CBBoundaryD->setVisible(0); + + GBAdvancedOptions->setVisible(0); + Comment->setVisible(0); + CBPyramid->setChecked(false); +// + adjustSize(); + +// MESSAGE("Fin du constructeur de MonCreateCase"); +} +// ------------------------------------------------------------------------ +MonCreateCase::~MonCreateCase() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void MonCreateCase::InitConnect() +// ------------------------------------------------------------------------ +{ + connect( LEName, SIGNAL(textChanged(QString)), this, SLOT(CaseNameChanged())); + connect( PushDir, SIGNAL(pressed()), this, SLOT(SetDirName())); + connect( PushFichier, SIGNAL(pressed()), this, SLOT(SetFileName())); + + connect( RBConforme, SIGNAL(clicked()), this, SLOT(SetConforme())); + connect( RBNonConforme, SIGNAL(clicked()), this, SLOT(SetNonConforme())); + + connect( RBBoundaryNo, SIGNAL(clicked()), this, SLOT(SetBoundaryNo())); + connect( RBBoundaryCAO, SIGNAL(clicked()), this, SLOT(SetBoundaryCAO())); + connect( RBBoundaryNonCAO, SIGNAL(clicked()), this, SLOT(SetBoundaryNonCAO())); + + connect( PBBoundaryCAONew, SIGNAL(pressed()), this, SLOT(PushBoundaryCAONew())); + connect( PBBoundaryCAOEdit, SIGNAL(pressed()), this, SLOT(PushBoundaryCAOEdit()) ); + connect( PBBoundaryCAOHelp, SIGNAL(pressed()), this, SLOT(PushBoundaryCAOHelp()) ); + connect( CBBoundaryD, SIGNAL(stateChanged(int)), this, SLOT(SetBoundaryD())); + connect( PBBoundaryDiNew, SIGNAL(pressed()), this, SLOT(PushBoundaryDiNew())); + connect( PBBoundaryDiEdit, SIGNAL(pressed()), this, SLOT(PushBoundaryDiEdit()) ); + connect( PBBoundaryDiHelp, SIGNAL(pressed()), this, SLOT(PushBoundaryDiHelp()) ); + connect( CBBoundaryA, SIGNAL(stateChanged(int)), this, SLOT(SetBoundaryA())); + connect( PBBoundaryAnNew, SIGNAL(pressed()), this, SLOT(PushBoundaryAnNew())); + connect( PBBoundaryAnEdit, SIGNAL(pressed()), this, SLOT(PushBoundaryAnEdit()) ); + connect( PBBoundaryAnHelp, SIGNAL(pressed()), this, SLOT(PushBoundaryAnHelp()) ); + + connect( CBAdvanced, SIGNAL(stateChanged(int)), this, SLOT(SetAdvanced())); + connect( RBStandard, SIGNAL(clicked()), this, SLOT(SetStandard())); + connect( RBBox, SIGNAL(clicked()), this, SLOT(SetBox())); + connect( RBNC1NpA, SIGNAL(clicked()), this, SLOT(SetNC1NpA())); + connect( RBNCQuelconque, SIGNAL(clicked()), this, SLOT(SetNCQuelconque())); + + connect( RBMED, SIGNAL(clicked()), this, SLOT(SetMED())); + connect( RBSaturne, SIGNAL(clicked()), this, SLOT(SetSaturne())); + connect( RBSaturne2D, SIGNAL(clicked()), this, SLOT(SetSaturne2D())); + + connect( buttonOk, SIGNAL(pressed()), this, SLOT(PushOnOK())); + connect( buttonApply, SIGNAL(pressed()), this, SLOT(PushOnApply(0))); + connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close())); + connect( buttonHelp, SIGNAL(pressed()), this, SLOT(PushOnHelp())); +} +// ------------------------------------------------------------------------ +void MonCreateCase::InitBoundarys() +// ------------------------------------------------------------------------ +// Initialisation des menus avec les frontieres deja enregistrees +{ + MESSAGE("InitBoundarys"); +// Pour les frontieres analytiques : la colonne des groupes + HOMARD::ListGroupType_var _listeGroupesCas = aCase->GetGroups(); + QTableWidgetItem *__colItem = new QTableWidgetItem(); + __colItem->setText(QApplication::translate("CreateCase", "", 0)); + TWBoundary->setHorizontalHeaderItem(0, __colItem); + for ( int i = 0; i < _listeGroupesCas->length(); i++ ) + { + TWBoundary->insertRow(i); + TWBoundary->setItem( i, 0, new QTableWidgetItem(QString((_listeGroupesCas)[i]).trimmed())); + 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 + HOMARD::HOMARD_Boundary_var myBoundary ; + HOMARD::listeBoundarys_var mesBoundarys = myHomardGen->GetAllBoundarysName(); +// MESSAGE("Nombre de frontieres enregistrees : "<length()); + for (int i=0; ilength(); i++) + { + myBoundary = myHomardGen->GetBoundary(mesBoundarys[i]); + int type_obj = myBoundary->GetType() ; + if ( type_obj==-1 ) { CBBoundaryCAO->addItem(QString(mesBoundarys[i])); } + else if ( type_obj==0 ) { CBBoundaryDi->addItem(QString(mesBoundarys[i])); } + else { AddBoundaryAn(QString(mesBoundarys[i])); } + } +// Ajustement + TWBoundary->resizeColumnsToContents(); + TWBoundary->resizeRowsToContents(); + TWBoundary->clearSelection(); +} +// ------------------------------- +bool MonCreateCase::PushOnApply(int option) +// -------------------------------- +{ + MESSAGE("PushOnApply"); + QString aCaseName=LEName->text().trimmed(); + if ( aCaseName == "" ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_NAME") ); + return false; + } + + QString aDirName=LEDirName->text().trimmed(); + if (aDirName == QString("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_DIRECTORY_1") ); + return false; + } + + if ( aDirName != _aDirName) + { QString CaseNameDir = myHomardGen->VerifieDir( aDirName.toStdString().c_str()) ; + if ( ( CaseNameDir != "" ) & ( CaseNameDir != aCaseName ) ) + { + QString texte ; + texte = QObject::tr("HOM_CASE_DIRECTORY_2") + CaseNameDir ; + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + texte ); + return false; + } + } + if (CHDIR(aDirName.toStdString().c_str()) != 0) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_DIRECTORY_3") ); + return false; + } + + QString aFileName=LEFileName->text().trimmed(); + if (aFileName ==QString("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_MESH") ); + return false; + } + + QString aMeshName = HOMARD_QT_COMMUN::LireNomMaillage(aFileName); + if (aMeshName == "" ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MED_FILE_2") ); + return false; + } + +// On verifie qu'un groupe n'est pas associe a deux frontieres differentes + if (CBBoundaryA->isChecked()) + { + QStringList ListeGroup ; + QString NomGroup ; + int nbcol = TWBoundary->columnCount(); + int nbrow = TWBoundary->rowCount(); + for ( int col=1; col< nbcol; col++) + { + for ( int row=0; row< nbrow; row++) + { + if ( TWBoundary->item( row, col )->checkState() == Qt::Checked ) + { +// Nom du groupe + NomGroup = QString(TWBoundary->item(row, 0)->text()) ; +// MESSAGE("NomGroup "<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; + } + LEFileName->setReadOnly(true); + PushFichier->hide(); + InitBoundarys(); + } + +// Repertoire et type + aCase->SetDirName(aDirName.toStdString().c_str()); + _aDirName=aDirName; + aCase->SetConfType(_ConfType); + aCase->SetExtType(_ExtType); + +// Menage des eventuelles frontieres deja enregistrees + aCase->SupprBoundaryGroup() ; + + // Enregistrement et publication dans l'arbre d'etudes a la sortie definitive + if ( option > 0 ) + { + if (RBBoundaryCAO->isChecked()) + { + QString monBoundaryCAOName=CBBoundaryCAO->currentText(); + if (monBoundaryCAOName != "" ) + { + aCase->AddBoundary(monBoundaryCAOName.toStdString().c_str()); + } + } + if (CBBoundaryD->isChecked()) + { + QString monBoundaryDiName=CBBoundaryDi->currentText(); + if (monBoundaryDiName != "" ) + { + aCase->AddBoundary(monBoundaryDiName.toStdString().c_str()); + } + } + if (CBBoundaryA->isChecked()) + { + QString NomGroup ; + int nbcol = TWBoundary->columnCount(); + int nbrow = TWBoundary->rowCount(); + for ( int col=1; col< nbcol; col++) + { + for ( int row=0; row< nbrow; row++) + { + if ( TWBoundary->item( row, col )->checkState() == Qt::Checked ) + { + // Nom du groupe + NomGroup = QString(TWBoundary->item(row, 0)->text()) ; + // Nom de la frontiere + QTableWidgetItem *__colItem = new QTableWidgetItem(); + __colItem = TWBoundary->horizontalHeaderItem(col); + aCase->AddBoundaryGroup(QString(__colItem->text()).toStdString().c_str(), NomGroup.toStdString().c_str()); + } + } + } + } + } + + +// Options avancees + if (CBAdvanced->isChecked()) + { +// Autorisation des pyramides + if (CBPyramid->isChecked()) { _Pyram = 1 ; } + } + aCase->SetPyram(_Pyram); + + HOMARD_UTILS::updateObjBrowser(); + + return true; +} +// --------------------------- +void MonCreateCase::PushOnOK() +// --------------------------- +{ + bool bOK = PushOnApply(1); + if ( bOK ) this->close(); +} +//------------------------------ +void MonCreateCase::PushOnHelp() +//------------------------------- +{ + std::string LanguageShort = myHomardGen->GetLanguageShort(); + HOMARD_UTILS::PushOnHelp(QString("gui_create_case.html"), QString(""), QString(LanguageShort.c_str())); +} +// --------------------------------- +void MonCreateCase::SetNewName() +// ------------------------------ +{ + HOMARD::listeCases_var MyCases = myHomardGen->GetAllCasesName(); + int num = 0; QString aCaseName=""; + while (aCaseName=="" ) + { + aCaseName.setNum(num+1) ; + aCaseName.insert(0, QString("Case_")) ; + for ( int i=0; ilength(); i++) + { + if ( aCaseName == QString((MyCases)[i])) + { + num ++ ; + aCaseName = "" ; + break ; + } + } + } + LEName->clear() ; + LEName->insert(aCaseName); +} + +// ------------------------------------------------------------------------ +void MonCreateCase::SetDirName() +// ------------------------------------------------------------------------ +{ + QString aDirName=QFileDialog::getExistingDirectory (); + if (!(aDirName.isEmpty()))LEDirName->setText(aDirName); +} +// ------------------------------------------------------------------------ +void MonCreateCase::SetFileName() +// ------------------------------------------------------------------------ +{ + QString fileName0 = LEFileName->text().trimmed(); + QString fileName = HOMARD_QT_COMMUN::PushNomFichier( false, QString("med") ) ; + if (fileName.isEmpty()) fileName = fileName0 ; + LEFileName->setText(fileName); +} +// ------------------------------------------------------------------------ +void MonCreateCase::SetConforme() +// ------------------------------------------------------------------------ +{ +// + _ConfType=0; + RBNC1NpA->setVisible(0); + RBNCQuelconque->setVisible(0); +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void MonCreateCase::SetNonConforme() +// ------------------------------------------------------------------------ +{ +// + _ConfType=1; + RBNC1NpA->setVisible(1); + RBNCQuelconque->setVisible(1); +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void MonCreateCase::SetStandard() +// ------------------------------------------------------------------------ +{ + if ( ( _ConfType == 0 ) || ( _ConfType == -1 ) ) { _ConfType = 0 ; } + else { _ConfType = 1 ; } + RBStandard->setChecked(true); +} +// ------------------------------------------------------------------------ +void MonCreateCase::SetBox() +// ------------------------------------------------------------------------ +{ + if ( ( _ConfType == 0 ) || ( _ConfType == -1 ) ) { _ConfType = -1 ; } + else { _ConfType = -2 ; } +} +// ------------------------------------------------------------------------ +void MonCreateCase::SetNC1NpA() +// ------------------------------------------------------------------------ +{ + _ConfType = 2; +} +// ------------------------------------------------------------------------ +void MonCreateCase::SetNCQuelconque() +// ------------------------------------------------------------------------ +{ + _ConfType = 3; +} +// ------------------------------------------------------------------------ +void MonCreateCase::SetMED() +// ------------------------------------------------------------------------ +{ + _ExtType = 0 ; + RBMED->setChecked(true); +} +// ------------------------------------------------------------------------ +void MonCreateCase::SetSaturne() +// ------------------------------------------------------------------------ +{ + _ExtType = 1 ; + RBSaturne->setChecked(true); +} +// ------------------------------------------------------------------------ +void MonCreateCase::SetSaturne2D() +// ------------------------------------------------------------------------ +{ + _ExtType = 2 ; + RBSaturne2D->setChecked(true); +} +// ------------------------------------------------------------------------ +void MonCreateCase::SetBoundaryNo() +// ------------------------------------------------------------------------ +{ +// + GBBoundaryC->setVisible(0); + GBBoundaryA->setVisible(0); + GBBoundaryD->setVisible(0); + CBBoundaryD->setVisible(0); + CBBoundaryA->setVisible(0); +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void MonCreateCase::SetBoundaryCAO() +// ------------------------------------------------------------------------ +{ +// + GBBoundaryC->setVisible(1); + GBBoundaryA->setVisible(0); + GBBoundaryD->setVisible(0); + CBBoundaryD->setVisible(0); + CBBoundaryA->setVisible(0); +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void MonCreateCase::SetBoundaryNonCAO() +// ------------------------------------------------------------------------ +{ +// + GBBoundaryC->setVisible(0); + CBBoundaryD->setVisible(1); + CBBoundaryA->setVisible(1); +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void MonCreateCase::AddBoundaryCAO(QString newBoundary) +// ------------------------------------------------------------------------ +{ + CBBoundaryCAO->insertItem(0,newBoundary); + CBBoundaryCAO->setCurrentIndex(0); +} +// ------------------------------------------------------------------------ +void MonCreateCase::PushBoundaryCAONew() +// ------------------------------------------------------------------------ +{ + MonCreateBoundaryCAO *BoundaryDlg = new MonCreateBoundaryCAO(this, true, + HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, "") ; + BoundaryDlg->show(); +} +// ------------------------------------------------------------------------ +void MonCreateCase::PushBoundaryCAOEdit() +// ------------------------------------------------------------------------ +{ + if (CBBoundaryCAO->currentText() == QString("")) return; + MonEditBoundaryCAO *BoundaryDlg = new MonEditBoundaryCAO(this, true, + HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, CBBoundaryCAO->currentText() ) ; + BoundaryDlg->show(); +} +// ------------------------------------------------------------------------ +void MonCreateCase::PushBoundaryCAOHelp() +// ------------------------------------------------------------------------ +{ + std::string LanguageShort = myHomardGen->GetLanguageShort(); + HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("CAO"), QString(LanguageShort.c_str())); +} +// ------------------------------------------------------------------------ +void MonCreateCase::SetBoundaryD() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetBoundaryD "); + if (CBBoundaryD->isChecked()) + { + bool bOK = PushOnApply(0); + if (bOK) { GBBoundaryD->setVisible(1); } + else { GBBoundaryD->setVisible(0); + CBBoundaryD->setChecked(0); + CBBoundaryD->setCheckState(Qt::Unchecked); } + } + else { GBBoundaryD->setVisible(0); } +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void MonCreateCase::AddBoundaryDi(QString newBoundary) +// ------------------------------------------------------------------------ +{ + CBBoundaryDi->insertItem(0,newBoundary); + CBBoundaryDi->setCurrentIndex(0); +} +// ------------------------------------------------------------------------ +void MonCreateCase::PushBoundaryDiNew() +// ------------------------------------------------------------------------ +{ + MonCreateBoundaryDi *BoundaryDlg = new MonCreateBoundaryDi(this, true, + HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, "") ; + BoundaryDlg->show(); +} +// ------------------------------------------------------------------------ +void MonCreateCase::PushBoundaryDiEdit() +// ------------------------------------------------------------------------ +{ + if (CBBoundaryDi->currentText() == QString("")) return; + MonEditBoundaryDi *BoundaryDlg = new MonEditBoundaryDi(this, true, + HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, CBBoundaryDi->currentText() ) ; + BoundaryDlg->show(); +} +// ------------------------------------------------------------------------ +void MonCreateCase::PushBoundaryDiHelp() +// ------------------------------------------------------------------------ +{ + std::string LanguageShort = myHomardGen->GetLanguageShort(); + HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("frontiere-discrete"), QString(LanguageShort.c_str())); +} +// ------------------------------------------------------------------------ +void MonCreateCase::SetBoundaryA() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetBoundaryA "); + if (CBBoundaryA->isChecked()) + { + bool bOK = PushOnApply(0); + if (bOK) { GBBoundaryA->setVisible(1); } + else { GBBoundaryA->setVisible(0); + CBBoundaryA->setChecked(0); + CBBoundaryA->setCheckState(Qt::Unchecked); } + } + else { GBBoundaryA->setVisible(0); } +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void MonCreateCase::AddBoundaryAn(QString newBoundary) +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de AddBoundaryAn "); +// Ajout d'une nouvelle colonne + int nbcol = TWBoundary->columnCount(); +// MESSAGE("nbcol " << nbcol); + nbcol += 1 ; + TWBoundary->setColumnCount ( nbcol ) ; + QTableWidgetItem *__colItem = new QTableWidgetItem(); + __colItem->setText(QApplication::translate("CreateCase", newBoundary.toStdString().c_str(), 0)); + TWBoundary->setHorizontalHeaderItem(nbcol-1, __colItem); +/* TWBoundary->horizontalHeaderItem(nbcol-1)->setFlags( Qt::ItemIsSelectable|Qt::ItemIsEnabled );*/ +// Chaque case est a cocher + int nbrow = TWBoundary->rowCount(); +// MESSAGE("nbrow " << nbrow); + for ( int i = 0; i < nbrow; i++ ) + { + TWBoundary->setItem( i, nbcol-1, new QTableWidgetItem( QString ("") ) ); + TWBoundary->item( i, nbcol-1 )->setFlags( 0 ); + TWBoundary->item( i, nbcol-1 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled ); + TWBoundary->item( i, nbcol-1 )->setCheckState( Qt::Unchecked ); + } + TWBoundary->resizeColumnToContents(nbcol-1); +// TWBoundary->resizeRowsToContents(); +// MESSAGE("Fin de AddBoundaryAn "); +} +// ------------------------------------------------------------------------ +void MonCreateCase::PushBoundaryAnNew() +// ------------------------------------------------------------------------ +{ + MonCreateBoundaryAn *BoundaryDlg = new MonCreateBoundaryAn(this, true, + HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName) ; + BoundaryDlg->show(); +} +// ------------------------------------------------------------------------ +void MonCreateCase::PushBoundaryAnEdit() +// ------------------------------------------------------------------------ +{ + QString nom=""; + int nbcol = TWBoundary->columnCount(); + for ( int i = 1; i < nbcol; i++ ) + { + QTableWidgetItem *__colItem = new QTableWidgetItem(); + __colItem = TWBoundary->horizontalHeaderItem(i); + nom = QString(__colItem->text()) ; + MESSAGE("nom "<show(); } + } +} +// ------------------------------------------------------------------------ +void MonCreateCase::PushBoundaryAnHelp() +// ------------------------------------------------------------------------ +{ + std::string LanguageShort = myHomardGen->GetLanguageShort(); + HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("frontiere-analytique"), QString(LanguageShort.c_str())); +} +// ------------------------------------------------------------------------ +void MonCreateCase::CaseNameChanged() +// ------------------------------------------------------------------------ +{ + if (_aCaseName != LEName->text().trimmed()) + { + LEFileName->setReadOnly(false); + PushFichier->show(); + } +} +// ------------------------------------------------------------------------ +void MonCreateCase::SetAdvanced() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetAdvanced "); + if (CBAdvanced->isChecked()) + { GBAdvancedOptions->setVisible(1); + GBConforme->setVisible(1); + RBStandard->setVisible(1); + RBBox->setVisible(1); + if ( ( _ConfType == 0 ) || ( _ConfType == -1 ) ) + { RBNC1NpA->setVisible(0); + RBNCQuelconque->setVisible(0);} + else + { RBNC1NpA->setVisible(1); + RBNCQuelconque->setVisible(1);} + GBFormat->setVisible(1); + RBMED->setVisible(1); + RBSaturne2D->setVisible(1); + } + else + { GBAdvancedOptions->setVisible(0); + CBPyramid->setChecked(false); + _Pyram = 0 ; + SetStandard() ; + SetMED() ; + } +// + adjustSize(); +} diff --git a/src/ADAPTGUI/MonCreateCase.h b/src/ADAPTGUI/MonCreateCase.h new file mode 100644 index 000000000..ab1a2f4c1 --- /dev/null +++ b/src/ADAPTGUI/MonCreateCase.h @@ -0,0 +1,102 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_CREATECASE_H +#define MON_CREATECASE_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(HOMARD_Cas) + +#include "ui_CreateCase.h" +#include + +class HOMARD_EXPORT MonCreateCase : public QDialog, public Ui_CreateCase +{ + Q_OBJECT + +public: + MonCreateCase( bool modal, HOMARD::HOMARD_Gen_var myHomardGen ); + ~MonCreateCase(); + + void AddBoundaryCAO(QString newBoundary); + void AddBoundaryAn(QString newBoundary); + void AddBoundaryDi(QString newBoundary); + +protected : + QString _aCaseName; + QString _aDirName; + + int _ConfType; + int _ExtType; + + int _Pyram; + + HOMARD::HOMARD_Cas_var aCase ; + HOMARD::HOMARD_Gen_var myHomardGen; + + virtual void InitConnect(); + virtual void InitBoundarys(); + virtual void SetNewName(); + +public slots: + virtual void SetDirName(); + virtual void SetFileName(); + + virtual void SetConforme(); + virtual void SetNonConforme(); + virtual void SetStandard(); + virtual void SetBox(); + virtual void SetNC1NpA(); + virtual void SetNCQuelconque(); + + virtual void SetMED(); + virtual void SetSaturne(); + virtual void SetSaturne2D(); + + 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(); + + virtual void SetAdvanced(); + + virtual void PushOnOK(); + virtual bool PushOnApply(int option); + virtual void PushOnHelp(); + + virtual void CaseNameChanged(); +}; + +#endif // MON_CREATECASE_H diff --git a/src/ADAPTGUI/MonCreateHypothesis.cxx b/src/ADAPTGUI/MonCreateHypothesis.cxx new file mode 100644 index 000000000..6b03def0e --- /dev/null +++ b/src/ADAPTGUI/MonCreateHypothesis.cxx @@ -0,0 +1,945 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonCreateHypothesis.h" +#include "MonCreateListGroup.h" +#include "MonCreateIteration.h" +#include "MonCreateZone.h" +#include "MonEditZone.h" + +#include +#include + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include + +using namespace std; + +// ------------------------------------------------------------------------------- +MonCreateHypothesis::MonCreateHypothesis(MonCreateIteration* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen0, + QString Name, + QString caseName, QString aFieldFile) +// --------------------------------------------------------------------------------- +/* Constructs a MonCreateHypothesis */ + : + QScrollArea(0), Ui_CreateHypothesis(), + _parent(parent), _Name(Name), + _aCaseName(caseName), _aFieldFile(aFieldFile), + _aFieldName(""), + _aTypeAdap(-2), _aTypeRaff(1), _aTypeDera(0), + _TypeThR(3), _ThreshR(0), + _TypeThC(0), _ThreshC(0), + _UsField(0), _UsCmpI(0), _TypeFieldInterp(0), + _NivMax(-1), + _DiamMin(-1.), + _AdapInit(0), + _ExtraOutput(1) + +{ + MESSAGE("Constructeur") ; + myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + setupUi(this); + if ( modal ) { setWindowModality(Qt::WindowModal); } + else { setWindowModality(Qt::NonModal); } + setWindowFlags( Qt::WindowStaysOnTopHint ) ; + InitConnect(); + + SetNewName(); + if (_aFieldFile != QString("")) + { RBChamp->setChecked(1); + SetChamp(); + } + else + { RBUniforme->setChecked(1); + SetUniforme(); + } + SetFieldNo(); + GBAdvancedOptions->setVisible(0); + CBOutputLevel->setChecked(false); + CBOutputQuality->setChecked(false); + CBOutputDiameter->setChecked(false); + CBOutputParent->setChecked(false); + CBOutputVoisins->setChecked(false); + _ExtraOutput = 1 ; +// + adjustSize(); +} + +// ------------------------------------------------------------------------ +MonCreateHypothesis::~MonCreateHypothesis() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::InitConnect() +// ------------------------------------------------------------------------ +{ + connect( RBUniforme, SIGNAL(clicked()), this, SLOT(SetUniforme())); + connect( RBChamp, SIGNAL(clicked()), this, SLOT(SetChamp())); + connect( RBZone, SIGNAL(clicked()), this, SLOT(SetZone())); + connect( RBUniRaff, SIGNAL(clicked()), this, SLOT(SetUniRaff())); + connect( RBUniDera, SIGNAL(clicked()), this, SLOT(SetUniDera())); + + connect( CBFieldName, SIGNAL(activated(int)), this, SLOT( SetFieldName())); + connect( RBRPE, SIGNAL(clicked()), this, SLOT(SetRPE())); + connect( RBRRel, SIGNAL(clicked()), this, SLOT(SetRRel())); + connect( RBRMuSigma, SIGNAL(clicked()), this, SLOT(SetRMS())); + connect( RBRAbs, SIGNAL(clicked()), this, SLOT(SetRAbs())); + connect( RBRNo, SIGNAL(clicked()), this, SLOT(SetRNo())); + connect( RBCPE, SIGNAL(clicked()), this, SLOT(SetCPE())); + connect( RBCRel, SIGNAL(clicked()), this, SLOT(SetCRel())); + connect( RBCMuSigma, SIGNAL(clicked()), this, SLOT(SetCMS())); + connect( RBCAbs, SIGNAL(clicked()), this, SLOT(SetCAbs())); + connect( RBCNo, SIGNAL(clicked()), this, SLOT(SetCNo())); + connect( RBL2, SIGNAL(clicked()), this, SLOT(SetUCL2())); + connect( RBInf, SIGNAL(clicked()), this, SLOT(SetUCInf())); + connect( CBJump, SIGNAL(stateChanged(int)), this, SLOT(SetUseField())); + connect( PBZoneNew, SIGNAL(pressed()), this, SLOT(PushZoneNew())); + connect( PBZoneEdit, SIGNAL(pressed()), this, SLOT(PushZoneEdit()) ); + connect( PBZoneDelete, SIGNAL(pressed()), this, SLOT(PushZoneDelete()) ); + connect( CBGroupe, SIGNAL(stateChanged(int)), this, SLOT(SetFiltrage())); + + connect( RBFieldNo, SIGNAL(clicked()), this, SLOT(SetFieldNo())); + connect( RBFieldAll, SIGNAL(clicked()), this, SLOT(SetFieldAll())); + connect( RBFieldChosen,SIGNAL(clicked()), this, SLOT(SetFieldChosen())); + + connect( CBAdvanced, SIGNAL(stateChanged(int)), this, SLOT(SetAdvanced())); + connect( RBAIN, SIGNAL(clicked()), this, SLOT(SetAIN())); + connect( RBAIR, SIGNAL(clicked()), this, SLOT(SetAIR())); + connect( RBAID, SIGNAL(clicked()), this, SLOT(SetAID())); + + 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 MonCreateHypothesis::PushOnApply() +// ------------------------------------------------------------------------ +// Appele lorsque l'un des boutons Ok ou Apply est presse +// +{ +// Verifications + + + if (LEName->text().trimmed()=="") { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_HYPO_NAME") ); + return false; + } + + if (VerifieZone() == false) return false; + if (VerifieComposant() == false) return false; + +// Creation de l'objet CORBA si ce n'est pas deja fait sous le meme nom + if (LEName->text().trimmed() != _Name) + { + _Name=LEName->text().trimmed(); + try + { + aHypothesis=myHomardGen->CreateHypothesis(CORBA::string_dup(_Name.toStdString().c_str()) ); + _parent->addHypothese(_Name); + } + catch( SALOME::SALOME_Exception& S_ex ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QString(CORBA::string_dup(S_ex.details.text)) ); + return false; + } + } + +// Mise en place des attributs + if ( _aTypeAdap == -1 ) + { + int TypeRaffDera ; + if ( _aTypeRaff == 1 ) { TypeRaffDera = 1 ; } + else { TypeRaffDera = -1 ; } + aHypothesis->SetUnifRefinUnRef(TypeRaffDera); + } + aHypothesis->SetTypeFieldInterp(_TypeFieldInterp); + aHypothesis->SetCaseCreation(_aCaseName.toStdString().c_str()); + + AssocieLesZones(); + AssocieComposants(); + AssocieLesGroupes(); + AssocieFieldInterp(); + +// Options avancees + if (CBAdvanced->isChecked()) + { +// Enregistrement du niveau maximal + _NivMax = SpinBoxNivMax->value() ; + aHypothesis->SetNivMax(_NivMax); +// Enregistrement du diametre minimal + _DiamMin = doubleSpinBoxDiamMin->value() ; + aHypothesis->SetDiamMin(_DiamMin); +// Enregistrement de l'intialisation de l'adaptation + aHypothesis->SetAdapInit(_AdapInit); +// Sortie optionnelle des niveaux de raffinement, des diametres, des qualites + _ExtraOutput = 1 ; + if (CBOutputLevel->isChecked()) { _ExtraOutput = 2 ; } + if (CBOutputQuality->isChecked()) { _ExtraOutput = 3*_ExtraOutput ; } + if (CBOutputDiameter->isChecked()) { _ExtraOutput = 5*_ExtraOutput ; } + if (CBOutputParent->isChecked()) { _ExtraOutput = 7*_ExtraOutput ; } + if (CBOutputVoisins->isChecked()) { _ExtraOutput = 11*_ExtraOutput ; } + aHypothesis->SetExtraOutput(_ExtraOutput); + } + + HOMARD_UTILS::updateObjBrowser() ; + + return true; +} + + +// ------------------------------------------------------------------------ +void MonCreateHypothesis::PushOnOK() +// ------------------------------------------------------------------------ +{ + if (PushOnApply()) this->close(); + if ( _parent ) { _parent->raise(); _parent->activateWindow(); }; +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::PushOnHelp() +// ------------------------------------------------------------------------ +{ + std::string LanguageShort = myHomardGen->GetLanguageShort(); + HOMARD_UTILS::PushOnHelp(QString("gui_create_hypothese.html"), QString(""), QString(LanguageShort.c_str())); +} +// ------------------------------------------------- +void MonCreateHypothesis::SetNewName() +// -------------------------------------------------- +{ + + HOMARD::listeHypotheses_var MyObjects = myHomardGen->GetAllHypothesesName(); + int num = 0;// + QString aName=""; + while (aName=="" ) + { + aName.setNum(num+1) ; + aName.insert(0, QString("Hypo_")) ; + for ( int i=0; ilength(); i++) + { + if ( aName == QString(MyObjects[i])) + { + num ++ ; + aName = "" ; + break ; + } + } + } + LEName->setText(aName); +} + +// +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetUniforme() +// ------------------------------------------------------------------------ +{ + GBFieldManagement->setVisible(0); + if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); } + else { GBFieldFile->setVisible(1); } + GBAreaManagement->setVisible(0); + GBUniform->setVisible(1); + + _aTypeAdap = -1 ; +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetChamp() +// ------------------------------------------------------------------------ +{ + if (_aFieldFile == QString("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_HYPO_FIELD_FILE") ); + close(); + if ( _parent ) { _parent->raise(); _parent->activateWindow(); }; + return; + } + LEFieldFile->setText(_aFieldFile); + LEFieldFile->setReadOnly(1); + InitFields(); + GBUniform->setVisible(0); + GBAreaManagement->setVisible(0); + GBFieldManagement->setVisible(1); + GBFieldFile->setVisible(1); + + GBUniform->adjustSize(); + GBAreaManagement->adjustSize(); + GBFieldManagement->adjustSize(); + GBFieldFile->adjustSize(); + + _aTypeAdap = 1 ; +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetZone() +// ------------------------------------------------------------------------ +{ + GetAllZones(); + GBUniform->setVisible(0); + GBFieldManagement->setVisible(0); + if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); } + else { GBFieldFile->setVisible(1); } + GBAreaManagement->setVisible(1); + + _aTypeRaff = 1 ; + _aTypeDera = 0 ; + _aTypeAdap = 0 ; +// + adjustSize(); +} + +// ------------------------------------------------------------------------ +void MonCreateHypothesis::PushZoneNew() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de MonCreateHypothesis::PushZoneNew") + MonCreateZone *aDlg = new MonCreateZone(this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName) ; + aDlg->show(); +} + +// ------------------------------------------------------------------------ +void MonCreateHypothesis::PushZoneEdit() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de MonCreateHypothesis::PushZoneEdit") + int colonne = TWZone->currentColumn(); + QTableWidgetItem * monItem = TWZone->currentItem(); + if (colonne !=2 || monItem == NULL) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_HYPO_ZONE_1") ); + return; + } + QString zoneName = monItem->text().trimmed(); + MonEditZone *aDlg = new MonEditZone(this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, zoneName) ; + aDlg->show(); +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::PushZoneDelete() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de MonCreateHypothesis::PushZoneDelete") + QMessageBox::warning( 0, QObject::tr("HOM_WARNING"), + QObject::tr("HOM_INACTIVE_BUTTON") ); + return; +} + +// ------------------------------------------------------------------------ +void MonCreateHypothesis::GetAllZones() +// ------------------------------------------------------------------------ +// Recuperation de toutes les zones enregistrees dans l'arbre d'etude +// et affichage dans le tableau +// Par defaut, aucune n'est selectionnee +{ + MESSAGE("Debut de GetAllZones") ; + HOMARD::listeZones_var mesZones = myHomardGen->GetAllZonesName(); + int nbrow=TWZone->rowCount(); + for ( int row=0; row< nbrow; row++) + { + TWZone->removeRow(row); + } + TWZone->setRowCount(0); + int row=0; + for (int i=0; ilength(); i++) + { + TWZone->insertRow(row); +// + TWZone->setItem( row, 0, new QTableWidgetItem( QString ("") ) ); + TWZone->item( row, 0 )->setFlags( 0 ); + TWZone->item( row, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled ); + TWZone->item( row, 0 )->setCheckState( Qt::Unchecked ); +// + TWZone->setItem( row, 1, new QTableWidgetItem( QString ("") ) ); + TWZone->item( row, 1 )->setFlags( 0 ); + TWZone->item( row, 1 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled ); + TWZone->item( row, 1 )->setCheckState( Qt::Unchecked ); +// + TWZone->setItem( row, 2, new QTableWidgetItem(QString(mesZones[i]).trimmed())); + TWZone->item( row, 2 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable ); +// + row += 1; + } + TWZone->resizeColumnsToContents(); + TWZone->resizeRowsToContents(); + TWZone->clearSelection(); +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::addZoneinTWZone(QString newZone) +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de addZoneinTWZone") ; + int row = TWZone->rowCount() ; +// Par defaut, on suppose qu'une nouvelle zone est destinee au raffinement + TWZone->setRowCount( row+1 ); +// + TWZone->setItem( row, 0, new QTableWidgetItem( QString ("") ) ); + TWZone->item( row, 0 )->setFlags( Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled ); + TWZone->item( row, 0 )->setCheckState( Qt::Checked ); +// + TWZone->setItem( row, 1, new QTableWidgetItem( QString ("") ) ); + TWZone->item( row, 1 )->setFlags( Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled ); + TWZone->item( row, 1 )->setCheckState( Qt::Unchecked ); +// + TWZone->setItem( row, 2, new QTableWidgetItem( newZone ) ); + TWZone->scrollToItem( TWZone->item( row, 2 ) ); +// + TWZone->resizeRowsToContents(); + TWZone->resizeColumnToContents(1); + TWZone->clearSelection(); +// + TWZone->item( row, 2 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable ); +} +// ------------------------------------------------------------------------ +QStringList MonCreateHypothesis::GetZonesChecked() +// ------------------------------------------------------------------------ +// Retourne les zones enregistrees +{ + MESSAGE("Debut de GetZonesChecked") ; + QStringList ListeZone ; +// On ne peut pas avoir selectionne les deux options + int Pbm = 0 ; + for ( int row=0; row< TWZone->rowCount(); row++) + { + if ( ( TWZone->item( row, 0 )->checkState() == Qt::Checked ) && ( TWZone->item( row, 1 )->checkState() == Qt::Checked ) ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_HYPO_ZONE_3") ); + Pbm = 1 ; + } + } +// Si tout va bien, on affecte +// Attention, on insere en tete, donc on commence d'inserer le type, psui le nom de la zone + if ( Pbm == 0 ) + { + QString Raff = "1" ; + QString Dera = "-1" ; + for ( int row=0; row< TWZone->rowCount(); row++) + { +// MESSAGE ("row "<item(row, 2)->text().toStdString()); +// En raffinement : + if ( TWZone->item(row,0)->checkState() == Qt::Checked ) + { ListeZone.insert(0, Raff) ; + ListeZone.insert(0, QString(TWZone->item(row, 2)->text()) ) ; } +// En deraffinement : + if ( TWZone->item(row,1)->checkState() == Qt::Checked ) + { ListeZone.insert(0, Dera) ; + ListeZone.insert(0, QString(TWZone->item(row, 2)->text()) ) ; } + } + MESSAGE("Fin de GetZonesChecked ; longueur de ListeZone : "<rowCount(); row++) + if ( TWCMP->item( row, 0 )->checkState() == Qt::Checked ) + ListeComposant.insert(0, QString(TWCMP->item(row, 1)->text()) ) ; + // Choix du texte des radio-boutons selon 1 ou plusieurs composantes + if ( ListeComposant.count() < 2 ) + { RBL2->setText(QObject::tr("HOM_HYPO_NORM_ABS")); + RBInf->setText(QObject::tr("HOM_HYPO_NORM_REL")); + } + else + { RBL2->setText(QObject::tr("HOM_HYPO_NORM_L2")); + RBInf->setText(QObject::tr("HOM_HYPO_NORM_INF")); + } + return ListeComposant ; +// +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::AssocieFieldInterp() +// ------------------------------------------------------------------------ +{ + if ( _TypeFieldInterp != 2 ) return; + for ( int row=0; row< TWField->rowCount(); row++) + { + if ( TWField->item( row, 0 )->checkState() == Qt::Checked ) + { + aHypothesis->AddFieldInterp(TWField->item(row, 1)->text().toStdString().c_str()); + } + } +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetUniRaff() +// ------------------------------------------------------------------------ +{ + _aTypeRaff = 1 ; + _aTypeDera = 0 ; +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetUniDera() +// ------------------------------------------------------------------------ +{ + _aTypeRaff = 0 ; + _aTypeDera = 1 ; +} + +// ------------------------------------------------------------------------ +void MonCreateHypothesis::InitFields() +// ------------------------------------------------------------------------ +{ + CBFieldName->clear(); + std::list listeChamp = HOMARD_QT_COMMUN::GetListeChamps(QString(_aFieldFile) ); + // Mise en place de la liste dans le menu pour l'indicateur d'erreur + std:: list::const_iterator it; + for ( it=listeChamp.begin() ; it != listeChamp.end(); it++) + { + CBFieldName->insertItem(0,QString(*it)); + } + SetFieldName(); +} +// --------------------------------------- +void MonCreateHypothesis::SetFieldName() +// ------------------------------------------- +{ + MESSAGE("Debut de SetFieldName"); + _aFieldName=CBFieldName->currentText(); + if (QString(_aFieldFile) == QString("") || QString(_aFieldName) == QString("") ) { return; } + + int nbrow= TWCMP->rowCount() ; + for ( int row=0; row < nbrow ; row++) + { + TWCMP->removeRow(row); + } + TWCMP->setRowCount(0); + //TWCMP->resizeRowsToContents(); + + std::list maListe =HOMARD_QT_COMMUN::GetListeComposants(_aFieldFile, _aFieldName); + std::list::const_iterator it; + for ( it=maListe.begin() ; it != maListe.end(); it++) + { + TWCMP->insertRow(0); + TWCMP->setItem( 0, 0, new QTableWidgetItem( QString ("") ) ); + TWCMP->item( 0, 0 )->setFlags( 0 ); + TWCMP->item( 0, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled ); + TWCMP->item( 0, 0 )->setCheckState( Qt::Checked ); + TWCMP->setItem( 0, 1, new QTableWidgetItem(QString((*it)).trimmed())); + TWCMP->item( 0, 1 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable ); + } + TWCMP->resizeColumnsToContents(); + TWCMP->resizeRowsToContents(); + TWCMP->clearSelection(); + // Choix du texte des radio-boutons selon 1 ou plusieurs composantes + if ( TWCMP->rowCount() == 1 ) + { RBL2->setText(QObject::tr("HOM_HYPO_NORM_ABS")); + RBInf->setText(QObject::tr("HOM_HYPO_NORM_REL")); + } + else + { RBL2->setText(QObject::tr("HOM_HYPO_NORM_L2")); + RBInf->setText(QObject::tr("HOM_HYPO_NORM_INF")); + } + // Par defaut, on propose la valeur absolue / norme L2 + SetUCL2(); +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetRPE() +// ------------------------------------------------------------------------ +{ + _aTypeRaff = 1 ; + _TypeThR = 3 ; + RBRPE->setChecked(true); + SpinBox_RPE->setEnabled(true); + SpinBox_RRel->setEnabled(false); + SpinBox_RAbs->setEnabled(false); + SpinBox_RMuSigma->setEnabled(false); +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetRRel() +// ------------------------------------------------------------------------ +{ + _aTypeRaff = 1 ; + _TypeThR = 2 ; + RBRRel->setChecked(true); + SpinBox_RPE->setEnabled(false); + SpinBox_RRel->setEnabled(true); + SpinBox_RAbs->setEnabled(false); + SpinBox_RMuSigma->setEnabled(false); +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetRAbs() +// ------------------------------------------------------------------------ +{ + _aTypeRaff = 1 ; + _TypeThR = 1 ; + RBRAbs->setChecked(true); + SpinBox_RPE->setEnabled(false); + SpinBox_RRel->setEnabled(false); + SpinBox_RAbs->setEnabled(true); + SpinBox_RMuSigma->setEnabled(false); +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetRMS() +// ------------------------------------------------------------------------ +{ + _aTypeRaff = 1 ; + _TypeThR = 4 ; + RBRMuSigma->setChecked(true); + SpinBox_RPE->setEnabled(false); + SpinBox_RRel->setEnabled(false); + SpinBox_RAbs->setEnabled(false); + SpinBox_RMuSigma->setEnabled(true); +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetRNo() +// ------------------------------------------------------------------------ +{ + _aTypeRaff = 0 ; + _TypeThR = 0; + RBRNo->setChecked(true); + SpinBox_RPE->setEnabled(false); + SpinBox_RRel->setEnabled(false); + SpinBox_RAbs->setEnabled(false); + SpinBox_RMuSigma->setEnabled(false); +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetCPE() +// ------------------------------------------------------------------------ +{ + _aTypeDera = 1 ; + _TypeThC = 3 ; + RBCPE->setChecked(true); + SpinBox_CPE->setEnabled(true); + SpinBox_CRel->setEnabled(false); + SpinBox_CAbs->setEnabled(false); + SpinBox_CMuSigma->setEnabled(false); +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetCRel() +// ------------------------------------------------------------------------ +{ + _aTypeDera = 1 ; + _TypeThC = 2 ; + RBCRel->setChecked(true); + SpinBox_CPE->setEnabled(false); + SpinBox_CRel->setEnabled(true); + SpinBox_CAbs->setEnabled(false); + SpinBox_CMuSigma->setEnabled(false); +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetCAbs() +// ------------------------------------------------------------------------ +{ + _aTypeDera = 1 ; + _TypeThC = 1 ; + RBCAbs->setChecked(true); + SpinBox_CPE->setEnabled(false); + SpinBox_CRel->setEnabled(false); + SpinBox_CAbs->setEnabled(true); + SpinBox_CMuSigma->setEnabled(false); +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetCMS() +// ------------------------------------------------------------------------ +{ + _aTypeDera = 1 ; + _TypeThC = 4 ; + RBCMuSigma->setChecked(true); + SpinBox_CPE->setEnabled(false); + SpinBox_CRel->setEnabled(false); + SpinBox_CAbs->setEnabled(false); + SpinBox_CMuSigma->setEnabled(true); +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetCNo() +// ------------------------------------------------------------------------ +{ + _aTypeDera = 0 ; + _TypeThC = 0; + RBCNo->setChecked(true); + SpinBox_CPE->setEnabled(false); + SpinBox_CRel->setEnabled(false); + SpinBox_CAbs->setEnabled(false); + SpinBox_CMuSigma->setEnabled(false); +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetUCL2() +// ------------------------------------------------------------------------ +{ + _UsCmpI = 0 ; + RBL2->setChecked(true); +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetUCInf() +// ------------------------------------------------------------------------ +{ + if ( TWCMP->rowCount() == 1 ) { _UsCmpI = 2 ; } + else { _UsCmpI = 1 ; } + RBInf->setChecked(true); +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetUseField() +// ------------------------------------------------------------------------ +{ + if ( CBJump->isChecked() ) { _UsField = 1 ; } + else { _UsField = 0 ; } +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetFiltrage() +// ------------------------------------------------------------------------ +{ + if (!CBGroupe->isChecked()) return; + MonCreateListGroup *aDlg = new MonCreateListGroup(this, NULL, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),_aCaseName, _aListeGroupes) ; + aDlg->show(); +} + +// ------------------------------------------------------------------------ +void MonCreateHypothesis::setGroups(QStringList listGroup) +// ------------------------------------------------------------------------ +{ + _aListeGroupes=listGroup; +} +// ------------------------------------------------------------------------ +bool MonCreateHypothesis::VerifieZone() +// ------------------------------------------------------------------------ +{ + if ( _aTypeAdap != 0 ) return true; + MESSAGE("Debut de VerifieZone") ; + _aListeZone = GetZonesChecked() ; + MESSAGE(". Longueur de _aListeZone : "<<_aListeZone.count()) ; + if (_aListeZone.count() == 0) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_HYPO_ZONE_2") ); + return false; + } + MESSAGE("Fin de VerifieZone") ; + return true; +} +// ------------------------------------------------------------------------ +bool MonCreateHypothesis::VerifieComposant() +// ------------------------------------------------------------------------ +{ + if ( _aTypeAdap != 1 ) return true; + _aListeComposant = GetListCompChecked() ; + if (_aListeComposant.count() == 0) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_HYPO_COMP") ); + return false; + } + return true; +} + +// ------------------------------------------------------------------------ +void MonCreateHypothesis::AssocieLesZones() +// ------------------------------------------------------------------------ +{ + MESSAGE( "Debut de AssocieLesZones" ); + if ( _aTypeAdap != 0 ) return; + _aListeZone = GetZonesChecked() ; + MESSAGE(". Longueur de _aListeZone : "<<_aListeZone.count()) ; + QString Raff = "1" ; + int TypeUse ; + for ( int i=0 ; i< _aListeZone.count() ; i++ ) + { if ( _aListeZone[i+1] == Raff ) { TypeUse = 1 ; } + else { TypeUse = -1 ; } + aHypothesis->AddZone(_aListeZone[i].toStdString().c_str(), TypeUse); + i += 1 ; + } + MESSAGE( "Fin de AssocieLesZones" ); +}; +// ------------------------------------------------------------------------ +void MonCreateHypothesis::AssocieComposants() +// ------------------------------------------------------------------------ +{ + if ( _aTypeAdap != 1 ) return; + MESSAGE( "Dans AssocieComposants, _TypeThC : " << _TypeThC ); + MESSAGE( "Dans AssocieComposants, _TypeThR : " << _TypeThR ); + + _ThreshR = 0; + if ( _TypeThR == 1 ) { _ThreshR = SpinBox_RAbs->value();} + if ( _TypeThR == 2 ) { _ThreshR = SpinBox_RRel->value();} + if ( _TypeThR == 3 ) { _ThreshR = SpinBox_RPE->value(); } + if ( _TypeThR == 4 ) { _ThreshR = SpinBox_RMuSigma->value(); } + + _ThreshC = 0; + if ( _TypeThC == 1 ) { _ThreshC = SpinBox_CAbs->value();} + if ( _TypeThC == 2 ) { _ThreshC = SpinBox_CRel->value();} + if ( _TypeThC == 3 ) { _ThreshC = SpinBox_CPE->value(); } + if ( _TypeThC == 4 ) { _ThreshC = SpinBox_CMuSigma->value(); } + + _aFieldName=CBFieldName->currentText(); + aHypothesis->SetField(CORBA::string_dup(_aFieldName.toStdString().c_str()) ) ; + if ( _TypeThR > 0 ) { aHypothesis->SetRefinThr( _TypeThR, _ThreshR ) ; } + if ( _TypeThC > 0 ) { aHypothesis->SetUnRefThr( _TypeThC, _ThreshC ) ; } + aHypothesis->SetUseField( _UsField ) ; + aHypothesis->SetUseComp( _UsCmpI ) ; + _aListeComposant = GetListCompChecked() ; + for ( int i=0 ; i< _aListeComposant.count() ; i++ ) + { aHypothesis->AddComp(_aListeComposant[i].toStdString().c_str()); } +}; +// ------------------------------------------------------------------------ +void MonCreateHypothesis::AssocieLesGroupes() +// ------------------------------------------------------------------------ +{ + HOMARD::ListGroupType_var aSeqGroupe = new HOMARD::ListGroupType; + aSeqGroupe->length(_aListeGroupes.size()); + QStringList::const_iterator it; + int i=0; + for (it = _aListeGroupes.constBegin(); it != _aListeGroupes.constEnd(); it++) + aSeqGroupe[i++]=(*it).toStdString().c_str(); + aHypothesis->SetGroups(aSeqGroupe); + +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetFieldNo() +// ------------------------------------------------------------------------ +// Par defaut, on n'interpole rien +{ + if ( _aTypeAdap == 1 ) { GBFieldFile->setVisible(1); } + else { GBFieldFile->setVisible(0); } + TWField->setVisible(0); +// + _TypeFieldInterp = 0 ; +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetFieldAll() +// ------------------------------------------------------------------------ +// Par defaut, on interpole tout +{ + if (_aFieldFile == QString("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_HYPO_FIELD_FILE") ); + close(); + if ( _parent ) { _parent->raise(); _parent->activateWindow(); }; + return; + } + LEFieldFile->setText(_aFieldFile); + LEFieldFile->setReadOnly(1); + GBFieldFile->setVisible(1); + TWField->setVisible(0); +// + _TypeFieldInterp = 1 ; +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetFieldChosen() +// ------------------------------------------------------------------------ +{ + if (_aFieldFile == QString("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_HYPO_FIELD_FILE") ); + close(); + if ( _parent ) { _parent->raise(); _parent->activateWindow(); }; + return; + } + LEFieldFile->setText(_aFieldFile); + LEFieldFile->setReadOnly(1); + GBFieldFile->setVisible(1); + // Recuperation de la liste des champs contenus dans le fichier _aFieldFile + std::list listeChamp = HOMARD_QT_COMMUN::GetListeChamps(QString(_aFieldFile) ); + + // Initialisation de la table + TWField->clear(); + int nbrow=TWField->rowCount(); + for ( int row=0; row< nbrow; row++) + { + TWField->removeRow(row); + } + TWField->setRowCount(0); + std:: list::const_iterator it; + int row=0; + for ( it=listeChamp.begin() ; it != listeChamp.end(); it++) + { + TWField->insertRow(row); + TWField->setItem( row, 0, new QTableWidgetItem( QString ("") ) ); + TWField->item( row, 0 )->setFlags( 0 ); + TWField->item( row, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled ); + TWField->item( row, 0 )->setCheckState( Qt::Unchecked ); + TWField->setItem( row, 1, new QTableWidgetItem(QString(*it).trimmed())); + TWField->item( row, 1 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable ); + row=row+1; + } + TWField->resizeColumnsToContents(); + TWField->resizeRowsToContents(); + TWField->clearSelection(); + TWField->setVisible(1); + + _TypeFieldInterp = 2 ; +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetAdvanced() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetAdvanced "); + if (CBAdvanced->isChecked()) + { GBAdvancedOptions->setVisible(1); + if (_aFieldFile != QString("")) { GBAdapInit->setVisible(1) ; } + else { GBAdapInit->setVisible(0) ; } + } + else + { GBAdvancedOptions->setVisible(0); + _NivMax = -1 ; + _DiamMin = -1. ; + _AdapInit = 0 ; + CBOutputLevel->setChecked(false); + CBOutputQuality->setChecked(false); + CBOutputDiameter->setChecked(false); + CBOutputParent->setChecked(false); + CBOutputVoisins->setChecked(false); + _ExtraOutput = 1 ; + } +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetAIN() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetAIN "); + _AdapInit = 0 ; +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetAIR() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetAIR "); + _AdapInit = 1 ; +} +// ------------------------------------------------------------------------ +void MonCreateHypothesis::SetAID() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetAID "); + _AdapInit = -1 ; +} diff --git a/src/ADAPTGUI/MonCreateHypothesis.h b/src/ADAPTGUI/MonCreateHypothesis.h new file mode 100644 index 000000000..929ee30aa --- /dev/null +++ b/src/ADAPTGUI/MonCreateHypothesis.h @@ -0,0 +1,138 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_CREATEHYPOTHESIS_H +#define MON_CREATEHYPOTHESIS_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(HOMARD_Hypothesis) + +#include "ui_CreateHypothesis.h" +#include + +class MonCreateIteration; +class HOMARD_EXPORT MonCreateHypothesis : public QScrollArea, public Ui_CreateHypothesis +{ + Q_OBJECT + +public: + MonCreateHypothesis( MonCreateIteration* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, + QString aHypotheseName, QString caseName, QString aFieldFile); + ~MonCreateHypothesis(); + + virtual void addZoneinTWZone(QString newZone); + virtual void setGroups(QStringList listGroup); + +protected : + // MonCreateHypothesis( MonCreateIteration* parent, HOMARD::HOMARD_Gen_var myHomardGen, + // QString caseName, QString aFieldFile); + + MonCreateIteration *_parent; + + QString _Name; + QString _aFieldFile ; + QString _aFieldName; + QString _aCaseName; + + int _aTypeAdap; + int _aTypeRaff; + int _aTypeDera; + + int _TypeThR; + double _ThreshR; + int _TypeThC; + double _ThreshC; + + int _UsField; + int _UsCmpI; + int _TypeFieldInterp; + + int _NivMax; + double _DiamMin; + int _AdapInit; + int _ExtraOutput; + + HOMARD::HOMARD_Hypothesis_var aHypothesis; + HOMARD::HOMARD_Gen_var myHomardGen; + + QStringList _aListeZone; + QStringList _aListeComposant; + QStringList _aListeGroupes; + + virtual void InitConnect(); + virtual void InitFields(); + virtual void GetAllZones(); + virtual void SetNewName(); + + virtual void AssocieFieldInterp(); + virtual void AssocieLesZones(); + virtual void AssocieComposants(); + virtual void AssocieLesGroupes(); + virtual bool VerifieZone(); + virtual bool VerifieComposant(); + + virtual QStringList GetZonesChecked(); + virtual QStringList GetListCompChecked(); + +public slots: + + virtual void SetUniforme(); + virtual void SetChamp(); + virtual void SetZone(); + virtual void SetUniRaff(); + virtual void SetUniDera(); + virtual void SetFieldName(); + virtual void SetRPE(); + virtual void SetRAbs(); + virtual void SetRRel(); + virtual void SetRMS(); + virtual void SetRNo(); + virtual void SetCPE(); + virtual void SetCAbs(); + virtual void SetCRel(); + virtual void SetCMS(); + virtual void SetCNo(); + virtual void SetUCL2(); + virtual void SetUCInf(); + virtual void SetUseField(); + virtual void PushZoneNew(); + virtual void PushZoneEdit(); + virtual void PushZoneDelete(); + virtual void SetFiltrage(); + virtual void SetFieldNo(); + virtual void SetFieldAll(); + virtual void SetFieldChosen(); + + virtual void SetAdvanced(); + virtual void SetAIN(); + virtual void SetAIR(); + virtual void SetAID(); + + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); +}; + +#endif // MON_CREATEHYPOTHESIS_H diff --git a/src/ADAPTGUI/MonCreateIteration.cxx b/src/ADAPTGUI/MonCreateIteration.cxx new file mode 100644 index 000000000..99da0c955 --- /dev/null +++ b/src/ADAPTGUI/MonCreateIteration.cxx @@ -0,0 +1,339 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonCreateIteration.h" +#include "MonCreateHypothesis.h" +#include "MonEditHypothesis.h" + +#include +#include + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include + +using namespace std; + +// ----------------------------------------------------------------------------------------------------- +MonCreateIteration::MonCreateIteration(QWidget* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen0, QString IterParentName ): +// ----------------------------------------------------------------------------------------------------- +/* Constructs a MonCreateIteration + * Inherits from CasHomard + * Sets attributes to default values + */ + QScrollArea(0), + Ui_CreateIteration(), + _Name(""), + _IterParentName(IterParentName), + _CaseName("") + { + MESSAGE("Constructeur"); + myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + setupUi(this); + if ( modal ) { setWindowModality(Qt::WindowModal); } + else { setWindowModality(Qt::NonModal); } + InitConnect(); + + SetNewName(); + GetHypotheses(); + if (_IterParentName != QString("")) { SetIterParentName(); } + else { setWindowModality(Qt::NonModal) ; /* permet selection de l'iteration dans l arbre d etude */} + SetTSNo(); +// + adjustSize(); + } +// ------------------------------------------------------------------------ +MonCreateIteration::~MonCreateIteration() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void MonCreateIteration::InitConnect() +// ------------------------------------------------------------------------ +{ + connect( PBIterParent, SIGNAL(pressed()), this, SLOT( SetIterParentName())); + connect( PBHypoEdit, SIGNAL(pressed()), this, SLOT( PushHypoEdit() ) ); + connect( PBHypoNew, SIGNAL(pressed()), this, SLOT( PushHypoNew() ) ); + connect( PushFieldFile, SIGNAL(pressed()), this, SLOT( SetFieldFile() ) ); + connect( RBNo, SIGNAL(clicked()), this, SLOT( SetTSNo())); + connect( RBLast, SIGNAL(clicked()), this, SLOT( SetTSLast())); + connect( RBChosen, SIGNAL(clicked()), this, SLOT( SetTSChosen())); + + 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 MonCreateIteration::GetHypotheses() +// ------------------------------------------------------------------------ +{ + HOMARD::listeHypotheses_var mesHypotheses = myHomardGen->GetAllHypothesesName(); + for (int i=0; ilength(); i++) + { + CBHypothese->addItem(QString(mesHypotheses[i])); + } +} +// ------------------------------------------------------------------------ +bool MonCreateIteration::PushOnApply() +// ------------------------------------------------------------------------ +// Appele lorsque l'un des boutons Ok ou Apply est presse +{ + MESSAGE("PushOnApply"); +// + QString aName = LEName->text().trimmed(); + if ( aName == QString ("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_ITER_NAME") ); + return false; + } + + if ( _IterParentName == QString ("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_ITER_STARTING_POINT") ); + return false; + } + QString aMeshName_np1=LEMeshName_np1->text().trimmed(); + if (aMeshName_np1 == "" ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_ITER_MESH") ); + return false; + } + QString monHypoName=CBHypothese->currentText(); + if (monHypoName == "" ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_ITER_HYPO") ); + return false; + } + HOMARD::HOMARD_Hypothesis_var _myHypothesis = myHomardGen->GetHypothesis(monHypoName.toStdString().c_str()); + HOMARD::listeTypes_var ListTypes (_myHypothesis->GetAdapRefinUnRef()); + int TypeAdap = ListTypes[0]; + if ( TypeAdap == 1 && LEFieldFile->text().trimmed() == QString("") ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_ITER_FIELD_FILE") ); + return false; + } + + MESSAGE ("aMeshName_np1.toStdString " << aMeshName_np1.toStdString()); + MESSAGE ("_CaseName.toStdString " << _CaseName.toStdString() ); + MESSAGE ("_IterParentName.toStdString " << _IterParentName.toStdString() ); + +// Creation de l'objet CORBA si ce n'est pas deja fait sous le meme nom + if (_Name != aName) + { + try + { + _Name = aName; + std::cerr << _Name.toStdString() << std::endl; + aIter = myHomardGen->CreateIteration( \ + CORBA::string_dup(_Name.toStdString().c_str()), + CORBA::string_dup(_IterParentName.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; + } + } +// Mise en place des attributs + std::string IterName = aIter->GetName() ; + + if ( LEFieldFile->text().trimmed() != QString("")) + { + QString FieldFile=LEFieldFile->text().trimmed(); + aIter->SetFieldFile(CORBA::string_dup(FieldFile.toStdString().c_str())); + int rank = SpinBox_Rank->value(); + int step = SpinBox_TimeStep->value(); + if ( step == -2 ) { aIter->SetTimeStepRankLast(); } + else { aIter->SetTimeStepRank(step,rank); } + } + myHomardGen->AssociateIterHypo (IterName.c_str(), monHypoName.toStdString().c_str()); + aIter->SetMeshName(CORBA::string_dup(aMeshName_np1.toStdString().c_str())); + + HOMARD_UTILS::updateObjBrowser() ; + + return true; +} +// ------------------------------------------------------------------------ +void MonCreateIteration::PushOnOK() +// ------------------------------------------------------------------------ +{ + bool bOK = PushOnApply(); + if ( bOK ) this->close(); +} +// ------------------------------------------------------------------------ +void MonCreateIteration::PushOnHelp() +// ------------------------------------------------------------------------ +{ + std::string LanguageShort = myHomardGen->GetLanguageShort(); + HOMARD_UTILS::PushOnHelp(QString("gui_create_iteration.html"), QString(""), QString(LanguageShort.c_str())); +} +// ------------------------------------------------------------------------ +void MonCreateIteration::SetIterParentName() +// ------------------------------------------------------------------------ +{ + if (_IterParentName == QString("")) { + _IterParentName=HOMARD_QT_COMMUN::SelectionArbreEtude(QString("IterationHomard"), 1); + if (_IterParentName == QString("")) { raise();return;}; + } + _CaseName=HOMARD_QT_COMMUN::SelectionCasEtude(); + HOMARD::HOMARD_Iteration_var aIterParent = myHomardGen->GetIteration(_IterParentName.toStdString().c_str()) ; + QString MeshName = aIterParent->GetMeshName(); + + LEMeshName_n->setText(MeshName); + LEMeshName_n->setReadOnly(1); + LEMeshName_np1->setText(MeshName); + + LEIterationParentName->setText(_IterParentName); +} +// ------------------------------------------------- +void MonCreateIteration::SetNewName() +// -------------------------------------------------- +{ +// Recherche d'un nom par defaut qui n'existe pas encore + + HOMARD::listeIterations_var MyObjects=myHomardGen->GetAllIterationsName(); + int num = 0;// + QString aName=""; + while (aName=="" ) + { + aName.setNum(num+1) ; + aName.insert(0, QString("Iter_")); + for ( int i=0; i< MyObjects->length(); i++) + { + if ( aName == QString((MyObjects)[i])) + { + num ++ ; + aName = "" ; + break ; + } + } + } + LEName->setText(aName); +} +// ------------------------------------------------------------------------ +void MonCreateIteration::PushHypoEdit() +// ------------------------------------------------------------------------ +{ + if (CBHypothese->currentText() == QString("")) return; + if (_IterParentName == QString("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_ITER_STARTING_POINT") ); + raise(); + return; + } + QString aFieldFile=LEFieldFile->text().trimmed(); + MonEditHypothesis *HypoDlg = new MonEditHypothesis(this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),CBHypothese->currentText(), _CaseName, aFieldFile) ; + HypoDlg->show(); +} + +// ------------------------------------------------------------------------ +void MonCreateIteration::addHypothese(QString newHypothese) +// ------------------------------------------------------------------------ +{ + CBHypothese->insertItem(0,newHypothese); + CBHypothese->setCurrentIndex(0); +} +// ------------------------------------------------------------------------ +void MonCreateIteration::PushHypoNew() +// ------------------------------------------------------------------------ +{ + if (_IterParentName == QString("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_ITER_STARTING_POINT") ); + raise(); + return; + } + if ( _CaseName == QString("")) + { + HOMARD::HOMARD_Iteration_var aIterParent = myHomardGen->GetIteration(_IterParentName.toStdString().c_str()) ; + _CaseName = aIterParent->GetCaseName(); + } + QString aFieldFile=LEFieldFile->text().trimmed(); + MonCreateHypothesis *HypoDlg = new MonCreateHypothesis(this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), QString(""), _CaseName, aFieldFile) ; + HypoDlg->show(); +} +// ------------------------------------------------------------------------ +void MonCreateIteration::SetFieldFile() +// ------------------------------------------------------------------------ +{ + QString fileName0 = LEFieldFile->text().trimmed(); + QString fileName = HOMARD_QT_COMMUN::PushNomFichier( false, QString("med") ) ; + if (fileName.isEmpty()) fileName = fileName0 ; + LEFieldFile->setText(fileName); + raise(); +} +// ------------------------------------------------------------------------ +void MonCreateIteration::SetTSNo() +// ------------------------------------------------------------------------ +// Si on ne tient pas compte du pas de temps, on declare que le pas de temps +// vaut -1, valeur par defaut de med +{ + Rank->setVisible(0); + SpinBox_Rank->setVisible(0); + SpinBox_Rank->setValue(-1); + + TimeStep->setVisible(0); + SpinBox_TimeStep->setVisible(0); + SpinBox_TimeStep->setValue(-1); +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void MonCreateIteration::SetTSLast() +// ------------------------------------------------------------------------ +// Si on choisit le dernier instant, on declare que le pas de temps vaut -2 +{ + Rank->setVisible(0); + SpinBox_Rank->setVisible(0); + SpinBox_Rank->setValue(-2); + + TimeStep->setVisible(0); + SpinBox_TimeStep->setVisible(0); + SpinBox_TimeStep->setValue(-2); +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void MonCreateIteration::SetTSChosen() +// ------------------------------------------------------------------------ +// Si choisit un instant, on prepositionne a 0 +{ + Rank->setVisible(1); + SpinBox_Rank->setVisible(1); + SpinBox_Rank->setValue(0); + + TimeStep->setVisible(1); + SpinBox_TimeStep->setVisible(1); + SpinBox_TimeStep->setValue(0); +// + adjustSize(); +} + diff --git a/src/ADAPTGUI/MonCreateIteration.h b/src/ADAPTGUI/MonCreateIteration.h new file mode 100644 index 000000000..7567c4866 --- /dev/null +++ b/src/ADAPTGUI/MonCreateIteration.h @@ -0,0 +1,78 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_CREATEITERATION_H +#define MON_CREATEITERATION_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(HOMARD_Cas) + +#include "ui_CreateIteration.h" +#include + +class HOMARD_EXPORT MonCreateIteration : public QScrollArea, public Ui_CreateIteration +{ + Q_OBJECT + +public: + MonCreateIteration( QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString IterParentName ); + ~MonCreateIteration(); + + void addHypothese(QString newHypothese); + + +protected : + MonCreateIteration( QWidget* parent, HOMARD::HOMARD_Gen_var myHomardGen, QString IterParentName ); + + QString _Name; + QString _IterParentName; + QString _CaseName; + + + HOMARD::HOMARD_Iteration_var aIter ; + HOMARD::HOMARD_Iteration_var aIterParent ; + HOMARD::HOMARD_Cas_var aCas ; + HOMARD::HOMARD_Gen_var myHomardGen; + + + virtual void InitConnect(); + virtual void GetHypotheses(); + virtual void SetNewName(); + +public slots: + virtual void SetIterParentName(); + virtual void PushHypoEdit(); + virtual void PushHypoNew(); + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); + virtual void SetFieldFile(); + virtual void SetTSNo(); + virtual void SetTSLast(); + virtual void SetTSChosen(); + +}; + +#endif // MON_CREATEITERATION_H diff --git a/src/ADAPTGUI/MonCreateListGroup.cxx b/src/ADAPTGUI/MonCreateListGroup.cxx new file mode 100644 index 000000000..28f93e315 --- /dev/null +++ b/src/ADAPTGUI/MonCreateListGroup.cxx @@ -0,0 +1,153 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonCreateListGroup.h" +#include "MonCreateHypothesis.h" +#include "MonCreateBoundaryDi.h" + +#include + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include + +#include +#include +#include +#include +#include + +using namespace std; + +// -------------------------------------------------------------------------------------------------------------- +MonCreateListGroup::MonCreateListGroup(MonCreateHypothesis* parentHyp, MonCreateBoundaryDi* parentBound, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen0, QString aCaseName, QStringList listeGroupesHypo) : +// -------------------------------------------------------------------------------------------------------------- +// + QDialog(0), Ui_CreateListGroup(), + _aCaseName (aCaseName), + _listeGroupesHypo (listeGroupesHypo), + _parentHyp(parentHyp), + _parentBound(parentBound) +{ + MESSAGE("Debut de MonCreateListGroup") + myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + setupUi(this); + setModal(modal); + InitConnect(); + InitGroupes(); +} +// -------------------------------------------------------------------------------------------------------------- +MonCreateListGroup::MonCreateListGroup(MonCreateHypothesis* parentHyp, MonCreateBoundaryDi* parentBound, + HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo) : +// -------------------------------------------------------------------------------------------------------------- +// + QDialog(0), Ui_CreateListGroup(), + _aCaseName (aCaseName), + _listeGroupesHypo (listeGroupesHypo), + _parentHyp(parentHyp), + _parentBound(parentBound) +{ + myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen); + setupUi(this); + InitConnect(); +} + +// ------------------------------------------------------------------------ +MonCreateListGroup::~MonCreateListGroup() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void MonCreateListGroup::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 MonCreateListGroup::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 ( _parentHyp ) { _parentHyp->setGroups(ListeGroup);}; + if ( _parentBound ) { _parentBound->setGroups(ListeGroup);}; + return true; +} + + +// ------------------------------------------------------------------------ +void MonCreateListGroup::PushOnOK() +// ------------------------------------------------------------------------ +{ + if (PushOnApply()) + { + this->close(); + if ( _parentHyp ) { _parentHyp->raise(); _parentHyp->activateWindow(); }; + if ( _parentBound ) { _parentBound->raise(); _parentBound->activateWindow(); }; + } +} +// ------------------------------------------------------------------------ +void MonCreateListGroup::PushOnHelp() +// ------------------------------------------------------------------------ +{ + std::string LanguageShort = myHomardGen->GetLanguageShort(); + HOMARD_UTILS::PushOnHelp(QString("gui_create_hypothese.html"), QString(""), QString(LanguageShort.c_str())); +} +// ------------------------------------------------------------------------ +void MonCreateListGroup::InitGroupes() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de MonCreateListGroup::InitGroupes "); + for ( int row=0; row< TWGroupe->rowCount(); row++) + TWGroupe->removeRow(row); + TWGroupe->setRowCount(0); + if (_aCaseName == QString("")) { return; }; + HOMARD::HOMARD_Cas_var monCas= myHomardGen->GetCase(_aCaseName.toStdString().c_str()); + HOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups(); + 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 MonCreateListGroup::InitGroupes "); +} + diff --git a/src/ADAPTGUI/MonCreateListGroup.h b/src/ADAPTGUI/MonCreateListGroup.h new file mode 100644 index 000000000..b0472d3b9 --- /dev/null +++ b/src/ADAPTGUI/MonCreateListGroup.h @@ -0,0 +1,64 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_CREATELISTGROUP_H +#define MON_CREATELISTGROUP_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) + +#include "ui_CreateListGroup.h" +#include + +class MonCreateHypothesis; +class MonCreateBoundaryDi; +class HOMARD_EXPORT MonCreateListGroup : public QDialog, public Ui_CreateListGroup +{ + Q_OBJECT + +public: + MonCreateListGroup( MonCreateHypothesis* parentHyp, MonCreateBoundaryDi* parentBound, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); + MonCreateListGroup( MonCreateHypothesis* parentHyp, MonCreateBoundaryDi* parentBound, HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); + virtual ~MonCreateListGroup(); + +protected : + + HOMARD::HOMARD_Gen_var myHomardGen; + + MonCreateHypothesis * _parentHyp; + MonCreateBoundaryDi * _parentBound; + QString _aCaseName; + QStringList _listeGroupesHypo; + + virtual void InitConnect(); + virtual void InitGroupes(); + +public slots: + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); + +}; + +#endif // MON_CREATELISTGROUP_H diff --git a/src/ADAPTGUI/MonCreateListGroupCAO.cxx b/src/ADAPTGUI/MonCreateListGroupCAO.cxx new file mode 100644 index 000000000..796f2502d --- /dev/null +++ b/src/ADAPTGUI/MonCreateListGroupCAO.cxx @@ -0,0 +1,150 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonCreateListGroupCAO.h" +#include "MonCreateHypothesis.h" +#include "MonCreateBoundaryCAO.h" + +#include + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include + +#include +#include +#include +#include +#include + +using namespace std; + +// -------------------------------------------------------------------------------------------------------------- +MonCreateListGroupCAO::MonCreateListGroupCAO(MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen0, QString aCaseName, QStringList listeGroupesHypo) : +// -------------------------------------------------------------------------------------------------------------- +// + QDialog(0), Ui_CreateListGroup(), + _aCaseName (aCaseName), + _listeGroupesHypo (listeGroupesHypo), + _parentHyp(parentHyp), + _parentBound(parentBound) +{ + MESSAGE("Debut de MonCreateListGroupCAO") + myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + setupUi(this); + setModal(modal); + InitConnect(); + InitGroupes(); +} +// -------------------------------------------------------------------------------------------------------------- +MonCreateListGroupCAO::MonCreateListGroupCAO(MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound, + HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo) : +// -------------------------------------------------------------------------------------------------------------- +// + QDialog(0), Ui_CreateListGroup(), + _aCaseName (aCaseName), + _listeGroupesHypo (listeGroupesHypo), + _parentHyp(parentHyp), + _parentBound(parentBound) +{ + myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen); + setupUi(this); + InitConnect(); +} + +// ------------------------------------------------------------------------ +MonCreateListGroupCAO::~MonCreateListGroupCAO() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void MonCreateListGroupCAO::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 MonCreateListGroupCAO::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 ( _parentHyp ) { _parentHyp->setGroups(ListeGroup);}; + if ( _parentBound ) { _parentBound->setGroups(ListeGroup);}; + return true; +} + + +// ------------------------------------------------------------------------ +void MonCreateListGroupCAO::PushOnOK() +// ------------------------------------------------------------------------ +{ + if (PushOnApply()) this->close(); + if ( _parentHyp ) { _parentHyp->raise(); _parentHyp->activateWindow(); }; + if ( _parentBound ) { _parentBound->raise(); _parentBound->activateWindow(); }; +} +// ------------------------------------------------------------------------ +void MonCreateListGroupCAO::PushOnHelp() +// ------------------------------------------------------------------------ +{ + std::string LanguageShort = myHomardGen->GetLanguageShort(); + HOMARD_UTILS::PushOnHelp(QString("gui_create_hypothese.html"), QString(""), QString(LanguageShort.c_str())); +} +// ------------------------------------------------------------------------ +void MonCreateListGroupCAO::InitGroupes() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de MonCreateListGroupCAO::InitGroupes "); + for ( int row=0; row< TWGroupe->rowCount(); row++) + TWGroupe->removeRow(row); + TWGroupe->setRowCount(0); + if (_aCaseName == QString("")) { return; }; + HOMARD::HOMARD_Cas_var monCas= myHomardGen->GetCase(_aCaseName.toStdString().c_str()); + HOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups(); + 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 MonCreateListGroupCAO::InitGroupes "); +} + diff --git a/src/ADAPTGUI/MonCreateListGroupCAO.h b/src/ADAPTGUI/MonCreateListGroupCAO.h new file mode 100644 index 000000000..898389b83 --- /dev/null +++ b/src/ADAPTGUI/MonCreateListGroupCAO.h @@ -0,0 +1,64 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_CREATELISTGROUPCAO_H +#define MON_CREATELISTGROUPCAO_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) + +#include "ui_CreateListGroup.h" +#include + +class MonCreateHypothesis; +class MonCreateBoundaryCAO; +class HOMARD_EXPORT MonCreateListGroupCAO : public QDialog, public Ui_CreateListGroup +{ + Q_OBJECT + +public: + MonCreateListGroupCAO( MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); + MonCreateListGroupCAO( MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound, HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); + virtual ~MonCreateListGroupCAO(); + +protected : + + HOMARD::HOMARD_Gen_var myHomardGen; + + MonCreateHypothesis * _parentHyp; + MonCreateBoundaryCAO * _parentBound; + QString _aCaseName; + QStringList _listeGroupesHypo; + + virtual void InitConnect(); + virtual void InitGroupes(); + +public slots: + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); + +}; + +#endif // MON_CREATELISTGROUPCAO_H diff --git a/src/ADAPTGUI/MonCreateYACS.cxx b/src/ADAPTGUI/MonCreateYACS.cxx new file mode 100644 index 000000000..4d1002798 --- /dev/null +++ b/src/ADAPTGUI/MonCreateYACS.cxx @@ -0,0 +1,342 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonCreateYACS.h" +#include "HOMARD.hxx" + +#include +#include + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include + +#ifdef WIN32 +#include +#endif +using namespace std; + +// ---------------------------------------------------------------------- +MonCreateYACS::MonCreateYACS (bool modal, HOMARD::HOMARD_Gen_var myHomardGen0, QString CaseName ): +// ---------------------------------------------------------------------- +/* Constructs a MonCreateYACS + * Sets attributes to default values + */ +// ---------------------------------------------------------------------- + Ui_CreateYACS(), + _aCaseName(CaseName), + _aScriptFile(""), + _aDirName(""), + _aMeshFile(""), + _Type(1) + // Les valeurs de _Type, _MaxIter, _MaxNode, _MaxElem doivent etre les memes que celles dans HOMARD_Gen_i::CreateYACSSchema + // et doivent correspondre aux defauts des boutons + { +// MESSAGE("Debut du constructeur de MonCreateYACS"); + myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + setupUi(this); + if ( modal ) { setWindowModality(Qt::WindowModal); } + else { setWindowModality(Qt::NonModal); } + + InitConnect(); + + SetNewName() ; + + if (_aCaseName != QString("")) { SetCaseName(); } + else { setWindowModality(Qt::NonModal); /* permet selection du cas dans l arbre d etude */} +// +// Les valeurs definies dans les preferences + _MaxIter = myHomardGen->GetYACSMaxIter(); + _MaxNode = myHomardGen->GetYACSMaxNode(); + _MaxElem = myHomardGen->GetYACSMaxElem(); + MESSAGE ("Valeur par defaut de MaxIter = " << _MaxIter<<", MaxNode = "<< _MaxNode<<", MaxElem = "<< _MaxElem); + SpinBoxMaxIter->setValue(_MaxIter) ; + SpinBoxMaxNode->setValue(_MaxNode) ; + SpinBoxMaxElem->setValue(_MaxElem) ; +// + adjustSize(); + } + +// ---------------------------------------------------------------------- +MonCreateYACS::MonCreateYACS(HOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName): +// ---------------------------------------------------------------------- +// Constructeur appele par MonEditYACS +// +myHomardGen(myHomardGen0), +_Name (""), +Chgt (false) +{ +// MESSAGE("Debut du constructeur de MonCreateYACS appele par MonEditYACS"); + setupUi(this) ; + + setWindowModality(Qt::WindowModal); + InitConnect() ; +// + adjustSize(); +} +// ------------------------------------------------------------------------ +MonCreateYACS::~MonCreateYACS() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void MonCreateYACS::InitConnect() +// ------------------------------------------------------------------------ +{ + connect( PBCaseName, SIGNAL(pressed()), this, SLOT(SetCaseName())); + connect( PBScriptFile, SIGNAL(pressed()), this, SLOT(SetScriptFile())); + connect( PBDir, SIGNAL(pressed()), this, SLOT(SetDirName())); + connect( PBMeshFile, SIGNAL(pressed()), this, SLOT(SetMeshFile())); + + connect( RBConstant, SIGNAL(clicked()), this, SLOT(SetConstant())); + connect( RBVariable, SIGNAL(clicked()), this, SLOT(SetVariable())); + + 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 MonCreateYACS::PushOnApply() +// -------------------------------- +{ + MESSAGE("PushOnApply"); + +// Le fichier du script + QString aFileName=LEScriptFile->text().trimmed(); + if (aFileName ==QString("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_SCRIPT_FILE") ); + return false; + } + +// Le repertoire de calcul + QString aDirName=LEDirName->text().trimmed(); + if (aDirName == QString("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_DIRECTORY_4") ); + return false; + } + if ( aDirName != _aDirName) + { QString CaseNameDir = myHomardGen->VerifieDir( aDirName.toStdString().c_str()) ; + if ( CaseNameDir != "" ) + { + QString texte ; + texte = QObject::tr("HOM_CASE_DIRECTORY_2") + CaseNameDir ; + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + texte ); + return false; + } + } + if (CHDIR(aDirName.toStdString().c_str()) != 0) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_DIRECTORY_3") ); + return false; + } + +// Le fichier du tout premier maillage + aFileName=LEMeshFile->text().trimmed(); + if (aFileName ==QString("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_MESH") ); + return false; + } + QString aMeshName = HOMARD_QT_COMMUN::LireNomMaillage(aFileName); + if (aMeshName == "" ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MED_FILE_2") ); + return false; + } + + bool bOK = CreateOrUpdate() ; + + if ( bOK ) { HOMARD_UTILS::updateObjBrowser() ; } + + return bOK; +} +// --------------------------------------------------- +bool MonCreateYACS:: CreateOrUpdate() +//---------------------------------------------------- +// Creation ou modification du schema +{ + MESSAGE("CreateOrUpdate"); + bool bOK = true ; + + // 1. Verification des donnees + // 1.1. Le cas + if ( _aCaseName == QString ("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_NAME") ); + return false; + } + // 1.2. Les donnees + QString aScriptFile=LEScriptFile->text().trimmed(); + if ( aScriptFile != _aScriptFile ) + { + _aScriptFile = aScriptFile ; + Chgt = true ; + } + QString aDirName=LEDirName->text().trimmed(); + if ( aDirName != _aDirName ) + { + _aDirName = aDirName ; + Chgt = true ; + } + QString aMeshFile=LEMeshFile->text().trimmed(); + if ( aMeshFile != _aMeshFile ) + { + _aMeshFile = aMeshFile ; + Chgt = true ; + } + + // 2. Creation de l'objet CORBA + try + { + _Name=LEName->text().trimmed(); + aYACS=myHomardGen->CreateYACSSchema(CORBA::string_dup(_Name.toStdString().c_str()), CORBA::string_dup(_aCaseName.toStdString().c_str()), CORBA::string_dup(_aScriptFile.toStdString().c_str()), CORBA::string_dup(_aDirName.toStdString().c_str()), CORBA::string_dup(_aMeshFile.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)) ); + bOK = false; + } + + // 3. Options + if ( bOK ) + { + // 3.1. Le type du schema + aYACS->SetType(_Type) ; + + // 3.2. Les maximums + _MaxIter = SpinBoxMaxIter->value() ; + aYACS->SetMaxIter(_MaxIter) ; + + _MaxNode = SpinBoxMaxNode->value() ; + aYACS->SetMaxNode(_MaxNode) ; + + _MaxElem = SpinBoxMaxElem->value() ; + aYACS->SetMaxElem(_MaxElem) ; + + } + + // 4. Ecriture du fichier + if ( bOK ) + { + int codret = aYACS->Write() ; + if ( codret != 0 ) { bOK = false ; } + } + + return bOK; +} +// --------------------------- +void MonCreateYACS::PushOnOK() +// --------------------------- +{ + bool bOK = PushOnApply(); + if ( bOK ) this->close(); +} +//------------------------------ +void MonCreateYACS::PushOnHelp() +//------------------------------- +{ + std::string LanguageShort = myHomardGen->GetLanguageShort(); + HOMARD_UTILS::PushOnHelp(QString("yacs.html"), QString(""), QString(LanguageShort.c_str())); +} +// ------------------------------------------------- +void MonCreateYACS::SetNewName() +// -------------------------------------------------- +{ + + HOMARD::listeYACSs_var MyObjects = myHomardGen->GetAllYACSsName(); + int num = 0; QString aName=""; + while (aName == QString("") ) + { + aName.setNum(num+1) ; + aName.insert(0, QString("YACS_")) ; + for ( int i=0; ilength(); i++) + { + if ( aName == QString(MyObjects[i])) + { + num ++ ; + aName = "" ; + break ; + } + } + } + LEName->setText(aName); +} +// ------------------------------------------------------------------------ +void MonCreateYACS::SetCaseName() +// ------------------------------------------------------------------------ +{ + MESSAGE ("SetCaseName avec _aCaseName = " << _aCaseName.toStdString() ); + if (_aCaseName == QString("")) + { + _aCaseName=HOMARD_QT_COMMUN::SelectionArbreEtude(QString("CasHomard"), 1); + if (_aCaseName == QString("")) { raise();return;}; + } + LECaseName->setText(_aCaseName); +} +// ------------------------------------------------------------------------ +void MonCreateYACS::SetDirName() +// ------------------------------------------------------------------------ +{ + QString aDirName=QFileDialog::getExistingDirectory (); + if (!(aDirName.isEmpty()))LEDirName->setText(aDirName); +} +// ------------------------------------------------------------------------ +void MonCreateYACS::SetScriptFile() +// ------------------------------------------------------------------------ +{ + QString fileName0 = LEScriptFile->text().trimmed(); + QString fileName = HOMARD_QT_COMMUN::PushNomFichier( false, QString("py") ) ; + if (fileName.isEmpty()) fileName = fileName0 ; + LEScriptFile->setText(fileName); +} +// ------------------------------------------------------------------------ +void MonCreateYACS::SetMeshFile() +// ------------------------------------------------------------------------ +{ + QString fileName0 = LEMeshFile->text().trimmed(); + QString fileName = HOMARD_QT_COMMUN::PushNomFichier( false, QString("med") ) ; + if (fileName.isEmpty()) fileName = fileName0 ; + LEMeshFile->setText(fileName); +} +// ------------------------------------------------------------------------ +void MonCreateYACS::SetConstant() +// ------------------------------------------------------------------------ +{ + _Type = 1 ; +} +// ------------------------------------------------------------------------ +void MonCreateYACS::SetVariable() +// ------------------------------------------------------------------------ +{ + _Type = 2 ; +} diff --git a/src/ADAPTGUI/MonCreateYACS.h b/src/ADAPTGUI/MonCreateYACS.h new file mode 100644 index 000000000..a0c5ba0f7 --- /dev/null +++ b/src/ADAPTGUI/MonCreateYACS.h @@ -0,0 +1,84 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_CREATEYACS_H +#define MON_CREATEYACS_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(HOMARD_Cas) + +#include "ui_CreateYACS.h" +#include + +class HOMARD_EXPORT MonCreateYACS : public QScrollArea, public Ui_CreateYACS +{ + Q_OBJECT + + public: + MonCreateYACS( bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString CaseName); + virtual ~MonCreateYACS(); + + protected : + MonCreateYACS( HOMARD::HOMARD_Gen_var myHomardGen, QString CaseName); + + QString _Name; + QString _aCaseName; + QString _aScriptFile; + QString _aDirName; + QString _aMeshFile; + + int _Type; + int _MaxIter; + int _MaxNode; + int _MaxElem; + + bool Chgt; + + HOMARD::HOMARD_YACS_var aYACS; + HOMARD::HOMARD_Gen_var myHomardGen; + + virtual void InitConnect(); + virtual bool CreateOrUpdate(); + + public slots: + virtual void SetNewName(); + + virtual void SetCaseName(); + virtual void SetDirName(); + + virtual void SetScriptFile(); + virtual void SetMeshFile(); + +// virtual void SetType(int Type); + virtual void SetConstant(); + virtual void SetVariable(); + + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); + +}; + +#endif // MON_CREATEYACS_H diff --git a/src/ADAPTGUI/MonCreateZone.cxx b/src/ADAPTGUI/MonCreateZone.cxx new file mode 100644 index 000000000..1adb91653 --- /dev/null +++ b/src/ADAPTGUI/MonCreateZone.cxx @@ -0,0 +1,713 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonCreateZone.h" +#include "MonCreateHypothesis.h" + +#include +#include + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include + +#include +#include +#include +#include +#include + +using namespace std; + +// ---------------------------------------------------------------------- +MonCreateZone::MonCreateZone(MonCreateHypothesis* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName) : +// ---------------------------------------------------------------------- +/* Constructs a MonCreateZone + appele pour une vraie creation + initialise une boite et non une sphere +*/ + QDialog(0), Ui_CreateZone(), + _parent(parent), + _Name (""), + _aCaseName(caseName), + _Orient(0), + _Type(2), + _Xcentre(0), _Ycentre(0), _Zcentre(0), _Rayon(0), + _ZoneXcentre(0), _ZoneYcentre(0), _ZoneZcentre(0), _ZoneRayon(0), + _Xmin(0), _Xmax(0), _Xincr(0), _Ymin(0), _Ymax(0), _Yincr(0), _Zmin(0), _Zmax(0), _Zincr(0), + _ZoneXmin(0), _ZoneXmax(0), _ZoneYmin(0), _ZoneYmax(0), _ZoneZmin(0), _ZoneZmax(0), + _Xaxis(0), _Yaxis(0), _Zaxis(0), _RayonInt(0), _Haut(0), + _ZoneXaxis(0), _ZoneYaxis(0), _ZoneZaxis(0), _ZoneRayonInt(0), _ZoneHaut(0), + _DMax(0), + Chgt (false) + { + MESSAGE("Constructeur") ; + myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0) ; + setupUi(this) ; + setModal(modal) ; + InitConnect( ) ; + + SetNewName() ; + InitValZone() ; // Cherche les valeurs de la boite englobante le maillage + InitMinMax() ; // Initialise les bornes des boutons + SetBox() ; // Propose une boite en premier choix + + } +// ---------------------------------------------------------------------- +MonCreateZone::MonCreateZone(MonCreateHypothesis* parent, + HOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName): +// ---------------------------------------------------------------------- +// Constructeur appele par MonEditZone +// + QDialog(0), Ui_CreateZone(), + myHomardGen(myHomardGen0), + _parent(parent), + _Name (""), + _aCaseName(caseName), + _Orient(0), + _Type(2), + _Xcentre(0), _Ycentre(0), _Zcentre(0), _Rayon(0), + _ZoneXcentre(0), _ZoneYcentre(0), _ZoneZcentre(0), _ZoneRayon(0), + _ZoneXmin(0), _ZoneXmax(0), _ZoneYmin(0), _ZoneYmax(0), _ZoneZmin(0), _ZoneZmax(0), + _Xaxis(0), _Yaxis(0), _Zaxis(0), _RayonInt(0), _Haut(0), + _ZoneXaxis(0), _ZoneYaxis(0), _ZoneZaxis(0), _ZoneRayonInt(0), _ZoneHaut(0), + // Pour affichage lors de l edition d une Zone sans nom de Cas + _Xmin(1), _Xmax(1), _Xincr(1), _Ymin(1), _Ymax(1), _Yincr(1), _Zmin(1), _Zmax(1), _Zincr(1), + _DMax(1), + Chgt (false) + { + // MESSAGE("Debut de MonCreateZone") + setupUi(this) ; + + setModal(true) ; + InitConnect() ; + } + +// ------------------------------------------------------------------------ +MonCreateZone::~MonCreateZone() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void MonCreateZone::InitConnect() +// ------------------------------------------------------------------------ +{ + connect( RBBox, SIGNAL(clicked()) , this, SLOT(SetBox()) ) ; + connect( RBSphere, SIGNAL(clicked()) , this, SLOT(SetSphere()) ) ; + connect( RBCylinder, SIGNAL(clicked()) , this, SLOT(SetCylinder()) ) ; + connect( RBPipe, SIGNAL(clicked()) , this, SLOT(SetPipe()) ) ; + 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 MonCreateZone::InitValZone() +// ------------------------------------------------------------------------ +{ +// +// 1. Les coordonnees extremes du maillage +// + if (_aCaseName == QString("")) { return; } + + HOMARD::HOMARD_Cas_var aCas = myHomardGen->GetCase(_aCaseName.toStdString().c_str()) ; + HOMARD::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]; + if ( _Xincr < 0 ) { _Orient = 2 ; } + else if ( _Yincr < 0 ) { _Orient = 3 ; } + else if ( _Zincr < 0 ) { _Orient = 1 ; } + MESSAGE ("_Xmin : " << _Xmin << " _Xmax : " << _Xmax << " _Xincr : " << _Xincr ) ; + MESSAGE ("_Ymin : " << _Ymin << " _Ymax : " << _Ymax << " _Yincr : " << _Yincr ) ; + MESSAGE ("_Zmin : " << _Zmin << " _Zmax : " << _Zmax << " _Zincr : " << _Zincr) ; + MESSAGE ("_DMax : " << _DMax) ; + MESSAGE ("_Orient : " << _Orient) ; +// 2. Caracteristiques des zones +// en X + if ( _Xincr < 0 ) + { + _ZoneXmin = _Xmin; + _ZoneXmax = _Xmax; + } + else + { + _ZoneXmin = _Xmin - _Xincr; + _ZoneXmax = _Xmax + _Xincr; + } + _Xcentre=(_Xmin + _Xmax)/2.; +// en Y + if ( _Yincr < 0 ) + { + _ZoneYmin = _Ymin; + _ZoneYmax = _Ymax; + } + else + { + _ZoneYmin = _Ymin - _Yincr; + _ZoneYmax = _Ymax + _Yincr; + } + _Ycentre=(_Ymin + _Ymax)/2.; +// en Z + if ( _Zincr < 0 ) + { + _ZoneZmin = _Zmin; + _ZoneZmax = _Zmax; + } + else + { + _ZoneZmin = _Zmin - _Zincr; + _ZoneZmax = _Zmax + _Zincr; + } + _Zcentre=(_Zmin + _Zmax)/2.; +// Rayons + _Rayon= _DMax/4.; + _RayonInt= _DMax/8.; +// Axe et hauteur pour cylindre et tuyau + _Haut= _DMax/2.; +// 3. Gestion des icones + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr() ; + QPixmap pix = resMgr->loadPixmap( "HOMARD", "boxdxyz.png" ) ; + if ( _Orient == 0 ) { pix = resMgr->loadPixmap( "HOMARD", "boxdxyz.png" ) ; } + else { pix = resMgr->loadPixmap( "HOMARD", "boxdxy.png" ) ; } + QIcon IS=QIcon(pix) ; + RBBox->setIcon(IS) ; + + if ( _Orient == 0 ) { pix = resMgr->loadPixmap( "HOMARD", "cylinderpointvector.png" ) ; } + else { pix = resMgr->loadPixmap( "HOMARD", "disk.png" ) ; + RBCylinder->setText(QApplication::translate("CreateZone", "Disk", 0)); + TLXbase->setText(QApplication::translate("CreateZone", "X centre", 0)); + TLYbase->setText(QApplication::translate("CreateZone", "Y centre", 0)); + TLZbase->setText(QApplication::translate("CreateZone", "Z centre", 0)); } + IS=QIcon(pix) ; + RBCylinder->setIcon(IS) ; + + if ( _Orient == 0 ) { pix = resMgr->loadPixmap( "HOMARD", "pipe.png" ) ; } + else { pix = resMgr->loadPixmap( "HOMARD", "diskwithhole.png" ) ; + RBPipe->setText(QApplication::translate("CreateZone", "Disk with hole", 0)); + TLXbase_p->setText(QApplication::translate("CreateZone", "X centre", 0)); + TLYbase_p->setText(QApplication::translate("CreateZone", "Y centre", 0)); + TLZbase_p->setText(QApplication::translate("CreateZone", "Z centre", 0)); } + IS=QIcon(pix) ; + RBPipe->setIcon(IS) ; + + if ( _Orient == 0 ) { pix = resMgr->loadPixmap( "HOMARD", "spherepoint.png" ) ; + IS=QIcon(pix) ; + RBSphere->setIcon(IS) ; } + else { RBSphere->setVisible(0) ; } +} + +// ------------------------------------------------------------------------ +void MonCreateZone::InitMinMax() +// ------------------------------------------------------------------------ +{ +// en X + if ( _Xincr > 0) { + SpinBox_Xmini->setRange(_ZoneXmin,_ZoneXmax) ; + SpinBox_Xmaxi->setRange(_ZoneXmin,_ZoneXmax) ; + SpinBox_Xmini->setSingleStep(_Xincr) ; + SpinBox_Xmaxi->setSingleStep(_Xincr) ; + SpinBox_Xcentre->setSingleStep(_Xincr) ; + } + else { + SpinBox_Xmini->setValue(_ZoneXmin) ; + SpinBox_Xmaxi->setValue(_ZoneXmax) ; + SpinBox_Xcentre->setValue(_Xcentre) ; + SpinBox_Xbase->setValue(_Xcentre) ; + SpinBox_Xbase_p->setValue(_Xcentre) ; + SpinBox_Xmini->setEnabled(false) ; + SpinBox_Xmaxi->setEnabled(false) ; + SpinBox_Xcentre->setEnabled(false) ; + SpinBox_Xbase->setEnabled(false) ; + SpinBox_Xbase_p->setEnabled(false) ; + } +// en Y + if ( _Yincr > 0) { + SpinBox_Ymini->setRange(_ZoneYmin,_ZoneYmax) ; + SpinBox_Ymaxi->setRange(_ZoneYmin,_ZoneYmax) ; + SpinBox_Ymini->setSingleStep(_Yincr) ; + SpinBox_Ymaxi->setSingleStep(_Yincr) ; + SpinBox_Ycentre->setSingleStep(_Yincr) ; + } + else { + SpinBox_Ymini->setValue(_ZoneYmin) ; + SpinBox_Ymaxi->setValue(_ZoneYmax) ; + SpinBox_Ycentre->setValue(_Ycentre) ; + SpinBox_Ybase->setValue(_Ycentre) ; + SpinBox_Ybase_p->setValue(_Ycentre) ; + SpinBox_Ymini->setEnabled(false) ; + SpinBox_Ymaxi->setEnabled(false) ; + SpinBox_Ycentre->setEnabled(false) ; + SpinBox_Ybase->setEnabled(false) ; + SpinBox_Ybase_p->setEnabled(false) ; + } +// en Z + if ( _Zincr > 0) { + SpinBox_Zmini->setRange(_ZoneZmin,_ZoneZmax) ; + SpinBox_Zmaxi->setRange(_ZoneZmin,_ZoneZmax) ; + SpinBox_Zmini->setSingleStep(_Zincr) ; + SpinBox_Zmaxi->setSingleStep(_Zincr) ; + SpinBox_Zcentre->setSingleStep(_Zincr) ; + } + else { + SpinBox_Zmini->setValue(_ZoneZmin) ; + SpinBox_Zmaxi->setValue(_ZoneZmax) ; + SpinBox_Zcentre->setValue(_Zcentre) ; + SpinBox_Zbase->setValue(_Zcentre) ; + SpinBox_Zbase_p->setValue(_Zcentre) ; + SpinBox_Zmini->setEnabled(false) ; + SpinBox_Zmaxi->setEnabled(false) ; + SpinBox_Zcentre->setEnabled(false) ; + SpinBox_Zbase->setEnabled(false) ; + SpinBox_Zbase_p->setEnabled(false) ; + } +// Rayons + SpinBox_Rayon->setSingleStep(_Rayon/10.) ; + SpinBox_Radius->setSingleStep(_Rayon/10.) ; + SpinBox_Radius_int->setSingleStep(_Rayon/20.) ; + SpinBox_Radius_ext->setSingleStep(_Rayon/10.) ; +// Axe et hauteur +// Si une coordonnee est constante, inutile de demander l'axe et la hauteur + if ( _Orient > 0) { + SpinBox_Xaxis->setVisible(0) ; + SpinBox_Yaxis->setVisible(0) ; + SpinBox_Zaxis->setVisible(0) ; + SpinBox_Haut->setVisible(0) ; + TLXaxis->setVisible(0) ; + TLYaxis->setVisible(0) ; + TLZaxis->setVisible(0) ; + TLHaut->setVisible(0) ; + SpinBox_Xaxis_p->setVisible(0) ; + SpinBox_Yaxis_p->setVisible(0) ; + SpinBox_Zaxis_p->setVisible(0) ; + SpinBox_Haut_p->setVisible(0) ; + TLXaxis_p->setVisible(0) ; + TLYaxis_p->setVisible(0) ; + TLZaxis_p->setVisible(0) ; + TLHaut_p->setVisible(0) ; + } + else { + SpinBox_Haut->setSingleStep(_Rayon/10.) ; + SpinBox_Haut_p->setSingleStep(_Rayon/10.) ; + } +} +// ------------------------------------------------------------------------ +bool MonCreateZone::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_ZONE_NAME") ) ; + return false; + } + + switch (_Type) + { + case 11 : // il s agit d un rectangle + { } + case 12 : // il s agit d un rectangle + { } + case 13 : // il s agit d un rectangle + { } + case 2 : // il s agit d un parallelipipede rectangle + { + if ( (_ZoneXmin != SpinBox_Xmini->value()) || + (_ZoneXmax != SpinBox_Xmaxi->value()) || + (_ZoneYmin != SpinBox_Ymini->value()) || + (_ZoneYmax != SpinBox_Ymaxi->value()) || + (_ZoneZmin != SpinBox_Zmini->value()) || + (_ZoneZmax != SpinBox_Zmaxi->value()) ) + { + Chgt = true; + _ZoneXmin= SpinBox_Xmini->value() ; _ZoneXmax= SpinBox_Xmaxi->value() ; + _ZoneYmin= SpinBox_Ymini->value() ; _ZoneYmax= SpinBox_Ymaxi->value() ; + _ZoneZmin= SpinBox_Zmini->value() ; _ZoneZmax= SpinBox_Zmaxi->value() ; + } + break ; + } + case 4 : // il s agit d une sphere + { + if ( (_ZoneXcentre != SpinBox_Xcentre->value()) || + (_ZoneYcentre != SpinBox_Ycentre->value()) || + (_ZoneZcentre != SpinBox_Zbase->value()) || + (_ZoneRayon != SpinBox_Rayon->value()) ) + { + Chgt = true; + _ZoneXcentre=SpinBox_Xcentre->value() ; + _ZoneYcentre=SpinBox_Ycentre->value() ; + _ZoneZcentre=SpinBox_Zcentre->value() ; + _ZoneRayon=SpinBox_Rayon->value() ; + } + break ; + } + case 31 : // il s agit d un disque issu d'un cylindre + { } + case 32 : // il s agit d un disque issu d'un cylindre + { } + case 33 : // il s agit d un disque issu d'un cylindre + { } + case 5 : // il s agit d un cylindre + { + if ( (_ZoneXcentre != SpinBox_Xbase->value()) || + (_ZoneYcentre != SpinBox_Ybase->value()) || + (_ZoneZcentre != SpinBox_Zbase->value()) || + (_ZoneRayon != SpinBox_Radius->value()) || + (_ZoneHaut != SpinBox_Haut->value()) || + (_ZoneXaxis != SpinBox_Xaxis->value()) || + (_ZoneYaxis != SpinBox_Yaxis->value()) || + (_ZoneZaxis != SpinBox_Zaxis->value()) ) + { + Chgt = true; + _ZoneXcentre=SpinBox_Xbase->value() ; + _ZoneYcentre=SpinBox_Ybase->value() ; + _ZoneZcentre=SpinBox_Zbase->value() ; + _ZoneXaxis=SpinBox_Xaxis->value() ; + _ZoneYaxis=SpinBox_Yaxis->value() ; + _ZoneZaxis=SpinBox_Zaxis->value() ; + _ZoneRayon=SpinBox_Radius->value() ; + _ZoneHaut=SpinBox_Haut->value() ; + } + break ; + } + case 61 : // il s agit d un disque avec trou + { } + case 62 : // il s agit d un disque avec trou + { } + case 63 : // il s agit d un disque avec trou + { } + case 7 : // il s agit d un tuyau + { + if ( (_ZoneXcentre != SpinBox_Xbase_p->value()) || + (_ZoneYcentre != SpinBox_Ybase_p->value()) || + (_ZoneZcentre != SpinBox_Zbase_p->value()) || + (_ZoneRayonInt != SpinBox_Radius_int->value()) || + (_ZoneRayon != SpinBox_Radius_ext->value()) || + (_ZoneHaut != SpinBox_Haut_p->value()) || + (_ZoneXaxis != SpinBox_Xaxis_p->value()) || + (_ZoneYaxis != SpinBox_Yaxis_p->value()) || + (_ZoneZaxis != SpinBox_Zaxis_p->value()) ) + { + Chgt = true; + _ZoneXcentre=SpinBox_Xbase_p->value() ; + _ZoneYcentre=SpinBox_Ybase_p->value() ; + _ZoneZcentre=SpinBox_Zbase_p->value() ; + _ZoneXaxis=SpinBox_Xaxis_p->value() ; + _ZoneYaxis=SpinBox_Yaxis_p->value() ; + _ZoneZaxis=SpinBox_Zaxis_p->value() ; + _ZoneRayonInt=SpinBox_Radius_int->value() ; + _ZoneRayon=SpinBox_Radius_ext->value() ; + _ZoneHaut=SpinBox_Haut_p->value() ; + } + break ; + } + } + +// Controles +// Pour un rectangle ou un parallelepipede : + if ( ( _Type >= 11 && _Type <= 13 ) || _Type == 2 ) + { + if ((_ZoneXmin >= _ZoneXmax) && (_Xincr > 0)) { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_ZONE_LIMIT").arg("X") ) ; + return false; } + + if ((_ZoneYmin >= _ZoneYmax) && (_Yincr > 0)) { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_ZONE_LIMIT").arg("Y") ) ; + return false; } + + if ((_ZoneZmin >= _ZoneZmax) && (_Zincr > 0)) { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_ZONE_LIMIT").arg("Z") ) ; + return false; } + } +// L'axe pour un cylindre ou un tuyau : + if ( _Type == 5 || _Type == 7 ) + { + double daux = _ZoneXaxis*_ZoneXaxis + _ZoneYaxis*_ZoneYaxis + _ZoneZaxis*_ZoneZaxis ; + if ( daux < 0.0000001 ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_AXE") ); + return false; + } + } +// Rayons pour disque avec trou ou un tuyau : + if ( ( _Type >= 61 && _Type <= 63 ) || _Type == 7 ) + { + if ( _ZoneRayonInt >= _ZoneRayon ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_ZONE_RAYON") ); + return false; + } + } +// +// Création ou mise à jour de la zone +// + bool bOK = CreateOrUpdateZone() ; + + if ( bOK ) { HOMARD_UTILS::updateObjBrowser() ; } + + return bOK; + +} +// --------------------------------------------------- +bool MonCreateZone::CreateOrUpdateZone() +//---------------------------------------------------- +// Creation de la zone +{ + MESSAGE("Debut de CreateOrUpdateZone 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 11 : // il s agit d un rectangle, dans le plan (X,Y) + { aZone = myHomardGen->CreateZoneBox2D(CORBA::string_dup(_Name.toStdString().c_str()), \ + _ZoneXmin, _ZoneXmax, _ZoneYmin, _ZoneYmax, _Orient ); + break; + } + case 12 : // il s agit d un rectangle, dans le plan (Y,Z) + { aZone = myHomardGen->CreateZoneBox2D(CORBA::string_dup(_Name.toStdString().c_str()), \ + _ZoneYmin, _ZoneYmax, _ZoneZmin, _ZoneZmax, _Orient ); + break; + } + case 13 : // il s agit d un rectangle, dans le plan (Z,X) + { aZone = myHomardGen->CreateZoneBox2D(CORBA::string_dup(_Name.toStdString().c_str()), \ + _ZoneZmin, _ZoneZmax, _ZoneXmin, _ZoneXmax, _Orient ); + break; + } + case 2 : // il s agit d un parallelepipede + { aZone = myHomardGen->CreateZoneBox(CORBA::string_dup(_Name.toStdString().c_str()), \ + _ZoneXmin, _ZoneXmax, _ZoneYmin, _ZoneYmax, _ZoneZmin, _ZoneZmax ); + break; + } + case 4 : // il s agit d une sphere + { aZone = myHomardGen->CreateZoneSphere(CORBA::string_dup(_Name.toStdString().c_str()), \ + _ZoneXcentre, _ZoneYcentre, _ZoneZcentre, _ZoneRayon ); + break; + } + case 31 : // il s agit d un disque issu d'un cylindre, dans le plan (X,Y) + { aZone = myHomardGen->CreateZoneDisk(CORBA::string_dup(_Name.toStdString().c_str()), \ + _ZoneXcentre, _ZoneYcentre, _ZoneRayon, _Orient ); + break; + } + case 32 : // il s agit d un disque issu d'un cylindre, dans le plan (Y,Z) + { aZone = myHomardGen->CreateZoneDisk(CORBA::string_dup(_Name.toStdString().c_str()), \ + _ZoneYcentre, _ZoneZcentre, _ZoneRayon, _Orient ); + break; + } + case 33 : // il s agit d un disque issu d'un cylindre, dans le plan (Z,X) + { aZone = myHomardGen->CreateZoneDisk(CORBA::string_dup(_Name.toStdString().c_str()), \ + _ZoneZcentre, _ZoneXcentre, _ZoneRayon, _Orient ); + break; + } + case 5 : // il s agit d un cylindre + { aZone = myHomardGen->CreateZoneCylinder(CORBA::string_dup(_Name.toStdString().c_str()), \ + _ZoneXcentre, _ZoneYcentre, _ZoneZcentre, _ZoneXaxis, _ZoneYaxis, _ZoneZaxis, _ZoneRayon, _ZoneHaut ); + break; + } + case 61 : // il s agit d un disque avec trou, dans le plan (X,Y) + { aZone = myHomardGen->CreateZoneDiskWithHole(CORBA::string_dup(_Name.toStdString().c_str()), \ + _ZoneXcentre, _ZoneYcentre, _ZoneRayon, _ZoneRayonInt, _Orient ); + break; + } + case 62 : // il s agit d un disque avec trou, dans le plan (Y,Z) + { aZone = myHomardGen->CreateZoneDiskWithHole(CORBA::string_dup(_Name.toStdString().c_str()), \ + _ZoneYcentre, _ZoneZcentre, _ZoneRayon, _ZoneRayonInt, _Orient ); + break; + } + case 63 : // il s agit d un disque avec trou, dans le plan (Z,X) + { aZone = myHomardGen->CreateZoneDiskWithHole(CORBA::string_dup(_Name.toStdString().c_str()), \ + _ZoneZcentre, _ZoneXcentre, _ZoneRayon, _ZoneRayonInt, _Orient ); + break; + } + case 7 : // il s agit d un tuyau + { aZone = myHomardGen->CreateZonePipe(CORBA::string_dup(_Name.toStdString().c_str()), \ + _ZoneXcentre, _ZoneYcentre, _ZoneZcentre, _ZoneXaxis, _ZoneYaxis, _ZoneZaxis, _ZoneRayon, _ZoneHaut, _ZoneRayonInt ); + 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->addZoneinTWZone(_Name) ; +// Mise en place des attributs + aZone->SetLimit(_Xincr, _Yincr, _Zincr) ; + + return true; + } + else { + QMessageBox::warning( 0, QObject::tr("HOM_WARNING"), + QObject::tr("HOM_SELECT_OBJECT_4") ); + return false ; + } + MESSAGE("Fin de CreateOrUpdateZone"); +} +// ------------------------------------------------------------------------ +void MonCreateZone::PushOnOK() +// ------------------------------------------------------------------------ +{ + if (PushOnApply()) this->close() ; +} +// ------------------------------------------------------------------------ +void MonCreateZone::PushOnHelp() +// ------------------------------------------------------------------------ +{ + std::string LanguageShort = myHomardGen->GetLanguageShort(); + HOMARD_UTILS::PushOnHelp(QString("gui_create_zone.html"), QString(""), QString(LanguageShort.c_str())); +} + +// ----------------------------------- +void MonCreateZone::SetNewName() +// ----------------------------------- +{ + MESSAGE("SetNewName"); +// Recherche d'un nom par defaut qui n'existe pas encore + + HOMARD::listeZones_var MyObjects = myHomardGen->GetAllZonesName() ; + int num = 0; QString aName=""; + while (aName=="" ) + { + aName.setNum(num+1) ; + aName.insert(0, QString("Zone_")) ; + for ( int i=0; ilength() ; i++) + { + if ( aName == QString(MyObjects[i])) + { + num ++ ; + aName = "" ; + break ; + } + } + } + LEName->setText(aName); + MESSAGE("SetNewName aName ="<setVisible(1) ; + gBSphere->setVisible(0) ; + gBCylindre->setVisible(0) ; + gBPipe->setVisible(0) ; + adjustSize() ; + _Type=2; +// Sachant que l'increment est le 1/100eme de l'ecart (min/max), cela revient +// a initialiser la boite sur une boite 'centrale' comprise entre 2/5 et 3/5 + if ( _Xincr > 0 ) { SpinBox_Xmini->setValue(_Xcentre-10*_Xincr) ; + SpinBox_Xmaxi->setValue(_Xcentre+10*_Xincr) ; } + else { _Type=12 ; } + if ( _Yincr > 0 ) { SpinBox_Ymini->setValue(_Ycentre-10*_Yincr) ; + SpinBox_Ymaxi->setValue(_Ycentre+10*_Yincr) ; } + else { _Type=13 ; } + if ( _Zincr > 0 ) { SpinBox_Zmini->setValue(_Zcentre-10*_Zincr) ; + SpinBox_Zmaxi->setValue(_Zcentre+10*_Zincr) ; } + else { _Type=11 ; } + MESSAGE("Fin de SetBox") +} +// ------------------------------------------------------------------------ +void MonCreateZone::SetSphere() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetSphere") + gBBox->setVisible(0) ; + gBSphere->setVisible(1) ; + gBCylindre->setVisible(0) ; + gBPipe->setVisible(0) ; + adjustSize() ; + _Type=4; + SpinBox_Xcentre->setValue(_Xcentre) ; + SpinBox_Ycentre->setValue(_Ycentre) ; + SpinBox_Zcentre->setValue(_Zcentre) ; + SpinBox_Rayon->setValue(_Rayon) ; + MESSAGE("Fin de SetSphere") +} +// ------------------------------------------------------------------------ +void MonCreateZone::SetCylinder() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetCylinder") + gBBox->setVisible(0) ; + gBSphere->setVisible(0) ; + gBCylindre->setVisible(1) ; + gBPipe->setVisible(0) ; + adjustSize() ; + _Type=5; + if ( _Xincr > 0 ) { SpinBox_Xbase->setValue(_Xcentre) ; + SpinBox_Xaxis->setValue(0.) ; } + else { _Type=32 ; } + if ( _Yincr > 0 ) { SpinBox_Ybase->setValue(_Ycentre) ; + SpinBox_Yaxis->setValue(0.) ; } + else { _Type=33 ; } + if ( _Zincr > 0 ) { SpinBox_Zbase->setValue(_Zcentre) ; + SpinBox_Zaxis->setValue(1.) ; } + else { _Type=31 ; } + SpinBox_Radius->setValue(_Rayon) ; + SpinBox_Haut->setValue(_Haut) ; + MESSAGE("Fin de SetCylinder") +} +// ------------------------------------------------------------------------ +void MonCreateZone::SetPipe() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetPipe") + gBBox->setVisible(0) ; + gBSphere->setVisible(0) ; + gBCylindre->setVisible(0) ; + gBPipe->setVisible(1) ; + adjustSize() ; + _Type=7; + if ( _Xincr > 0 ) { SpinBox_Xbase_p->setValue(_Xcentre) ; + SpinBox_Xaxis_p->setValue(0.) ; } + else { _Type=62 ; } + if ( _Yincr > 0 ) { SpinBox_Ybase_p->setValue(_Ycentre) ; + SpinBox_Yaxis_p->setValue(0.) ; } + else { _Type=63 ; } + if ( _Zincr > 0 ) { SpinBox_Zbase_p->setValue(_Zcentre) ; + SpinBox_Zaxis_p->setValue(1.) ; } + else { _Type=61 ; } + SpinBox_Radius_int->setValue(_RayonInt) ; + SpinBox_Radius_ext->setValue(_Rayon) ; + SpinBox_Haut_p->setValue(_Haut) ; + MESSAGE("Fin de SetPipe") +} + + diff --git a/src/ADAPTGUI/MonCreateZone.h b/src/ADAPTGUI/MonCreateZone.h new file mode 100644 index 000000000..932e9965f --- /dev/null +++ b/src/ADAPTGUI/MonCreateZone.h @@ -0,0 +1,87 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_CREATEZONE_H +#define MON_CREATEZONE_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) + +#include "ui_CreateZone.h" +#include + +class MonCreateHypothesis; +class HOMARD_EXPORT MonCreateZone : public QDialog, public Ui_CreateZone +{ + Q_OBJECT + +public: + MonCreateZone( MonCreateHypothesis* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString caseName); + virtual ~MonCreateZone(); + +protected : + MonCreateZone( MonCreateHypothesis* parent, + HOMARD::HOMARD_Gen_var myHomardGen, + QString caseName); + + MonCreateHypothesis * _parent; + + QString _Name; + QString _aCaseName; + + int _Orient; + int _Type; + double _Xcentre, _Ycentre, _Zcentre, _Rayon ; + double _Xmin, _Xmax, _Xincr, _Ymin, _Ymax, _Yincr, _Zmin, _Zmax, _Zincr ; + double _ZoneXcentre, _ZoneYcentre, _ZoneZcentre, _ZoneRayon ; + double _ZoneXmin, _ZoneXmax, _ZoneYmin, _ZoneYmax, _ZoneZmin, _ZoneZmax ; + double _Xaxis, _Yaxis, _Zaxis, _RayonInt, _Haut ; + double _ZoneXaxis, _ZoneYaxis, _ZoneZaxis, _ZoneRayonInt, _ZoneHaut ; + double _DMax ; + + bool Chgt; + + HOMARD::HOMARD_Zone_var aZone ; + HOMARD::HOMARD_Gen_var myHomardGen; + + virtual void InitConnect(); + virtual void InitValZone(); + virtual void InitMinMax(); + virtual void SetNewName(); + virtual bool CreateOrUpdateZone(); + +public slots: + virtual void SetBox(); + virtual void SetSphere(); + virtual void SetCylinder(); + virtual void SetPipe(); + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); + +}; + +#endif // MON_CREATEZONE_H diff --git a/src/ADAPTGUI/MonEditBoundaryAn.cxx b/src/ADAPTGUI/MonEditBoundaryAn.cxx new file mode 100644 index 000000000..6f7889d94 --- /dev/null +++ b/src/ADAPTGUI/MonEditBoundaryAn.cxx @@ -0,0 +1,399 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonEditBoundaryAn.h" + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include + +using namespace std; + +// ------------------------------------------------------------------------ +MonEditBoundaryAn::MonEditBoundaryAn( MonCreateCase* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString caseName, QString Name ): +// ------------------------------------------------------------------------ +/* Constructs a MonEditBoundaryAn + herite de MonCreateBoundaryAn +*/ + MonCreateBoundaryAn(parent, myHomardGen, caseName) +{ + MESSAGE("Debut de MonEditBoundaryAn pour " << Name.toStdString().c_str()); + setWindowTitle(QObject::tr("HOM_BOUN_A_EDIT_WINDOW_TITLE")); + _Name=Name; + aBoundaryAn = myHomardGen->GetBoundary(_Name.toStdString().c_str()); + InitValEdit(); +} +// ------------------------------------------------------------------------ +MonEditBoundaryAn::~MonEditBoundaryAn() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void MonEditBoundaryAn::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 MonEditBoundaryAn::InitValBoundaryAnLimit() +// ------------------------------------------------------------------------ +{ + HOMARD::double_array_var mesCoordLimits = aBoundaryAn->GetLimit(); + ASSERT(mesCoordLimits->length() == 3 ); + _Xincr=mesCoordLimits[0]; + _Yincr=mesCoordLimits[1]; + _Zincr=mesCoordLimits[2]; +} +// ------------------------------------------------------------------------ +void MonEditBoundaryAn::InitValBoundaryAnCylindre() +// ------------------------------------------------------------------------ +{ + HOMARD::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 MonEditBoundaryAn::InitValBoundaryAnSphere() +// ------------------------------------------------------------------------ +{ + HOMARD::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords(); + ASSERT(mesCoordBoundary->length() == 4 ); + _BoundaryAnXcentre=mesCoordBoundary[0]; + _BoundaryAnYcentre=mesCoordBoundary[1]; + _BoundaryAnZcentre=mesCoordBoundary[2]; + _BoundaryAnRayon=mesCoordBoundary[3]; +} +// ------------------------------------------------------------------------ +void MonEditBoundaryAn::InitValBoundaryAnConeA() +// ------------------------------------------------------------------------ +{ + HOMARD::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 MonEditBoundaryAn::InitValBoundaryAnConeR() +// ------------------------------------------------------------------------ +{ + HOMARD::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 MonEditBoundaryAn::InitValBoundaryAnTore() +// ------------------------------------------------------------------------ +{ + HOMARD::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 MonEditBoundaryAn::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 MonEditBoundaryAn::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 MonEditBoundaryAn::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 MonEditBoundaryAn::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 MonEditBoundaryAn::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 MonEditBoundaryAn::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; +} + diff --git a/src/ADAPTGUI/MonEditBoundaryAn.h b/src/ADAPTGUI/MonEditBoundaryAn.h new file mode 100644 index 000000000..ea98981e3 --- /dev/null +++ b/src/ADAPTGUI/MonEditBoundaryAn.h @@ -0,0 +1,61 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_EDITBOUNDARYAN_H +#define MON_EDITBOUNDARYAN_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) + +#include + +class HOMARD_EXPORT MonEditBoundaryAn : public MonCreateBoundaryAn +{ + Q_OBJECT +public: + MonEditBoundaryAn( MonCreateCase* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString caseName, QString Name); + virtual ~MonEditBoundaryAn(); + +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: + +}; + +#endif // MON_EDITZONE_H diff --git a/src/ADAPTGUI/MonEditBoundaryCAO.cxx b/src/ADAPTGUI/MonEditBoundaryCAO.cxx new file mode 100644 index 000000000..36e3714ed --- /dev/null +++ b/src/ADAPTGUI/MonEditBoundaryCAO.cxx @@ -0,0 +1,105 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonEditBoundaryCAO.h" +#include "MonEditListGroupCAO.h" + +#include + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include + +using namespace std; + +// ------------------------------------------------------------------------------------------------------------------------------------- +MonEditBoundaryCAO::MonEditBoundaryCAO( MonCreateCase* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString caseName, QString Name): +// ------------------------------------------------------------------------------------------------------------------------------------- +/* Constructs a MonEditBoundaryCAO + herite de MonCreateBoundaryCAO +*/ + MonCreateBoundaryCAO(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; + } + + HOMARD::ListGroupType_var maListe = aBoundary->GetGroups(); + for ( int i = 0; i < maListe->length(); i++ ) + _listeGroupesBoundary << QString(maListe[i]); + +} +// ------------------------------ +MonEditBoundaryCAO::~MonEditBoundaryCAO() +// ------------------------------ +{ +} +// ------------------------------ +void MonEditBoundaryCAO::InitValEdit() +// ------------------------------ +{ + LEName->setText(_aName); + LEName->setReadOnly(true); + + QString aDataFile = aBoundary->GetDataFile(); + LEFileName->setText(aDataFile); + LEFileName->setReadOnly(1); + PushFichier->setVisible(0); +// + adjustSize(); +} +// ------------------------------ +bool MonEditBoundaryCAO::PushOnApply() +// ------------------------------ +{ + return true; +} +// ------------------------------------------------------------------------ +void MonEditBoundaryCAO::SetFiltrage() +// // ------------------------------------------------------------------------ +{ + if (!CBGroupe->isChecked()) return; + if (_aCaseName.toStdString().c_str() == QString()) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_BOUN_CASE") ); + return; + } + HOMARD::HOMARD_Cas_var monCas= myHomardGen->GetCase(_aCaseName.toStdString().c_str()); + HOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups(); + + MonEditListGroupCAO *aDlg = new MonEditListGroupCAO(NULL, this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), + _aCaseName, _listeGroupesBoundary) ; + aDlg->show(); +} + diff --git a/src/ADAPTGUI/MonEditBoundaryCAO.h b/src/ADAPTGUI/MonEditBoundaryCAO.h new file mode 100644 index 000000000..01ac507b8 --- /dev/null +++ b/src/ADAPTGUI/MonEditBoundaryCAO.h @@ -0,0 +1,51 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_EDITBOUNDARYCAO_H +#define MON_EDITBOUNDARYCAO_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) + +#include + +class HOMARD_EXPORT MonEditBoundaryCAO : public MonCreateBoundaryCAO +{ + Q_OBJECT +public: + MonEditBoundaryCAO( MonCreateCase* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString caseName, QString Name ); + virtual ~MonEditBoundaryCAO(); + +protected : + virtual void InitValEdit(); + virtual bool PushOnApply(); + virtual void SetFiltrage(); + +public slots: + +}; + +#endif diff --git a/src/ADAPTGUI/MonEditBoundaryDi.cxx b/src/ADAPTGUI/MonEditBoundaryDi.cxx new file mode 100644 index 000000000..d891732c0 --- /dev/null +++ b/src/ADAPTGUI/MonEditBoundaryDi.cxx @@ -0,0 +1,105 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonEditBoundaryDi.h" +#include "MonEditListGroup.h" + +#include + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include + +using namespace std; + +// ------------------------------------------------------------------------------------------------------------------------------------- +MonEditBoundaryDi::MonEditBoundaryDi( MonCreateCase* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString caseName, QString Name): +// ------------------------------------------------------------------------------------------------------------------------------------- +/* Constructs a MonEditBoundaryDi + herite de MonCreateBoundaryDi +*/ + MonCreateBoundaryDi(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; + } + + HOMARD::ListGroupType_var maListe = aBoundary->GetGroups(); + for ( int i = 0; i < maListe->length(); i++ ) + _listeGroupesBoundary << QString(maListe[i]); + +} +// ------------------------------ +MonEditBoundaryDi::~MonEditBoundaryDi() +// ------------------------------ +{ +} +// ------------------------------ +void MonEditBoundaryDi::InitValEdit() +// ------------------------------ +{ + LEName->setText(_aName); + LEName->setReadOnly(true); + + QString aDataFile = aBoundary->GetDataFile(); + LEFileName->setText(aDataFile); + LEFileName->setReadOnly(1); + PushFichier->setVisible(0); +// + adjustSize(); +} +// ------------------------------ +bool MonEditBoundaryDi::PushOnApply() +// ------------------------------ +{ + return true; +} +// ------------------------------------------------------------------------ +void MonEditBoundaryDi::SetFiltrage() +// // ------------------------------------------------------------------------ +{ + if (!CBGroupe->isChecked()) return; + if (_aCaseName.toStdString().c_str() == QString()) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_BOUN_CASE") ); + return; + } + HOMARD::HOMARD_Cas_var monCas= myHomardGen->GetCase(_aCaseName.toStdString().c_str()); + HOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups(); + + MonEditListGroup *aDlg = new MonEditListGroup(NULL, this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), + _aCaseName, _listeGroupesBoundary) ; + aDlg->show(); +} + diff --git a/src/ADAPTGUI/MonEditBoundaryDi.h b/src/ADAPTGUI/MonEditBoundaryDi.h new file mode 100644 index 000000000..123b12340 --- /dev/null +++ b/src/ADAPTGUI/MonEditBoundaryDi.h @@ -0,0 +1,51 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_EDITBOUNDARYDI_H +#define MON_EDITBOUNDARYDI_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) + +#include + +class HOMARD_EXPORT MonEditBoundaryDi : public MonCreateBoundaryDi +{ + Q_OBJECT +public: + MonEditBoundaryDi( MonCreateCase* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString caseName, QString Name ); + virtual ~MonEditBoundaryDi(); + +protected : + virtual void InitValEdit(); + virtual bool PushOnApply(); + virtual void SetFiltrage(); + +public slots: + +}; + +#endif diff --git a/src/ADAPTGUI/MonEditCase.cxx b/src/ADAPTGUI/MonEditCase.cxx new file mode 100644 index 000000000..d6304c54c --- /dev/null +++ b/src/ADAPTGUI/MonEditCase.cxx @@ -0,0 +1,269 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonEditCase.h" + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include + +using namespace std; + +// ------------------------------------------------------------- +/* Constructs a MonEditCase + herite de MonCreateCase +*/ +// ------------------------------------------------------------- +MonEditCase::MonEditCase ( bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString CaseName ): + MonCreateCase(modal, myHomardGen) +{ + MESSAGE("Debut de MonEditCase" << CaseName.toStdString().c_str()); + setWindowTitle(QObject::tr("HOM_CASE_EDIT_WINDOW_TITLE")); + _aCaseName = CaseName; + aCase = myHomardGen->GetCase(_aCaseName.toStdString().c_str()); + InitValEdit(); +} +// ------------------------------ +MonEditCase::~MonEditCase() +// ------------------------------ +{ +} +// ------------------------------ +void MonEditCase::InitValEdit() +// ------------------------------ +{ + MESSAGE("InitValEdit"); + LEName->setText(_aCaseName); + LEName->setReadOnly(true); + + QString aDirName = aCase->GetDirName(); + LEDirName->setText(aDirName); + LEDirName->setReadOnly(true); + PushDir->setVisible(0); + + QString _aitername=aCase->GetIter0Name(); + HOMARD::HOMARD_Iteration_var aIter = myHomardGen->GetIteration(_aitername.toStdString().c_str()); + QString aFileName = aIter->GetMeshFile(); + LEFileName->setText(aFileName); + LEFileName->setReadOnly(true); + PushFichier->setVisible(0); + + int ConfType=aCase->GetConfType(); + if ( ( ConfType == 0 ) || ( ConfType == -1 ) ) { RBConforme->setChecked(true); } + else { RBNonConforme->setChecked(true); }; + RBConforme->setEnabled(false); + RBNonConforme->setEnabled(false); + int ExtType=aCase->GetExtType(); + + +// Suivi de frontiere +// A priori, aucun affichage + GBTypeBoun->setVisible(0); + CBBoundaryD->setVisible(0); + CBBoundaryA->setVisible(0); + GBBoundaryC->setVisible(0); + GBBoundaryD->setVisible(0); + GBBoundaryA->setVisible(0); +// On passe en revue tous les couples (frontiere,groupe) du cas + HOMARD::ListBoundaryGroupType_var mesBoundarys = aCase->GetBoundaryGroup(); + if (mesBoundarys->length()>0) + { + QStringList ListeFron ; + QString NomFron ; + bool BounCAO = false ; + bool BounDi = false ; + bool BounAn = false ; + for (int i=0; ilength(); i++) + { +// Nom de la frontiere + NomFron = mesBoundarys[i++]; + MESSAGE("NomFron "<GetBoundary(NomFron.toStdString().c_str()); + int type_obj = myBoundary->GetType() ; + MESSAGE("type_obj "<addItem(NomFron); + } +// C'est une frontiere discrete +// Rermarque : on ne gere pas les groupes + else if ( type_obj==0 ) + { + BounDi = true ; + CBBoundaryDi->addItem(NomFron); + } +// C'est une frontiere analytique + else + { + BounAn = true ; + int nbcol = TWBoundary->columnCount(); +// On ajoute une ligne pour le groupe + TWBoundary->insertRow(0); +// La colonne 0 comporte le nom du groupe + TWBoundary->setItem( 0, 0, new QTableWidgetItem(QString(mesBoundarys[i]).trimmed())); +// TWBoundary->item( 0, 0 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable ); +// Chacune des colonnes suivantes est associé a une frontiere deja presente : on y met une +// case non cochee + for ( int j = 1; j < nbcol; j++ ) + { + TWBoundary->setItem( 0, j, new QTableWidgetItem( QString ("") ) ); + TWBoundary->item( 0, j )->setFlags( 0 ); + TWBoundary->item( 0, j )->setFlags( Qt::ItemIsUserCheckable ); + TWBoundary->item( 0, j )->setCheckState( Qt::Unchecked ); + } +// On cherche si la frontiere en cours d'examen a deja ete rencontree : +// si oui, on stocke son numero de colonne + int ok = -1 ; + for ( int nufr = 0 ; nufritem( 0, ok )->setCheckState( Qt::Checked ); + } + } + MESSAGE("BounCAO "<setVisible(1); + if ( BounCAO ) + { RBBoundaryCAO->setChecked(true); + GBBoundaryC->setVisible(1); + CBBoundaryCAO->setDisabled(true); + PBBoundaryCAONew->setVisible(0); + PBBoundaryCAOHelp->setVisible(0); } + if ( BounDi ) + { RBBoundaryNonCAO->setChecked(true); + GBBoundaryD->setVisible(1); + CBBoundaryDi->setDisabled(true); + PBBoundaryDiNew->setVisible(0); + PBBoundaryDiHelp->setVisible(0); } + if ( BounAn ) + { RBBoundaryNonCAO->setChecked(true); + GBBoundaryA->setVisible(1); +// On rend les cases non modifiables. +// On ne peut pas le faire pour tout le tableau sinon on perd l'ascenseur ! + int nbcol = TWBoundary->columnCount(); + int nbrow = TWBoundary->rowCount(); + for ( int i = 0; i < nbrow; i++ ) + { for ( int j = 0; j < nbcol; j++ ) TWBoundary->item( i, j )->setFlags( Qt::ItemIsSelectable ); } +// on met un nom blanc au coin + QTableWidgetItem *__colItem = new QTableWidgetItem(); + __colItem->setText(QApplication::translate("CreateCase", "", 0)); + TWBoundary->setHorizontalHeaderItem(0, __colItem); +// on cache les boutons inutiles + PBBoundaryAnNew->setVisible(0); + PBBoundaryAnHelp->setVisible(0); + } + RBBoundaryNo->setEnabled(false); + RBBoundaryCAO->setEnabled(false); + RBBoundaryNonCAO->setEnabled(false); + } +// +// Les options avancees (non modifiables) + CBAdvanced->setVisible(0) ; + CBAdvanced->setEnabled(false) ; + int Pyram = aCase->GetPyram(); + MESSAGE("Pyram "< 0 ) || ( ConfType < 0 ) || ( ConfType > 1 ) || ( ExtType > 0 ) ) + { GBAdvancedOptions->setVisible(1); +// + if ( Pyram > 0 ) + { CBPyramid->setChecked(true); + CBPyramid->setVisible(1); + } + else + { CBPyramid->setChecked(false); + CBPyramid->setVisible(0); + } + CBPyramid->setEnabled(false); +// + if ( ( ConfType == 0 ) || ( ConfType == -1 ) ) + { if ( ConfType == 0 ) { RBStandard->setChecked(true); } + else { RBBox->setChecked(true); } + RBStandard->setVisible(1); + RBBox->setVisible(1); + RBNC1NpA->setVisible(0); + RBNCQuelconque->setVisible(0); + } + else + { if (ConfType==-2) { RBBox->setChecked(true);}; + if (ConfType==1) { RBStandard->setChecked(true);}; + if (ConfType==2) { RBNC1NpA->setChecked(true);}; + if (ConfType==3) { RBNCQuelconque->setChecked(true);}; + RBStandard->setVisible(1); + RBBox->setVisible(1); + RBNC1NpA->setVisible(1); + RBNCQuelconque->setVisible(1); + } + RBStandard->setEnabled(false); + RBBox->setEnabled(false); + RBNC1NpA->setEnabled(false); + RBNCQuelconque->setEnabled(false); +// + if ( ExtType == 0 ) + { GBFormat->setVisible(0); + RBMED->setChecked(true); + } + else + { GBFormat->setVisible(1); + RBMED->setVisible(1); + RBSaturne->setVisible(1); + RBSaturne2D->setVisible(1); + if ( ExtType == 1 ) { RBSaturne->setChecked(true); } + else { RBSaturne2D->setChecked(true); } + } + RBMED->setEnabled(false); + RBSaturne->setEnabled(false); + RBSaturne2D->setEnabled(false); + } + else + { GBAdvancedOptions->setVisible(0); + CBPyramid->setChecked(false); + RBStandard->setChecked(true); + RBMED->setChecked(true); + } +// +// L'etat + int etat = aCase->GetState(); + MESSAGE("etat "<setText(QApplication::translate("CreateCase", "HOM_CASE_EDIT_STATE_0", 0)); } + else { Comment->setText(QApplication::translate("CreateCase", "HOM_CASE_EDIT_STATE", 0)); } + + Comment->setVisible(1); +// + adjustSize(); +} + +// ------------------------------------- +bool MonEditCase::PushOnApply() +// ------------------------------------- +{ + return true ; +}; diff --git a/src/ADAPTGUI/MonEditCase.h b/src/ADAPTGUI/MonEditCase.h new file mode 100644 index 000000000..52c2a2486 --- /dev/null +++ b/src/ADAPTGUI/MonEditCase.h @@ -0,0 +1,50 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_EDITCASE_H +#define MON_EDITCASE_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) + +#include + +class HOMARD_EXPORT MonEditCase : public MonCreateCase +{ + Q_OBJECT +public: + MonEditCase( bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString Name ); + virtual ~MonEditCase(); + +protected : + virtual void InitValEdit(); + virtual bool PushOnApply(); + +public slots: + +}; + +#endif diff --git a/src/ADAPTGUI/MonEditFile.cxx b/src/ADAPTGUI/MonEditFile.cxx new file mode 100644 index 000000000..773b9f394 --- /dev/null +++ b/src/ADAPTGUI/MonEditFile.cxx @@ -0,0 +1,119 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonEditFile.h" + +#include +#include +#include + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include + +using namespace std; + +/* --------------------------------------------------------- + * MonEditFile classe derivee de EditFile + * elle meme generee par uic + * Ouvre le fichier passe en parametre + * et affiche le texte correspondant dans la fenetre de log + * --------------------------------------------------------- + */ + +/* --------------------------------------------------------- + * MonEditFile Constructeur + * --------------------------------------------------------- + */ +MonEditFile::MonEditFile( QWidget* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString aFileName, int option): +// QWidget(0), + Ui_EditFile(), + _aFileName (aFileName), + _option (option), + _codret (0) +{ + MESSAGE("Debut de MonEditFile " << aFileName.toStdString().c_str()); + setupUi(this); + InitConnect(); + EditText(); +} +/* + * Destroys the object and frees any allocated resources + */ +MonEditFile::~MonEditFile() +{ + MESSAGE("Destructeur de ~MonEditFile"); +} +// ------------------------------------------------------------------------ +void MonEditFile::InitConnect() +// ------------------------------------------------------------------------ +{ + connect( buttonQuit, SIGNAL(pressed()), this, SLOT(close())); + connect( buttonPrint, SIGNAL(pressed()), this, SLOT(PushOnPrint())); +} +// ------------------------------------------------------------------------ +void MonEditFile::EditText() +// ------------------------------------------------------------------------ +{ +// Creation de l'objet fichier QT associe + QFile file( _aFileName ); +// Ouverture + bool bOpen = file.open( QIODevice::ReadOnly | QIODevice::Text ) ; +// + if ( bOpen ) + { +// Lecture +// Remarque : il serait plus clair de tout lire d'un coup mais cela ne marche pas ! +// alors on fait ligne par ligne et on cumule en ajoutant un saut de ligne. + QTextStream stream( &file ); + QString tout; + while ( !stream.atEnd() ) + { + tout = tout + stream.readLine() + "\n" ; + } +// tout = stream.readAll() ; + QTBEditFile->setPlainText( tout ); + } + else + { + // Option = 0 : emission d'un message d'erreur + if ( _option == 0 ) + { + MESSAGE( "EditText " << _aFileName.toStdString().c_str() << " est impossible a ouvrir "); + QMessageBox::warning( 0, QObject::tr("HOM_WARNING"), + QObject::tr("HOM_SELECT_FILE_3") ); + } + // Sinon : rien + _codret = 1 ; + } +} +// ------------------------------------------------------------------------ +void MonEditFile::PushOnPrint() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de MonEditFile::PushOnPrint") + QMessageBox::warning( 0, QObject::tr("HOM_WARNING"), + QObject::tr("HOM_INACTIVE_BUTTON") ); + return; +} + + diff --git a/src/ADAPTGUI/MonEditFile.h b/src/ADAPTGUI/MonEditFile.h new file mode 100644 index 000000000..62687b8be --- /dev/null +++ b/src/ADAPTGUI/MonEditFile.h @@ -0,0 +1,64 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_EDITFILE_H +#define MON_EDITFILE_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include "SALOME_Selection.h" +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(HOMARD_Cas) + +#include "ui_EditFile.h" +#include + +class QListBox; +class QDialog; + +class HOMARD_EXPORT MonEditFile : public QWidget, public Ui_EditFile +{ + Q_OBJECT + +public: + MonEditFile( QWidget* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString FileName, int option ); + ~MonEditFile(); + int _codret ; + +protected : + + HOMARD::HOMARD_Gen_var myHomardGen; + QString _aFileName ; + int _option ; + + virtual void InitConnect(); + virtual void EditText(); + +public slots: + virtual void PushOnPrint(); + +}; + +#endif // MON_EDITFILE_H diff --git a/src/ADAPTGUI/MonEditHypothesis.cxx b/src/ADAPTGUI/MonEditHypothesis.cxx new file mode 100644 index 000000000..d7dd550c7 --- /dev/null +++ b/src/ADAPTGUI/MonEditHypothesis.cxx @@ -0,0 +1,463 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonEditHypothesis.h" +#include "MonEditListGroup.h" + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include "HOMARD.hxx" +#include + +using namespace std; + +// ---------------------------------------------------------------------------- +MonEditHypothesis::MonEditHypothesis( MonCreateIteration* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString Name, + QString caseName, QString aFieldFile ): +// ---------------------------------------------------------------------------- +/* Constructs a MonEditHypothesis + herite de MonCreateHypothesis +*/ + MonCreateHypothesis(parent, modal,myHomardGen, Name, caseName, aFieldFile) +{ + MESSAGE("Hypothese " << Name.toStdString().c_str()); + setWindowTitle(QObject::tr("HOM_HYPO_EDIT_WINDOW_TITLE")); + aHypothesis = myHomardGen->GetHypothesis(_Name.toStdString().c_str()); + if (caseName == QString("") ){ _aCaseName = aHypothesis->GetCaseCreation();} + InitValEdit(); + InitGroupes(); +} +// ------------------------------ +MonEditHypothesis::~MonEditHypothesis() +// ------------------------------ +{ +} +// ------------------------------ +void MonEditHypothesis::InitGroupes() +// ------------------------------ +{ + HOMARD::ListGroupType_var maListe = aHypothesis->GetGroups(); + for ( int i = 0; i < maListe->length(); i++ ) + _aListeGroupes << QString(maListe[i]); + + if (maListe->length() == 0) { CBGroupe->hide();} +} + +// ------------------------------ +void MonEditHypothesis::InitValEdit() +// ------------------------------ +{ + MESSAGE("Debut de InitValEdit"); + LEName->setText(_Name); + LEName->setReadOnly(true); + HOMARD::listeTypes_var ListTypes (aHypothesis->GetAdapRefinUnRef()); + ASSERT( ListTypes->length()==3) ; + _aTypeAdap = ListTypes[0]; + _aTypeRaff = ListTypes[1]; + _aTypeDera = ListTypes[2]; + + if (_aTypeAdap == -1) InitAdaptUniforme(); + if (_aTypeAdap == 0) InitAdaptZone(); + if (_aTypeAdap == 1) InitAdaptChamps(); + + RBUniDera->setDisabled(true); + RBUniRaff->setDisabled(true); + + InitFieldInterp(); + + if (_aTypeAdap == 1 || _TypeFieldInterp >= 1 ) + { + if (_aFieldFile == QString("")) { GBFieldFile->setVisible(0); } + else + { + GBFieldFile->setVisible(1); + LEFieldFile->setText(_aFieldFile); + LEFieldFile->setReadOnly(1); + } + } + else + { + GBFieldFile->setVisible(0); + } +// Les options avancees (non modifiables) + CBAdvanced->setVisible(0) ; + int NivMax = aHypothesis->GetNivMax(); + double DiamMin = aHypothesis->GetDiamMin(); + int AdapInit = aHypothesis->GetAdapInit(); + int ExtraOutput = aHypothesis->GetExtraOutput(); + if ( NivMax > 0 || DiamMin > 0 || AdapInit != 0 || ExtraOutput != 1 ) + { GBAdvancedOptions->setVisible(1); + if ( NivMax > 0 ) + { SpinBoxNivMax->setValue(NivMax); + SpinBoxNivMax->setDisabled(true); } + else + { TLMaximalLevel->setVisible(0); + SpinBoxNivMax->setVisible(0); } + if ( DiamMin > 0 ) + { doubleSpinBoxDiamMin->setValue(DiamMin); + doubleSpinBoxDiamMin->setDisabled(true); } + else + { TLMinimalDiameter->setVisible(0); + doubleSpinBoxDiamMin->setVisible(0); } + if ( AdapInit != 0 ) + { + if ( AdapInit > 0 ) + { RBAIR->setChecked(true); } + else + { RBAID->setChecked(true); } + RBAIN->setEnabled(false); + RBAIR->setEnabled(false); + RBAID->setEnabled(false); + } + else + { GBAdapInit->setVisible(0) ; + } + if ( ExtraOutput % 2 == 0 ) + { + CBOutputLevel->setChecked(true); + CBOutputLevel->setEnabled(false); + } + else { CBOutputLevel->setVisible(0) ; } + if ( ExtraOutput % 3 == 0 ) + { + CBOutputQuality->setChecked(true); + CBOutputQuality->setEnabled(false); + } + else { CBOutputQuality->setVisible(0) ; } + if ( ExtraOutput % 5 == 0 ) + { + CBOutputDiameter->setChecked(true); + CBOutputDiameter->setEnabled(false); + } + else { CBOutputDiameter->setVisible(0) ; } + if ( ExtraOutput % 7 == 0 ) + { + CBOutputParent->setChecked(true); + CBOutputParent->setEnabled(false); + } + else { CBOutputParent->setVisible(0) ; } + if ( ExtraOutput % 11 == 0 ) + { + CBOutputVoisins->setChecked(true); + CBOutputVoisins->setEnabled(false); + } + else { CBOutputVoisins->setVisible(0) ; } + } + else + { GBAdvancedOptions->setVisible(0); } +// +} +// ---------------------------------------- +void MonEditHypothesis::InitAdaptUniforme() +// ---------------------------------------- +// Affichage des informations pour une adaptation uniforme +{ +// Choix des options generales + GBFieldManagement->setVisible(0); + GBAreaManagement->setVisible(0); + GBUniform->setVisible(1); + RBUniforme->setChecked(true); + RBUniforme->setEnabled(false); + RBChamp->setEnabled(false); + RBZone->setEnabled(false); +// +// Raffinement ou deraffinement ? + if (_aTypeDera == 0) + { + VERIFICATION(_aTypeRaff==1); + RBUniDera->setChecked(false); + RBUniRaff->setChecked(true); + } + if (_aTypeDera == 1) + { + VERIFICATION(_aTypeRaff==0); + RBUniDera->setChecked(true); + RBUniRaff->setChecked(false); + } +// + adjustSize(); +// +} +// ------------------------------------- +void MonEditHypothesis::InitAdaptZone() +// ------------------------------------- +// Affichage des informations pour une adaptation selon des zones : +{ + MESSAGE ("Debut de InitAdaptZone"); +// Choix des options generales + GBUniform->setVisible(0); + GBFieldManagement->setVisible(0); + GBAreaManagement->setVisible(1); + RBZone->setChecked(true); + RBChamp->setEnabled(false); + RBUniforme->setEnabled(false); + RBZone->setEnabled(false); + +// Recuperation de toutes les zones decrites et notation de celles retenues + GetAllZones(); + HOMARD::listeZonesHypo_var mesZonesAvant = aHypothesis->GetZones(); + for (int i=0; ilength(); i++) + { + MESSAGE ("i"<rowCount(); j++) + { + MESSAGE (". j"<item(j,2)->text().toStdString()); + if ( TWZone->item(j,2)->text().toStdString() == string(mesZonesAvant[i]) ) + { + MESSAGE ("OK avec "<item( j,0 )->setCheckState( Qt::Checked ); + TWZone->item( j,1 )->setCheckState( Qt::Unchecked ); } + else + { + MESSAGE ("... DERA"); + TWZone->item( j,0 )->setCheckState( Qt::Unchecked ); + TWZone->item( j,1 )->setCheckState( Qt::Checked ); } + break; + } + } + i += 1 ; + } +// +// Inactivation des choix + for ( int j =0 ; j < TWZone->rowCount(); j++) + { + TWZone->item( j, 0 )->setFlags(0); + TWZone->item( j, 1 )->setFlags(0); + } + PBZoneNew->setVisible(0); +// + adjustSize(); +// +} +// ------------------------------------- +void MonEditHypothesis::InitAdaptChamps() +// ------------------------------------- +// Affichage des informations pour une adaptation selon un champ : +// . Nom du champ +// . Composantes +// . Seuils +// . Absolu/relatif +{ + MESSAGE ("Debut de InitAdaptChamps"); +// Choix des options generales + GBUniform->setVisible(0); + GBAreaManagement->setVisible(0); + GBFieldManagement->setVisible(1); + RBChamp->setChecked(true); + RBUniforme->setEnabled(false); + RBChamp->setEnabled(false); + RBZone->setEnabled(false); + + HOMARD::InfosHypo_var aInfosHypo = aHypothesis->GetField(); + _aFieldName = aInfosHypo->FieldName; + _TypeThR = aInfosHypo->TypeThR; + _ThreshR = aInfosHypo->ThreshR; + _TypeThC = aInfosHypo->TypeThC; + _ThreshC = aInfosHypo->ThreshC; + _UsField = aInfosHypo->UsField; + _UsCmpI = aInfosHypo->UsCmpI; + + CBFieldName->insertItem(0,_aFieldName); + CBFieldName->setCurrentIndex(0); + CBFieldName->setEnabled(false); + //SetFieldName(Qt::Unchecked); + + HOMARD::listeComposantsHypo_var mesComposantsAvant = aHypothesis->GetComps(); + TWCMP->clear(); + TWCMP->setRowCount(0); + TWCMP->resizeRowsToContents(); + for (int i=0; ilength(); i++) + { + TWCMP->insertRow(0); + TWCMP->setItem( 0, 0, new QTableWidgetItem( QString ("") ) ); + TWCMP->item( 0, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled); + TWCMP->item( 0, 0 )->setCheckState(Qt::Checked ); + TWCMP->item( 0, 0 )->setFlags( 0 ); + TWCMP->setItem( 0, 1, new QTableWidgetItem(QString(mesComposantsAvant[i]).trimmed())); + TWCMP->item( 0, 1 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable ); + } + TWCMP->resizeColumnsToContents(); + TWCMP->resizeRowsToContents(); + TWCMP->clearSelection(); + + // Les seuils de raffinement + RBRAbs->setEnabled(false) ; + RBRRel->setEnabled(false) ; + RBRPE->setEnabled(false) ; + RBRMuSigma->setEnabled(false) ; + RBRNo->setEnabled(false) ; + if (_aTypeRaff== 0 ) + { + SetRNo(); + RBRNo->setEnabled(true) ; + } + else + { + if ( _TypeThR == 1 ) { SpinBox_RAbs->setValue(_ThreshR); SetRAbs(); RBRAbs->setEnabled(true);} + if ( _TypeThR == 2 ) { SpinBox_RRel->setValue(_ThreshR); SetRRel(); RBRRel->setEnabled(true);} + if ( _TypeThR == 3 ) { SpinBox_RPE->setValue(_ThreshR); SetRPE(); RBRPE->setEnabled(true);} + if ( _TypeThR == 4 ) { SpinBox_RMuSigma->setValue(_ThreshR); SetRMS(); RBRMuSigma->setEnabled(true);} + } + + // Les seuils de deraffinement + RBCAbs->setEnabled(false) ; + RBCRel->setEnabled(false) ; + RBCPE->setEnabled(false) ; + RBCMuSigma->setEnabled(false) ; + RBCNo->setEnabled(false) ; + if (_aTypeDera== 0 ) + { + SetCNo(); + RBCNo->setEnabled(true) ; + } + else + { + if ( _TypeThC == 1 ) { SpinBox_CAbs->setValue(_ThreshC); SetCAbs(); RBCAbs->setEnabled(true);} + if ( _TypeThC == 2 ) { SpinBox_CRel->setValue(_ThreshC); SetCRel(); RBCRel->setEnabled(true);} + if ( _TypeThC == 3 ) { SpinBox_CPE->setValue(_ThreshC); SetCPE(); RBCPE->setEnabled(true);} + if ( _TypeThC == 4 ) { SpinBox_CMuSigma->setValue(_ThreshC); SetCMS(); RBCMuSigma->setEnabled(true);} + } + // Le choix de la prise en compte des composantes + if ( TWCMP->rowCount() == 1 ) + { RBL2->setText(QObject::tr("HOM_HYPO_NORM_ABS")); + RBInf->setText(QObject::tr("HOM_HYPO_NORM_REL")); + } + else + { RBL2->setText(QObject::tr("HOM_HYPO_NORM_L2")); + RBInf->setText(QObject::tr("HOM_HYPO_NORM_INF")); + } + if ( _UsField == 0 ) { CBJump->hide(); } + else + { + CBJump->setChecked(true); + CBJump->setEnabled(false); + } + if ( _UsCmpI == 0 ) + { + RBL2->setChecked(true); + RBL2->setEnabled(true); + RBInf->setEnabled(false) ; + } + else + { + RBL2->setEnabled(false) ; + RBInf->setChecked(true); + RBInf->setEnabled(true); + } +// + adjustSize(); +} +// ------------------------------------- +void MonEditHypothesis::InitFieldInterp() +// ------------------------------------- +// Affichage des informations pour les interpolations +{ + MESSAGE ("Debut de InitFieldInterp"); +// Choix des options generales + _TypeFieldInterp = aHypothesis->GetTypeFieldInterp(); + MESSAGE ("_TypeFieldInterp = " << _TypeFieldInterp); +// +// Aucune interpolation + if ( _TypeFieldInterp == 0 ) + { + RBFieldNo->setChecked(true); + TWField->setVisible(0); + } +// Interpolation de tous les champs + if ( _TypeFieldInterp == 1 ) + { + RBFieldAll->setChecked(true); + TWField->setVisible(0); + } +// Interpolation de champs choisis + if ( _TypeFieldInterp == 2 ) + { + RBFieldChosen->setChecked(true); +// + TWField->setVisible(1); + HOMARD::listeFieldInterpsHypo_var mesChampsAvant = aHypothesis->GetFieldInterps(); + TWField->clear(); + TWField->setRowCount(0); + TWField->resizeRowsToContents(); + for (int iaux=0; iauxlength(); iaux++) + { + TWField->insertRow(0); + TWField->setItem( 0, 0, new QTableWidgetItem( QString ("") ) ); + TWField->item( 0, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled); + TWField->item( 0, 0 )->setCheckState(Qt::Checked ); + TWField->item( 0, 0 )->setFlags( 0 ); + TWField->setItem( 0, 1, new QTableWidgetItem(QString(mesChampsAvant[iaux]).trimmed())); + TWField->item( 0, 1 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable ); + iaux++; + } + TWField->resizeColumnsToContents(); + TWField->resizeRowsToContents(); + TWField->clearSelection(); + } + RBFieldNo->setEnabled(false) ; + RBFieldAll->setEnabled(false) ; + RBFieldChosen->setEnabled(false) ; +} + +// ------------------------------------- +bool MonEditHypothesis::PushOnApply() +// ------------------------------------- +{ +// Pour du raffinement selon un champ, les seuils ont-ils change ? + if ( _aTypeAdap == 1 ) + { + if (_aTypeRaff!= 0 ) + { + if (_TypeThR == 1) { _ThreshR = SpinBox_RAbs->value(); } + if (_TypeThR == 2) { _ThreshR = SpinBox_RRel->value(); } + if (_TypeThR == 3) { _ThreshR = SpinBox_RPE->value(); } + if (_TypeThR == 4) { _ThreshR = SpinBox_RMuSigma->value(); } + aHypothesis->SetRefinThr(_TypeThR, _ThreshR) ; + } + if (_aTypeDera!= 0 ) + { + if (_TypeThC == 1) { _ThreshC = SpinBox_CAbs->value() ; } + if (_TypeThC == 2) { _ThreshC = SpinBox_CRel->value() ; } + if (_TypeThC == 3) { _ThreshC = SpinBox_CPE->value() ; } + if (_TypeThC == 4) { _ThreshC = SpinBox_CMuSigma->value() ; } + aHypothesis->SetUnRefThr(_TypeThC, _ThreshC) ; + } + + myHomardGen->InvalideHypo(_Name.toStdString().c_str()); + HOMARD_UTILS::updateObjBrowser(); + } + return true; +}; +// ------------------------------------------------------------------------ +void MonEditHypothesis::SetFiltrage() +// ------------------------------------------------------------------------ +{ + if (CBGroupe->isChecked()) + { + MonEditListGroup *aDlg = new MonEditListGroup(this, NULL, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),_aCaseName, _aListeGroupes) ; + aDlg->show(); + } +} + diff --git a/src/ADAPTGUI/MonEditHypothesis.h b/src/ADAPTGUI/MonEditHypothesis.h new file mode 100644 index 000000000..051365b01 --- /dev/null +++ b/src/ADAPTGUI/MonEditHypothesis.h @@ -0,0 +1,56 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_EDITHYPOTHESIS_H +#define MON_EDITHYPOTHESIS_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) + +#include + +class HOMARD_EXPORT MonEditHypothesis : public MonCreateHypothesis +{ + Q_OBJECT +public: + MonEditHypothesis( MonCreateIteration* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString caseName, QString Name, QString aFieldFile ); + virtual ~MonEditHypothesis(); + +protected : + virtual void InitValEdit(); + virtual void InitAdaptUniforme(); + virtual void InitAdaptZone(); + virtual void InitAdaptChamps(); + virtual void InitGroupes(); + virtual void InitFieldInterp(); + virtual void SetFiltrage(); + virtual bool PushOnApply(); + +public slots: + +}; + +#endif diff --git a/src/ADAPTGUI/MonEditIteration.cxx b/src/ADAPTGUI/MonEditIteration.cxx new file mode 100644 index 000000000..e158f27cf --- /dev/null +++ b/src/ADAPTGUI/MonEditIteration.cxx @@ -0,0 +1,186 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonEditIteration.h" + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include + +using namespace std; + +// ------------------------------------------------------------------------------------------------------------------------------------- +MonEditIteration::MonEditIteration ( QWidget* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString IterParentName, QString IterName ): +// ------------------------------------------------------------------------------------------------------------------------------------- +/* Constructs a MonEditIteration + herite de MonCreateIteration +*/ + MonCreateIteration(parent, modal, myHomardGen, IterParentName), + _rank(-1), _step(-1), _IterationName(""), _FieldFile(""),_aTypeAdap() +{ + MESSAGE("Debut de MonEditIteration" << IterName.toStdString().c_str()); + setWindowTitle(QObject::tr("HOM_ITER_EDIT_WINDOW_TITLE")); + _IterationName = IterName; + aIter = myHomardGen->GetIteration(_IterationName.toStdString().c_str()); + +// Attention au cas ou c'est une iteration initiale : il faut inhiber l'essentiel + int etat = aIter->GetState() ; + if ( etat <= 0 ) { InitValEdit0(etat); } + else { InitValEdit(); } +} +// ------------------------------ +MonEditIteration::~MonEditIteration() +// ------------------------------ +{ +} + +// ------------------------------ +void MonEditIteration::InitValEdit0(int etat) +// ------------------------------ +// Cas d'une iteration initiale d'un cas (initial ou poursuite) +{ +// + LEName->setText(_IterationName); + LEName->setReadOnly(true); + +// Invisibilite de l'iteration parent + Iter_Parent->setVisible(0); + PBIterParent->setVisible(0); + LEIterationParentName->setVisible(0); + +// Affichage bloque du nom du maillage de l'iteration courante + QString MeshName = aIter->GetMeshName(); + Mesh_n->setText(QObject::tr("HOM_ITER_STARTING_POINT_0")); + LEMeshName_n->setText(MeshName); + LEMeshName_n->setReadOnly(1); + +// Message general + if ( etat == 0 ) { Mesh_np1->setText(QObject::tr("HOM_ITER_STARTING_POINT_1")) ; } + else { Mesh_np1->setText(QObject::tr("HOM_ITER_STARTING_POINT_2")) ; } + LEMeshName_np1->setVisible(0); +// +// Invisibilite des hypotheses et des champs + Hypothese->setVisible(0); + GBField->setVisible(0); +// +} +// ------------------------------ +void MonEditIteration::InitValEdit() +// ------------------------------ +// Cas d'une iteration courante +{ +// Affichage bloque du nom de l'iteration + LEName->setText(_IterationName); + LEName->setReadOnly(true); + + // Affichage bloque du nom de l'iteration parent + _IterParentName = aIter->GetIterParentName(); + LEIterationParentName->setText(_IterParentName); + LEIterationParentName->setReadOnly(true); + PBIterParent->setEnabled(false); + PBIterParent->setVisible(0); + + // Affichage bloque du nom du maillage de l'iteration parent + aIterParent = myHomardGen->GetIteration(_IterParentName.toStdString().c_str()); + QString MeshNameParent = aIterParent->GetMeshName(); + LEMeshName_n->setText(MeshNameParent); + LEMeshName_n->setReadOnly(1); + + // Affichage bloque du nom du maillage de l'iteration courante + QString MeshName = aIter->GetMeshName(); + LEMeshName_np1->setText(MeshName); + LEMeshName_np1->setReadOnly(1); + + // Affichage de la bonne hypothese + QString HypoName = aIter->GetHypoName(); + CBHypothese->insertItem(0,HypoName); + CBHypothese->setCurrentIndex(0); + CBHypothese->setEnabled(false); + PBHypoNew->setVisible(0); + + // Pour une adaptation selon un champ + HOMARD::HOMARD_Hypothesis_var myHypo = myHomardGen->GetHypothesis(HypoName.toStdString().c_str()) ; + _aTypeAdap = myHypo->GetAdapType() ; + if ( _aTypeAdap == 1 ) + { + _FieldFile = aIter->GetFieldFile(); + LEFieldFile->setText(_FieldFile); + _step = aIter->GetTimeStep() ; + SpinBox_TimeStep->setValue(_step); + _rank = aIter->GetRank() ; + SpinBox_Rank->setValue(_rank); + + // Cas ou on prend le dernier pas de temps ou sans pas de temps + if ( _step <= -1 ) + { + Rank->setVisible(0); + SpinBox_Rank->setVisible(0); + TimeStep->setVisible(0); + SpinBox_TimeStep->setVisible(0); + + if ( _step == -2 ) { RBLast->setChecked(true); } + else { RBNo->setChecked(true); } + } + + // Cas avec pas de temps + else + { + Rank->setVisible(1); + SpinBox_Rank->setVisible(1); + TimeStep->setVisible(1); + SpinBox_TimeStep->setVisible(1); + RBChosen->setChecked(true); + } + } + else + { + GBField->setVisible(0); + } +// + adjustSize(); +// +} + +// ------------------------------------- +bool MonEditIteration::PushOnApply() +// ------------------------------------- +{ + if ( _aTypeAdap == 1) + { +// Pour du raffinement selon un champ, les instants ont-ils change ? + if ( (_FieldFile != LEFieldFile->text().trimmed()) || + ( _rank != SpinBox_Rank->value()) || + ( _step != SpinBox_TimeStep->value())) + { + _FieldFile = LEFieldFile->text().trimmed(); + aIter->SetFieldFile(CORBA::string_dup(_FieldFile.toStdString().c_str())); + _rank = SpinBox_Rank->value(); + _step = SpinBox_TimeStep->value(); + if ( _step == -2 ) { aIter->SetTimeStepRankLast(); } + else { aIter->SetTimeStepRank(_step, _rank); } + myHomardGen->InvalideIter(_IterationName.toStdString().c_str()); + HOMARD_UTILS::updateObjBrowser(); + } + } + return true; + +}; diff --git a/src/ADAPTGUI/MonEditIteration.h b/src/ADAPTGUI/MonEditIteration.h new file mode 100644 index 000000000..0107d4b26 --- /dev/null +++ b/src/ADAPTGUI/MonEditIteration.h @@ -0,0 +1,57 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_EDITITERATION_H +#define MON_EDITITERATION_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) + +#include + +class HOMARD_EXPORT MonEditIteration : public MonCreateIteration +{ + Q_OBJECT +public: + MonEditIteration( QWidget* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString IterParentName, QString Name ); + virtual ~MonEditIteration(); + +protected : + QString _FieldFile ; + QString _IterationName ; + int _aTypeAdap ; + int _rank ; + int _step ; + + virtual void InitValEdit(); + virtual void InitValEdit0(int etat); + virtual bool PushOnApply(); + +public slots: + +}; + +#endif diff --git a/src/ADAPTGUI/MonEditListGroup.cxx b/src/ADAPTGUI/MonEditListGroup.cxx new file mode 100644 index 000000000..d8a68150a --- /dev/null +++ b/src/ADAPTGUI/MonEditListGroup.cxx @@ -0,0 +1,61 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonEditListGroup.h" +#include + +using namespace std; +//--------------------------------------------------------------------- +MonEditListGroup::MonEditListGroup( MonCreateHypothesis* parentHyp, + MonCreateBoundaryDi* parentBound, + bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString aCaseName, + QStringList listeGroupesHypo): +//--------------------------------------------------------------------- +MonCreateListGroup(parentHyp,parentBound,myHomardGen,aCaseName,listeGroupesHypo) +{ + MESSAGE("Debut de MonEditListGroup"); + setWindowTitle(QObject::tr("HOM_GROU_EDIT_WINDOW_TITLE")); + setModal(true); + InitGroupes(); +} + +//------------------------------------ +MonEditListGroup:: ~MonEditListGroup() +//------------------------------------ +{ +} +// ------------------------------------- +void MonEditListGroup:: 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/ADAPTGUI/MonEditListGroup.h b/src/ADAPTGUI/MonEditListGroup.h new file mode 100644 index 000000000..8ea41c935 --- /dev/null +++ b/src/ADAPTGUI/MonEditListGroup.h @@ -0,0 +1,49 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_EDITLISTGROUP_H +#define MON_EDITLISTGROUP_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) + +#include + +class MonCreateHypothesis; +class MonCreateBoundaryDi; +class HOMARD_EXPORT MonEditListGroup : public MonCreateListGroup +{ + Q_OBJECT + +public: + MonEditListGroup( MonCreateHypothesis* parentHyp, MonCreateBoundaryDi* parentBound, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); + virtual ~MonEditListGroup(); + +protected : + + virtual void InitGroupes(); + +}; + +#endif // MON_EDITLISTGROUP_H diff --git a/src/ADAPTGUI/MonEditListGroupCAO.cxx b/src/ADAPTGUI/MonEditListGroupCAO.cxx new file mode 100644 index 000000000..5c942fd5a --- /dev/null +++ b/src/ADAPTGUI/MonEditListGroupCAO.cxx @@ -0,0 +1,61 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonEditListGroupCAO.h" +#include + +using namespace std; +//--------------------------------------------------------------------- +MonEditListGroupCAO::MonEditListGroupCAO( MonCreateHypothesis* parentHyp, + MonCreateBoundaryCAO* parentBound, + bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString aCaseName, + QStringList listeGroupesHypo): +//--------------------------------------------------------------------- +MonCreateListGroupCAO(parentHyp,parentBound,myHomardGen,aCaseName,listeGroupesHypo) +{ + MESSAGE("Debut de MonEditListGroupCAO"); + setWindowTitle(QObject::tr("HOM_GROU_EDIT_WINDOW_TITLE")); + setModal(true); + InitGroupes(); +} + +//------------------------------------ +MonEditListGroupCAO:: ~MonEditListGroupCAO() +//------------------------------------ +{ +} +// ------------------------------------- +void MonEditListGroupCAO:: 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/ADAPTGUI/MonEditListGroupCAO.h b/src/ADAPTGUI/MonEditListGroupCAO.h new file mode 100644 index 000000000..4f6ada6db --- /dev/null +++ b/src/ADAPTGUI/MonEditListGroupCAO.h @@ -0,0 +1,49 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_EDITLISTGROUPCAO_H +#define MON_EDITLISTGROUPCAO_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) + +#include + +class MonCreateHypothesis; +class MonCreateBoundaryCAO; +class HOMARD_EXPORT MonEditListGroupCAO : public MonCreateListGroupCAO +{ + Q_OBJECT + +public: + MonEditListGroupCAO( MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); + virtual ~MonEditListGroupCAO(); + +protected : + + virtual void InitGroupes(); + +}; + +#endif // MON_EDITLISTGROUPCAO_H diff --git a/src/ADAPTGUI/MonEditYACS.cxx b/src/ADAPTGUI/MonEditYACS.cxx new file mode 100644 index 000000000..0c41e5b56 --- /dev/null +++ b/src/ADAPTGUI/MonEditYACS.cxx @@ -0,0 +1,148 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonEditYACS.h" + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include + +using namespace std; + +// ------------------------------------------------------------- +/* Constructs a MonEditYACS + herite de MonCreateYACS +*/ +// ------------------------------------------------------------- +MonEditYACS::MonEditYACS ( bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString Name ): + MonCreateYACS(myHomardGen, Name) +{ + MESSAGE("Debut de MonEditYACS" << Name.toStdString().c_str()); + setWindowTitle(QObject::tr("HOM_YACS_EDIT_WINDOW_TITLE")); + _Name = Name; + aYACS = myHomardGen->GetYACS(_Name.toStdString().c_str()); + InitValEdit(); +} +// ------------------------------ +MonEditYACS::~MonEditYACS() +// ------------------------------ +{ +} +// ------------------------------ +void MonEditYACS::InitValEdit() +// ------------------------------ +{ + MESSAGE("InitValEdit"); + LEName->setText(_Name); + LEName->setReadOnly(true); + + _aCaseName = aYACS->GetCaseName(); + LECaseName->setText(_aCaseName); + LECaseName->setReadOnly(true); + PBCaseName->setVisible(0); + + _aScriptFile = aYACS->GetScriptFile(); + LEScriptFile->setText(_aScriptFile); + + _aDirName = aYACS->GetDirName(); + LEDirName->setText(_aDirName); + LEDirName->setReadOnly(true); + + _aMeshFile = aYACS->GetMeshFile(); + LEMeshFile->setText(_aMeshFile); + + _Type=aYACS->GetType(); + if(_Type==1) { RBConstant->setChecked(true); } + else { RBVariable->setChecked(true); }; + RBConstant->setEnabled(false); + RBVariable->setEnabled(false); + + _MaxIter = aYACS->GetMaxIter(); + SpinBoxMaxIter->setValue(_MaxIter) ; + _MaxNode = aYACS->GetMaxNode(); + SpinBoxMaxNode->setValue(_MaxNode) ; + _MaxElem = aYACS->GetMaxElem(); + SpinBoxMaxElem->setValue(_MaxElem) ; +// +} + +// --------------------------------------------------- +bool MonEditYACS:: CreateOrUpdate() +//---------------------------------------------------- +// Edition/modification du schema +{ + MESSAGE("CreateOrUpdate"); + bool chgt = false ; + int valeur_i ; + // A. Recuperation et comparaison des valeurs + // A.1. Le script de lancement + QString aScriptFile=LEScriptFile->text().trimmed(); + if ( aScriptFile != _aScriptFile ) + { +// MESSAGE("modification de ScriptFile : "<<_aScriptFile.toStdString()<<" devient "<SetScriptFile(CORBA::string_dup(_aScriptFile.toStdString().c_str())) ; + chgt = true ; + } + // A.2. Le maillage initial + QString aMeshFile=LEMeshFile->text().trimmed(); + if ( aMeshFile != _aMeshFile ) + { +// MESSAGE("modification de aMeshFile : "<<_aMeshFile.toStdString()<<" devient "<SetMeshFile(CORBA::string_dup(_aMeshFile.toStdString().c_str())) ; + chgt = true ; + } + // A.3. La convergence + valeur_i = SpinBoxMaxIter->value() ; + if ( valeur_i != _MaxIter ) + { +// MESSAGE("modification de MaxIter : "<<_MaxIter<<" devient "<SetMaxIter(_MaxIter) ; + chgt = true ; + } + valeur_i = SpinBoxMaxNode->value() ; + if ( valeur_i != _MaxNode ) + { +// MESSAGE("modification de MaxNode : "<<_MaxNode<<" devient "<SetMaxNode(_MaxNode) ; + chgt = true ; + } + valeur_i = SpinBoxMaxElem->value() ; + if ( valeur_i != _MaxElem ) + { +// MESSAGE("modification de MaxElem : "<<_MaxElem<<" devient "<SetMaxElem(_MaxElem) ; + chgt = true ; + } +// B. Si changement + if ( chgt ) + { + myHomardGen->InvalideYACS(_Name.toStdString().c_str()); + } + + HOMARD_UTILS::updateObjBrowser(); + return true ; +} diff --git a/src/ADAPTGUI/MonEditYACS.h b/src/ADAPTGUI/MonEditYACS.h new file mode 100644 index 000000000..11fe76d01 --- /dev/null +++ b/src/ADAPTGUI/MonEditYACS.h @@ -0,0 +1,50 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_EDITYACS_H +#define MON_EDITYACS_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) + +#include + +class HOMARD_EXPORT MonEditYACS : public MonCreateYACS +{ + Q_OBJECT +public: + MonEditYACS( bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString Name ); + virtual ~MonEditYACS(); + +protected : + virtual void InitValEdit(); + virtual bool CreateOrUpdate(); + +public slots: + +}; + +#endif diff --git a/src/ADAPTGUI/MonEditZone.cxx b/src/ADAPTGUI/MonEditZone.cxx new file mode 100644 index 000000000..acab891eb --- /dev/null +++ b/src/ADAPTGUI/MonEditZone.cxx @@ -0,0 +1,432 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonEditZone.h" + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include +#include +#include +#include +#include +#include + +using namespace std; + +// ------------------------------------------------------------------------ +MonEditZone::MonEditZone( MonCreateHypothesis* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString caseName, QString Name ): +// ------------------------------------------------------------------------ +/* Constructs a MonEditZone + herite de MonCreateZone +*/ + MonCreateZone(parent, myHomardGen, caseName) +{ + MESSAGE("Debut de MonEditZone pour " << Name.toStdString().c_str()); + setWindowTitle(QObject::tr("HOM_ZONE_EDIT_WINDOW_TITLE")); + _Name=Name; + aZone = myHomardGen->GetZone(_Name.toStdString().c_str()); + InitValEdit(); +} +// ------------------------------------------------------------------------ +MonEditZone::~MonEditZone() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void MonEditZone::InitValEdit() +// ------------------------------------------------------------------------ +{ + MESSAGE("InitValEdit "); + LEName->setText(_Name); + LEName->setReadOnly(true); + _Type = aZone->GetType(); + MESSAGE("InitValEdit _Type ="<<_Type); + InitValZoneLimit(); + if (_aCaseName != QString("")) InitValZone(); + switch (_Type) + { + case 11 : // il s agit d un rectangle + { } + case 12 : // il s agit d un rectangle + { } + case 13 : // il s agit d un rectangle + { } + case 2 : // il s agit d une boite + { + InitValZoneBox(); + SetBox(); + break; + } + case 4 : // il s agit d une sphere + { + InitValZoneSphere(); + SetSphere(); + break; + } + case 31 : // il s agit d un cercle issu d'un cylindre + { } + case 32 : // il s agit d un cercle issu d'un cylindre + { } + case 33 : // il s agit d un cercle issu d'un cylindre + { } + case 5 : // il s agit d un cylindre + { + InitValZoneCylinder(); + SetCylinder(); + break; + } + case 61 : // il s agit d un disque avec trou issu d'un tuyau + { } + case 62 : // il s agit d un disque avec trou issu d'un tuyau + { } + case 63 : // il s agit d un disque avec trou issu d'un tuyau + { } + case 7 : // il s agit d un tuyau + { + InitValZonePipe(); + SetPipe(); + break; + } + }; +} +// ------------------------------------------------------------------------ +void MonEditZone::InitValZoneLimit() +// ------------------------------------------------------------------------ +{ + HOMARD::double_array_var mesCoordLimits = aZone->GetLimit(); + ASSERT(mesCoordLimits->length() == 3 ); + _Xincr=mesCoordLimits[0]; + _Yincr=mesCoordLimits[1]; + _Zincr=mesCoordLimits[2]; +} +// ------------------------------------------------------------------------ +void MonEditZone::InitValZoneBox() +// ------------------------------------------------------------------------ +{ + HOMARD::double_array_var mesCoordZones = aZone->GetCoords(); + ASSERT(mesCoordZones->length() == 6 ); + _ZoneXmin=mesCoordZones[0]; + _ZoneXmax=mesCoordZones[1]; + _ZoneYmin=mesCoordZones[2]; + _ZoneYmax=mesCoordZones[3]; + _ZoneZmin=mesCoordZones[4]; + _ZoneZmax=mesCoordZones[5]; +} +// ------------------------------------------------------------------------ +void MonEditZone::InitValZoneSphere() +// ------------------------------------------------------------------------ +{ + HOMARD::double_array_var mesCoordZones = aZone->GetCoords(); + ASSERT(mesCoordZones->length() == 4 ); + _ZoneXcentre=mesCoordZones[0]; + _ZoneYcentre=mesCoordZones[1]; + _ZoneZcentre=mesCoordZones[2]; + _ZoneRayon=mesCoordZones[3]; + +} +// ------------------------------------------------------------------------ +void MonEditZone::InitValZoneCylinder() +// ------------------------------------------------------------------------ +{ + HOMARD::double_array_var mesCoordZones = aZone->GetCoords(); + ASSERT(mesCoordZones->length() == 8 ); + _ZoneXcentre=mesCoordZones[0]; + _ZoneYcentre=mesCoordZones[1]; + _ZoneZcentre=mesCoordZones[2]; + _ZoneXaxis=mesCoordZones[3]; + _ZoneYaxis=mesCoordZones[4]; + _ZoneZaxis=mesCoordZones[5]; + _ZoneRayon=mesCoordZones[6]; + _ZoneHaut=mesCoordZones[7]; +} +// ------------------------------------------------------------------------ +void MonEditZone::InitValZonePipe() +// ------------------------------------------------------------------------ +{ + HOMARD::double_array_var mesCoordZones = aZone->GetCoords(); + ASSERT(mesCoordZones->length() == 9 ); + _ZoneXcentre=mesCoordZones[0]; + _ZoneYcentre=mesCoordZones[1]; + _ZoneZcentre=mesCoordZones[2]; + _ZoneXaxis=mesCoordZones[3]; + _ZoneYaxis=mesCoordZones[4]; + _ZoneZaxis=mesCoordZones[5]; + _ZoneRayon=mesCoordZones[6]; + _ZoneHaut=mesCoordZones[7]; + _ZoneRayonInt=mesCoordZones[8]; +} +// ------------------------------------------------------------------------ +void MonEditZone::SetBox() +// ------------------------------------------------------------------------ +{ + MESSAGE("SetBox "); + gBBox->setVisible(1); + gBSphere->setVisible(0); + gBCylindre->setVisible(0) ; + gBPipe->setVisible(0) ; + RBBox->setChecked(1); + adjustSize(); + RBCylinder->setDisabled(true); + RBPipe->setDisabled(true); + if ( _Type == 2 ) { RBSphere->setDisabled(true); } + else { RBSphere->setVisible(0); + RBPipe->setText(QApplication::translate("CreateZone", "Disk with hole", 0)); + RBCylinder->setText(QApplication::translate("CreateZone", "Disk", 0)); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr() ; + QPixmap pix = resMgr->loadPixmap( "HOMARD", "boxdxy.png" ) ; + QIcon IS=QIcon(pix) ; + RBBox->setIcon(IS) ; } + adjustSize(); + + SpinBox_Xmini->setValue(_ZoneXmin); + SpinBox_Xmaxi->setValue(_ZoneXmax); + + double incr ; + if ( _Xincr > 0 ) {incr=_Xincr;} else{incr=1.;} + SpinBox_Xmini->setSingleStep(incr); + SpinBox_Xmaxi->setSingleStep(incr); + + SpinBox_Ymini->setValue(_ZoneYmin); + SpinBox_Ymaxi->setValue(_ZoneYmax); + if ( _Yincr > 0 ) {incr=_Yincr;} else{incr=1.;} + SpinBox_Ymini->setSingleStep(incr); + SpinBox_Ymaxi->setSingleStep(incr); + + SpinBox_Zmini->setValue(_ZoneZmin); + SpinBox_Zmaxi->setValue(_ZoneZmax); + if ( _Zincr > 0 ) {incr=_Zincr;} else{incr=1.;} + SpinBox_Zmini->setSingleStep(incr); + SpinBox_Zmaxi->setSingleStep(incr); + + if ( _Type == 12 ) { SpinBox_Xmini->setDisabled(true) ; + SpinBox_Xmaxi->setDisabled(true) ; } + else if ( _Type == 13 ) { SpinBox_Ymini->setDisabled(true) ; + SpinBox_Ymaxi->setDisabled(true) ; } + else if ( _Type == 11 ) { SpinBox_Zmini->setDisabled(true) ; + SpinBox_Zmaxi->setDisabled(true) ; } + +} +// ------------------------------------------------------------------------ +void MonEditZone::SetSphere() +// ------------------------------------------------------------------------ +{ + gBBox->setVisible(0); + gBSphere->setVisible(1); + gBCylindre->setVisible(0) ; + gBPipe->setVisible(0) ; + RBSphere->setChecked(1); + RBBox->setDisabled(true); + RBCylinder->setDisabled(true); + RBPipe->setDisabled(true); + adjustSize(); + + SpinBox_Xcentre->setValue(_ZoneXcentre); + if ( _Xincr > 0) { SpinBox_Xcentre->setSingleStep(_Xincr); } + else { SpinBox_Xcentre->setSingleStep(1) ; } + + SpinBox_Ycentre->setValue(_ZoneYcentre); + if ( _Yincr > 0) { SpinBox_Ycentre->setSingleStep(_Yincr); } + else { SpinBox_Ycentre->setSingleStep(1) ; } + + SpinBox_Zcentre->setValue(_ZoneZcentre); + if ( _Zincr > 0) { SpinBox_Zcentre->setSingleStep(_Zincr); } + else { SpinBox_Zcentre->setSingleStep(1);} + + SpinBox_Rayon->setValue(_ZoneRayon); +} +// ------------------------------------------------------------------------ +void MonEditZone::SetCylinder() +// ------------------------------------------------------------------------ +{ + MESSAGE("SetCylinder _Xincr ="<<_Xincr<< " _Yincr ="<<_Yincr<< " _Zincr ="<<_Zincr); + gBBox->setVisible(0); + gBSphere->setVisible(0); + gBCylindre->setVisible(1) ; + gBPipe->setVisible(0) ; + RBCylinder->setChecked(1); + RBBox->setDisabled(true); + RBPipe->setDisabled(true); + if ( _Type == 5 ) { RBSphere->setDisabled(true); } + else { RBSphere->setVisible(0); + RBPipe->setText(QApplication::translate("CreateZone", "Disk with hole", 0)); + RBCylinder->setText(QApplication::translate("CreateZone", "Disk", 0)); + TLXbase->setText(QApplication::translate("CreateZone", "X centre", 0)); + TLYbase->setText(QApplication::translate("CreateZone", "Y centre", 0)); + TLZbase->setText(QApplication::translate("CreateZone", "Z centre", 0)); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr() ; + QPixmap pix = resMgr->loadPixmap( "HOMARD", "disk.png" ) ; + QIcon IS=QIcon(pix) ; + RBCylinder->setIcon(IS) ; } + adjustSize(); + + SpinBox_Xbase->setValue(_ZoneXcentre); + if ( _Xincr > 0) { SpinBox_Xbase->setSingleStep(_Xincr); } + else { SpinBox_Xbase->setSingleStep(1) ; } + + SpinBox_Ybase->setValue(_ZoneYcentre); + if ( _Yincr > 0) { SpinBox_Ybase->setSingleStep(_Yincr); } + else { SpinBox_Ybase->setSingleStep(1) ; } + + SpinBox_Zbase->setValue(_ZoneZcentre); + if ( _Zincr > 0) { SpinBox_Zbase->setSingleStep(_Zincr); } + else { SpinBox_Zbase->setSingleStep(1) ;} + + SpinBox_Radius->setValue(_ZoneRayon); + + if ( _Type == 5 ) + { SpinBox_Xaxis->setValue(_ZoneXaxis) ; + SpinBox_Yaxis->setValue(_ZoneYaxis) ; + SpinBox_Zaxis->setValue(_ZoneZaxis) ; + SpinBox_Haut->setValue(_ZoneHaut) ; + } + else + { SpinBox_Xaxis->setVisible(0) ; + SpinBox_Yaxis->setVisible(0) ; + SpinBox_Zaxis->setVisible(0) ; + SpinBox_Haut->setVisible(0) ; + TLXaxis->setVisible(0) ; + TLYaxis->setVisible(0) ; + TLZaxis->setVisible(0) ; + TLHaut->setVisible(0) ; + if ( _Type == 32 ) { SpinBox_Xbase->setDisabled(true) ; } + else if ( _Type == 33 ) { SpinBox_Ybase->setDisabled(true) ; } + else if ( _Type == 31 ) { SpinBox_Zbase->setDisabled(true) ; } + } +} +// ------------------------------------------------------------------------ +void MonEditZone::SetPipe() +// ------------------------------------------------------------------------ +{ + MESSAGE("SetPipe _Xincr ="<<_Xincr<< " _Yincr ="<<_Yincr<< " _Zincr ="<<_Zincr); + gBBox->setVisible(0); + gBSphere->setVisible(0); + gBCylindre->setVisible(0) ; + gBPipe->setVisible(1) ; + RBPipe->setChecked(1); + RBBox->setDisabled(true); + RBCylinder->setDisabled(true); + if ( _Type == 7 ) { RBSphere->setDisabled(true); } + else { RBSphere->setVisible(0); + RBPipe->setText(QApplication::translate("CreateZone", "Disk with hole", 0)); + RBCylinder->setText(QApplication::translate("CreateZone", "Disk", 0)); + TLXbase_p->setText(QApplication::translate("CreateZone", "X centre", 0)); + TLYbase_p->setText(QApplication::translate("CreateZone", "Y centre", 0)); + TLZbase_p->setText(QApplication::translate("CreateZone", "Z centre", 0)); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr() ; + QPixmap pix = resMgr->loadPixmap( "HOMARD", "diskwithhole.png" ) ; + QIcon IS=QIcon(pix) ; + RBPipe->setIcon(IS) ; } + adjustSize(); + + SpinBox_Xbase_p->setValue(_ZoneXcentre); + if ( _Xincr > 0) { SpinBox_Xbase_p->setSingleStep(_Xincr); } + else { SpinBox_Xbase_p->setSingleStep(1) ; } + + SpinBox_Ybase_p->setValue(_ZoneYcentre); + if ( _Yincr > 0) { SpinBox_Ybase_p->setSingleStep(_Yincr); } + else { SpinBox_Ybase_p->setSingleStep(1) ; } + + SpinBox_Zbase_p->setValue(_ZoneZcentre); + if ( _Zincr > 0) { SpinBox_Zbase_p->setSingleStep(_Zincr); } + else { SpinBox_Zbase_p->setSingleStep(1) ;} + + SpinBox_Radius_int->setValue(_ZoneRayonInt); + SpinBox_Radius_ext->setValue(_ZoneRayon); + + if ( _Type == 7 ) + { SpinBox_Xaxis_p->setValue(_ZoneXaxis) ; + SpinBox_Yaxis_p->setValue(_ZoneYaxis) ; + SpinBox_Zaxis_p->setValue(_ZoneZaxis) ; + SpinBox_Haut_p->setValue(_ZoneHaut) ; + } + else + { SpinBox_Xaxis_p->setVisible(0) ; + SpinBox_Yaxis_p->setVisible(0) ; + SpinBox_Zaxis_p->setVisible(0) ; + SpinBox_Haut_p->setVisible(0) ; + TLXaxis_p->setVisible(0) ; + TLYaxis_p->setVisible(0) ; + TLZaxis_p->setVisible(0) ; + TLHaut_p->setVisible(0) ; + if ( _Type == 62 ) { SpinBox_Xbase_p->setDisabled(true) ; } + else if ( _Type == 63 ) { SpinBox_Ybase_p->setDisabled(true) ; } + else if ( _Type == 61 ) { SpinBox_Zbase_p->setDisabled(true) ; } + } +} + + +// --------------------------------------------------- +bool MonEditZone::CreateOrUpdateZone() +//---------------------------------------------------- +// Pas de Creation de la zone +// Mise a jour des attributs de la Zone +{ + try + { + switch (_Type) + { + case 11 : // il s agit d un rectangle + { } + case 12 : // il s agit d un rectangle + { } + case 13 : // il s agit d un rectangle + { } + case 2 : // il s agit d un parallelepipede + { aZone->SetBox( _ZoneXmin, _ZoneXmax, _ZoneYmin, _ZoneYmax, _ZoneZmin, _ZoneZmax ); + break; + } + case 4 : // il s agit d une sphere + { aZone->SetSphere( _ZoneXcentre, _ZoneYcentre, _ZoneZcentre, _ZoneRayon ); + break; + } + case 31 : // il s agit d un disque issu d'un cylindre + { } + case 32 : // il s agit d un disque issu d'un cylindre + { } + case 33 : // il s agit d un disque issu d'un cylindre + { } + case 5 : // il s agit d un cylindre + { aZone->SetCylinder( _ZoneXcentre, _ZoneYcentre, _ZoneZcentre, _ZoneXaxis, _ZoneYaxis, _ZoneZaxis, _ZoneRayon, _ZoneHaut ); + break; + } + case 61 : // il s agit d un disque issu d'un cylindre + { } + case 62 : // il s agit d un disque issu d'un cylindre + { } + case 63 : // il s agit d un disque issu d'un cylindre + { } + case 7 : // il s agit d un tuyau + { aZone->SetPipe( _ZoneXcentre, _ZoneYcentre, _ZoneZcentre, _ZoneXaxis, _ZoneYaxis, _ZoneZaxis, _ZoneRayon, _ZoneHaut, _ZoneRayonInt ); + break; + } + } + if (Chgt) myHomardGen->InvalideZone(_Name.toStdString().c_str()); + HOMARD_UTILS::updateObjBrowser(); + } + catch( const SALOME::SALOME_Exception& S_ex ) { + SalomeApp_Tools::QtCatchCorbaException( S_ex ); + return false; + } + return true; +} + diff --git a/src/ADAPTGUI/MonEditZone.h b/src/ADAPTGUI/MonEditZone.h new file mode 100644 index 000000000..6570d263e --- /dev/null +++ b/src/ADAPTGUI/MonEditZone.h @@ -0,0 +1,59 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_EDITZONE_H +#define MON_EDITZONE_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) + +#include + +class HOMARD_EXPORT MonEditZone : public MonCreateZone +{ + Q_OBJECT +public: + MonEditZone( MonCreateHypothesis* parent, bool modal, + HOMARD::HOMARD_Gen_var myHomardGen, + QString caseName, QString Name); + virtual ~MonEditZone(); + +protected : + void SetBox(); + void SetSphere(); + void SetCylinder(); + void SetPipe(); + bool CreateOrUpdateZone(); + void InitValEdit(); + void InitValZoneLimit(); + void InitValZoneBox(); + void InitValZoneSphere(); + void InitValZoneCylinder(); + void InitValZonePipe(); + +public slots: + +}; + +#endif // MON_EDITZONE_H diff --git a/src/ADAPTGUI/MonIterInfo.cxx b/src/ADAPTGUI/MonIterInfo.cxx new file mode 100644 index 000000000..b361d29e8 --- /dev/null +++ b/src/ADAPTGUI/MonIterInfo.cxx @@ -0,0 +1,175 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonIterInfo.h" + +#include +#include +#include +#include + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include "MonEditFile.h" +#include + +using namespace std; + +// ----------------------------------------------------------------------------------------- +MonIterInfo::MonIterInfo(QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen0, QString IterName) +// ----------------------------------------------------------------------------------------- +/* Constructs a MonIterInfo + * Inherits from CasHomard + * Sets attributes to default values + */ + : + Ui_IterInfo(), + _IterName(IterName), + _aCaseName(""), + _BlockSize(0), + _Connection(0), + _Diametre(0), + _Entanglement(0), + _Quality(0), + _Option(-1) +{ + MESSAGE("appel de _duplicate"); + myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + setupUi(this); + setModal(modal); + InitConnect(); + + adjustSize(); +} + +// ------------------------------------------------------------------------ +MonIterInfo::~MonIterInfo() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void MonIterInfo::InitConnect() +// ------------------------------------------------------------------------ +{ + MESSAGE("InitConnect"); + connect( CBBlockSize, SIGNAL(stateChanged(int)), this, SLOT(SetBlockSize())); + connect( CBConnection, SIGNAL(stateChanged(int)), this, SLOT(SetConnection())); + connect( CBDiametre, SIGNAL(stateChanged(int)), this, SLOT(SetDiametre())); + connect( CBEntanglement, SIGNAL(stateChanged(int)), this, SLOT(SetEntanglement())); + connect( CBQuality, SIGNAL(stateChanged(int)), this, SLOT(SetQuality())); + + 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 MonIterInfo::PushOnApply() +// -------------------------------- +{ + MESSAGE("PushOnApply"); + + // Au moins une option a ete choisie + if ( ( _Quality == 0 ) && ( _Diametre == 0 ) && ( _Connection == 0 ) && ( _BlockSize == 0 ) && ( _Entanglement == 0 ) ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MESH_INFO_1") ); + return false; + } + + // Recuperation de l'iteration + aIter = myHomardGen->GetIteration(_IterName.toStdString().c_str()) ; + + // Lancement de l'analyse + try + { + aIter->MeshInfoOption( _Quality, _Diametre, _Connection, _BlockSize, _Entanglement, _Option ); + } + catch( SALOME::SALOME_Exception& S_ex ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr(CORBA::string_dup(S_ex.details.text)) ); + return false; + } + + // Le bilan de l'analyse a afficher + QString aFileName = aIter->GetFileInfo() ; + MonEditFile *aDlg = new MonEditFile( 0, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), aFileName, 0 ) ; + if ( aDlg->_codret == 0 ) { aDlg->show(); } + + + HOMARD_UTILS::updateObjBrowser(); + return true; +} +// --------------------------- +void MonIterInfo::PushOnOK() +// --------------------------- +{ + bool bOK = PushOnApply(); + if ( bOK ) this->close(); +} +//------------------------------ +void MonIterInfo::PushOnHelp() +//------------------------------- +{ + std::string LanguageShort = myHomardGen->GetLanguageShort(); + HOMARD_UTILS::PushOnHelp(QString("gui_mesh_info.html"), QString(""), QString(LanguageShort.c_str())); +} +// ------------------------------------------------------------------------ +void MonIterInfo::SetBlockSize() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetBlockSize "); + if ( CBBlockSize->isChecked() ) { _BlockSize = 1 ; } + else { _BlockSize = 0 ; } +} +// ------------------------------------------------------------------------ +void MonIterInfo::SetConnection() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetConnection "); + if ( CBConnection->isChecked() ) { _Connection = 1 ; } + else { _Connection = 0 ; } +} +// ------------------------------------------------------------------------ +void MonIterInfo::SetDiametre() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetDiametre "); + if ( CBDiametre->isChecked() ) { _Diametre = 1 ; } + else { _Diametre = 0 ; } +} +// ------------------------------------------------------------------------ +void MonIterInfo::SetEntanglement() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetEntanglement "); + if ( CBEntanglement->isChecked() ) { _Entanglement = 1 ; } + else { _Entanglement = 0 ; } +} +// ------------------------------------------------------------------------ +void MonIterInfo::SetQuality() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetQuality "); + if ( CBQuality->isChecked() ) { _Quality = 1 ; } + else { _Quality = 0 ; } +} diff --git a/src/ADAPTGUI/MonIterInfo.h b/src/ADAPTGUI/MonIterInfo.h new file mode 100644 index 000000000..358c3baf4 --- /dev/null +++ b/src/ADAPTGUI/MonIterInfo.h @@ -0,0 +1,78 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_ITERINFO_H +#define MON_ITERINFO_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(HOMARD_Cas) + +#include "ui_IterInfo.h" +#include +#include + +class QListBox; + +class HOMARD_EXPORT MonIterInfo : public QDialog, public Ui_IterInfo +{ + Q_OBJECT + +public: + MonIterInfo( QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString IterName); + ~MonIterInfo(); + +protected : + MonIterInfo( QWidget* parent, HOMARD::HOMARD_Gen_var myHomardGen, QString IterName ); + + QString _IterName; + QString _aCaseName; + + int _BlockSize; + int _Connection; + int _Diametre; + int _Entanglement; + int _Quality; + int _Option; + + HOMARD::HOMARD_Iteration_var aIter ; + HOMARD::HOMARD_Gen_var myHomardGen; + + virtual void InitConnect(); + +public slots: + + virtual void SetBlockSize(); + virtual void SetConnection(); + virtual void SetEntanglement(); + virtual void SetDiametre(); + virtual void SetQuality(); + + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); + +}; + +#endif // MON_ITERINFO_H diff --git a/src/ADAPTGUI/MonMeshInfo.cxx b/src/ADAPTGUI/MonMeshInfo.cxx new file mode 100644 index 000000000..7c5e92899 --- /dev/null +++ b/src/ADAPTGUI/MonMeshInfo.cxx @@ -0,0 +1,281 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonMeshInfo.h" +#include "HOMARD.hxx" + +#include +#include + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include "MonEditFile.h" +#include + +#ifdef WIN32 +#include +#endif + +using namespace std; + +// ----------------------------------------------------------------------------------------- +MonMeshInfo::MonMeshInfo(QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen0) +// ----------------------------------------------------------------------------------------- +/* Constructs a MonMeshInfo + * Inherits from CasHomard + * Sets attributes to default values + */ + : + Ui_MeshInfo(), + _aCaseName(""),_aDirName(""), + _BlockSize(0), + _Connection(0), + _Diametre(0), + _Entanglement(0), + _Quality(0) +{ + myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + setupUi(this); + setModal(modal); + InitConnect(); + + SetNewCaseName() ; + adjustSize(); +} + +// ------------------------------------------------------------------------ +MonMeshInfo::~MonMeshInfo() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void MonMeshInfo::InitConnect() +// ------------------------------------------------------------------------ +{ + connect( LECaseName, SIGNAL(textChanged(QString)), this, SLOT(CaseNameChanged())); + connect( PushDir, SIGNAL(pressed()), this, SLOT(SetDirName())); + connect( PushFichier, SIGNAL(pressed()), this, SLOT(SetFileName())); + + connect( CBBlockSize, SIGNAL(stateChanged(int)), this, SLOT(SetBlockSize())); + connect( CBConnection, SIGNAL(stateChanged(int)), this, SLOT(SetConnection())); + connect( CBDiametre, SIGNAL(stateChanged(int)), this, SLOT(SetDiametre())); + connect( CBEntanglement, SIGNAL(stateChanged(int)), this, SLOT(SetEntanglement())); + connect( CBQuality, SIGNAL(stateChanged(int)), this, SLOT(SetQuality())); + + 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 MonMeshInfo::PushOnApply() +// -------------------------------- +{ + MESSAGE("PushOnApply"); + QString aCaseName=LECaseName->text().trimmed(); + if ( aCaseName == "" ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_NAME") ); + return false; + } + + QString aDirName=LEDirName->text().trimmed(); + if (aDirName == QString("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_DIRECTORY_1") ); + return false; + } + if ( aDirName != _aDirName) + { QString CaseNameDir = myHomardGen->VerifieDir( aDirName.toStdString().c_str()) ; + if ( CaseNameDir != "" ) + { + QString texte ; + texte = QObject::tr("HOM_CASE_DIRECTORY_2") + CaseNameDir ; + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + texte ); + return false; + } + } + if (CHDIR(aDirName.toStdString().c_str()) != 0) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_DIRECTORY_3") ); + return false; + } + + QString aFileName=LEFileName->text().trimmed(); + if (aFileName ==QString("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_MESH") ); + return false; + } + + QString aMeshName = HOMARD_QT_COMMUN::LireNomMaillage(aFileName); + if (aMeshName == "" ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MED_FILE_2") ); + return false; + } + if ( ( _Quality == 0 ) && ( _Diametre == 0 ) && ( _Connection == 0 ) && ( _BlockSize == 0 ) && ( _Entanglement == 0 ) ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MESH_INFO") ); + return false; + } + + if (aCaseName != _aCaseName ) + { + _aCaseName = aCaseName; + try + { + myHomardGen->MeshInfo( \ + CORBA::string_dup(_aCaseName.toStdString().c_str()), \ + CORBA::string_dup(aMeshName.toStdString().c_str()), \ + CORBA::string_dup(aFileName.toStdString().c_str()), \ + CORBA::string_dup(aDirName.toStdString().c_str()), \ + _Quality, _Diametre, _Connection, _BlockSize, _Entanglement ); + } + catch( SALOME::SALOME_Exception& S_ex ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr(CORBA::string_dup(S_ex.details.text)) ); + return false; + } + } + + // Le bilan de l'analyse a afficher + aCase = myHomardGen->GetCase(_aCaseName.toStdString().c_str()); + string iter0 = aCase->GetIter0Name(); + HOMARD::HOMARD_Iteration_var aIter = myHomardGen->GetIteration(iter0.c_str()); + aFileName = aIter->GetFileInfo() ; + MonEditFile *aDlg = new MonEditFile( 0, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), aFileName, 1 ) ; + if ( aDlg->_codret == 0 ) { aDlg->show(); } + +HOMARD_UTILS::updateObjBrowser(); + return true; +} +// --------------------------- +void MonMeshInfo::PushOnOK() +// --------------------------- +{ + bool bOK = PushOnApply(); + if ( bOK ) this->close(); +} +//------------------------------ +void MonMeshInfo::PushOnHelp() +//------------------------------- +{ + std::string LanguageShort = myHomardGen->GetLanguageShort(); + HOMARD_UTILS::PushOnHelp(QString("gui_create_case.html"), QString(""), QString(LanguageShort.c_str())); +} +// --------------------------------- +void MonMeshInfo::SetNewCaseName() +// ------------------------------ +{ + HOMARD::listeCases_var MyCases = myHomardGen->GetAllCasesName(); + int num = 0; QString aCaseName=""; + while (aCaseName=="" ) + { + aCaseName.setNum(num+1) ; + aCaseName.insert(0, QString("Case_")) ; + for ( int i=0; ilength(); i++) + { + if ( aCaseName == QString((MyCases)[i]) ) + { + num ++ ; + aCaseName = "" ; + break ; + } + } + } + LECaseName->clear() ; + LECaseName->insert(aCaseName); +} +// ------------------------------------------------------------------------ +void MonMeshInfo::SetDirName() +// ------------------------------------------------------------------------ +{ + QString aDirName=QFileDialog::getExistingDirectory (); + if (!(aDirName.isEmpty()))LEDirName->setText(aDirName); +} +// ------------------------------------------------------------------------ +void MonMeshInfo::SetFileName() +// ------------------------------------------------------------------------ +{ + QString fileName0 = LEFileName->text().trimmed(); + QString fileName = HOMARD_QT_COMMUN::PushNomFichier( false, QString("med") ) ; + if (fileName.isEmpty()) fileName = fileName0 ; + LEFileName->setText(fileName); +} +// ------------------------------------------------------------------------ +void MonMeshInfo::CaseNameChanged() +// ------------------------------------------------------------------------ +{ + if (_aCaseName != LECaseName->text().trimmed()) + { + LEFileName->setReadOnly(false); + PushFichier->show(); + } +} +// ------------------------------------------------------------------------ +void MonMeshInfo::SetBlockSize() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetBlockSize "); + if ( CBBlockSize->isChecked() ) { _BlockSize = 1 ; } + else { _BlockSize = 0 ; } +} +// ------------------------------------------------------------------------ +void MonMeshInfo::SetConnection() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetConnection "); + if ( CBConnection->isChecked() ) { _Connection = 1 ; } + else { _Connection = 0 ; } +} +// ------------------------------------------------------------------------ +void MonMeshInfo::SetDiametre() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetDiametre "); + if ( CBDiametre->isChecked() ) { _Diametre = 1 ; } + else { _Diametre = 0 ; } +} +// ------------------------------------------------------------------------ +void MonMeshInfo::SetEntanglement() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetEntanglement "); + if ( CBEntanglement->isChecked() ) { _Entanglement = 1 ; } + else { _Entanglement = 0 ; } +} +// ------------------------------------------------------------------------ +void MonMeshInfo::SetQuality() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetQuality "); + if ( CBQuality->isChecked() ) { _Quality = 1 ; } + else { _Quality = 0 ; } +} diff --git a/src/ADAPTGUI/MonMeshInfo.h b/src/ADAPTGUI/MonMeshInfo.h new file mode 100644 index 000000000..55a31fe34 --- /dev/null +++ b/src/ADAPTGUI/MonMeshInfo.h @@ -0,0 +1,76 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_MESHINFO_H +#define MON_MESHINFO_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(HOMARD_Cas) + +#include "ui_MeshInfo.h" +#include + +class HOMARD_EXPORT MonMeshInfo : public QDialog, public Ui_MeshInfo +{ + Q_OBJECT + +public: + MonMeshInfo( QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen); + ~MonMeshInfo(); + +protected : + QString _aCaseName; + QString _aDirName; + + int _BlockSize; + int _Connection; + int _Diametre; + int _Entanglement; + int _Quality; + + HOMARD::HOMARD_Cas_var aCase ; + HOMARD::HOMARD_Gen_var myHomardGen; + + virtual void InitConnect(); + virtual void SetNewCaseName(); + +public slots: + virtual void SetDirName(); + virtual void SetFileName(); + + virtual void SetBlockSize(); + virtual void SetConnection(); + virtual void SetEntanglement(); + virtual void SetDiametre(); + virtual void SetQuality(); + + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); + + virtual void CaseNameChanged(); +}; + +#endif // MON_MESHINFO_H diff --git a/src/ADAPTGUI/MonPursueIteration.cxx b/src/ADAPTGUI/MonPursueIteration.cxx new file mode 100644 index 000000000..b6c76d407 --- /dev/null +++ b/src/ADAPTGUI/MonPursueIteration.cxx @@ -0,0 +1,288 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "MonPursueIteration.h" +#include "HOMARD.hxx" + +#include +#include + +#include "SalomeApp_Tools.h" +#include "HOMARDGUI_Utils.h" +#include "HomardQtCommun.h" +#include + +#ifdef WIN32 +#include +#endif + +using namespace std; + +// ----------------------------------------------------------------------------------------- +/* Constructs a MonPursueIteration + * Sets attributes to default values + */ +// ----------------------------------------------------------------------------------------- +MonPursueIteration::MonPursueIteration ( bool modal, HOMARD::HOMARD_Gen_var myHomardGen0 ) + : + Ui_PursueIteration(), + _aCaseName(""), _aDirName(""), _aDirNameStart("") +{ + MESSAGE("Debut du constructeur de MonPursueIteration"); + myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + setupUi(this); + setModal(modal); + + InitConnect(); + + SetNewCaseName() ; + _Type = 1 ; + GBIterationintoCase->setVisible(0); + SpinBoxNumber->setVisible(0); + + adjustSize(); + MESSAGE("Fin du constructeur de MonPursueIteration"); +} + +// ------------------------------------------------------------------------ +MonPursueIteration::~MonPursueIteration() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void MonPursueIteration::InitConnect() +// ------------------------------------------------------------------------ +{ + connect( PushDir, SIGNAL(pressed()), this, SLOT(SetDirName())); + + connect( RBIteration, SIGNAL(clicked()), this, SLOT(FromIteration())); + connect( RBCase, SIGNAL(clicked()), this, SLOT(FromCase())); + connect( PushDirStart, SIGNAL(pressed()), this, SLOT(SetDirNameStart())); + + connect( RBCaseLastIteration, SIGNAL(clicked()), this, SLOT(CaseLastIteration())); + connect( RBCaseNIteration, SIGNAL(clicked()), this, SLOT(CaseNIteration())); + + 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 MonPursueIteration::PushOnApply() +// -------------------------------- +{ + MESSAGE("PushOnApply"); +// 1. Enregistrement du repertoire du cas + QString aDirName=LEDirName->text().trimmed(); + if (aDirName == QString("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_DIRECTORY_1") ); + return false; + } + if ( aDirName != _aDirName) + { QString CaseNameDir = myHomardGen->VerifieDir( aDirName.toStdString().c_str()) ; + if ( CaseNameDir != "" ) + { + QString texte ; + texte = QObject::tr("HOM_CASE_DIRECTORY_2") + CaseNameDir ; + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + texte ); + return false; + } + } + if (CHDIR(aDirName.toStdString().c_str()) != 0) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_DIRECTORY_3") ); + return false; + } +// 2. Enregistrement du repertoire de depart + QString aDirNameStart=LEDirNameStart->text().trimmed(); + if (aDirNameStart == QString("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_START_DIRECTORY_1") ); + return false; + } + if (CHDIR(aDirNameStart.toStdString().c_str()) != 0) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_START_DIRECTORY_3") ); + return false; + } + +// 3. Enregistrement du numero d'iteration + int Number ; + if ( _Type == 3 ) { Number = SpinBoxNumber->value() ; } + +// 4. Creation du cas + QString _aCaseName=LECaseName->text().trimmed(); + _aDirNameStart=aDirNameStart; + + MESSAGE("_aCaseName = "<<_aCaseName.toStdString().c_str()); + MESSAGE("_aDirNameStart = "<<_aDirNameStart.toStdString().c_str()); + MESSAGE("_Type = "<<_Type); + switch (_Type) + { + case 1 : // Poursuite a partir d'une iteration + { + try + { + MESSAGE("Poursuite a partir d'une iteration"); + aCase = myHomardGen->CreateCaseFromIteration( \ + CORBA::string_dup(_aCaseName.toStdString().c_str()), \ + CORBA::string_dup(_aDirNameStart.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 ; + } + break; + } + case 2 : // Poursuite a partir de la derniere iteration dans un cas + { + try + { + MESSAGE("Poursuite a partir de la derniere iteration dans un cas"); + aCase = myHomardGen->CreateCaseFromCaseLastIteration( \ + CORBA::string_dup(_aCaseName.toStdString().c_str()), \ + CORBA::string_dup(_aDirNameStart.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 ; + } + break; + } + case 3 : // Poursuite a partir d'une iteration dans un cas + { + try + { + MESSAGE("Poursuite a partir d'une iteration dans un cas"); + aCase = myHomardGen->CreateCaseFromCaseIteration( \ + CORBA::string_dup(_aCaseName.toStdString().c_str()), \ + CORBA::string_dup(_aDirNameStart.toStdString().c_str()), \ + Number ); + } + catch( SALOME::SALOME_Exception& S_ex ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr(CORBA::string_dup(S_ex.details.text)) ); + return false ; + } + break; + } + } + + aCase->SetDirName(aDirName.toStdString().c_str()); + _aDirName=aDirName; + + HOMARD_UTILS::updateObjBrowser(); + + return true; +} +// --------------------------- +void MonPursueIteration::PushOnOK() +// --------------------------- +{ + bool bOK = PushOnApply(); + if ( bOK ) this->close(); +} +//------------------------------ +void MonPursueIteration::PushOnHelp() +//------------------------------- +{ + std::string LanguageShort = myHomardGen->GetLanguageShort(); + HOMARD_UTILS::PushOnHelp(QString("gui_create_case.html"), QString(""), QString(LanguageShort.c_str())); +} +// --------------------------------- +void MonPursueIteration::SetNewCaseName() +// ------------------------------ +{ + HOMARD::listeCases_var MyCases = myHomardGen->GetAllCasesName(); + int num = 0; QString aCaseName=""; + while (aCaseName=="" ) + { + aCaseName.setNum(num+1) ; + aCaseName.insert(0, QString("Case_")) ; + for ( int i=0; ilength(); i++) + { + if ( aCaseName == QString((MyCases)[i])) + { + num ++ ; + aCaseName = "" ; + break ; + } + } + } + LECaseName->clear() ; + LECaseName->insert(aCaseName); +} +// ------------------------------------------------------------------------ +void MonPursueIteration::SetDirName() +// ------------------------------------------------------------------------ +{ + QString aDirName=QFileDialog::getExistingDirectory (); + if (!(aDirName.isEmpty()))LEDirName->setText(aDirName); +} +// ------------------------------------------------------------------------ +void MonPursueIteration::SetDirNameStart() +// ------------------------------------------------------------------------ +{ + QString aDirName=QFileDialog::getExistingDirectory (); + if (!(aDirName.isEmpty()))LEDirNameStart->setText(aDirName); +} +// ------------------------------------------------------------------------ +void MonPursueIteration::FromIteration() +// ------------------------------------------------------------------------ +{ + GBIterationintoCase->setVisible(0); + SpinBoxNumber->setVisible(0); + _Type = 1 ; + adjustSize(); +} +// ------------------------------------------------------------------------ +void MonPursueIteration::FromCase() +// ------------------------------------------------------------------------ +{ + GBIterationintoCase->setVisible(1); + CaseLastIteration(); +} +// ------------------------------------------------------------------------ +void MonPursueIteration::CaseLastIteration() +// ------------------------------------------------------------------------ +{ + SpinBoxNumber->setVisible(0); + _Type = 2 ; + adjustSize(); +} +// ------------------------------------------------------------------------ +void MonPursueIteration::CaseNIteration() +// ------------------------------------------------------------------------ +{ + SpinBoxNumber->setVisible(1); + _Type = 3 ; + adjustSize(); +} diff --git a/src/ADAPTGUI/MonPursueIteration.h b/src/ADAPTGUI/MonPursueIteration.h new file mode 100644 index 000000000..fbeda6f75 --- /dev/null +++ b/src/ADAPTGUI/MonPursueIteration.h @@ -0,0 +1,72 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MON_PURSUEITERATION_H +#define MON_PURSUEITERATION_H + +#include "HOMARDGUI_Exports.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(HOMARD_Gen) +#include CORBA_CLIENT_HEADER(HOMARD_Cas) + +#include "ui_PursueIteration.h" +#include + +class HOMARD_EXPORT MonPursueIteration : public QDialog, public Ui_PursueIteration +{ + Q_OBJECT + + public: + MonPursueIteration( bool modal, HOMARD::HOMARD_Gen_var myHomardGen ); + virtual ~MonPursueIteration(); + + protected : + QString _aCaseName; + QString _aDirName; + QString _aDirNameStart; + + int _Type ; + + HOMARD::HOMARD_Cas_var aCase ; + HOMARD::HOMARD_Gen_var myHomardGen; + + virtual void InitConnect(); + virtual void SetNewCaseName(); + + public slots: + virtual void SetDirName(); + + virtual void FromIteration(); + virtual void FromCase(); + virtual void SetDirNameStart(); + + virtual void CaseLastIteration(); + virtual void CaseNIteration(); + + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); + +}; + +#endif // MON_PURSUEITERATION_H diff --git a/src/ADAPTGUI/PursueIteration.ui b/src/ADAPTGUI/PursueIteration.ui new file mode 100644 index 000000000..ad3de2352 --- /dev/null +++ b/src/ADAPTGUI/PursueIteration.ui @@ -0,0 +1,252 @@ + + + PursueIteration + + + + 0 + 0 + 601 + 300 + + + + + 0 + 0 + + + + Pursue an iteration + + + true + + + + + + 6 + + + 0 + + + + + Name + + + + + + + + 382 + 21 + + + + + + + + + + 6 + + + 0 + + + + + Directory + + + + + + + + + + false + + + + + + + + 382 + 21 + + + + + + + + + + From an iteration + + + true + + + + + + + From a case + + + + + + + 6 + + + 0 + + + + + Directory + + + + + + + + + + false + + + + + + + + 382 + 21 + + + + + + + + + + Iteration into the case + + + + + + Last iteration + + + true + + + + + + + Iteration number + + + + + + + 1789 + + + + + + + + + + + + + + 9 + + + 6 + + + + + Help + + + false + + + + + + + Apply + + + false + + + + + + + OK + + + false + + + + + + + Cancel + + + false + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 128 + 25 + + + + + + + + + diff --git a/src/ADAPT_I/CMakeLists.txt b/src/ADAPT_I/CMakeLists.txt new file mode 100644 index 000000000..f571c2158 --- /dev/null +++ b/src/ADAPT_I/CMakeLists.txt @@ -0,0 +1,93 @@ +# Copyright (C) 2012-2020 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# --- options --- +# additional include directories +INCLUDE_DIRECTORIES( + ${OMNIORB_INCLUDE_DIR} + ${KERNEL_INCLUDE_DIRS} + ${MEDFILE_INCLUDE_DIRS} + ${SMESH_INCLUDE_DIRS} + ${GEOM_INCLUDE_DIRS} + ${HDF5_INCLUDE_DIRS} + ${PROJECT_BINARY_DIR} + ${PROJECT_BINARY_DIR}/idl + ${PROJECT_BINARY_DIR}/adm_local/unix + ${PROJECT_SOURCE_DIR}/src/FrontTrack + ${PROJECT_SOURCE_DIR}/src/ADAPT + ${PROJECT_SOURCE_DIR}/src/ADAPTGUI +) +# additional preprocessor / compiler flags +ADD_DEFINITIONS( + ${OMNIORB_DEFINITIONS} +) + +# libraries to link to +SET(_link_LIBRARIES + ${MEDFILE_C_LIBRARIES} + ${KERNEL_SalomeContainer} + ${KERNEL_SalomeNS} + ${KERNEL_Registry} + ${KERNEL_SalomeHDFPersist} + ${KERNEL_SalomeLifeCycleCORBA} + ${KERNEL_TOOLSDS} + ${KERNEL_SalomeGenericObj} + ${SMESH_SalomeIDLSMESH} + ${SMESH_SMESHEngine} + FrontTrack + SalomeIDLADAPT + ADAPTImpl +) + +# --- headers --- + +# header files / no moc processing +SET(ADAPTEngine_HEADERS + HOMARD_Cas_i.hxx + HOMARD_Hypothesis_i.hxx + HOMARD_Iteration_i.hxx + HOMARD_Zone_i.hxx + HOMARD_Gen_i.hxx + HOMARD_Boundary_i.hxx + HOMARD_YACS_i.hxx + HomardMedCommun.h + HOMARD_i.hxx +) + +# --- sources --- + +# sources / static +SET(ADAPTEngine_SOURCES + HOMARD_Cas_i.cxx + HOMARD_Hypothesis_i.cxx + HOMARD_Iteration_i.cxx + HOMARD_Gen_i.cxx + HOMARD_Zone_i.cxx + HOMARD_Boundary_i.cxx + HOMARD_YACS_i.cxx + HomardMedCommun.cxx +) + +# --- rules --- + +ADD_LIBRARY(ADAPTEngine ${ADAPTEngine_SOURCES}) +TARGET_LINK_LIBRARIES(ADAPTEngine ${_link_LIBRARIES} ) +INSTALL(TARGETS ADAPTEngine EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) + +INSTALL(FILES ${ADAPTEngine_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) diff --git a/src/ADAPT_I/HOMARD_Boundary_i.cxx b/src/ADAPT_I/HOMARD_Boundary_i.cxx new file mode 100644 index 000000000..ef80c35b5 --- /dev/null +++ b/src/ADAPT_I/HOMARD_Boundary_i.cxx @@ -0,0 +1,262 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// 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 "HOMARD_Boundary_i.hxx" +#include "HOMARD_Gen_i.hxx" +#include "HOMARD_Boundary.hxx" +#include "HOMARD_DriverTools.hxx" + +#include "utilities.h" + +//============================================================================= +/*! + * 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, + HOMARD::HOMARD_Gen_var engine ) +{ + MESSAGE( "HOMARD_Boundary_i" ); + _gen_i = engine; + _orb = orb; + myHomardBoundary = new ::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 HOMARD::Dump( *myHomardBoundary ); +} +//============================================================================= +bool HOMARD_Boundary_i::Restore( const std::string& stream ) +{ + return HOMARD::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 ); +} +//============================================================================= +HOMARD::double_array* HOMARD_Boundary_i::GetCoords() +{ + ASSERT( myHomardBoundary ); + HOMARD::double_array_var aResult = new HOMARD::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 ); +} +//============================================================================= +HOMARD::double_array* HOMARD_Boundary_i::GetLimit() +{ + ASSERT( myHomardBoundary ); + HOMARD::double_array_var aResult = new HOMARD::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 HOMARD::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 ); +} +//============================================================================= +HOMARD::ListGroupType* HOMARD_Boundary_i::GetGroups() +{ + ASSERT( myHomardBoundary ); + const std::list& ListString = myHomardBoundary->GetGroups(); + HOMARD::ListGroupType_var aResult = new HOMARD::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() ); +} + + + diff --git a/src/ADAPT_I/HOMARD_Boundary_i.hxx b/src/ADAPT_I/HOMARD_Boundary_i.hxx new file mode 100644 index 000000000..eaac61af3 --- /dev/null +++ b/src/ADAPT_I/HOMARD_Boundary_i.hxx @@ -0,0 +1,112 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// 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 _HOMARD_Boundary_I_HXX_ +#define _HOMARD_Boundary_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(HOMARD_Gen) +#include CORBA_SERVER_HEADER(HOMARD_Boundary) + +#include "HOMARD_i.hxx" +#include "SALOME_Component_i.hxx" +#include "SALOME_NamingService.hxx" +#include "Utils_CorbaException.hxx" + +#include + +class HOMARD_Boundary; + +class HOMARDENGINE_EXPORT HOMARD_Boundary_i: + public virtual Engines_Component_i, + public virtual POA_HOMARD::HOMARD_Boundary, + public virtual PortableServer::ServantBase +{ +public: + HOMARD_Boundary_i( CORBA::ORB_ptr orb, HOMARD::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 ); + + HOMARD::double_array* GetCoords(); + + void SetLimit( double Xincr, double Yincr, double Zincr); + HOMARD::double_array* GetLimit(); + + void AddGroup( const char* Group); + void SetGroups(const HOMARD::ListGroupType& ListGroup); + HOMARD::ListGroupType* GetGroups(); + +// Liens avec les autres structures + void SetCaseCreation( const char* NomCaseCreation ); + char* GetCaseCreation(); + + +private: + ::HOMARD_Boundary* myHomardBoundary; + + CORBA::ORB_ptr _orb; + HOMARD::HOMARD_Gen_var _gen_i; +}; + +#endif diff --git a/src/ADAPT_I/HOMARD_Cas_i.cxx b/src/ADAPT_I/HOMARD_Cas_i.cxx new file mode 100644 index 000000000..036dacef1 --- /dev/null +++ b/src/ADAPT_I/HOMARD_Cas_i.cxx @@ -0,0 +1,599 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// 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 "HOMARD_Cas_i.hxx" +#include "HOMARD_Gen_i.hxx" +#include "HOMARD_Cas.hxx" +#include "HOMARD_DriverTools.hxx" +#include "HOMARD.hxx" + +#include "utilities.h" +#include +#include + +#ifdef WIN32 +#include +#endif + +//============================================================================= +/*! + * 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, + HOMARD::HOMARD_Gen_var engine ) +{ + MESSAGE( "HOMARD_Cas_i" ); + _gen_i = engine; + _orb = orb; + myHomardCas = new ::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 HOMARD::Dump( *myHomardCas ); +} +//============================================================================= +bool HOMARD_Cas_i::Restore( const std::string& stream ) +{ + return HOMARD::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 + HOMARD::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) ; + } + return ; +} +//============================================================================= +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() ; + HOMARD::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 HOMARD::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 ); +} +//============================================================================= +HOMARD::extrema* HOMARD_Cas_i::GetBoundingBox() +{ + ASSERT(myHomardCas ); + HOMARD::extrema_var aResult = new HOMARD::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 HOMARD::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 ); +} +//============================================================================= +HOMARD::ListGroupType* HOMARD_Cas_i::GetGroups() +{ + ASSERT(myHomardCas ); + const std::list& ListString = myHomardCas->GetGroups(); + HOMARD::ListGroupType_var aResult = new HOMARD::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 + HOMARD::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 ); + HOMARD::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 ) + { + HOMARD::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++ ; + } + if ( !existe ) + { + char* CaseName = GetName() ; + MESSAGE ( "AddBoundaryGroup : insertion de la frontiere dans l'arbre de " << CaseName ); + _gen_i->PublishBoundaryUnderCase(CaseName, BoundaryName) ; + } + // 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); + } +} +//============================================================================= +HOMARD::ListBoundaryGroupType* HOMARD_Cas_i::GetBoundaryGroup() +{ + MESSAGE ("GetBoundaryGroup"); + ASSERT(myHomardCas ); + const std::list& ListBoundaryGroup = myHomardCas->GetBoundaryGroup(); + HOMARD::ListBoundaryGroupType_var aResult = new HOMARD::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 ); + return ; +} +//============================================================================= +//============================================================================= +// Liens avec les autres structures +//============================================================================= +//============================================================================= +char* HOMARD_Cas_i::GetIter0Name() +{ + ASSERT( myHomardCas ); + return CORBA::string_dup( myHomardCas->GetIter0Name().c_str() ); +} +//============================================================================= +HOMARD::HOMARD_Iteration_ptr HOMARD_Cas_i::GetIter0() +{ +// Nom de l'iteration initiale + char* Iter0Name = GetIter0Name() ; + MESSAGE ( "GetIter0 : Iter0Name = " << Iter0Name ); + return _gen_i->GetIteration(Iter0Name) ; +} +//============================================================================= +HOMARD::HOMARD_Iteration_ptr HOMARD_Cas_i::NextIteration( const char* IterName ) +{ +// Nom de l'iteration parent + char* NomIterParent = GetIter0Name() ; + MESSAGE ( "NextIteration : IterName = " << IterName ); + MESSAGE ( "NextIteration : NomIterParent = " << NomIterParent ); + return _gen_i->CreateIteration(IterName, NomIterParent) ; +} +//============================================================================= +HOMARD::HOMARD_Iteration_ptr HOMARD_Cas_i::LastIteration( ) +{ + HOMARD::HOMARD_Iteration_ptr Iter ; + HOMARD::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 ); +} +//============================================================================= +//============================================================================= +// YACS +//============================================================================= +//============================================================================= +//============================================================================= +// Creation d'un schema YACS +// YACSName : nom du schema +// ScriptFile : nom du fichier contenant le script de lancement du calcul +// DirName : le repertoire de lancement des calculs du sch?ma +// MeshFile : nom du fichier contenant le maillage pour le premier calcul +//============================================================================= +HOMARD::HOMARD_YACS_ptr HOMARD_Cas_i::CreateYACSSchema( const char* YACSName, const char* ScriptFile, const char* DirName, const char* MeshFile ) +{ +// Nom du cas + const char* CaseName = GetName() ; + MESSAGE ( "CreateYACSSchema : Schema YACS pour le cas " << YACSName); + MESSAGE ( "nomCas : " << CaseName); + MESSAGE ( "ScriptFile : " << ScriptFile); + MESSAGE ( "DirName : " << DirName); + MESSAGE ( "MeshFile : " << MeshFile); + return _gen_i->CreateYACSSchema(YACSName, CaseName, ScriptFile, DirName, MeshFile) ; +} diff --git a/src/ADAPT_I/HOMARD_Cas_i.hxx b/src/ADAPT_I/HOMARD_Cas_i.hxx new file mode 100644 index 000000000..94d17f857 --- /dev/null +++ b/src/ADAPT_I/HOMARD_Cas_i.hxx @@ -0,0 +1,119 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// 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 _HOMARD_CAS_I_HXX_ +#define _HOMARD_CAS_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(HOMARD_Gen) +#include CORBA_SERVER_HEADER(HOMARD_Cas) + +#include "HOMARD_i.hxx" +#include "SALOME_Component_i.hxx" +#include "SALOME_NamingService.hxx" +#include "Utils_CorbaException.hxx" + +#include + +class HOMARD_Cas; + +class HOMARDENGINE_EXPORT HOMARD_Cas_i: + public virtual Engines_Component_i, + public virtual POA_HOMARD::HOMARD_Cas, + public virtual PortableServer::ServantBase +{ +public: + HOMARD_Cas_i( CORBA::ORB_ptr orb, HOMARD::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 HOMARD::extrema& LesExtremes ); + HOMARD::extrema* GetBoundingBox(); + + void AddGroup( const char* Group); + void SetGroups(const HOMARD::ListGroupType& ListGroup); + HOMARD::ListGroupType* GetGroups(); + + void AddBoundary(const char* Boundary); + void AddBoundaryGroup(const char* Boundary, const char* Group); + HOMARD::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(); + HOMARD::HOMARD_Iteration_ptr GetIter0() ; + + HOMARD::HOMARD_Iteration_ptr NextIteration( const char* Name ) ; + + HOMARD::HOMARD_Iteration_ptr LastIteration() ; + + void AddIteration( const char* NomIteration ); + +// YACS + HOMARD::HOMARD_YACS_ptr CreateYACSSchema( const char* YACSName, const char* ScriptFile, const char* DirName, const char* MeshFile ); + +private: + ::HOMARD_Cas* myHomardCas; + + CORBA::ORB_ptr _orb; + HOMARD::HOMARD_Gen_var _gen_i; +}; + +#endif diff --git a/src/ADAPT_I/HOMARD_Gen_i.cxx b/src/ADAPT_I/HOMARD_Gen_i.cxx new file mode 100644 index 000000000..dde42a691 --- /dev/null +++ b/src/ADAPT_I/HOMARD_Gen_i.cxx @@ -0,0 +1,5432 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "HOMARD_Gen_i.hxx" +#include "HOMARD_Cas_i.hxx" +#include "HOMARD_Hypothesis_i.hxx" +#include "HOMARD_Iteration_i.hxx" +#include "HOMARD_Boundary_i.hxx" +#include "HOMARD_Zone_i.hxx" +#include "HOMARD_YACS_i.hxx" +#include "HomardDriver.hxx" +#include "HOMARD_DriverTools.hxx" +#include "HomardMedCommun.h" +#include "YACSDriver.hxx" +#include "HOMARD.hxx" + +#include "FrontTrack.hxx" + +#include "HOMARD_version.h" + +#include "utilities.h" +#include "Basics_Utils.hxx" +#include "Basics_DirUtils.hxx" +#include "Utils_SINGLETON.hxx" +#include "Utils_CorbaException.hxx" +#include "SALOMEDS_Tool.hxx" +#include "SALOME_LifeCycleCORBA.hxx" +#include "SALOMEconfig.h" +#include +#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog) +#include CORBA_CLIENT_HEADER(SMESH_Gen) + +#include +#include +#include +#ifndef WIN32 +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef WIN32 +#include +#endif + +using namespace std; + +//============================================================================= +//functions +//============================================================================= +std::string RemoveTabulation( std::string theScript ) +{ + std::string::size_type aPos = 0; + while( aPos < theScript.length() ) + { + aPos = theScript.find( "\n\t", aPos ); + if( aPos == std::string::npos ) + break; + theScript.replace( aPos, 2, "\n" ); + aPos++; + } + return theScript; +} +//============================================================================= +/*! + * standard constructor + */ +//============================================================================= +HOMARD_Gen_i::HOMARD_Gen_i( CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName) : +Engines_Component_i(orb, poa, contId, instanceName, interfaceName) +{ + MESSAGE("constructor"); + _thisObj = this; + _id = _poa->activate_object(_thisObj); + + myHomard = new ::HOMARD_Gen(); + _NS = SINGLETON_::Instance(); + ASSERT(SINGLETON_::IsAlreadyExisting()); + _NS->init_orb(_orb); + + myStudy = SALOMEDS::Study::_duplicate( SMESH_Gen_i::getStudyServant() ); + + _tag_gene = 0 ; + _tag_boun = 0 ; + _tag_hypo = 0 ; + _tag_yacs = 0 ; + _tag_zone = 0 ; + + SetPreferences( ) ; +} +//================================= +/*! + * standard destructor + */ +//================================ +HOMARD_Gen_i::~HOMARD_Gen_i() +{ +} +//============================================================================= +//============================================================================= +// Utilitaires pour l'étude +//============================================================================= +//============================================================================= +void HOMARD_Gen_i::UpdateStudy() +{ + ASSERT(!CORBA::is_nil(myStudy)); + SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder(); + + // Create SComponent labelled 'homard' if it doesn't already exit + SALOMEDS::SComponent_var homardFather = myStudy->FindComponent(ComponentDataType()); + if (CORBA::is_nil(homardFather)) + { + myBuilder->NewCommand(); + MESSAGE("Add Component HOMARD"); + + bool aLocked = myStudy->GetProperties()->IsLocked(); + if (aLocked) myStudy->GetProperties()->SetLocked(false); + + homardFather = myBuilder->NewComponent(ComponentDataType()); + SALOMEDS::GenericAttribute_var anAttr = myBuilder->FindOrCreateAttribute(homardFather,"AttributeName"); + SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr); + CORBA::Object_var objVarN = _NS->Resolve("/Kernel/ModulCatalog"); + SALOME_ModuleCatalog::ModuleCatalog_var Catalogue = + SALOME_ModuleCatalog::ModuleCatalog::_narrow(objVarN); + SALOME_ModuleCatalog::Acomponent_var Comp = Catalogue->GetComponent(ComponentDataType()); + if (!Comp->_is_nil()) + { + aName->SetValue(ComponentDataType()); + } + + anAttr = myBuilder->FindOrCreateAttribute(homardFather,"AttributePixMap"); + SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap("HOMARD_2.png"); + myBuilder->DefineComponentInstance(homardFather, HOMARD_Gen::_this()); + + if (aLocked) myStudy->GetProperties()->SetLocked(true); + myBuilder->CommitCommand(); + } +} + +//============================================================================= +//============================================================================= +// Utilitaires pour l'iteration +//============================================================================= +//============================================================================= +void HOMARD_Gen_i::SetEtatIter(const char* nomIter, const CORBA::Long Etat) +//===================================================================================== +{ + MESSAGE( "SetEtatIter : affectation de l'etat " << Etat << " a l'iteration " << nomIter ); + HOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[nomIter]; + if (CORBA::is_nil(myIteration)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid iteration"; + throw SALOME::SALOME_Exception(es); + return ; + }; + + myIteration->SetState(Etat); + + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + SALOMEDS::SObject_var aIterSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIteration))); + + std::string icone ; + if ( Etat <= 0 ) + icone = "iter0.png" ; + else if ( Etat == 2 ) + icone = "iter_calculee.png" ; + else + icone = "iter_non_calculee.png" ; + PublishInStudyAttr(aStudyBuilder, aIterSO, NULL , NULL, icone.c_str(), NULL) ; + + aStudyBuilder->CommitCommand(); + +} +//============================================================================= +//============================================================================= +// +//============================================================================= +//============================================================================= +// Destruction des structures identifiees par leurs noms +//============================================================================= +//============================================================================= +CORBA::Long HOMARD_Gen_i::DeleteBoundary(const char* BoundaryName) +{ + MESSAGE ( "DeleteBoundary : BoundaryName = " << BoundaryName ); + HOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; + if (CORBA::is_nil(myBoundary)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid boundary"; + throw SALOME::SALOME_Exception(es); + return 1 ; + }; + +// On verifie que la frontiere n'est plus utilisee + HOMARD::listeCases* maListe = GetAllCasesName(); + int numberOfCases = maListe->length(); + MESSAGE ( ".. Nombre de cas = " << numberOfCases ); + std::string CaseName ; + HOMARD::ListBoundaryGroupType* ListBoundaryGroupType ; + int numberOfitems ; + HOMARD::HOMARD_Cas_var myCase ; + for (int NumeCas = 0; NumeCas< numberOfCases; NumeCas++) + { + CaseName = std::string((*maListe)[NumeCas]); + MESSAGE ( "... Examen du cas = " << CaseName.c_str() ); + myCase = myStudyContext._mesCas[CaseName]; + ASSERT(!CORBA::is_nil(myCase)); + ListBoundaryGroupType = myCase->GetBoundaryGroup(); + numberOfitems = ListBoundaryGroupType->length(); + MESSAGE ( "... number of string for Boundary+Group = " << numberOfitems); + for (int NumBoundary = 0; NumBoundary< numberOfitems; NumBoundary=NumBoundary+2) + { + if ( std::string((*ListBoundaryGroupType)[NumBoundary]) == BoundaryName ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This boundary is used in a case and cannot be deleted."; + throw SALOME::SALOME_Exception(es); + return 2 ; + }; + }; + } + + // comme on a un _var comme pointeur CORBA, on ne se preoccupe pas du delete + myStudyContext._mesBoundarys.erase(BoundaryName); + SALOMEDS::Study::ListOfSObject_var listSO = myStudy->FindObjectByName(BoundaryName, ComponentDataType()); + SALOMEDS::SObject_var aSO =listSO[0]; + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + myStudy->NewBuilder()->RemoveObjectWithChildren(aSO); + + return 0 ; +} +//============================================================================= +CORBA::Long HOMARD_Gen_i::DeleteCase(const char* nomCas, CORBA::Long Option) +{ + // Pour detruire un cas + MESSAGE ( "DeleteCase : nomCas = " << nomCas << ", avec option = " << Option ); + HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; + if (CORBA::is_nil(myCase)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid case context"; + throw SALOME::SALOME_Exception(es); + return 1; + }; + // On commence par detruire toutes les iterations en partant de l'initiale et y compris elle + CORBA::String_var nomIter = myCase->GetIter0Name(); + CORBA::Long Option1 = 0 ; + if ( DeleteIterationOption(nomIter, Option1, Option) != 0 ) + { + return 2; + }; + + // comme on a un _var comme pointeur CORBA, on ne se preoccupe pas du delete + myStudyContext._mesCas.erase(nomCas); + SALOMEDS::Study::ListOfSObject_var listSO = myStudy->FindObjectByName(nomCas, ComponentDataType()); + SALOMEDS::SObject_var aSO =listSO[0]; + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + myStudy->NewBuilder()->RemoveObjectWithChildren(aSO); + + return 0 ; +} +//============================================================================= +CORBA::Long HOMARD_Gen_i::DeleteHypo(const char* nomHypo) +{ + MESSAGE ( "DeleteHypo : nomHypo = " << nomHypo ); + HOMARD::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypo]; + if (CORBA::is_nil(myHypo)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid hypothesis"; + throw SALOME::SALOME_Exception(es); + return 1 ; + }; + +// On verifie que l'hypothese n'est plus utilisee + HOMARD::listeIters* maListeIter = myHypo->GetIterations(); + int numberOfIter = maListeIter->length(); + if ( numberOfIter > 0 ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This hypothesis is used in an iteration and cannot be deleted."; + throw SALOME::SALOME_Exception(es); + return 2 ; + }; + + // suppression du lien avec les zones eventuelles + HOMARD::listeZonesHypo* maListe = myHypo->GetZones(); + int numberOfZones = maListe->length(); + MESSAGE ( ".. Nombre de zones = " << numberOfZones ); + for (int NumeZone = 0; NumeZone< numberOfZones; NumeZone++) + { + std::string ZoneName = std::string((*maListe)[NumeZone]); + MESSAGE ( ".. suppression du lien avec la zone = " << ZoneName.c_str() ); + DissociateHypoZone(nomHypo, ZoneName.c_str()) ; + NumeZone += 1 ; + } + + // comme on a un _var comme pointeur CORBA, on ne se preoccupe pas du delete + myStudyContext._mesHypotheses.erase(nomHypo); + SALOMEDS::Study::ListOfSObject_var listSO = myStudy->FindObjectByName(nomHypo, ComponentDataType()); + SALOMEDS::SObject_var aSO =listSO[0]; + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + myStudy->NewBuilder()->RemoveObjectWithChildren(aSO); + + return 0 ; +} +//============================================================================= +CORBA::Long HOMARD_Gen_i::DeleteIteration(const char* nomIter, CORBA::Long Option) +{ + // Option = 0 : On ne supprime pas le fichier du maillage associe + // Option = 1 : On supprime le fichier du maillage associe + // Pour detruire une iteration courante + MESSAGE ( "DeleteIteration : nomIter = " << nomIter << ", avec option = " << Option ); + CORBA::Long Option1 = 1 ; + return DeleteIterationOption(nomIter, Option1, Option); +} +//============================================================================= +CORBA::Long HOMARD_Gen_i::DeleteIterationOption(const char* nomIter, CORBA::Long Option1, CORBA::Long Option2) +{ + // Option1 = 0 : On autorise la destruction de l'iteration 0 + // Option1 = 1 : On interdit la destruction de l'iteration 0 + + // Option2 = 0 : On ne supprime pas le fichier du maillage associe + // Option2 = 1 : On supprime le fichier du maillage associe + MESSAGE ( "DeleteIterationOption : nomIter = " << nomIter << ", avec options = " << Option1<< ", " << Option2 ); + HOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[nomIter]; + if (CORBA::is_nil(myIteration)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid iteration"; + throw SALOME::SALOME_Exception(es); + return 1 ; + }; + + int numero = myIteration->GetNumber(); + MESSAGE ( "DeleteIterationOption : numero = " << numero ); + if ( numero == 0 && Option1 == 1 ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This iteration cannot be deleted."; + throw SALOME::SALOME_Exception(es); + return 2 ; + }; + + // On detruit recursivement toutes les filles + HOMARD::listeIterFilles* maListe = myIteration->GetIterations(); + int numberOfIter = maListe->length(); + for (int NumeIter = 0; NumeIter< numberOfIter; NumeIter++) + { + std::string nomIterFille = std::string((*maListe)[NumeIter]); + MESSAGE ( ".. appel recursif de DeleteIterationOption pour nomIter = " << nomIterFille.c_str() ); + DeleteIterationOption(nomIterFille.c_str(), Option1, Option2); + } + + // On arrive ici pour une iteration sans fille + MESSAGE ( "Destruction effective de " << nomIter ); + // On commence par invalider l'iteration pour faire le menage des dependances + // et eventuellement du maillage associe + int option ; + if ( numero == 0 ) { option = 0 ; } + else { option = Option2 ; } + InvalideIterOption(nomIter, option) ; + + // Retrait dans la descendance de l'iteration parent + if ( numero > 0 ) + { + std::string nomIterationParent = myIteration->GetIterParentName(); + MESSAGE ( "Retrait dans la descendance de nomIterationParent " << nomIterationParent ); + HOMARD::HOMARD_Iteration_var myIterationParent = myStudyContext._mesIterations[nomIterationParent]; + if (CORBA::is_nil(myIterationParent)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid iteration"; + throw SALOME::SALOME_Exception(es); + return 3 ; + }; + myIterationParent->UnLinkNextIteration(nomIter); + } + + // suppression du lien avec l'hypothese + if ( numero > 0 ) + { + std::string nomHypo = myIteration->GetHypoName(); + HOMARD::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypo]; + ASSERT(!CORBA::is_nil(myHypo)); + myHypo->UnLinkIteration(nomIter); + } + + // comme on a un _var comme pointeur CORBA, on ne se preoccupe pas du delete + myStudyContext._mesIterations.erase(nomIter); + SALOMEDS::Study::ListOfSObject_var listSO = myStudy->FindObjectByName(nomIter, ComponentDataType()); + SALOMEDS::SObject_var aSO =listSO[0]; + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + myStudy->NewBuilder()->RemoveObjectWithChildren(aSO); + // on peut aussi faire RemoveObject +// MESSAGE ( "Au final" ); +// HOMARD::listeIterations* Liste = GetAllIterationsName() ; +// numberOfIter = Liste->length(); +// for (int NumeIter = 0; NumeIter< numberOfIter; NumeIter++) +// { +// std::string nomIterFille = std::string((*Liste)[NumeIter]); +// MESSAGE ( ".. nomIter = " << nomIterFille.c_str() ); +// } + + return 0 ; +} +//============================================================================= +CORBA::Long HOMARD_Gen_i::DeleteYACS(const char* nomYACS, CORBA::Long Option) +{ + // Option = 0 : On ne supprime pas le fichier du schema associe + // Option = 1 : On supprime le fichier du schema associe + MESSAGE ( "DeleteYACS : nomYACS = " << nomYACS << ", avec option = " << Option ); + HOMARD::HOMARD_YACS_var myYACS = myStudyContext._mesYACSs[nomYACS]; + if (CORBA::is_nil(myYACS)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid schema YACS"; + throw SALOME::SALOME_Exception(es); + return 1 ; + }; + // Suppression eventuelle du fichier XML + if ( Option == 1 ) + { + std::string nomFichier = myYACS->GetXMLFile(); + std::string commande = "rm -rf " + nomFichier ; + MESSAGE ( "commande = " << commande ); + if ((system(commande.c_str())) != 0) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The xml file for the schema YACS cannot be removed." ; + throw SALOME::SALOME_Exception(es); + return 2 ; + } + } + // comme on a un _var comme pointeur CORBA, on ne se preoccupe pas du delete + myStudyContext._mesYACSs.erase(nomYACS); + SALOMEDS::Study::ListOfSObject_var listSO = myStudy->FindObjectByName(nomYACS, ComponentDataType()); + SALOMEDS::SObject_var aSO =listSO[0]; + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + myStudy->NewBuilder()->RemoveObjectWithChildren(aSO); + + return 0 ; +} +//============================================================================= +CORBA::Long HOMARD_Gen_i::DeleteZone(const char* nomZone) +{ + MESSAGE ( "DeleteZone : nomZone = " << nomZone ); + HOMARD::HOMARD_Zone_var myZone = myStudyContext._mesZones[nomZone]; + if (CORBA::is_nil(myZone)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid zone"; + throw SALOME::SALOME_Exception(es); + return 1 ; + }; + +// On verifie que la zone n'est plus utilisee + HOMARD::listeHypo* maListe = myZone->GetHypo(); + int numberOfHypo = maListe->length(); + MESSAGE ( ".. Nombre d'hypotheses = " << numberOfHypo ); + if ( numberOfHypo > 0 ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This zone is used in a hypothesis and cannot be deleted."; + throw SALOME::SALOME_Exception(es); + return 2 ; + }; +// + // comme on a un _var comme pointeur CORBA, on ne se preoccupe pas du delete + myStudyContext._mesZones.erase(nomZone); + SALOMEDS::Study::ListOfSObject_var listSO = myStudy->FindObjectByName(nomZone, ComponentDataType()); + SALOMEDS::SObject_var aSO =listSO[0]; + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + myStudy->NewBuilder()->RemoveObjectWithChildren(aSO); + + return 0 ; +} +//============================================================================= +//============================================================================= +// +//============================================================================= +//============================================================================= +// Invalidation des structures identifiees par leurs noms +//============================================================================= +//============================================================================= +void HOMARD_Gen_i::InvalideBoundary(const char* BoundaryName) +{ + MESSAGE( "InvalideBoundary : BoundaryName = " << BoundaryName ); + HOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; + if (CORBA::is_nil(myBoundary)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid boundary"; + throw SALOME::SALOME_Exception(es); + return ; + } + else + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "No change is allowed in a boundary. Ask for evolution."; + throw SALOME::SALOME_Exception(es); + return ; + }; +} +//============================================================================= +void HOMARD_Gen_i::InvalideHypo(const char* nomHypo) +{ + MESSAGE( "InvalideHypo : nomHypo = " << nomHypo ); + HOMARD::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypo]; + if (CORBA::is_nil(myHypo)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid hypothesis"; + throw SALOME::SALOME_Exception(es); + return ; + }; + + HOMARD::listeIters* maListe = myHypo->GetIterations(); + int numberOfIter = maListe->length(); + for (int NumeIter = 0; NumeIter< numberOfIter; NumeIter++) + { + std::string nomIter = std::string((*maListe)[NumeIter]); + MESSAGE( ".. nomIter = " << nomIter ); + InvalideIter(nomIter.c_str()); + } +} +//============================================================================= +void HOMARD_Gen_i::InvalideIter(const char* nomIter) +{ + MESSAGE("InvalideIter : nomIter = " << nomIter); + // Pour invalider totalement une iteration courante + CORBA::Long Option = 1 ; + return InvalideIterOption(nomIter, Option); +} +//============================================================================= +void HOMARD_Gen_i::InvalideIterOption(const char* nomIter, CORBA::Long Option) +{ + // Option = 0 : On ne supprime pas le fichier du maillage associe + // Option = 1 : On supprime le fichier du maillage associe + MESSAGE ( "InvalideIterOption : nomIter = " << nomIter << ", avec option = " << Option ); + HOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[nomIter]; + if (CORBA::is_nil(myIteration)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid iteration"; + throw SALOME::SALOME_Exception(es); + return ; + }; + + HOMARD::listeIterFilles* maListe = myIteration->GetIterations(); + int numberOfIter = maListe->length(); + for (int NumeIter = 0; NumeIter< numberOfIter; NumeIter++) + { + std::string nomIterFille = std::string((*maListe)[NumeIter]); + MESSAGE ( ".. appel recursif de InvalideIter pour nomIter = " << nomIterFille.c_str() ); + InvalideIter(nomIterFille.c_str()); + } + + // On arrive ici pour une iteration sans fille + MESSAGE ( "Invalidation effective de " << nomIter ); + SALOMEDS::SObject_var aIterSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIteration))); + SALOMEDS::ChildIterator_var aIter = myStudy->NewChildIterator(aIterSO); + for (; aIter->More(); aIter->Next()) + { + SALOMEDS::SObject_var so = aIter->Value(); + SALOMEDS::GenericAttribute_var anAttr; + if (!so->FindAttribute(anAttr, "AttributeComment")) continue; + SALOMEDS::AttributeComment_var aCommentAttr = SALOMEDS::AttributeComment::_narrow(anAttr); + std::string value (aCommentAttr->Value()); + if(value == std::string("IterationHomard")) continue; + if(value == std::string("HypoHomard")) continue; + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + aStudyBuilder->RemoveObject(so); + } + + int etat = myIteration->GetState(); + if ( etat > 0 ) + { + SetEtatIter(nomIter,1); + const char * nomCas = myIteration->GetCaseName(); + HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; + if (CORBA::is_nil(myCase)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid case context"; + throw SALOME::SALOME_Exception(es); + return ; + }; + std::string nomDir = myIteration->GetDirName(); + std::string nomFichier = myIteration->GetMeshFile(); + std::string commande = "rm -rf " + std::string(nomDir); + if ( Option == 1 ) { commande = commande + ";rm -rf " + std::string(nomFichier) ; } + MESSAGE ( "commande = " << commande ); + if ((system(commande.c_str())) != 0) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The directory for the calculation cannot be cleared." ; + throw SALOME::SALOME_Exception(es); + return ; + } + // Suppression du maillage publie dans SMESH + std::string MeshName = myIteration->GetMeshName() ; + DeleteResultInSmesh(nomFichier, MeshName) ; + }; + +} +//============================================================================= +void HOMARD_Gen_i::InvalideIterInfo(const char* nomIter) +{ + MESSAGE("InvalideIterInfo : nomIter = " << nomIter); + HOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[nomIter]; + if (CORBA::is_nil(myIteration)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid iteration"; + throw SALOME::SALOME_Exception(es); + return ; + }; + + SALOMEDS::SObject_var aIterSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIteration))); + SALOMEDS::ChildIterator_var aIter = myStudy->NewChildIterator(aIterSO); + for (; aIter->More(); aIter->Next()) + { + SALOMEDS::SObject_var so = aIter->Value(); + SALOMEDS::GenericAttribute_var anAttr; + if (!so->FindAttribute(anAttr, "AttributeComment")) continue; + SALOMEDS::AttributeComment_var aCommentAttr = SALOMEDS::AttributeComment::_narrow(anAttr); + std::string value (aCommentAttr->Value()); +/* MESSAGE("... value = " << value);*/ + if( (value == std::string("logInfo")) || ( value == std::string("SummaryInfo")) ) + { + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + aStudyBuilder->RemoveObject(so); + } + } + + const char * nomCas = myIteration->GetCaseName(); + HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; + if (CORBA::is_nil(myCase)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid case context"; + throw SALOME::SALOME_Exception(es); + return ; + }; + const char* nomDir = myIteration->GetDirName(); + std::string commande = "rm -f " + std::string(nomDir) + "/info* " ; + commande += std::string(nomDir) + "/Liste.*info" ; +/* MESSAGE ( "commande = " << commande );*/ + if ((system(commande.c_str())) != 0) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The directory for the calculation cannot be cleared." ; + throw SALOME::SALOME_Exception(es); + return ; + } +} +//============================================================================= +void HOMARD_Gen_i::InvalideYACS(const char* YACSName) +{ + MESSAGE( "InvalideYACS : YACSName = " << YACSName ); + HOMARD::HOMARD_YACS_var myYACS = myStudyContext._mesYACSs[YACSName]; + if (CORBA::is_nil(myYACS)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid schema YACS"; + throw SALOME::SALOME_Exception(es); + return ; + }; + // + SALOMEDS::SObject_var aYACSSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myYACS))); + SALOMEDS::ChildIterator_var aYACS = myStudy->NewChildIterator(aYACSSO); + for (; aYACS->More(); aYACS->Next()) + { + SALOMEDS::SObject_var so = aYACS->Value(); + SALOMEDS::GenericAttribute_var anAttr; + if (!so->FindAttribute(anAttr, "AttributeComment")) continue; + SALOMEDS::AttributeComment_var aCommentAttr = SALOMEDS::AttributeComment::_narrow(anAttr); + std::string value (aCommentAttr->Value()); + if( value == std::string("xml") ) + { + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + aStudyBuilder->RemoveObject(so); + } + } + std::string nomFichier = myYACS->GetXMLFile(); + std::string commande = "rm -rf " + std::string(nomFichier) ; + MESSAGE ( "commande = " << commande ); + if ((system(commande.c_str())) != 0) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The XML file for the schema YACS cannot be removed." ; + throw SALOME::SALOME_Exception(es); + return ; + } +} +//============================================================================= +void HOMARD_Gen_i::InvalideZone(const char* ZoneName) +{ + MESSAGE( "InvalideZone : ZoneName = " << ZoneName ); + HOMARD::HOMARD_Zone_var myZone = myStudyContext._mesZones[ZoneName]; + if (CORBA::is_nil(myZone)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid zone"; + throw SALOME::SALOME_Exception(es); + return ; + }; + HOMARD::listeHypo* maListe = myZone->GetHypo(); + int numberOfHypo = maListe->length(); + MESSAGE( ".. numberOfHypo = " << numberOfHypo ); + for (int NumeHypo = 0; NumeHypo< numberOfHypo; NumeHypo++) + { + std::string nomHypo = std::string((*maListe)[NumeHypo]); + MESSAGE( ".. nomHypo = " << nomHypo ); + InvalideHypo(nomHypo.c_str()); + } +} +//============================================================================= +//============================================================================= +// +//============================================================================= +//============================================================================= +// Association de lien entre des structures identifiees par leurs noms +//============================================================================= +//============================================================================= +void HOMARD_Gen_i::AssociateCaseIter(const char* nomCas, const char* nomIter, const char* labelIter) +{ + MESSAGE( "AssociateCaseIter : " << nomCas << ", " << nomIter << ", " << labelIter ); + + HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; + if (CORBA::is_nil(myCase)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid case"; + throw SALOME::SALOME_Exception(es); + return ; + }; + + HOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[nomIter]; + if (CORBA::is_nil(myIteration)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid iteration"; + throw SALOME::SALOME_Exception(es); + return ; + }; + + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + SALOMEDS::SObject_var aCasSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myCase))); + if (CORBA::is_nil(aCasSO)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid case"; + throw SALOME::SALOME_Exception(es); + return ; + }; + + aStudyBuilder->NewCommand(); + SALOMEDS::SObject_var newStudyIter = aStudyBuilder->NewObject(aCasSO); + PublishInStudyAttr(aStudyBuilder, newStudyIter, nomIter , labelIter, + "iter_non_calculee.png", _orb->object_to_string(myIteration)) ; + aStudyBuilder->CommitCommand(); + + myCase->AddIteration(nomIter); + myIteration->SetCaseName(nomCas); +} +//===================================================================================== +void HOMARD_Gen_i::AssociateHypoZone(const char* nomHypothesis, const char* ZoneName, CORBA::Long TypeUse) +{ + MESSAGE ( "AssociateHypoZone : nomHypo = " << nomHypothesis << ", ZoneName= " << ZoneName << ", TypeUse = " << TypeUse); + + HOMARD::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypothesis]; + ASSERT(!CORBA::is_nil(myHypo)); + SALOMEDS::SObject_var aHypoSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myHypo))); + ASSERT(!CORBA::is_nil(aHypoSO)); + + HOMARD::HOMARD_Zone_var myZone = myStudyContext._mesZones[ZoneName]; + ASSERT(!CORBA::is_nil(myZone)); + SALOMEDS::SObject_var aZoneSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myZone))); + ASSERT(!CORBA::is_nil(aZoneSO)); + + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + + aStudyBuilder->NewCommand(); + + SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aHypoSO); + aStudyBuilder->Addreference(aSubSO, aZoneSO); + + aStudyBuilder->CommitCommand(); + + myZone->AddHypo(nomHypothesis); + myHypo->AddZone0(ZoneName, TypeUse); +}; +//============================================================================= +void HOMARD_Gen_i::AssociateIterHypo(const char* nomIter, const char* nomHypo) +{ + MESSAGE("AssociateIterHypo : nomHypo = " << nomHypo << " nomIter = " << nomIter); + + // Verification de l'existence de l'hypothese + HOMARD::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypo]; + ASSERT(!CORBA::is_nil(myHypo)); + SALOMEDS::SObject_var aHypoSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myHypo))); + ASSERT(!CORBA::is_nil(aHypoSO)); + + // Verification de l'existence de l'iteration + HOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[nomIter]; + ASSERT(!CORBA::is_nil(myIteration)); + SALOMEDS::SObject_var aIterSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIteration))); + ASSERT(!CORBA::is_nil(aIterSO)); + + // Gestion de l'arbre d'etudes + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + aStudyBuilder->NewCommand(); + SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aIterSO); + aStudyBuilder->Addreference(aSubSO, aHypoSO); + aStudyBuilder->CommitCommand(); + + // Liens reciproques + myIteration->SetHypoName(nomHypo); + myHypo->LinkIteration(nomIter); + + // On stocke les noms des champ a interpoler pour le futur controle de la donnée des pas de temps + myIteration->SupprFieldInterps() ; + HOMARD::listeFieldInterpsHypo* ListField = myHypo->GetFieldInterps(); + int numberOfFieldsx2 = ListField->length(); + for (int iaux = 0; iaux< numberOfFieldsx2; iaux++) + { + std::string FieldName = std::string((*ListField)[iaux]) ; + myIteration->SetFieldInterp(FieldName.c_str()) ; + iaux++ ; + } +}; +//============================================================================= +//============================================================================= +// +//============================================================================= +//============================================================================= +// Dissociation de lien entre des structures identifiees par leurs noms +//============================================================================= +//============================================================================= +void HOMARD_Gen_i::DissociateHypoZone(const char* nomHypothesis, const char* ZoneName) +{ + MESSAGE ( "DissociateHypoZone : ZoneName= " << ZoneName << ", nomHypo = " << nomHypothesis); + + HOMARD::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypothesis]; + ASSERT(!CORBA::is_nil(myHypo)); + SALOMEDS::SObject_var aHypoSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myHypo))); + ASSERT(!CORBA::is_nil(aHypoSO)); + + HOMARD::HOMARD_Zone_var myZone = myStudyContext._mesZones[ZoneName]; + ASSERT(!CORBA::is_nil(myZone)); + SALOMEDS::SObject_var aZoneSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myZone))); + ASSERT(!CORBA::is_nil(aZoneSO)); + + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + + SALOMEDS::ChildIterator_var it = myStudy->NewChildIterator(aHypoSO); + for (; it->More(); it->Next()) + { + SALOMEDS::SObject_var aHypObj = it->Value(); + SALOMEDS::SObject_var ptrObj; + if (aHypObj->ReferencedObject(ptrObj)) + { + if (std::string(ptrObj->GetName()) == std::string(aZoneSO->GetName())) + { + aStudyBuilder->NewCommand(); + aStudyBuilder->RemoveObject(aHypObj); + aStudyBuilder->CommitCommand(); + break; + } + } + } + + myZone->SupprHypo(nomHypothesis); + myHypo->SupprZone(ZoneName); +}; +//============================================================================= +//============================================================================= +// + +//============================================================================= +//============================================================================= +// Recuperation des listes +//============================================================================= +//============================================================================= +HOMARD::listeBoundarys* HOMARD_Gen_i::GetAllBoundarysName() +{ + MESSAGE("GetAllBoundarysName"); + IsValidStudy () ; + + HOMARD::listeBoundarys_var ret = new HOMARD::listeBoundarys; + ret->length(myStudyContext._mesBoundarys.size()); + std::map::const_iterator it; + int i = 0; + for (it = myStudyContext._mesBoundarys.begin(); + it != myStudyContext._mesBoundarys.end(); it++) + { + ret[i++] = CORBA::string_dup((*it).first.c_str()); + } + + return ret._retn(); +} +//============================================================================= +HOMARD::listeCases* HOMARD_Gen_i::GetAllCasesName() +{ + MESSAGE("GetAllCasesName"); + IsValidStudy () ; + + HOMARD::listeCases_var ret = new HOMARD::listeCases; + ret->length(myStudyContext._mesCas.size()); + std::map::const_iterator it; + int i = 0; + for (it = myStudyContext._mesCas.begin(); + it != myStudyContext._mesCas.end(); it++) + { + ret[i++] = CORBA::string_dup((*it).first.c_str()); + } + + return ret._retn(); +} +//============================================================================= +HOMARD::listeHypotheses* HOMARD_Gen_i::GetAllHypothesesName() +{ + MESSAGE("GetAllHypothesesName"); + IsValidStudy () ; + + HOMARD::listeHypotheses_var ret = new HOMARD::listeHypotheses; + ret->length(myStudyContext._mesHypotheses.size()); + std::map::const_iterator it; + int i = 0; + for (it = myStudyContext._mesHypotheses.begin(); + it != myStudyContext._mesHypotheses.end(); it++) + { + ret[i++] = CORBA::string_dup((*it).first.c_str()); + } + + return ret._retn(); +} +//============================================================================= +HOMARD::listeIterations* HOMARD_Gen_i::GetAllIterationsName() +{ + MESSAGE("GetAllIterationsName"); + IsValidStudy () ; + + HOMARD::listeIterations_var ret = new HOMARD::listeIterations; + ret->length(myStudyContext._mesIterations.size()); + std::map::const_iterator it; + int i = 0; + for (it = myStudyContext._mesIterations.begin(); + it != myStudyContext._mesIterations.end(); it++) + { + ret[i++] = CORBA::string_dup((*it).first.c_str()); + } + + return ret._retn(); +} +//============================================================================= +HOMARD::listeYACSs* HOMARD_Gen_i::GetAllYACSsName() +{ + MESSAGE("GetAllYACSsName"); + IsValidStudy () ; + + HOMARD::listeYACSs_var ret = new HOMARD::listeYACSs; + ret->length(myStudyContext._mesYACSs.size()); + std::map::const_iterator it; + int i = 0; + for (it = myStudyContext._mesYACSs.begin(); + it != myStudyContext._mesYACSs.end(); it++) + { + ret[i++] = CORBA::string_dup((*it).first.c_str()); + } + + return ret._retn(); +} +//============================================================================= +HOMARD::listeZones* HOMARD_Gen_i::GetAllZonesName() +{ + MESSAGE("GetAllZonesName"); + IsValidStudy () ; + + HOMARD::listeZones_var ret = new HOMARD::listeZones; + ret->length(myStudyContext._mesZones.size()); + std::map::const_iterator it; + int i = 0; + for (it = myStudyContext._mesZones.begin(); + it != myStudyContext._mesZones.end(); it++) + { + ret[i++] = CORBA::string_dup((*it).first.c_str()); + } + + return ret._retn(); +} +//============================================================================= +//============================================================================= + +//============================================================================= +//============================================================================= +// Recuperation des structures identifiees par leurs noms +//============================================================================= +//============================================================================= +HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::GetBoundary(const char* nomBoundary) +{ + HOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[nomBoundary]; + ASSERT(!CORBA::is_nil(myBoundary)); + return HOMARD::HOMARD_Boundary::_duplicate(myBoundary); +} +//============================================================================= +HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::GetCase(const char* nomCas) +{ + HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; + ASSERT(!CORBA::is_nil(myCase)); + return HOMARD::HOMARD_Cas::_duplicate(myCase); +} +//============================================================================= +HOMARD::HOMARD_Hypothesis_ptr HOMARD_Gen_i::GetHypothesis(const char* nomHypothesis) +{ + HOMARD::HOMARD_Hypothesis_var myHypothesis = myStudyContext._mesHypotheses[nomHypothesis]; + ASSERT(!CORBA::is_nil(myHypothesis)); + return HOMARD::HOMARD_Hypothesis::_duplicate(myHypothesis); +} +//============================================================================= +HOMARD::HOMARD_Iteration_ptr HOMARD_Gen_i::GetIteration(const char* NomIterationation) +{ + HOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[NomIterationation]; + ASSERT(!CORBA::is_nil(myIteration)); + return HOMARD::HOMARD_Iteration::_duplicate(myIteration); +} +//============================================================================= +HOMARD::HOMARD_YACS_ptr HOMARD_Gen_i::GetYACS(const char* nomYACS) +{ + HOMARD::HOMARD_YACS_var myYACS = myStudyContext._mesYACSs[nomYACS]; + ASSERT(!CORBA::is_nil(myYACS)); + return HOMARD::HOMARD_YACS::_duplicate(myYACS); +} +//============================================================================= +HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::GetZone(const char* ZoneName) +{ + HOMARD::HOMARD_Zone_var myZone = myStudyContext._mesZones[ZoneName]; + ASSERT(!CORBA::is_nil(myZone)); + return HOMARD::HOMARD_Zone::_duplicate(myZone); +} +//============================================================================= +//============================================================================= + +//============================================================================= +//============================================================================= +// Informations +//============================================================================= +//============================================================================= +void HOMARD_Gen_i::MeshInfo(const char* nomCas, const char* MeshName, const char* MeshFile, const char* DirName, CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte) +{ + INFOS ( "MeshInfo : nomCas = " << nomCas << ", MeshName = " << MeshName << ", MeshFile = " << MeshFile ); + INFOS ( "Qual = " << Qual << ", Diam = " << Diam << ", Conn = " << Conn << ", Tail = " << Tail << ", Inte = " << Inte ); + IsValidStudy () ; + +// Creation du cas + int option = 1 ; + if ( _PublisMeshIN != 0 ) option = 2 ; + HOMARD::HOMARD_Cas_ptr myCase = CreateCase0(nomCas, MeshName, MeshFile, 1, 0, option) ; + myCase->SetDirName(DirName) ; +// Analyse + myCase->MeshInfo(Qual, Diam, Conn, Tail, Inte) ; + + return ; +} +//============================================================================= +//============================================================================= + +//============================================================================= +//============================================================================= +// Recuperation des structures par le contexte +//============================================================================= +//============================================================================= +HOMARD::HOMARD_Iteration_ptr HOMARD_Gen_i::LastIteration(const char* nomCas) +{ + HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; + ASSERT(!CORBA::is_nil(myCase)); +// + HOMARD::HOMARD_Iteration_var myIteration = myCase->LastIteration(); + ASSERT(!CORBA::is_nil(myIteration)); +// + return HOMARD::HOMARD_Iteration::_duplicate(myIteration); +} +//============================================================================= +//============================================================================= + +//============================================================================= +//============================================================================= +// Nouvelles structures +//============================================================================= +//============================================================================= +HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::newCase() +{ + HOMARD::HOMARD_Gen_var engine = POA_HOMARD::HOMARD_Gen::_this(); + HOMARD_Cas_i* aServant = new HOMARD_Cas_i(_orb, engine); + HOMARD::HOMARD_Cas_var aCase = HOMARD::HOMARD_Cas::_narrow(aServant->_this()); + return aCase._retn(); +} +//============================================================================= +HOMARD::HOMARD_Hypothesis_ptr HOMARD_Gen_i::newHypothesis() +{ + HOMARD::HOMARD_Gen_var engine = POA_HOMARD::HOMARD_Gen::_this(); + HOMARD_Hypothesis_i* aServant = new HOMARD_Hypothesis_i(_orb, engine); + HOMARD::HOMARD_Hypothesis_var aHypo = HOMARD::HOMARD_Hypothesis::_narrow(aServant->_this()); + return aHypo._retn(); +} +//============================================================================= +HOMARD::HOMARD_Iteration_ptr HOMARD_Gen_i::newIteration() +{ + HOMARD::HOMARD_Gen_var engine = POA_HOMARD::HOMARD_Gen::_this(); + HOMARD_Iteration_i* aServant = new HOMARD_Iteration_i(_orb, engine); + HOMARD::HOMARD_Iteration_var aIter = HOMARD::HOMARD_Iteration::_narrow(aServant->_this()); + return aIter._retn(); +} +//============================================================================= +HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::newBoundary() +{ + HOMARD::HOMARD_Gen_var engine = POA_HOMARD::HOMARD_Gen::_this(); + HOMARD_Boundary_i* aServant = new HOMARD_Boundary_i(_orb, engine); + HOMARD::HOMARD_Boundary_var aBoundary = HOMARD::HOMARD_Boundary::_narrow(aServant->_this()); + return aBoundary._retn(); +} +//============================================================================= +HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::newZone() +{ + HOMARD::HOMARD_Gen_var engine = POA_HOMARD::HOMARD_Gen::_this(); + HOMARD_Zone_i* aServant = new HOMARD_Zone_i(_orb, engine); + HOMARD::HOMARD_Zone_var aZone = HOMARD::HOMARD_Zone::_narrow(aServant->_this()); + return aZone._retn(); +} +//============================================================================= +HOMARD::HOMARD_YACS_ptr HOMARD_Gen_i::newYACS() +{ + HOMARD::HOMARD_Gen_var engine = POA_HOMARD::HOMARD_Gen::_this(); + HOMARD_YACS_i* aServant = new HOMARD_YACS_i(_orb, engine); + HOMARD::HOMARD_YACS_var aYACS = HOMARD::HOMARD_YACS::_narrow(aServant->_this()); + return aYACS._retn(); +} +//============================================================================= +//============================================================================= + +//============================================================================= +//============================================================================= +// Creation des structures identifiees par leurs noms +//============================================================================= +//============================================================================= +HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCase(const char* nomCas, const char* MeshName, const char* MeshFile) +// +// Creation d'un cas initial +// nomCas : nom du cas a creer +// MeshName, MeshFile : nom et fichier du maillage correspondant +// +{ + INFOS ( "CreateCase : nomCas = " << nomCas << ", MeshName = " << MeshName << ", MeshFile = " << MeshFile ); + + int option = 1 ; + if ( _PublisMeshIN != 0 ) option = 2 ; + HOMARD::HOMARD_Cas_ptr myCase = CreateCase0(nomCas, MeshName, MeshFile, 0, 0, option) ; + +// Valeurs par defaut des filtrages + myCase->SetPyram(0); + + return HOMARD::HOMARD_Cas::_duplicate(myCase); +} +//============================================================================= +HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromIteration(const char* nomCas, const char* DirNameStart) +// +// nomCas : nom du cas a creer +// DirNameStart : nom du répertoire contenant l'iteration de reprise +// +{ + INFOS ( "CreateCaseFromIteration : nomCas = " << nomCas << ", DirNameStart = " << DirNameStart ); + std::string nomDirWork = getenv("PWD") ; + int codret ; + + // A. Decodage du point de reprise + // A.1. Controle du répertoire de depart de l'iteration + codret = CHDIR(DirNameStart) ; + if ( codret != 0 ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The directory of the iteration does not exist."; + throw SALOME::SALOME_Exception(es); + return 0; + }; + // A.2. Reperage des fichiers du répertoire de reprise + std::string file_configuration = "" ; + std::string file_maillage_homard = "" ; + int bilan ; +#ifndef WIN32 + DIR *dp; + struct dirent *dirp; + dp = opendir(DirNameStart); + while ( (dirp = readdir(dp)) != NULL ) + { + std::string file_name(dirp->d_name); +// MESSAGE ( file_name ); + bilan = file_name.find("HOMARD.Configuration.") ; + if ( bilan != string::npos ) { file_configuration = file_name ; } + bilan = file_name.find("maill.") ; + if ( bilan != string::npos ) + { + bilan = file_name.find(".hom.med") ; + if ( bilan != string::npos ) { file_maillage_homard = file_name ; } + } + } + closedir(dp); +#else + HANDLE hFind = INVALID_HANDLE_VALUE; + WIN32_FIND_DATA ffd; + hFind = FindFirstFile(DirNameStart, &ffd); + if (INVALID_HANDLE_VALUE != hFind) { + while (FindNextFile(hFind, &ffd) != 0) { + if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories + std::string file_name(ffd.cFileName); + bilan = file_name.find("HOMARD.Configuration.") ; + if ( bilan != string::npos ) { file_configuration = file_name ; } + bilan = file_name.find("maill.") ; + if ( bilan != string::npos ) + { + bilan = file_name.find(".hom.med") ; + if ( bilan != string::npos ) { file_maillage_homard = file_name ; } + } + } + FindClose(hFind); + } +#endif + MESSAGE ( "==> file_configuration : " << file_configuration ) ; + MESSAGE ( "==> file_maillage_homard : " << file_maillage_homard ) ; + // A.3. Controle + if ( ( file_configuration == "" ) || ( file_maillage_homard == "" ) ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text ; + if ( file_configuration == "" ) { text = "The configuration file cannot be found." ; } + else { text = "The HOMARD mesh file cannot be found." ; } + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + + // B. Lecture du fichier de configuration + // ATTENTION : on doit veiller a la coherence entre HomardDriver et CreateCaseFromIteration + int NumeIter ; + int TypeExt = 0 ; + int TypeConf = 0 ; + int Pyram = 0 ; + char* MeshName ; + char* MeshFile ; + // le constructeur de ifstream permet d'ouvrir un fichier en lecture + std::ifstream fichier( file_configuration.c_str() ); + if ( fichier ) // ce test échoue si le fichier n'est pas ouvert + { + std::string ligne; // variable contenant chaque ligne lue + std::string mot_cle; + std::string argument; + int decalage; + // cette boucle sur les lignes s'arrête dès qu'une erreur de lecture survient + while ( std::getline( fichier, ligne ) ) + { + // B.1. Pour la ligne courante, on identifie le premier mot : le mot-cle + std::istringstream ligne_bis(ligne); // variable contenant chaque ligne sous forme de flux + ligne_bis >> mot_cle ; + // B.2. Des valeurs entieres : le second bloc de la ligne + if ( mot_cle == "NumeIter" ) + { + ligne_bis >> NumeIter ; + NumeIter += 1 ; + } + // B.3. Des valeurs caracteres brutes : le second bloc de la ligne est la valeur + else if ( ( mot_cle == "TypeConf" ) || ( mot_cle == "TypeElem" ) ) + { + ligne_bis >> argument ; + + if ( mot_cle == "TypeConf" ) + { + if ( argument == "conforme" ) { TypeConf = 1 ; } + else if ( argument == "non_conforme_1_noeud" ) { TypeConf = 2 ; } + else if ( argument == "non_conforme_1_arete" ) { TypeConf = 3 ; } + else if ( argument == "non_conforme_indicateur" ) { TypeConf = 4 ; } + } + else if ( mot_cle == "TypeElem" ) + { + if ( argument == "ignore_pyra" ) { Pyram = 1 ; } + else if ( argument == "HOMARD" ) { Pyram = 0 ; } + } + } + // B.4. Des valeurs caracteres : le deuxieme bloc de la ligne peut etre encadre par des quotes : + // il faut les supprimer + else if ( ( mot_cle == "CCNoMNP1" ) || ( mot_cle == "CCMaiNP1" ) ) + { + ligne_bis >> argument ; + if ( argument[0] == '"' ) { decalage = 1 ; } + else { decalage = 0 ; } + size_t size = argument.size() + 1 - 2*decalage ; + + if ( mot_cle == "CCNoMNP1" ) + { + MeshName = new char[ size ]; + strncpy( MeshName, argument.c_str()+decalage, size ); + MeshName[size-1] = '\0' ; + } + else if ( mot_cle == "CCMaiNP1" ) + { + MeshFile = new char[ size ]; + strncpy( MeshFile, argument.c_str()+decalage, size ); + MeshFile[size-1] = '\0' ; + } + } + } + MESSAGE ( "==> TypeConf : " << TypeConf ) ; + MESSAGE ( "==> MeshName : " << MeshName ) ; + MESSAGE ( "==> MeshFile : " << MeshFile ) ; + MESSAGE ( "==> NumeIter : " << NumeIter ) ; + MESSAGE ( "==> Pyram : " << Pyram ) ; + } + else + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "The configuration file cannot be read." ; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + + // C. Creation effective du cas + + int option = 1 ; + if ( _PublisMeshIN != 0 ) option = 2 ; + HOMARD::HOMARD_Cas_ptr myCase = CreateCase0(nomCas, MeshName, MeshFile, 1, NumeIter, option) ; + + // D. Parametrages lus dans le fichier de configuration + + myCase->SetConfType (TypeConf) ; + myCase->SetExtType (TypeExt) ; + myCase->SetPyram (Pyram) ; + + // E. Copie du fichier de maillage homard + // E.1. Répertoire associe au cas + char* nomDirCase = myCase->GetDirName() ; + // E.2. Répertoire associe a l'iteration de ce cas + char* IterName ; + IterName = myCase->GetIter0Name() ; + HOMARD::HOMARD_Iteration_var Iter = GetIteration(IterName) ; + char* nomDirIter = CreateDirNameIter(nomDirCase, 0 ); + Iter->SetDirNameLoc(nomDirIter); + std::string nomDirIterTotal ; + nomDirIterTotal = std::string(nomDirCase) + "/" + std::string(nomDirIter) ; +#ifndef WIN32 + if (mkdir(nomDirIterTotal.c_str(), S_IRWXU|S_IRGRP|S_IXGRP) != 0) +#else + if (_mkdir(nomDirIterTotal.c_str()) != 0) +#endif + { + MESSAGE ( "nomDirIterTotal : " << nomDirIterTotal ) ; + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "The directory for the computation cannot be created." ; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + // E.3. Copie du maillage HOMARD au format MED + codret = CHDIR(DirNameStart) ; + std::string commande = "cp " + file_maillage_homard + " " + nomDirIterTotal ; + MESSAGE ( "commande : " << commande ) ; + codret = system(commande.c_str()) ; + MESSAGE ( "codret : " << codret ) ; + if ( codret != 0 ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The starting point for the case cannot be copied into the working directory."; + throw SALOME::SALOME_Exception(es); + return 0; + }; + + // F. Menage + + delete[] MeshName ; + delete[] MeshFile ; + + CHDIR(nomDirWork.c_str()); + return HOMARD::HOMARD_Cas::_duplicate(myCase); +} +//============================================================================= +HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromCaseLastIteration(const char* nomCas, const char* DirNameStart) +// +// nomCas : nom du cas a creer +// DirNameStart : nom du répertoire du cas contenant l'iteration de reprise +// +{ + INFOS ( "CreateCaseFromCaseLastIteration : nomCas = " << nomCas << ", DirNameStart = " << DirNameStart ); + + std::string DirNameStartIter = CreateCase1(DirNameStart, -1) ; + + DirNameStartIter = string(DirNameStart) + "/" + DirNameStartIter ; + HOMARD::HOMARD_Cas_ptr myCase = CreateCaseFromIteration(nomCas, DirNameStartIter.c_str()) ; + + return HOMARD::HOMARD_Cas::_duplicate(myCase); +} +//============================================================================= +HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromCaseIteration(const char* nomCas, const char* DirNameStart, CORBA::Long Number) +// +// nomCas : nom du cas a creer +// DirNameStart : nom du répertoire du cas contenant l'iteration de reprise +// Number : numero de l'iteration de depart +// +{ + INFOS ( "CreateCaseFromCaseIteration : nomCas = " << nomCas << ", DirNameStart = " << DirNameStart << ", Number = " << Number ); + if ( Number < 0 ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The number of iteration must be positive."; + throw SALOME::SALOME_Exception(es); + return 0; + }; + + std::string DirNameStartIter = CreateCase1(DirNameStart, Number) ; + + DirNameStartIter = string(DirNameStart) + "/" + DirNameStartIter ; + HOMARD::HOMARD_Cas_ptr myCase = CreateCaseFromIteration(nomCas, DirNameStartIter.c_str()) ; + + return HOMARD::HOMARD_Cas::_duplicate(myCase); +} +//============================================================================= +std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Number) +// +// Retourne le nom du répertoire ou se trouve l'iteration voulue. +// DirNameStart : nom du répertoire du cas contenant l'iteration de reprise +// Number : numero de l'iteration de depart ou -1 si on cherche la derniere +// +{ + MESSAGE ( "CreateCase1 : DirNameStart = " << DirNameStart << ", Number = " << Number ); + std::string nomDirWork = getenv("PWD") ; + std::string DirNameStartIter ; + int codret ; + int NumeIterMax = -1 ; + + // A.1. Controle du répertoire de depart du cas + codret = CHDIR(DirNameStart) ; + if ( codret != 0 ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The directory of the case for the pursuit does not exist."; + throw SALOME::SALOME_Exception(es); + return 0; + }; + // A.2. Reperage des sous-répertoire du répertoire de reprise + bool existe = false ; +#ifndef WIN32 + DIR *dp; + struct dirent *dirp; + dp = opendir(DirNameStart); + while ( (dirp = readdir(dp)) != NULL ) { + std::string DirName_1(dirp->d_name); +#else + HANDLE hFind = INVALID_HANDLE_VALUE; + WIN32_FIND_DATA ffd; + hFind = FindFirstFile(DirNameStart, &ffd); + if (INVALID_HANDLE_VALUE != hFind) { + while (FindNextFile(hFind, &ffd) != 0) { + std::string DirName_1 = ""; + if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + DirName_1 = std::string(ffd.cFileName); + } +#endif + if ( ( DirName_1 != "." ) && ( DirName_1 != ".." ) ) + { + if ( CHDIR(DirName_1.c_str()) == 0 ) + { +// On cherche le fichier de configuration dans ce sous-répertoire + codret = CHDIR(DirNameStart); +#ifndef WIN32 + DIR *dp_1; + struct dirent *dirp_1; + dp_1 = opendir(DirName_1.c_str()) ; + while ( (dirp_1 = readdir(dp_1)) != NULL ) + { + std::string file_name_1(dirp_1->d_name); +#else + HANDLE hFind1 = INVALID_HANDLE_VALUE; + WIN32_FIND_DATA ffd1; + hFind1 = FindFirstFile(DirName_1.c_str(), &ffd1); + while (FindNextFile(hFind1, &ffd1) != 0) + { + if (ffd1.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories + std::string file_name_1(ffd1.cFileName); +#endif + int bilan = file_name_1.find("HOMARD.Configuration.") ; + if ( bilan != string::npos ) + { + // Decodage du fichier pour trouver le numero d'iteration + CHDIR(DirName_1.c_str()) ; + + std::ifstream fichier( file_name_1.c_str() ); + if ( fichier ) // ce test échoue si le fichier n'est pas ouvert + { + int NumeIter ; + std::string ligne; // variable contenant chaque ligne lue + std::string mot_cle; + // cette boucle sur les lignes s'arrête dès qu'une erreur de lecture survient + while ( std::getline( fichier, ligne ) ) + { + // B.1. Pour la ligne courante, on identifie le premier mot : le mot-cle + std::istringstream ligne_bis(ligne); // variable contenant chaque ligne sous forme de flux + ligne_bis >> mot_cle ; + if ( mot_cle == "NumeIter" ) + { + ligne_bis >> NumeIter ; + NumeIter += 1 ; +// MESSAGE ( "==> NumeIter : " << NumeIter ) ; + if ( Number == - 1 ) + { + if ( NumeIter >= NumeIterMax ) + { + NumeIterMax = NumeIter ; + DirNameStartIter = DirName_1 ; + } + } + else + { + if ( NumeIter == Number ) + { + DirNameStartIter = DirName_1 ; + existe = true ; + break ; + } + } + } + } + } + else + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "The configuration file cannot be read." ; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + CHDIR(DirNameStart) ; + } + if ( existe ) { break ; } + } +#ifndef WIN32 + closedir(dp_1); +#else + FindClose(hFind1); +#endif + if ( existe ) { break ; } + } + } + } +#ifndef WIN32 + closedir(dp); +#else + FindClose(hFind); +#endif + CHDIR(nomDirWork.c_str()); + + if ( ( Number >= 0 && ( !existe ) ) || ( Number < 0 && ( NumeIterMax == -1 ) ) ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The directory of the iteration does not exist."; + throw SALOME::SALOME_Exception(es); + return 0; + }; + + return DirNameStartIter ; +} +//============================================================================= +HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCase0(const char* nomCas, const char* MeshName, const char* MeshFile, CORBA::Long MeshOption, CORBA::Long NumeIter, CORBA::Long Option) +// +// nomCas : nom du cas a creer +// MeshName, MeshFile : nom et fichier du maillage correspondant +// MeshOption : 0 : le maillage fourni est obligatoirement present ==> erreur si absent +// 1 : le maillage fourni peut ne pas exister ==> on continue si absent +// -1 : le maillage n'est pas fourni +// NumeIter : numero de l'iteration correspondante : 0, pour un depart, n>0 pour une poursuite +// Option : multiple de nombres premiers +// 1 : aucune option +// x2 : publication du maillage dans SMESH +{ + MESSAGE ( "CreateCase0 : nomCas = " << nomCas ); + MESSAGE ( "CreateCase0 : MeshName = " << MeshName << ", MeshFile = " << MeshFile << ", MeshOption = " << MeshOption ); + MESSAGE ( "CreateCase0 : NumeIter = " << NumeIter << ", Option = " << Option ); +// + // A. Controles + // A.1. L'etude + IsValidStudy () ; + + // A.2. Controle du nom : + if ((myStudyContext._mesCas).find(nomCas)!=(myStudyContext._mesCas).end()) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This case has already been defined."; + throw SALOME::SALOME_Exception(es); + return 0; + }; + + // A.3. Controle du fichier du maillage + int existeMeshFile ; + if ( MeshOption >= 0 ) + { + existeMeshFile = MEDFileExist ( MeshFile ) ; + MESSAGE ( "CreateCase0 : existeMeshFile = " << existeMeshFile ); + if ( ( existeMeshFile == 0 ) && ( MeshOption == 0 ) ) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The mesh file does not exist."; + throw SALOME::SALOME_Exception(es); + return 0; + } + } + else { existeMeshFile = 0 ; } + + // B. Creation de l'objet cas et publication +// MESSAGE ( "CreateCase0 : Creation de l'objet" ); + HOMARD::HOMARD_Cas_var myCase = newCase(); + myCase->SetName(nomCas); + SALOMEDS::SObject_var aSO; + SALOMEDS::SObject_var aResultSO=PublishInStudy(aSO, myCase, nomCas); + myStudyContext._mesCas[nomCas] = myCase; + + // C. Caracteristiques du maillage + if ( existeMeshFile != 0 ) + { + // Les valeurs extremes des coordonnées +// MESSAGE ( "CreateCase0 : Les valeurs extremes des coordonnées" ); + std::vector LesExtremes =GetBoundingBoxInMedFile(MeshFile) ; + HOMARD::extrema_var aSeq = new HOMARD::extrema() ; + if (LesExtremes.size()!=10) { return 0; } + aSeq->length(10) ; + for (int i =0 ; i< LesExtremes.size() ; i++) + aSeq[i]=LesExtremes[i] ; + myCase->SetBoundingBox(aSeq) ; + // Les groupes +// MESSAGE ( "CreateCase0 : Les groupes" ); + std::set LesGroupes =GetListeGroupesInMedFile(MeshFile) ; + HOMARD::ListGroupType_var aSeqGroupe = new HOMARD::ListGroupType ; + aSeqGroupe->length(LesGroupes.size()); + std::set::const_iterator it ; + int i = 0 ; + for (it=LesGroupes.begin() ; it != LesGroupes.end() ; it++) + aSeqGroupe[i++]=(*it).c_str() ; + myCase->SetGroups(aSeqGroupe) ; + } + + // D. L'iteration initiale du cas + MESSAGE ( "CreateCase0 : iteration initiale du cas" ); + // D.1. Recherche d'un nom : par defaut, on prend le nom du maillage correspondant. + // Si ce nom d'iteration existe deja, on incremente avec 0, 1, 2, etc. + int monNum = 0; + std::string NomIteration = std::string(MeshName) ; + while ( (myStudyContext._mesIterations).find(NomIteration) != (myStudyContext._mesIterations.end()) ) + { + std::ostringstream nom; + nom << MeshName << monNum; + NomIteration = nom.str(); + monNum += 1; + } + MESSAGE ( "CreateCas0 : ==> NomIteration = " << NomIteration ); + + // D.2. Creation de l'iteration + HOMARD::HOMARD_Iteration_var anIter = newIteration(); + myStudyContext._mesIterations[NomIteration] = anIter; + anIter->SetName(NomIteration.c_str()); + AssociateCaseIter (nomCas, NomIteration.c_str(), "IterationHomard"); + + // D.4. Maillage correspondant + if ( existeMeshFile != 0 ) + { + anIter->SetMeshFile(MeshFile); + if ( Option % 2 == 0 ) { PublishResultInSmesh(MeshFile, 0); } + } + anIter->SetMeshName(MeshName); + + // D.5. Numero d'iteration + anIter->SetNumber(NumeIter); + + // D.6. Etat + SetEtatIter(NomIteration.c_str(), -NumeIter); +// + + return HOMARD::HOMARD_Cas::_duplicate(myCase); +} +//============================================================================= +HOMARD::HOMARD_Hypothesis_ptr HOMARD_Gen_i::CreateHypothesis(const char* nomHypothesis) +{ + INFOS ( "CreateHypothesis : nomHypothesis = " << nomHypothesis ); + IsValidStudy () ; + + // A. Controle du nom : + if ((myStudyContext._mesHypotheses).find(nomHypothesis) != (myStudyContext._mesHypotheses).end()) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This hypothesis has already been defined."; + throw SALOME::SALOME_Exception(es); + return 0; + } + + // B. Creation de l'objet + HOMARD::HOMARD_Hypothesis_var myHypothesis = newHypothesis(); + if (CORBA::is_nil(myHypothesis)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Unable to create the hypothesis"; + throw SALOME::SALOME_Exception(es); + return 0; + }; + myHypothesis->SetName(nomHypothesis); + + // C. Enregistrement + myStudyContext._mesHypotheses[nomHypothesis] = myHypothesis; + + SALOMEDS::SObject_var aSO; + SALOMEDS::SObject_var aResultSO=PublishInStudy(aSO, myHypothesis, nomHypothesis); + + // D. Valeurs par defaut des options avancees + myHypothesis->SetNivMax(-1); + myHypothesis->SetDiamMin(-1.0); + myHypothesis->SetAdapInit(0); + myHypothesis->SetExtraOutput(1); + + return HOMARD::HOMARD_Hypothesis::_duplicate(myHypothesis); +} + +//============================================================================= +HOMARD::HOMARD_Iteration_ptr HOMARD_Gen_i::CreateIteration(const char* NomIteration, const char* nomIterParent) +//============================================================================= +{ + INFOS ("CreateIteration : NomIteration = " << NomIteration << ", nomIterParent = " << nomIterParent); + IsValidStudy () ; + + HOMARD::HOMARD_Iteration_var myIterationParent = myStudyContext._mesIterations[nomIterParent]; + if (CORBA::is_nil(myIterationParent)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The parent iteration is not defined."; + throw SALOME::SALOME_Exception(es); + return 0; + }; + + const char* nomCas = myIterationParent->GetCaseName(); + MESSAGE ("CreateIteration : nomCas = " << nomCas); + HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; + if (CORBA::is_nil(myCase)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid case context"; + throw SALOME::SALOME_Exception(es); + return 0; + }; + const char* nomDirCase = myCase->GetDirName(); + + // Controle du nom : + if ((myStudyContext._mesIterations).find(NomIteration)!=(myStudyContext._mesIterations).end()) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This iteration has already been defined."; + throw SALOME::SALOME_Exception(es); + return 0; + }; + + HOMARD::HOMARD_Iteration_var myIteration = newIteration(); + if (CORBA::is_nil(myIteration)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Unable to create the iteration"; + throw SALOME::SALOME_Exception(es); + return 0; + }; + myStudyContext._mesIterations[std::string(NomIteration)] = myIteration; +// Nom de l'iteration et du maillage + myIteration->SetName(NomIteration); + myIteration->SetMeshName(NomIteration); + myIteration->SetState(1); + + int numero = myIterationParent->GetNumber() + 1; + myIteration->SetNumber(numero); + +// Nombre d'iterations deja connues pour le cas, permettant +// la creation d'un sous-répertoire unique + int nbitercase = myCase->GetNumberofIter(); + char* nomDirIter = CreateDirNameIter(nomDirCase, nbitercase ); + myIteration->SetDirNameLoc(nomDirIter); + +// Le nom du fichier du maillage MED est indice par le nombre d'iterations du cas. +// Si on a une chaine unique depuis le depart, ce nombre est le meme que le +// numero d'iteration dans la sucession : maill.01.med, maill.02.med, etc... C'est la +// situation la plus frequente. +// Si on a plusieurs branches, donc des iterations du meme niveau d'adaptation, utiliser +// le nombre d'iterations du cas permet d'eviter les collisions. + int jaux ; + if ( nbitercase < 100 ) { jaux = 2 ; } + else if ( nbitercase < 1000 ) { jaux = 3 ; } + else if ( nbitercase < 10000 ) { jaux = 4 ; } + else if ( nbitercase < 100000 ) { jaux = 5 ; } + else { jaux = 9 ; } + std::ostringstream iaux ; + iaux << std::setw(jaux) << std::setfill('0') << nbitercase ; + std::stringstream MeshFile; + MeshFile << nomDirCase << "/maill." << iaux.str() << ".med"; + myIteration->SetMeshFile(MeshFile.str().c_str()); + +// Association avec le cas + std::string label = "IterationHomard_" + std::string(nomIterParent); + AssociateCaseIter(nomCas, NomIteration, label.c_str()); +// Lien avec l'iteration precedente + myIterationParent->LinkNextIteration(NomIteration); + myIteration->SetIterParentName(nomIterParent); + // Gestion de l'arbre d'etudes + SALOMEDS::SObject_var aIterSOParent = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIterationParent))); + SALOMEDS::SObject_var aIterSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIteration))); + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + aStudyBuilder->NewCommand(); + SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aIterSO); + aStudyBuilder->Addreference(aSubSO, aIterSOParent); + aStudyBuilder->CommitCommand(); + + return HOMARD::HOMARD_Iteration::_duplicate(myIteration); +} +//============================================================================= +HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundary(const char* BoundaryName, CORBA::Long BoundaryType) +{ + MESSAGE ("CreateBoundary : BoundaryName = " << BoundaryName << ", BoundaryType = " << BoundaryType); + IsValidStudy () ; + + // Controle du nom : + if ((myStudyContext._mesBoundarys).find(BoundaryName)!=(myStudyContext._mesBoundarys).end()) + { + MESSAGE ("CreateBoundary : la frontiere " << BoundaryName << " existe deja"); + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This boundary has already been defined"; + throw SALOME::SALOME_Exception(es); + return 0; + }; + + HOMARD::HOMARD_Boundary_var myBoundary = newBoundary(); + myBoundary->SetName(BoundaryName); + myBoundary->SetType(BoundaryType); + + myStudyContext._mesBoundarys[BoundaryName] = myBoundary; + + SALOMEDS::SObject_var aSO; + SALOMEDS::SObject_var aResultSO=PublishInStudy(aSO, myBoundary, BoundaryName); + + return HOMARD::HOMARD_Boundary::_duplicate(myBoundary); +} +//============================================================================= +HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryCAO(const char* BoundaryName, const char* CAOFile) +{ + INFOS ("CreateBoundaryCAO : BoundaryName = " << BoundaryName << ", CAOFile = " << CAOFile ); + HOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, -1); + myBoundary->SetDataFile( CAOFile ) ; + + return HOMARD::HOMARD_Boundary::_duplicate(myBoundary); +} +//============================================================================= +HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryDi(const char* BoundaryName, const char* MeshName, const char* MeshFile) +{ + INFOS ("CreateBoundaryDi : BoundaryName = " << BoundaryName << ", MeshName = " << MeshName << ", MeshFile = " << MeshFile ); + HOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 0); + myBoundary->SetDataFile( MeshFile ) ; + myBoundary->SetMeshName( MeshName ) ; + + return HOMARD::HOMARD_Boundary::_duplicate(myBoundary); +} +//============================================================================= +HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryCylinder(const char* BoundaryName, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, + CORBA::Double Rayon) +{ + INFOS ("CreateBoundaryCylinder : BoundaryName = " << BoundaryName ) ; +// + SALOME::ExceptionStruct es; + int error = 0 ; + if ( Rayon <= 0.0 ) + { es.text = "The radius must be positive." ; + error = 1 ; } + double daux = fabs(Xaxe) + fabs(Yaxe) + fabs(Zaxe) ; + if ( daux < 0.0000001 ) + { es.text = "The axis must be a non 0 vector." ; + error = 2 ; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + HOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 1) ; + myBoundary->SetCylinder( Xcentre, Ycentre, Zcentre, Xaxe, Yaxe, Zaxe, Rayon ) ; + + return HOMARD::HOMARD_Boundary::_duplicate(myBoundary) ; +} +//============================================================================= +HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundarySphere(const char* BoundaryName, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Rayon) +{ + INFOS ("CreateBoundarySphere : BoundaryName = " << BoundaryName ) ; +// + SALOME::ExceptionStruct es; + int error = 0 ; + if ( Rayon <= 0.0 ) + { es.text = "The radius must be positive." ; + error = 1 ; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + HOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 2) ; + myBoundary->SetSphere( Xcentre, Ycentre, Zcentre, Rayon ) ; + + return HOMARD::HOMARD_Boundary::_duplicate(myBoundary) ; +} +//============================================================================= +HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryConeA(const char* BoundaryName, + CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, CORBA::Double Angle, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre) +{ + INFOS ("CreateBoundaryConeA : BoundaryName = " << BoundaryName ) ; +// + SALOME::ExceptionStruct es; + int error = 0 ; + if ( Angle <= 0.0 || Angle >= 90.0 ) + { es.text = "The angle must be included higher than 0 degree and lower than 90 degrees." ; + error = 1 ; } + double daux = fabs(Xaxe) + fabs(Yaxe) + fabs(Zaxe) ; + if ( daux < 0.0000001 ) + { es.text = "The axis must be a non 0 vector." ; + error = 2 ; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + HOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 3) ; + myBoundary->SetConeA( Xaxe, Yaxe, Zaxe, Angle, Xcentre, Ycentre, Zcentre ) ; + + return HOMARD::HOMARD_Boundary::_duplicate(myBoundary) ; +} +//============================================================================= +HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryConeR(const char* BoundaryName, + CORBA::Double Xcentre1, CORBA::Double Ycentre1, CORBA::Double Zcentre1, CORBA::Double Rayon1, + CORBA::Double Xcentre2, CORBA::Double Ycentre2, CORBA::Double Zcentre2, CORBA::Double Rayon2) +{ + INFOS ("CreateBoundaryConeR : BoundaryName = " << BoundaryName ) ; +// + SALOME::ExceptionStruct es; + int error = 0 ; + if ( Rayon1 < 0.0 || Rayon2 < 0.0 ) + { es.text = "The radius must be positive." ; + error = 1 ; } + double daux = fabs(Rayon2-Rayon1) ; + if ( daux < 0.0000001 ) + { es.text = "The radius must be different." ; + error = 2 ; } + daux = fabs(Xcentre2-Xcentre1) + fabs(Ycentre2-Ycentre1) + fabs(Zcentre2-Zcentre1) ; + if ( daux < 0.0000001 ) + { es.text = "The centers must be different." ; + error = 3 ; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + HOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 4) ; + myBoundary->SetConeR( Xcentre1, Ycentre1, Zcentre1, Rayon1, Xcentre2, Ycentre2, Zcentre2, Rayon2 ) ; + + return HOMARD::HOMARD_Boundary::_duplicate(myBoundary) ; +} +//============================================================================= +HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryTorus(const char* BoundaryName, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, + CORBA::Double RayonRev, CORBA::Double RayonPri) +{ + INFOS ("CreateBoundaryTorus : BoundaryName = " << BoundaryName ) ; +// + SALOME::ExceptionStruct es; + int error = 0 ; + if ( ( RayonRev <= 0.0 ) || ( RayonPri <= 0.0 ) ) + { es.text = "The radius must be positive." ; + error = 1 ; } + double daux = fabs(Xaxe) + fabs(Yaxe) + fabs(Zaxe) ; + if ( daux < 0.0000001 ) + { es.text = "The axis must be a non 0 vector." ; + error = 2 ; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + HOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 5) ; + myBoundary->SetTorus( Xcentre, Ycentre, Zcentre, Xaxe, Yaxe, Zaxe, RayonRev, RayonPri ) ; + + return HOMARD::HOMARD_Boundary::_duplicate(myBoundary) ; +} +//============================================================================= +HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZone(const char* ZoneName, CORBA::Long ZoneType) +{ + MESSAGE ("CreateZone : ZoneName = " << ZoneName << ", ZoneType = " << ZoneType); + IsValidStudy () ; + + // Controle du nom : + if ((myStudyContext._mesZones).find(ZoneName)!=(myStudyContext._mesZones).end()) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This zone has already been defined"; + throw SALOME::SALOME_Exception(es); + return 0; + }; + + HOMARD::HOMARD_Zone_var myZone = newZone(); + myZone->SetName(ZoneName); + myZone->SetType(ZoneType); + + myStudyContext._mesZones[ZoneName] = myZone; + + SALOMEDS::SObject_var aSO; + SALOMEDS::SObject_var aResultSO=PublishInStudy(aSO, myZone, ZoneName); + + return HOMARD::HOMARD_Zone::_duplicate(myZone); +} +//============================================================================= +HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZoneBox(const char* ZoneName, + CORBA::Double Xmini, CORBA::Double Xmaxi, + CORBA::Double Ymini, CORBA::Double Ymaxi, + CORBA::Double Zmini, CORBA::Double Zmaxi) +{ + INFOS ("CreateZoneBox : ZoneName = " << ZoneName ) ; +// + SALOME::ExceptionStruct es; + int error = 0 ; + if ( Xmini > Xmaxi ) + { es.text = "The X coordinates are not coherent." ; + error = 1 ; } + if ( Ymini > Ymaxi ) + { es.text = "The Y coordinates are not coherent." ; + error = 2 ; } + if ( Zmini > Zmaxi ) + { es.text = "The Z coordinates are not coherent." ; + error = 3 ; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + HOMARD::HOMARD_Zone_var myZone = CreateZone(ZoneName, 2) ; + myZone->SetBox ( Xmini, Xmaxi, Ymini, Ymaxi, Zmini, Zmaxi) ; + + return HOMARD::HOMARD_Zone::_duplicate(myZone) ; +} +//============================================================================= +HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZoneSphere(const char* ZoneName, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, CORBA::Double Rayon) +{ + INFOS ("CreateZoneSphere : ZoneName = " << ZoneName ) ; +// + SALOME::ExceptionStruct es; + int error = 0 ; + if ( Rayon <= 0.0 ) + { es.text = "The radius must be positive." ; + error = 1 ; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + HOMARD::HOMARD_Zone_var myZone = CreateZone(ZoneName, 4) ; + myZone->SetSphere( Xcentre, Ycentre, Zcentre, Rayon ) ; + + return HOMARD::HOMARD_Zone::_duplicate(myZone) ; +} +//============================================================================= +HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZoneCylinder(const char* ZoneName, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, + CORBA::Double Rayon, CORBA::Double Haut) +{ + INFOS ("CreateZoneCylinder : ZoneName = " << ZoneName ) ; +// + SALOME::ExceptionStruct es; + int error = 0 ; + if ( Rayon <= 0.0 ) + { es.text = "The radius must be positive." ; + error = 1 ; } + double daux = fabs(Xaxe) + fabs(Yaxe) + fabs(Zaxe) ; + if ( daux < 0.0000001 ) + { es.text = "The axis must be a non 0 vector." ; + error = 2 ; } + if ( Haut <= 0.0 ) + { es.text = "The height must be positive." ; + error = 3 ; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + HOMARD::HOMARD_Zone_var myZone = CreateZone(ZoneName, 5) ; + myZone->SetCylinder( Xcentre, Ycentre, Zcentre, Xaxe, Yaxe, Zaxe, Rayon, Haut ) ; + + return HOMARD::HOMARD_Zone::_duplicate(myZone) ; +} +//============================================================================= +HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZonePipe(const char* ZoneName, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, + CORBA::Double Rayon, CORBA::Double Haut, CORBA::Double Rayonint) +{ + INFOS ("CreateZonePipe : ZoneName = " << ZoneName ) ; +// + SALOME::ExceptionStruct es; + int error = 0 ; + if ( Rayon <= 0.0 || Rayonint <= 0.0 ) + { es.text = "The radius must be positive." ; + error = 1 ; } + double daux = fabs(Xaxe) + fabs(Yaxe) + fabs(Zaxe) ; + if ( daux < 0.0000001 ) + { es.text = "The axis must be a non 0 vector." ; + error = 2 ; } + if ( Haut <= 0.0 ) + { es.text = "The height must be positive." ; + error = 3 ; } + if ( Rayon <= Rayonint ) + { es.text = "The external radius must be higher than the internal radius." ; + error = 4 ; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + HOMARD::HOMARD_Zone_var myZone = CreateZone(ZoneName, 7) ; + myZone->SetPipe( Xcentre, Ycentre, Zcentre, Xaxe, Yaxe, Zaxe, Rayon, Haut, Rayonint ) ; + + return HOMARD::HOMARD_Zone::_duplicate(myZone) ; +} +//============================================================================= +HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZoneBox2D(const char* ZoneName, + CORBA::Double Umini, CORBA::Double Umaxi, + CORBA::Double Vmini, CORBA::Double Vmaxi, + CORBA::Long Orient) +{ + INFOS ("CreateZoneBox2D : ZoneName = " << ZoneName ) ; +// MESSAGE ("Umini = " << Umini << ", Umaxi =" << Umaxi ) ; +// MESSAGE ("Vmini = " << Vmini << ", Vmaxi =" << Vmaxi ) ; +// MESSAGE ("Orient = " << Orient ) ; +// + SALOME::ExceptionStruct es; + int error = 0 ; + if ( Umini > Umaxi ) + { es.text = "The first coordinates are not coherent." ; + error = 1 ; } + if ( Vmini > Vmaxi ) + { es.text = "The second coordinates are not coherent." ; + error = 2 ; } + if ( Orient < 1 || Orient > 3 ) + { es.text = "The orientation must be 1, 2 or 3." ; + error = 3 ; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + double Xmini, Xmaxi ; + double Ymini, Ymaxi ; + double Zmini, Zmaxi ; + if ( Orient == 1 ) + { Xmini = Umini ; + Xmaxi = Umaxi ; + Ymini = Vmini ; + Ymaxi = Vmaxi ; + Zmini = 0. ; + Zmaxi = 0. ; } + else if ( Orient == 2 ) + { Xmini = 0. ; + Xmaxi = 0. ; + Ymini = Umini ; + Ymaxi = Umaxi ; + Zmini = Vmini ; + Zmaxi = Vmaxi ; } + else if ( Orient == 3 ) + { Xmini = Vmini ; + Xmaxi = Vmaxi ; + Ymini = 0. ; + Ymaxi = 0. ; + Zmini = Umini ; + Zmaxi = Umaxi ; } + else { VERIFICATION( (Orient>=1) && (Orient<=3) ) ; } + + HOMARD::HOMARD_Zone_var myZone = CreateZone(ZoneName, 10+Orient) ; + myZone->SetBox ( Xmini, Xmaxi, Ymini, Ymaxi, Zmini, Zmaxi) ; + + return HOMARD::HOMARD_Zone::_duplicate(myZone) ; +} +//============================================================================= +HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZoneDisk(const char* ZoneName, + CORBA::Double Ucentre, CORBA::Double Vcentre, + CORBA::Double Rayon, + CORBA::Long Orient) +{ + INFOS ("CreateZoneDisk : ZoneName = " << ZoneName ) ; +// + SALOME::ExceptionStruct es; + int error = 0 ; + if ( Rayon <= 0.0 ) + { es.text = "The radius must be positive." ; + error = 1 ; } + if ( Orient < 1 || Orient > 3 ) + { es.text = "The orientation must be 1, 2 or 3." ; + error = 3 ; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + double Xcentre ; + double Ycentre ; + double Zcentre ; + if ( Orient == 1 ) + { Xcentre = Ucentre ; + Ycentre = Vcentre ; + Zcentre = 0. ; } + else if ( Orient == 2 ) + { Xcentre = 0. ; + Ycentre = Ucentre ; + Zcentre = Vcentre ; } + else if ( Orient == 3 ) + { Xcentre = Vcentre ; + Ycentre = 0. ; + Zcentre = Ucentre ; } + else { VERIFICATION( (Orient>=1) && (Orient<=3) ) ; } + + HOMARD::HOMARD_Zone_var myZone = CreateZone(ZoneName, 30+Orient) ; + myZone->SetCylinder( Xcentre, Ycentre, Zcentre, 0., 0., 1., Rayon, 1. ) ; + + return HOMARD::HOMARD_Zone::_duplicate(myZone) ; +} +//============================================================================= +HOMARD::HOMARD_Zone_ptr HOMARD_Gen_i::CreateZoneDiskWithHole(const char* ZoneName, + CORBA::Double Ucentre, CORBA::Double Vcentre, + CORBA::Double Rayon, CORBA::Double Rayonint, + CORBA::Long Orient) +{ + INFOS ("CreateZoneDiskWithHole : ZoneName = " << ZoneName ) ; +// + SALOME::ExceptionStruct es; + int error = 0 ; + if ( Rayon <= 0.0 || Rayonint <= 0.0 ) + { es.text = "The radius must be positive." ; + error = 1 ; } + if ( Orient < 1 || Orient > 3 ) + { es.text = "The orientation must be 1, 2 or 3." ; + error = 3 ; } + if ( Rayon <= Rayonint ) + { es.text = "The external radius must be higher than the internal radius." ; + error = 4 ; } + if ( error != 0 ) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + double Xcentre ; + double Ycentre ; + double Zcentre ; + if ( Orient == 1 ) + { Xcentre = Ucentre ; + Ycentre = Vcentre ; + Zcentre = 0. ; } + else if ( Orient == 2 ) + { Xcentre = 0. ; + Ycentre = Ucentre ; + Zcentre = Vcentre ; } + else if ( Orient == 3 ) + { Xcentre = Vcentre ; + Ycentre = 0. ; + Zcentre = Ucentre ; } + else { VERIFICATION( (Orient>=1) && (Orient<=3) ) ; } + + HOMARD::HOMARD_Zone_var myZone = CreateZone(ZoneName, 60+Orient) ; + myZone->SetPipe( Xcentre, Ycentre, Zcentre, 0., 0., 1., Rayon, 1., Rayonint ) ; + + return HOMARD::HOMARD_Zone::_duplicate(myZone) ; +} +//============================================================================= +//============================================================================= + + + + +//============================================================================= +//============================================================================= +// Traitement d'une iteration +// etatMenage = 1 : destruction du répertoire d'execution +// modeHOMARD = 1 : adaptation +// != 1 : information avec les options modeHOMARD +// Option1 >0 : appel depuis python +// <0 : appel depuis GUI +// Option2 : multiple de nombres premiers +// 1 : aucune option +// x2 : publication du maillage dans SMESH +//============================================================================= +CORBA::Long HOMARD_Gen_i::Compute(const char* NomIteration, CORBA::Long etatMenage, CORBA::Long modeHOMARD, CORBA::Long Option1, CORBA::Long Option2) +{ + INFOS ( "Compute : traitement de " << NomIteration << ", avec modeHOMARD = " << modeHOMARD << ", Option1 = " << Option1 << ", Option2 = " << Option2 ); + + // A. Prealable + int codret = 0; + + // A.1. L'objet iteration + HOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[NomIteration]; + ASSERT(!CORBA::is_nil(myIteration)); + + // A.2. Controle de la possibilite d'agir + // A.2.1. Etat de l'iteration + int etat = myIteration->GetState(); + MESSAGE ( "etat = "<GetNumber(); + std::string siterp1 ; + std::stringstream saux1 ; + saux1 << NumeIter ; + siterp1 = saux1.str() ; + if (NumeIter < 10) { siterp1 = "0" + siterp1 ; } + + std::string siter ; + if ( modeHOMARD==1 ) + { + std::stringstream saux0 ; + int iaux = max(0, NumeIter-1) ; + saux0 << iaux ; + siter = saux0.str() ; + if (NumeIter < 11) { siter = "0" + siter ; } + } + else + { siter = siterp1 ; } + + // A.4. Le cas + const char* nomCas = myIteration->GetCaseName(); + HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; + ASSERT(!CORBA::is_nil(myCase)); + + // B. Les répertoires + // B.1. Le répertoire courant + std::string nomDirWork = getenv("PWD") ; + // B.2. Le sous-répertoire de l'iteration a traiter + char* DirCompute = ComputeDirManagement(myCase, myIteration, etatMenage); + MESSAGE( ". DirCompute = " << DirCompute ); + + // C. Le fichier des messages + // C.1. Le deroulement de l'execution de HOMARD + std::string LogFile = DirCompute ; + LogFile += "/Liste" ; + if ( modeHOMARD == 1 ) { LogFile += "." + siter + ".vers." + siterp1 ; } + LogFile += ".log" ; + MESSAGE (". LogFile = " << LogFile); + if ( modeHOMARD == 1 ) { myIteration->SetLogFile(LogFile.c_str()); } + // C.2. Le bilan de l'analyse du maillage + std::string FileInfo = DirCompute ; + FileInfo += "/" ; + if ( modeHOMARD == 1 ) { FileInfo += "apad" ; } + else + { if ( NumeIter == 0 ) { FileInfo += "info_av" ; } + else { FileInfo += "info_ap" ; } + } + FileInfo += "." + siterp1 + ".bilan" ; + myIteration->SetFileInfo(FileInfo.c_str()); + + // D. On passe dans le répertoire de l'iteration a calculer + MESSAGE ( ". On passe dans DirCompute = " << DirCompute ); + CHDIR(DirCompute); + + // E. Les données de l'exécution HOMARD + // E.1. L'objet du texte du fichier de configuration + HomardDriver* myDriver = new HomardDriver(siter, siterp1); + myDriver->TexteInit(DirCompute, LogFile, _Langue); + + // E.2. Le maillage associe a l'iteration + const char* NomMesh = myIteration->GetMeshName(); + MESSAGE ( ". NomMesh = " << NomMesh ); + const char* MeshFile = myIteration->GetMeshFile(); + MESSAGE ( ". MeshFile = " << MeshFile ); + + // E.3. Les données du traitement HOMARD + int iaux ; + if ( modeHOMARD == 1 ) + { + iaux = 1 ; + myDriver->TexteMaillageHOMARD( DirCompute, siterp1, iaux ) ; + myDriver->TexteMaillage(NomMesh, MeshFile, 1); + codret = ComputeAdap(myCase, myIteration, etatMenage, myDriver, Option1, Option2) ; + } + else + { + InvalideIterInfo(NomIteration); + myDriver->TexteInfo( modeHOMARD, NumeIter ) ; + iaux = 0 ; + myDriver->TexteMaillageHOMARD( DirCompute, siterp1, iaux ) ; + myDriver->TexteMaillage(NomMesh, MeshFile, 0); + myDriver->CreeFichierDonn(); + } + + // E.4. Ajout des informations liees a l'eventuel suivi de frontiere + int BoundaryOption = DriverTexteBoundary(myCase, myDriver) ; + + // E.5. Ecriture du texte dans le fichier + MESSAGE ( ". Ecriture du texte dans le fichier de configuration ; codret = "<CreeFichier(); } + +// G. Execution +// + int codretexec = 1789 ; + if (codret == 0) + { + codretexec = myDriver->ExecuteHomard(Option1); +// + MESSAGE ( "Erreur en executant HOMARD : " << codretexec ); + // En mode adaptation, on ajuste l'etat de l'iteration + if ( modeHOMARD == 1 ) + { + if (codretexec == 0) { SetEtatIter(NomIteration,2); } + else { SetEtatIter(NomIteration,1); } + // GERALD -- QMESSAGE BOX + } + } + + // H. Gestion des resultats + if (codret == 0) + { + std::string Commentaire ; + // H.1. Le fichier des messages, dans tous les cas + Commentaire = "log" ; + if ( modeHOMARD == 1 ) { Commentaire += " " + siterp1 ; } + else { Commentaire += "Info" ; } + PublishFileUnderIteration(NomIteration, LogFile.c_str(), Commentaire.c_str()); + + // H.2. Si tout s'est bien passe : + if (codretexec == 0) + { + // H.2.1. Le fichier de bilan + Commentaire = "Summary" ; + if ( modeHOMARD == 1 ) { Commentaire += " " + siterp1 ; } + else { Commentaire += "Info" ; } + PublishFileUnderIteration(NomIteration, FileInfo.c_str(), Commentaire.c_str()); + // H.2.2. Le fichier de maillage obtenu + if ( modeHOMARD == 1 ) + { + std::stringstream saux0 ; + Commentaire = "Mesh" ; + Commentaire += " " + siterp1 ; + PublishFileUnderIteration(NomIteration, MeshFile, Commentaire.c_str()); + if ( Option2 % 2 == 0 ) { PublishResultInSmesh(MeshFile, 1); } + } + } + // H.3 Message d'erreur + if (codretexec != 0) + { + std::string text = "" ; + // Message d'erreur en cas de probleme en adaptation + if ( modeHOMARD == 1 ) + { + text = "Error during the adaptation.\n" ; + bool stopvu = false ; + std::ifstream fichier( LogFile.c_str() ); + if ( fichier ) // ce test échoue si le fichier n'est pas ouvert + { + std::string ligne; // variable contenant chaque ligne lue + while ( std::getline( fichier, ligne ) ) + { +// INFOS(ligne); + if ( stopvu ) + { text += ligne+ "\n"; } + else + { + int position = ligne.find( "===== HOMARD ===== STOP =====" ) ; + if ( position > 0 ) { stopvu = true ; } + } + } + } + } + text += "\n\nSee the file " + LogFile + "\n" ; + INFOS ( text ) ; + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); +// + // En mode information, on force le succes pour pouvoir consulter le fichier log + if ( modeHOMARD != 1 ) { codretexec = 0 ; } + } + } + + // I. Menage et retour dans le répertoire du cas + if (codret == 0) + { + delete myDriver; + MESSAGE ( ". On retourne dans nomDirWork = " << nomDirWork ); + + CHDIR(nomDirWork.c_str()); + } + + // J. Suivi de la frontière CAO +// std::cout << "- codret : " << codret << std::endl; +// std::cout << "- modeHOMARD : " << modeHOMARD << std::endl; +// std::cout << "- BoundaryOption : " << BoundaryOption << std::endl; +// std::cout << "- codretexec : " << codretexec << std::endl; + if (codret == 0) + { + if ( ( modeHOMARD == 1 ) && ( BoundaryOption % 5 == 0 ) && (codretexec == 0) ) + { + INFOS ( "Suivi de frontière CAO" ); + codret = ComputeCAO(myCase, myIteration, Option1, Option2) ; + } + } + + return codretexec ; +} +//============================================================================= +// Calcul d'une iteration : partie spécifique à l'adaptation +//============================================================================= +CORBA::Long HOMARD_Gen_i::ComputeAdap(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage, HomardDriver* myDriver, CORBA::Long Option1, CORBA::Long Option2) +{ + MESSAGE ( "ComputeAdap avec Option1 = " << Option1 << ", Option2 = " << Option2 ); + + // A. Prealable + // A.1. Bases + int codret = 0; + // Numero de l'iteration + int NumeIter = myIteration->GetNumber(); + std::stringstream saux0 ; + saux0 << NumeIter-1 ; + std::string siter = saux0.str() ; + if (NumeIter < 11) { siter = "0" + siter ; } + + // A.2. On verifie qu il y a une hypothese (erreur improbable); + const char* nomHypo = myIteration->GetHypoName(); + if (std::string(nomHypo) == std::string("")) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This iteration does not have any associated hypothesis."; + throw SALOME::SALOME_Exception(es); + return 2; + }; + HOMARD::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypo]; + ASSERT(!CORBA::is_nil(myHypo)); + + // B. L'iteration parent + const char* nomIterationParent = myIteration->GetIterParentName(); + HOMARD::HOMARD_Iteration_var myIterationParent = myStudyContext._mesIterations[nomIterationParent]; + ASSERT(!CORBA::is_nil(myIterationParent)); + // Si l'iteration parent n'est pas calculee, on le fait (recursivite amont) + if ( myIterationParent->GetState() == 1 ) + { + int iaux = 1 ; + int codret = Compute(nomIterationParent, etatMenage, iaux, Option1, Option2); + if (codret != 0) + { + // GERALD -- QMESSAGE BOX + VERIFICATION("Pb au calcul de l'iteration precedente" == 0); + } + }; + + // C. Le sous-répertoire de l'iteration precedente + char* DirComputePa = ComputeDirPaManagement(myCase, myIteration); + MESSAGE( ". DirComputePa = " << DirComputePa ); + + // D. Les données de l'adaptation HOMARD + // D.1. Le type de conformite + int ConfType = myCase->GetConfType(); + MESSAGE ( ". ConfType = " << ConfType ); + + // D.1. Le type externe + int ExtType = myCase->GetExtType(); + MESSAGE ( ". ExtType = " << ExtType ); + + // D.3. Le maillage de depart + const char* NomMeshParent = myIterationParent->GetMeshName(); + MESSAGE ( ". NomMeshParent = " << NomMeshParent ); + const char* MeshFileParent = myIterationParent->GetMeshFile(); + MESSAGE ( ". MeshFileParent = " << MeshFileParent ); + + // D.4. Le maillage associe a l'iteration + const char* MeshFile = myIteration->GetMeshFile(); + MESSAGE ( ". MeshFile = " << MeshFile ); + FILE *file = fopen(MeshFile,"r"); + if (file != NULL) + { + fclose(file); + if (etatMenage == 0) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "MeshFile : " + std::string(MeshFile) + " already exists "; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + return 4; + } + else + { + std::string commande = "rm -f " + std::string(MeshFile); + codret = system(commande.c_str()); + if (codret != 0) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The mesh file cannot be deleted."; + throw SALOME::SALOME_Exception(es); + return 5; + } + } + } + + // D.5. Les types de raffinement et de deraffinement + // Les appels corba sont lourds, il vaut mieux les grouper + HOMARD::listeTypes* ListTypes = myHypo->GetAdapRefinUnRef(); + ASSERT(ListTypes->length() == 3); + int TypeAdap = (*ListTypes)[0]; + int TypeRaff = (*ListTypes)[1]; + int TypeDera = (*ListTypes)[2]; +// MESSAGE ( ". TypeAdap = " << TypeAdap << ", TypeRaff = " << TypeRaff << ", TypeDera = " << TypeDera ); + + // E. Texte du fichier de configuration + // E.1. Incontournables du texte + myDriver->TexteAdap(ExtType); + int iaux = 0 ; + myDriver->TexteMaillageHOMARD( DirComputePa, siter, iaux ) ; + myDriver->TexteMaillage(NomMeshParent, MeshFileParent, 0); + myDriver->TexteConfRaffDera(ConfType, TypeAdap, TypeRaff, TypeDera); + + // E.2. Ajout des informations liees aux zones eventuelles + if ( TypeAdap == 0 ) + { DriverTexteZone(myHypo, myDriver) ; } + + // E.3. Ajout des informations liees aux champs eventuels + if ( TypeAdap == 1 ) + { DriverTexteField(myIteration, myHypo, myDriver) ; } + + // E.4. Ajout des informations liees au filtrage eventuel par les groupes + HOMARD::ListGroupType* listeGroupes = myHypo->GetGroups(); + int numberOfGroups = listeGroupes->length(); + MESSAGE( ". Filtrage par " << numberOfGroups << " groupes"); + if (numberOfGroups > 0) + { + for (int NumGroup = 0; NumGroup< numberOfGroups; NumGroup++) + { + std::string GroupName = std::string((*listeGroupes)[NumGroup]); + MESSAGE( "... GroupName = " << GroupName ); + myDriver->TexteGroup(GroupName); + } + } + + // E.5. Ajout des informations liees a l'eventuelle interpolation des champs + DriverTexteFieldInterp(myIteration, myHypo, myDriver) ; + + // E.6. Ajout des options avancees + int Pyram = myCase->GetPyram(); + MESSAGE ( ". Pyram = " << Pyram ); + int NivMax = myHypo->GetNivMax(); + MESSAGE ( ". NivMax = " << NivMax ); + double DiamMin = myHypo->GetDiamMin() ; + MESSAGE ( ". DiamMin = " << DiamMin ); + int AdapInit = myHypo->GetAdapInit(); + MESSAGE ( ". AdapInit = " << AdapInit ); + int ExtraOutput = myHypo->GetExtraOutput(); + MESSAGE ( ". ExtraOutput = " << ExtraOutput ); + myDriver->TexteAdvanced(Pyram, NivMax, DiamMin, AdapInit, ExtraOutput); + + // E.7. Ajout des informations sur le deroulement de l'execution + int MessInfo = myIteration->GetInfoCompute(); + MESSAGE ( ". MessInfo = " << MessInfo ); + myDriver->TexteInfoCompute(MessInfo); + + return codret ; +} +//============================================================================= +// Calcul d'une iteration : partie spécifique au suivi de frontière CAO +//============================================================================= +CORBA::Long HOMARD_Gen_i::ComputeCAO(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long Option1, CORBA::Long Option2) +{ + MESSAGE ( "ComputeCAO avec Option1 = " << Option1 << ", Option2 = " << Option2 ); + + // A. Prealable + // A.1. Bases + int codret = 0; + // A.2. Le sous-répertoire de l'iteration en cours de traitement + char* DirCompute = myIteration->GetDirName(); + // A.3. Le maillage résultat de l'iteration en cours de traitement + char* MeshFile = myIteration->GetMeshFile(); + + // B. Les données pour FrontTrack + // B.1. Le maillage à modifier + const std::string theInputMedFile = MeshFile; + MESSAGE ( ". theInputMedFile = " << theInputMedFile ); + + // B.2. Le maillage après modification : fichier identique + const std::string theOutputMedFile = MeshFile ; + MESSAGE ( ". theOutputMedFile = " << theInputMedFile ); + + // B.3. La liste des fichiers contenant les numéros des noeuds à bouger + std::vector< std::string > theInputNodeFiles ; + MESSAGE ( ". DirCompute = " << DirCompute ); + int bilan ; + int icpt = 0 ; +#ifndef WIN32 + DIR *dp; + struct dirent *dirp; + dp = opendir(DirCompute); + while ( (dirp = readdir(dp)) != NULL ) + { + std::string file_name(dirp->d_name); + bilan = file_name.find("fr") ; + if ( bilan != string::npos ) + { + std::stringstream filename_total ; + filename_total << DirCompute << "/" << file_name ; + theInputNodeFiles.push_back(filename_total.str()) ; + icpt += 1 ; + } + } +#else + HANDLE hFind = INVALID_HANDLE_VALUE; + WIN32_FIND_DATA ffd; + hFind = FindFirstFile(DirNameStart, &ffd); + if (INVALID_HANDLE_VALUE != hFind) { + while (FindNextFile(hFind, &ffd) != 0) { + std::string file_name(ffd.cFileName); + bilan = file_name.find("fr") ; + if ( bilan != string::npos ) + { + std::stringstream filename_total ; + filename_total << DirCompute << "/" << file_name ; + theInputNodeFiles.push_back(filename_total.str()) ; + icpt += 1 ; + } + } + FindClose(hFind); + } +#endif + for ( int i = 0; i < icpt; i++ ) + { MESSAGE ( ". theInputNodeFiles["<< i << "] = " << theInputNodeFiles[i] ); } + + // B.4. Le fichier de la CAO + HOMARD::ListBoundaryGroupType* ListBoundaryGroupType = myCase->GetBoundaryGroup(); + std::string BoundaryName = std::string((*ListBoundaryGroupType)[0]); + MESSAGE ( ". BoundaryName = " << BoundaryName ); + HOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; + const std::string theXaoFileName = myBoundary->GetDataFile(); + MESSAGE ( ". theXaoFileName = " << theXaoFileName ); + + // B.5. Parallélisme + bool theIsParallel = false; + + // C. Lancement des projections + MESSAGE ( ". Lancement des projections" ); + FrontTrack* myFrontTrack = new FrontTrack(); + myFrontTrack->track(theInputMedFile, theOutputMedFile, theInputNodeFiles, theXaoFileName, theIsParallel); + + // D. Transfert des coordonnées modifiées dans le fichier historique de HOMARD + // On lance une exécution spéciale de HOMARD en attendant de savoir le faire avec MEDCoupling + MESSAGE ( ". Transfert des coordonnées" ); + codret = ComputeCAObis(myIteration, Option1, Option2) ; + + return codret ; +} +//============================================================================= +//============================================================================= +// Transfert des coordonnées en suivi de frontière CAO +// Option1 >0 : appel depuis python +// <0 : appel depuis GUI +// Option2 : multiple de nombres premiers +// 1 : aucune option +// x2 : publication du maillage dans SMESH +//============================================================================= +CORBA::Long HOMARD_Gen_i::ComputeCAObis(HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long Option1, CORBA::Long Option2) +{ + MESSAGE ( "ComputeCAObis, avec Option1 = " << Option1 << ", Option2 = " << Option2 ); + + // A. Prealable + int codret = 0; + + // A.1. Controle de la possibilite d'agir + // A.1.1. Etat de l'iteration + int etat = myIteration->GetState(); + MESSAGE ( "etat = "<GetNumber(); + std::string siterp1 ; + std::stringstream saux1 ; + saux1 << NumeIter ; + siterp1 = saux1.str() ; + if (NumeIter < 10) { siterp1 = "0" + siterp1 ; } + MESSAGE ( "siterp1 = "<GetCaseName(); + HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[CaseName]; + ASSERT(!CORBA::is_nil(myCase)); + + // A.4. Le sous-répertoire de l'iteration a traiter + char* DirCompute = myIteration->GetDirName(); + MESSAGE( ". DirCompute = " << DirCompute ); + + // C. Le fichier des messages + std::string LogFile = DirCompute ; + LogFile += "/Liste." + siterp1 + ".maj_coords.log" ; + MESSAGE (". LogFile = " << LogFile); + myIteration->SetFileInfo(LogFile.c_str()); + + // D. On passe dans le répertoire de l'iteration a calculer + MESSAGE ( ". On passe dans DirCompute = " << DirCompute ); + CHDIR(DirCompute); + + // E. Les données de l'exécution HOMARD + // E.1. L'objet du texte du fichier de configuration + HomardDriver* myDriver = new HomardDriver("", siterp1); + myDriver->TexteInit(DirCompute, LogFile, _Langue); + + // E.2. Le maillage associe a l'iteration + const char* NomMesh = myIteration->GetMeshName(); + MESSAGE ( ". NomMesh = " << NomMesh ); + const char* MeshFile = myIteration->GetMeshFile(); + MESSAGE ( ". MeshFile = " << MeshFile ); + + // E.3. Les données du traitement HOMARD + int iaux ; + myDriver->TexteMajCoords( NumeIter ) ; + iaux = 0 ; + myDriver->TexteMaillageHOMARD( DirCompute, siterp1, iaux ) ; + myDriver->TexteMaillage(NomMesh, MeshFile, 0); +// + // E.4. Ecriture du texte dans le fichier + MESSAGE ( ". Ecriture du texte dans le fichier de configuration ; codret = "<CreeFichier(); } + +// F. Execution +// + int codretexec = 1789 ; + if (codret == 0) + { + codretexec = myDriver->ExecuteHomard(Option1); + MESSAGE ( "Erreur en executant HOMARD : " << codretexec ); + } + + // G. Gestion des resultats + if (codret == 0) + { + // G.1. Le fichier des messages, dans tous les cas + const char* NomIteration = myIteration->GetName(); + std::string Commentaire = "logmaj_coords" ; + PublishFileUnderIteration(NomIteration, LogFile.c_str(), Commentaire.c_str()); + // G.2 Message d'erreur + if (codretexec != 0) + { + std::string text = "\n\nSee the file " + LogFile + "\n" ; + INFOS ( text ) ; + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + + // On force le succes pour pouvoir consulter le fichier log + codretexec = 0 ; + } + } + + // H. Menage et retour dans le répertoire du cas + if (codret == 0) { delete myDriver; } + + return codret ; +} +//============================================================================= +// Creation d'un nom de sous-répertoire pour l'iteration au sein d'un répertoire parent +// nomrep : nom du répertoire parent +// num : le nom du sous-répertoire est sous la forme 'In', n est >= num +//============================================================================= +char* HOMARD_Gen_i::CreateDirNameIter(const char* nomrep, CORBA::Long num ) +{ + MESSAGE ( "CreateDirNameIter : nomrep ="<< nomrep << ", num = "<d_name); +#else + HANDLE hFind = INVALID_HANDLE_VALUE; + WIN32_FIND_DATA ffd; + hFind = FindFirstFile(nomrep, &ffd); + if (INVALID_HANDLE_VALUE != hFind) { + while (FindNextFile(hFind, &ffd) != 0) { + if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories + std::string file_name(ffd.cFileName); +#endif + if ( file_name == DirNameA.str() ) { existe = true ; } + } +#ifndef WIN32 + closedir(dp); +#else + FindClose(hFind); +#endif + if ( !existe ) + { + DirName = DirNameA.str() ; + a_chercher = false ; + break ; + } + } + num += 1; + } + + MESSAGE ( "==> DirName = " << DirName); + MESSAGE ( ". On retourne dans nomDirActuel = " << nomDirActuel ); + CHDIR(nomDirActuel.c_str()); + return CORBA::string_dup( DirName.c_str() ); +} +//============================================================================= +// Calcul d'une iteration : gestion du répertoire de calcul +// Si le sous-répertoire existe : +// etatMenage = 0 : on sort en erreur si le répertoire n'est pas vide +// etatMenage = 1 : on fait le menage du répertoire +// etatMenage = -1 : on ne fait rien +//============================================================================= +char* HOMARD_Gen_i::ComputeDirManagement(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage) +{ + MESSAGE ( "ComputeDirManagement : répertoires pour le calcul" ); + // B.2. Le répertoire du cas + const char* nomDirCase = myCase->GetDirName(); + MESSAGE ( ". nomDirCase = " << nomDirCase ); + + // B.3. Le sous-répertoire de l'iteration a calculer, puis le répertoire complet a creer + // B.3.1. Le nom du sous-répertoire + const char* nomDirIt = myIteration->GetDirNameLoc(); + + // B.3.2. Le nom complet du sous-répertoire + std::stringstream DirCompute ; + DirCompute << nomDirCase << "/" << nomDirIt; + MESSAGE (". DirCompute = " << DirCompute.str() ); + + // B.3.3. Si le sous-répertoire n'existe pas, on le cree + if (CHDIR(DirCompute.str().c_str()) != 0) + { +#ifndef WIN32 + if (mkdir(DirCompute.str().c_str(), S_IRWXU|S_IRGRP|S_IXGRP) != 0) +#else + if (_mkdir(DirCompute.str().c_str()) != 0) +#endif + { + // GERALD -- QMESSAGE BOX + std::cerr << "Pb Creation du répertoire DirCompute = " << DirCompute.str() << std::endl; + VERIFICATION("Pb a la creation du répertoire" == 0); + } + } + else + { +// Le répertoire existe +// On demande de faire le menage de son contenu : + if (etatMenage == 1) + { + MESSAGE (". Menage du répertoire DirCompute = " << DirCompute.str()); + std::string commande = "rm -rf " + DirCompute.str()+"/*" ; + int codret = system(commande.c_str()); + if (codret != 0) + { + // GERALD -- QMESSAGE BOX + std::cerr << ". Menage du répertoire de calcul" << DirCompute.str() << std::endl; + VERIFICATION("Pb au menage du répertoire de calcul" == 0); + } + } +// On n'a pas demande de faire le menage de son contenu : on sort en erreur : + else + { + if (etatMenage == 0) + { +#ifndef WIN32 + DIR *dp; + struct dirent *dirp; + dp = opendir(DirCompute.str().c_str()); + bool result = true; + while ((dirp = readdir(dp)) != NULL && result ) + { + std::string file_name(dirp->d_name); + result = file_name.empty() || file_name == "." || file_name == ".."; //if any file - break and return false + } + closedir(dp); +#else + HANDLE hFind = INVALID_HANDLE_VALUE; + WIN32_FIND_DATA ffd; + hFind = FindFirstFile(DirCompute.str().c_str(), &ffd); + bool result = true; + if (INVALID_HANDLE_VALUE != hFind) { + while (FindNextFile(hFind, &ffd) != 0) { + if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories + std::string file_name(ffd.cFileName); + result = file_name.empty() || file_name == "." || file_name == ".."; //if any file - break and return false + } + } + FindClose(hFind); +#endif + if ( result == false) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "Directory : " + DirCompute.str() + " is not empty"; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + VERIFICATION("Directory is not empty" == 0); + } + } + } + } + + return CORBA::string_dup( DirCompute.str().c_str() ); +} +//============================================================================= +// Calcul d'une iteration : gestion du répertoire de calcul de l'iteration parent +//============================================================================= +char* HOMARD_Gen_i::ComputeDirPaManagement(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration) +{ + MESSAGE ( "ComputeDirPaManagement : répertoires pour le calcul" ); + // Le répertoire du cas + const char* nomDirCase = myCase->GetDirName(); + MESSAGE ( ". nomDirCase = " << nomDirCase ); + + // Le sous-répertoire de l'iteration precedente + + const char* nomIterationParent = myIteration->GetIterParentName(); + HOMARD::HOMARD_Iteration_var myIterationParent = myStudyContext._mesIterations[nomIterationParent]; + const char* nomDirItPa = myIterationParent->GetDirNameLoc(); + std::stringstream DirComputePa ; + DirComputePa << nomDirCase << "/" << nomDirItPa; + MESSAGE( ". nomDirItPa = " << nomDirItPa); + MESSAGE( ". DirComputePa = " << DirComputePa.str() ); + + return CORBA::string_dup( DirComputePa.str().c_str() ); +} +//============================================================================= +// Calcul d'une iteration : ecriture des zones dans le fichier de configuration +//============================================================================= +void HOMARD_Gen_i::DriverTexteZone(HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver) +{ + MESSAGE ( "... DriverTexteZone" ); + HOMARD::listeZonesHypo* ListZone = myHypo->GetZones(); + int numberOfZonesx2 = ListZone->length(); + int NumZone ; + + for (int iaux = 0; iaux< numberOfZonesx2; iaux++) + { + std::string ZoneName = std::string((*ListZone)[iaux]); + MESSAGE ( "... ZoneName = " << ZoneName); + HOMARD::HOMARD_Zone_var myZone = myStudyContext._mesZones[ZoneName]; + ASSERT(!CORBA::is_nil(myZone)); + + int ZoneType = myZone->GetType(); + std::string TypeUsestr = std::string((*ListZone)[iaux+1]); + int TypeUse = atoi( TypeUsestr.c_str() ); + MESSAGE ( "... ZoneType = " << ZoneType << ", TypeUse = "<GetCoords(); + if ( ZoneType == 2 || ( ZoneType>=11 && ZoneType <=13 ) ) // Cas d un parallelepipede ou d'un rectangle + { myDriver->TexteZone(NumZone, ZoneType, TypeUse, (*zone)[0], (*zone)[1], (*zone)[2], (*zone)[3], (*zone)[4], (*zone)[5], 0., 0., 0.); } + else if ( ZoneType == 4 ) // Cas d une sphere + { myDriver->TexteZone(NumZone, ZoneType, TypeUse, (*zone)[0], (*zone)[1], (*zone)[2], (*zone)[3], 0., 0., 0., 0., 0.); } + else if ( ZoneType == 5 || ( ZoneType>=31 && ZoneType <=33 ) ) // Cas d un cylindre ou d'un disque + { myDriver->TexteZone(NumZone, ZoneType, TypeUse, (*zone)[0], (*zone)[1], (*zone)[2], (*zone)[3], (*zone)[4], (*zone)[5], (*zone)[6], (*zone)[7], 0.); } + else if ( ZoneType == 7 || ( ZoneType>=61 && ZoneType <=63 ) ) // Cas d un tuyau ou disque perce + { myDriver->TexteZone(NumZone, ZoneType, TypeUse, (*zone)[0], (*zone)[1], (*zone)[2], (*zone)[3], (*zone)[4], (*zone)[5], (*zone)[6], (*zone)[7], (*zone)[8]); } + else { VERIFICATION("ZoneType est incorrect." == 0) ; } + iaux += 1 ; + } + return ; +} +//============================================================================= +// Calcul d'une iteration : ecriture des champs dans le fichier de configuration +//============================================================================= +void HOMARD_Gen_i::DriverTexteField(HOMARD::HOMARD_Iteration_var myIteration, HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver) +{ + MESSAGE ( "... DriverTexteField" ); +// Le fichier du champ + char* FieldFile = myIteration->GetFieldFile(); + MESSAGE ( ". FieldFile = " << FieldFile ); + if (strlen(FieldFile) == 0) + { + // GERALD -- QMESSAGE BOX + std::cerr << "Le fichier du champ n'a pas ete fourni." << std::endl; + VERIFICATION("The file for the field is not given." == 0); + } +// Les caracteristiques d'instants du champ de pilotage + int TimeStep = myIteration->GetTimeStep(); + MESSAGE( ". TimeStep = " << TimeStep ); + int Rank = myIteration->GetRank(); + MESSAGE( ". Rank = " << Rank ); +// Les informations sur les champs + HOMARD::InfosHypo* aInfosHypo = myHypo->GetField(); +// Le nom + const char* FieldName = aInfosHypo->FieldName; +// Les seuils + int TypeThR = aInfosHypo->TypeThR; + double ThreshR = aInfosHypo->ThreshR; + int TypeThC = aInfosHypo->TypeThC; + double ThreshC = aInfosHypo->ThreshC; +// Saut entre mailles ou non ? + int UsField = aInfosHypo->UsField; + MESSAGE( ". UsField = " << UsField ); +// L'usage des composantes + int UsCmpI = aInfosHypo->UsCmpI; + MESSAGE( ". UsCmpI = " << UsCmpI ); +// + myDriver->TexteField(FieldName, FieldFile, TimeStep, Rank, TypeThR, ThreshR, TypeThC, ThreshC, UsField, UsCmpI); +// +// Les composantes + HOMARD::listeComposantsHypo* mescompo = myHypo->GetComps(); + int numberOfCompos = mescompo->length(); + MESSAGE( ". numberOfCompos = " << numberOfCompos ); + for (int NumeComp = 0; NumeComp< numberOfCompos; NumeComp++) + { + std::string nomCompo = std::string((*mescompo)[NumeComp]); + MESSAGE( "... nomCompo = " << nomCompo ); + myDriver->TexteCompo(NumeComp, nomCompo); + } + return ; +} +//============================================================================= +// Calcul d'une iteration : ecriture des frontieres dans le fichier de configuration +// On ecrit dans l'ordre : +// 1. la definition des frontieres +// 2. les liens avec les groupes +// 3. un entier resumant le type de comportement pour les frontieres +//============================================================================= +int HOMARD_Gen_i::DriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, HomardDriver* myDriver) +{ + MESSAGE ( "... DriverTexteBoundary" ); + // 1. Recuperation des frontieres + std::list ListeBoundaryTraitees ; + HOMARD::ListBoundaryGroupType* ListBoundaryGroupType = myCase->GetBoundaryGroup(); + int numberOfitems = ListBoundaryGroupType->length(); + MESSAGE ( "... number of string for Boundary+Group = " << numberOfitems); + int BoundaryOption = 1 ; + // 2. Parcours des frontieres pour ecrire leur description + int NumBoundaryAnalytical = 0 ; + for (int NumBoundary = 0; NumBoundary< numberOfitems; NumBoundary=NumBoundary+2) + { + std::string BoundaryName = std::string((*ListBoundaryGroupType)[NumBoundary]); + MESSAGE ( "... BoundaryName = " << BoundaryName); + // 2.1. La frontiere a-t-elle deja ete ecrite ? + // Cela arrive quand elle est liee a plusieurs groupes. Il ne faut l'ecrire que la premiere fois + int A_faire = 1 ; + std::list::const_iterator it = ListeBoundaryTraitees.begin(); + while (it != ListeBoundaryTraitees.end()) + { + MESSAGE ( "..... BoundaryNameTraitee = " << *it); + if ( BoundaryName == *it ) { A_faire = 0 ; } + it++; + } + // 2.2. Ecriture de la frontiere + if ( A_faire == 1 ) + { + // 2.2.1. Caracteristiques de la frontiere + HOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; + ASSERT(!CORBA::is_nil(myBoundary)); + int BoundaryType = myBoundary->GetType(); + MESSAGE ( "... BoundaryType = " << BoundaryType ); + // 2.2.2. Ecriture selon le type + // 2.2.2.1. Cas d une frontiere CAO + if (BoundaryType == -1) + { +// const char* CAOFile = myBoundary->GetDataFile() ; +// MESSAGE ( ". CAOFile = " << CAOFile ); + if ( BoundaryOption % 5 != 0 ) { BoundaryOption = BoundaryOption*5 ; } + } + // 2.2.2.2. Cas d une frontiere discrete + else if (BoundaryType == 0) + { + const char* MeshName = myBoundary->GetMeshName() ; + MESSAGE ( ". MeshName = " << MeshName ); + const char* MeshFile = myBoundary->GetDataFile() ; + MESSAGE ( ". MeshFile = " << MeshFile ); + myDriver->TexteBoundaryDi( MeshName, MeshFile); + if ( BoundaryOption % 2 != 0 ) { BoundaryOption = BoundaryOption*2 ; } + } + // 2.2.2.3. Cas d une frontiere analytique + else + { + NumBoundaryAnalytical++ ; + HOMARD::double_array* coor = myBoundary->GetCoords(); + if (BoundaryType == 1) // Cas d un cylindre + { + myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], (*coor)[4], (*coor)[5], (*coor)[6], 0.); + if ( BoundaryOption % 3 != 0 ) { BoundaryOption = BoundaryOption*3 ; } + } + else if (BoundaryType == 2) // Cas d une sphere + { + myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], 0., 0., 0., 0.); + if ( BoundaryOption % 3 != 0 ) { BoundaryOption = BoundaryOption*3 ; } + } + else if (BoundaryType == 3) // Cas d un cone defini par un axe et un angle + { + myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], (*coor)[4], (*coor)[5], (*coor)[6], 0.); + if ( BoundaryOption % 3 != 0 ) { BoundaryOption = BoundaryOption*3 ; } + } + else if (BoundaryType == 4) // Cas d un cone defini par les 2 rayons + { + myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], (*coor)[4], (*coor)[5], (*coor)[6], (*coor)[7]); + if ( BoundaryOption % 3 != 0 ) { BoundaryOption = BoundaryOption*3 ; } + } + else if (BoundaryType == 5) // Cas d un tore + { + myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], (*coor)[4], (*coor)[5], (*coor)[6], (*coor)[7]); + if ( BoundaryOption % 3 != 0 ) { BoundaryOption = BoundaryOption*3 ; } + } + } + // 2.2.3. Memorisation du traitement + ListeBoundaryTraitees.push_back( BoundaryName ); + } + } + // 3. Parcours des frontieres pour ecrire les liens avec les groupes + NumBoundaryAnalytical = 0 ; + for (int NumBoundary = 0; NumBoundary< numberOfitems; NumBoundary=NumBoundary+2) + { + std::string BoundaryName = std::string((*ListBoundaryGroupType)[NumBoundary]); + MESSAGE ( "... BoundaryName = " << BoundaryName); + HOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; + ASSERT(!CORBA::is_nil(myBoundary)); + int BoundaryType = myBoundary->GetType(); + MESSAGE ( "... BoundaryType = " << BoundaryType ); + // 3.1. Recuperation du nom du groupe + std::string GroupName = std::string((*ListBoundaryGroupType)[NumBoundary+1]); + MESSAGE ( "... GroupName = " << GroupName); + // 3.2. Cas d une frontiere CAO + if ( BoundaryType == -1 ) + { + if ( GroupName.size() > 0 ) { myDriver->TexteBoundaryCAOGr ( GroupName ) ; } + } + // 3.3. Cas d une frontiere discrete + else if ( BoundaryType == 0 ) + { + if ( GroupName.size() > 0 ) { myDriver->TexteBoundaryDiGr ( GroupName ) ; } + } + // 3.4. Cas d une frontiere analytique + else + { + NumBoundaryAnalytical++ ; + myDriver->TexteBoundaryAnGr ( BoundaryName, NumBoundaryAnalytical, GroupName ) ; + } + } + // 4. Ecriture de l'option finale + myDriver->TexteBoundaryOption(BoundaryOption); +// + return BoundaryOption ; +} +//============================================================================= +// Calcul d'une iteration : ecriture des interpolations dans le fichier de configuration +//============================================================================= +void HOMARD_Gen_i::DriverTexteFieldInterp(HOMARD::HOMARD_Iteration_var myIteration, HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver) +{ + MESSAGE ( "... DriverTexteFieldInterp" ); + int TypeFieldInterp = myHypo->GetTypeFieldInterp(); + MESSAGE ( "... TypeFieldInterp = " << TypeFieldInterp); + if (TypeFieldInterp != 0) + { +// Le fichier des champs + char* FieldFile = myIteration->GetFieldFile(); + MESSAGE ( ". FieldFile = " << FieldFile ); + if (strlen(FieldFile) == 0) + { + // GERALD -- QMESSAGE BOX + VERIFICATION("The file for the field is not given." == 0); + } + // + const char* MeshFile = myIteration->GetMeshFile(); + myDriver->TexteFieldInterp(FieldFile, MeshFile); + + // Les champs + // Interpolation de tous les champs + if ( TypeFieldInterp == 1 ) + { + myDriver->TexteFieldInterpAll(); + } + // Interpolation de certains champs + else if (TypeFieldInterp == 2) + { + // Les champs et leurs instants pour l'iteration + HOMARD::listeFieldInterpTSRsIter* ListFieldTSR = myIteration->GetFieldInterpsTimeStepRank(); + int numberOfFieldsx3 = ListFieldTSR->length(); + MESSAGE( ". pour iteration, numberOfFields = " << numberOfFieldsx3/3 ); + // Les champs pour l'hypothese + HOMARD::listeFieldInterpsHypo* ListField = myHypo->GetFieldInterps(); + int numberOfFieldsx2 = ListField->length(); + MESSAGE( ". pour hypothese, numberOfFields = " << numberOfFieldsx2/2 ); + // On parcourt tous les champs de l'hypothese + int NumField = 0 ; + for (int iaux = 0; iaux< numberOfFieldsx2; iaux++) + { + // Le nom du champ + std::string FieldName = std::string((*ListField)[iaux]) ; + // Le type d'interpolation + std::string TypeInterpstr = std::string((*ListField)[iaux+1]) ; + MESSAGE( "... FieldName = " << FieldName << ", TypeInterp = " << TypeInterpstr ); + // On cherche ?? savoir si des instants ont ??t?? pr??cis??s pour cette it??ration + int tsrvu = 0; + for (int jaux = 0; jaux< numberOfFieldsx3; jaux++) + { + // Le nom du champ + std::string FieldName2 = std::string((*ListFieldTSR)[jaux]) ; + MESSAGE( "..... FieldName2 = " << FieldName2 ); + // Quand c'est le bon champ, on ecrit le pas de temps + if ( FieldName == FieldName2 ) + { + tsrvu = 1 ; + // Le pas de temps + std::string TimeStepstr = std::string((*ListFieldTSR)[jaux+1]) ; + // Le numero d'ordre + std::string Rankstr = std::string((*ListFieldTSR)[jaux+2]) ; + MESSAGE( "..... TimeStepstr = " << TimeStepstr <<", Rankstr = "<TexteFieldInterpNameType(NumField, FieldName, TypeInterpstr, TimeStep, Rank); + } + jaux += 2 ; + } + // Si aucun instant n'a été défini + if ( tsrvu == 0 ) + { + NumField += 1 ; + myDriver->TexteFieldInterpNameType(NumField, FieldName, TypeInterpstr, -1, -1); + } + iaux++ ; + } + } + } + return ; +} +//=========================================================================== +//=========================================================================== + + +//=========================================================================== +//=========================================================================== +// Publications +//=========================================================================== +//=========================================================================== +SALOMEDS::SObject_ptr HOMARD_Gen_i::PublishInStudy(SALOMEDS::SObject_ptr theSObject, + CORBA::Object_ptr theObject, + const char* theName) +{ + MESSAGE("PublishInStudy pour " << theName); + SALOMEDS::SObject_var aResultSO; + if (CORBA::is_nil(myStudy)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid study context"; + throw SALOME::SALOME_Exception(es); + return 0; + }; + +// Recuperation de l'objet correspondant, en essayant chacun des types possibles +// Rq : Iteration est publiee ailleurs + HOMARD::HOMARD_Boundary_var aBoundary = HOMARD::HOMARD_Boundary::_narrow(theObject); + HOMARD::HOMARD_Cas_var aCase = HOMARD::HOMARD_Cas::_narrow(theObject); + HOMARD::HOMARD_Hypothesis_var aHypo = HOMARD::HOMARD_Hypothesis::_narrow(theObject); + HOMARD::HOMARD_YACS_var aYACS = HOMARD::HOMARD_YACS::_narrow(theObject); + HOMARD::HOMARD_Zone_var aZone = HOMARD::HOMARD_Zone::_narrow(theObject); + + UpdateStudy(); + +// Controle de la non publication d'un objet de meme nom + if ( (!aBoundary->_is_nil()) || (!aHypo->_is_nil()) || (!aYACS->_is_nil()) || (!aZone->_is_nil()) ) + { + SALOMEDS::Study::ListOfSObject_var listSO = myStudy->FindObjectByName(theName, ComponentDataType()); + if (listSO->length() >= 1) + { + MESSAGE("This name "<length()<<" time(s)"); + aResultSO = listSO[0]; + return aResultSO._retn(); + } + } + + // Caracteristiques de l'etude + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + aStudyBuilder->NewCommand(); + if(!aBoundary->_is_nil()) + aResultSO = PublishBoundaryInStudy(aStudyBuilder, aBoundary, theName); + else if(!aCase->_is_nil()) + aResultSO = PublishCaseInStudy(aStudyBuilder, aCase, theName); + else if(!aHypo->_is_nil()) + aResultSO = PublishHypotheseInStudy(aStudyBuilder, aHypo, theName); + else if(!aYACS->_is_nil()) + aResultSO = PublishYACSInStudy(aStudyBuilder, aYACS, theName); + else if(!aZone->_is_nil()) + aResultSO = PublishZoneInStudy(aStudyBuilder, aZone, theName); + + aStudyBuilder->CommitCommand(); + + return aResultSO._retn(); +}; +//============================================================================= +SALOMEDS::SObject_ptr HOMARD_Gen_i::PublishBoundaryInStudy( SALOMEDS::StudyBuilder_var aStudyBuilder, + HOMARD::HOMARD_Boundary_ptr theObject, const char* theName) +{ + MESSAGE("PublishBoundaryStudy pour "<FindComponent(ComponentDataType()); + if (theFatherHomard->_is_nil()) + { + MESSAGE("theFatherHomard->_is_nil()"); + return aResultSO._retn(); + } + + // On ajoute la categorie des boundarys dans l etude si necessaire + if ( _tag_boun == 0 ) + { + _tag_gene += 1 ; + _tag_boun = _tag_gene ; + } + MESSAGE("PublishBoundaryInStudy _tag_gene = "<<_tag_gene << ", _tag_boun = "<<_tag_boun ); + SALOMEDS::SObject_var aSObject; + if (!theFatherHomard->FindSubObject(_tag_boun, aSObject)) + { + MESSAGE("Ajout de la categorie des boundarys"); + aSObject = aStudyBuilder->NewObjectToTag(theFatherHomard, _tag_boun); + PublishInStudyAttr(aStudyBuilder, aSObject, "Boundaries", "BoundList", "zone_icone_2.png", NULL ) ; + } + else { MESSAGE("La categorie des boundarys existe deja."); } + + CORBA::Long BoundaryType = myBoundary->GetType(); +// MESSAGE("BoundaryType : "<NewObject(aSObject); + PublishInStudyAttr(aStudyBuilder, aResultSO, theName, value.c_str(), icone.c_str(), _orb->object_to_string(theObject)); + return aResultSO._retn(); +} +//============================================================================= +SALOMEDS::SObject_ptr HOMARD_Gen_i::PublishCaseInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, + HOMARD::HOMARD_Cas_ptr theObject, const char* theName) +{ + MESSAGE("PublishCaseInStudy pour "<_is_nil()"); + return aResultSO._retn(); + } + if (myStudy->_is_nil()) { + MESSAGE("HOMARD_Gen_i::myStudy->_is_nil()"); + return aResultSO._retn(); + } + + // On recupere le module pere dans l etude + SALOMEDS::SComponent_var theFatherHomard = myStudy->FindComponent(ComponentDataType()); + if (theFatherHomard->_is_nil()) + { + MESSAGE("theFatherHomard->_is_nil()"); + return aResultSO._retn(); + } + + _tag_gene += 1 ; + MESSAGE("PublishCaseInStudy _tag_gene = "<<_tag_gene ); + aResultSO = aStudyBuilder->NewObject(theFatherHomard); + PublishInStudyAttr(aStudyBuilder, aResultSO, theName, "CasHomard", "cas_calcule.png", + _orb->object_to_string(theObject) ) ; + + return aResultSO._retn(); +} +//============================================================================= +SALOMEDS::SObject_ptr HOMARD_Gen_i::PublishHypotheseInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, + HOMARD::HOMARD_Hypothesis_ptr theObject, const char* theName) +{ + MESSAGE("PublishHypotheseInStudy pour "<FindComponent(ComponentDataType()); + if (theFatherHomard->_is_nil()) + { + MESSAGE("theFatherHomard->_is_nil()"); + return aResultSO._retn(); + } + + // On ajoute la categorie des hypotheses dans l etude si necessaire + SALOMEDS::SObject_var aSObject; + if ( _tag_hypo == 0 ) + { + _tag_gene += 1 ; + _tag_hypo = _tag_gene ; + } + MESSAGE("PublishHypotheseInStudy _tag_gene = "<<_tag_gene << ", _tag_hypo = "<<_tag_hypo ); + if (!theFatherHomard->FindSubObject(_tag_hypo, aSObject)) + { + MESSAGE("Ajout de la categorie des hypotheses"); + aSObject = aStudyBuilder->NewObjectToTag(theFatherHomard, _tag_hypo); + PublishInStudyAttr(aStudyBuilder, aSObject, "Hypothesis", "HypoList", "hypotheses.png", NULL); + } + else { MESSAGE("La categorie des hypotheses existe deja."); } + +// Creation du resultat dans l'etude + aResultSO = aStudyBuilder->NewObject(aSObject); + PublishInStudyAttr(aStudyBuilder, aResultSO, theName, "HypoHomard", NULL, _orb->object_to_string(theObject) ) ; + + return aResultSO._retn(); +} +//============================================================================= +SALOMEDS::SObject_ptr HOMARD_Gen_i::PublishYACSInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, + HOMARD::HOMARD_YACS_ptr theObject, const char* theName) +{ + MESSAGE("PublishYACSInStudy pour "<FindComponent(ComponentDataType()); + if (theFatherHomard->_is_nil()) + { + MESSAGE("theFatherHomard->_is_nil()"); + return aResultSO._retn(); + } + // On ajoute la categorie des schemas YACS dans l etude si necessaire + if ( _tag_yacs == 0 ) + { + _tag_gene += 1 ; + _tag_yacs = _tag_gene ; + } + MESSAGE("PublishZoneStudy _tag_gene = "<<_tag_gene << ", _tag_yacs = "<<_tag_yacs ); + SALOMEDS::SObject_var aSObject; + if (!theFatherHomard->FindSubObject(_tag_yacs, aSObject)) + { + MESSAGE("Ajout de la categorie des schemas YACS"); + aSObject = aStudyBuilder->NewObjectToTag(theFatherHomard, _tag_yacs); + PublishInStudyAttr(aStudyBuilder, aSObject, "YACS", "YACSList", "full_view.png", NULL); + } + else { MESSAGE("La categorie des schemas YACS existe deja."); } + +// Creation du resultat dans l'etude + aResultSO = aStudyBuilder->NewObject(aSObject); + PublishInStudyAttr(aStudyBuilder, aResultSO, theName, "YACSHomard", "schema.png", _orb->object_to_string(theObject) ) ; + + return aResultSO._retn(); +} + +//============================================================================= +SALOMEDS::SObject_ptr HOMARD_Gen_i::PublishZoneInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, + HOMARD::HOMARD_Zone_ptr theObject, const char* theName) +{ + MESSAGE("PublishZoneStudy pour "<_is_nil()"); + return aResultSO._retn(); + } + if (myStudy->_is_nil()) + { + MESSAGE("PublishZoneInStudy : myStudy->_is_nil()"); + return aResultSO._retn(); + } + SALOMEDS::SComponent_var theFatherHomard = myStudy->FindComponent(ComponentDataType()); + if (theFatherHomard->_is_nil()) + { + MESSAGE("PublishZoneInStudy : theFatherHomard->_is_nil()"); + return aResultSO._retn(); + } + + // Caracteristique de la zone + HOMARD::HOMARD_Zone_var myZone = myStudyContext._mesZones[theName]; + CORBA::Long ZoneType = myZone->GetType(); + + // On ajoute la categorie des zones dans l etude si necessaire + if ( _tag_zone == 0 ) + { + _tag_gene += 1 ; + _tag_zone = _tag_gene ; + } + MESSAGE("PublishZoneStudy _tag_gene = "<<_tag_gene << ", _tag_zone = "<<_tag_zone ); + SALOMEDS::SObject_var aSObject; + if (!theFatherHomard->FindSubObject(_tag_zone, aSObject)) + { + MESSAGE("Ajout de la categorie des zones"); + aSObject = aStudyBuilder->NewObjectToTag(theFatherHomard, _tag_zone); + PublishInStudyAttr(aStudyBuilder, aSObject, "Zones", "ZoneList", "zone_icone_2.png", NULL ) ; + } + else { MESSAGE("La categorie des zones existe deja."); } + + aResultSO = aStudyBuilder->NewObject(aSObject); + std::string icone ; + switch (ZoneType) + { + case 11 : + { } + case 12 : + { } + case 13 : + { icone = "boxdxy_2.png" ; + break ; + } + case 2 : + { icone = "boxdxyz_2.png" ; + break ; + } + case 31 : + { } + case 32 : + { } + case 33 : + { icone = "disk_2.png" ; + break ; + } + case 4 : + { icone = "spherepoint_2.png" ; + break ; + } + case 5 : + { icone = "cylinderpointvector_2.png" ; + break ; + } + case 61 : + { } + case 62 : + { } + case 63 : + { icone = "diskwithhole_2.png" ; + break ; + } + case 7 : + { icone = "pipe_2.png" ; + break ; + } + } + PublishInStudyAttr(aStudyBuilder, aResultSO, theName, "ZoneHomard", icone.c_str(), _orb->object_to_string(theObject) ) ; + + return aResultSO._retn(); +} +//=========================================================================== +void HOMARD_Gen_i::PublishInStudyAttr(SALOMEDS::StudyBuilder_var aStudyBuilder, + SALOMEDS::SObject_var aResultSO, + const char* name, const char* comment, const char* icone, const char* ior) +{ + MESSAGE("PublishInStudyAttr pour name = "<SetValue(name); + } + +// Ajout du commentaire + if ( comment != NULL ) + { + anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeComment"); + SALOMEDS::AttributeComment_var aCommentAttrib = SALOMEDS::AttributeComment::_narrow(anAttr); + aCommentAttrib->SetValue(comment); + } + +// Ajout de l'icone + if ( icone != NULL ) + { + anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributePixMap"); + SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap(icone); + } + +// Ajout de l ior + if ( ior != NULL ) + { + anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeIOR"); + SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + anIOR->SetValue(ior); + } +}; + +//===================================================================================== +void HOMARD_Gen_i::PublishBoundaryUnderCase(const char* CaseName, const char* BoundaryName) +{ + MESSAGE ( "PublishBoundaryUnderCase : CaseName = " << CaseName << ", BoundaryName= " << BoundaryName ); + + HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[CaseName]; + ASSERT(!CORBA::is_nil(myCase)); + SALOMEDS::SObject_var aCaseSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myCase))); + ASSERT(!CORBA::is_nil(aCaseSO)); + + HOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; + ASSERT(!CORBA::is_nil(myBoundary)); + SALOMEDS::SObject_var aBoundarySO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myBoundary))); + ASSERT(!CORBA::is_nil(aBoundarySO)); + + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + + aStudyBuilder->NewCommand(); + + SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aCaseSO); + aStudyBuilder->Addreference(aSubSO, aBoundarySO); +// aStudyBuilder->RemoveReference(aSubSO); + + aStudyBuilder->CommitCommand(); + +}; +//===================================================================================== +void HOMARD_Gen_i::PublishCaseUnderYACS(const char* nomYACS, const char* CaseName) +{ + MESSAGE ( "PublishCaseUnderYACS : nomYACS = " << nomYACS << ", CaseName= " << CaseName ); + + HOMARD::HOMARD_YACS_var myYACS = myStudyContext._mesYACSs[nomYACS]; + ASSERT(!CORBA::is_nil(myYACS)); + SALOMEDS::SObject_var aYACSSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myYACS))); + ASSERT(!CORBA::is_nil(aYACSSO)); + + HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[CaseName]; + ASSERT(!CORBA::is_nil(myCase)); + SALOMEDS::SObject_var aCaseSO = SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myCase))); + ASSERT(!CORBA::is_nil(aCaseSO)); + + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + + aStudyBuilder->NewCommand(); + + SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aYACSSO); + aStudyBuilder->Addreference(aSubSO, aCaseSO); + + aStudyBuilder->CommitCommand(); + +}; +//============================================================================= +void HOMARD_Gen_i::PublishResultInSmesh(const char* NomFich, CORBA::Long Option) +// Option = 0 : fichier issu d'une importation +// Option = 1 : fichier issu d'une execution HOMARD +{ + MESSAGE( "PublishResultInSmesh " << NomFich << ", avec Option = " << Option); + if (CORBA::is_nil(myStudy)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid study context"; + throw SALOME::SALOME_Exception(es); + return ; + }; + +// Le module SMESH est-il actif ? + SALOMEDS::SObject_var aSmeshSO = myStudy->FindComponent("SMESH"); +// + if (!CORBA::is_nil(aSmeshSO)) + { +// On verifie que le fichier n est pas deja publie + SALOMEDS::ChildIterator_var aIter = myStudy->NewChildIterator(aSmeshSO); + for (; aIter->More(); aIter->Next()) + { + SALOMEDS::SObject_var aSO = aIter->Value(); + SALOMEDS::GenericAttribute_var aGAttr; + if (aSO->FindAttribute(aGAttr,"AttributeExternalFileDef")) + { + SALOMEDS::AttributeExternalFileDef_var anAttr = SALOMEDS::AttributeExternalFileDef::_narrow(aGAttr); + CORBA::String_var value=anAttr->Value(); + if (strcmp((const char*)value,NomFich) == 0) + { + MESSAGE ( "PublishResultInSmesh : le fichier " << NomFich << " est deja publie." ); + // Pour un fichier importe, on ne republie pas + if ( Option == 0 ) { return; } + // Pour un fichier calcule, on commence par faire la depublication + else + { + MESSAGE ( "PublishResultInSmesh : depublication" ); + SALOMEDS::AttributeName_var anAttr2 = SALOMEDS::AttributeName::_narrow(aGAttr); + CORBA::String_var value2=anAttr2->Value(); + std::string MeshName = string(value2) ; + MESSAGE ( "PublishResultInSmesh : depublication de " << MeshName ); + DeleteResultInSmesh(NomFich, MeshName) ; + } + } + } + } + } + +// On enregistre le fichier + MESSAGE( "Enregistrement du fichier"); + SALOME_LifeCycleCORBA* myLCC = new SALOME_LifeCycleCORBA(_NS); + SMESH::SMESH_Gen_var aSmeshEngine = SMESH::SMESH_Gen::_narrow(myLCC->FindOrLoad_Component("FactoryServer","SMESH")); + ASSERT(!CORBA::is_nil(aSmeshEngine)); + aSmeshEngine->UpdateStudy(); + SMESH::DriverMED_ReadStatus theStatus; + //aSmeshEngine->CreateMeshesFromMED(NomFich, theStatus); + +// On met a jour les attributs AttributeExternalFileDef et AttributePixMap + SMESH::mesh_array* mesMaillages=aSmeshEngine->CreateMeshesFromMED(NomFich, theStatus); + for (int i = 0; i < mesMaillages->length(); i++) + { + MESSAGE( ". Mise a jour des attributs du maillage"); + SMESH::SMESH_Mesh_var monMaillage= (*mesMaillages)[i]; + SALOMEDS::SObject_var aSO=SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(monMaillage))); + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + SALOMEDS::GenericAttribute_var aGAttr = aStudyBuilder->FindOrCreateAttribute(aSO, "AttributeExternalFileDef"); + SALOMEDS::AttributeExternalFileDef_var anAttr = SALOMEDS::AttributeExternalFileDef::_narrow(aGAttr); + anAttr->SetValue(NomFich); + SALOMEDS::GenericAttribute_var aPixMap = aStudyBuilder->FindOrCreateAttribute(aSO, "AttributePixMap" ); + SALOMEDS::AttributePixMap_var anAttr2 = SALOMEDS::AttributePixMap::_narrow(aPixMap); + const char* icone ; + if ( Option == 0 ) { icone = "mesh_tree_importedmesh.png" ; } + else { icone = "mesh_tree_mesh.png" ; } + anAttr2->SetPixMap( icone ); + } + +} +//============================================================================= +void HOMARD_Gen_i::DeleteResultInSmesh(std::string NomFich, std::string MeshName) +{ + MESSAGE ("DeleteResultInSmesh pour le maillage " << MeshName << " dans le fichier " << NomFich ); + if (CORBA::is_nil(myStudy)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid study context"; + throw SALOME::SALOME_Exception(es); + return ; + }; + +// Le module SMESH est-il actif ? + SALOMEDS::SObject_var aSmeshSO = myStudy->FindComponent("SMESH"); +// + if (CORBA::is_nil(aSmeshSO)) + { + return ; + }; +// On verifie que le fichier est deja publie + SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder(); + SALOMEDS::ChildIterator_var aIter = myStudy->NewChildIterator(aSmeshSO); + for (; aIter->More(); aIter->Next()) + { + SALOMEDS::SObject_var aSO = aIter->Value(); + SALOMEDS::GenericAttribute_var aGAttr; + if (aSO->FindAttribute(aGAttr,"AttributeExternalFileDef")) + { + SALOMEDS::AttributeExternalFileDef_var anAttr = SALOMEDS::AttributeExternalFileDef::_narrow(aGAttr); + CORBA::String_var value=anAttr->Value(); + if (strcmp((const char*)value,NomFich.c_str()) == 0) + { + if (aSO->FindAttribute(aGAttr,"AttributeName")) + { + SALOMEDS::AttributeName_var anAttr2 = SALOMEDS::AttributeName::_narrow(aGAttr); + CORBA::String_var value2=anAttr2->Value(); + if (strcmp((const char*)value2,MeshName.c_str()) == 0) + { + myBuilder->RemoveObjectWithChildren( aSO ) ; + } + } + } + } + } + return ; +} +//============================================================================= +void HOMARD_Gen_i::PublishMeshIterInSmesh(const char* NomIter) +{ + MESSAGE( "PublishMeshIterInSmesh " << NomIter); + HOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[NomIter]; + + SALOMEDS::SObject_var aIterSO=SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIteration))); + if (CORBA::is_nil(myIteration)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid iterationStudy Object"; + throw SALOME::SALOME_Exception(es); + return ; + }; + const char* MeshFile = myIteration->GetMeshFile() ; + const char* MeshName = myIteration->GetMeshName() ; + CORBA::Long Option = -1 ; + int etat = myIteration->GetState(); +// Iteration initiale + if ( etat <= 0 ) { Option = 0 ; } +// ou iteration calculee + else if ( etat == 2 ) { Option = 1 ; } +// Publication effective apres menage eventuel + if ( Option >= 0 ) + { + DeleteResultInSmesh(MeshFile, MeshName) ; + PublishResultInSmesh(MeshFile, Option) ; + } + +} +//============================================================================= +void HOMARD_Gen_i::PublishFileUnderIteration(const char* NomIter, const char* NomFich, const char* Commentaire) +{ +// MESSAGE ("PublishFileUnderIteration pour l'iteration " << NomIter << " du fichier " << NomFich << " avec le commentaire " << Commentaire ); + HOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[NomIter]; + + SALOMEDS::SObject_var aIterSO=SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myIteration))); + if (CORBA::is_nil(myIteration)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid iterationStudy Object"; + throw SALOME::SALOME_Exception(es); + return ; + }; + + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + + aStudyBuilder->NewCommand(); + + SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aIterSO); +// Pour les fichiers med, on affiche une icone de maillage +// Pour les fichiers qui sont du texte, on affiche une icone de fichier texte 'texte' +// Le reperage se fait par la 1ere lettre du commentaire : I pour Iteration n + std::string icone ; + std::string ior = " " ; + if ( Commentaire[0] == 'M' ) + { icone = "med.png" ; } + else + { icone = "texte_2.png" ; } + PublishInStudyAttr(aStudyBuilder, aSubSO, NomFich, Commentaire, icone.c_str(), ior.c_str() ) ; + + aStudyBuilder->CommitCommand(); +} +// +//============================================================================= +void HOMARD_Gen_i::PublishFileUnderYACS(const char* nomYACS, const char* NomFich, const char* Commentaire) +{ +// MESSAGE ("PublishFileUnderYACS pour le schema " << nomYACS << " du fichier " << NomFich << " avec le commentaire " << Commentaire ); + HOMARD::HOMARD_YACS_var myYACS = myStudyContext._mesYACSs[nomYACS]; + + SALOMEDS::SObject_var aYACSSO=SALOMEDS::SObject::_narrow(myStudy->FindObjectIOR(_orb->object_to_string(myYACS))); + if (CORBA::is_nil(myYACS)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid YACSStudy Object"; + throw SALOME::SALOME_Exception(es); + return ; + }; + + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + + aStudyBuilder->NewCommand(); + + SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aYACSSO); + std::string icone = "texte_2.png" ; + std::string ior = " " ; + PublishInStudyAttr(aStudyBuilder, aSubSO, NomFich, Commentaire, icone.c_str(), ior.c_str() ) ; + + aStudyBuilder->CommitCommand(); +} +// +//============================================================================= +//============================================================================= +// YACS +//============================================================================= +//============================================================================= +//============================================================================= +// Creation d'un schema YACS +// nomCas : nom du cas a traiter +// FileName : nom du fichier contenant le script de lancement du calcul +// DirName : le répertoire de lancement des calculs du schéma +//============================================================================= +HOMARD::HOMARD_YACS_ptr HOMARD_Gen_i::CreateYACSSchema (const char* nomYACS, const char* nomCas, const char* ScriptFile, const char* DirName, const char* MeshFile) +{ + INFOS ( "CreateYACSSchema : Schema YACS " << nomYACS ); + INFOS ( ". nomCas : " << nomCas); + INFOS ( ". ScriptFile : " << ScriptFile); + INFOS ( ". DirName : " << DirName); + INFOS ( ". MeshFile : " << MeshFile); + + // A. Controle du nom : + if ((myStudyContext._mesYACSs).find(nomYACS) != (myStudyContext._mesYACSs).end()) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This schema YACS has already been defined."; + throw SALOME::SALOME_Exception(es); + return 0; + } + + // B. Creation de l'objet + HOMARD::HOMARD_YACS_var myYACS = newYACS(); + if (CORBA::is_nil(myYACS)) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Unable to create the schema YACS"; + throw SALOME::SALOME_Exception(es); + return 0; + }; + myYACS->SetName( nomYACS ) ; + + // C. Enregistrement + myStudyContext._mesYACSs[nomYACS] = myYACS; + + SALOMEDS::SObject_var aSO; + SALOMEDS::SObject_var aResultSO=PublishInStudy(aSO, myYACS, nomYACS); + + PublishCaseUnderYACS(nomYACS, nomCas); + + // D. Caracterisation + // D.1. Options + myYACS->SetDirName( DirName ) ; + myYACS->SetMeshFile( MeshFile ) ; + myYACS->SetScriptFile( ScriptFile ) ; + myYACS->SetCaseName( nomCas ) ; + // D.2. Defaut + int defaut_i ; + // D.2.1. Type constant + myYACS->SetType( 1 ) ; + // D.2.2. Convergence + defaut_i = GetYACSMaxIter() ; + myYACS->SetMaxIter( defaut_i ) ; + defaut_i = GetYACSMaxNode() ; + myYACS->SetMaxNode( defaut_i ) ; + defaut_i = GetYACSMaxElem() ; + myYACS->SetMaxElem( defaut_i ) ; + // D.3. Fichier de sauvegarde dans le répertoire du cas + HOMARD::HOMARD_Cas_ptr caseyacs = GetCase(nomCas) ; + std::string dirnamecase = caseyacs->GetDirName() ; + std::string XMLFile ; + XMLFile = dirnamecase + "/schema.xml" ; + myYACS->SetXMLFile( XMLFile.c_str() ) ; + + return HOMARD::HOMARD_YACS::_duplicate(myYACS); +} +//============================================================================= +// Ecriture d'un schema YACS +//============================================================================= +CORBA::Long HOMARD_Gen_i::YACSWrite(const char* nomYACS) +{ + INFOS ( "YACSWrite : Ecriture de " << nomYACS ); +// Le répertoire du cas + HOMARD::HOMARD_YACS_var myYACS = myStudyContext._mesYACSs[nomYACS]; + ASSERT(!CORBA::is_nil(myYACS)); +// Le nom du fichier du schema + std::string XMLFile ; + XMLFile = myYACS->GetXMLFile() ; + + int codret = YACSWriteOnFile(nomYACS, XMLFile.c_str()) ; + + return codret ; +} +//============================================================================= +// Ecriture d'un schema YACS sur un fichier donne +//============================================================================= +CORBA::Long HOMARD_Gen_i::YACSWriteOnFile(const char* nomYACS, const char* XMLFile) +{ + INFOS ( "YACSWriteOnFile : Ecriture de " << nomYACS << " sur " << XMLFile ); + + // A. Prealable + int codret = 0; + + // B. L'objet YACS + // B.1. L'objet + HOMARD::HOMARD_YACS_var myYACS = myStudyContext._mesYACSs[nomYACS]; + ASSERT(!CORBA::is_nil(myYACS)); + // B.2. Les caracteristiques + std::string DirName = myYACS->GetDirName() ; + std::string MeshFile = myYACS->GetMeshFile() ; + std::string ScriptFile = myYACS->GetScriptFile() ; + // B.3. Les caracteristiques de convergence + int MaxIter = myYACS->GetMaxIter() ; + int MaxNode = myYACS->GetMaxNode() ; + int MaxElem = myYACS->GetMaxElem() ; + + // C. Le cas + // C.1. L'objet cas + const char* nomCas = myYACS->GetCaseName(); + HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas]; + ASSERT(!CORBA::is_nil(myCase)); + // C.2. Les instructions python associees au cas + CORBA::String_var dumpCorbaCase = myCase->GetDumpPython(); + std::string pythonCas = dumpCorbaCase.in(); + MESSAGE ("pythonCas :\n"<GetIter0() ; + std::string Iter0Name = myCase->GetIter0Name() ; + MESSAGE (". Iter0Name = " << Iter0Name); + std::string MeshName = Iter0->GetMeshName(); + MESSAGE (". MeshName = " << MeshName); + // D.2. L'iteration numero 1 + HOMARD::listeIterFilles* maListe = Iter0->GetIterations(); + int numberOfIter = maListe->length(); + if ( numberOfIter > 1 ) + { + MESSAGE (". numberOfIter = " << numberOfIter); + SALOME::ExceptionStruct es ; + es.type = SALOME::BAD_PARAM; + std::string text = "Une seule iteration est permise." ; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + return 0; + } + std::string Iter1Name = std::string((*maListe)[0]); + MESSAGE ("... Iter1Name = " << Iter1Name); + HOMARD::HOMARD_Iteration_var Iter1 = GetIteration(Iter1Name.c_str()) ; + // D.3. Les instructions python associees a l'iteration + CORBA::String_var dumpCorbaIter = Iter1->GetDumpPython(); + std::string pythonIter = dumpCorbaIter.in(); + MESSAGE ("pythonIter :\n"<GetHypoName(); + MESSAGE (". nomHypo = " << nomHypo); + HOMARD::HOMARD_Hypothesis_var myHypo = myStudyContext._mesHypotheses[nomHypo]; + ASSERT(!CORBA::is_nil(myHypo)); + // E.2. Les caracteristiques de l'adaptation + HOMARD::listeTypes* ListTypes = myHypo->GetAdapRefinUnRef(); + ASSERT(ListTypes->length() == 3); + int TypeAdap = (*ListTypes)[0]; +// int TypeRaff = (*ListTypes)[1]; +// int TypeDera = (*ListTypes)[2]; + // E.3. Les instructions python associees a l'hypothese + CORBA::String_var dumpCorbaHypo = myHypo->GetDumpPython(); + std::string pythonHypo = dumpCorbaHypo.in(); + MESSAGE ("pythonHypo :\n"<Texte_DataInit_MeshFile(MeshFile); } + // G.1.3. Le script de lancement + else if ( mot_cle == "Alternance_Calcul_HOMARD_Calcul" ) + { myDriver->Texte_Alternance_Calcul_HOMARD_Calcul(ScriptFile); } + // G.1.4. Les options du cas + else if ( mot_cle == "Iter_1_Case_Options" ) + { myDriver->Texte_Iter_1_Case_Options(pythonCas); } + // G.1.5. Execution de HOMARD : le répertoire du cas + else if ( mot_cle == "HOMARD_Exec_DirName" ) + { myDriver->Texte_HOMARD_Exec_DirName(); } + // G.1.6. Execution de HOMARD : le nom du maillage + else if ( mot_cle == "HOMARD_Exec_MeshName" ) + { + myDriver->Texte_HOMARD_Exec_MeshName(MeshName); + std::string node ; + if ( _LangueShort == "fr" ) { node = "Boucle_de_convergence.Alternance_Calcul_HOMARD" ; } + else { node = "Convergence_Loop.Alternation_Computation_HOMARD" ; } + node += ".Adaptation.p0_Adaptation_HOMARD.HOMARD_Initialisation.p1_Iter_1.CreateCase" ; + myDriver->TexteParametre( node, "MeshName", "string", MeshName ) ; + } + // G.1.7. Execution de HOMARD : les options de l'hypothese + else if ( mot_cle == "HOMARD_Exec_Hypo_Options" ) + { myDriver->Texte_python_1( pythonHypo, 3, "Hypo" ) ; } + // G.1.8. Execution de HOMARD : les options de l'iteration + else if ( mot_cle == "HOMARD_Exec_Iter_Options" ) + { myDriver->Texte_python_2( pythonIter, "TimeStep", "Iter" ) ; } + // G.1.9. a. Creation eventuelles des zones et frontieres + // b. Enchainement + else if ( mot_cle == "Iter_1" ) + { + std::string texte_control = "" ; + if ( TypeAdap == 0 ) { texte_control += YACSDriverTexteZone( myHypo, myDriver ) ; } + texte_control += YACSDriverTexteBoundary( myCase, myDriver ) ; + texte_control += myDriver->Texte_Iter_1_control() ; + myDriver->TexteAdd(texte_control); + } + // G.1.10. Les tests de convergence + else if ( mot_cle == "Analyse_Test_Convergence" ) + { myDriver->TexteAnalyse_Test_Convergence(MaxIter, MaxNode, MaxElem); } + // G.1.11. Les parametres + else if ( mot_cle == "PARAMETRES" ) + { myDriver->TexteAddParametres(); } + // G.1.n. La ligne est recopiee telle quelle + else { myDriver->TexteAdd(ligne); } + } + // G.2. Ecriture du texte dans le fichier + if ( codret == 0 ) + { myDriver->CreeFichier(); } + } + else + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "The reference file for the YACS schema cannot be read." ; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + + delete myDriver; + + // H. Publication du fichier dans l'arbre + + std::string Commentaire = "xml" ; + PublishFileUnderYACS(nomYACS, XMLFile, Commentaire.c_str()); + + return codret ; +} +//============================================================================= +// Ecriture d'un schema YACS : ecriture des zones associees a une hypothese +//============================================================================= +std::string HOMARD_Gen_i::YACSDriverTexteZone(HOMARD::HOMARD_Hypothesis_var myHypo, YACSDriver* myDriver) +{ + MESSAGE ( "YACSDriverTexteZone" ); + // A. Les zones associees a cette hypothese + HOMARD::listeZonesHypo* ListZone = myHypo->GetZones(); + int numberOfZonesx2 = ListZone->length(); + + // B. Parcours des zones + std::string texte_control ; + for (int iaux = 0; iaux< numberOfZonesx2; iaux++) + { + // 1. Reperage de la zone + std::string ZoneName = std::string((*ListZone)[iaux]); + MESSAGE ( "\n. ZoneName = " << ZoneName << " - " <GetDumpPython(); + std::string pythonStructure_0 = dumpCorbaZone.in(); + MESSAGE ("pythonStructure_0 :"<GetBoundaryGroup(); + int numberOfitems = ListBoundaryGroupType->length(); + + // B. Parcours des frontieres + std::string texte_control ; + std::list ListeBoundaryTraitees ; + for (int NumBoundary = 0; NumBoundary< numberOfitems; NumBoundary=NumBoundary+2) + { + std::string BoundaryName = std::string((*ListBoundaryGroupType)[NumBoundary]); + MESSAGE ( "... BoundaryName = " << BoundaryName); + // Attention a n'ecrire la definition qu'une seule fois car elle peut se trouver + // plusieurs fois dans la definition du cas, d'ou la liste ListeBoundaryTraitees + int A_faire = 1 ; + std::list::const_iterator it = ListeBoundaryTraitees.begin(); + while (it != ListeBoundaryTraitees.end()) + { + MESSAGE ( "..... BoundaryNameTraitee = " << *it); + if ( BoundaryName == *it ) { A_faire = 0 ; } + it++; + } + if ( A_faire == 1 ) + { + // 1. Caracteristiques de la frontiere + HOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName]; + ASSERT(!CORBA::is_nil(myBoundary)); + // 2. Les instructions python associees a la frontiere + // La premiere ligne est un commentaire a eliminer + // La seconde ligne est l'instruction a proprement parler ; on ne garde que ce qui suit le "." + CORBA::String_var dumpCorbaBoundary = myBoundary->GetDumpPython(); + std::string pythonStructure_0 = dumpCorbaBoundary.in(); + MESSAGE ("pythonStructure_0 :"<URL())); + aFileName += "_HOMARD.dat"; + + // initialize sequence of file names + SALOMEDS_Tool::ListOfFiles aFileSeq; + aFileSeq.reserve(1); + aFileSeq.push_back(CORBA::string_dup(aFileName.c_str())) ; + + // get full path to the data file + aFileName = tmpDir + aFileName; + + // save data + // -> create file + std::ofstream f(aFileName.c_str()); + + // clear temporary id map + context._idmap.clear(); + + int id = 1; + + // -> save cases + std::map::const_iterator it_case; + for (it_case = context._mesCas.begin(); it_case != context._mesCas.end(); ++it_case) { + HOMARD::HOMARD_Cas_var aCas = it_case->second; + PortableServer::ServantBase_var aServant = GetServant(aCas); + HOMARD_Cas_i* aCasServant = dynamic_cast(aServant.in()); + if (aCasServant) { + f << HOMARD::GetSignature(HOMARD::Case) << aCasServant->Dump() << std::endl; + context._idmap[id++] = dynamic_cast(aCasServant); + } + } + // -> save zones + std::map::const_iterator it_zone; + for (it_zone = context._mesZones.begin(); it_zone != context._mesZones.end(); ++it_zone) { + HOMARD::HOMARD_Zone_var aZone = it_zone->second; + PortableServer::ServantBase_var aServant = GetServant(aZone); + HOMARD_Zone_i* aZoneServant = dynamic_cast(aServant.in()); + if (aZoneServant) { + f << HOMARD::GetSignature(HOMARD::Zone) << aZoneServant->Dump() << std::endl; + context._idmap[id++] = dynamic_cast(aZoneServant); + } + } + // -> save hypotheses + std::map::const_iterator it_hypo; + for (it_hypo = context._mesHypotheses.begin(); it_hypo != context._mesHypotheses.end(); ++it_hypo) { + HOMARD::HOMARD_Hypothesis_var aHypo = it_hypo->second; + PortableServer::ServantBase_var aServant = GetServant(aHypo); + HOMARD_Hypothesis_i* aHypoServant = dynamic_cast(aServant.in()); + if (aHypoServant) { + f << HOMARD::GetSignature(HOMARD::Hypothesis) << aHypoServant->Dump() << std::endl; + context._idmap[id++] = dynamic_cast(aHypoServant); + } + } + // -> save iterations + std::map::const_iterator it_iter; + for (it_iter = context._mesIterations.begin(); it_iter != context._mesIterations.end(); ++it_iter) { + HOMARD::HOMARD_Iteration_var aIter = it_iter->second; + PortableServer::ServantBase_var aServant = GetServant(aIter); + HOMARD_Iteration_i* aIterServant = dynamic_cast(aServant.in()); + if (aIterServant) { + f << HOMARD::GetSignature(HOMARD::Iteration) << aIterServant->Dump() << std::endl; + context._idmap[id++] = dynamic_cast(aIterServant); + } + } + // -> save boundaries + std::map::const_iterator it_boundary; + for (it_boundary = context._mesBoundarys.begin(); it_boundary != context._mesBoundarys.end(); ++it_boundary) { + HOMARD::HOMARD_Boundary_var aBoundary = it_boundary->second; + PortableServer::ServantBase_var aServant = GetServant(aBoundary); + HOMARD_Boundary_i* aBoundaryServant = dynamic_cast(aServant.in()); + if (aBoundaryServant) { + f << HOMARD::GetSignature(HOMARD::Boundary) << aBoundaryServant->Dump() << std::endl; + context._idmap[id++] = dynamic_cast(aBoundaryServant); + } + } + // -> close file + MESSAGE ("close file"); + f.close(); + + // put temporary files to the stream + MESSAGE ("put temporary files to the stream"); + aStreamFile = SALOMEDS_Tool::PutFilesToStream(tmpDir.c_str(), aFileSeq, isMultiFile); + + // remove temporary files + MESSAGE ("remove temporary files"); + if (!isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(tmpDir.c_str(), aFileSeq, true); + + // return data stream + MESSAGE ("return data stream"); + return aStreamFile._retn(); +}; + +//=========================================================================== +SALOMEDS::TMPFile* HOMARD_Gen_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent, + const char* theURL, + CORBA::Boolean isMultiFile) +{ + // No specific ASCII persistence + SALOMEDS::TMPFile_var aStreamFile = Save(theComponent, theURL, isMultiFile); + return aStreamFile._retn(); +}; + +//=========================================================================== +CORBA::Boolean HOMARD_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, + const SALOMEDS::TMPFile& theStream, + const char* theURL, + CORBA::Boolean isMultiFile) +{ + MESSAGE ("Load pour theURL = "<< theURL); + + // set current study + if (myStudy->_is_nil()) + UpdateStudy(); + + // get temporary directory name + std::string tmpDir = isMultiFile ? std::string(theURL) : SALOMEDS_Tool::GetTmpDir(); + + // Convert the stream into sequence of files to process + SALOMEDS_Tool::ListOfFiles aFileSeq = SALOMEDS_Tool::PutStreamToFiles(theStream, + tmpDir.c_str(), + isMultiFile); + // HOMARD data file name + std::string aFileName = ""; + if (isMultiFile) + aFileName = SALOMEDS_Tool::GetNameFromPath(Kernel_Utils::encode(SMESH_Gen_i::getStudyServant()->URL())); + aFileName = tmpDir + aFileName + "_HOMARD.dat"; + + StudyContext& context = myStudyContext; + + // save data + // -> create file + std::ifstream f(aFileName.c_str()); + + // clear context + context._mesCas.clear(); + context._mesHypotheses.clear(); + context._mesIterations.clear(); + context._mesZones.clear(); + context._mesBoundarys.clear(); + context._idmap.clear(); + + int id = 1; + std::string line; + + while (f) { + std::getline(f, line); + std::string bounSignature = HOMARD::GetSignature(HOMARD::Boundary); + std::string caseSignature = HOMARD::GetSignature(HOMARD::Case); + std::string hypoSignature = HOMARD::GetSignature(HOMARD::Hypothesis); + std::string iterSignature = HOMARD::GetSignature(HOMARD::Iteration); + std::string zoneSignature = HOMARD::GetSignature(HOMARD::Zone); + std::string yacsSignature = HOMARD::GetSignature(HOMARD::YACS); + if (line.substr(0, bounSignature.size()) == bounSignature) { + // re-create boundary + MESSAGE ("Recreation de la frontiere" ); + HOMARD::HOMARD_Boundary_var aBoundary = newBoundary(); + PortableServer::ServantBase_var aServant = GetServant(aBoundary); + HOMARD_Boundary_i* aBoundaryServant = dynamic_cast(aServant.in()); + if (aBoundaryServant && aBoundaryServant->Restore(line.substr(bounSignature.size()))) { + context._mesBoundarys[aBoundary->GetName()] = aBoundary; + context._idmap[id] = dynamic_cast(aBoundaryServant); + } + } + else if (line.substr(0, caseSignature.size()) == caseSignature) { + // re-create case + MESSAGE ("Recreation du cas" ); + HOMARD::HOMARD_Cas_var aCase = newCase(); + PortableServer::ServantBase_var aServant = GetServant(aCase); + HOMARD_Cas_i* aCaseServant = dynamic_cast(aServant.in()); + if (aCaseServant && aCaseServant->Restore(line.substr(caseSignature.size()))) { + context._mesCas[aCase->GetName()] = aCase; + context._idmap[id] = dynamic_cast(aCaseServant); + } + } + else if (line.substr(0, hypoSignature.size()) == hypoSignature) { + // re-create hypothesis + MESSAGE ("Recreation de l hypothese" ); + HOMARD::HOMARD_Hypothesis_var aHypo = newHypothesis(); + PortableServer::ServantBase_var aServant = GetServant(aHypo); + HOMARD_Hypothesis_i* aHypoServant = dynamic_cast(aServant.in()); + if (aHypoServant && aHypoServant->Restore(line.substr(hypoSignature.size()))) { + context._mesHypotheses[aHypo->GetName()] = aHypo; + context._idmap[id] = dynamic_cast(aHypoServant); + } + } + else if (line.substr(0, iterSignature.size()) == iterSignature) { + // re-create iteration + MESSAGE ("Recreation de l'iteration" ); + HOMARD::HOMARD_Iteration_var aIter = newIteration(); + PortableServer::ServantBase_var aServant = GetServant(aIter); + HOMARD_Iteration_i* aIterServant = dynamic_cast(aServant.in()); + if (aIterServant && aIterServant->Restore(line.substr(iterSignature.size()))) { + context._mesIterations[aIter->GetName()] = aIter; + context._idmap[id] = dynamic_cast(aIterServant); + } + } + else if (line.substr(0, zoneSignature.size()) == zoneSignature) { + MESSAGE ("Recreation de la zone" ); + // re-create zone + HOMARD::HOMARD_Zone_var aZone = newZone(); + PortableServer::ServantBase_var aServant = GetServant(aZone); + HOMARD_Zone_i* aZoneServant = dynamic_cast(aServant.in()); + if (aZoneServant && aZoneServant->Restore(line.substr(zoneSignature.size()))) { + context._mesZones[aZone->GetName()] = aZone; + context._idmap[id] = dynamic_cast(aZoneServant); + } + } + else if (line.substr(0, zoneSignature.size()) == yacsSignature) { + MESSAGE ("Recreation du schema YACS" ); + // re-create YACS + HOMARD::HOMARD_YACS_var aYACS = newYACS(); + PortableServer::ServantBase_var aServant = GetServant(aYACS); + HOMARD_YACS_i* aYACSServant = dynamic_cast(aServant.in()); + if (aYACSServant && aYACSServant->Restore(line.substr(yacsSignature.size()))) { + context._mesYACSs[aYACS->GetName()] = aYACS; + context._idmap[id] = dynamic_cast(aYACSServant); + } + } + id++; + } + + // -> close file + f.close(); + + // Remove temporary files created from the stream + if (!isMultiFile) + SALOMEDS_Tool::RemoveTemporaryFiles(tmpDir.c_str(), aFileSeq, true); + + return true; +}; + +//=========================================================================== +CORBA::Boolean HOMARD_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent, + const SALOMEDS::TMPFile& theStream, + const char* theURL, + CORBA::Boolean isMultiFile) +{ + // No specific ASCII persistence + return Load(theComponent, theStream, theURL, isMultiFile); +}; + +//=========================================================================== +void HOMARD_Gen_i::Close(SALOMEDS::SComponent_ptr theComponent) +{ +}; + +//=========================================================================== +char* HOMARD_Gen_i::ComponentDataType() +{ + return CORBA::string_dup("HOMARD"); +}; + +//=========================================================================== +char* HOMARD_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, + const char* IORString, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII) +{ + CORBA::String_var aString(""); + if (!CORBA::is_nil(theSObject) && strcmp(IORString, "") != 0) { + StudyContext context = myStudyContext; + CORBA::Object_var anObj = _orb->string_to_object(IORString); + if (!CORBA::is_nil(anObj)) { + PortableServer::ServantBase_var aServant = GetServant(anObj); + PortableServer::ServantBase* aStorable = dynamic_cast(aServant.in()); + if (aStorable) { + std::map::const_iterator it; + for (it = context._idmap.begin(); it != context._idmap.end(); ++it) { + if (it->second == aStorable) { + std::stringstream os; + os << it->first; + aString = CORBA::string_dup(os.str().c_str()); + } + } + } + } + } + return aString._retn(); +}; + +//=========================================================================== +char* HOMARD_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, + const char* aLocalPersistentID, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII) +{ + CORBA::String_var aString(""); + if (!CORBA::is_nil(theSObject) && strcmp(aLocalPersistentID, "") != 0) { + StudyContext context = myStudyContext; + int id = atoi(aLocalPersistentID); + if (id > 0 && context._idmap.find(id) != context._idmap.end()) { + CORBA::Object_var object = _poa->servant_to_reference(context._idmap[ id ]); + if (!CORBA::is_nil(object)) { + aString = _orb->object_to_string(object); + } + } + } + return aString._retn(); +}; + +//=========================================================================== +CORBA::Boolean HOMARD_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR) +{ + if(CORBA::is_nil(myStudy)) + return false; + + HOMARD::HOMARD_Cas_var aCas = HOMARD::HOMARD_Cas::_narrow(theIOR); + if(!aCas->_is_nil()) + return true; + + HOMARD::HOMARD_Hypothesis_var aHypo = HOMARD::HOMARD_Hypothesis::_narrow(theIOR); + if(!aHypo->_is_nil()) + return true; + + HOMARD::HOMARD_Zone_var aZone = HOMARD::HOMARD_Zone::_narrow(theIOR); + if(!aZone->_is_nil()) + return true; + + HOMARD::HOMARD_Boundary_var aBoundary = HOMARD::HOMARD_Boundary::_narrow(theIOR); + if(!aBoundary->_is_nil()) + return true; + + /* Iteration is not published directly + HOMARD::HOMARD_Iteration_var aIter = HOMARD::HOMARD_Iteration::_narrow(theIOR); + if(!aIter->_is_nil()) + return true; + */ + return false; +}; + +//=========================================================================== +CORBA::Boolean HOMARD_Gen_i::CanCopy(SALOMEDS::SObject_ptr theObject) +{ + // No Copy/Paste support + return false; +}; + +//=========================================================================== +SALOMEDS::TMPFile* HOMARD_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, + CORBA::Long& theObjectID) +{ + // No Copy/Paste support + SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(0); + return aStreamFile._retn(); +}; + +//=========================================================================== +CORBA::Boolean HOMARD_Gen_i::CanPaste(const char *theComponentName, + CORBA::Long theObjectID) +{ + // No Copy/Paste support + return false; +}; + +//=========================================================================== +SALOMEDS::SObject_ptr HOMARD_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream, + CORBA::Long theObjectID, + SALOMEDS::SObject_ptr theSObject) +{ + // No Copy/Paste support + SALOMEDS::SObject_var aResultSO; + return aResultSO._retn(); +}; + +//=========================================================================== +PortableServer::ServantBase_var HOMARD_Gen_i::GetServant(CORBA::Object_ptr theObject) +{ + PortableServer::Servant aServant = 0; + if (!CORBA::is_nil(theObject)) { + try { + aServant = _poa->reference_to_servant(theObject); + } + catch (...) { + } + } + return aServant; +} + +//========================================================================== +Engines::TMPFile* HOMARD_Gen_i::DumpPython(CORBA::Boolean isPublished, + CORBA::Boolean isMultiFile, + CORBA::Boolean& isValidScript) +{ + MESSAGE ("Entree dans DumpPython"); + isValidScript=1; + + SALOMEDS::SObject_var aSO = SMESH_Gen_i::getStudyServant()->FindComponent("HOMARD"); + if(CORBA::is_nil(aSO)) + return new Engines::TMPFile(0); + + std::string aScript = "\"\"\"\n"; + aScript += "Python script for HOMARD\n"; + aScript += "Copyright 1996, 2011, 2015 EDF\n"; + aScript += "\"\"\"\n"; + aScript += "__revision__ = \"V1.2\"\n"; + aScript += "import HOMARD\n"; + if( isMultiFile ) + aScript += "import salome\n"; + aScript += "homard = salome.lcc.FindOrLoadComponent('FactoryServer','HOMARD')\n"; + aScript += "\thomard.UpdateStudy()\n"; + MESSAGE (". Au depart \n"< 0) + { + MESSAGE (". Ecritures des frontieres"); + aScript += "#\n# Creation of the boundaries"; + aScript += "\n# =========================="; + } + std::map::const_iterator it_boundary; + for (it_boundary = myStudyContext._mesBoundarys.begin(); + it_boundary != myStudyContext._mesBoundarys.end(); ++it_boundary) + { + HOMARD::HOMARD_Boundary_var maBoundary = (*it_boundary).second; + CORBA::String_var dumpCorbaBoundary = maBoundary->GetDumpPython(); + std::string dumpBoundary = dumpCorbaBoundary.in(); + MESSAGE (dumpBoundary<<"\n"); + aScript += dumpBoundary; + } + + + if (myStudyContext._mesZones.size() > 0) + { + MESSAGE (". Ecritures des zones"); + aScript += "#\n# Creation of the zones"; + aScript += "\n# ====================="; + } + std::map::const_iterator it_zone; + for ( it_zone = myStudyContext._mesZones.begin(); + it_zone != myStudyContext._mesZones.end(); ++it_zone) + { + HOMARD::HOMARD_Zone_var myZone = (*it_zone).second; + CORBA::String_var dumpCorbaZone = myZone->GetDumpPython(); + std::string dumpZone = dumpCorbaZone.in(); + MESSAGE (dumpZone<<"\n"); + aScript += dumpZone; + } + + + if (myStudyContext._mesHypotheses.size() > 0) + { + MESSAGE (". Ecritures des hypotheses"); + aScript += "#\n# Creation of the hypotheses"; + aScript += "\n# =========================="; + } + std::map::const_iterator it_hypo; + for ( it_hypo = myStudyContext._mesHypotheses.begin(); + it_hypo != myStudyContext._mesHypotheses.end(); it_hypo++) + { + HOMARD::HOMARD_Hypothesis_var monHypo = (*it_hypo).second; + CORBA::String_var dumpCorbaHypo = monHypo->GetDumpPython(); + std::string dumpHypo = dumpCorbaHypo.in(); + MESSAGE (dumpHypo<<"\n"); + aScript += dumpHypo; + } + + + if (myStudyContext._mesCas.size() > 0) + { + MESSAGE (". Ecritures des cas"); + aScript += "#\n# Creation of the cases"; + aScript += "\n# ====================="; + } + std::map::const_iterator it_cas; + for (it_cas = myStudyContext._mesCas.begin(); + it_cas != myStudyContext._mesCas.end(); it_cas++) + { + std::string nomCas = (*it_cas).first; + std::string dumpCas = std::string("\n# Creation of the case ") ; + dumpCas += nomCas + std::string("\n"); + dumpCas += std::string("\t") + nomCas; + dumpCas += std::string(" = homard.CreateCase(\"") + nomCas + std::string("\", \""); + + HOMARD::HOMARD_Cas_var myCase = (*it_cas).second; + CORBA::String_var cIter0= myCase->GetIter0Name(); + std::string iter0 = cIter0.in(); + + HOMARD::HOMARD_Iteration_var myIteration = myStudyContext._mesIterations[iter0]; + CORBA::String_var cMesh0= myIteration->GetMeshFile(); + std::string mesh0 = cMesh0.in(); + CORBA::String_var cMeshName0= myIteration->GetMeshName(); + std::string meshName0 = cMeshName0.in(); + dumpCas += meshName0 + std::string("\", \"")+ mesh0 + std::string("\")\n"); + CORBA::String_var dumpCorbaCase = myCase->GetDumpPython(); + std::string dumpCas2= dumpCorbaCase.in(); + + MESSAGE (dumpCas< 0) + { + MESSAGE (". Ecritures des iterations"); + aScript += "#\n# Creation of the iterations" ; + aScript += "\n# =========================="; + } + std::map::const_iterator it_iter; + for (it_iter = myStudyContext._mesIterations.begin(); + it_iter != myStudyContext._mesIterations.end(); ++it_iter) + { + HOMARD::HOMARD_Iteration_var aIter = (*it_iter).second; + CORBA::String_var dumpCorbaIter = aIter->GetDumpPython(); + std::string dumpIter = dumpCorbaIter.in(); + MESSAGE (dumpIter<<"\n"); + aScript += dumpIter; + } + + + if (myStudyContext._mesYACSs.size() > 0) + { + MESSAGE (". Ecritures des schemas YACS"); + aScript += "#\n# Creation of the schemas YACS"; + aScript += "\n# ============================"; + } + std::map::const_iterator it_yacs; + for ( it_yacs = myStudyContext._mesYACSs.begin(); + it_yacs != myStudyContext._mesYACSs.end(); ++it_yacs) + { + HOMARD::HOMARD_YACS_var myYACS = (*it_yacs).second; + CORBA::String_var dumpCorbaYACS = myYACS->GetDumpPython(); + std::string dumpYACS = dumpCorbaYACS.in(); + MESSAGE (dumpYACS<<"\n"); + aScript += dumpYACS; + } + + MESSAGE (". Ecritures finales"); + if( isMultiFile ) + aScript += "\n\tpass"; + aScript += "\n"; + + if( !isMultiFile ) // remove unnecessary tabulation + aScript = RemoveTabulation( aScript ); + +// MESSAGE ("A ecrire \n"<::const_iterator it; + for (it = myStudyContext._mesCas.begin(); + it != myStudyContext._mesCas.end(); it++) + { + if (std::string(nomDir) == std::string(it->second->GetDirName())) + { + casename = std::string(it->second->GetName()) ; + break ; + } + } + return CORBA::string_dup( casename.c_str() ); +} +/*//============================================================================= +void SALOMEException( std::string message ) +{ + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = message; + throw SALOME::SALOME_Exception(es); + return ; +}*/ +//============================================================================= +char* HOMARD_Gen_i::getVersion() +{ +#if HOMARD_DEVELOPMENT + return CORBA::string_dup(HOMARD_VERSION_STR"dev"); +#else + return CORBA::string_dup(HOMARD_VERSION_STR); +#endif +} +//=============================================================================== +// Recuperation de la chaine de caracteres par rapport a l'apparition d'un caractere +// ligne : la ligne a manipuler +// caractere : le caractere a reperer +// option : 0 : la chaine avant la premiere apparition du caractere +// 1 : la chaine apres la premiere apparition du caractere +// 2 : la chaine avant la derniere apparition du caractere +// 3 : la chaine apres la derniere apparition du caractere +// Si le caractere est absent, on retourne la chaine totale +//=============================================================================== +std::string HOMARD_Gen_i::GetStringInTexte( const std::string ligne, const std::string caractere, int option ) +{ +// MESSAGE("GetStringInTexte, recherche de '"<> mot_cle ; + chaine = GetStringInTexte ( mot_cle, "\"", 1 ) ; + chaine = GetStringInTexte ( chaine, "\"", 0 ) ; + if ( chaine == "language" ) { section_langue = true ; } + if ( chaine == "HOMARD" ) { section_homard = true ; } + // MESSAGE ( "section_langue = "<" ) + { /*MESSAGE ( "Fin de la section : "<< ligne<<", section_langue = "<> PublisMeshIN ; } + if ( chaine2 == "publish_mesh_out" ) { chainebis >> PublisMeshOUT ; } + // 3.2.2. Les maximum pour YACS + if ( chaine2 == "yacs_max_iter" ) { chainebis >> YACSMaxIter ; } + if ( chaine2 == "yacs_max_node" ) { chainebis >> YACSMaxNode ; } + if ( chaine2 == "yacs_max_elem" ) { chainebis >> YACSMaxElem ; } + if ( chaine2 == "yacs_type_test" ) { YACSTypeTestchaine = chaine ; } + } + } + } + } + } + + // C. Enregistrements + MESSAGE ("Enregistrement de LanguageShort = " << LanguageShort ); + SetLanguageShort( LanguageShort.c_str() ) ; + + MESSAGE ("Enregistrement de PublisMeshIN = " << PublisMeshIN<<", PublisMeshOUT = "<< PublisMeshOUT); + SetPublisMesh(PublisMeshIN, PublisMeshOUT) ; + + MESSAGE ("Enregistrement de YACSMaxIter = " << YACSMaxIter<<", YACSMaxNode = "<< YACSMaxNode<<", YACSMaxElem = "<< YACSMaxElem); + SetYACSMaximum(YACSMaxIter, YACSMaxNode, YACSMaxElem) ; + + MESSAGE ("Enregistrement de TypeTest = " << YACSTypeTestchaine.c_str() ); + int YACSTypeTest ; + if ( ( YACSTypeTestchaine == "VTest > VRef" ) || ( YACSTypeTestchaine == "VTest > VRef" ) ) { YACSTypeTest = 1 ; } + else if ( ( YACSTypeTestchaine == "VTest < VRef" ) || ( YACSTypeTestchaine == "VTest < VRef" ) ) { YACSTypeTest = 2 ; } + else { YACSTypeTest = 0 ; } + MESSAGE ("==> TypeTest = " << YACSTypeTest ); + SetYACSConvergenceType( YACSTypeTest ) ; + + return ; +} +//=============================================================================== +// Langue de SALOME +//=============================================================================== +void HOMARD_Gen_i::SetLanguageShort(const char* LanguageShort) +{ +// MESSAGE ("SetLanguageShort pour LanguageShort = " << LanguageShort ); + _LangueShort = LanguageShort ; + if ( _LangueShort == "fr" ) { _Langue = "Francais" ; } + else { _Langue = "English" ; } + return ; +} +char* HOMARD_Gen_i::GetLanguageShort() +{ +// MESSAGE ("GetLanguageShort"); + return CORBA::string_dup( _LangueShort.c_str() ); +} +//=============================================================================== +// Options de publications +//=============================================================================== +void HOMARD_Gen_i::SetPublisMesh(CORBA::Long PublisMeshIN, CORBA::Long PublisMeshOUT) +{ + _PublisMeshIN = PublisMeshIN ; + _PublisMeshOUT = PublisMeshOUT ; + return ; +} +CORBA::Long HOMARD_Gen_i::GetPublisMeshIN() +{ + return _PublisMeshIN ; +} +CORBA::Long HOMARD_Gen_i::GetPublisMeshOUT() +{ + return _PublisMeshOUT ; +} +//=============================================================================== +// YACS - test de convergence +//=============================================================================== +void HOMARD_Gen_i::SetYACSMaximum(CORBA::Long YACSMaxIter, CORBA::Long YACSMaxNode, CORBA::Long YACSMaxElem) +{ + _YACSMaxIter = YACSMaxIter ; + _YACSMaxNode = YACSMaxNode ; + _YACSMaxElem = YACSMaxElem ; + return ; +} +CORBA::Long HOMARD_Gen_i::GetYACSMaxIter() +{ + return _YACSMaxIter ; +} +CORBA::Long HOMARD_Gen_i::GetYACSMaxNode() +{ + return _YACSMaxNode ; +} +CORBA::Long HOMARD_Gen_i::GetYACSMaxElem() +{ + return _YACSMaxElem ; +} +void HOMARD_Gen_i::SetYACSConvergenceType(CORBA::Long YACSTypeTest) +{ + _YACSTypeTest = YACSTypeTest ; + return ; +} +CORBA::Long HOMARD_Gen_i::GetYACSConvergenceType() +{ + return _YACSTypeTest ; +} + +//============================================================================= +extern "C" +{ + HOMARDENGINE_EXPORT + PortableServer::ObjectId* HOMARDEngine_factory(CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId* contId, + const char* instanceName, + const char* interfaceName) + { + MESSAGE("PortableServer::ObjectId* HOMARDEngine_factory()"); + HOMARD_Gen_i* myHOMARD_Gen = new HOMARD_Gen_i(orb, poa, contId, instanceName, interfaceName); + return myHOMARD_Gen->getId(); + } +} diff --git a/src/ADAPT_I/HOMARD_Gen_i.hxx b/src/ADAPT_I/HOMARD_Gen_i.hxx new file mode 100644 index 000000000..10c07cec4 --- /dev/null +++ b/src/ADAPT_I/HOMARD_Gen_i.hxx @@ -0,0 +1,347 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef _HOMARD_GEN_I_HXX_ +#define _HOMARD_GEN_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(HOMARD_Gen) +#include CORBA_SERVER_HEADER(HOMARD_Cas) +#include CORBA_SERVER_HEADER(HOMARD_Hypothesis) +#include CORBA_SERVER_HEADER(HOMARD_Iteration) +#include CORBA_SERVER_HEADER(HOMARD_Zone) +#include CORBA_SERVER_HEADER(HOMARD_Boundary) +#include CORBA_SERVER_HEADER(HOMARD_YACS) +#include CORBA_CLIENT_HEADER(SALOMEDS) +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) + +#include "HOMARD_i.hxx" +#include "HOMARD_Gen.hxx" +#include "HomardDriver.hxx" +#include "YACSDriver.hxx" +#include "FrontTrack.hxx" +#include "SALOME_Component_i.hxx" +#include "SALOME_NamingService.hxx" +#include "Utils_CorbaException.hxx" + +#include +#include + +class HOMARDENGINE_EXPORT HOMARD_Gen_i: + public virtual Engines_Component_i, + public virtual POA_HOMARD::HOMARD_Gen +{ +public: + HOMARD_Gen_i( CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId* contId, + const char* instanceName, + const char* interfaceName ); + virtual ~HOMARD_Gen_i(); + + +// Generalites + +// Les creations + HOMARD::HOMARD_Boundary_ptr CreateBoundary (const char* nomBoundary, CORBA::Long typeBoundary); + HOMARD::HOMARD_Boundary_ptr CreateBoundaryCAO(const char* nomBoundary, + const char* DataFile); + HOMARD::HOMARD_Boundary_ptr CreateBoundaryDi (const char* nomBoundary, + const char* MeshName, const char* DataFile); + HOMARD::HOMARD_Boundary_ptr CreateBoundaryCylinder (const char* nomBoundary, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Xaxis, CORBA::Double Yaxis, CORBA::Double Zaxis, + CORBA::Double Rayon); + HOMARD::HOMARD_Boundary_ptr CreateBoundarySphere (const char* nomBoundary, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Rayon); + HOMARD::HOMARD_Boundary_ptr CreateBoundaryConeR (const char* nomBoundary, + CORBA::Double Xcentre1, CORBA::Double Ycentre1, CORBA::Double Zcentre1, CORBA::Double Rayon1, + CORBA::Double Xcentre2, CORBA::Double Ycentre2, CORBA::Double Zcentre2, CORBA::Double Rayon2); + HOMARD::HOMARD_Boundary_ptr CreateBoundaryConeA (const char* nomBoundary, + CORBA::Double Xaxis, CORBA::Double Yaxis, CORBA::Double Zaxis, CORBA::Double Angle, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre); + HOMARD::HOMARD_Boundary_ptr CreateBoundaryTorus (const char* nomBoundary, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Xaxis, CORBA::Double Yaxis, CORBA::Double Zaxis, + CORBA::Double RayonRev, CORBA::Double RayonPri); + + HOMARD::HOMARD_Cas_ptr CreateCase (const char* nomCas, const char* MeshName, const char* FileName); + HOMARD::HOMARD_Cas_ptr CreateCaseFromIteration (const char* nomCas, const char* DirNameStart); + HOMARD::HOMARD_Cas_ptr CreateCaseFromCaseLastIteration (const char* nomCas, const char* DirNameStart); + HOMARD::HOMARD_Cas_ptr CreateCaseFromCaseIteration (const char* nomCas, const char* DirNameStart, CORBA::Long Number); + HOMARD::HOMARD_Cas_ptr CreateCase0 (const char* nomCas, const char* MeshName, const char* FileName, CORBA::Long MeshOption, CORBA::Long NumeIter, CORBA::Long Option); + std::string CreateCase1 (const char* DirNameStart, CORBA::Long Number); + + HOMARD::HOMARD_Hypothesis_ptr CreateHypothesis(const char* nomHypothesis); + + HOMARD::HOMARD_Iteration_ptr CreateIteration (const char* nomIter, const char* nomIterParent); + + HOMARD::HOMARD_Zone_ptr CreateZone (const char* nomZone, CORBA::Long typeZone); + HOMARD::HOMARD_Zone_ptr CreateZoneBox (const char* nomZone, + CORBA::Double Xmini, CORBA::Double Xmaxi, + CORBA::Double Ymini, CORBA::Double Ymaxi, + CORBA::Double Zmini, CORBA::Double Zmaxi); + HOMARD::HOMARD_Zone_ptr CreateZoneBox2D (const char* nomZone, + CORBA::Double Umini, CORBA::Double Umaxi, + CORBA::Double Vmini, CORBA::Double Vmaxi, + CORBA::Long Orient); + HOMARD::HOMARD_Zone_ptr CreateZoneCylinder (const char* nomZone, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, + CORBA::Double Rayon, CORBA::Double Haut); + HOMARD::HOMARD_Zone_ptr CreateZoneDisk (const char* nomZone, + CORBA::Double Ucentre, CORBA::Double Vcentre, + CORBA::Double Rayon, + CORBA::Long Orient); + HOMARD::HOMARD_Zone_ptr CreateZoneDiskWithHole (const char* nomZone, + CORBA::Double Ucentre, CORBA::Double Vcentre, + CORBA::Double Rayon, CORBA::Double Rayonint, + CORBA::Long Orient); + HOMARD::HOMARD_Zone_ptr CreateZonePipe (const char* nomZone, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, + CORBA::Double Rayon, CORBA::Double Haut, CORBA::Double Rayonint); + HOMARD::HOMARD_Zone_ptr CreateZoneSphere (const char* nomZone, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, CORBA::Double Rayon); + +// Les informations + HOMARD::HOMARD_Boundary_ptr GetBoundary (const char* nomBoundary); + HOMARD::HOMARD_Cas_ptr GetCase (const char* nomCas); + HOMARD::HOMARD_Hypothesis_ptr GetHypothesis (const char* nomHypothesis); + HOMARD::HOMARD_Iteration_ptr GetIteration (const char* nomIteration); + HOMARD::HOMARD_YACS_ptr GetYACS (const char* nomYACS); + HOMARD::HOMARD_Zone_ptr GetZone (const char* nomZone); + + HOMARD::listeBoundarys* GetAllBoundarysName(); + HOMARD::listeCases* GetAllCasesName(); + HOMARD::listeHypotheses* GetAllHypothesesName(); + HOMARD::listeIterations* GetAllIterationsName(); + HOMARD::listeYACSs* GetAllYACSsName(); + HOMARD::listeZones* GetAllZonesName(); + + void MeshInfo (const char* nomCas, + const char* MeshName, const char* FileName, const char* DirName, + CORBA::Long Qual, CORBA::Long Diam, CORBA::Long Conn, CORBA::Long Tail, CORBA::Long Inte); + + HOMARD::HOMARD_Iteration_ptr LastIteration (const char* nomCas); + +// L'etude + void UpdateStudy(); + void IsValidStudy(); + +// Liens entre structures + void InvalideBoundary(const char* nomBoundary); + void InvalideHypo(const char* nomHypo); + void InvalideIter(const char* nomIter); + void InvalideIterOption(const char* nomIter, CORBA::Long Option); + void InvalideIterInfo(const char* nomIter); + void InvalideYACS(const char* nomYACS); + void InvalideZone(const char* nomZone); + + CORBA::Long DeleteBoundary(const char* nomBoundary); + CORBA::Long DeleteCase(const char* nomCas, CORBA::Long Option); + CORBA::Long DeleteHypo(const char* nomHypothesis); + CORBA::Long DeleteIteration(const char* nomIter, CORBA::Long Option); + CORBA::Long DeleteIterationOption(const char* nomIter, CORBA::Long Option1, CORBA::Long Option2); + CORBA::Long DeleteYACS(const char* nomYACS, CORBA::Long Option); + CORBA::Long DeleteZone(const char* nomZone); + + void AssociateIterHypo(const char* nomIter, const char* nomHypothesis); + + void AssociateHypoZone(const char* nomHypothesis, const char* nomZone, CORBA::Long TypeUse); + void DissociateHypoZone(const char* nomHypothesis, const char* nomZone); + + void AssociateCaseIter(const char* nomCas, const char* nomIter, + const char* labelIter); + +// Actions + void SetEtatIter(const char* nomIter,const CORBA::Long Etat); + char* CreateDirNameIter(const char* nomrep, CORBA::Long num ); + + CORBA::Long Compute(const char* nomIteration, CORBA::Long etatMenage, CORBA::Long modeHOMARD, CORBA::Long Option1, CORBA::Long Option2); + CORBA::Long ComputeAdap(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage, HomardDriver* myDriver, CORBA::Long Option1, CORBA::Long Option2); + CORBA::Long ComputeCAO(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long Option1, CORBA::Long Option2); + CORBA::Long ComputeCAObis(HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long Option1, CORBA::Long Option2); + char* ComputeDirManagement(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage); + char* ComputeDirPaManagement(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration); + void DriverTexteZone(HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver); + void DriverTexteField(HOMARD::HOMARD_Iteration_var myIteration, HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver); + int DriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, HomardDriver* myDriver); + void DriverTexteFieldInterp(HOMARD::HOMARD_Iteration_var myIteration, HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver); + + char* VerifieDir(const char* nomDir); + + void PublishFileUnderIteration(const char* NomIter, const char* NomFich, const char* Commentaire); + void PublishFileUnderYACS(const char* NomYACS, const char* NomFich, const char* Commentaire); + void PublishBoundaryUnderCase(const char* CaseName, const char* BoundaryName); + void PublishCaseUnderYACS(const char* YACSName, const char* CaseName); + void PublishResultInSmesh(const char* NomFich, CORBA::Long Option); + void DeleteResultInSmesh(std::string NomFich, std::string MeshName); + void PublishMeshIterInSmesh(const char* NomIter); + +// YACS + HOMARD::HOMARD_YACS_ptr CreateYACSSchema (const char* YACSName, const char* nomCas, const char* ScriptFile, const char* DirName, const char* MeshFile); + CORBA::Long YACSWrite(const char* nomYACS); + CORBA::Long YACSWriteOnFile(const char* nomYACS, const char* XMLFile); + std::string YACSDriverTexteZone(HOMARD::HOMARD_Hypothesis_var myHypo, YACSDriver* myDriver); + std::string YACSDriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, YACSDriver* myDriver); + +// Preferences + void SetPreferences() ; + void SetLanguageShort(const char* LanguageShort); + char* GetLanguageShort(); + void SetPublisMesh(CORBA::Long PublisMeshIN, CORBA::Long PublisMeshOUT); + CORBA::Long GetPublisMeshIN(); + CORBA::Long GetPublisMeshOUT(); + void SetYACSMaximum(CORBA::Long YACSMaxIter, CORBA::Long YACSMaxNode, CORBA::Long YACSMaxElem); + CORBA::Long GetYACSMaxIter(); + CORBA::Long GetYACSMaxNode(); + CORBA::Long GetYACSMaxElem(); + void SetYACSConvergenceType(CORBA::Long YACSTypeTest); + CORBA::Long GetYACSConvergenceType(); + + + // --------------------------------------------------------------- + // next functions are inherited from SALOMEDS::Driver interface + // --------------------------------------------------------------- + + // --> Persistence + virtual SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent, + const char* theURL, + CORBA::Boolean isMultiFile); + + virtual SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent, + const char* theURL, + CORBA::Boolean isMultiFile); + + virtual CORBA::Boolean Load(SALOMEDS::SComponent_ptr theComponent, + const SALOMEDS::TMPFile& theStream, + const char* theURL, + CORBA::Boolean isMultiFile); + + virtual CORBA::Boolean LoadASCII(SALOMEDS::SComponent_ptr theComponent, + const SALOMEDS::TMPFile& theStream, + const char* theURL, + CORBA::Boolean isMultiFile); + + virtual void Close(SALOMEDS::SComponent_ptr IORSComponent); + + virtual char* ComponentDataType(); + + virtual char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, + const char* IORString, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII); + + virtual char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, + const char* aLocalPersistentID, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII); + + // --> Data publishing + virtual CORBA::Boolean CanPublishInStudy(CORBA::Object_ptr theIOR); + + virtual SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::SObject_ptr theSObject, + CORBA::Object_ptr theObject, + const char* theName); + + // --> Copy/Paste + virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject); + + virtual SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, + CORBA::Long& theObjectID); + + virtual CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID); + + virtual SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream, + CORBA::Long theObjectID, + SALOMEDS::SObject_ptr theObject); + +// virtual void SALOMEException( std::string message ); + +private: + SALOMEDS::SObject_ptr PublishBoundaryInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, + HOMARD::HOMARD_Boundary_ptr theObject, const char* theName); + SALOMEDS::SObject_ptr PublishCaseInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, + HOMARD::HOMARD_Cas_ptr theObject, const char* theName); + SALOMEDS::SObject_ptr PublishHypotheseInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, + HOMARD::HOMARD_Hypothesis_ptr theObject, const char* theName); + SALOMEDS::SObject_ptr PublishYACSInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, + HOMARD::HOMARD_YACS_ptr theObject, const char* theName); + SALOMEDS::SObject_ptr PublishZoneInStudy(SALOMEDS::StudyBuilder_var aStudyBuilder, + HOMARD::HOMARD_Zone_ptr theObject, const char* theName); + virtual void PublishInStudyAttr(SALOMEDS::StudyBuilder_var aStudyBuilder, + SALOMEDS::SObject_var aResultSO, + const char* theName, const char* comment, const char* icone, const char* ior); + + PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject); + + HOMARD::HOMARD_Boundary_ptr newBoundary(); + HOMARD::HOMARD_Cas_ptr newCase(); + HOMARD::HOMARD_Hypothesis_ptr newHypothesis(); + HOMARD::HOMARD_Iteration_ptr newIteration(); + HOMARD::HOMARD_YACS_ptr newYACS(); + HOMARD::HOMARD_Zone_ptr newZone(); + + + virtual Engines::TMPFile* DumpPython(CORBA::Boolean isPublished, + CORBA::Boolean isMultiFile, + CORBA::Boolean& isValidScript); + + virtual char* getVersion(); + std::string GetStringInTexte( const std::string Texte, const std::string String, int option ) ; + +private: + struct StudyContext + { + std::map _mesBoundarys; + std::map _mesCas; + std::map _mesHypotheses; + std::map _mesIterations; + std::map _mesYACSs; + std::map _mesZones; + std::map _idmap; + }; + + ::HOMARD_Gen* myHomard; + SALOMEDS::Study_var myStudy; + StudyContext myStudyContext; + SALOME_NamingService* _NS; + + int _tag_gene ; + int _tag_boun ; + int _tag_hypo ; + int _tag_yacs ; + int _tag_zone ; + +// Preferences + std::string _Langue ; + std::string _LangueShort ; + int _PublisMeshIN ; + int _PublisMeshOUT ; + int _YACSMaxIter ; + int _YACSMaxNode ; + int _YACSMaxElem ; + int _YACSTypeTest ; + ; + +}; + +#endif diff --git a/src/ADAPT_I/HOMARD_Hypothesis_i.cxx b/src/ADAPT_I/HOMARD_Hypothesis_i.cxx new file mode 100644 index 000000000..f9c5249f7 --- /dev/null +++ b/src/ADAPT_I/HOMARD_Hypothesis_i.cxx @@ -0,0 +1,506 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// 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 "HOMARD_Hypothesis_i.hxx" +#include "HOMARD_Gen_i.hxx" +#include "HOMARD_Hypothesis.hxx" +#include "HOMARD_DriverTools.hxx" + +#include "utilities.h" + +//============================================================================= +/*! + * 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, + HOMARD::HOMARD_Gen_var engine ) +{ + MESSAGE( "standard constructor" ); + _gen_i = engine; + _orb = orb; + myHomardHypothesis = new ::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 HOMARD::Dump( *myHomardHypothesis ); +} +//============================================================================= +bool HOMARD_Hypothesis_i::Restore( const std::string& stream ) +{ + return HOMARD::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 ); +} +//============================================================================= +HOMARD::listeTypes* HOMARD_Hypothesis_i::GetAdapRefinUnRef() +{ + ASSERT( myHomardHypothesis ); + HOMARD::listeTypes_var aResult = new HOMARD::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 ); +} +//============================================================================= +HOMARD::InfosHypo* HOMARD_Hypothesis_i::GetField() +{ + ASSERT( myHomardHypothesis ); + HOMARD::InfosHypo* aInfosHypo = new HOMARD::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(); +} +//============================================================================= +HOMARD::listeComposantsHypo* HOMARD_Hypothesis_i::GetComps() +{ + ASSERT( myHomardHypothesis ); + const std::list& ListString = myHomardHypothesis->GetComps(); + HOMARD::listeComposantsHypo_var aResult = new HOMARD::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 HOMARD::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 ); +} +//============================================================================= +HOMARD::ListGroupType* HOMARD_Hypothesis_i::GetGroups() +{ + ASSERT( myHomardHypothesis ); + const std::list& ListString = myHomardHypothesis->GetGroups(); + HOMARD::ListGroupType_var aResult = new HOMARD::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(); +} +//============================================================================= +HOMARD::listeFieldInterpsHypo* HOMARD_Hypothesis_i::GetFieldInterps() +{ + ASSERT( myHomardHypothesis ); + const std::list& ListString = myHomardHypothesis->GetFieldInterps(); + HOMARD::listeFieldInterpsHypo_var aResult = new HOMARD::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 ); +} +//============================================================================= +HOMARD::listeIters* HOMARD_Hypothesis_i::GetIterations() +{ + ASSERT( myHomardHypothesis ); + const std::list& ListString = myHomardHypothesis->GetIterations(); + HOMARD::listeIters_var aResult = new HOMARD::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(); +} +//============================================================================= +void HOMARD_Hypothesis_i::AddZone( const char* NomZone, CORBA::Long TypeUse ) +{ + MESSAGE ("Dans AddZone pour " << NomZone << " et TypeUse = " << TypeUse ) ; + ASSERT( myHomardHypothesis ); + VERIFICATION( (TypeUse==1) || (TypeUse==-1) ); + myHomardHypothesis->SetAdapType( 0 ); + int TypeRaff, TypeDera ; + if ( TypeUse == 1 ) + { + TypeRaff = 1 ; + TypeDera = myHomardHypothesis->GetUnRefType() ; + } + else if ( TypeUse == -1 ) + { + TypeRaff = myHomardHypothesis->GetRefinType() ; + TypeDera = 1 ; + } + myHomardHypothesis->SetRefinTypeDera( TypeRaff, TypeDera ); + char* NomHypo = GetName() ; + return _gen_i->AssociateHypoZone(NomHypo, NomZone, TypeUse) ; +} +//============================================================================= +void HOMARD_Hypothesis_i::AddZone0( const char* NomZone, CORBA::Long TypeUse ) +{ + MESSAGE ("Dans AddZone0 pour " << NomZone) ; + ASSERT( myHomardHypothesis ); + myHomardHypothesis->AddZone( NomZone, TypeUse ); +} +//============================================================================= +void HOMARD_Hypothesis_i::SupprZone(const char * NomZone) +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SupprZone( NomZone); +} +//============================================================================= +void HOMARD_Hypothesis_i::SupprZones() +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SupprZones(); +} +//============================================================================= +HOMARD::listeZonesHypo* HOMARD_Hypothesis_i::GetZones() +{ + ASSERT( myHomardHypothesis ); + const std::list& ListString = myHomardHypothesis->GetZones(); + HOMARD::listeZonesHypo_var aResult = new HOMARD::listeZonesHypo; + 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(); +} diff --git a/src/ADAPT_I/HOMARD_Hypothesis_i.hxx b/src/ADAPT_I/HOMARD_Hypothesis_i.hxx new file mode 100644 index 000000000..79c4e6b24 --- /dev/null +++ b/src/ADAPT_I/HOMARD_Hypothesis_i.hxx @@ -0,0 +1,138 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// 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 _HOMARD_HYPOTHESIS_I_HXX_ +#define _HOMARD_HYPOTHESIS_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(HOMARD_Gen) +#include CORBA_SERVER_HEADER(HOMARD_Hypothesis) + +#include "HOMARD_i.hxx" +#include "SALOME_Component_i.hxx" +#include "SALOME_NamingService.hxx" +#include "Utils_CorbaException.hxx" + +#include + +class HOMARD_Hypothesis; + +class HOMARDENGINE_EXPORT HOMARD_Hypothesis_i: + public virtual Engines_Component_i, + public virtual POA_HOMARD::HOMARD_Hypothesis, + public virtual PortableServer::ServantBase +{ +public: + HOMARD_Hypothesis_i( CORBA::ORB_ptr orb, HOMARD::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 ); + HOMARD::listeTypes* GetAdapRefinUnRef(); + CORBA::Long GetAdapType(); + CORBA::Long GetRefinType(); + CORBA::Long GetUnRefType(); + + void SetField( const char* FieldName ); + char* GetFieldName(); + void SetUseField(CORBA::Long UsField); + HOMARD::InfosHypo* GetField(); + + void SetUseComp(CORBA::Long UsCmpI); + void AddComp( const char* NomComp ); + void SupprComp( const char* NomComp ); + void SupprComps(); + HOMARD::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 HOMARD::ListGroupType& ListGroup); + HOMARD::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(); + HOMARD::listeFieldInterpsHypo* GetFieldInterps(); + +// Liens avec les autres structures + void SetCaseCreation( const char* NomCaseCreation ); + char* GetCaseCreation(); + + void LinkIteration( const char* NomIteration ); + void UnLinkIteration( const char* NomIteration ); + HOMARD::listeIters* GetIterations(); + + void AddZone( const char* NomZone, CORBA::Long TypeUse ); + void AddZone0( const char* NomZone, CORBA::Long TypeUse ); + void SupprZone( const char* NomZone ); + void SupprZones(); + HOMARD::listeZonesHypo* GetZones(); + +private: + ::HOMARD_Hypothesis* myHomardHypothesis; + + CORBA::ORB_ptr _orb; + HOMARD::HOMARD_Gen_var _gen_i; +}; + +#endif diff --git a/src/ADAPT_I/HOMARD_Iteration_i.cxx b/src/ADAPT_I/HOMARD_Iteration_i.cxx new file mode 100644 index 000000000..640c13062 --- /dev/null +++ b/src/ADAPT_I/HOMARD_Iteration_i.cxx @@ -0,0 +1,465 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// 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 "HOMARD_Iteration_i.hxx" +#include "HOMARD_Gen_i.hxx" +#include "HOMARD_Iteration.hxx" +#include "HOMARD_DriverTools.hxx" + +#include "SALOMEDS_Tool.hxx" + +#include "utilities.h" + +//============================================================================= +/*! + * 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, + HOMARD::HOMARD_Gen_var engine ) +{ + MESSAGE("constructor"); + _gen_i = engine; + _orb = orb; + myHomardIteration = new ::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 ) +{ + ASSERT( myHomardIteration ); + char* IterName = GetName() ; + MESSAGE ( "Delete : destruction de l'iteration " << IterName << ", Option = " << Option ); + return _gen_i->DeleteIteration(IterName, Option) ; +} +//============================================================================= +char* HOMARD_Iteration_i::GetDumpPython() +{ + ASSERT( myHomardIteration ); + return CORBA::string_dup( myHomardIteration->GetDumpPython().c_str() ); +} +//============================================================================= +std::string HOMARD_Iteration_i::Dump() const +{ + return HOMARD::Dump( *myHomardIteration ); +} +//============================================================================= +bool HOMARD_Iteration_i::Restore( const std::string& stream ) +{ + return HOMARD::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() ; + HOMARD::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 ); +} +//============================================================================= +HOMARD::listeFieldInterpTSRsIter* HOMARD_Iteration_i::GetFieldInterpsTimeStepRank() +{ + ASSERT( myHomardIteration ); + const std::list& ListString = myHomardIteration->GetFieldInterpsTimeStepRank(); + HOMARD::listeFieldInterpTSRsIter_var aResult = new HOMARD::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 ); +} +//============================================================================= +HOMARD::listeFieldInterpsIter* HOMARD_Iteration_i::GetFieldInterps() +{ + ASSERT( myHomardIteration ); + const std::list& ListString = myHomardIteration->GetFieldInterps(); + HOMARD::listeFieldInterpsIter_var aResult = new HOMARD::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 ) ; +// + return ; +} +//============================================================================= +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 ); +// + return ; +} +//============================================================================= +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 +//============================================================================= +//============================================================================= +HOMARD::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 ); +} +//============================================================================= +HOMARD::listeIterFilles* HOMARD_Iteration_i::GetIterations() +{ + ASSERT( myHomardIteration ); + const std::list& maListe = myHomardIteration->GetIterations(); + HOMARD::listeIterFilles_var aResult = new HOMARD::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() ); +} +//============================================================================= +HOMARD::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() ; +} diff --git a/src/ADAPT_I/HOMARD_Iteration_i.hxx b/src/ADAPT_I/HOMARD_Iteration_i.hxx new file mode 100644 index 000000000..1cc30b67e --- /dev/null +++ b/src/ADAPT_I/HOMARD_Iteration_i.hxx @@ -0,0 +1,145 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// 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 _HOMARD_ITERATION_I_HXX_ +#define _HOMARD_ITERATION_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(HOMARD_Gen) +#include CORBA_SERVER_HEADER(HOMARD_Iteration) + +#include "HOMARD_i.hxx" +#include "SALOME_Component_i.hxx" +#include "SALOME_NamingService.hxx" +#include "Utils_CorbaException.hxx" + +#include + +class HOMARD_Iteration; + +class HOMARDENGINE_EXPORT HOMARD_Iteration_i: + public virtual Engines_Component_i, + public virtual POA_HOMARD::HOMARD_Iteration, + public virtual PortableServer::ServantBase +{ +public: + HOMARD_Iteration_i( CORBA::ORB_ptr orb, + HOMARD::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 ); + + 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 ); + HOMARD::listeFieldInterpTSRsIter* GetFieldInterpsTimeStepRank(); + void SetFieldInterp( const char* FieldInterp ); + HOMARD::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 + HOMARD::HOMARD_Iteration_ptr NextIteration( const char* Name) ; + + void LinkNextIteration( const char* NomIteration ); + void UnLinkNextIteration( const char* NomIteration ); + HOMARD::listeIterFilles* GetIterations(); + + void SetIterParentName( const char* NomIterParent ); + char* GetIterParentName(); + HOMARD::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: + ::HOMARD_Iteration* myHomardIteration; + + CORBA::ORB_ptr _orb; + HOMARD::HOMARD_Gen_var _gen_i; +}; + +#endif diff --git a/src/ADAPT_I/HOMARD_YACS_i.cxx b/src/ADAPT_I/HOMARD_YACS_i.cxx new file mode 100644 index 000000000..749d60d71 --- /dev/null +++ b/src/ADAPT_I/HOMARD_YACS_i.cxx @@ -0,0 +1,279 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// 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 "HOMARD_YACS_i.hxx" +#include "HOMARD_Gen_i.hxx" +#include "HOMARD_YACS.hxx" +#include "HOMARD_DriverTools.hxx" + +#include "SALOMEDS_Tool.hxx" + +#include "utilities.h" + +//============================================================================= +/*! + * standard constructor + */ +//============================================================================= +HOMARD_YACS_i::HOMARD_YACS_i() +{ + MESSAGE( "Default constructor, not for use" ); + ASSERT( 0 ); +} +//============================================================================= +/*! + * standard constructor + */ +//============================================================================= +HOMARD_YACS_i::HOMARD_YACS_i( CORBA::ORB_ptr orb, + HOMARD::HOMARD_Gen_var engine ) +{ + MESSAGE("constructor"); + _gen_i = engine; + _orb = orb; + myHomardYACS = new ::HOMARD_YACS(); + ASSERT( myHomardYACS ); +} +//============================================================================= +/*! + * standard destructor + */ +//============================================================================= +HOMARD_YACS_i::~HOMARD_YACS_i() +{ +} +//============================================================================= +//============================================================================= +// Generalites +//============================================================================= +//============================================================================= +void HOMARD_YACS_i::SetName( const char* Name ) +{ + ASSERT( myHomardYACS ); + myHomardYACS->SetName( Name ); +} +//============================================================================= +char* HOMARD_YACS_i::GetName() +{ + ASSERT( myHomardYACS ); + return CORBA::string_dup( myHomardYACS->GetName().c_str() ); +} +//============================================================================= +CORBA::Long HOMARD_YACS_i::Delete( CORBA::Long Option ) +{ + ASSERT( myHomardYACS ); + char* YACSName = GetName() ; + MESSAGE ( "Delete : destruction du schema " << YACSName << ", Option = " << Option ); + return _gen_i->DeleteYACS(YACSName, Option) ; +} +//============================================================================= +char* HOMARD_YACS_i::GetDumpPython() +{ + ASSERT( myHomardYACS ); + return CORBA::string_dup( myHomardYACS->GetDumpPython().c_str() ); +} +//============================================================================= +std::string HOMARD_YACS_i::Dump() const +{ + return HOMARD::Dump( *myHomardYACS ); +} +//============================================================================= +bool HOMARD_YACS_i::Restore( const std::string& stream ) +{ + return HOMARD::Restore( *myHomardYACS, stream ); +} +//============================================================================= +//============================================================================= +// Caracteristiques +//============================================================================= +//============================================================================= +void HOMARD_YACS_i::SetType( CORBA::Long Type ) +{ + ASSERT( myHomardYACS ); + myHomardYACS->SetType( Type ); +} +//============================================================================= +CORBA::Long HOMARD_YACS_i::GetType() +{ + ASSERT( myHomardYACS ); + return CORBA::Long( myHomardYACS->GetType() ); +} +//============================================================================= +//============================================================================= +// Caracteristiques de la convergence +//============================================================================= +//============================================================================= +void HOMARD_YACS_i::SetMaxIter( CORBA::Long MaxIter ) +{ + ASSERT( myHomardYACS ); + myHomardYACS->SetMaxIter( MaxIter ); +} +//============================================================================= +CORBA::Long HOMARD_YACS_i::GetMaxIter() +{ + ASSERT( myHomardYACS ); + return CORBA::Long( myHomardYACS->GetMaxIter() ); +} +//============================================================================= +void HOMARD_YACS_i::SetMaxNode( CORBA::Long MaxNode ) +{ + ASSERT( myHomardYACS ); + myHomardYACS->SetMaxNode( MaxNode ); +} +//============================================================================= +CORBA::Long HOMARD_YACS_i::GetMaxNode() +{ + ASSERT( myHomardYACS ); + return CORBA::Long( myHomardYACS->GetMaxNode() ); +} +//============================================================================= +void HOMARD_YACS_i::SetMaxElem( CORBA::Long MaxElem ) +{ + ASSERT( myHomardYACS ); + myHomardYACS->SetMaxElem( MaxElem ); +} +//============================================================================= +CORBA::Long HOMARD_YACS_i::GetMaxElem() +{ + ASSERT( myHomardYACS ); + return CORBA::Long( myHomardYACS->GetMaxElem() ); +} +//============================================================================= +void HOMARD_YACS_i::SetTestConvergence( CORBA::Long TypeTest, CORBA::Double VRef) +{ + ASSERT( myHomardYACS ); + myHomardYACS->SetTestConvergence( TypeTest, VRef ); +} +//============================================================================= +CORBA::Long HOMARD_YACS_i::GetTestConvergenceType() +{ + ASSERT( myHomardYACS ); + return CORBA::Long( myHomardYACS->GetTestConvergenceType() ); +} +//============================================================================= +CORBA::Double HOMARD_YACS_i::GetTestConvergenceVRef() +{ + ASSERT( myHomardYACS ); + return CORBA::Long( myHomardYACS->GetTestConvergenceVRef() ); +} +//============================================================================= +//============================================================================= +// Repertoire et fichiers +//============================================================================= +//============================================================================= +void HOMARD_YACS_i::SetDirName( const char* NomDir ) +{ + ASSERT( myHomardYACS ); + myHomardYACS->SetDirName( NomDir ); +} +//============================================================================= +char* HOMARD_YACS_i::GetDirName() +{ + ASSERT( myHomardYACS ); + return CORBA::string_dup( myHomardYACS->GetDirName().c_str() ); +} +//============================================================================= +void HOMARD_YACS_i::SetMeshFile( const char* MeshFile ) +{ + ASSERT( myHomardYACS ); + myHomardYACS->SetMeshFile( MeshFile ); +} +//============================================================================= +char* HOMARD_YACS_i::GetMeshFile() +{ + ASSERT( myHomardYACS ); + return CORBA::string_dup( myHomardYACS->GetMeshFile().c_str() ); +} +//============================================================================= +void HOMARD_YACS_i::SetScriptFile( const char* ScriptFile ) +{ + ASSERT( myHomardYACS ); + myHomardYACS->SetScriptFile( ScriptFile ); +} +//============================================================================= +char* HOMARD_YACS_i::GetScriptFile() +{ + ASSERT( myHomardYACS ); + return CORBA::string_dup( myHomardYACS->GetScriptFile().c_str() ); +} +//============================================================================= +void HOMARD_YACS_i::SetXMLFile( const char* XMLFile ) +{ + ASSERT( myHomardYACS ); + MESSAGE ( "SetXMLFile : SetXMLFile = " << XMLFile ); + myHomardYACS->SetXMLFile( XMLFile ); +} +//============================================================================= +char* HOMARD_YACS_i::GetXMLFile() +{ + ASSERT( myHomardYACS ); + return CORBA::string_dup( myHomardYACS->GetXMLFile().c_str() ); +} +//============================================================================= +//============================================================================= +// Liens avec les autres structures +//============================================================================= +//============================================================================= +void HOMARD_YACS_i::SetCaseName( const char* NomCas ) +{ + ASSERT( myHomardYACS ); + myHomardYACS->SetCaseName( NomCas ); +} +//============================================================================= +char* HOMARD_YACS_i::GetCaseName() +{ + ASSERT( myHomardYACS ); + return CORBA::string_dup( myHomardYACS->GetCaseName().c_str() ); +} +//============================================================================= +CORBA::Long HOMARD_YACS_i::Write() +{ +// + char* nomYACS = GetName() ; + return _gen_i->YACSWrite(nomYACS) ; +} +//============================================================================= +CORBA::Long HOMARD_YACS_i::WriteOnFile( const char* XMLFile ) +{ + MESSAGE ( "WriteOnFile : ecriture du schema sur " << XMLFile ); + ASSERT( myHomardYACS ); +// +// Memorisation du fichier associe + SetXMLFile( XMLFile ) ; +// +// Nom du schema + char* nomYACS = GetName() ; + return _gen_i->YACSWriteOnFile(nomYACS, XMLFile) ; +} +//============================================================================= +//============================================================================= +//============================================================================= +// Divers +//============================================================================= +//============================================================================= diff --git a/src/ADAPT_I/HOMARD_YACS_i.hxx b/src/ADAPT_I/HOMARD_YACS_i.hxx new file mode 100644 index 000000000..806602423 --- /dev/null +++ b/src/ADAPT_I/HOMARD_YACS_i.hxx @@ -0,0 +1,112 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// 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 _HOMARD_YACS_I_HXX_ +#define _HOMARD_YACS_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(HOMARD_Gen) +#include CORBA_SERVER_HEADER(HOMARD_YACS) + +#include "HOMARD_i.hxx" +#include "SALOME_Component_i.hxx" +#include "SALOME_NamingService.hxx" +#include "Utils_CorbaException.hxx" + +#include + +class HOMARD_YACS; + +class HOMARDENGINE_EXPORT HOMARD_YACS_i: + public virtual Engines_Component_i, + public virtual POA_HOMARD::HOMARD_YACS, + public virtual PortableServer::ServantBase +{ +public: + HOMARD_YACS_i( CORBA::ORB_ptr orb, + HOMARD::HOMARD_Gen_var gen_i ); + HOMARD_YACS_i(); + + virtual ~HOMARD_YACS_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 SetType( CORBA::Long Type ); + CORBA::Long GetType(); + + void SetMaxIter( CORBA::Long MaxIter ); + CORBA::Long GetMaxIter(); + void SetMaxNode( CORBA::Long MaxNode ); + CORBA::Long GetMaxNode(); + void SetMaxElem( CORBA::Long MaxElem ); + CORBA::Long GetMaxElem(); + + void SetTestConvergence( CORBA::Long TypeTest, CORBA::Double VRef ); + CORBA::Long GetTestConvergenceType(); + CORBA::Double GetTestConvergenceVRef(); + + void SetDirName( const char* NomDir ); + char* GetDirName(); + + void SetMeshFile( const char* MeshFile ); + char* GetMeshFile(); + + void SetScriptFile( const char* ScriptFile ); + char* GetScriptFile(); + + void SetXMLFile( const char* XMLFile ); + char* GetXMLFile(); + + CORBA::Long Write() ; + CORBA::Long WriteOnFile( const char* XMLFile ) ; + + // Liens avec les autres structures + void SetCaseName( const char* NomCas ); + char* GetCaseName(); + +// Divers + +private: + ::HOMARD_YACS* myHomardYACS; + + CORBA::ORB_ptr _orb; + HOMARD::HOMARD_Gen_var _gen_i; +}; + +#endif diff --git a/src/ADAPT_I/HOMARD_Zone_i.cxx b/src/ADAPT_I/HOMARD_Zone_i.cxx new file mode 100644 index 000000000..4a16ee5dd --- /dev/null +++ b/src/ADAPT_I/HOMARD_Zone_i.cxx @@ -0,0 +1,218 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// 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 "HOMARD_Zone_i.hxx" +#include "HOMARD_Gen_i.hxx" +#include "HOMARD_Zone.hxx" +#include "HOMARD_DriverTools.hxx" + +#include "utilities.h" + +//============================================================================= +/*! + * standard constructor + */ +//============================================================================= +HOMARD_Zone_i::HOMARD_Zone_i() +{ + MESSAGE( "Default constructor, not for use" ); + ASSERT( 0 ); +} + +//============================================================================= +/*! + * standard constructor + */ +//============================================================================= +HOMARD_Zone_i::HOMARD_Zone_i( CORBA::ORB_ptr orb, + HOMARD::HOMARD_Gen_var engine ) +{ + MESSAGE( "HOMARD_Zone_i" ); + _gen_i = engine; + _orb = orb; + myHomardZone = new ::HOMARD_Zone(); + ASSERT( myHomardZone ); +} +//============================================================================= +/*! + * standard destructor + */ +//============================================================================= + +HOMARD_Zone_i::~HOMARD_Zone_i() +{ +} +//============================================================================= +//============================================================================= +// Generalites +//============================================================================= +//============================================================================= +void HOMARD_Zone_i::SetName( const char* Name ) +{ + ASSERT( myHomardZone ); + myHomardZone->SetName( Name ); +} +//============================================================================= +char* HOMARD_Zone_i::GetName() +{ + ASSERT( myHomardZone ); + return CORBA::string_dup( myHomardZone->GetName().c_str() ); +} +//============================================================================= +CORBA::Long HOMARD_Zone_i::Delete() +{ + ASSERT( myHomardZone ); + char* ZoneName = GetName() ; + MESSAGE ( "Delete : destruction de la zone " << ZoneName ); + return _gen_i->DeleteZone(ZoneName) ; +} +//============================================================================= +char* HOMARD_Zone_i::GetDumpPython() +{ + ASSERT( myHomardZone ); + return CORBA::string_dup( myHomardZone->GetDumpPython().c_str() ); +} +//============================================================================= +std::string HOMARD_Zone_i::Dump() const +{ + return HOMARD::Dump( *myHomardZone ); +} +//============================================================================= +bool HOMARD_Zone_i::Restore( const std::string& stream ) +{ + return HOMARD::Restore( *myHomardZone, stream ); +} +//============================================================================= +//============================================================================= +// Caracteristiques +//============================================================================= +//============================================================================= +void HOMARD_Zone_i::SetType( CORBA::Long Type ) +{ + ASSERT( myHomardZone ); + myHomardZone->SetType( Type ); +} +//============================================================================= +CORBA::Long HOMARD_Zone_i::GetType() +{ + ASSERT( myHomardZone ); + return CORBA::Long( myHomardZone->GetType() ); +} +//============================================================================= +void HOMARD_Zone_i::SetBox( double X0, double X1, double X2, double X3, double X4, double X5 ) +{ + ASSERT( myHomardZone ); + myHomardZone->SetBox( X0, X1, X2, X3, X4, X5 ); +} +//============================================================================= +void HOMARD_Zone_i::SetCylinder( double Xcentre, double Ycentre, double Zcentre, + double Xaxis, double Yaxis, double Zaxis, + double Rayon, double Haut ) +{ + ASSERT( myHomardZone ); + myHomardZone->SetCylinder( Xcentre, Ycentre, Zcentre, Xaxis, Yaxis, Zaxis, Rayon, Haut ); +} +//============================================================================= +void HOMARD_Zone_i::SetPipe( double Xcentre, double Ycentre, double Zcentre, + double Xaxis, double Yaxis, double Zaxis, + double Rayon, double Haut, double Rayonint ) +{ + ASSERT( myHomardZone ); + myHomardZone->SetPipe( Xcentre, Ycentre, Zcentre, Xaxis, Yaxis, Zaxis, Rayon, Haut, Rayonint ); +} +//============================================================================= +void HOMARD_Zone_i::SetSphere( double Xcentre, double Ycentre, double Zcentre, double Rayon ) +{ + ASSERT( myHomardZone ); + myHomardZone->SetSphere( Xcentre, Ycentre, Zcentre, Rayon ); +} +//============================================================================= +HOMARD::double_array* HOMARD_Zone_i::GetCoords() +{ + ASSERT( myHomardZone ); + HOMARD::double_array_var aResult = new HOMARD::double_array(); + std::vector mesCoor = myHomardZone->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_Zone_i::SetLimit( double Xincr, double Yincr, double Zincr ) +{ + MESSAGE ("SetLimit, Xincr : " << Xincr << ", Yincr : " << Yincr << ", Zincr : " << Zincr) ; + ASSERT( myHomardZone ); + myHomardZone->SetLimit( Xincr, Yincr, Zincr ); +} +//============================================================================= +HOMARD::double_array* HOMARD_Zone_i::GetLimit() +{ + ASSERT( myHomardZone ); + HOMARD::double_array_var aResult = new HOMARD::double_array(); + std::vector mesCoor = myHomardZone->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(); +} +//============================================================================= +//============================================================================= +// Liens avec les autres structures +//============================================================================= +//============================================================================= +void HOMARD_Zone_i::AddHypo( const char* NomHypo ) +{ + MESSAGE ( " AddHypo, NomHypo= " << NomHypo); + ASSERT( myHomardZone ); + myHomardZone->AddHypo( NomHypo ); +} +//============================================================================= +HOMARD::listeHypo* HOMARD_Zone_i::GetHypo() +{ + ASSERT( myHomardZone ); + const std::list& maListe = myHomardZone->GetHypo(); + HOMARD::listeHypo_var aResult = new HOMARD::listeHypo; + 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_Zone_i::SupprHypo( const char* NomHypo ) +{ + ASSERT( myHomardZone ); + myHomardZone->SupprHypo( NomHypo ); +} + diff --git a/src/ADAPT_I/HOMARD_Zone_i.hxx b/src/ADAPT_I/HOMARD_Zone_i.hxx new file mode 100644 index 000000000..84c2d5c00 --- /dev/null +++ b/src/ADAPT_I/HOMARD_Zone_i.hxx @@ -0,0 +1,104 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// 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 _HOMARD_Zone_I_HXX_ +#define _HOMARD_Zone_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(HOMARD_Gen) +#include CORBA_SERVER_HEADER(HOMARD_Zone) + +#include "HOMARD_i.hxx" +#include "SALOME_Component_i.hxx" +#include "SALOME_NamingService.hxx" +#include "Utils_CorbaException.hxx" + +#include + +class HOMARD_Zone; + +class HOMARDENGINE_EXPORT HOMARD_Zone_i: + public virtual Engines_Component_i, + public virtual POA_HOMARD::HOMARD_Zone, + public virtual PortableServer::ServantBase +{ +public: + HOMARD_Zone_i( CORBA::ORB_ptr orb, HOMARD::HOMARD_Gen_var gen_i ); + HOMARD_Zone_i(); + + virtual ~HOMARD_Zone_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 SetBox( double Xmini, double Xmaxi, + double Ymini, double Ymaxi, + double Zmini, double Zmaxi ); + + void SetCylinder( double Xcentre, double Ycentre, double ZCentre, + double Xaxis, double Yaxis, double Zaxis, + double Rayon, double Haut ); + + void SetPipe( double Xcentre, double Ycentre, double ZCentre, + double Xaxis, double Yaxis, double Zaxis, + double Rayon, double Haut, double Rayonint ); + + void SetSphere( double Xcentre, double Ycentre, double ZCentre, + double Rayon ); + + HOMARD::double_array* GetCoords(); + + void SetLimit( double Xincr, double Yincr, double Zincr); + HOMARD::double_array* GetLimit(); + +// Liens avec les autres structures + void AddHypo( const char *NomHypo ); + HOMARD::listeHypo* GetHypo(); + void SupprHypo( const char *NomHypo ); + +private: + ::HOMARD_Zone* myHomardZone; + + CORBA::ORB_ptr _orb; + HOMARD::HOMARD_Gen_var _gen_i; +}; + +#endif diff --git a/src/ADAPT_I/HOMARD_i.hxx b/src/ADAPT_I/HOMARD_i.hxx new file mode 100644 index 000000000..2f6aad6bd --- /dev/null +++ b/src/ADAPT_I/HOMARD_i.hxx @@ -0,0 +1,35 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef _HOMARD_I_HXX_ +#define _HOMARD_I_HXX_ + +#ifdef WIN32 + #if defined HOMARDENGINE_EXPORTS || defined HOMARDEngine_EXPORTS + #define HOMARDENGINE_EXPORT __declspec( dllexport ) + #else + #define HOMARDENGINE_EXPORT __declspec( dllimport ) + #endif +#else + #define HOMARDENGINE_EXPORT +#endif + +#endif //_HOMARD_I_HXX_ + + diff --git a/src/ADAPT_I/HomardMedCommun.cxx b/src/ADAPT_I/HomardMedCommun.cxx new file mode 100644 index 000000000..4fc06c891 --- /dev/null +++ b/src/ADAPT_I/HomardMedCommun.cxx @@ -0,0 +1,335 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "HomardMedCommun.h" + +#include +#include +#include +#include +#include + +#include + +#include "utilities.h" +// ======================================================================= +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; +} + diff --git a/src/ADAPT_I/HomardMedCommun.h b/src/ADAPT_I/HomardMedCommun.h new file mode 100644 index 000000000..0ab2a3ff3 --- /dev/null +++ b/src/ADAPT_I/HomardMedCommun.h @@ -0,0 +1,32 @@ +// Copyright (C) 2011-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef HOMARDMEDCOMMUN_H +#define HOMARDMEDCOMMUN_H + +#include "HOMARD_i.hxx" +#include +#include +#include + +HOMARDENGINE_EXPORT int MEDFileExist( const char * aFile ); +HOMARDENGINE_EXPORT std::vector GetBoundingBoxInMedFile( const char * aFile); +HOMARDENGINE_EXPORT std::set GetListeGroupesInMedFile(const char * aFile); + +#endif // HOMARD%MEDCOMMUN_H diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 88405aed6..80fa00a42 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -40,6 +40,8 @@ SET(SUBDIRS_COMMON StdMeshers_I SMESH_PY Tools + ADAPT + ADAPT_I ) IF(SALOME_SMESH_ENABLE_MEFISTO) @@ -65,6 +67,7 @@ IF(SALOME_BUILD_GUI) PluginUtils SMESH_SWIG_WITHIHM StdMeshersGUI + ADAPTGUI ) ENDIF(SALOME_BUILD_GUI) -- 2.39.2