raccord_c1.C

00001 /*
00002  *   Copyright (c) 2000-2001 Eric Gourgoulhon
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 raccord_c1_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Utilities/raccord_c1.C,v 1.3 2010/01/26 16:47:40 e_gourgoulhon Exp $" ;
00024 
00025 /*
00026  * $Id: raccord_c1.C,v 1.3 2010/01/26 16:47:40 e_gourgoulhon Exp $
00027  * $Log: raccord_c1.C,v $
00028  * Revision 1.3  2010/01/26 16:47:40  e_gourgoulhon
00029  * Added the Scalar version.
00030  *
00031  * Revision 1.2  2003/12/19 16:21:49  j_novak
00032  * Shadow hunt
00033  *
00034  * Revision 1.1.1.1  2001/11/20 15:19:29  e_gourgoulhon
00035  * LORENE
00036  *
00037  * Revision 2.0  2000/03/22  10:08:55  eric
00038  * *** empty log message ***
00039  *
00040  *
00041  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Utilities/raccord_c1.C,v 1.3 2010/01/26 16:47:40 e_gourgoulhon Exp $
00042  *
00043  */
00044 
00045 // Headers Lorene
00046 #include "cmp.h"
00047 #include "scalar.h"
00048 
00049 Cmp raccord_c1(const Cmp& uu, int l1) {
00050     
00051     const Map_radial* mpi = dynamic_cast<const Map_radial*>( uu.get_mp() ) ; 
00052 
00053     if (mpi == 0x0) {
00054     cout << 
00055     "raccord_c1 : The mapping does not belong to the class Map_radial !"
00056         << endl ; 
00057     abort() ;
00058     }
00059 
00060     const Map_radial& mp = *mpi ; 
00061 
00062     const Mg3d& mg = *(mp.get_mg()) ; 
00063     
00064 #ifndef NDEBUG
00065     int nz = mg.get_nzone() ; 
00066 #endif
00067     assert(l1 > 0) ; 
00068     assert(l1 < nz-1) ; 
00069     
00070     int l0 = l1 - 1 ;   // index of left domain
00071     int l2 = l1 + 1 ;   // index of right domain
00072     
00073     
00074     Mtbl dxdr = mp.dxdr ; 
00075     Mtbl r2 = mp.r * mp.r ; 
00076      
00077     Cmp resu = uu ; 
00078     
00079     Valeur& va = resu.va ; 
00080     
00081     va.coef_i() ; 
00082     va.set_etat_c_qcq() ; 
00083     
00084     va.c->set_etat_qcq() ; 
00085     va.c->t[l1]->set_etat_qcq() ; 
00086     
00087     int np = mg.get_np(l1) ; 
00088     int nt = mg.get_nt(l1) ; 
00089     assert( mg.get_np(l0) == np ) ;    
00090     assert( mg.get_nt(l0) == nt ) ;    
00091     assert( mg.get_np(l2) == np ) ;    
00092     assert( mg.get_nt(l2) == nt ) ;    
00093     
00094     int nr0 = mg.get_nr(l0) ; 
00095     int nr1 = mg.get_nr(l1) ; 
00096     
00097     for (int k=0; k<np; k++) {
00098     for (int j=0; j<nt; j++) {
00099         double lam0 = uu(l0, k, j, nr0-1) ;    
00100         double lam1 = uu.dsdr()(l0, k, j, nr0-1) / dxdr(l1, k, j, 0) ;    
00101         double mu0 = uu(l2, k, j, 0) ;    
00102         double mu1 = uu.dsdr()(l2, k, j, 0) / dxdr(l1, k, j, nr1-1) ;  
00103        
00104         if ( mg.get_type_r(l2) == UNSURR ) {
00105         mu1 /= r2(l2, k, j, 0) ; 
00106         }
00107        
00108         double s0 = 0.25 * (mu0 + lam0) ;  
00109         double s1 = 0.25 * (mu1 + lam1) ;  
00110         double d0 = 0.25 * (mu0 - lam0) ;  
00111         double d1 = 0.25 * (mu1 - lam1) ;  
00112         
00113         double a0 = 2. * s0 - d1 ; 
00114         double a1 = 3. * d0 - s1 ; 
00115         double a2 = d1 ; 
00116         double a3 = s1 - d0 ; 
00117         
00118         for (int i=0; i<nr1; i++) {
00119         double x = mg.get_grille3d(l1)->x[i] ; 
00120             va.set(l1, k, j, i) = a0 + x * ( a1 + x * ( a2 + x * a3 ) ) ; 
00121         }
00122          
00123     }
00124     }
00125     
00126     return resu ; 
00127     
00128 }
00129 
00130 /*
00131  * Scalar version 
00132  */
00133 Scalar raccord_c1(const Scalar& uu, int l1) {
00134 
00135     Cmp cuu(uu) ; 
00136     return Scalar( raccord_c1(cuu, l1) ) ; 
00137    
00138 }

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