33 char tensor_arithm_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Tensor/tensor_arithm.C,v 1.5 2014/10/13 08:53:44 j_novak Exp $" ;
85 for (
int i=0 ; i<res.get_n_comp() ; i++) {
86 Itbl ind (res.indices(i)) ;
87 res.
set(ind) = -t(ind) ;
111 for (
int i=0 ; i<res.get_n_comp() ; i++) {
112 Itbl ind (res.indices(i)) ;
113 res.
set(ind) = t1(ind) + t2(ind) ;
125 return *(t1.
cmp[0]) + t2 ;
134 return t1 + *(t2.
cmp[0]) ;
156 for (
int i=0 ; i<res.get_n_comp() ; i++) {
157 Itbl ind (res.indices(i)) ;
158 res.
set(ind) = t1(ind) - t2(ind) ;
169 return *(t1.
cmp[0]) - t2 ;
178 return t1 - *(t2.
cmp[0]) ;
192 if (t1.
get_etat() == ETATUN)
return t2 ;
197 for (
int ic=0 ; ic<res.get_n_comp() ; ic++) {
198 Itbl ind = res.indices(ic) ;
199 res.
set(ind) = t1 * t2(ind) ;
218 for (
int i=0 ; i<res.get_n_comp() ; i++) {
219 Itbl ind (res.indices(i)) ;
220 res.
set(ind) = x*t(ind) ;
233 return double(m) * t ;
238 return double(m) * t ;
249 assert(s2.
get_etat() != ETATNONDEF) ;
254 cout <<
"Division by 0 in Tensor / Scalar !" << endl ;
258 if (s2.
get_etat() == ETATUN)
return t1 ;
263 for (
int i=0 ; i<res.get_n_comp() ; i++) {
264 Itbl ind (res.indices(i)) ;
265 res.
set(ind) = t1(ind) / s2 ;
274 if ( x ==
double(0) ) {
275 cout <<
"Division by 0 in Tensor / double !" << endl ;
285 for (
int i=0 ; i<res.get_n_comp() ; i++) {
286 Itbl ind (res.indices(i)) ;
287 res.
set(ind) = t(ind) / x ;
296 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.