00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 char tenseur_compare_C[] = "$Header: /cvsroot/Lorene/C++/Source/Tenseur/tenseur_compare.C,v 1.2 2004/05/27 07:17:19 p_grandclement Exp $" ;
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #include "math.h"
00048
00049
00050 #include "tenseur.h"
00051
00052
00053 void Tenseur::compare(const Tenseur& tens, const char* name) {
00054 assert ( valence == tens.get_valence() ) ;
00055
00056 cout << "----------------------------------------------" << endl ;
00057 cout << "Comparison of " << name << " : " << endl << endl ;
00058
00059 if (valence == 0) {
00060 Cmp comp = tens() ;
00061 Cmp tmp = (*this)() ;
00062 tmp.compare(comp, name) ;
00063 }
00064
00065 if (valence == 1) {
00066 Cmp comp0 = tens(0) ;
00067 Cmp comp1 = tens(1) ;
00068 Cmp comp2 = tens(2) ;
00069
00070 Cmp tmp0 = (*this)(0) ;
00071 Cmp tmp1 = (*this)(1) ;
00072 Cmp tmp2 = (*this)(2) ;
00073
00074 tmp0.compare(comp0, name, 0) ;
00075 tmp1.compare(comp1, name, 1) ;
00076 tmp2.compare(comp2, name, 2) ;
00077 }
00078
00079 if (valence == 2) {
00080 Cmp comp00 = tens(0,0) ;
00081 Cmp comp01 = tens(0,1) ;
00082 Cmp comp02 = tens(0,2) ;
00083 Cmp comp10 = tens(1,0) ;
00084 Cmp comp11 = tens(1,1) ;
00085 Cmp comp12 = tens(1,2) ;
00086 Cmp comp20 = tens(2,0) ;
00087 Cmp comp21 = tens(2,1) ;
00088 Cmp comp22 = tens(2,2) ;
00089
00090 Cmp tmp00 = (*this)(0,0) ;
00091 Cmp tmp01 = (*this)(0,1) ;
00092 Cmp tmp02 = (*this)(0,2) ;
00093 Cmp tmp10 = (*this)(1,0) ;
00094 Cmp tmp11 = (*this)(1,1) ;
00095 Cmp tmp12 = (*this)(1,2) ;
00096 Cmp tmp20 = (*this)(2,0) ;
00097 Cmp tmp21 = (*this)(2,1) ;
00098 Cmp tmp22 = (*this)(2,2) ;
00099
00100 tmp00.compare(comp00, name, 0, 0) ;
00101 tmp01.compare(comp01, name, 0, 1) ;
00102 tmp02.compare(comp02, name, 0, 2) ;
00103 tmp10.compare(comp10, name, 1, 0) ;
00104 tmp11.compare(comp11, name, 1, 1) ;
00105 tmp12.compare(comp12, name, 1, 2) ;
00106 tmp20.compare(comp20, name, 2, 0) ;
00107 tmp21.compare(comp21, name, 2, 1) ;
00108 tmp22.compare(comp22, name, 2, 2) ;
00109 }
00110
00111 if (valence > 2 ) {
00112 abort() ;
00113 }
00114 }
00115
00116 void Tenseur::compare(FILE* fich, const char* name_i) {
00117
00118 Mg3d mg(fich) ;
00119 Map_et mpg(mg, fich) ;
00120
00121 Tenseur tens(mpg, mpg.get_bvect_cart(), fich) ;
00122
00123 compare(tens, name_i) ;
00124
00125
00126 }