30char vector_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Tensor/vector.C,v 1.30 2014/10/13 08:53:44 j_novak Exp $" ;
157 :
Tensor(map, 1, tipe, triad_i) {
166 :
Tensor(map, 1, tipe, *triad_i) {
194Vector::Vector(
const Map& mapping,
const Base_vect& triad_i, FILE* fd) :
195 Tensor(mapping, triad_i, fd) {
221 for (
int i=0; i<N_MET_MAX; i++)
224 if (
p_A != 0x0)
delete p_A ;
234 for (
int i=0; i<N_MET_MAX; i++)
244 assert( (j>=0) && (j<N_MET_MAX) ) ;
260 assert( (i>=0) && (i<N_MET_MAX) ) ;
273 for (
int i=0 ; i<3 ; i++) {
287 for (
int i=0 ; i<3 ; i++) {
298 assert ( (index>=1) && (index<=3) ) ;
302 return *
cmp[index - 1] ;
307 assert ( (index>=1) && (index<=3) ) ;
309 return *
cmp[index - 1] ;
332 for (
int i=0 ; i<3 ; i++) {
336 for (
int i=0 ; i<3 ; i++) {
362 for (
int i=0 ; i<3 ; i++) {
366 for (
int i=0 ; i<3 ; i++) {
386 assert(pscal != 0x0) ;
443 for (
int i=1; i<=3; i++) {
444 for (
int j=i; j<=3; j++) {
450 for (
int i=1; i<=3; i++) {
451 for (
int j=i; j<=3; j++) {
467 for (
int i=1; i<=3; i++) {
468 for (
int j=i; j<=3; j++) {
476 for (
int i=1; i<=3; i++) {
477 for (
int j=i; j<=3; j++) {
496 assert ((j>=0) && (j<N_MET_MAX)) ;
508 assert ((j>=0) && (j<N_MET_MAX)) ;
522 assert ((ind>=0) && (ind<N_MET_MAX)) ;
541 assert( dz_zero || dz_four) ;
542 assert (
cmp[1]->check_dzpuis(dzp)) ;
543 assert (
cmp[2]->check_dzpuis(dzp)) ;
560 assert (mapping != 0x0) ;
568 for (
int lz=0; lz<nz; lz++) {
569 assert (mmg->
get_np(lz) == np) ;
570 assert (mmg->
get_nt(lz) == nt) ;
574 for (
int k=0; k<np+1; k++)
575 for (
int j=0; j<nt; j++)
576 if ( nullite_plm(j, nt, k, np, val.
base)) {
577 int m_quant, l_quant, base_r ;
578 donne_lm (nz, 0, j, k, val.
base, m_quant,
580 lmax = (l_quant > lmax ? l_quant : lmax) ;
586 for (
int l=0; l<=lmax; l++) {
589 if (l == 0) *(ri[l]) = 1. ;
590 else *(ri[l]) =
pow(erre, l) ;
593 if (l==2) *(rmi[l]) = 1 ;
594 else *(rmi[l]) =
pow(erre, 2-l) ;
604 for (
int k=0; k<np+1; k++) {
605 for (
int j=0; j<nt; j++) {
606 if ( nullite_plm(j, nt, k, np, val.
base)) {
607 int m_quant, l_quant, base_r, l, c ;
608 donne_lm (nz, 0, j, k, val.
base, m_quant, l_quant, base_r) ;
609 bool lzero = (l_quant == 0) || (l_quant == 1) ;
610 int nb_hom_ced = (l_quant < 2 ? 0 : 1) ;
612 int taille = 2*(nz-1) - 1 + nb_hom_ced ;
615 Matrice systeme(taille,taille) ;
617 for (l=0; l<taille; l++)
618 for (c=0; c<taille; c++) systeme.
set(l,c) = 0 ;
619 for (l=0; l<taille; l++) deuz.
set(l) = 0 ;
632 for (
int i=0; i<nr; i++)
633 partn.
set(i) = mtc(0, k, j, i) ;
636 systeme.
set(l,c) +=
pow(alpha,
double(l_quant)) ;
638 deuz.
set(l) -= val1_dern_1d(0, partn, base_r) ;
642 systeme.
set(l,c) += l_quant *
pow(alpha,
double(l_quant - 1)) ;
644 deuz.
set(l) -= val1_dern_1d(1, partn, base_r) / alpha ;
651 for (
int lz=1; lz<nz-1; lz++) {
653 double beta = mapping->
get_beta()[lz] ;
654 double xm1 = beta - alpha ;
655 double xp1 = alpha + beta ;
659 for (
int i=0; i<nr; i++)
660 parts.
set(i) = mtc(lz, k, j, i) ;
665 systeme.
set(l,c) -=
pow(xm1,
double(l_quant)) ;
667 systeme.
set(l,c) -=
pow(xm1,
double(-l_quant-1)) ;
669 deuz.
set(l) += valm1_dern_1d(0, parts,
R_CHEB) ;
671 if ((lz>1) || (!lzero)) {
675 systeme.
set(l,c) -= l_quant*
pow(xm1,
double(l_quant - 1)) ;
677 systeme.
set(l,c) -= (-l_quant - 1)*
678 pow(xm1,
double(-l_quant - 2)) ;
680 deuz.
set(l) += valm1_dern_1d(1, parts,
R_CHEB) / alpha ;
686 systeme.
set(l,c) +=
pow(xp1,
double(l_quant)) ;
688 systeme.
set(l,c) +=
pow(xp1,
double(-l_quant-1)) ;
690 deuz.
set(l) -= val1_dern_1d(0, parts,
R_CHEB) ;
695 systeme.
set(l,c) += l_quant*
pow(xp1,
double(l_quant - 1)) ;
697 systeme.
set(l,c) += (-l_quant - 1)*
698 pow(xp1,
double(-l_quant - 2)) ;
700 deuz.
set(l) -= val1_dern_1d(1, parts,
R_CHEB) / alpha ;
711 for (
int i=0; i<nr; i++)
712 partc.
set(i) = mtc(nz-1, k, j, i) ;
715 double beta = mapping->
get_beta()[nz-1] ;
716 double xm1 = beta - alpha ;
717 double part0, part1 ;
718 part0 = valm1_dern_1d(0, partc,
R_CHEB) ;
719 part1 = xm1*valm1_dern_1d(1, partc,
R_CHEB) / alpha ;
726 systeme.
set(l,c) -=
pow(xm1,
double(l_quant+1)) ;
728 deuz.
set(l) += part0*xm1*xm1*xm1 ;
733 systeme.
set(l,c) -= (-l_quant - 1)*
734 pow(xm1,
double(l_quant + 2)) ;
736 if ( (nz > 2) || (!lzero))
737 deuz.
set(l) += -xm1*xm1*xm1*xm1*(3*part0 + part1) ;
743 int inf = 1 + nb_hom_ced;
744 int sup = 3 - nb_hom_ced;
753 for (
int i=0; i<nr; i++)
754 mtc.
set(0, k, j, i) +=
758 for (
int lz=1; lz<nz-1; lz++) {
760 for (
int i=0; i<nr; i++)
761 mtc.
set(lz, k, j, i) += facteur(2*lz - 1)*
763 for (
int i=0; i<nr; i++)
764 mtc.
set(lz, k, j, i) += facteur(2*lz)*
771 for (
int i=0; i<nr; i++)
772 mtc.
set(nz-1, k, j, i) +=
781 for (
int l=0; l<=lmax; l++) {
814 "Vector::flux : the case of a mapping outside the class Map_af\n"
815 <<
" is not implemented yet !" << endl ;
822 "Vector::flux : the case of a non flat metric is not implemented yet !"
830 vspher =
new Vector(*
this) ;
835 const Vector* vv = (bcart != 0x0) ? vspher : this ;
837 const Scalar& vr = vv->operator()(1) ;
840 if (radius == __infinity) {
853 for (
int i=0; i<
n_comp; i++)
870 for (
int i=0; i<
n_comp; i++)
Bases of the spectral expansions.
Cartesian vectorial bases (triads).
Spherical orthonormal vectorial bases (triads).
Vectorial bases (triads) with respect to which the tensorial components are defined.
virtual int identify() const =0
Returns a number to identify the sub-classe of Base_vect the object belongs to.
const double * get_beta() const
Returns the pointer on the array beta.
const double * get_alpha() const
Returns the pointer on the array alpha.
double integrale_surface_infini(const Cmp &ci) const
Performs the surface integration of ci at infinity.
double integrale_surface(const Cmp &ci, double rayon) const
Performs the surface integration of ci on the sphere of radius rayon .
Base class for coordinate mappings.
const Base_vect_cart & get_bvect_cart() const
Returns the Cartesian basis associated with the coordinates (x,y,z) of the mapping,...
Coord r
r coordinate centered on the grid
const Base_vect_spher & get_bvect_spher() const
Returns the orthonormal vectorial basis associated with the coordinates of the mapping.
const Metric_flat & flat_met_cart() const
Returns the flat metric associated with the Cartesian coordinates and with components expressed in th...
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
const Metric_flat & flat_met_spher() const
Returns the flat metric associated with the spherical coordinates and with components expressed in th...
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
double & set(int j, int i)
Read/write of a particuliar element.
Tbl inverse(const Tbl &sec_membre) const
Solves the linear system represented by the matrix.
void set_band(int up, int low) const
Calculate the band storage of *std.
void set_lu() const
Calculate the LU-representation, assuming the band-storage has been done.
Flat metric for tensor calculation.
Metric for tensor calculation.
virtual const Sym_tensor & con() const
Read-only access to the contravariant representation.
virtual const Sym_tensor & cov() const
Read-only access to the covariant representation.
Base_val ** std_base_vect_spher() const
Returns the standard spectral bases for the spherical components of a vector.
Base_val ** pseudo_base_vect_spher() const
Returns the standard spectral bases for the spherical components of a pseudo-vector.
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
Base_val ** pseudo_base_vect_cart() const
Returns the standard spectral bases for the Cartesian components of a pseudo-vector.
int get_nzone() const
Returns the number of domains.
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
int get_type_r(int l) const
Returns the type of sampling in the radial direction in domain no.
Base_val ** std_base_vect_cart() const
Returns the standard spectral bases for the Cartesian components of a vector.
Coefficients storage for the multi-domain spectral method.
Tbl & set(int l)
Read/write of the Tbl containing the coefficients in a given domain.
Tensor field of valence 0 (or component of a tensorial field).
const Scalar & dsdz() const
Returns of *this , where .
const Scalar & dsdt() const
Returns of *this .
Scalar poisson() const
Solves the scalar Poisson equation with *this as a source.
int get_dzpuis() const
Returns dzpuis.
const Scalar & dsdy() const
Returns of *this , where .
const Scalar & srstdsdp() const
Returns of *this .
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field.
bool check_dzpuis(int dzi) const
Returns false if the last domain is compactified and *this is not zero in this domain and dzpuis is n...
void div_r()
Division by r everywhere; dzpuis is not changed.
const Scalar & dsdx() const
Returns of *this , where .
virtual void set_etat_zero()
Sets the logical state to ETATZERO (zero).
void div_tant()
Division by .
const Scalar & dsdr() const
Returns of *this .
virtual void exponential_filter_ylm(int lzmin, int lzmax, int p, double alpha=-16.)
Applies an exponential filter to the spectral coefficients in the angular directions.
virtual void annule(int l_min, int l_max)
Sets the Scalar to zero in several domains.
Valeur & set_spectral_va()
Returns va (read/write version)
const Valeur & get_spectral_va() const
Returns va (read only version)
int get_etat() const
Returns the logical state ETATNONDEF (undefined), ETATZERO (null) or ETATQCQ (ordinary).
void set_dzpuis(int)
Modifies the dzpuis flag.
const Vector & derive_con(const Metric &gam) const
Returns the "contravariant" derivative of *this with respect to some metric , by raising the index of...
void mult_r()
Multiplication by r everywhere; dzpuis is not changed.
void set_spectral_base(const Base_val &)
Sets the spectral bases of the Valeur va
virtual void exponential_filter_r(int lzmin, int lzmax, int p, double alpha=-16.)
Applies an exponential filter to the spectral coefficients in the radial direction.
Class intended to describe valence-2 symmetric tensors.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
double & set(int i)
Read/write of a particular element (index i) (1D case)
Values and coefficients of a (real-value) function.
void ylm()
Computes the coefficients of *this.
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
void coef() const
Computes the coeffcients of *this.
void set_base_r(int l, int base_r)
Sets the expansion basis for r ( ) functions in a given domain.
void ylm_i()
Inverse of ylm()
Base_val base
Bases on which the spectral expansion is performed.
Tensor field of valence 1.
const Scalar & operator()(int) const
Readonly access to a component.
Sym_tensor ope_killing(const Metric &gam) const
Computes the Killing operator associated with a given metric.
virtual void std_spectral_base()
Sets the standard spectal bases of decomposition for each component.
void decompose_div(const Metric &) const
Makes the Helmholtz decomposition (see documentation of p_potential ) of this with respect to a given...
const Scalar & divergence(const Metric &) const
The divergence of this with respect to a Metric .
Scalar * p_potential[N_MET_MAX]
The potential giving the gradient part in the Helmholtz decomposition of any 3D vector .
virtual void del_deriv() const
Deletes the derived quantities.
virtual const Scalar & mu() const
Gives the field such that the angular components of the vector are written:
virtual void del_derive_met(int) const
Logical destructor of the derivatives depending on the i-th element of met_depend in the class Vector...
double flux(double radius, const Metric &met) const
Computes the flux of the vector accross a sphere r = const.
Vector_divfree * p_div_free[N_MET_MAX]
The divergence-free vector of the Helmholtz decomposition of any 3D vector .
const Vector_divfree curl() const
The curl of this with respect to a (flat) Metric .
Scalar * p_A
Field defined by.
virtual const Scalar & eta() const
Gives the field such that the angular components of the vector are written:
virtual void exponential_filter_r(int lzmin, int lzmax, int p, double alpha=-16.)
Applies exponential filters to all components (see Scalar::exponential_filter_r ).
const Vector_divfree & div_free(const Metric &) const
Returns the div-free vector in the Helmholtz decomposition.
void set_der_0x0() const
Sets the pointers on derived quantities to 0x0.
virtual ~Vector()
Destructor.
virtual void pseudo_spectral_base()
Sets the standard spectal bases of decomposition for each component for a pseudo_vector.
void set_der_met_0x0(int) const
Sets all the i-th components of met_depend in the class Vector (p_potential , etc....
Scalar * p_mu
Field such that the angular components of the vector are written:
Scalar * p_eta
Field such that the angular components of the vector are written:
Sym_tensor ope_killing_conf(const Metric &gam) const
Computes the conformal Killing operator associated with a given metric.
virtual void change_triad(const Base_vect &)
Sets a new vectorial basis (triad) of decomposition and modifies the components accordingly.
virtual void operator=(const Vector &a)
Assignment from a Vector.
const Scalar & potential(const Metric &) const
Returns the potential in the Helmholtz decomposition.
Scalar & set(int)
Read/write access to a component.
void set_vr_eta_mu(const Scalar &vr_i, const Scalar &eta_i, const Scalar &mu_i)
Defines the components through potentials and (see members p_eta and p_mu ), as well as the compon...
virtual void exponential_filter_ylm(int lzmin, int lzmax, int p, double alpha=-16.)
Applies exponential filters to all components (see Scalar::exponential_filter_ylm ).
Vector derive_lie(const Vector &v) const
Computes the Lie derivative of this with respect to some vector field v.
Cmp pow(const Cmp &, int)
Power .
#define R_CHEBI
base de Cheb. impaire (rare) seulement
#define R_CHEB
base de Chebychev ordinaire (fin)
#define R_CHEBP
base de Cheb. paire (rare) seulement
virtual void del_derive_met(int) const
Logical destructor of the derivatives depending on the i-th element of met_depend .
virtual void dec_dzpuis(int dec=1)
Decreases by dec units the value of dzpuis and changes accordingly the values in the compactified ext...
const Map *const mp
Mapping on which the numerical values at the grid points are defined.
int get_place_met(const Metric &) const
Returns the position of the pointer on metre in the array met_depend .
const Tensor & derive_con(const Metric &gam) const
Returns the "contravariant" derivative of this with respect to some metric , by raising the last inde...
const Metric * met_depend[N_MET_MAX]
Array on the Metric 's which were used to compute derived quantities, like p_derive_cov ,...
int valence
Valence of the tensor (0 = scalar, 1 = vector, etc...)
void set_dependance(const Metric &) const
To be used to describe the fact that the derivatives members have been calculated with met .
Scalar ** cmp
Array of size n_comp of pointers onto the components.
void compute_derive_lie(const Vector &v, Tensor &resu) const
Computes the Lie derivative of this with respect to some vector field v (protected method; the public...
int n_comp
Number of stored components, depending on the symmetry.
void annule_domain(int l)
Sets the Tensor to zero in a given domain.
virtual void del_deriv() const
Deletes the derived quantities.
const Tensor & divergence(const Metric &gam) const
Computes the divergence of this with respect to some metric .
const Tensor & derive_cov(const Metric &gam) const
Returns the covariant derivative of this with respect to some metric .
Itbl type_indice
1D array of integers (class Itbl ) of size valence containing the type of each index: COV for a cov...
Tensor trace(int ind1, int ind2) const
Trace on two different type indices.
Scalar & set(const Itbl &ind)
Returns the value of a component (read/write version).
const Base_vect * triad
Vectorial basis (triad) with respect to which the tensor components are defined.