2021-09-15 12:00:56 +02:00
|
|
|
// FICHIER : Enum_matrice.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.
|
|
|
|
//
|
2023-05-03 17:23:49 +02:00
|
|
|
// Copyright (C) 1997-2022 Université Bretagne Sud (France)
|
2021-09-15 12:00:56 +02:00
|
|
|
// 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_matrice.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_matrice(Enum_matrice id_matrice)
|
|
|
|
// Retourne le nom du type de matrice correspondant a l'identificateur
|
|
|
|
// de type enumere id_matrice
|
|
|
|
{
|
|
|
|
string result;
|
|
|
|
switch (id_matrice)
|
|
|
|
{case RIEN_MATRICE : result="RIEN_MATRICE"; break;
|
|
|
|
case CARREE : result="CARREE"; break;
|
|
|
|
case CARREE_SYMETRIQUE : result="CARREE_SYMETRIQUE"; break;
|
|
|
|
case RECTANGLE : result="RECTANGLE"; break;
|
|
|
|
case BANDE_SYMETRIQUE : result="BANDE_SYMETRIQUE"; break;
|
|
|
|
case BANDE_NON_SYMETRIQUE: result="BANDE_NON_SYMETRIQUE"; break;
|
|
|
|
case CARREE_LAPACK : result="CARREE_LAPACK"; break;
|
|
|
|
case CARREE_SYMETRIQUE_LAPACK : result="CARREE_SYMETRIQUE_LAPACK"; break;
|
|
|
|
case RECTANGLE_LAPACK : result="RECTANGLE_LAPACK"; break;
|
|
|
|
case BANDE_SYMETRIQUE_LAPACK : result="BANDE_SYMETRIQUE_LAPACK"; break;
|
|
|
|
case BANDE_NON_SYMETRIQUE_LAPACK : result="BANDE_NON_SYMETRIQUE_LAPACK"; break;
|
|
|
|
case TRIDIAGONALE_GENE_LAPACK : result="TRIDIAGONALE_GENE_LAPACK"; break;
|
|
|
|
case TRIDIAGONALE_DEF_POSITIVE_LAPACK : result="TRIDIAGONALE_DEF_POSITIVE_LAPACK"; break;
|
|
|
|
case CREUSE_NON_COMPRESSEE : result="CREUSE_NON_COMPRESSEE"; break;
|
|
|
|
case CREUSE_COMPRESSEE_COLONNE : result="CREUSE_COMPRESSEE_COLONNE"; break;
|
|
|
|
case CREUSE_COMPRESSEE_LIGNE : result="CREUSE_COMPRESSEE_LIGNE"; break;
|
|
|
|
case DIAGONALE : result="DIAGONALE"; break;
|
|
|
|
default :
|
|
|
|
cout << "\nErreur : valeur incorrecte du type Enum_matrice !\n";
|
|
|
|
cout << "Nom_matrice(Enum_matrice ) \n";
|
|
|
|
Sortie(1);
|
|
|
|
};
|
|
|
|
return result;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
Enum_matrice Id_nom_matrice(const string& nom_matrice)
|
|
|
|
// Retourne la variable de type enumere associe au nom
|
|
|
|
// de matrice nom_matrice
|
|
|
|
{
|
|
|
|
|
|
|
|
Enum_matrice result;
|
|
|
|
if ( nom_matrice == "RIEN_MATRICE" )
|
|
|
|
result=RIEN_MATRICE;
|
|
|
|
else if ( nom_matrice == "CARREE" )
|
|
|
|
result=CARREE;
|
|
|
|
else if ( nom_matrice == "CARREE_SYMETRIQUE" )
|
|
|
|
result=CARREE_SYMETRIQUE;
|
|
|
|
else if ( nom_matrice == "RECTANGLE" )
|
|
|
|
result=RECTANGLE;
|
|
|
|
else if ( nom_matrice == "BANDE_SYMETRIQUE" )
|
|
|
|
result=BANDE_SYMETRIQUE;
|
|
|
|
else if ( nom_matrice == "BANDE_NON_SYMETRIQUE" )
|
|
|
|
result=BANDE_NON_SYMETRIQUE;
|
|
|
|
else if ( nom_matrice == "CARREE_LAPACK" )
|
|
|
|
result=CARREE_LAPACK;
|
|
|
|
else if ( nom_matrice == "CARREE_SYMETRIQUE_LAPACK" )
|
|
|
|
result=CARREE_SYMETRIQUE_LAPACK;
|
|
|
|
else if ( nom_matrice == "RECTANGLE_LAPACK" )
|
|
|
|
result=RECTANGLE_LAPACK;
|
|
|
|
else if ( nom_matrice == "BANDE_SYMETRIQUE_LAPACK" )
|
|
|
|
result=BANDE_SYMETRIQUE_LAPACK;
|
|
|
|
else if ( nom_matrice == "BANDE_NON_SYMETRIQUE_LAPACK" )
|
|
|
|
result=BANDE_NON_SYMETRIQUE_LAPACK;
|
|
|
|
else if ( nom_matrice == "TRIDIAGONALE_GENE_LAPACK" )
|
|
|
|
result=TRIDIAGONALE_GENE_LAPACK;
|
|
|
|
else if ( nom_matrice == "TRIDIAGONALE_DEF_POSITIVE_LAPACK" )
|
|
|
|
result=TRIDIAGONALE_DEF_POSITIVE_LAPACK;
|
|
|
|
else if ( nom_matrice == "CREUSE_NON_COMPRESSEE" )
|
|
|
|
result=CREUSE_NON_COMPRESSEE;
|
|
|
|
else if ( nom_matrice == "CREUSE_COMPRESSEE_COLONNE" )
|
|
|
|
result=CREUSE_COMPRESSEE_COLONNE;
|
|
|
|
else if ( nom_matrice == "CREUSE_COMPRESSEE_LIGNE" )
|
|
|
|
result=CREUSE_COMPRESSEE_LIGNE;
|
|
|
|
else if ( nom_matrice == "DIAGONALE" )
|
|
|
|
result=DIAGONALE;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cout << "\nErreur : nom de matrice inconnu !\n";
|
|
|
|
cout << "Id_nom_interpol(string ) \n";
|
|
|
|
Sortie(1);
|
|
|
|
};
|
|
|
|
return result;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
// indique si le type existe ou pas, -> 1 ou 0
|
|
|
|
int Existe_Enum_matrice(string& nom_matrice)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int result;
|
|
|
|
if ( nom_matrice == "RIEN_MATRICE" )
|
|
|
|
result=1;
|
|
|
|
else if ( nom_matrice == "CARREE" )
|
|
|
|
result=1;
|
|
|
|
else if ( nom_matrice == "CARREE_SYMETRIQUE" )
|
|
|
|
result=1;
|
|
|
|
else if ( nom_matrice == "RECTANGLE" )
|
|
|
|
result=1;
|
|
|
|
else if ( nom_matrice == "BANDE_SYMETRIQUE" )
|
|
|
|
result=1;
|
|
|
|
else if ( nom_matrice == "BANDE_NON_SYMETRIQUE" )
|
|
|
|
result=1;
|
|
|
|
else if ( nom_matrice == "CARREE_LAPACK" )
|
|
|
|
result=1;
|
|
|
|
else if ( nom_matrice == "CARREE_SYMETRIQUE_LAPACK" )
|
|
|
|
result=1;
|
|
|
|
else if ( nom_matrice == "RECTANGLE_LAPACK" )
|
|
|
|
result=1;
|
|
|
|
else if ( nom_matrice == "BANDE_SYMETRIQUE_LAPACK" )
|
|
|
|
result=1;
|
|
|
|
else if ( nom_matrice == "BANDE_NON_SYMETRIQUE_LAPACK" )
|
|
|
|
result=1;
|
|
|
|
else if ( nom_matrice == "TRIDIAGONALE_GENE_LAPACK" )
|
|
|
|
result=1;
|
|
|
|
else if ( nom_matrice == "TRIDIAGONALE_DEF_POSITIVE_LAPACK" )
|
|
|
|
result=1;
|
|
|
|
else if ( nom_matrice == "CREUSE_NON_COMPRESSEE" )
|
|
|
|
result=1;
|
|
|
|
else if ( nom_matrice == "CREUSE_COMPRESSEE_COLONNE" )
|
|
|
|
result=1;
|
|
|
|
else if ( nom_matrice == "CREUSE_COMPRESSEE_LIGNE" )
|
|
|
|
result=1;
|
|
|
|
else if ( nom_matrice == "DIAGONALE" )
|
|
|
|
result=1;
|
|
|
|
else
|
|
|
|
{result = 0;};
|
|
|
|
return result;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
// indique si la matrice est de part son type, symétrique ou pas
|
|
|
|
bool Symetrique_Enum_matrice(Enum_matrice id_matrice)
|
|
|
|
{
|
|
|
|
bool result;
|
|
|
|
switch (id_matrice)
|
|
|
|
{case RIEN_MATRICE : result=false; break;
|
|
|
|
case CARREE : result=false; break;
|
|
|
|
case CARREE_SYMETRIQUE : result=true; break;
|
|
|
|
case RECTANGLE : result=false; break;
|
|
|
|
case BANDE_SYMETRIQUE : result=true; break;
|
|
|
|
case BANDE_NON_SYMETRIQUE: result=false; break;
|
|
|
|
case CARREE_LAPACK : result=false; break;
|
|
|
|
case CARREE_SYMETRIQUE_LAPACK : result=true; break;
|
|
|
|
case RECTANGLE_LAPACK : result=false; break;
|
|
|
|
case BANDE_SYMETRIQUE_LAPACK : result=true; break;
|
|
|
|
case BANDE_NON_SYMETRIQUE_LAPACK : result=false; break;
|
|
|
|
case TRIDIAGONALE_GENE_LAPACK : result=false; break;
|
|
|
|
case TRIDIAGONALE_DEF_POSITIVE_LAPACK : result=false; break;
|
|
|
|
case CREUSE_NON_COMPRESSEE : result=false; break;
|
|
|
|
case CREUSE_COMPRESSEE_COLONNE : result=false; break;
|
|
|
|
case CREUSE_COMPRESSEE_LIGNE : result=false; break;
|
|
|
|
case DIAGONALE : result=true; break;
|
|
|
|
default :
|
|
|
|
cout << "\nErreur : valeur incorrecte (id_matrice="<< id_matrice <<") du type Enum_matrice !\n";
|
|
|
|
cout << "\n Symetrique(Enum_matrice id_matrice) \n";
|
|
|
|
Sortie(1);
|
|
|
|
};
|
|
|
|
return result;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// surcharge de la lecture
|
|
|
|
istream & operator >> (istream & entree, Enum_matrice & result)
|
|
|
|
{ char nom_matrice[80];
|
|
|
|
entree >> nom_matrice;
|
|
|
|
result = Id_nom_matrice ( nom_matrice);
|
|
|
|
return entree;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// surcharge de l'operator d'ecriture
|
|
|
|
ostream & operator << (ostream & sort, const Enum_matrice& a)
|
|
|
|
{ // on ecrit la forme caractère
|
|
|
|
sort << Nom_matrice(a) << " ";
|
|
|
|
return sort;
|
|
|
|
};
|
|
|
|
|