Herezh_dev/herezh_pp/Enumeration/EnumTypeGrandeur.h

112 lines
4.3 KiB
C++
Executable file

/*! \file EnumTypeGrandeur.h
\brief def de l'enuméré concernant les types de structures de grandeurs
*/
// FICHIER : EnumTypeGrandeur.h
// 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/>.
// Afin de realiser un gain en place memoire, les noms des types de grandeurs sont
// stockes a l'aide d'un type enumere. Les fonctions NomTypeGrandeur et Id_nomTypeGrandeur rendent
// possible le lien entre des noms grandeur et les identificateurs
// de type enumere correspondants.
#ifndef ENUMTYPEGRANDEUR_H
#define ENUMTYPEGRANDEUR_H
#include <iostream>
using namespace std;
#include <map>
/// @addtogroup Group_types_enumeres
/// @{
/// un énuméré pour les types de base
enum EnumTypeGrandeur { RIEN_TYPEGRANDEUR = 0, SCALAIRE, VECTEUR, TENSEUR, TENSEUR_NON_SYM
,SCALAIRE_ENTIER,SCALAIRE_DOUBLE,TENSEURBB,TENSEURHH,TENSEURBH,TENSEURHB
,TENSEUR_NON_SYM_BB,TENSEUR_NON_SYM_HH
,COORDONNEE,COORDONNEEB,COORDONNEEH
,BASE__H, BASE__B
,CHAINE_CAR,GRANDEUR_QUELCONQUE};
/// @} // end of group
/// @addtogroup Group_types_enumeres
/// @{
/// un énuméré pour les types de structure
enum EnumType2Niveau { TYPE_SIMPLE = 0, TABLEAU_T, TABLEAU2_T, LISTE_T, LISTE_IO_T, MAP_T, VECTOR_T };
/// @} // end of group
/// @addtogroup Group_types_enumeres
/// @{
/// def de map qui fait la liaison entre les string et les énumérés
class ClassPourEnumTypeGrandeur
{ public:
/// def de map qui fait la liaison entre les string et les énumérés
static map < string, EnumTypeGrandeur , std::less < string> > map_EnumTypeGrandeur;
static map < string, EnumType2Niveau , std::less < string> > map_EnumType2Niveau;
// def de la grandeur statique qui permet de remplir les map
static ClassPourEnumTypeGrandeur remplir_map;
// le constructeur qui rempli effectivement la map
ClassPourEnumTypeGrandeur();
};
/// @} // end of group
// Retourne le nom du type de grandeur a partir de son identificateur de
// type enumere id_typeGrandeur correspondant
string NomTypeGrandeur (EnumTypeGrandeur id_typeGrandeur);
// idem pour le type secondaire
string NomType2Niveau (EnumType2Niveau id_Type2Niveau );
// Retourne l'identificateur de type enumere associe au nom du type de grandeur
// nom_typeGrandeur
EnumTypeGrandeur Id_nomTypeGrandeur (string nom_typeGrandeur);
// item pour le type secondaire
EnumType2Niveau Id_nomType2Niveau (string nom_Type2Niveau );
// Retourne le nombre d'éléments de la grandeur en fonction de la dimension
// exemple en dimension 3, pour un scalaire retourne 1, pour un vecteur 3
// pour un tenseur (a priori symétrique) 6
// pour un tenseur non symétrique 9
// RIEN_TYPEGRANDEUR 0
// pour le cas particulier GRANDEUR_QUELCONQUE : retourne -1
int NombreElementFoncDim(EnumTypeGrandeur id_typeGrandeur);
// indique si c'est un type numérique ou non
bool Type_grandeur_numerique(EnumTypeGrandeur id_typeGrandeur);
// surcharge de l'operator de lecture
istream & operator >> (istream & entree, EnumTypeGrandeur& a);
// surcharge de l'operator d'ecriture
ostream & operator << (ostream & sort, const EnumTypeGrandeur& a);
#endif