prepa_helmholtz_minus.C

00001 /*
00002  *   Copyright (c) 1999-2001 Philippe Grandclement
00003  *
00004  *   This file is part of LORENE.
00005  *
00006  *   LORENE is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License as published by
00008  *   the Free Software Foundation; either version 2 of the License, or
00009  *   (at your option) any later version.
00010  *
00011  *   LORENE is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License
00017  *   along with LORENE; if not, write to the Free Software
00018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 
00022 
00023 char prepa_helmholtz_minus_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/PDE/prepa_helmholtz_minus.C,v 1.6 2008/07/09 06:51:58 p_grandclement Exp $" ;
00024 
00025 /*
00026  * $Id: prepa_helmholtz_minus.C,v 1.6 2008/07/09 06:51:58 p_grandclement Exp $
00027  * $Log: prepa_helmholtz_minus.C,v $
00028  * Revision 1.6  2008/07/09 06:51:58  p_grandclement
00029  * some corrections to helmholtz minus in the nucleus
00030  *
00031  * Revision 1.5  2008/07/08 11:45:28  p_grandclement
00032  * Add helmholtz_minus in the nucleus
00033  *
00034  * Revision 1.4  2008/02/18 13:53:43  j_novak
00035  * Removal of special indentation instructions.
00036  *
00037  * Revision 1.3  2004/08/24 09:14:44  p_grandclement
00038  * Addition of some new operators, like Poisson in 2d... It now requieres the
00039  * GSL library to work.
00040  *
00041  * Also, the way a variable change is stored by a Param_elliptic is changed and
00042  * no longer uses Change_var but rather 2 Scalars. The codes using that feature
00043  * will requiere some modification. (It should concern only the ones about monopoles)
00044  *
00045  * Revision 1.2  2004/01/15 09:15:37  p_grandclement
00046  * Modification and addition of the Helmholtz operators
00047  *
00048  * Revision 1.1  2003/12/11 14:48:49  p_grandclement
00049  * Addition of ALL (and that is a lot !) the files needed for the general elliptic solver ... UNDER DEVELOPEMENT...
00050  *
00051  * 
00052  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/PDE/prepa_helmholtz_minus.C,v 1.6 2008/07/09 06:51:58 p_grandclement Exp $
00053  *
00054  */
00055 
00056 //fichiers includes
00057 #include <stdio.h>
00058 #include <stdlib.h>
00059 #include <math.h>
00060 
00061 #include "matrice.h"
00062 #include "type_parite.h"
00063 #include "proto.h"
00064 
00065 
00066 
00067 
00068         //------------------------------------
00069         // Routine pour les cas non prevus --
00070         //-----------------------------------
00071 
00072 Matrice _prepa_helmholtz_minus_nondege_pas_prevu(const Matrice &so) {
00073   
00074     cout << "Unknown case for prepa_helmholtz_minus_nondege" << endl ;
00075     abort() ;
00076     exit(-1) ;
00077     return so;
00078 }
00079   
00080             //-------------------
00081            //--  R_CHEB   -------
00082           //--------------------
00083 
00084 Matrice _prepa_helmholtz_minus_nondege_r_cheb (const Matrice &lap) {
00085     
00086   int n = lap.get_dim(0) ;
00087   int non_dege = 2 ;
00088   
00089   Matrice res(n-non_dege, n-non_dege) ;
00090   res.set_etat_qcq() ;
00091   for (int i=0 ; i<n-non_dege ; i++)
00092     for (int j=0 ; j<n-non_dege ; j++)
00093       res.set(i, j) = lap(i, j+non_dege) ;
00094   
00095   res.set_band (4,4) ;
00096   res.set_lu() ;
00097   return res ;
00098 } 
00099 
00100             //-------------------
00101            //--  R_CHEBU  -------
00102           //--------------------
00103 Matrice _prepa_helmholtz_minus_nondege_r_chebu (const Matrice &lap) {
00104     
00105   int n = lap.get_dim(0) ;
00106   int non_dege = 1 ;
00107   
00108   Matrice res(n-non_dege, n-non_dege) ;
00109   res.set_etat_qcq() ;
00110   for (int i=0 ; i<n-non_dege ; i++)
00111     for (int j=0 ; j<n-non_dege ; j++)
00112       res.set(i, j) = lap(i, j+non_dege) ;
00113   
00114   res.set_band (5,3) ;
00115   res.set_lu() ;
00116   return res ;
00117 } 
00118             //-------------------
00119            //--  R_CHEBP  -------
00120           //--------------------
00121 Matrice _prepa_helmholtz_minus_nondege_r_chebp (const Matrice &lap) {
00122     
00123   int n = lap.get_dim(0) ;
00124   int non_dege = 1 ;
00125   
00126   Matrice res(n-non_dege, n-non_dege) ;
00127   res.set_etat_qcq() ;
00128   for (int i=0 ; i<n-non_dege ; i++)
00129     for (int j=0 ; j<n-non_dege ; j++)
00130       res.set(i, j) = lap(i, j+non_dege) ;
00131   
00132   res.set_band (4,2) ;
00133   res.set_lu() ;
00134   return res ;
00135 } 
00136             //-------------------
00137            //--  R_CHEBI  -------
00138           //--------------------
00139 Matrice _prepa_helmholtz_minus_nondege_r_chebi (const Matrice &lap) {
00140     
00141   int n = lap.get_dim(0) ;
00142   int non_dege = 1 ;
00143   
00144   Matrice res(n-non_dege, n-non_dege) ;
00145   res.set_etat_qcq() ;
00146   for (int i=0 ; i<n-non_dege ; i++)
00147     for (int j=0 ; j<n-non_dege ; j++)
00148       res.set(i, j) = lap(i, j+non_dege) ;
00149   
00150   res.set_band (4,2) ;
00151   res.set_lu() ;
00152   return res ;
00153 } 
00154 
00155             //-------------------
00156            //--  Fonction   ----
00157           //-------------------
00158           
00159 Matrice prepa_helmholtz_minus_nondege(const Matrice &ope, int base_r) {
00160 
00161   // Routines de derivation
00162   static Matrice (*prepa_helmholtz_minus_nondege[MAX_BASE])
00163     (const Matrice&) ;
00164   static int nap = 0 ;
00165   
00166   // Premier appel
00167   if (nap==0) {
00168     nap = 1 ;
00169     for (int i=0 ; i<MAX_BASE ; i++) {
00170       prepa_helmholtz_minus_nondege[i] = 
00171     _prepa_helmholtz_minus_nondege_pas_prevu ;
00172     }
00173     // Les routines existantes
00174     prepa_helmholtz_minus_nondege[R_CHEB >> TRA_R] = 
00175       _prepa_helmholtz_minus_nondege_r_cheb ;
00176     prepa_helmholtz_minus_nondege[R_CHEBU >> TRA_R] = 
00177       _prepa_helmholtz_minus_nondege_r_chebu ; 
00178     prepa_helmholtz_minus_nondege[R_CHEBP >> TRA_R] = 
00179       _prepa_helmholtz_minus_nondege_r_chebp ;
00180     prepa_helmholtz_minus_nondege[R_CHEBI >> TRA_R] = 
00181       _prepa_helmholtz_minus_nondege_r_chebi ;
00182   }
00183   
00184   Matrice res(prepa_helmholtz_minus_nondege[base_r](ope)) ;
00185   return res ;
00186 }
00187 

Generated on Tue Feb 7 01:35:19 2012 for LORENE by  doxygen 1.4.6