X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHOMARD%2FHomardDriver.cxx;h=35514cbb8a782926735134dd1ec7f15e4a1a37d9;hb=2bbedbe8e77b831531fbdef0cb08223d32da1a99;hp=04c463022a2c4b4e2780317265cfd1b4fbb1d3c3;hpb=bdbb00479184579ff9ec2e33886894326d4d6a0f;p=modules%2Fhomard.git diff --git a/src/HOMARD/HomardDriver.cxx b/src/HOMARD/HomardDriver.cxx index 04c46302..35514cbb 100644 --- a/src/HOMARD/HomardDriver.cxx +++ b/src/HOMARD/HomardDriver.cxx @@ -1,4 +1,27 @@ -#include +// HOMARD HOMARD : implementation of HOMARD idl descriptions +// +// Copyright (C) 2011-2013 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. +// +// 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 +// #include #include #include @@ -10,68 +33,109 @@ //============================================================================= HomardDriver::HomardDriver(const std::string siter, const std::string siterp1): _HOMARD_Exec( "" ), _NomDir( "" ), _NomFichierConfBase( "HOMARD.Configuration" ), - _NomFichierConf( "" ), _siter( "" ), _siterp1( "" ), + _NomFichierConf( "" ), _NomFichierDonn( "" ), _siter( "" ), _siterp1( "" ), _Texte( "" ), _bLu( false ) { + MESSAGE("siter = "< _HOMARD_Exec ="<<_HOMARD_Exec) ; // _siter = siter ; _siterp1 = siterp1 ; } - //============================================================================= //============================================================================= HomardDriver::~HomardDriver() { } - -////============================================================================= -void HomardDriver::TexteInit( const std::string DirCompute, const std::string DirComputePa, const std::string MessFile ) +//=============================================================================== +void HomardDriver::TexteInit( const std::string DirCompute, const std::string LogFile, const std::string Langue ) { - - _Texte = "Action homa\n" ; + 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 and ZoneType <= 13 ) { ZoneTypeHOMARD = 1 ; } + else if ( ZoneType >= 31 and ZoneType <= 33 ) { ZoneTypeHOMARD = 3 ; } + else if ( ZoneType >= 61 and ZoneType <= 63 ) { ZoneTypeHOMARD = 6 ; } + else { ZoneTypeHOMARD = ZoneType ; } +// + if ( TypeUse < 0 ) { ZoneTypeHOMARD = -ZoneTypeHOMARD ; } // std::stringstream saux1 ; saux1 << NumeZone ; @@ -169,14 +244,94 @@ void HomardDriver::TexteZone( int NumeZone, int ZoneType, double x0, double x1, saux = "#\n# Zone numero " + saux2 + "\n" ; // { std::stringstream saux1 ; - saux1 << NumeZone << " " << ZoneType ; + saux1 << NumeZone << " " << ZoneTypeHOMARD ; saux2 = saux1.str() ; saux += "ZoRaType " + saux2 + "\n" ; } // -// Cas du rectangle/parallelepipede +// 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 ; + saux2 = saux1.str() ; + saux += "ZoRaXmin " + saux2 + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x1 ; + saux2 = saux1.str() ; + saux += "ZoRaXmax " + saux2 + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x2 ; + saux2 = saux1.str() ; + saux += "ZoRaYmin " + saux2 + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x3 ; + saux2 = saux1.str() ; + saux += "ZoRaYmax " + saux2 + "\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 ; + saux2 = saux1.str() ; + saux += "ZoRaXmin " + saux2 + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x3 ; + saux2 = saux1.str() ; + saux += "ZoRaXmax " + saux2 + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x4 ; + saux2 = saux1.str() ; + saux += "ZoRaYmin " + saux2 + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x5 ; + saux2 = saux1.str() ; + saux += "ZoRaYmax " + saux2 + "\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 ; + saux2 = saux1.str() ; + saux += "ZoRaXmin " + saux2 + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x1 ; + saux2 = saux1.str() ; + saux += "ZoRaXmax " + saux2 + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x4 ; + saux2 = saux1.str() ; + saux += "ZoRaYmin " + saux2 + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x5 ; + saux2 = saux1.str() ; + saux += "ZoRaYmax " + saux2 + "\n" ; + } + } +// +// Cas du parallelepipede // - if ( ZoneType == 2 ) + else if ( ZoneType == 2 ) { saux += "# Boite\n" ; { std::stringstream saux1 ; @@ -211,7 +366,88 @@ void HomardDriver::TexteZone( int NumeZone, int ZoneType, double x0, double x1, } } // -// Cas du cercle/sphere +// Cas du disque +// + else if ( ZoneType == 31 or ZoneType == 61 ) + { + saux += "# Sphere\n" ; + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x0 ; + saux2 = saux1.str() ; + saux += "ZoRaXCen " + saux2 + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x1 ; + saux2 = saux1.str() ; + saux += "ZoRaYCen " + saux2 + "\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 ; + saux2 = saux1.str() ; + saux += "ZoRaRayI " + saux2 + "\n" ; + } + } + else if ( ZoneType == 32 or ZoneType == 62 ) + { + saux += "# Sphere\n" ; + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x1 ; + saux2 = saux1.str() ; + saux += "ZoRaXCen " + saux2 + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x2 ; + saux2 = saux1.str() ; + saux += "ZoRaYCen " + saux2 + "\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 ; + saux2 = saux1.str() ; + saux += "ZoRaRayI " + saux2 + "\n" ; + } + } + else if ( ZoneType == 33 or ZoneType == 63 ) + { + saux += "# Sphere\n" ; + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x0 ; + saux2 = saux1.str() ; + saux += "ZoRaXCen " + saux2 + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x2 ; + saux2 = saux1.str() ; + saux += "ZoRaYCen " + saux2 + "\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 ; + saux2 = saux1.str() ; + saux += "ZoRaRayI " + saux2 + "\n" ; + } + } +// +// Cas de la sphere // else if ( ZoneType == 4 ) { @@ -237,15 +473,70 @@ void HomardDriver::TexteZone( int NumeZone, int ZoneType, double x0, double x1, saux += "ZoRaRayo " + saux2 + "\n" ; } } +// +// Cas du cylindre ou du tuyau +// + else if ( ZoneType == 5 or ZoneType == 7 ) + { + if ( ZoneType == 5 ) { saux += "# Cylindre\n" ; } + else { saux += "# Tuyau\n" ; } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x0 ; + saux2 = saux1.str() ; + saux += "ZoRaXBas " + saux2 + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x1 ; + saux2 = saux1.str() ; + saux += "ZoRaYBas " + saux2 + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x2 ; + saux2 = saux1.str() ; + saux += "ZoRaZBas " + saux2 + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x3 ; + saux2 = saux1.str() ; + saux += "ZoRaXAxe " + saux2 + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x4 ; + saux2 = saux1.str() ; + saux += "ZoRaYAxe " + saux2 + "\n" ; + } + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x5 ; + saux2 = saux1.str() ; + saux += "ZoRaZAxe " + saux2 + "\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 ; + saux2 = saux1.str() ; + saux += "ZoRaHaut " + saux2 + "\n" ; + } + if ( ZoneType == 7 ) + { std::stringstream saux1 ; + saux1 << NumeZone << " " << x8 ; + saux2 = saux1.str() ; + saux += "ZoRaRayI " + saux2 + "\n" ; + } + } // _Texte += saux + "#\n" ; // -// std::cerr << "A la fin de TexteZone _Texte ="<<_Texte << std::endl; +// 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 UsCmpI ) + int TypeThR, double ThreshR, int TypeThC, double ThreshC, + int UsField, int UsCmpI ) { MESSAGE("TexteField, FieldName = "< 0 ) + { + _Texte += "# Niveaux extremes\n" ; + { std::stringstream saux1 ; + saux1 << NivMax ; + std::string saux2 = saux1.str() ; + _Texte += "NiveauMa " + saux2 + "\n" ; + } + } + if ( DiamMin > 0 ) + { + _Texte += "# Diametre minimal\n" ; + { std::stringstream saux1 ; + saux1 << DiamMin ; + std::string saux2 = saux1.str() ; + _Texte += "DiametMi " + saux2 + "\n" ; + } + } + if ( AdapInit != 0 ) + { + if ( AdapInit > 0 ) + { _Texte += "# Raffinement" ; } + else + { _Texte += "# Deraffinement" ; } + _Texte += " des regions sans indicateur\n" ; + { std::stringstream saux1 ; + saux1 << AdapInit ; + std::string saux2 = saux1.str() ; + _Texte += "AdapInit " + saux2 + "\n" ; + } + } + if ( LevelOutput != 0 ) + { + _Texte += "# Sortie des niveaux de raffinement\n" ; + _Texte += "NCNiveau NIVEAU\n" ; + } +} +//=============================================================================== void HomardDriver::CreeFichier( ) { // - _NomFichierConf = _NomFichierConfBase + "." + _siter + ".vers." + _siterp1 ; + if ( _siter != _siterp1 ) + { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".vers." + _siterp1 ; } + else + { _NomFichierConf = _NomFichierConfBase + "." + _siter + ".info" ; } // - std::ofstream FicConf(_NomFichierConf.c_str(), std::ios::out ) ; - if (FicConf.is_open() == true) - { - FicConf << _Texte << std::endl ; - } - FicConf.close() ; + std::ofstream Fic(_NomFichierConf.c_str(), std::ios::out ) ; + if (Fic.is_open() == true) { Fic << _Texte << std::endl ; } + Fic.close() ; // } - -////============================================================================= -int HomardDriver::ExecuteHomard() +//=============================================================================== +// Creation du fichier de donnees pour l'information +//=============================================================================== +void HomardDriver::CreeFichierDonn( ) +{ +// + MESSAGE("CreeFichierDonn"); + _NomFichierDonn = "info.donn" ; +// + std::string data ; + data = "0\n" ; + data += "0\n" ; + data += "q\n" ; + std::ofstream Fic(_NomFichierDonn.c_str(), std::ios::out ) ; + if (Fic.is_open() == true) { Fic << data << std::endl ; } + Fic.close() ; +// +} +//=============================================================================== +int HomardDriver::ExecuteHomard(int option) { + MESSAGE("ExecuteHomard, avec option = "<