172 lines
5.8 KiB
C++
172 lines
5.8 KiB
C++
// FICHIER : Enum_geom.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 "Enum_geom.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_geom (const Enum_geom id_geom)
|
|
// Retourne le nom de la geometrie correspondant a l'identificateur
|
|
// de type enumere id_geom
|
|
{string result;
|
|
switch (id_geom)
|
|
{case RIEN_GEOM : result="RIEN_GEOM"; break;
|
|
case TRIANGLE : result="TRIANGLE"; break;
|
|
case QUADRANGLE : result="QUADRANGLE"; break;
|
|
case TETRAEDRE : result="TETRAEDRE"; break;
|
|
case PENTAEDRE : result="PENTAEDRE"; break;
|
|
case HEXAEDRE : result="HEXAEDRE"; break;
|
|
case TRIA_AXI : result="TRIA_AXI"; break;
|
|
case QUAD_AXI : result="QUAD_AXI"; break;
|
|
case SEGMENT : result="SEGMENT"; break;
|
|
case SEG_AXI : result="SEG_AXI"; break;
|
|
case POINT : result="POINT"; break;
|
|
case POINT_CP : result="POINT_CP"; break;
|
|
case POUT : result="POUT"; break;
|
|
case PS1 : result="PS1"; break;
|
|
default :
|
|
cout << "\nErreur : valeur incorrecte du type Enum_geom !\n";
|
|
cout << "NOM_GEOM(Enum_geom ) \n";
|
|
Sortie(1);
|
|
};
|
|
return result;
|
|
};
|
|
|
|
Enum_geom Id_nom_geom (const string& nom_geom)
|
|
// Retourne la variable de type enumere associe au nom
|
|
// de geometrie nom_geom
|
|
{ Enum_geom result;
|
|
if ( nom_geom == "RIEN_GEOM") result=RIEN_GEOM;
|
|
else if ( nom_geom == "TRIANGLE" ) result=TRIANGLE;
|
|
else if ( nom_geom == "QUADRANGLE" ) result=QUADRANGLE;
|
|
else if ( nom_geom == "TETRAEDRE" ) result=TETRAEDRE;
|
|
else if ( nom_geom == "PENTAEDRE" ) result=PENTAEDRE;
|
|
else if ( nom_geom == "HEXAEDRE" ) result=HEXAEDRE;
|
|
else if ( nom_geom == "TRIA_AXI" ) result=TRIA_AXI;
|
|
else if ( nom_geom == "QUAD_AXI" ) result=QUAD_AXI;
|
|
else if ( nom_geom == "SEGMENT" ) result=SEGMENT;
|
|
else if ( nom_geom == "SEG_AXI" ) result=SEG_AXI;
|
|
else if ( nom_geom == "POINT" ) result=POINT;
|
|
else if ( nom_geom == "POINT_CP" ) result=POINT_CP;
|
|
else if ( nom_geom == "POUT" ) result=POUT;
|
|
else if ( nom_geom == "PS1" ) result=PS1;
|
|
else
|
|
{ cout << "\nErreur : nom de geometrie '" <<nom_geom << " 'inconnu !\n";
|
|
cout << "ID_NOM_GEOM(char* ) \n";
|
|
Sortie(1);
|
|
};
|
|
return result;
|
|
};
|
|
|
|
// surcharge de la lecture
|
|
istream & operator >> (istream & entree, Enum_geom & result)
|
|
{ char nom_geom[35];
|
|
entree >> nom_geom;
|
|
result = Id_nom_geom ( nom_geom);
|
|
return entree;
|
|
};
|
|
|
|
// surcharge de l'operator d'ecriture
|
|
ostream & operator << (ostream & sort, const Enum_geom& a)
|
|
{ // on ecrit la forme caractère
|
|
sort << Nom_geom(a) << " ";
|
|
return sort;
|
|
};
|
|
|
|
// Retourne le type de géométrie générique: POINT_G, LIGNE, SURFACE, VOLUME,
|
|
// associée à l'Enum_geom
|
|
Enum_type_geom Type_geom_generique(const Enum_geom id_geom)
|
|
{ Enum_type_geom result;
|
|
switch (id_geom)
|
|
{ case RIEN_GEOM : result=RIEN_TYPE_GEOM; break;
|
|
case TRIANGLE : result=SURFACE; break;
|
|
case QUADRANGLE : result=SURFACE; break;
|
|
case TETRAEDRE : result=VOLUME; break;
|
|
case PENTAEDRE : result=VOLUME; break;
|
|
case HEXAEDRE : result=VOLUME; break;
|
|
case TRIA_AXI : result=SURFACE; break;
|
|
case QUAD_AXI : result=SURFACE; break;
|
|
case SEGMENT : result=LIGNE; break;
|
|
case SEG_AXI : result=LIGNE; break;
|
|
case POINT : result=POINT_G; break;
|
|
case POINT_CP : result=POINT_G; break;
|
|
case POUT : result=LIGNE; break;
|
|
case PS1 : result=LIGNE; break;
|
|
default :
|
|
cout << "\nErreur : valeur incorrecte du type Enum_geom !\n";
|
|
cout << "Type_geom_generique(const Enum_geom id_geom ) \n";
|
|
Sortie(1);
|
|
};
|
|
return result;
|
|
};
|
|
|
|
// retourne vrai s'il s'agit d'un type axisymétrique
|
|
bool TestEnum_geom_axisymetrique(const Enum_geom id_geom)
|
|
{ bool result;
|
|
switch (id_geom)
|
|
{ case RIEN_GEOM : result=false; break;
|
|
case TRIANGLE : result=false; break;
|
|
case QUADRANGLE : result=false; break;
|
|
case TETRAEDRE : result=false; break;
|
|
case PENTAEDRE : result=false; break;
|
|
case HEXAEDRE : result=false; break;
|
|
case TRIA_AXI : result=true; break;
|
|
case QUAD_AXI : result=true; break;
|
|
case SEGMENT : result=false; break;
|
|
case SEG_AXI : result=true; break;
|
|
case POINT : result=false; break;
|
|
case POINT_CP : result=false; break;
|
|
case POUT : result=false; break;
|
|
case PS1 : result=false; break;
|
|
default :
|
|
cout << "\nErreur : valeur incorrecte du type Enum_geom !\n";
|
|
cout << "TestEnum_geom_axisymetrique(const Enum_geom id_geom ) \n";
|
|
Sortie(1);
|
|
};
|
|
return result;
|
|
};
|
|
|