73 assert (t1.
mp == t2.
mp) ;
79 for (
int i=0 ; i<t1.
valence ; i++)
81 for (
int i=0 ; i<t2.
valence ; i++)
88 assert ( *(t2.
get_triad()) == *triad_res ) ;
91 Tensor_sym res(*t1.
mp, val_res, tipe, *triad_res, t1.
sym_index1(),
97 for (
int i=0 ; i<res.
n_comp ; i++) {
99 for (
int j=0 ; j<t1.
valence ; j++)
100 jeux_indice_t1.
set(j) = jeux_indice_res(j) ;
101 for (
int j=0 ; j<t2.
valence ; j++)
102 jeux_indice_t2.
set(j) = jeux_indice_res(j+t1.
valence) ;
104 res.
set(jeux_indice_res) = t1(jeux_indice_t1)*t2(jeux_indice_t2) ;
113 assert (t1.
mp == t2.
mp) ;
119 for (
int i=0 ; i<t1.
valence ; i++)
121 for (
int i=0 ; i<t2.
valence ; i++)
128 assert ( *(t1.
get_triad()) == *triad_res ) ;
134 Tensor_sym res(*t2.
mp, val_res, tipe, *triad_res, ids1, ids2) ;
139 for (
int i=0 ; i<res.
n_comp ; i++) {
141 for (
int j=0 ; j<t1.
valence ; j++)
142 jeux_indice_t1.
set(j) = jeux_indice_res(j) ;
143 for (
int j=0 ; j<t2.
valence ; j++)
144 jeux_indice_t2.
set(j) = jeux_indice_res(j+t1.
valence) ;
146 res.
set(jeux_indice_res) = t1(jeux_indice_t1)*t2(jeux_indice_t2) ;
154Tensor_sym
operator*(
const Tensor_sym& t1,
const Tensor_sym& t2) {
156 assert (t1.
mp == t2.
mp) ;
162 for (
int i=0 ; i<t1.
valence ; i++)
164 for (
int i=0 ; i<t2.
valence ; i++)
170 assert ( *(t2.
get_triad()) == *triad_res ) ;
172 Tensor_sym res(*t1.
mp, val_res, tipe, *triad_res, t1.
sym_index1(),
178 for (
int i=0 ; i<res.
n_comp ; i++) {
180 for (
int j=0 ; j<t1.
valence ; j++)
181 jeux_indice_t1.
set(j) = jeux_indice_res(j) ;
182 for (
int j=0 ; j<t2.
valence ; j++)
183 jeux_indice_t2.
set(j) = jeux_indice_res(j+t1.
valence) ;
185 res.
set(jeux_indice_res) = t1(jeux_indice_t1)*t2(jeux_indice_t2) ;
200 assert(p_resu != 0x0) ;
212 assert(p_resu != 0x0) ;
Vectorial bases (triads) with respect to which the tensorial components are defined.
Basic integer array class.
int & set(int i)
Read/write of a particular element (index i ) (1D case).
Base_val operator*(const Base_val &, const Base_val &)
This operator is used when calling multiplication or division of Valeur .
Tensor_sym derive_lie(const Vector &v) const
Computes the Lie derivative of this with respect to some vector field v.
int sym_index1() const
Number of the first symmetric index (0<= id_sym1 < valence ).
const Tensor_sym & derive_cov(const Metric &gam) const
Returns the covariant derivative of this with respect to some metric .
const Map *const mp
Mapping on which the numerical values at the grid points are defined.
virtual Itbl indices(int pos) const
Returns the indices of a component given by its position in the array cmp .
int sym_index2() const
Number of the second symmetric index (id_sym1 < id_sym2 < valence ).
const Tensor & derive_con(const Metric &gam) const
Returns the "contravariant" derivative of this with respect to some metric , by raising the last inde...
int id_sym1
Number of the first symmetric index (0<= id_sym1 < valence ).
Tensor(const Map &map, int val, const Itbl &tipe, const Base_vect &triad_i)
Standard constructor.
int valence
Valence of the tensor (0 = scalar, 1 = vector, etc...).
Tensor_sym(const Map &map, int val, const Itbl &tipe, const Base_vect &triad_i, int index_sym1, int index_sym2)
Standard constructor.
int id_sym2
Number of the second symmetric index (id_sym1 < id_sym2 < valence ).
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...
const Base_vect * get_triad() const
Returns the vectorial basis (triad) on which the components are defined.
int n_comp
Number of stored components, depending on the symmetry.
const Tensor_sym & derive_con(const Metric &gam) const
Returns the "contravariant" derivative of this with respect to some metric , by raising the last inde...
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...
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.