X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHOMARD%2FHomardDriver.cxx;h=c025a5e22644e58862035a26feea331c89f407c7;hb=a9189d870ff98f06dc5577c5fc37102ee5337aea;hp=04c463022a2c4b4e2780317265cfd1b4fbb1d3c3;hpb=bdbb00479184579ff9ec2e33886894326d4d6a0f;p=modules%2Fhomard.git diff --git a/src/HOMARD/HomardDriver.cxx b/src/HOMARD/HomardDriver.cxx index 04c46302..c025a5e2 100644 --- a/src/HOMARD/HomardDriver.cxx +++ b/src/HOMARD/HomardDriver.cxx @@ -1,3 +1,24 @@ +// HOMARD HOMARD : implementaion of HOMARD idl descriptions +// +// Copyright (C) 2011-2012 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 @@ -17,15 +38,16 @@ HomardDriver::HomardDriver(const std::string siter, const std::string siterp1): char* dirchar; char* execchar; std::string dir; std::string executable; - if ( !(dirchar = getenv("HOMARD_REP_EXE")) ) - dir = "/logiciels/HOMARD/HOMARD_PUBLIC/Linux64" ; - else - dir = std::string(dirchar); - if ( !(execchar = getenv("HOMARD_EXE")) ) - executable = "HOMARD"; - else - executable = std::string(execchar); + if ( !(dirchar = getenv("HOMARD_REP_EXE_PRIVATE")) ) + { dirchar = getenv("HOMARD_REP_EXE") ; } + dir = std::string(dirchar); + MESSAGE("HomardDriver, dirchar ="<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 +203,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" ; + } + } // - if ( ZoneType == 2 ) + 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 +// + else if ( ZoneType == 2 ) { saux += "# Boite\n" ; { std::stringstream saux1 ; @@ -211,7 +325,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 +432,71 @@ 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" ; + } + } +} ////============================================================================= void HomardDriver::CreeFichier( )