25char tenseur_operateur_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Tenseur/tenseur_operateur.C,v 1.10 2014/10/13 08:53:42 j_novak Exp $" ;
121 assert ((
t1.etat != ETATNONDEF) && (
t2.etat != ETATNONDEF)) ;
127 const Metrique*
met_res = 0x0 ;
138 if ((
t1.etat == ETATZERO) || (
t2.etat == ETATZERO))
139 scal.set_etat_zero() ;
141 scal.set_etat_qcq() ;
150 tipe.set_etat_qcq() ;
151 for (
int i=0 ;
i<
t1.valence ;
i++)
153 for (
int i=0 ;
i<
t2.valence ;
i++)
157 if ( (
t1.valence != 0) && (
t2.valence != 0) ) {
158 assert ( *(
t1.get_triad()) == *(
t2.get_triad()) ) ;
162 if (
t1.valence != 0) {
171 if ((
t1.etat == ETATZERO) || (
t2.etat == ETATZERO))
172 res.set_etat_zero() ;
180 for (
int i=0 ;
i<
res.n_comp ;
i++) {
182 for (
int j=0 ;
j<
t1.valence ;
j++)
184 for (
int j=0 ;
j<
t2.valence ;
j++)
201 assert ((
t1.etat != ETATNONDEF) && (
t2.etat != ETATNONDEF)) ;
207 const Metrique*
met_res = 0x0 ;
218 if ((
t1.etat == ETATZERO) || (
t2.etat == ETATZERO))
219 scal.set_etat_zero() ;
221 scal.set_etat_qcq() ;
230 tipe.set_etat_qcq() ;
231 for (
int i=0 ;
i<
t1.valence ;
i++)
233 for (
int i=0 ;
i<
t2.valence ;
i++)
237 if ( (
t1.valence != 0) && (
t2.valence != 0) ) {
238 assert ( *(
t1.get_triad()) == *(
t2.get_triad()) ) ;
242 if (
t1.valence != 0) {
253 if ((
t1.etat == ETATZERO) || (
t2.etat == ETATZERO))
254 res.set_etat_zero() ;
262 for (
int i=0 ;
i<
res.n_comp ;
i++) {
264 for (
int j=0 ;
j<
t1.valence ;
j++)
266 for (
int j=0 ;
j<
t2.valence ;
j++)
299 tipe.set_etat_qcq() ;
311 if (
source.etat == ETATZERO) {
312 res.set_etat_zero() ;
325 for (
int i=0 ;
i<
res.n_comp ;
i++) {
335 work.set_etat_zero() ;
336 for (
int j=0 ;
j<3 ;
j++) {
350 assert ((
t1.etat != ETATNONDEF) && (
t2.etat != ETATNONDEF)) ;
357 if ( (
t1.valence != 0) && (
t2.valence != 0) ) {
358 assert ( *(
t1.get_triad()) == *(
t2.get_triad()) ) ;
365 const Metrique*
met_res = 0x0 ;
372 tipe.set_etat_qcq() ;
377 for (
int i=
t1.valence-1 ;
i<
t1.valence+
ind2-1 ;
i++)
378 tipe.set(
i) =
t2.type_indice(
i-
t1.valence+1) ;
380 tipe.set(
i) =
t2.type_indice(
i-
t1.valence+2) ;
387 if ( (
t1.etat == ETATZERO) || (
t2.etat == ETATZERO) ) {
388 res.set_etat_zero() ;
416 work.set_etat_zero() ;
417 for (
int j=0 ;
j<3 ;
j++) {
430 assert ((
t1.etat != ETATNONDEF) && (
t2.etat != ETATNONDEF)) ;
437 if ( (
t1.valence != 0) && (
t2.valence != 0) ) {
438 assert ( *(
t1.get_triad()) == *(
t2.get_triad()) ) ;
444 poids_res = (fabs(poids_res) < 1.e-10 ? 0. : poids_res) ;
445 const Metrique* met_res = 0x0 ;
446 if (poids_res != 0.) {
449 else met_res = t2.
metric ;
452 tipe.set_etat_qcq() ;
453 for (
int i=0 ; i<ind1 ; i++)
455 for (
int i=ind1 ; i<t1.
valence-1 ; i++)
459 for (
int i = t1.
valence+ind2-1 ; i<val_res ; i++)
462 const Base_vect* triad_res = (val_res == 0) ? 0x0 : t1.get_triad() ;
464 Tenseur res(*t1.
mp, val_res, tipe, triad_res, met_res, poids_res) ;
467 if ( (t1.
etat == ETATZERO) || (t2.
etat == ETATZERO) ) {
468 res.set_etat_zero() ;
478 Itbl jeux_indice_t1(t1.
valence) ;
479 Itbl jeux_indice_t2(t2.
valence) ;
480 jeux_indice_t1.set_etat_qcq() ;
481 jeux_indice_t2.set_etat_qcq() ;
483 for (
int comp=0 ; comp<res.n_comp ; comp++) {
484 Itbl jeux_indice_res (res.donne_indices(comp)) ;
485 for (
int i=0 ; i<ind1 ; i++)
486 jeux_indice_t1.set(i) = jeux_indice_res(i) ;
487 for (
int i=ind1+1 ; i<t1.
valence ; i++)
488 jeux_indice_t1.set(i) = jeux_indice_res(i-1) ;
489 for (
int i=0 ; i<ind2 ; i++)
490 jeux_indice_t2.set(i) = jeux_indice_res(t1.
valence+i-1) ;
491 for (
int i=ind2+1 ; i<t2.
valence ; i++)
492 jeux_indice_t2.set(i) = jeux_indice_res(t1.
valence+i-2) ;
496 work.set_etat_zero() ;
497 for (
int j=0 ; j<3 ; j++) {
498 jeux_indice_t1.set(ind1) = j ;
499 jeux_indice_t2.set(ind2) = j ;
500 work = work + t1(jeux_indice_t1)%t2(jeux_indice_t2) ;
503 res.set(jeux_indice_res) = work ;
519 tipe.set_etat_qcq() ;
528 if (
t1.type_indice(
place) == COV)
545 for (
int i=0 ;
i<
res.n_comp ;
i++) {
567 for (
int i=0 ;
i<
t1.valence ;
i++) {
590 tipe.set_etat_qcq() ;
598 if (
source.etat == ETATZERO)
599 res.set_etat_zero() ;
603 for (
int i=0 ;
i<
res.n_comp ;
i++) {
655 assert ((
t1.etat != ETATNONDEF) && (
t2.etat != ETATNONDEF)) ;
660 if ( (
t1.valence != 0) && (
t2.valence != 0) ) {
661 assert ( *(
t1.get_triad()) == *(
t2.get_triad()) ) ;
667 const Metrique*
met_res = 0x0 ;
669 assert((
t1.metric != 0x0) || (
t2.metric != 0x0)) ;
674 tipe.set_etat_qcq() ;
676 for (
int i=0 ;
i<
t1.valence - 1 ;
i++)
679 tipe.set(
i) =
t2.type_indice(
i-
t1.valence+2) ;
684 if ( (
t1.etat == ETATZERO) || (
t2.etat == ETATZERO) ) {
685 res.set_etat_zero() ;
707 for (
int i=0 ;
i<
t1.valence - 1 ;
i++) {
712 for (
int i=1 ;
i<
t2.valence ;
i++) {
716 work.set_etat_zero() ;
720 for (
int j=0 ;
j<3 ;
j++) {
737 assert ((
t1.etat != ETATNONDEF) && (
t2.etat != ETATNONDEF)) ;
742 if ( (
t1.valence != 0) && (
t2.valence != 0) ) {
743 assert ( *(
t1.get_triad()) == *(
t2.get_triad()) ) ;
749 const Metrique*
met_res = 0x0 ;
751 assert((
t1.metric != 0x0) || (
t2.metric != 0x0)) ;
756 tipe.set_etat_qcq() ;
758 for (
int i=0 ;
i<
t1.valence - 1 ;
i++)
761 tipe.set(
i) =
t2.type_indice(
i-
t1.valence+2) ;
766 if ( (
t1.etat == ETATZERO) || (
t2.etat == ETATZERO) ) {
767 res.set_etat_zero() ;
789 for (
int i=0 ;
i<
t1.valence - 1 ;
i++) {
794 for (
int i=1 ;
i<
t2.valence ;
i++) {
798 work.set_etat_zero() ;
802 for (
int j=0 ;
j<3 ;
j++) {
827 tipe.set_etat_qcq() ;
830 tipx.set_etat_qcq() ;
833 for (
int i=0 ;
i<val ;
i++)
850 for (
int i=0 ;
i<val ;
i++) {
856 for (
int j=0 ;
j<
resu.get_n_comp() ;
j++) {
876 for (
int j=0 ;
j<
resu.get_n_comp() ;
j++) {
904 if (
resu.get_etat() == ETATZERO)
return resu ;
934 cout <<
"Erreur bizarre dans sans_trace!" <<
endl ;
943 for (
int i=0;
i<3;
i++)
944 for (
int j=
i;
j<3;
j++)
945 delta.
set(
i,
j) = (
i==
j ? 1 : 0) ;
948 resu.set_std_base() ;
Vectorial bases (triads) with respect to which the tensorial components are defined.
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Time evolution with partial storage (*** under development ***).
Basic integer array class.
int & set(int i)
Read/write of a particular element (index i ) (1D case)
Base class for pure radial mappings.
Class intended to describe tensors with a symmetry on the two last indices *** DEPRECATED : use class...
Tensor handling *** DEPRECATED : use class Tensor instead ***.
const Base_vect * get_triad() const
Returns the vectorial basis (triad) on which the components are defined.
Cmp & set()
Read/write for a scalar (see also operator=(const Cmp&) ).
int get_type_indice(int i) const
Returns the type of the index number i .
const Metrique * metric
For tensor densities: the metric defining the conformal factor.
const Map *const mp
Reference mapping.
const Tenseur & derive_cov(const Metrique &met) const
Returns the covariant derivative of *this , with respect to met .
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
const Map * get_mp() const
Returns pointer on the mapping.
double get_poids() const
Returns the weight.
const Tenseur & gradient() const
Returns the gradient of *this (Cartesian coordinates)
Itbl type_indice
Array of size valence contening the type of each index, COV for a covariant one and CON for a contrav...
int etat
Logical state ETATZERO , ETATQCQ or ETATNONDEF.
double poids
For tensor densities: the weight.
int get_valence() const
Returns the valence.
const Metrique * get_metric() const
Returns a pointer on the metric defining the conformal factor for tensor densities.
int get_etat() const
Returns the logical state.
Base_val operator*(const Base_val &, const Base_val &)
This operator is used when calling multiplication or division of Valeur .
Cmp operator%(const Cmp &, const Cmp &)
Cmp * Cmp with desaliasing.
Tenseur lie_derive(const Tenseur &t, const Tenseur &x, const Metrique *=0x0)
Lie Derivative of t with respect to x .
Tenseur contract(const Tenseur &, int id1, int id2)
Self contraction of two indices of a Tenseur .
Tenseur flat_scalar_prod(const Tenseur &t1, const Tenseur &t2)
Scalar product of two Tenseur when the metric is : performs the contraction of the last index of t1 w...
Tenseur sans_trace(const Tenseur &tens, const Metrique &metre)
Computes the traceless part of a Tenseur of valence 2.
Tenseur flat_scalar_prod_desal(const Tenseur &t1, const Tenseur &t2)
Same as flat_scalar_prod but with desaliasing.
Tenseur skxk(const Tenseur &)
Contraction of the last index of (*this) with or , depending on the type of S .
Tenseur manipule(const Tenseur &, const Metrique &, int idx)
Raise or lower the index idx depending on its type, using the given Metrique .