Herezh_dev/herezh_pp/Enumeration/EnumTypeVitesseDefor.cc

110 lines
3.6 KiB
C++
Executable file

// FICHIER : Enum_TypeVitDef.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) <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 "EnumTypeVitesseDefor.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>
char* Nom_TypeVitDef (const Enum_TypeVitDef id_TypeVitDef)
// Retourne le nom du type de vitesse de déformation correspondant a l'identificateur
// de type enumere id_TypeVitDef
{
char* result;
switch (id_TypeVitDef)
{
case D_MOY_EPS_SUR_DT : result="D_MOY_EPS_SUR_DT"; break;
case D_AVEC_V_A_T_PLUS_DT : result="D_AVEC_V_A_T_PLUS_DT"; break;
case D_AVEC_DX_SUR_DT_A_T_PLUS_DT_SUR2 :
result="D_AVEC_DX_SUR_DT_A_T_PLUS_DT_SUR2"; break;
case D_AVEC_V_MOY_A_T_PLUS_DT_SUR2 :
result="D_AVEC_V_MOY_A_T_PLUS_DT_SUR2"; break;
default :
cout << "\nErreur : valeur incorrecte du type Enum_TypeVitDef !\n";
cout << "Nom_TypeVitDef(Enum_TypeVitDef ) \n";
Sortie(1);
};
return result;
};
Enum_TypeVitDef Id_nom_TypeVitDef (const char* nom_TypeVitDef)
// Retourne la variable de type enumere associe au nom
// de type de vitesse de déformation nom_TypeVitDef
{
Enum_TypeVitDef result;
if ( strcmp(nom_TypeVitDef,"D_MOY_EPS_SUR_DT")==0 )
result=D_MOY_EPS_SUR_DT;
else if ( strcmp(nom_TypeVitDef,"D_AVEC_V_A_T_PLUS_DT")==0 )
result=D_AVEC_V_A_T_PLUS_DT;
else if ( strcmp(nom_TypeVitDef,"D_AVEC_DX_SUR_DT_A_T_PLUS_DT_SUR2")==0 )
result=D_AVEC_DX_SUR_DT_A_T_PLUS_DT_SUR2;
else if ( strcmp(nom_TypeVitDef,"D_AVEC_V_MOY_A_T_PLUS_DT_SUR2")==0 )
result=D_AVEC_V_MOY_A_T_PLUS_DT_SUR2;
else
{
cout << "\nErreur : nom de type de vitesse de deformation inconnu !\n";
cout << "Id_nom_TypeVitDef(char* ) \n";
Sortie(1);
};
return result;
};
// surcharge de la lecture
istream & operator >> (istream & entree, Enum_TypeVitDef & result)
{ char nom_TypeVitDef[35];
entree >> nom_TypeVitDef;
result = Id_nom_TypeVitDef ( nom_TypeVitDef);
return entree;
};
// surcharge de l'operator d'ecriture
ostream & operator << (ostream & sort, const Enum_TypeVitDef& a)
{ // on ecrit la forme caractère
sort << Nom_TypeVitDef(a) << " ";
return sort;
};