cmp_raccord_zec.C
/*
* Copyright (c) 2000-2001 Philippe Grandclement
*
* This file is part of LORENE.
*
* LORENE is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* LORENE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LORENE; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
char cmp_raccord_zec_C[] = "$Header: /cvsroot/Lorene/C++/Source/Cmp/cmp_raccord_zec.C,v 1.4 2014/10/13 08:52:48 j_novak Exp $" ;
/*
* $Id: cmp_raccord_zec.C,v 1.4 2014/10/13 08:52:48 j_novak Exp $
* $Log: cmp_raccord_zec.C,v $
* Revision 1.4 2014/10/13 08:52:48 j_novak
* Lorene classes and functions now belong to the namespace Lorene.
*
* Revision 1.3 2014/10/06 15:13:04 j_novak
* Modified #include directives to use c++ syntax.
*
* Revision 1.2 2003/10/03 15:58:45 j_novak
* Cleaning of some headers
*
* Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
* LORENE
*
* Revision 2.7 2001/03/30 13:38:32 phil
* *** empty log message ***
*
* Revision 2.6 2001/03/22 10:25:01 phil
* changement complet : cas plus general
*
* Revision 2.5 2001/02/08 14:21:32 phil
* correction de raccord_zec.C (on prend en compte le dernier coef ...)
*
* Revision 2.4 2001/01/02 11:25:37 phil
* *** empty log message ***
*
* Revision 2.3 2000/12/13 14:59:18 phil
* *** empty log message ***
*
* Revision 2.2 2000/12/13 14:49:54 phil
* changement nom variable appel
* /
*
* Revision 2.1 2000/12/13 14:12:29 phil
* correction bugs
*
* Revision 2.0 2000/12/13 14:09:31 phil
* *** empty log message ***
*
*
* $Header: /cvsroot/Lorene/C++/Source/Cmp/cmp_raccord_zec.C,v 1.4 2014/10/13 08:52:48 j_novak Exp $
*
*/
//standard
#include <cstdlib>
#include <cmath>
// LORENE
#include "matrice.h"
#include "cmp.h"
#include "proto.h"
// Fait le raccord C1 dans la zec ...
namespace Lorene {
// Suppose (pour le moment, le meme nbre de points sur les angles ...)
// et que la zone precedente est une coquille
void Cmp::raccord_c1_zec (int puis, int nbre, int lmax) {
assert (nbre>0) ;
assert (etat != ETATNONDEF) ;
if (etat == ETATZERO)
return ;
// Le mapping doit etre affine :
const Map_af* map = dynamic_cast<const Map_af*>(mp) ;
if (map == 0x0) {
cout << "Le mapping doit etre affine" << endl ;
abort() ;
}
int nz = map->get_mg()->get_nzone() ;
int nr = map->get_mg()->get_nr (nz-1) ;
int nt = map->get_mg()->get_nt (nz-1) ;
int np = map->get_mg()->get_np (nz-1) ;
double alpha = map->get_alpha()[nz-1] ;
double r_cont = -1./2./alpha ; //Rayon de debut de la zec.
// On calcul les coefficients des puissances de 1./r
Tbl coef (nbre+2*lmax, nr) ;
coef.set_etat_qcq() ;
int* deg = new int[3] ;
deg[0] = 1 ; deg[1] = 1 ; deg[2] = nr ;
double* auxi = new double[nr] ;
for (int conte=0 ; conte<nbre+2*lmax ; conte++) {
for (int i=0 ; i<nr ; i++)
auxi[i] = pow(-1-cos(M_PI*i/(nr-1)), (conte+puis)) ;
cfrcheb(deg, deg, auxi, deg, auxi) ;
for (int i=0 ; i<nr ; i++)
coef.set(conte, i) = auxi[i]*pow (alpha, conte+puis) ;
}
delete[] deg ;
// Maintenant on va calculer les valeurs de la ieme derivee :
Tbl valeurs (nbre, nt, np+1) ;
valeurs.set_etat_qcq() ;
Cmp courant (*this) ;
double* res_val = new double[1] ;
for (int conte=0 ; conte<nbre ; conte++) {
courant.va.coef() ;
courant.va.ylm() ;
courant.va.c_cf->t[nz-1]->annule_hard() ;
int base_r = courant.va.base.get_base_r(nz-2) ;
for (int k=0 ; k<np+1 ; k++)
for (int j=0 ; j<nt ; j++)
if (nullite_plm(j, nt, k, np, courant.va.base) == 1) {
for (int i=0 ; i<nr ; i++)
auxi[i] = (*courant.va.c_cf)(nz-2, k, j, i) ;
switch (base_r) {
case R_CHEB :
som_r_cheb (auxi, nr, 1, 1, 1, res_val) ;
break ;
default :
cout << "Cas non prevu dans raccord_zec" << endl ;
abort() ;
break ;
}
valeurs.set(conte, k, j) = res_val[0] ;
}
Cmp copie (courant) ;
copie.dec2_dzpuis() ;
courant = copie.dsdr() ;
}
delete [] auxi ;
delete [] res_val ;
// On boucle sur les harmoniques : construction de la matrice
// et du second membre
va.coef() ;
va.ylm() ;
va.c_cf->t[nz-1]->annule_hard() ;
va.set_etat_cf_qcq() ;
const Base_val& base = va.base ;
int base_r, l_quant, m_quant ;
for (int k=0 ; k<np+1 ; k++)
for (int j=0 ; j<nt ; j++)
if (nullite_plm(j, nt, k, np, va.base) == 1) {
donne_lm (nz, nz-1, j, k, base, m_quant, l_quant, base_r) ;
if (l_quant<=lmax) {
Matrice systeme (nbre, nbre) ;
systeme.set_etat_qcq() ;
for (int col=0 ; col<nbre ; col++)
for (int lig=0 ; lig<nbre ; lig++) {
int facteur = (lig%2==0) ? 1 : -1 ;
for (int conte=0 ; conte<lig ; conte++)
facteur *= puis+col+conte+2*l_quant ;
systeme.set(lig, col) = facteur/pow(r_cont, puis+col+lig+2*l_quant) ;
}
systeme.set_band(nbre, nbre) ;
systeme.set_lu() ;
Tbl sec_membre (nbre) ;
sec_membre.set_etat_qcq() ;
for (int conte=0 ; conte<nbre ; conte++)
sec_membre.set(conte) = valeurs(conte, k, j) ;
Tbl inv (systeme.inverse(sec_membre)) ;
for (int conte=0 ; conte<nbre ; conte++)
for (int i=0 ; i<nr ; i++)
va.c_cf->set(nz-1, k, j, i)+=
inv(conte)*coef(conte+2*l_quant, i) ;
}
else for (int i=0 ; i<nr ; i++)
va.c_cf->set(nz-1, k, j, i)
= 0 ;
}
va.ylm_i() ;
set_dzpuis (0) ;
}
}
Lorene::Base_val
Bases of the spectral expansions.
Definition base_val.h:322
Lorene::Base_val::get_base_r
int get_base_r(int l) const
Returns the expansion basis for r ( ) functions in the domain of index l (e.g.
Definition base_val.h:400
Lorene::Cmp::mp
const Map * mp
Reference mapping.
Definition cmp.h:451
Lorene::Cmp::raccord_c1_zec
void raccord_c1_zec(int puis, int nbre, int lmax)
Performs the matching of the external domain with respect to the last shell using function like wit...
Definition cmp_raccord_zec.C:84
Lorene::Cmp::Cmp
Cmp(const Map &map)
Constructor from mapping.
Definition cmp.C:208
Lorene::Cmp::va
Valeur va
The numerical value of the Cmp.
Definition cmp.h:464
Lorene::Cmp::etat
int etat
Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
Definition cmp.h:454
Lorene::Cmp::set_dzpuis
void set_dzpuis(int)
Set a value to dzpuis.
Definition cmp.C:654
Lorene::Cmp::dec2_dzpuis
void dec2_dzpuis()
Decreases by 2 the value of dzpuis and changes accordingly the values of the Cmp in the external comp...
Definition cmp_r_manip.C:180
Lorene::Cmp::dsdr
const Cmp & dsdr() const
Returns of *this .
Definition cmp_deriv.C:84
Lorene::Map_af
Affine radial mapping.
Definition map.h:2027
Lorene::Map_af::get_alpha
const double * get_alpha() const
Returns the pointer on the array alpha.
Definition map_af.C:477
Lorene::Matrice
Matrix handling.
Definition matrice.h:152
Lorene::Matrice::set_etat_qcq
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition matrice.C:175
Lorene::Matrice::set
double & set(int j, int i)
Read/write of a particuliar element.
Definition matrice.h:277
Lorene::Matrice::inverse
Tbl inverse(const Tbl &sec_membre) const
Solves the linear system represented by the matrix.
Definition matrice.C:424
Lorene::Matrice::set_band
void set_band(int up, int low) const
Calculate the band storage of *std.
Definition matrice.C:364
Lorene::Matrice::set_lu
void set_lu() const
Calculate the LU-representation, assuming the band-storage has been done.
Definition matrice.C:392
Lorene::Mtbl_cf::t
Tbl ** t
Array (size nzone ) of pointers on the Tbl 's which contain the spectral coefficients in each domain.
Definition mtbl_cf.h:205
Lorene::Tbl
Basic array class.
Definition tbl.h:161
Lorene::Tbl::annule_hard
void annule_hard()
Sets the Tbl to zero in a hard way.
Definition tbl.C:372
Lorene::Tbl::set_etat_qcq
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition tbl.C:361
Lorene::Tbl::set
double & set(int i)
Read/write of a particular element (index i) (1D case).
Definition tbl.h:281
Lorene::Valeur::ylm
void ylm()
Computes the coefficients of *this.
Definition valeur_ylm.C:138
Lorene::Valeur::c_cf
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
Definition valeur.h:302
Lorene::Valeur::coef
void coef() const
Computes the coeffcients of *this.
Definition valeur_coef.C:148
Lorene::Valeur::base
Base_val base
Bases on which the spectral expansion is performed.
Definition valeur.h:305
Lorene::pow
Cmp pow(const Cmp &, int)
Power .
Definition cmp_math.C:348
Lorene::cos
Cmp cos(const Cmp &)
Cosine.
Definition cmp_math.C:94
R_CHEB
#define R_CHEB
base de Chebychev ordinaire (fin)
Definition type_parite.h:166
Lorene
Lorene prototypes.
Definition app_hor.h:64