32char tenseur_arithm_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Tenseur/tenseur_arithm.C,v 1.9 2014/10/13 08:53:42 j_novak Exp $" ;
125 for (
int i=0 ;
i<
res.get_n_comp() ;
i++) {
126 Itbl indices (
res.donne_indices(
i)) ;
127 res.set(indices) = -t(indices) ;
139 assert ((
t1.get_etat() != ETATNONDEF) && (
t2.get_etat() != ETATNONDEF)) ;
140 assert (
t1.get_valence() ==
t2.get_valence()) ;
142 if (
t1.get_valence() != 0) {
143 assert ( *(
t1.get_triad()) == *(
t2.get_triad()) ) ;
146 for (
int i=0 ;
i<
t1.get_valence() ;
i++)
147 assert(
t1.get_type_indice(
i) ==
t2.get_type_indice(
i)) ;
151 if (
t1.get_etat() == ETATZERO)
153 else if (
t2.get_etat() == ETATZERO)
157 t1.get_triad(),
t1.get_metric(),
t1.get_poids() ) ;
160 for (
int i=0 ;
i<
res.get_n_comp() ;
i++) {
161 Itbl indices (
res.donne_indices(
i)) ;
162 res.set(indices) =
t1(indices) +
t2(indices) ;
171 assert (
t1.get_etat() != ETATNONDEF) ;
174 if (x ==
double(0)) {
182 res.set() =
t1() + x ;
216 return (
t1 + (-
t2)) ;
223 assert (
t1.get_etat() != ETATNONDEF) ;
226 if (x ==
double(0)) {
234 res.set() =
t1() - x ;
272 if ( (t.
get_etat() == ETATZERO) || (x ==
double(1)) )
278 if ( x ==
double(0) )
279 res.set_etat_zero() ;
282 for (
int i=0 ;
i<
res.get_n_comp() ;
i++) {
283 Itbl indices (
res.donne_indices(
i)) ;
284 res.set(indices) = x*t(indices) ;
313 assert(
t1.get_etat() != ETATNONDEF) ;
314 assert(
t2.get_etat() != ETATNONDEF) ;
320 const Metrique*
met_res = 0x0 ;
323 if (
t1.get_metric() != 0x0)
met_res =
t1.get_metric() ;
327 if (
t2.get_etat() == ETATZERO) {
328 cout <<
"Division by 0 in Tenseur / Tenseur !" <<
endl ;
331 if (
t1.get_etat() == ETATZERO) {
347 for (
int i=0 ;
i<
res.get_n_comp() ;
i++) {
348 Itbl indices (
res.donne_indices(
i)) ;
349 res.set(indices) =
t1(indices) /
t2() ;
360 if ( x ==
double(0) ) {
361 cout <<
"Division by 0 in Tenseur / double !" <<
endl ;
365 if ( (t.
get_etat() == ETATZERO) || (x ==
double(1)) )
372 for (
int i=0 ;
i<
res.get_n_comp() ;
i++) {
373 Itbl indices (
res.donne_indices(
i)) ;
374 res.set(indices) = t(indices) / x ;
387 cout <<
"Division by 0 in double / Tenseur !" <<
endl ;
396 res.set() = x / t() ;
Time evolution with partial storage (*** under development ***).
Basic integer array class.
Tensor handling *** DEPRECATED : use class Tensor instead ***.
const Base_vect * get_triad() const
Returns the vectorial basis (triad) on which the components are defined.
int get_type_indice(int i) const
Returns the type of the index number i .
const Map * get_mp() const
Returns pointer on the mapping.
double get_poids() const
Returns 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_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 .
Cmp operator-(const Cmp &)
- Cmp
Cmp operator/(const Cmp &, const Cmp &)
Cmp / Cmp.
Cmp operator+(const Cmp &)