solp_helmholtz_plus.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 solp_helmholtz_plus_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/PDE/solp_helmholtz_plus.C,v 1.3 2008/02/18 13:53:45 j_novak Exp $" ;
00024 
00025 /*
00026  * $Id: solp_helmholtz_plus.C,v 1.3 2008/02/18 13:53:45 j_novak Exp $
00027  * $Log: solp_helmholtz_plus.C,v $
00028  * Revision 1.3  2008/02/18 13:53:45  j_novak
00029  * Removal of special indentation instructions.
00030  *
00031  * Revision 1.2  2004/01/15 09:15:37  p_grandclement
00032  * Modification and addition of the Helmholtz operators
00033  *
00034  * Revision 1.1  2003/12/11 14:48:49  p_grandclement
00035  * Addition of ALL (and that is a lot !) the files needed for the general elliptic solver ... UNDER DEVELOPEMENT...
00036  *
00037  * 
00038  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/PDE/solp_helmholtz_plus.C,v 1.3 2008/02/18 13:53:45 j_novak Exp $
00039  *
00040  */
00041 
00042 //fichiers includes
00043 #include <stdio.h>
00044 #include <stdlib.h>
00045 #include <math.h>
00046 
00047 #include "matrice.h"
00048 #include "type_parite.h"
00049 #include "proto.h"
00050 
00051         //------------------------------------
00052         // Routine pour les cas non prevus --
00053         //------------------------------------
00054 Tbl _solp_helmholtz_plus_pas_prevu (const Matrice &, const Matrice &, 
00055                     const Tbl &, double, double) {
00056     cout << " Solution homogene pas prevue ..... : "<< endl ;
00057     abort() ;
00058     exit(-1) ;
00059     Tbl res(1) ;
00060     return res;
00061 }
00062     
00063     
00064 
00065             //-------------------
00066            //--  R_CHEB   -----
00067           //-------------------
00068 Tbl _solp_helmholtz_plus_r_cheb (const Matrice &lap, const Matrice &nondege, 
00069                 const Tbl &source, double alpha, double beta) {
00070  
00071   int n = lap.get_dim(0) ;    
00072   int dege = n-nondege.get_dim(0) ;
00073   assert (dege ==2) ;
00074   
00075   Tbl source_aux(source*alpha*alpha) ;
00076   Tbl xso(source_aux) ;
00077   Tbl xxso(source_aux) ;
00078   multx_1d(n, &xso.t, R_CHEB) ;
00079   multx_1d(n, &xxso.t, R_CHEB) ;
00080   multx_1d(n, &xxso.t, R_CHEB) ;
00081   source_aux = beta*beta/alpha/alpha*source_aux+2*beta/alpha*xso+xxso ;
00082   
00083   source_aux = cl_helmholtz_plus (source_aux, R_CHEB) ;
00084   
00085   Tbl so(n-dege) ;
00086   so.set_etat_qcq() ;
00087   for (int i=0 ; i<n-dege ; i++)
00088     so.set(i) = source_aux(i) ;
00089  
00090   Tbl auxi(nondege.inverse(so)) ;
00091 
00092   Tbl res(n) ;
00093   res.set_etat_qcq() ;
00094   for (int i=dege ; i<n ; i++)
00095     res.set(i) = auxi(i-dege) ;
00096   
00097   for (int i=0 ; i<dege ; i++)
00098     res.set(i) = 0 ;
00099   return res ;
00100 }
00101 
00102             //-------------------
00103            //--  R_CHEBP   ----
00104           //-------------------
00105 Tbl _solp_helmholtz_plus_r_chebp (const Matrice &lap, const Matrice &nondege, 
00106                 const Tbl &source, double alpha, double) {
00107  
00108   int n = lap.get_dim(0) ;    
00109   int dege = n-nondege.get_dim(0) ;
00110   assert (dege ==1) ;
00111   
00112   Tbl source_aux(source*alpha*alpha) ;
00113   source_aux = cl_helmholtz_plus (source_aux, R_CHEBP) ;
00114   
00115   Tbl so(n-dege) ;
00116   so.set_etat_qcq() ;
00117   for (int i=0 ; i<n-dege ; i++)
00118     so.set(i) = source_aux(i) ;
00119   
00120   Tbl auxi(nondege.inverse(so)) ;
00121   
00122   Tbl res(n) ;
00123   res.set_etat_qcq() ;
00124   for (int i=dege ; i<n ; i++)
00125     res.set(i) = auxi(i-dege) ;
00126   
00127   for (int i=0 ; i<dege ; i++)
00128     res.set(i) = 0 ;
00129   return res ;
00130 }
00131             //-------------------
00132                //--  Fonction   ----
00133           //-------------------
00134           
00135           
00136 Tbl solp_helmholtz_plus (const Matrice &lap, const Matrice &nondege, 
00137               const Tbl &source, double alpha, double beta, 
00138               int base_r) {
00139 
00140   // Routines de derivation
00141   static Tbl (*solp_helmholtz_plus[MAX_BASE]) (const Matrice&, const Matrice&,
00142                         const Tbl&, double, double) ;
00143   static int nap = 0 ;
00144   
00145   // Premier appel
00146   if (nap==0) {
00147     nap = 1 ;
00148     for (int i=0 ; i<MAX_BASE ; i++) {
00149       solp_helmholtz_plus[i] = _solp_helmholtz_plus_pas_prevu ;
00150     }
00151     // Les routines existantes
00152     solp_helmholtz_plus[R_CHEB >> TRA_R] = _solp_helmholtz_plus_r_cheb ;
00153     solp_helmholtz_plus[R_CHEBP >> TRA_R] = _solp_helmholtz_plus_r_chebp ;
00154   }
00155   
00156   Tbl res(solp_helmholtz_plus[base_r] (lap, nondege, source, alpha, beta)) ;
00157   return res ;
00158 }

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