81 lines
3.1 KiB
C++
81 lines
3.1 KiB
C++
|
// 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 "LesSuitesReel.h"
|
||
|
|
||
|
#include "Suite_equidistante.h"
|
||
|
#include "Suite_geometrique.h"
|
||
|
#include "Suite_arithmetique.h"
|
||
|
|
||
|
// -------- def du membre statique -------------
|
||
|
list < SuiteReel* > LesSuiteReel::listeDeSuites; // def la liste des Suites
|
||
|
// -------- fin def du membre statique -------------
|
||
|
|
||
|
|
||
|
// DESTRUCTEUR :
|
||
|
LesSuiteReel::~LesSuiteReel ()
|
||
|
{ list <SuiteReel*>::iterator il,ilfin=listeDeSuites.end();
|
||
|
for (il=listeDeSuites.begin();il!=ilfin;il++)
|
||
|
delete (*il);
|
||
|
};
|
||
|
|
||
|
// METHODES PUBLIQUES :
|
||
|
|
||
|
// lecture d'une nouvelle suite, création et retour d'un pointeur sur la suite
|
||
|
// si amplitude != 0 alors il faut n non nulle et:
|
||
|
// on a U_n=amplitude, ce qui permet pour les suites de réduire le nombre de paramètre à lire
|
||
|
SuiteReel * LesSuiteReel::Lecture_uneSuiteReel(double amplitude, int n)
|
||
|
{ SuiteReel * ret; // la suite en retour
|
||
|
// lecture et choix de la suite
|
||
|
string rep;
|
||
|
bool suite_definie = false;
|
||
|
do {
|
||
|
cout << " \n type de repartition de point ? "
|
||
|
<< " \n suite equidistante (rep: eq) "
|
||
|
<< " \n suite geometrique (rep: ge) (Un+1 = p * Un)"
|
||
|
<< " \n suite arithmetique (rep: ar) (Un+1 = p + Un)"
|
||
|
<< " \n rep ? ";
|
||
|
rep = lect_chaine();
|
||
|
if (rep == "eq")
|
||
|
{ ret = new Suite_equidistante();suite_definie=true;}
|
||
|
else if (rep == "ge")
|
||
|
{ ret = new Suite_geometrique();suite_definie=true;}
|
||
|
else if (rep == "ar")
|
||
|
{ ret = new Suite_arithmetique();suite_definie=true;}
|
||
|
else
|
||
|
{ cout << "\n mauvais choix, (erreur de syntaxe ?) recommencer ! ";
|
||
|
}
|
||
|
} while(!suite_definie);
|
||
|
// on définit les données spécifiques
|
||
|
ret->Def_suite(amplitude,n);
|
||
|
// on enregistre la suite
|
||
|
listeDeSuites.push_back(ret);
|
||
|
// retour
|
||
|
return ret;
|
||
|
};
|