Herezh_dev/comportement/thermique/Taux_crista/CristaliniteAbstraite.cc

76 lines
2.8 KiB
C++
Raw Normal View History

2021-09-23 11:21:15 +02:00
// 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"CristaliniteAbstraite.h"
#include "Hoffman1.h"
#include "Hoffman2.h"
// ramène un pointeur correspondant au type de crista passé en paramètre
// IMPORTANT : il y a création d'une instance (utilisation d'un new)
CristaliniteAbstraite* CristaliniteAbstraite::New_Cristalinite(Enum_crista typeCrista)
{ // définition du pointeur de retour
CristaliniteAbstraite* crista;
// choix en fonction de l'instance demandée
switch (typeCrista)
{ case HOFFMAN: crista = new Hoffman1();break;
case HOFFMAN2: crista = new Hoffman2();break;
default:
{ cout << "\nErreur : valeur incorrecte du type de cristalinite : "
<< Nom_Enum_crista(typeCrista) << "\n";
cout << "\n CristaliniteAbstraite* CristaliniteAbstraite::New_Cristalinite(... \n";
Sortie(1);
}
};
return crista;
};
// ramène un pointeur sur une instance copie de celle passée en paramètre
// IMPORTANT : il y a création d'une instance (utilisation d'un new)
CristaliniteAbstraite* CristaliniteAbstraite::New_Cristalinite(const CristaliniteAbstraite& co)
{ // définition du pointeur de retour
CristaliniteAbstraite* crista;
// choix en fonction de l'instance demandée
switch (co.Type_Crista())
{ case HOFFMAN: crista = new Hoffman1(*((Hoffman1*) &co));break;
case HOFFMAN2: crista = new Hoffman2(*((Hoffman2*) &co));break;
default:
{ cout << "\nErreur : valeur incorrecte du type de cristalinite : "
<< Nom_Enum_crista(co.Type_Crista()) << "\n";
cout << "\n CristaliniteAbstraite::New_Cristalinite(const CristaliniteAbstraite& co \n";
Sortie(1);
}
};
return crista;
};