180 lines
4.6 KiB
C++
180 lines
4.6 KiB
C++
// FICHIER EnumElemTypeProblem.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-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 <https://www.gnu.org/licenses/>.
|
|
//
|
|
// For more information, please consult: <https://herezh.irdl.fr/>.
|
|
|
|
|
|
#include "EnumElemTypeProblem.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 EnumElemTypeProblem_deja_inclus
|
|
|
|
|
|
#ifndef MISE_AU_POINT
|
|
inline
|
|
#endif
|
|
int Nombre_de_EnumElemTypeProblem() { return 5;}; // nombre maxi d'enum
|
|
|
|
|
|
#ifndef MISE_AU_POINT
|
|
inline
|
|
#endif
|
|
string NomElemTypeProblem (const EnumElemTypeProblem id_ElemTypeProblem)
|
|
// Retourne le nom a partir de son identificateur de
|
|
// type enumere id_ElemTypeProbleme correspondant
|
|
{
|
|
|
|
string result="";
|
|
switch (id_ElemTypeProblem)
|
|
{
|
|
case MECA_SOLIDE_DEFORMABLE :
|
|
result="MECA_SOLIDE_DEFORMABLE";
|
|
break;
|
|
case MECA_SOLIDE_INDEFORMABLE :
|
|
result="MECA_SOLIDE_INDEFORMABLE";
|
|
break;
|
|
case MECA_FLUIDE :
|
|
result="MECA_FLUIDE";
|
|
break;
|
|
case THERMIQUE :
|
|
result="THERMIQUE";
|
|
break;
|
|
case ELECTROMAGNETIQUE :
|
|
result="ELECTROMAGNETIQUE";
|
|
break;
|
|
case RIEN_PROBLEM :
|
|
result="RIEN_PROBLEM";
|
|
break;
|
|
default :
|
|
cout << "\nErreur : valeur incorrecte du type EnumElemTypeProblem !\n";
|
|
cout << "NomElemTypeProblem (EnumElemTypeProblem id_ElemTypeProblem) \n";
|
|
Sortie(1);
|
|
};
|
|
return result;
|
|
|
|
};
|
|
|
|
#ifndef MISE_AU_POINT
|
|
inline
|
|
#endif
|
|
EnumElemTypeProblem Id_nom_ElemTypeProblem (const string& nom)
|
|
// Retourne l'identificateur de type enumere associe au nom
|
|
{
|
|
|
|
EnumElemTypeProblem result=RIEN_PROBLEM;
|
|
if ( nom == "MECA_SOLIDE_DEFORMABLE" )
|
|
result=MECA_SOLIDE_DEFORMABLE;
|
|
else if ( nom == "MECA_SOLIDE_INDEFORMABLE" )
|
|
result=MECA_SOLIDE_INDEFORMABLE;
|
|
else if ( nom == "MECA_FLUIDE" )
|
|
result=MECA_FLUIDE;
|
|
else if ( nom == "THERMIQUE" )
|
|
result=THERMIQUE;
|
|
else if ( nom == "ELECTROMAGNETIQUE" )
|
|
result=ELECTROMAGNETIQUE;
|
|
else if ( nom == "RIEN_PROBLEM" )
|
|
result=RIEN_PROBLEM;
|
|
else
|
|
{
|
|
cout << "\nErreur : nom:\"" << nom << "\" du degre de liberte inconnu !\n";
|
|
cout << "Id_nom_ElemTypeProblem (string nom) \n";
|
|
Sortie(1);
|
|
};
|
|
return result;
|
|
|
|
};
|
|
|
|
// retourne true si l'identificateur existe, false sinon
|
|
#ifndef MISE_AU_POINT
|
|
inline
|
|
#endif
|
|
bool ExisteEnum_ElemTypeProblem(const string& nom)
|
|
{ bool res;
|
|
if ( nom == "MECA_SOLIDE_DEFORMABLE" )
|
|
res=true;
|
|
else if ( nom == "MECA_SOLIDE_INDEFORMABLE" )
|
|
res=true;
|
|
else if ( nom == "MECA_FLUIDE" )
|
|
res=true;
|
|
else if ( nom == "THERMIQUE" )
|
|
res=true;
|
|
else if ( nom == "ELECTROMAGNETIQUE" )
|
|
res=true;
|
|
else if ( nom == "RIEN_PROBLEM" )
|
|
res=true;
|
|
else
|
|
res = false;
|
|
return res;
|
|
|
|
};
|
|
|
|
#ifndef MISE_AU_POINT
|
|
inline
|
|
#endif
|
|
// retourne le nombre maxi de Type de problème apréhendé
|
|
int NbEnum_ElemTypeProblem()
|
|
{ return 6;};
|
|
|
|
// surcharge de l'operator de lecture
|
|
#ifndef MISE_AU_POINT
|
|
inline
|
|
#endif
|
|
istream & operator >> (istream & entree, EnumElemTypeProblem& a)
|
|
{ string nom_EnumElemTypeProblem;
|
|
entree >> nom_EnumElemTypeProblem;
|
|
a = Id_nom_ElemTypeProblem ( nom_EnumElemTypeProblem);
|
|
return entree;
|
|
};
|
|
|
|
// surcharge de l'operator d'ecriture
|
|
#ifndef MISE_AU_POINT
|
|
inline
|
|
#endif
|
|
ostream & operator << (ostream & sort, const EnumElemTypeProblem& a)
|
|
{ // on ecrit la forme caractère
|
|
sort << NomElemTypeProblem(a) << " ";
|
|
return sort;
|
|
};
|
|
|
|
#endif
|