donne_lm.C

00001 /*
00002  *   Copyright (c) 1999-2001 Philippe Grandclement
00003  *   Copyright (c) 2000-2001 Eric Gourgoulhon
00004  *   Copyright (c) 2000-2001 Jerome Novak
00005  *
00006  *   This file is part of LORENE.
00007  *
00008  *   LORENE is free software; you can redistribute it and/or modify
00009  *   it under the terms of the GNU General Public License as published by
00010  *   the Free Software Foundation; either version 2 of the License, or
00011  *   (at your option) any later version.
00012  *
00013  *   LORENE is distributed in the hope that it will be useful,
00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  *   GNU General Public License for more details.
00017  *
00018  *   You should have received a copy of the GNU General Public License
00019  *   along with LORENE; if not, write to the Free Software
00020  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  *
00022  */
00023 
00024 
00025 char donne_lm_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/donne_lm.C,v 1.8 2009/10/26 10:48:37 j_novak Exp $" ;
00026 
00027 
00028 /*
00029  * $Id: donne_lm.C,v 1.8 2009/10/26 10:48:37 j_novak Exp $
00030  * $Log: donne_lm.C,v $
00031  * Revision 1.8  2009/10/26 10:48:37  j_novak
00032  * Completed the T_LEG_MI case.
00033  *
00034  * Revision 1.7  2009/10/23 12:54:47  j_novak
00035  * New base T_LEG_MI
00036  *
00037  * Revision 1.6  2009/10/13 19:45:01  j_novak
00038  * New base T_LEG_MP.
00039  *
00040  * Revision 1.5  2005/02/18 13:14:13  j_novak
00041  * Changing of malloc/free to new/delete + suppression of some unused variables
00042  * (trying to avoid compilation warnings).
00043  *
00044  * Revision 1.4  2004/11/23 15:13:50  m_forot
00045  * Added the bases for the cases without any equatorial symmetry
00046  * (T_COSSIN_C, T_COSSIN_S, T_LEG, R_CHEBPI_P, R_CHEBPI_I).
00047  *
00048  * Revision 1.3  2003/09/16 12:11:59  j_novak
00049  * Added the base T_LEG_II.
00050  *
00051  * Revision 1.2  2002/10/16 14:36:54  j_novak
00052  * Reorganization of #include instructions of standard C++, in order to
00053  * use experimental version 3 of gcc.
00054  *
00055  * Revision 1.1.1.1  2001/11/20 15:19:29  e_gourgoulhon
00056  * LORENE
00057  *
00058  * Revision 3.0  2000/10/09  09:15:01  novak
00059  * correction pour les cas de bases en r alternees
00060  *
00061  * Revision 2.8  2000/10/04  14:55:33  eric
00062  * Ajout des bases T_LEG_IP et T_LEG_PI.
00063  *
00064  * Revision 2.7  1999/12/16  16:41:33  phil
00065  * *** empty log message ***
00066  *
00067  * Revision 2.6  1999/12/16  16:23:39  phil
00068  * vire un assert
00069  *
00070  * Revision 2.5  1999/12/16  16:21:38  phil
00071  * correction cas nt = 1
00072  *
00073  * Revision 2.4  1999/09/16  12:06:11  phil
00074  * correction des cas antisymetriques en z=0
00075  *
00076  * Revision 2.3  1999/09/14  17:52:59  phil
00077  * *** empty log message ***
00078  *
00079  * Revision 2.2  1999/09/14  17:44:16  phil
00080  * *** empty log message ***
00081  *
00082  * Revision 2.1  1999/04/13  13:50:01  phil
00083  * *** empty log message ***
00084  *
00085  * Revision 2.0  1999/04/13  13:31:01  phil
00086  * *** empty log message ***
00087  *
00088  * Revision 1.1  1999/04/13  13:30:28  phil
00089  * Initial revision
00090  *
00091  *
00092  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/donne_lm.C,v 1.8 2009/10/26 10:48:37 j_novak Exp $
00093  *
00094  */
00095 
00096 // Entetes C
00097 #include <stdlib.h>
00098 
00099 // Entete Lorene
00100 #include "headcpp.h"
00101 #include "type_parite.h"
00102 #include "base_val.h"
00103 
00104 /*
00105  * Fonction affection les nombres l_quant, m_quant et la base en r
00106  * 
00107  * ENTREES :      nz : le nombre de zones
00108  *        zone : la zone de travail  
00109  *        j et k : indices en theta et phi, respectivement
00110  *        base : la base de developpement
00111  * 
00112  * SORTIES : les variables m_quant, l_quant et base_r.
00113  * 
00114  */
00115 
00116 //-----------------------------------------------------------------
00117 // Developpement en P_COSSIN pour phi et T_LEG en theta
00118 //-------------------------------------------------------------------
00119 
00120 void donne_lm_nonsymTP (int j, int k, int &m_quant, int &l_quant) {
00121 
00122     m_quant = (k%2 == 0) ? k/2 : (k-1)/2;
00123     l_quant = j ;
00124     
00125 }
00126 
00127 
00128      //-----------------------------------------------------------------
00129     // Developpement en P_COSSIN pour phi et T_LEG_P en theta
00130        //-------------------------------------------------------------------
00131 
00132 void donne_lm_nonsym (int j, int k, int &m_quant, int &l_quant) {
00133 
00134     m_quant = (k%2 == 0) ? k/2 : (k-1)/2;
00135     l_quant = (m_quant%2 == 0) ? 2*j : 2*j+1 ;
00136     
00137 }
00138 
00139      //-----------------------------------------------------------------
00140     // Developpement en P_COSSIN pour phi et T_LEG_I en theta
00141        //-------------------------------------------------------------------
00142 
00143 void donne_lm_nonsym_anti (int j, int k, int &m_quant, int &l_quant) {
00144 
00145     m_quant = (k%2 == 0) ? k/2 : (k-1)/2;
00146     l_quant = (m_quant%2 == 1) ? 2*j : 2*j+1 ;
00147     
00148 }
00149 
00150      //------------------------------------------------------
00151     // Developpement en P_COSSIN_P pour phi et T_LEG_PP en theta
00152        //-------------------------------------------------------
00153 
00154 void donne_lm_sym (int j, int k, int &m_quant, int &l_quant) {
00155 
00156     m_quant = (k%2 == 0) ? k : k-1;
00157     l_quant = 2*j ;
00158     
00159 }
00160 
00161     
00162      //-------------------------------------------------------
00163     // Developpement en P_COSSIN_P pour phi et T_LEG_IP en theta
00164        //---------------------------------------------------------
00165 
00166 void donne_lm_t_leg_ip (int j, int k, int &m_quant, int &l_quant) {
00167 
00168     m_quant = (k%2 == 0) ? k : k-1 ;
00169     l_quant = 2*j+1 ;
00170     
00171 }
00172 
00173 
00174      //----------------------------------------------------------
00175     // Developpement en P_COSSIN_P pour phi et T_LEG_MP en theta
00176        //------------------------------------------------------------
00177 
00178 void donne_lm_t_leg_mp (int j, int k, int &m_quant, int &l_quant) {
00179 
00180     m_quant = (k%2 == 0) ? k : k-1;
00181     l_quant = j ;
00182     
00183 }
00184 
00185      //----------------------------------------------------------
00186     // Developpement en P_COSSIN_I pour phi et T_LEG_MI en theta
00187        //------------------------------------------------------------
00188 
00189 void donne_lm_t_leg_mi (int j, int k, int &m_quant, int &l_quant) {
00190 
00191     m_quant = 2*((k-1)/2 ) + 1 ;
00192     l_quant = j ;
00193     
00194 }
00195 
00196      //-------------------------------------------------------
00197     // Developpement en P_COSSIN_I pour phi et T_LEG_PI en theta
00198        //---------------------------------------------------------
00199 
00200 void donne_lm_t_leg_pi (int j, int k, int &m_quant, int &l_quant) {
00201 
00202     if (k<=2) {
00203     m_quant = 1 ; 
00204     }
00205     else{
00206     m_quant = (k%2 == 0) ? k-1 : k ; 
00207     }
00208     
00209     l_quant = 2*j+1 ;
00210     
00211 }
00212 
00213      //-------------------------------------------------------
00214     // Developpement en P_COSSIN_I pour phi et T_LEG_II en theta
00215        //---------------------------------------------------------
00216 
00217 void donne_lm_t_leg_ii (int j, int k, int &m_quant, int &l_quant) {
00218 
00219     if (k<=2) {
00220     m_quant = 1 ; 
00221     }
00222     else{
00223     m_quant = (k%2 == 0) ? k-1 : k ; 
00224     }
00225     
00226     l_quant = 2*j ;
00227     
00228 }
00229 
00230 
00231 
00232         //-----------------------------
00233            //       La fonction 
00234           //-------------------------------
00235           
00236 void donne_lm (int nz, int zone, int j, int k, Base_val base,
00237          int &m_quant, int &l_quant, int& base_r) {
00238     
00239     //verifications :
00240     assert (zone >= 0) ;
00241     assert (zone < nz) ;
00242     
00243     int base_t = (base.b[zone] & MSQ_T) ;
00244     int base_p = (base.b[zone] & MSQ_P) ;
00245     base_r = (base.b[zone] & MSQ_R) ;
00246     
00247     switch (base_p) {
00248     case P_COSSIN : 
00249         // cas sym ou antisym en z=0 ...
00250         switch (base_t) {
00251 
00252             case T_LEG :
00253           donne_lm_nonsymTP (j, k, m_quant, l_quant) ;
00254           break ;  
00255 
00256         case T_LEG_P :
00257           donne_lm_nonsym (j, k, m_quant, l_quant) ;
00258           break ;  
00259         
00260         case T_LEG_I :
00261           donne_lm_nonsym_anti (j, k, m_quant, l_quant) ;
00262           break ;  
00263         
00264         default :
00265             cout << "donne_lm : cas inconnu ..." << endl ;
00266             abort() ;
00267             break ;
00268         }
00269         break ;
00270 
00271     case P_COSSIN_P :
00272         switch (base_t) {
00273 
00274         case T_LEG_PP :
00275             donne_lm_sym (j, k, m_quant, l_quant) ;
00276             break ; 
00277 
00278         case T_LEG_MP :
00279             donne_lm_t_leg_mp (j, k, m_quant, l_quant) ;
00280             break ; 
00281 
00282         case T_LEG_IP :
00283           donne_lm_t_leg_ip (j, k, m_quant, l_quant); 
00284             break ; 
00285 
00286         default :
00287             cout << "donne_lm : cas inconnu ..." << endl ;
00288             abort() ;
00289             break ;
00290         }
00291         break ; 
00292 
00293     case P_COSSIN_I :
00294         switch (base_t) {
00295 
00296         case T_LEG_PI :
00297             donne_lm_t_leg_pi (j, k, m_quant, l_quant) ;
00298             break ; 
00299 
00300         case T_LEG_II :
00301             donne_lm_t_leg_ii (j, k, m_quant, l_quant) ;
00302             break ; 
00303 
00304         case T_LEG_MI :
00305             donne_lm_t_leg_mp (j, k, m_quant, l_quant) ;
00306             break ; 
00307 
00308         default :
00309             cout << "donne_lm : cas inconnu ..." << endl ;
00310             abort() ;
00311             break ;
00312 
00313         }
00314         break ;
00315     
00316     default :
00317         cout << "donne_lm : cas inconnu ..." << endl ;
00318         cout << nz << endl ; // to avoid compilation warnings ...
00319         abort() ;
00320         break ;
00321     }
00322     switch (base_r) {
00323 
00324         case R_CHEBPI_P :
00325       base_r = (l_quant%2 == 0) ? R_CHEBP : R_CHEBI ;
00326       break ;
00327       
00328         case R_CHEBPI_I :
00329       base_r = (l_quant%2 == 1) ? R_CHEBP : R_CHEBI ;
00330       break ;
00331       
00332         case R_CHEBPIM_P :
00333       base_r = (m_quant%2 == 0) ? R_CHEBP : R_CHEBI ;
00334       break ;
00335       
00336         case R_CHEBPIM_I :
00337       base_r = (m_quant%2 == 1) ? R_CHEBP : R_CHEBI ;
00338       break ;
00339       
00340     }
00341 }

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