Herezh_dev/herezh_pp/Enumeration/Enum_boolddl.cc

170 lines
5.2 KiB
C++
Executable file

// FICHIER Enum_boolddl.cc
// 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) <https://www.irdl.fr/>.
//
// Herezh++ is distributed under GPL 3 license ou ultérieure.
//
// Copyright (C) 1997-2021 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 <https://www.gnu.org/licenses/>.
//
// For more information, please consult: <https://herezh.irdl.fr/>.
#include "Enum_boolddl.h"
# include <iostream>
using namespace std; //introduces namespace std
#include <stdlib.h>
#include "Sortie.h"
//#ifdef SYSTEM_MAC_OS_X
// #include <stringfwd.h> // a priori ce n'est pas portable
//#el
#if defined SYSTEM_MAC_OS_CARBON
#include <stringfwd.h> // a priori ce n'est pas portable
#else
#include <string.h> // pour le flot en memoire centrale
#endif
#include <string>
#ifndef Enum_boolddl_deja_inclus
#ifndef MISE_AU_POINT
inline
#endif
string Nom_boolddl (Enum_boolddl id_nom)
// Retourne le nom du degre de liberte associe
// a l'identificateur de type enumere id_nom
{
string result="";
switch (id_nom)
{
case LIBRE : result="LIBRE"; break;
case FIXE : result="FIXE"; break;
case HSLIBRE : result="HSLIBRE"; break;
case HSFIXE : result="HSFIXE"; break;
case SOUSLIBRE : result="SOUSLIBRE"; break;
case SURFIXE : result="SURFIXE"; break;
case LISIBLE_LIBRE : result="LISIBLE_LIBRE"; break;
case LISIBLE_FIXE : result="LISIBLE_FIXE"; break;
case LISIBLE_SOUSLIBRE : result="LISIBLE_SOUSLIBRE"; break;
case LISIBLE_SURFIXE : result="LISIBLE_SURFIXE"; break;
case HS_LISIBLE_LIBRE : result="HS_LISIBLE_LIBRE"; break;
case HS_LISIBLE_FIXE : result="HS_LISIBLE_FIXE"; break;
case HS_SOUSLIBRE : result="HS_SOUSLIBRE"; break;
case HS_SURFIXE : result="HS_SURFIXE"; break;
case HS_LISIBLE_SOUSLIBRE : result="HS_LISIBLE_SOUSLIBRE"; break;
case HS_LISIBLE_SURFIXE : result="HS_LISIBLE_SURFIXE"; break;
default :
cout << "\nErreur : valeur incorrecte du type Enum_boolddl !\n";
cout << "NOM_DDL(Enum_boolddl ) \n";
Sortie(1);
};
return result;
};
#ifndef MISE_AU_POINT
inline
#endif
Enum_boolddl Id_nom_boolddl (const string& nom)
// Retourne la variable de type enumere associee au nom du degre
// de liberte nom
{
Enum_boolddl result;
if ( nom == "LIBRE" ) result=LIBRE;
else if ( nom == "FIXE" ) result=FIXE;
else if ( nom == "HSLIBRE" ) result=HSLIBRE;
else if ( nom == "HSFIXE" ) result=HSFIXE;
else if ( nom == "SOUSLIBRE" ) result=SOUSLIBRE;
else if ( nom == "SURFIXE" ) result=SURFIXE;
else if ( nom == "LISIBLE_LIBRE" ) result=LISIBLE_LIBRE;
else if ( nom == "LISIBLE_FIXE" ) result=LISIBLE_FIXE;
else if ( nom == "LISIBLE_SOUSLIBRE" ) result=LISIBLE_SOUSLIBRE;
else if ( nom == "LISIBLE_SURFIXE" ) result=LISIBLE_SURFIXE;
else if ( nom == "HS_LISIBLE_LIBRE" ) result=HS_LISIBLE_LIBRE;
else if ( nom == "HS_LISIBLE_FIXE" ) result=HS_LISIBLE_FIXE;
else if ( nom == "HS_SOUSLIBRE" ) result=HS_SOUSLIBRE;
else if ( nom == "HS_SURFIXE" ) result=HS_SURFIXE;
else if ( nom == "HS_LISIBLE_SOUSLIBRE" ) result=HS_LISIBLE_SOUSLIBRE;
else if ( nom == "HS_LISIBLE_SURFIXE" ) result=HS_LISIBLE_SURFIXE;
else
{
cout << "\nErreur : nom ** " << nom << " ** du degre de liberte inconnu !\n";
cout << "Id_nom_boolddl (char* nom) \n";
Sortie(1);
};
return result;
};
#ifndef MISE_AU_POINT
inline
#endif
// dit si c'est HS ou pas
// ramène true si HS, false sinon
bool Est_HS(Enum_boolddl id_ddl)
{ switch (id_ddl)
{ case HSLIBRE : case HSFIXE :case HS_LISIBLE_LIBRE :
case HS_LISIBLE_FIXE :case HS_SOUSLIBRE :
case HS_SURFIXE :case HS_LISIBLE_SOUSLIBRE : case HS_LISIBLE_SURFIXE :
return true; break;
default : return false;
};
};
// surcharge de l'operator de lecture
#ifndef MISE_AU_POINT
inline
#endif
istream & operator >> (istream & entree, Enum_boolddl& a)
{ char nom_Enum_boolddl[50];
entree >> nom_Enum_boolddl;
a = Id_nom_boolddl ( nom_Enum_boolddl);
return entree;
};
// surcharge de l'operator d'ecriture
#ifndef MISE_AU_POINT
inline
#endif
ostream & operator << (ostream & sort, const Enum_boolddl& a)
{ // on ecrit la forme caractère
sort << Nom_boolddl(a) << " ";
return sort;
};
#endif