90 res.
set(ind) = -t(ind) ;
116 res.
set(ind) = t1(ind) + t2(ind) ;
128 return *(t1.
cmp[0]) + t2 ;
137 return t1 + *(t2.
cmp[0]) ;
161 res.
set(ind) = t1(ind) - t2(ind) ;
172 return *(t1.
cmp[0]) - t2 ;
181 return t1 - *(t2.
cmp[0]) ;
195 if (t1.
get_etat() == ETATUN)
return t2 ;
202 res.
set(ind) = t1 * t2(ind) ;
223 res.
set(ind) =
x*t(ind) ;
236 return double(m) * t ;
241 return double(m) * t ;
252 assert(s2.
get_etat() != ETATNONDEF) ;
257 cout <<
"Division by 0 in Tensor / Scalar !" << endl ;
261 if (s2.
get_etat() == ETATUN)
return t1 ;
268 res.
set(ind) = t1(ind) / s2 ;
277 if (
x ==
double(0) ) {
278 cout <<
"Division by 0 in Tensor / double !" << endl ;
290 res.
set(ind) = t(ind) /
x ;
299 return t / double(m) ;
Basic integer array class.
Tensor field of valence 0 (or component of a tensorial field).
int get_etat() const
Returns the logical state ETATNONDEF (undefined), ETATZERO (null) or ETATQCQ (ordinary).
Base_val operator*(const Base_val &, const Base_val &)
This operator is used when calling multiplication or division of Valeur .
Cmp operator-(const Cmp &)
- Cmp
Cmp operator/(const Cmp &, const Cmp &)
Cmp / Cmp.
Cmp operator+(const Cmp &)
const Map & get_mp() const
Returns the mapping.
int get_index_type(int i) const
Gives the type (covariant or contravariant) of the index number i .
int get_valence() const
Returns the valence.
virtual Itbl indices(int pos) const
Returns the indices of a component given by its position in the array cmp .
Tensor(const Map &map, int val, const Itbl &tipe, const Base_vect &triad_i)
Standard constructor.
int get_n_comp() const
Returns the number of stored components.
Scalar ** cmp
Array of size n_comp of pointers onto the components.
const Base_vect * get_triad() const
Returns the vectorial basis (triad) on which the components are defined.
Scalar & set(const Itbl &ind)
Returns the value of a component (read/write version).
Coord x
x coordinate centered on the grid