// FICHIER Enum_Critere_Loi.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) .
//
// 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_Critere_loi.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
// Retourne le nom a partir de son identificateur de type enumere
string Nom_Critere_Loi (Enum_Critere_Loi id_nom)
{string result="";
switch (id_nom)
{
case AUCUN_CRITERE :
result="AUCUN_CRITERE";
break;
case PLISSEMENT_MEMBRANE :
result="PLISSEMENT_MEMBRANE";
break;
case PLISSEMENT_BIEL :
result="PLISSEMENT_BIEL";
break;
case RUPTURE_SIGMA_PRINC :
result="RUPTURE_SIGMA_PRINC";
break;
case RUPTURE_EPS_PRINC :
result="RUPTURE_EPS_PRINC";
break;
default :
cout << "\nErreur : valeur incorrecte du type Enum_Critere_Loi !\n";
cout << "Nom_Critere_Loi(Enum_Critere_Loi ) \n";
Sortie(1);
};
return result;
};
Enum_Critere_Loi Id_Nom_Critere_Loi (const string& nom_Critere_Loi)
// Retourne la variable de type enumere associee au nom
{
Enum_Critere_Loi result;
if ( nom_Critere_Loi == "AUCUN_CRITERE" )
result=AUCUN_CRITERE;
else if ( nom_Critere_Loi == "PLISSEMENT_MEMBRANE")
result=PLISSEMENT_MEMBRANE;
else if ( nom_Critere_Loi == "PLISSEMENT_BIEL")
result=PLISSEMENT_BIEL;
else if ( nom_Critere_Loi == "RUPTURE_SIGMA_PRINC" )
result=RUPTURE_SIGMA_PRINC;
else if ( nom_Critere_Loi == "RUPTURE_EPS_PRINC" )
result=RUPTURE_EPS_PRINC;
else
{
cout << "\nErreur : nom " << nom_Critere_Loi << " type de critere de loi inconnue !\n";
cout << "Id_Nom_Critere_Loi (const string& nom_Critere_Loi) \n";
Sortie(1);
};
return result;
};
// Retourne vrai si le nom passé en argument représente un type reconnu
// sinon false
bool Type_Enum_Critere_Loi_existe(const string& nom)
{ bool result;
if ( nom == "PLISSEMENT_MEMBRANE") {result=true;}
else if ( nom == "PLISSEMENT_BIEL") {result=true;}
else if ( nom == "RUPTURE_SIGMA_PRINC") {result=true;}
else if ( nom == "RUPTURE_EPS_PRINC") {result=true;}
else if ( nom == "AUCUN_CRITERE") {result=true;}
else {result = false;}
return result;
};
// surcharge de l'operator de lecture
istream & operator >> (istream & entree, Enum_Critere_Loi& a)
{ string nom_Enum_Critere_Loi;
entree >> nom_Enum_Critere_Loi;
a = Id_Nom_Critere_Loi ( nom_Enum_Critere_Loi);
return entree;
};
// surcharge de l'operator d'ecriture
ostream & operator << (ostream & sort, const Enum_Critere_Loi& a)
{ // on ecrit la forme caractère
sort << Nom_Critere_Loi(a) << " ";
return sort;
};