ope_poisson.C

00001 /*
00002  *   Copyright (c) 2003 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 version 2
00008  *   as published by the Free Software Foundation.
00009  *
00010  *   LORENE is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with LORENE; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  *
00019  */
00020 
00021 char ope_poisson_C[] = "$Header: /cvsroot/Lorene/C++/Source/Ope_elementary/ope_poisson.C,v 1.2 2004/06/14 15:07:11 j_novak Exp $" ;
00022 
00023 /*
00024  * $Id: ope_poisson.C,v 1.2 2004/06/14 15:07:11 j_novak Exp $
00025  * $Log: ope_poisson.C,v $
00026  * Revision 1.2  2004/06/14 15:07:11  j_novak
00027  * New methods for the construction of the elliptic operator appearing in
00028  * the vector Poisson equation (acting on eta).
00029  *
00030  * Revision 1.1  2003/12/11 14:48:50  p_grandclement
00031  * Addition of ALL (and that is a lot !) the files needed for the general elliptic solver ... UNDER DEVELOPEMENT...
00032  *
00033  * 
00034  * $Header: /cvsroot/Lorene/C++/Source/Ope_elementary/ope_poisson.C,v 1.2 2004/06/14 15:07:11 j_novak Exp $
00035  *
00036  */
00037 
00038 #include "proto.h"
00039 #include "ope_elementary.h"
00040 
00041 // Standard constructor :
00042 Ope_poisson::Ope_poisson (int nbr, int baser, double alf, double bet, int lq, int dz): 
00043   Ope_elementary(nbr, baser, alf, bet), l_quant (lq), 
00044   dzpuis (dz) {
00045 
00046   assert ((dzpuis==2) || (dzpuis==3) || (dzpuis==4)) ;
00047 }
00048 
00049 // Constructor by copy :
00050 Ope_poisson::Ope_poisson (const Ope_poisson& so) : Ope_elementary(so), 
00051   l_quant (so.l_quant), dzpuis (so.dzpuis) {
00052 
00053   assert ((dzpuis==2) || (dzpuis==3) || (dzpuis==4)) ;
00054 }
00055 
00056 // Destructor :
00057 Ope_poisson::~Ope_poisson() {} 
00058 
00059 // True functions :
00060 void Ope_poisson::do_ope_mat() const {
00061   if (ope_mat != 0x0)
00062     delete ope_mat ;
00063 
00064   ope_mat = new Matrice 
00065     (laplacien_mat(nr, l_quant, beta/alpha, dzpuis, base_r)) ;
00066 }
00067 
00068 void Ope_poisson::do_ope_cl() const {
00069   if (ope_mat == 0x0)
00070     do_ope_mat() ;
00071 
00072   if (ope_cl != 0x0)
00073     delete ope_cl ;
00074 
00075   ope_cl = new Matrice 
00076     (combinaison(*ope_mat, l_quant, beta/alpha, dzpuis, base_r)) ;
00077 }
00078 
00079 void Ope_poisson::do_non_dege() const {
00080   if (ope_cl == 0x0)
00081     do_ope_cl() ;
00082 
00083   if (non_dege != 0x0)
00084     delete non_dege ;
00085 
00086   non_dege = new Matrice 
00087     (prepa_nondege(*ope_cl, l_quant, beta/alpha, dzpuis, base_r)) ;
00088 }
00089   
00090 Tbl Ope_poisson::get_solp (const Tbl& so) const {
00091 
00092   if (non_dege == 0x0)
00093     do_non_dege() ;
00094 
00095   Tbl res(solp(*ope_mat, *non_dege, alpha, beta, so, dzpuis, base_r)) ;
00096   
00097   Tbl valeurs (val_solp (res, alpha, base_r)) ;
00098   sp_plus = valeurs(0) ;
00099   sp_minus = valeurs(1) ;
00100   dsp_plus = valeurs(2) ;
00101   dsp_minus = valeurs(3) ;
00102 
00103   return res ;
00104 }
00105 
00106 Tbl Ope_poisson::get_solh() const {
00107  
00108   Tbl valeurs (val_solh (l_quant, alpha, beta, base_r)) ;
00109   if (valeurs.get_ndim() == 2) {
00110     // cas 2 sh
00111     s_one_plus = valeurs(0,0) ;
00112     s_one_minus = valeurs(0,1) ;
00113     ds_one_plus = valeurs(0,2) ;
00114     ds_one_minus = valeurs(0,3) ;
00115 
00116     s_two_plus = valeurs(1,0) ;
00117     s_two_minus = valeurs(1,1) ;
00118     ds_two_plus = valeurs(1,2) ;
00119     ds_two_minus = valeurs(1,3) ;
00120   }
00121   else {
00122     // cas 1 sh :
00123     s_one_plus = valeurs(0) ;
00124     s_one_minus = valeurs(1) ;
00125     ds_one_plus = valeurs(2) ;
00126     ds_one_minus = valeurs(3) ;
00127   } 
00128  
00129   return solh(nr, l_quant, beta/alpha, base_r) ;
00130 }
00131 
00132 void Ope_poisson::inc_l_quant() {
00133   
00134   if (ope_mat != 0x0) {
00135     delete ope_mat ;
00136     ope_mat = 0x0 ;
00137   }
00138   
00139   if (ope_cl != 0x0) {
00140     delete ope_cl ;
00141     ope_cl = 0x0 ;
00142   }
00143 
00144   if (non_dege != 0x0) {
00145     delete non_dege ;
00146     non_dege = 0x0 ;
00147   } 
00148   l_quant ++ ;
00149 }
00150 
00151 void Ope_poisson::dec_l_quant() {
00152   
00153   assert(l_quant > 0) ;
00154 
00155   if (ope_mat != 0x0) {
00156     delete ope_mat ;
00157     ope_mat = 0x0 ;
00158   }
00159   
00160   if (ope_cl != 0x0) {
00161     delete ope_cl ;
00162     ope_cl = 0x0 ;
00163   }
00164 
00165   if (non_dege != 0x0) {
00166     delete non_dege ;
00167     non_dege = 0x0 ;
00168   } 
00169   l_quant -- ;
00170 }

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