89 assert ((t1.
get_etat() != ETATNONDEF) && (t2.
etat != ETATNONDEF)) ;
94 poids_res = (fabs(poids_res) < 1.e-10 ? 0. : poids_res) ;
95 const Metrique* met_res = 0x0 ;
96 if (poids_res != 0.) {
102 Itbl tipe (val_res) ;
106 for (
int i=0 ; i<t2.
valence ; i++)
115 met_res, poids_res) ;
118 if ((t1.
get_etat() == ETATZERO) || (t2.
etat == ETATZERO))
127 for (
int i=0 ; i<res.
n_comp ; i++) {
130 jeux_indice_t1.
set(j) = jeux_indice_res(j) ;
131 for (
int j=0 ; j<t2.
valence ; j++)
134 res.
set(jeux_indice_res) = t1(jeux_indice_t1)*t2(jeux_indice_t2) ;
145 for (
int i=0 ; i<t1.
valence ; i++) {
148 auxi_old =
new Tenseur(*auxi) ;
160 assert ( (t.
get_etat() != ETATNONDEF) && (
x.get_etat() != ETATNONDEF) ) ;
161 assert(
x.get_valence() == 1) ;
162 assert(
x.get_type_indice(0) == CON) ;
163 assert(
x.get_poids() == 0.) ;
164 assert(t.
get_mp() ==
x.get_mp()) ;
175 for (
int i=0 ; i<val ; i++)
179 Tenseur dx(*
x.get_mp(), 2, tipx,
x.get_triad()) ;
185 dx =
x.derive_cov(*met) ;
190 if ((val!=0)&&(t.
get_etat()!=ETATZERO)&&(
x.get_etat()!=ETATZERO)) {
193 for (
int i=0 ; i<val ; i++) {
197 Itbl indices_aux(val) ;
202 indices_aux.
set(val-1) = indices(i) ;
203 for (
int idx=0 ; idx<val-1 ; idx++)
205 indices_aux.
set(idx) = indices(idx) ;
207 indices_aux.
set(idx) = indices(idx+1) ;
209 resu.
set(indices) += (*auxi)(indices_aux) ;
215 Itbl indices_aux(val) ;
222 indices_aux.
set(val-1) = indices(i) ;
223 for (
int idx=0 ; idx<val-1 ; idx++)
225 indices_aux.
set(idx) = indices(idx) ;
227 indices_aux.
set(idx) = indices(idx+1) ;
228 resu.
set(indices) -= (*auxi)(indices_aux) ;
234 if ((poids != 0.)&&(t.
get_etat()!=ETATZERO)&&(
x.get_etat()!=ETATZERO))
235 resu = resu + poids*
contract(dx,0,1)*t ;
242 assert(t.
get_etat() != ETATNONDEF) ;
243 assert(metre.get_etat() != ETATNONDEF) ;
247 if (resu.
get_etat() == ETATZERO)
return resu ;
248 assert(resu.
get_etat() == ETATQCQ) ;
254 mix.
set(0) = (t0 == t1 ? -t0 : t0) ;
269 resu = resu - 1./3.*trace * metre.cov() ;
273 resu = resu - 1./3.*trace * metre.con() ;
277 cout <<
"Erreur bizarre dans sans_trace!" << endl ;
286 for (
int i=0; i<3; i++)
287 for (
int j=i; j<3; j++)
288 delta.
set(i,j) = (i==j ? 1 : 0) ;
289 resu = resu - trace/3. * delta ;
virtual int identify() const =0
Returns a number to identify the sub-classe of Base_vect the object belongs to.
Basic integer array class.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
int & set(int i)
Read/write of a particular element (index i ) (1D case).
Class intended to describe tensors with a symmetry on the two last indices *** DEPRECATED : use class...
Tenseur_sym(const Map &map, int val, const Itbl &tipe, const Base_vect &triad_i, const Metrique *met=0x0, double weight=0)
Standard constructor.
virtual Itbl donne_indices(int place) const
Returns the indices of a component given by its position in the Cmp 1-D array c .
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).
Tenseur(const Map &map, const Metrique *met=0x0, double weight=0)
Constructor for a scalar field.
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).
int n_comp
Number of components, depending on the symmetry.
void set_std_base()
Set the standard spectal basis of decomposition for each component.
void set_etat_zero()
Sets the logical state to ETATZERO (zero state).
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_n_comp() const
Returns the number of components.
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 .
Tenseur sans_trace(const Tenseur &tens, const Metrique &metre)
Computes the traceless part of a Tenseur of valence 2.
Tenseur contract(const Tenseur &, int id1, int id2)
Self contraction of two indices of a Tenseur .
Tenseur lie_derive(const Tenseur &t, const Tenseur &x, const Metrique *=0x0)
Lie Derivative of t with respect to x .
Tenseur manipule(const Tenseur &, const Metrique &, int idx)
Raise or lower the index idx depending on its type, using the given Metrique .
Coord x
x coordinate centered on the grid