sol_elliptic_only_zec.C

00001 /*
00002  *   Copyright (c) 2004 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 sol_elliptic_only_zec_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/PDE/sol_elliptic_only_zec.C,v 1.2 2004/08/24 09:14:44 p_grandclement Exp $" ;
00022 
00023 /*
00024  * $Id: sol_elliptic_only_zec.C,v 1.2 2004/08/24 09:14:44 p_grandclement Exp $
00025  * $Log: sol_elliptic_only_zec.C,v $
00026  * Revision 1.2  2004/08/24 09:14:44  p_grandclement
00027  * Addition of some new operators, like Poisson in 2d... It now requieres the
00028  * GSL library to work.
00029  *
00030  * Also, the way a variable change is stored by a Param_elliptic is changed and
00031  * no longer uses Change_var but rather 2 Scalars. The codes using that feature
00032  * will requiere some modification. (It should concern only the ones about monopoles)
00033  *
00034  * Revision 1.1  2004/06/22 08:49:58  p_grandclement
00035  * Addition of everything needed for using the logarithmic mapping
00036  *
00037  * 
00038  * $Header $
00039  *
00040  */
00041 
00042 // Header C : 
00043 #include <stdlib.h>
00044 #include <math.h>
00045 
00046 // Headers Lorene :
00047 #include "tbl.h"
00048 #include "mtbl_cf.h"
00049 #include "map.h"
00050 #include "param_elliptic.h"
00051           
00052  
00053         //----------------------------------------------
00054        //       Version Mtbl_cf
00055       //----------------------------------------------
00056 
00057 
00058 
00059 Mtbl_cf elliptic_solver_only_zec  (const Param_elliptic& ope_var, const Mtbl_cf& source, double val) {
00060   // Verifications d'usage sur les zones
00061   int nz = source.get_mg()->get_nzone() ;
00062   assert (nz>1) ;
00063   assert (source.get_mg()->get_type_r(nz-1) == UNSURR) ;
00064   
00065   // donnees sur la zone
00066   int nr, nt, np ;
00067   
00068   //Rangement des valeurs intermediaires 
00069   Tbl *so ;
00070   Tbl *sol_hom ;
00071   Tbl *sol_part ;
00072    
00073   
00074   // Rangement des solutions, avant raccordement
00075   Mtbl_cf solution_part(source.get_mg(), source.base) ;
00076   Mtbl_cf solution_hom_un(source.get_mg(), source.base) ;
00077   Mtbl_cf solution_hom_deux(source.get_mg(), source.base) ;
00078   Mtbl_cf resultat(source.get_mg(), source.base) ;
00079 
00080   solution_part.annule_hard() ;
00081   solution_hom_un.annule_hard() ;
00082   solution_hom_deux.annule_hard() ;
00083   resultat.annule_hard() ;
00084 
00085   // Computation of the SP and SH's in the ZEC ...
00086   int conte_start = 0 ;
00087   for (int l=0 ; l<nz-1 ; l++) {
00088     nt = source.get_mg()->get_nt(l) ;
00089     np = source.get_mg()->get_np(l) ;
00090     for (int k=0 ; k<np+1 ; k++)
00091       for (int j=0 ; j<nt ; j++)
00092     conte_start ++ ;
00093   }
00094   int conte = conte_start ;
00095 
00096   int zone = nz-1 ;
00097 
00098   nr = source.get_mg()->get_nr(zone) ;
00099   nt = source.get_mg()->get_nt(zone) ;
00100   np = source.get_mg()->get_np(zone) ;
00101   
00102   for (int k=0 ; k<np+1 ; k++)
00103     for (int j=0 ; j<nt ; j++) {
00104       
00105       if (ope_var.operateurs[conte] != 0x0) {
00106     
00107     // Calcul de la SH
00108     sol_hom = new Tbl(ope_var.operateurs[conte]->get_solh()) ;
00109     
00110     //Calcul de la SP
00111     so = new Tbl(nr) ;
00112     so->set_etat_qcq() ;
00113     for (int i=0 ; i<nr ; i++)
00114       so->set(i) = source(zone, k, j, i) ;
00115     
00116     sol_part = new Tbl(ope_var.operateurs[conte]->get_solp(*so)) ;
00117     
00118     // Rangement dans les tableaux globaux ;
00119     for (int i=0 ; i<nr ; i++) {
00120       solution_part.set(zone, k, j, i) = (*sol_part)(i) ;
00121       if (sol_hom->get_ndim()==1)
00122         solution_hom_un.set(zone, k, j, i) = (*sol_hom)(i) ;
00123       else
00124         {
00125           solution_hom_un.set(zone, k, j, i) = (*sol_hom)(0,i) ;
00126           solution_hom_deux.set(zone, k, j, i) = (*sol_hom)(1,i) ;
00127         }
00128     }
00129     
00130     delete so ;
00131     delete sol_hom ;
00132     delete sol_part ;
00133     
00134       }
00135       conte ++ ;
00136     }
00137 
00138  
00139   //---------------------------------------------------------
00140   // ON impose la bonne CL ... CASE ONLY SPHERICAL RIGHT NOW
00141   //---------------------------------------------------------
00142   
00143   // C'est pas simple toute cette sombre affaire...
00144   // Que le cas meme nombre de points dans chaque domaines...
00145 
00146   int start = conte_start ;
00147   for (int k=0 ; k<1 ; k++)
00148     for (int j=0 ; j<1 ; j++) {
00149       if (ope_var.operateurs[start] != 0x0) {
00150     
00151 
00152     // Valeurs en -1 :
00153     double facteur = ((val-ope_var.F_minus(nz-1, k, j))/
00154               ope_var.G_minus(nz-1) - 
00155               ope_var.operateurs[start]->val_sp_minus()) /
00156       ope_var.operateurs[start]->val_sh_one_minus()  ; 
00157 
00158     // Zec
00159     nr = source.get_mg()->get_nr(nz-1) ;
00160     for (int i=0 ; i<nr ; i++)
00161       resultat.set(nz-1,k,j,i) = solution_part(nz-1,k,j,i) + 
00162         facteur*solution_hom_un(nz-1,k,j,i) ;
00163       }
00164     start ++ ;
00165     }
00166     
00167   return resultat;
00168 }
00169 

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