Herezh_dev/Enumeration/Enum_interpol.cc
2023-05-03 17:23:49 +02:00

166 lines
4.9 KiB
C++

// FICHIER : Enum_interpol.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 "Enum_interpol.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>
string Nom_interpol (const Enum_interpol id_interpol)
// Retourne le nom du type d'interpolation correspondant a l'identificateur
// de type enumere id_interpol
{
string result;
switch (id_interpol)
{
case RIEN_INTERPOL : result="RIEN_INTERPOL"; break;
case CONSTANT : result="CONSTANT"; break;
case LINEAIRE : result="LINEAIRE"; break;
case QUADRATIQUE : result="QUADRATIQUE"; break;
case QUADRACOMPL : result="QUADRACOMPL"; break;
case CUBIQUE : result="CUBIQUE"; break;
case CUBIQUE_INCOMPL : result="CUBIQUE_INCOMPL"; break;
case LINQUAD : result="LINQUAD"; break;
case HERMITE : result="HERMITE"; break;
case SFE1 : result="SFE1"; break;
case SFE2 : result="SFE2"; break;
case SFE3 : result="SFE3"; break;
case SFE3C : result="SFE3C"; break;
case QSFE3 : result="QSFE3"; break;
case QSFE1 : result="QSFE1"; break;
case SFE1_3D : result="SFE1_3D"; break;
case SFE2_3D : result="SFE2_3D"; break;
case SFE3_3D : result="SFE3_3D"; break;
case SFE3C_3D : result="SFE3C_3D"; break;
case SEG1 : result="SEG1"; break;
case BIE1 : result="BIE1"; break;
case BIE2 : result="BIE2"; break;
default :
cout << "\nErreur : valeur incorrecte du type Enum_interpol !\n";
cout << "NOM_INTERPOL(Enum_interpol ) \n";
Sortie(1);
};
return result;
};
Enum_interpol Id_nom_interpol (const string& nom_interpol)
// Retourne la variable de type enumere associe au nom
// d'interpolation nom_interpol
{
Enum_interpol result;
if ( nom_interpol == "RIEN_INTERPOL" )
result=RIEN_INTERPOL;
else if ( nom_interpol == "CONSTANT" )
result=CONSTANT;
else if ( nom_interpol == "LINEAIRE" )
result=LINEAIRE;
else if ( nom_interpol == "QUADRATIQUE" )
result=QUADRATIQUE;
else if ( nom_interpol == "QUADRACOMPL" )
result=QUADRACOMPL;
else if ( nom_interpol == "CUBIQUE" )
result=CUBIQUE;
else if ( nom_interpol == "CUBIQUE_INCOMPL" )
result=CUBIQUE_INCOMPL;
else if ( nom_interpol == "LINQUAD" )
result=LINQUAD;
else if ( nom_interpol == "HERMITE" )
result=HERMITE;
else if ( nom_interpol == "SFE1" )
result=SFE1;
else if ( nom_interpol == "SFE2" )
result=SFE2;
else if ( nom_interpol == "SFE3" )
result=SFE3;
else if ( nom_interpol == "SFE3C" )
result=SFE3C;
else if ( nom_interpol == "QSFE3" )
result=QSFE3;
else if ( nom_interpol == "QSFE1" )
result=QSFE1;
else if ( nom_interpol == "SFE1_3D" )
result=SFE1_3D;
else if ( nom_interpol == "SFE2_3D" )
result=SFE2_3D;
else if ( nom_interpol == "SFE3_3D" )
result=SFE3_3D;
else if ( nom_interpol == "SFE3C_3D" )
result=SFE3C_3D;
else if ( nom_interpol == "SEG1" )
result=SEG1;
else if ( nom_interpol == "BIE1" )
result=BIE1;
else if ( nom_interpol == "BIE2" )
result=BIE2;
else
{
cout << "\nErreur : nom d'interpolation inconnu !\n";
cout << "ID_NOM_INTERPOL(string ) \n";
Sortie(1);
};
return result;
};
// surcharge de la lecture
istream & operator >> (istream & entree, Enum_interpol & result)
{ char nom_interpol[35];
entree >> nom_interpol;
result = Id_nom_interpol ( nom_interpol);
return entree;
};
// surcharge de l'operator d'ecriture
ostream & operator << (ostream & sort, const Enum_interpol& a)
{ // on ecrit la forme caractère
sort << Nom_interpol(a) << " ";
return sort;
};