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

395 lines
18 KiB
C++

// FICHIER : Enum_comp.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_comp.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>
// ----- 1) concernant Enum_comp ------
string Nom_comp (const Enum_comp id_comport)
// Retourne le nom de la loi de comportement correspondant a l'identificateur
// de type enumere id_comport
{
string result;
switch (id_comport)
{
case ISOELAS : result="ISOELAS"; break;
case ISOELAS1D : result="ISOELAS1D"; break;
case ISOELAS2D_D : result="ISOELAS2D_D"; break;
case ISOELAS2D_C : result="ISOELAS2D_C"; break;
case ISO_ELAS_ESPO1D : result="ISO_ELAS_ESPO1D"; break;
case ISO_ELAS_SE1D : result="ISO_ELAS_SE1D"; break;
case ISO_ELAS_ESPO3D : result="ISO_ELAS_ESPO3D"; break;
case ORTHOELA3D : result="ORTHOELA3D"; break;
case ORTHOELA2D_D : result="ORTHOELA2D_D"; break;
case ORTHOELA2D_C : result="ORTHOELA2D_C"; break;
case HYPO_ORTHO3D : result="HYPO_ORTHO3D"; break;
case HYPO_ORTHO2D_D : result="HYPO_ORTHO2D_D"; break;
case HYPO_ORTHO2D_C : result="HYPO_ORTHO2D_C"; break;
case PROJECTION_ANISOTROPE_3D : result="PROJECTION_ANISOTROPE_3D"; break;
case VISCOELA : result="VISCOELA"; break;
case ISOHYPER : result="ISOHYPER"; break;
case ISOHYPER1 : result="ISOHYPER1"; break;
case ISOHYPER10 : result="ISOHYPER10"; break;
case ISOHYSTE : result="ISOHYSTE";break;
case TRELOAR : result="TRELOAR"; break;
case ISOHYPER3DFAVIER1 : result="ISOHYPER3DFAVIER1"; break;
case ISOHYPER3DFAVIER2 : result="ISOHYPER3DFAVIER2"; break;
case ISOHYPER3DFAVIER3 : result="ISOHYPER3DFAVIER3"; break;
case ISOHYPER3DFAVIER4 : result="ISOHYPER3DFAVIER4"; break;
case ISOHYPER3DORGEAS1 : result="ISOHYPER3DORGEAS1"; break;
case ISOHYPER3DORGEAS2 : result="ISOHYPER3DORGEAS2"; break;
case ISOHYPERBULK3 : result="ISOHYPERBULK3"; break;
case ISOHYPERBULK_GENE : result="ISOHYPERBULK_GENE"; break;
case PRANDTL_REUSS : result="PRANDTL_REUSS"; break;
case PRANDTL_REUSS2D_D : result="PRANDTL_REUSS2D_D"; break;
case PRANDTL_REUSS2D_C : result="PRANDTL_REUSS2D_C"; break;
case PRANDTL_REUSS1D : result="PRANDTL_REUSS1D"; break;
case NEWTON1D : result="NEWTON1D"; break;
case NEWTON2D_C : result="NEWTON2D_C"; break;
case NEWTON2D_D : result="NEWTON2D_D"; break;
case NEWTON3D : result="NEWTON3D"; break;
case MAXWELL1D : result="MAXWELL1D"; break;
case MAXWELL2D_C : result="MAXWELL2D_C"; break;
case MAXWELL2D_D : result="MAXWELL2D_D"; break;
case MAXWELL3D : result="MAXWELL3D"; break;
case LOI_ADDITIVE_EN_SIGMA : result="LOI_ADDITIVE_EN_SIGMA"; break;
case LOI_CRITERE : result="LOI_CRITERE"; break;
case LOI_DES_MELANGES_EN_SIGMA : result="LOI_DES_MELANGES_EN_SIGMA"; break;
case LOI_CONTRAINTES_PLANES : result="LOI_CONTRAINTES_PLANES"; break;
case LOI_CONTRAINTES_PLANES_DOUBLE : result="LOI_CONTRAINTES_PLANES_DOUBLE"; break;
case LOI_DEFORMATIONS_PLANES : result="LOI_DEFORMATIONS_PLANES"; break;
case HYSTERESIS_1D : result="HYSTERESIS_1D"; break;
case HYSTERESIS_3D : result="HYSTERESIS_3D"; break;
case HYSTERESIS_BULK : result="HYSTERESIS_BULK"; break;
case LOI_ISO_THERMO : result="LOI_ISO_THERMO"; break;
case MOONEY_RIVLIN_1D : result="MOONEY_RIVLIN_1D"; break;
case MOONEY_RIVLIN_3D : result="MOONEY_RIVLIN_3D"; break;
case POLY_HYPER3D : result="POLY_HYPER3D"; break;
case HART_SMITH3D : result="HART_SMITH3D"; break;
case MAHEO_HYPER : result="MAHEO_HYPER"; break;
case HYPER_EXTERNE_W : result="HYPER_EXTERNE_W"; break;
case HYPO_ELAS3D : result="HYPO_ELAS3D"; break;
case HYPO_ELAS2D_C : result="HYPO_ELAS2D_C"; break;
case HYPO_ELAS2D_D : result="HYPO_ELAS2D_D"; break;
case HYPO_ELAS1D : result="HYPO_ELAS1D"; break;
case LOI_DE_TAIT : result="LOI_DE_TAIT"; break;
case LOI_VIA_UMAT :result="LOI_VIA_UMAT"; break;
case LOI_VIA_UMAT_CP :result="LOI_VIA_UMAT_CP"; break;
case LOI_COULOMB :result="LOI_COULOMB"; break;
case LOI_RIEN1D :result="LOI_RIEN1D"; break;
case LOI_RIEN2D_D :result="LOI_RIEN2D_D"; break;
case LOI_RIEN2D_C :result="LOI_RIEN2D_C"; break;
case LOI_RIEN3D :result="LOI_RIEN3D"; break;
default :
cout << "\nErreur : valeur incorrecte du type Enum_comp !: " << id_comport << " \n";
cout << "NOM_COMP(Enum_comp ) \n";
Sortie(1);
};
return result;
};
Enum_comp Id_nom_comp (const string& nom_comport)
// Retourne la variable de type enumere associee au nom de la loi
// de comportement nom_comport
{
Enum_comp result;
if ( nom_comport == "ISOELAS" ) result=ISOELAS;
else if ( nom_comport == "ISOELAS1D" ) result=ISOELAS1D;
else if ( nom_comport == "ISOELAS2D_D" ) result=ISOELAS2D_D;
else if ( nom_comport == "ISOELAS2D_C" ) result=ISOELAS2D_C;
else if ( nom_comport == "ISO_ELAS_ESPO1D" ) result=ISO_ELAS_ESPO1D;
else if ( nom_comport == "ISO_ELAS_SE1D" ) result=ISO_ELAS_SE1D;
else if ( nom_comport == "ISO_ELAS_ESPO3D" ) result=ISO_ELAS_ESPO3D;
else if ( nom_comport == "ORTHOELA3D" ) result=ORTHOELA3D;
else if ( nom_comport == "ORTHOELA2D_D" ) result=ORTHOELA2D_D;
else if ( nom_comport == "ORTHOELA2D_C" ) result=ORTHOELA2D_C;
else if ( nom_comport == "HYPO_ORTHO3D" ) result=HYPO_ORTHO3D;
else if ( nom_comport == "HYPO_ORTHO2D_D" ) result=HYPO_ORTHO2D_D;
else if ( nom_comport == "HYPO_ORTHO2D_C" ) result=HYPO_ORTHO2D_C;
else if ( nom_comport == "PROJECTION_ANISOTROPE_3D" ) result=PROJECTION_ANISOTROPE_3D;
else if ( nom_comport == "VISCOELA" ) result=VISCOELA;
else if ( nom_comport == "ISOHYPER" ) result=ISOHYPER;
else if ( nom_comport == "ISOHYPER1" ) result=ISOHYPER1;
else if ( nom_comport == "ISOHYPER10" ) result=ISOHYPER10;
else if ( nom_comport == "ISOHYSTE" ) result=ISOHYSTE;
else if ( nom_comport == "TRELOAR" ) result=TRELOAR;
else if ( nom_comport == "ISOHYPER3DFAVIER1" ) result=ISOHYPER3DFAVIER1;
else if ( nom_comport == "ISOHYPER3DFAVIER2" ) result=ISOHYPER3DFAVIER2;
else if ( nom_comport == "ISOHYPER3DFAVIER3" ) result=ISOHYPER3DFAVIER3;
else if ( nom_comport == "ISOHYPER3DFAVIER4" ) result=ISOHYPER3DFAVIER4;
else if ( nom_comport == "ISOHYPER3DORGEAS1" ) result=ISOHYPER3DORGEAS1;
else if ( nom_comport == "ISOHYPER3DORGEAS2" ) result=ISOHYPER3DORGEAS2;
else if ( nom_comport == "ISOHYPERBULK3" ) result=ISOHYPERBULK3;
else if ( nom_comport == "ISOHYPERBULK_GENE" ) result=ISOHYPERBULK_GENE;
else if ( nom_comport == "PRANDTL_REUSS" ) result=PRANDTL_REUSS;
else if ( nom_comport == "PRANDTL_REUSS2D_D" ) result=PRANDTL_REUSS2D_D;
else if ( nom_comport == "PRANDTL_REUSS2D_C" ) result=PRANDTL_REUSS2D_C;
else if ( nom_comport == "PRANDTL_REUSS1D" ) result=PRANDTL_REUSS1D;
else if ( nom_comport == "NEWTON1D" ) result=NEWTON1D;
else if ( nom_comport == "NEWTON2D_C" ) result=NEWTON2D_C;
else if ( nom_comport == "NEWTON2D_D" ) result=NEWTON2D_D;
else if ( nom_comport == "NEWTON3D" ) result=NEWTON3D;
else if ( nom_comport == "MAXWELL1D" ) result=MAXWELL1D;
else if ( nom_comport == "MAXWELL2D_C" ) result=MAXWELL2D_C;
else if ( nom_comport == "MAXWELL2D_D" ) result=MAXWELL2D_D;
else if ( nom_comport == "MAXWELL3D" ) result=MAXWELL3D;
else if ( nom_comport == "LOI_ADDITIVE_EN_SIGMA" ) result=LOI_ADDITIVE_EN_SIGMA;
else if ( nom_comport == "LOI_CRITERE" ) result=LOI_CRITERE;
else if ( nom_comport == "LOI_DES_MELANGES_EN_SIGMA" ) result=LOI_DES_MELANGES_EN_SIGMA;
else if ( nom_comport == "LOI_CONTRAINTES_PLANES" ) result=LOI_CONTRAINTES_PLANES;
else if ( nom_comport == "LOI_CONTRAINTES_PLANES_DOUBLE" ) result=LOI_CONTRAINTES_PLANES_DOUBLE;
else if ( nom_comport == "LOI_DEFORMATIONS_PLANES" ) result=LOI_DEFORMATIONS_PLANES;
else if ( nom_comport == "HYSTERESIS_1D" ) result=HYSTERESIS_1D;
else if ( nom_comport == "HYSTERESIS_3D" ) result=HYSTERESIS_3D;
else if ( nom_comport == "HYSTERESIS_BULK" ) result=HYSTERESIS_BULK;
else if ( nom_comport == "LOI_ISO_THERMO" ) result=LOI_ISO_THERMO;
else if ( nom_comport == "LOI_DE_TAIT" ) result=LOI_DE_TAIT;
else if ( nom_comport == "MOONEY_RIVLIN_1D" ) result=MOONEY_RIVLIN_1D;
else if ( nom_comport == "MOONEY_RIVLIN_3D" ) result=MOONEY_RIVLIN_3D;
else if ( nom_comport == "POLY_HYPER3D" ) result=POLY_HYPER3D;
else if ( nom_comport == "HART_SMITH3D" ) result=HART_SMITH3D;
else if ( nom_comport == "MAHEO_HYPER" ) result=MAHEO_HYPER;
else if ( nom_comport == "HYPER_EXTERNE_W" ) result=HYPER_EXTERNE_W;
else if ( nom_comport == "HYPO_ELAS3D" ) result=HYPO_ELAS3D;
else if ( nom_comport == "HYPO_ELAS2D_C" ) result=HYPO_ELAS2D_C;
else if ( nom_comport == "HYPO_ELAS2D_D" ) result=HYPO_ELAS2D_D;
else if ( nom_comport == "HYPO_ELAS1D" ) result=HYPO_ELAS1D;
else if ( nom_comport == "LOI_VIA_UMAT" ) result=LOI_VIA_UMAT;
else if ( nom_comport == "LOI_VIA_UMAT_CP" ) result=LOI_VIA_UMAT_CP;
else if ( nom_comport == "LOI_COULOMB" ) result=LOI_COULOMB;
else if ( nom_comport == "LOI_RIEN1D" ) result=LOI_RIEN1D;
else if ( nom_comport == "LOI_RIEN2D_D" ) result=LOI_RIEN2D_D;
else if ( nom_comport == "LOI_RIEN2D_C" ) result=LOI_RIEN2D_C;
else if ( nom_comport == "LOI_RIEN3D" ) result=LOI_RIEN3D;
else if ( nom_comport == "RIEN_COMP" ) result=RIEN_COMP;
else
{
cout << "\nErreur : nom de loi de comportement inconnu !: " << nom_comport << " \n";
cout << "ID_NOM_COMP(string ) \n";
Sortie(1);
};
return result;
};
// indique si la loi est inactive mécaniquement
// typiquement de type : LOI_RIEN... ou RIEN_COMP
bool Loi_rien(const Enum_comp id_comport)
{
bool retour = false;
switch (id_comport)
{
case LOI_DE_TAIT : case LOI_RIEN1D : case LOI_RIEN2D_D :
case LOI_RIEN2D_C : case LOI_RIEN3D : case RIEN_COMP:
retour = true ;
break;
default :
retour = false;
};
return retour;
};
// surcharge de l'operator de lecture
istream & operator >> (istream & entree, Enum_comp& a)
{ char nom_Enum_comp[50];
entree >> nom_Enum_comp;
a = Id_nom_comp ( nom_Enum_comp);
return entree;
};
// surcharge de l'operator d'ecriture
ostream & operator << (ostream & sort, const Enum_comp& a)
{ // on ecrit la forme caractère
sort << Nom_comp(a) << " ";
return sort;
};
// ----- 2) concernant Enum_comp_3D_CP_DP_1D -----
// Retourne le nom a partir de son identificateur du type enumere id_Enum_comp_3D_CP_DP_1D correspondant
string Nom_comp_3D_CP_DP_1D (const Enum_comp_3D_CP_DP_1D id_Enum_comp_3D_CP_DP_1D)
{
string result;
switch (id_Enum_comp_3D_CP_DP_1D)
{
case COMP_1D : result="COMP_1D"; break;
case COMP_CONTRAINTES_PLANES : result="COMP_CONTRAINTES_PLANES"; break;
case COMP_DEFORMATIONS_PLANES : result="COMP_DEFORMATIONS_PLANES"; break;
case COMP_3D : result="COMP_3D"; break;
case RIEN_COMP_3D_CP_DP_1D : result="RIEN_COMP_3D_CP_DP_1D"; break;
default :
cout << "\nErreur : valeur incorrecte du type Enum_comp_3D_CP_DP_1D !: " << id_Enum_comp_3D_CP_DP_1D << " \n";
cout << "Nom_comp_3D_CP_DP_1D(Enum_comp_3D_CP_DP_1D ) \n";
Sortie(1);
};
return result;
};
// Retourne l'identificateur de type enumere associe à un nom nom_comp_3D_CP_DP_1D
Enum_comp_3D_CP_DP_1D Id_nom_comp_3D_CP_DP_1D (const string nom_comp_3D_CP_DP_1D)
{ Enum_comp_3D_CP_DP_1D result;
if ( nom_comp_3D_CP_DP_1D == "COMP_1D" ) result= COMP_1D;
else if ( nom_comp_3D_CP_DP_1D == "COMP_CONTRAINTES_PLANES" ) result= COMP_CONTRAINTES_PLANES;
else if ( nom_comp_3D_CP_DP_1D == "COMP_DEFORMATIONS_PLANES" ) result= COMP_DEFORMATIONS_PLANES;
else if ( nom_comp_3D_CP_DP_1D == "COMP_3D" ) result= COMP_3D;
else if ( nom_comp_3D_CP_DP_1D == "RIEN_COMP_3D_CP_DP_1D" ) result= RIEN_COMP_3D_CP_DP_1D;
else
{
cout << "\nErreur : nom de l'enumere Enum_comp_3D_CP_DP_1D inconnu !: " << nom_comp_3D_CP_DP_1D << " \n";
cout << "Id_nom_comp_3D_CP_DP_1D(string ) \n";
Sortie(1);
};
return result;
};
// indique le type Enum_comp_3D_CP_DP_1D correspondant à une loi de comportement
Enum_comp_3D_CP_DP_1D Comp_3D_CP_DP_1D(const Enum_comp id_comport)
{ Enum_comp_3D_CP_DP_1D result;
switch (id_comport)
{
case ISOELAS : result= COMP_3D; break;
case ISOELAS1D : result= COMP_1D; break;
case ISOELAS2D_D : result= COMP_DEFORMATIONS_PLANES; break;
case ISOELAS2D_C : result= COMP_CONTRAINTES_PLANES; break;
case ISO_ELAS_ESPO1D : result= COMP_1D; break;
case ISO_ELAS_SE1D : result= COMP_1D; break;
case ISO_ELAS_ESPO3D : result= COMP_3D; break;
case ORTHOELA3D : result= COMP_3D; break;
case ORTHOELA2D_D : result= COMP_DEFORMATIONS_PLANES; break;
case ORTHOELA2D_C : result= COMP_CONTRAINTES_PLANES; break;
case HYPO_ORTHO3D : result= COMP_3D; break;
case HYPO_ORTHO2D_D : result= COMP_DEFORMATIONS_PLANES; break;
case HYPO_ORTHO2D_C : result= COMP_CONTRAINTES_PLANES; break;
case PROJECTION_ANISOTROPE_3D : result= COMP_3D; break;
case VISCOELA : result= COMP_3D; break;
case ISOHYPER : result= COMP_3D; break;
case ISOHYPER1 : result= COMP_3D; break;
case ISOHYPER10 : result= COMP_3D; break;
case ISOHYSTE : result= COMP_3D; break;
case TRELOAR : result= COMP_3D; break;
case ISOHYPER3DFAVIER1 : result= COMP_3D; break;
case ISOHYPER3DFAVIER2 : result= COMP_3D; break;
case ISOHYPER3DFAVIER3 : result= COMP_3D; break;
case ISOHYPER3DFAVIER4 : result= COMP_3D; break;
case ISOHYPER3DORGEAS1 : result= COMP_3D; break;
case ISOHYPER3DORGEAS2 : result= COMP_3D; break;
case ISOHYPERBULK3 : result= COMP_3D; break;
case ISOHYPERBULK_GENE : result= COMP_3D; break;
case PRANDTL_REUSS : result= COMP_3D; break;
case PRANDTL_REUSS2D_D : result= COMP_DEFORMATIONS_PLANES; break;
case PRANDTL_REUSS2D_C : result= COMP_CONTRAINTES_PLANES; break;
case PRANDTL_REUSS1D : result= COMP_1D; break;
case NEWTON1D : result= COMP_1D; break;
case NEWTON2D_C : result= COMP_CONTRAINTES_PLANES; break;
case NEWTON2D_D : result= COMP_DEFORMATIONS_PLANES; break;
case NEWTON3D : result= COMP_3D; break;
case MAXWELL1D : result= COMP_1D; break;
case MAXWELL2D_C : result= COMP_CONTRAINTES_PLANES; break;
case MAXWELL2D_D : result= COMP_DEFORMATIONS_PLANES; break;
case MAXWELL3D : result= COMP_3D; break;
case LOI_ADDITIVE_EN_SIGMA : result= RIEN_COMP_3D_CP_DP_1D; break;
case LOI_CRITERE : result= RIEN_COMP_3D_CP_DP_1D; break;
case LOI_DES_MELANGES_EN_SIGMA : result= RIEN_COMP_3D_CP_DP_1D; break;
case LOI_CONTRAINTES_PLANES : result= COMP_CONTRAINTES_PLANES; break;
case LOI_CONTRAINTES_PLANES_DOUBLE : result= COMP_1D; break;
case LOI_DEFORMATIONS_PLANES : result= COMP_DEFORMATIONS_PLANES; break;
case HYSTERESIS_1D : result= COMP_1D; break;
case HYSTERESIS_3D : result= COMP_3D; break;
case HYSTERESIS_BULK : result= COMP_3D; break;
case LOI_ISO_THERMO : result= RIEN_COMP_3D_CP_DP_1D; break;
case LOI_DE_TAIT : result= RIEN_COMP_3D_CP_DP_1D; break;
case MOONEY_RIVLIN_1D : result= COMP_1D; break;
case MOONEY_RIVLIN_3D : result= COMP_3D; break;
case POLY_HYPER3D : result= COMP_3D; break;
case HART_SMITH3D : result= COMP_3D; break;
case MAHEO_HYPER : result= COMP_3D; break;
case HYPER_EXTERNE_W : result= COMP_3D; break;
case HYPO_ELAS3D : result= COMP_3D; break;
case HYPO_ELAS2D_C : result= COMP_CONTRAINTES_PLANES; break;
case HYPO_ELAS2D_D : result= COMP_DEFORMATIONS_PLANES; break;
case HYPO_ELAS1D : result= COMP_1D; break;
case LOI_VIA_UMAT : result= COMP_3D; break;
case LOI_VIA_UMAT_CP : result= COMP_CONTRAINTES_PLANES; break;
case LOI_COULOMB : result= RIEN_COMP_3D_CP_DP_1D; break;
case LOI_RIEN1D : result= COMP_1D; break;
case LOI_RIEN2D_D : result= COMP_DEFORMATIONS_PLANES; break;
case LOI_RIEN2D_C : result= COMP_CONTRAINTES_PLANES; break;
case LOI_RIEN3D : result= COMP_3D; break;
case RIEN_COMP : result= RIEN_COMP_3D_CP_DP_1D; break;
default :
cout << "\nErreur : valeur incorrecte du type Enum_comp !: " << id_comport << " \n";
cout << "Comp_3D_CP_DP_1D(Enum_comp ) \n";
Sortie(1);
};
return result;
};
// surcharge de l'operator de lecture
istream & operator >> (istream & entree, Enum_comp_3D_CP_DP_1D& a)
{ char nom_Enum_comp_3D_CP_DP_1D[50];
entree >> nom_Enum_comp_3D_CP_DP_1D;
a = Id_nom_comp_3D_CP_DP_1D( nom_Enum_comp_3D_CP_DP_1D);
return entree;
};
// surcharge de l'operator d'ecriture
ostream & operator << (ostream & sort, const Enum_comp_3D_CP_DP_1D& a)
{ // on ecrit la forme caractère
sort << Nom_comp_3D_CP_DP_1D(a) << " ";
return sort;
};