88 for (
int i=0 ; i<res.get_n_comp() ; i++) {
89 Itbl ind (res.indices(i)) ;
90 res.
set(ind) = -t(ind) ;
114 for (
int i=0 ; i<res.get_n_comp() ; i++) {
115 Itbl ind (res.indices(i)) ;
116 res.
set(ind) = t1(ind) + t2(ind) ;
128 return *(t1.
cmp[0]) + t2 ;
137 return t1 + *(t2.
cmp[0]) ;
159 for (
int i=0 ; i<res.get_n_comp() ; i++) {
160 Itbl ind (res.indices(i)) ;
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 ;
200 for (
int ic=0 ; ic<res.get_n_comp() ; ic++) {
201 Itbl ind = res.indices(ic) ;
202 res.
set(ind) = t1 * t2(ind) ;
221 for (
int i=0 ; i<res.get_n_comp() ; i++) {
222 Itbl ind (res.indices(i)) ;
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 ;
266 for (
int i=0 ; i<res.get_n_comp() ; i++) {
267 Itbl ind (res.indices(i)) ;
268 res.
set(ind) = t1(ind) / s2 ;
277 if ( x ==
double(0) ) {
278 cout <<
"Division by 0 in Tensor / double !" << endl ;
288 for (
int i=0 ; i<res.get_n_comp() ; i++) {
289 Itbl ind (res.indices(i)) ;
290 res.
set(ind) = t(ind) / x ;
299 return t / double(m) ;
int & set(int i)
Read/write of a particular element (index i ) (1D case)
Tensor field of valence 0 (or component of a tensorial field).
Base_val operator*(const Base_val &, const Base_val &)
This operator is used when calling multiplication or division of Valeur .
Basic integer array class.
int get_etat() const
Returns the logical state ETATNONDEF (undefined), ETATZERO (null) or ETATQCQ (ordinary).
Cmp operator/(const Cmp &, const Cmp &)
Cmp / Cmp.
const Base_vect * get_triad() const
Returns the vectorial basis (triad) on which the components are defined.
Cmp operator+(const Cmp &)
int get_index_type(int i) const
Gives the type (covariant or contravariant) of the index number i .
Scalar ** cmp
Array of size n_comp of pointers onto the components.
int get_valence() const
Returns the valence.
Cmp operator-(const Cmp &)
- Cmp
const Map & get_mp() const
Returns the mapping.