31 char valeur_arithm_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_arithm.C,v 1.7 2014/10/13 08:53:49 j_novak Exp $" ;
148 assert(vi.
get_etat() != ETATNONDEF) ;
156 assert(vi.
get_etat() != ETATNONDEF) ;
173 assert(vi.
c_cf != 0x0) ;
174 resu = - *(vi.
c_cf) ;
191 assert(t1.
get_etat() != ETATNONDEF) ;
192 assert(t2.
get_etat() != ETATNONDEF) ;
211 resu = *(t1.
c) + *(t2.
c) ;
215 assert(t2.
c_cf != 0x0) ;
216 if (t1.
c_cf != 0x0) {
221 resu = *(t1.
c) + *(t2.
c) ;
222 resu.base = t1.
base ;
227 assert(t1.
c_cf != 0x0) ;
228 if (t2.
c_cf != 0x0) {
232 assert(t2.
c != 0x0) ;
234 resu = *(t1.
c) + *(t2.
c) ;
235 resu.base = t1.
base ;
247 assert(t1.
get_etat() != ETATNONDEF) ;
248 assert(mi.
get_etat() != ETATNONDEF) ;
262 assert(resu.
get_etat() == ETATQCQ) ;
283 assert(t1.
get_etat() != ETATNONDEF) ;
286 if (x ==
double(0)) {
297 assert(resu.
get_etat() == ETATQCQ) ;
300 *(resu.
c) = *(resu.
c) + x ;
317 return t1 + double(m) ;
324 return t1 + double(m) ;
338 assert(t1.
get_etat() != ETATNONDEF) ;
339 assert(t2.
get_etat() != ETATNONDEF) ;
358 resu = *(t1.
c) - *(t2.
c) ;
362 assert(t2.
c_cf != 0x0) ;
363 if (t1.
c_cf != 0x0) {
368 resu = *(t1.
c) - *(t2.
c) ;
369 resu.base = t1.
base ;
374 assert(t1.
c_cf != 0x0) ;
375 if (t2.
c_cf != 0x0) {
379 assert(t2.
c != 0x0) ;
381 resu = *(t1.
c) - *(t2.
c) ;
382 resu.base = t1.
base ;
395 assert(t1.
get_etat() != ETATNONDEF) ;
396 assert(mi.
get_etat() != ETATNONDEF) ;
410 assert(resu.
get_etat() == ETATQCQ) ;
430 assert(t1.
get_etat() != ETATNONDEF) ;
433 if (x ==
double(0)) {
444 assert(resu.
get_etat() == ETATQCQ) ;
447 *(resu.
c) = *(resu.
c) - x ;
464 return t1 - double(m) ;
471 return double(m) - t1 ;
487 assert(t1.
get_etat() != ETATNONDEF) ;
488 assert(t2.
get_etat() != ETATNONDEF) ;
511 resu = (*(t1.
c)) * (*(t2.
c)) ;
525 assert(c1.
get_etat() != ETATNONDEF) ;
528 if ((c1.
get_etat() == ETATZERO) || ( a ==
double(1) )) {
538 result = *(c1.
c) * a ;
543 assert(c1.
c_cf != 0x0) ;
544 result = *(c1.
c_cf) * a ;
561 return t1 * double(m) ;
568 return t1 * double(m) ;
577 assert(c1.
get_etat() != ETATNONDEF) ;
594 result = *(c1.
c) * c2 ;
613 assert(c1.
get_etat() != ETATNONDEF) ;
630 result = *(c1.
c) * c2 ;
652 assert(t1.
get_etat() != ETATNONDEF) ;
653 assert(t2.
get_etat() != ETATNONDEF) ;
658 cout <<
"Division by 0 in Valeur / Valeur !" << endl ;
678 resu = (*(t1.
c)) / (*(t2.
c)) ;
691 assert(t1.
get_etat() != ETATNONDEF) ;
694 if ( x ==
double(0) ) {
695 cout <<
"Division by 0 in Valeur / double !" << endl ;
698 if ((t1.
get_etat() == ETATZERO) || ( x ==
double(1) )) {
711 assert(t1.
c_cf != 0x0) ;
712 resu = *(t1.
c_cf) / x ;
723 assert(c2.
get_etat() != ETATNONDEF) ;
727 cout <<
"Division by 0 in double / Valeur !" << endl ;
742 *(r.c) = x / *(c2.
c) ;
754 return t1 / double(m) ;
760 return double(m) / t1 ;
768 assert(t1.
get_etat() != ETATNONDEF) ;
769 assert(m2.
get_etat() != ETATNONDEF) ;
773 cout <<
"Division by 0 in Valeur / Mtbl !" << endl ;
789 resu = (*(t1.
c)) / m2 ;
799 assert(m1.
get_etat() != ETATNONDEF) ;
800 assert(c2.
get_etat() != ETATNONDEF) ;
804 cout <<
"Division by 0 in Mtbl / Valeur !" << endl ;
819 resu = m1 / (*(c2.
c)) ;
838 assert(
etat != ETATNONDEF) ;
839 assert(vi.
get_etat() != ETATNONDEF) ;
849 if (
etat == ETATZERO) {
861 assert(vi.
c_cf != 0x0) ;
876 assert(
c_cf != 0x0) ;
877 if (vi.
c_cf != 0x0) {
883 assert(vi.
c != 0x0) ;
901 assert(
etat != ETATNONDEF) ;
902 assert(vi.
get_etat() != ETATNONDEF) ;
912 if (
etat == ETATZERO) {
923 assert(vi.
c_cf != 0x0) ;
938 assert(
c_cf != 0x0) ;
939 if (vi.
c_cf != 0x0) {
945 assert(vi.
c != 0x0) ;
962 assert(
etat != ETATNONDEF) ;
963 assert(vi.
get_etat() != ETATNONDEF) ;
966 if (
etat == ETATZERO) {
1006 assert(t1.
get_etat() != ETATNONDEF) ;
1007 assert(t2.
get_etat() != ETATNONDEF) ;
1024 const Mg3d& mg2 = *(mg.get_twice()) ;
1027 if (t1.
c_cf == 0x0) {
1030 if (t2.
c_cf == 0x0) {
1037 assert( c1.
get_etat() == ETATQCQ ) ;
1038 assert( c2.
get_etat() == ETATQCQ ) ;
1047 cc1.set_etat_qcq() ;
1050 for (
int l=0; l<mg.get_nzone(); l++) {
1052 int nr = mg.get_nr(l) ;
1053 int nt = mg.get_nt(l) ;
1054 int np = mg.get_np(l) ;
1055 int nr2 = mg2.
get_nr(l) ;
1056 int nt2 = mg2.
get_nt(l) ;
1057 int np2 = mg2.
get_np(l) ;
1062 if ( c1.
t[l]->
get_etat() == ETATZERO ) {
1063 cc1.t[l]->set_etat_zero() ;
1067 assert( c1.
t[l]->
get_etat() == ETATQCQ ) ;
1068 cc1.t[l]->set_etat_qcq() ;
1071 for (
int k=0; k<np+1; k++) {
1072 for (
int j=0; j<nt; j++) {
1073 for (
int i=0; i<nr; i++) {
1074 cc1.t[l]->set(k, j, i) = (*(c1.
t[l]))(k, j, i) ;
1080 for (
int k=np+1; k<np2+2; k++) {
1081 for (
int j=0; j<nt2; j++) {
1082 for (
int i=0; i<nr2; i++) {
1083 cc1.t[l]->set(k, j, i) = 0 ;
1089 for (
int k=0; k<np+1; k++) {
1090 for (
int j=nt; j<nt2; j++) {
1091 for (
int i=0; i<nr2; i++) {
1092 cc1.t[l]->set(k, j, i) = 0 ;
1098 for (
int k=0; k<np+1; k++) {
1099 for (
int j=0; j<nt; j++) {
1100 for (
int i=nr; i<nr2; i++) {
1101 cc1.t[l]->set(k, j, i) = 0 ;
1111 if ( c2.
t[l]->
get_etat() == ETATZERO ) {
1116 assert( c2.
t[l]->
get_etat() == ETATQCQ ) ;
1120 for (
int k=0; k<np+1; k++) {
1121 for (
int j=0; j<nt; j++) {
1122 for (
int i=0; i<nr; i++) {
1123 cc2.
t[l]->
set(k, j, i) = (*(c2.
t[l]))(k, j, i) ;
1129 for (
int k=np+1; k<np2+2; k++) {
1130 for (
int j=0; j<nt2; j++) {
1131 for (
int i=0; i<nr2; i++) {
1132 cc2.
t[l]->
set(k, j, i) = 0 ;
1138 for (
int k=0; k<np+1; k++) {
1139 for (
int j=nt; j<nt2; j++) {
1140 for (
int i=0; i<nr2; i++) {
1141 cc2.
t[l]->
set(k, j, i) = 0 ;
1147 for (
int k=0; k<np+1; k++) {
1148 for (
int j=0; j<nt; j++) {
1149 for (
int i=nr; i<nr2; i++) {
1150 cc2.
t[l]->
set(k, j, i) = 0 ;
1185 for (
int l=0; l<mg.get_nzone(); l++) {
1187 if ( cr2.
t[l]->
get_etat() == ETATZERO ) {
1194 assert( cr2.
t[l]->
get_etat() == ETATQCQ ) ;
1198 int nr = mg.get_nr(l) ;
1199 int nt = mg.get_nt(l) ;
1200 int np = mg.get_np(l) ;
1203 for (
int k=0; k<np+1; k++) {
1204 for (
int j=0; j<nt; j++) {
1205 for (
int i=0; i<nr; i++) {
1206 cr.
t[l]->
set(k, j, i) = (*(cr2.
t[l]))(k, j, i) ;
1212 for (
int j=0; j<nt; j++) {
1213 for (
int i=0; i<nr; i++) {
1214 cr.
t[l]->
set(np+1, j, i) = 0 ;
1238 assert(t1.
get_etat() != ETATNONDEF) ;
1239 assert(t2.
get_etat() != ETATNONDEF) ;
1256 const Mg3d& mg2 = *(mg.plus_half()) ;
1259 if (t1.
c_cf == 0x0) {
1262 if (t2.
c_cf == 0x0) {
1269 assert( c1.
get_etat() == ETATQCQ ) ;
1270 assert( c2.
get_etat() == ETATQCQ ) ;
1279 cc1.set_etat_qcq() ;
1282 for (
int l=0; l<mg.get_nzone(); l++) {
1284 int nr = mg.get_nr(l) ;
1285 int nt = mg.get_nt(l) ;
1286 int np = mg.get_np(l) ;
1287 int nr2 = mg2.
get_nr(l) ;
1292 if ( c1.
t[l]->
get_etat() == ETATZERO ) {
1293 cc1.t[l]->set_etat_zero() ;
1297 assert( c1.
t[l]->
get_etat() == ETATQCQ ) ;
1298 cc1.t[l]->set_etat_qcq() ;
1301 for (
int k=0; k<np+1; k++) {
1302 for (
int j=0; j<nt; j++) {
1303 for (
int i=0; i<nr; i++) {
1304 cc1.t[l]->set(k, j, i) = (*(c1.
t[l]))(k, j, i) ;
1310 for (
int j=0; j<nt; j++) {
1311 for (
int i=0; i<nr2; i++) {
1312 cc1.t[l]->set(np+1, j, i) = 0 ;
1318 for (
int k=0; k<np+1; k++) {
1319 for (
int j=0; j<nt; j++) {
1320 for (
int i=nr; i<nr2; i++) {
1321 cc1.t[l]->set(k, j, i) = 0 ;
1331 if ( c2.
t[l]->
get_etat() == ETATZERO ) {
1336 assert( c2.
t[l]->
get_etat() == ETATQCQ ) ;
1340 for (
int k=0; k<np+1; k++) {
1341 for (
int j=0; j<nt; j++) {
1342 for (
int i=0; i<nr; i++) {
1343 cc2.
t[l]->
set(k, j, i) = (*(c2.
t[l]))(k, j, i) ;
1349 for (
int j=0; j<nt; j++) {
1350 for (
int i=0; i<nr2; i++) {
1351 cc2.
t[l]->
set(np+1, j, i) = 0 ;
1356 for (
int k=0; k<np+1; k++) {
1357 for (
int j=0; j<nt; j++) {
1358 for (
int i=nr; i<nr2; i++) {
1359 cc2.
t[l]->
set(k, j, i) = 0 ;
1391 for (
int l=0; l<mg.get_nzone(); l++) {
1393 if ( cr2.
t[l]->
get_etat() == ETATZERO ) {
1400 assert( cr2.
t[l]->
get_etat() == ETATQCQ ) ;
1404 int nr = mg.get_nr(l) ;
1405 int nt = mg.get_nt(l) ;
1406 int np = mg.get_np(l) ;
1409 for (
int k=0; k<np+1; k++) {
1410 for (
int j=0; j<nt; j++) {
1411 for (
int i=0; i<nr; i++) {
1412 cr.
t[l]->
set(k, j, i) = (*(cr2.
t[l]))(k, j, i) ;
1418 for (
int j=0; j<nt; j++) {
1419 for (
int i=0; i<nr; i++) {
1420 cr.
t[l]->
set(np+1, j, i) = 0 ;
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
void operator+=(const Valeur &)
+= Valeur
void ylm_i()
Inverse of ylm()
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
void coef() const
Computes the coeffcients of *this.
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
void ylm()
Computes the coefficients of *this.
void annule_hard()
Sets the Valeur to zero in a hard way.
double & 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 .
void coef_i() const
Computes the physical value of *this.
Values and coefficients of a (real-value) function.
int get_etat() const
Gives the logical state.
Cmp operator%(const Cmp &, const Cmp &)
Cmp * Cmp with desaliasing.
Cmp operator/(const Cmp &, const Cmp &)
Cmp / Cmp.
Scalar operator|(const Scalar &, const Scalar &)
Scalar * Scalar with desaliasing only in r.
int get_etat() const
Returns the logical state.
const Mg3d * get_mg() const
Returns the Mg3d on which the this is defined.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
int get_etat() const
Gives the logical state.
int get_etat() const
Returns the logical state.
const Mg3d * mg
Multi-grid Mgd3 on which this is defined.
Cmp operator+(const Cmp &)
Base_val base
Bases on which the spectral expansion is performed.
Mtbl * c
Values of the function at the points of the multi-grid.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Active physical coordinates and mapping derivatives.
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
Base_val std_base_scal() const
Returns the standard spectral bases for a scalar.
void operator-=(const Valeur &)
-= Valeur
void operator*=(const Valeur &)
*= Valeur
Coefficients storage for the multi-domain spectral method.
void set_etat_c_qcq()
Sets the logical state to ETATQCQ (ordinary state) for values in the configuration space (Mtbl c )...
Base_val base
Bases of the spectral expansions.
Cmp operator-(const Cmp &)
- Cmp
int etat
Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
void del_deriv()
Logical destructor of the derivatives.
Tbl ** t
Array (size nzone ) of pointers on the Tbl 's which contain the spectral coefficients in each domain...