/* * Copyright (c) 1999-2001 Philippe Grandclement * * This file is part of LORENE. * * LORENE 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 2 of the License, or * (at your option) any later version. * * LORENE 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 LORENE; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ char comb_lin_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/PDE/comb_lin.C,v 1.10 2014/10/13 08:53:28 j_novak Exp $" ; /* * $Id: comb_lin.C,v 1.10 2014/10/13 08:53:28 j_novak Exp $ * $Log: comb_lin.C,v $ * Revision 1.10 2014/10/13 08:53:28 j_novak * Lorene classes and functions now belong to the namespace Lorene. * * Revision 1.9 2014/10/06 15:16:08 j_novak * Modified #include directives to use c++ syntax. * * Revision 1.8 2008/02/18 13:53:42 j_novak * Removal of special indentation instructions. * * Revision 1.7 2007/12/12 12:30:48 jl_cornou * *** empty log message *** * * Revision 1.6 2007/06/06 07:43:28 p_grandclement * nmax increased to 200 * * Revision 1.5 2004/02/09 09:33:56 j_novak * Minor modif. * * Revision 1.4 2004/02/06 10:53:54 j_novak * New dzpuis = 5 -> dzpuis = 3 case (not ready yet). * * Revision 1.3 2002/10/16 14:37:11 j_novak * Reorganization of #include instructions of standard C++, in order to * use experimental version 3 of gcc. * * Revision 1.2 2002/10/09 12:47:31 j_novak * Execution speed improved * * Revision 1.1.1.1 2001/11/20 15:19:28 e_gourgoulhon * LORENE * * Revision 2.15 2000/09/07 12:52:04 phil * *** empty log message *** * * Revision 2.14 2000/05/22 13:39:01 phil * ajout du cas dzpuis == 3 * * Revision 2.13 2000/01/04 18:59:58 phil * Double nmax * * Revision 2.12 1999/10/12 09:38:52 phil * passage en const Matrice& * * Revision 2.11 1999/10/11 14:26:07 phil * & _> && * * Revision 2.10 1999/09/30 09:25:36 phil * ajout condition sur dirac=0 * * Revision 2.9 1999/09/30 09:21:51 phil * remplacement des && en & * * Revision 2.8 1999/09/17 15:22:47 phil * correction definition NMAX * * Revision 2.7 1999/06/23 12:34:29 phil * ajout de dzpuis = 2 * * Revision 2.6 1999/04/28 10:48:19 phil * augmentation de NMAX a 50 * * Revision 2.5 1999/04/19 14:01:45 phil * *** empty log message *** * * Revision 2.4 1999/04/16 13:15:45 phil * *** empty log message *** * * Revision 2.3 1999/04/14 13:56:17 phil * Sauvegarde des Matrices deja calculees * * Revision 2.2 1999/04/07 14:37:34 phil * *** empty log message *** * * Revision 2.1 1999/04/07 14:29:51 phil * passage par reference * * Revision 2.0 1999/04/07 14:09:11 phil * *** empty log message *** * * * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/PDE/comb_lin.C,v 1.10 2014/10/13 08:53:28 j_novak Exp $ * */ //fichiers includes #include #include #include #include "matrice.h" #include "type_parite.h" #include "proto.h" /* FONCTIONS FAISANT DES COMBINAISONS LINEAIRES DES LIGNES. * Existe en deux versions Tbl ou Matrice. * * Entree : * La Matrice ou le Tbl ( a une dimension) * l : nbre quantique * puis = puissance dans la ZEC * La base de developpement en R * * Sortie : * Renvoie la matrice ou le tableau apres Combinaison lineaire * */ // Version Matrice --> Matrice namespace Lorene { Matrice _cl_pas_prevu (const Matrice &source, int l, double echelle, int puis) { cout << "Combinaison lineaire pas prevu..." << endl ; cout << "Source : " << source << endl ; cout << "l : " << l << endl ; cout << "dzpuis : " << puis << endl ; cout << "Echelle : " << echelle << endl ; abort() ; exit(-1) ; return source; } //------------------- //-- R_CHEB ------ //------------------- Matrice _cl_r_cheb (const Matrice &source, int l, double echelle, int) { int n = source.get_dim(0) ;assert (n == source.get_dim(1)) ; const int nmax = 200 ; // Nombre de Matrices stockees static Matrice* tab[nmax] ; // les matrices calculees static int nb_dejafait = 0 ; // nbre de matrices calculees static int l_dejafait[nmax] ; static int nr_dejafait[nmax] ; static double vieux_echelle = 0 ; // Si on a change l'echelle : on detruit tout : if (vieux_echelle != echelle) { for (int i=0 ; i= nmax) { cout << "_cl_r_cheb : trop de matrices" << endl ; abort() ; exit (-1) ; } l_dejafait[nb_dejafait] = l ; nr_dejafait[nb_dejafait] = n ; Matrice barre(source) ; int dirac = 1 ; for (int i=0 ; i(i+7)? i+7 : n) ; j++) barre.set(i, j) = ((1+dirac)*source(i, j)-source(i+2, j)) /(i+1) ; if (i==0) dirac = 0 ; } Matrice res(barre) ; for (int i=0 ; i(i+5)? i+5 : n) ; j++) res.set(i, j) = barre(i, j)-barre(i+2, j) ; tab[nb_dejafait] = new Matrice(res) ; nb_dejafait ++ ; return res ; } // Cas ou le calcul a deja ete effectue : else return *tab[indice] ; } //------------------- //-- R_JACO02 ------ //------------------- Matrice _cl_r_jaco02 (const Matrice &source, int l, double echelle, int) { int n = source.get_dim(0) ;assert (n == source.get_dim(1)) ; const int nmax = 200 ; // Nombre de Matrices stockees static Matrice* tab[nmax] ; // les matrices calculees static int nb_dejafait = 0 ; // nbre de matrices calculees static int l_dejafait[nmax] ; static int nr_dejafait[nmax] ; static double vieux_echelle = 0 ; // Si on a change l'echelle : on detruit tout : if (vieux_echelle != echelle) { for (int i=0 ; i= nmax) { cout << "_cl_r_jaco02 : trop de matrices" << endl ; abort() ; exit (-1) ; } l_dejafait[nb_dejafait] = l ; nr_dejafait[nb_dejafait] = n ; Matrice barre(source) ; for (int i=0 ; i= nmax) { cout << "_cl_r_chebp : trop de matrices" << endl ; abort() ; exit (-1) ; } l_dejafait[nb_dejafait] = l ; nr_dejafait[nb_dejafait] = n ; Matrice barre(source) ; int dirac = 1 ; for (int i=0 ; i= nmax) { cout << "_cl_r_chebi : trop de matrices" << endl ; abort() ; exit (-1) ; } l_dejafait[nb_dejafait] = l ; nr_dejafait[nb_dejafait] = n ; Matrice barre(source) ; for (int i=0 ; i= nmax) { cout << "_cl_r_chebu_quatre : trop de matrices" << endl ; abort() ; exit (-1) ; } l_dejafait[nb_dejafait] = l ; nr_dejafait[nb_dejafait] = n ; Matrice barre(source) ; int dirac = 1 ; for (int i=0 ; i= nmax) { cout << "_cl_r_chebu_trois : trop de matrices" << endl ; abort() ; exit (-1) ; } l_dejafait[nb_dejafait] = l ; nr_dejafait[nb_dejafait] = n ; Matrice barre(source) ; int dirac = 1 ; for (int i=0 ; i= nmax) { cout << "_cl_r_chebu_deux : trop de matrices" << endl ; abort() ; exit (-1) ; } l_dejafait[nb_dejafait] = l ; nr_dejafait[nb_dejafait] = n ; Matrice barre(source) ; int dirac = 1 ; for (int i=0 ; i= nmax) { cout << "_cl_r_chebu_cinq : trop de matrices" << endl ; abort() ; exit (-1) ; } l_dejafait[nb_dejafait] = l ; nr_dejafait[nb_dejafait] = n ; Matrice barre(source) ; int dirac = 1 ; for (int i=0 ; i> fg ; return res ; } // Cas ou le calcul a deja ete effectue : else return *tab[indice] ; } //------------------------- //- La routine a appeler --- //--------------------------- Matrice combinaison (const Matrice &source, int l, double echelle, int puis, int base_r) { // Routines de derivation static Matrice (*combinaison[MAX_BASE])(const Matrice &, int, double, int) ; static int nap = 0 ; // Premier appel if (nap==0) { nap = 1 ; for (int i=0 ; i> TRA_R] = _cl_r_cheb ; combinaison[R_CHEBU >> TRA_R] = _cl_r_chebu ; combinaison[R_CHEBP >> TRA_R] = _cl_r_chebp ; combinaison[R_CHEBI >> TRA_R] = _cl_r_chebi ; combinaison[R_JACO02 >> TRA_R] = _cl_r_jaco02 ; } Matrice res(combinaison[base_r](source, l, echelle, puis)) ; return res ; } //-------------------------------------------------- // Version Tbl --> Tbl a 1D pour la source //-------------------------------------------------- Tbl _cl_pas_prevu (const Tbl &source, int puis) { cout << "Combinaison lineaire pas prevue..." << endl ; cout << "source : " << &source << endl ; cout << "dzpuis : " << puis << endl ; abort() ; exit(-1) ; return source; } //------------------- //-- R_CHEB ------- //-------------------- Tbl _cl_r_cheb (const Tbl &source, int) { Tbl barre(source) ; int n = source.get_dim(0) ; int dirac = 1 ; for (int i=0 ; i> TRA_R] = _cl_r_cheb ; combinaison[R_CHEBU >> TRA_R] = _cl_r_chebu ; combinaison[R_CHEBP >> TRA_R] = _cl_r_chebp ; combinaison[R_CHEBI >> TRA_R] = _cl_r_chebi ; combinaison[R_JACO02 >> TRA_R] = _cl_r_jaco02 ; } Tbl res(combinaison[base_r](source, puis)) ; return res ; } }