// FICHIER : Enum_type_geom.cp // This file is part of the Herezh++ application. // // The finite element software Herezh++ is dedicated to the field // of mechanics for large transformations of solid structures. // It is developed by Gérard Rio (APP: IDDN.FR.010.0106078.000.R.P.2006.035.20600) // INSTITUT DE RECHERCHE DUPUY DE LÔME (IRDL) . // // Herezh++ is distributed under GPL 3 license ou ultérieure. // // Copyright (C) 1997-2022 Université Bretagne Sud (France) // AUTHOR : Gérard Rio // E-MAIL : gerardrio56@free.fr // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, // or (at your option) any later version. // // This program 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 General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . // // For more information, please consult: . #include "Enum_type_geom.h" # include using namespace std; //introduces namespace std #include #include "Sortie.h" //#ifdef SYSTEM_MAC_OS_X // #include // a priori ce n'est pas portable //#el #if defined SYSTEM_MAC_OS_CARBON #include // a priori ce n'est pas portable #else #include // pour le flot en memoire centrale #endif #include string Nom_type_geom (const Enum_type_geom id_type_geom) // Retourne le nom de la geometrie correspondant a l'identificateur // de type enumere id_type_geom { string result; switch (id_type_geom) { case RIEN_TYPE_GEOM : result="RIEN_TYPE_GEOM"; break; case POINT_G : result="POINT_G"; break; case LIGNE : result="LIGNE"; break; case SURFACE : result="SURFACE"; break; case VOLUME : result="VOLUME"; break; default : cout << "\nErreur : valeur incorrecte du type Enum_type_geom !\n"; cout << "Nom_type_geom(Enum_type_geom ) \n"; Sortie(1); }; return result; }; Enum_type_geom Id_nom_type_geom (const string& nom_type_geom) // Retourne la variable de type enumere associe au nom // de geometrie nom_type_geom { Enum_type_geom result; if ( nom_type_geom == "RIEN_TYPE_GEOM" ) result=RIEN_TYPE_GEOM; else if ( nom_type_geom == "POINT_G" ) result=POINT_G; else if ( nom_type_geom == "LIGNE" ) result=LIGNE; else if ( nom_type_geom == "SURFACE" ) result=SURFACE; else if ( nom_type_geom == "VOLUME" ) result=VOLUME; else { cout << "\nErreur : nom de geometrie '" <> (istream & entree, Enum_type_geom & result) { string nom_type_geom; entree >> nom_type_geom; result = Id_nom_type_geom ( nom_type_geom); return entree; }; // surcharge de l'operator d'ecriture ostream & operator << (ostream & sort, const Enum_type_geom& a) { // on ecrit la forme caractère sort << Nom_type_geom(a) << " "; return sort; };