From 11e3626b012086c7753ad000e5740c5c64758ab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9rard=20Rio?= Date: Tue, 28 Sep 2021 17:29:26 +0200 Subject: [PATCH] =?UTF-8?q?ajout=20de=20deux=20fichiers=20oubli=C3=A9s=20d?= =?UTF-8?q?e=20Resolin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Resolin/preconditionnement/ilupre_double_GR.h | 147 ++++++++++++++++++ Resolin/preconditionnement/pre_cond_double.h | 78 ++++++++++ 2 files changed, 225 insertions(+) create mode 100644 Resolin/preconditionnement/ilupre_double_GR.h create mode 100644 Resolin/preconditionnement/pre_cond_double.h diff --git a/Resolin/preconditionnement/ilupre_double_GR.h b/Resolin/preconditionnement/ilupre_double_GR.h new file mode 100644 index 0000000..a9cc367 --- /dev/null +++ b/Resolin/preconditionnement/ilupre_double_GR.h @@ -0,0 +1,147 @@ +/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ +/* ******** *** SparseLib++ */ +/* ******* ** *** *** *** v. 1.5c */ +/* ***** *** ******** ******** */ +/* ***** *** ******** ******** R. Pozo */ +/* ** ******* *** ** *** *** K. Remington */ +/* ******** ******** A. Lumsdaine */ +/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ +/* */ +/* */ +/* SparseLib++ : Sparse Matrix Library */ +/* */ +/* National Institute of Standards and Technology */ +/* University of Notre Dame */ +/* Authors: R. Pozo, K. Remington, A. Lumsdaine */ +/* */ +/* NOTICE */ +/* */ +/* Permission to use, copy, modify, and distribute this software and */ +/* its documentation for any purpose and without fee is hereby granted */ +/* provided that the above notice appear in all copies and supporting */ +/* documentation. */ +/* */ +/* Neither the Institutions (National Institute of Standards and Technology, */ +/* University of Notre Dame) nor the Authors make any representations about */ +/* the suitability of this software for any purpose. This software is */ +/* provided ``as is'' without expressed or implied warranty. */ +/* */ +/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ + +// modification GR +// 1) on utilise une interface unique pour tous les préconditionneurs +// d'où l'héritage d'une classe virtuelle +// 2) on utilise sytématiquement les classes templates MV++ + +#ifndef ILUPRE_GR_H +#define ILUPRE_GR_H + +//#include "vecdefs.h" +#include "vecdefs_GR.h" // modif GR +//#include VECTOR_H // modif GR +#include "comprow_double.h" +#include "compcol_double.h" + +#include "pre_cond_double.h" +#include "Mat_abstraite.h" + +class CompCol_ILUPreconditioner_double : public Pre_cond_double + { + + private: + VECTOR_double l_val_; + VECTOR_int l_colptr_; + VECTOR_int l_rowind_; + int l_nz_; + + VECTOR_double u_val_; + VECTOR_int u_colptr_; + VECTOR_int u_rowind_; + int u_nz_; + + int dim_[2]; + + public: + CompCol_ILUPreconditioner_double(const CompCol_Mat_double &A); + // cas d'une matrice abstraite + CompCol_ILUPreconditioner_double(const Mat_abstraite &A); + ~CompCol_ILUPreconditioner_double(void){}; + + // méthodes------- + + VECTOR_double solve(const VECTOR_double &x) const; + VECTOR_double trans_solve(const VECTOR_double &x) const; + +//====================== protégée ======================== + +protected : + // fonction interne d'initialisation pour éviter la recopie + void Init_CompCol_Mat_double(const CompCol_Mat_double &A); + void Init_Mat_creuse_CompCol(const Mat_abstraite &A); + +}; + + +class CompRow_ILUPreconditioner_double : public Pre_cond_double + { + + private: + VECTOR_double l_val_; + VECTOR_int l_rowptr_; + VECTOR_int l_colind_; + int l_nz_; + + VECTOR_double u_val_; + VECTOR_int u_rowptr_; + VECTOR_int u_colind_; + int u_nz_; + + int dim_[2]; + + public: + CompRow_ILUPreconditioner_double(const CompRow_Mat_double &A); + // cas d'une matrice abstraite + CompRow_ILUPreconditioner_double(const Mat_abstraite &A); + ~CompRow_ILUPreconditioner_double(void){}; + + // méthodes------- + + VECTOR_double solve(const VECTOR_double &x) const; + VECTOR_double trans_solve(const VECTOR_double &x) const; + +//====================== protégée ======================== + +protected : + // fonction interne d'initialisation pour éviter la recopie + void Init_CompRow_Mat_double(const CompRow_Mat_double &A); + +}; + +// introduction d'une classe qui regroupe les différentes possibilités de +// stockage matricielle + +class ILUPreconditioner_double : public Pre_cond_double + { + public: + // CONSTRUCTEUR + + // cas d'une matrice abstraite + ILUPreconditioner_double(const Mat_abstraite &A); + // destructeur + ~ILUPreconditioner_double(void); + + // méthodes------- + + VECTOR_double solve(const VECTOR_double &x) const + { return preCond_mat->solve(x);}; + VECTOR_double trans_solve(const VECTOR_double &x) const + { return preCond_mat->trans_solve(x);}; + + //====================== protégée ======================== + + private: + // pour l'instant deux types de matrices possibles + Pre_cond_double * preCond_mat; + }; + +#endif diff --git a/Resolin/preconditionnement/pre_cond_double.h b/Resolin/preconditionnement/pre_cond_double.h new file mode 100644 index 0000000..97a8323 --- /dev/null +++ b/Resolin/preconditionnement/pre_cond_double.h @@ -0,0 +1,78 @@ + +// 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) . +// +// 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 . +// +// For more information, please consult: . + +/************************************************************************ + * DATE: 03/01/01 * + * $ * + * AUTEUR: G RIO (mailto:gerardrio56@free.fr) * + * $ * + * PROJET: Herezh++ * + * $ * + ************************************************************************ + * BUT: Faire une interface générique pour les préconditionnements. * + * $ * + * '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' * * + * VERIFICATION: * + * * + * ! date ! auteur ! but ! * + * ------------------------------------------------------------ * + * ! ! ! ! * + * $ * + * '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' * + * MODIFICATIONS: * + * ! date ! auteur ! but ! * + * ------------------------------------------------------------ * + * $ * + ************************************************************************/ +#ifndef PRE_COND_DOUBLE_H +#define PRE_COND_DOUBLE_H + +#include "vecdefs_GR.h" + +#include "comprow_double.h" +#include "compcol_double.h" + +/// @addtogroup Les_classes_Matrices +/// @{ +/// + + +class Pre_cond_double { + + public: + virtual ~Pre_cond_double(){}; //destructeur virtuel pour l'appel des vrais destructeur + // résolution du système AX=b + virtual VECTOR_double solve (const VECTOR_double &x) const = 0; + // résolution du sytème Xt A = b + virtual VECTOR_double trans_solve (const VECTOR_double &x) const = 0; + +}; +/// @} // end of group + +#endif