Changeset 807 in Sophya
- Timestamp:
- Apr 3, 2000, 7:44:06 PM (25 years ago)
- Location:
- trunk/SophyaProg/Tests
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaProg/Tests/arrt.cc
r789 r807 7 7 #include "tarrinit.h" 8 8 #include "tarray.h" 9 #include "fioarr.h" 9 10 #include "matharr.h" 10 11 #include "timing.h" 11 12 13 14 void tstioarr(TArray<int_4> & ia, TArray<int_4> & ib, TArray<int_4> & ic); 15 void tstmtx(); 12 16 13 17 int main(int narg, char* arg[]) … … 21 25 int i,j,k; 22 26 23 if (narg > 1) n = atoi(arg[1]); 27 bool tio = false; 28 if (narg > 1) tio = true; 24 29 25 26 30 try { 27 31 cout << "\n -----> Testing TArray <---- " << endl; … … 32 36 cout << " ----- matrix IA = \n " << ia << endl; 33 37 // sub array extraction, Range(2,3) : starting position=2 , size=3 34 TArray<int_4> ic = ia(Range(2,3),Range(1,2) );38 TArray<int_4> ic = ia(Range(2,3),Range(1,2),Range(0)); 35 39 cout << " ----- matrix IC IA(Range(2,3),Range(1,2)) = \n " << ic << endl; 36 40 // we set the sub-array to zero, this should reflect in the original array … … 48 52 // Sub array extraction X from 1 , size 4 - Y from 2 , size 3 , in Z default, from 0, size 1 49 53 // we multiply this sub-array elements by 3 50 ib(Range(1,4),Range(2,3) ) *= 3;54 ib(Range(1,4),Range(2,3), Range(0)) *= 3; 51 55 cout << " -- matrix IB , Apres ib(Range(1,3),Range(2,1))*=3 : " << endl; 52 56 cout << ib; … … 63 67 cout << " ------ sin(fa2=fa*2*Pi) = \n" << sin(fa2) << endl; 64 68 cout << " ------ cos(fa2=fa*2*Pi) = \n" << cos(fa2) << endl; 69 70 if (tio) tstioarr(ia, ib, ic); 71 65 72 } 66 73 catch (PThrowable exc) { … … 72 79 cout << " --------------- END of Programme -------------- " << endl; 73 80 } 81 82 void tstioarr(TArray<int_4> & ia, TArray<int_4> & ib, TArray<int_4> & ic) 83 { 84 cout << " ------ tstioarr(TArray<int_4> & ia, TArray<int_4> & ib, TArray<int_4> & ic) ---- " << endl; 85 { 86 cout << " >>>>>> Writing in arrt.ppf <<<<<<< " << endl; 87 POutPersist pos("arrt.ppf"); 88 // We write the three arrays in the stream 89 pos << ia << ib << ic; 90 cout << " >>>>>> Writing in arrtn.ppf with names <<<<<<<" << endl; 91 POutPersist posn("arrtn.ppf"); 92 string tag = "ArrIA"; 93 posn.PutObject(ia, tag); 94 tag = "ArrIB"; 95 posn.PutObject(ib, tag); 96 tag = "ArrIC"; 97 posn.PutObject(ic, tag); 98 } 99 100 { 101 cout << " >>>>>>> Reading from arrt.ppf <<<<< " << endl; 102 PInPersist pis("arrt.ppf"); 103 TArray<int_4> iaa, ibb, icc; 104 // We read the three arrays from the stream 105 pis >> iaa >> ibb >> icc; 106 cout << " ----- matrix IAA = \n " << iaa << endl; 107 cout << " ----- matrix IBB = \n " << ibb << endl; 108 cout << " ----- matrix ICC = \n " << icc << endl; 109 icc = 12; 110 cout << " ----- matrix ICC (=12) = \n " << icc << endl; 111 cout << " ----- matrix IAA (ICC=12) = \n " << iaa << endl; 112 } 113 114 { 115 cout << " >>>>>>> Reading from arrtn.ppf <<<<< " << endl; 116 PInPersist pis("arrtn.ppf"); 117 TArray<int_4> iaa, ibb, icc; 118 // We read the three arrays from the stream 119 string tag = "ArrIC"; 120 pis.GetObject(icc, tag); 121 tag = "ArrIB"; 122 pis.GetObject(ibb, tag); 123 tag = "ArrIA"; 124 pis.GetObject(iaa, tag); 125 126 cout << " ----- matrix IAAA = \n " << iaa << endl; 127 cout << " ----- matrix IBBB = \n " << ibb << endl; 128 cout << " ----- matrix ICCC = \n " << icc << endl; 129 icc = 68; 130 cout << " ----- matrix ICCC (=12) = \n " << icc << endl; 131 cout << " ----- matrix IAAA (ICC=12) = \n " << iaa << endl; 132 } 133 134 135 } -
trunk/SophyaProg/Tests/lpk.cc
r789 r807 23 23 24 24 if (narg > 1) n = atoi(arg[1]); 25 cout << " rztest_lapack - Size=" << n<< endl;25 cout << ":::::::: rztest_lapack - Size=" << n << " ::::::::: " << endl; 26 26 try { 27 27 TArray<r_4> a(n,n); … … 38 38 } 39 39 40 cout << " ------------ MatrixA = \n " << a << "\n" << endl;41 cout << " ------------ MatrixX = \n " << x << "\n" << endl;42 cout << " ------------ MatrixB = \n " << b << "\n" << endl;40 cout << " ------------ Array A = \n " << a << "\n" << endl; 41 cout << " ------------ Array X = \n " << x << "\n" << endl; 42 cout << " ------------ Array B = \n " << b << "\n" << endl; 43 43 44 44 cout << "\n Calling rztest_lapack ... " << endl; -
trunk/SophyaProg/Tests/scanppf.cc
r742 r807 22 22 SambaInitiator smbinit; 23 23 24 if (narg < 2) { 25 cerr << " Usage: scanppf filename [s]\n " << endl; 24 if ((narg < 2) || (strcmp(arg[1],"-h") == 0) ) { 25 cerr << " Usage: scanppf filename [s/n/a0/a1/a2/a3] \n" 26 << " s[=default} : Sequential reading of objects \n" 27 << " n : Object reading at NameTags \n" 28 << " a0...a3 : Tag List with PInPersist.AnalyseTags(0...3) \n" << endl; 26 29 exit(0); 27 30 } … … 29 32 try { 30 33 string flnm = arg[1]; 31 bool seq=false; 32 if (narg > 2) seq=true; 34 bool seq=true; 35 bool ana=false; 36 int analev = 0; 37 string opt = "s"; 38 if (narg > 2) opt = arg[2]; 39 40 if (opt == "n") seq = false; 41 else if (opt[0] == 'a') { ana = true; analev = opt[1]-'0'; } 42 43 if (ana) cout << " Analyse PInPersist( " << flnm << ") Level=" << analev << endl; 44 else { 45 if (!seq) cout << "PInPersist( " << flnm << ") Object Reading at NameTags " << endl; 46 else cout << "PInPersist( " << flnm << ") Sequential Object Reading " << endl; 47 } 48 33 49 PPersist* op = NULL; 34 50 cout << " Opening PPF file " << flnm << endl; 35 51 PInPersist s(flnm); 36 int nt = s.NbTags(); 37 cout << " Number of tags in file = " << nt << endl; 38 if (nt < 1) { 39 op = s.ReadObject(); 40 cout << " Object Type " << typeid(*op).name() << endl; 41 if (op) delete op; 42 } 43 else if (!seq) { 52 53 if (ana) s.AnalyseTags(analev); // Analysing all tags in file 54 55 else { 56 cout << " Version= " << s.Version() << " CreationDate= " << s.CreationDateStr() << endl; 57 int nt = s.NbTags(); 58 cout << " Number of tags in file = " << nt << endl; 59 if ( seq || (nt < 1) ) { 60 while (1) { 61 op = s.ReadObject(); 62 cout << " Object Type " << typeid(*op).name() << endl; 63 if (op) delete op; 64 } 65 } 44 66 for(int i=0; i<nt; i++) { 45 67 cout << ">>> TagNum= " << i << " TagName= " << s.GetTagName(i) << endl; 46 68 s.GotoTagNum(i); 47 op = s.ReadObject();48 cout << " Object Type " << typeid(*op).name() << endl;49 if (op) delete op;50 }51 } else {52 while (1) {53 69 op = s.ReadObject(); 54 70 cout << " Object Type " << typeid(*op).name() << endl; -
trunk/SophyaProg/Tests/tobjio.cc
r768 r807 14 14 #include "fmath.h" 15 15 #include "nbrandom.h" 16 #include "fioarr.h" 16 17 17 18 … … 96 97 for(i=0; i<20; i++) { x = 8.*i/20; (*vpx)(i) = x; (*vpy)(i) = 3*cos(x)+2*sin(x); } 97 98 nom = "vx1"; 98 FIO_T Vector<double> oiov1(vpx);99 FIO_TArray<double> oiov1(vpx); 99 100 oiov1.Write(so, nom); 100 101 cout << "Writing " << nom << endl; 101 102 nom = "vy1"; 102 FIO_T Vector<double> oiov2(vpy);103 FIO_TArray<double> oiov2(vpy); 103 104 oiov2.Write(so, nom); 104 105 cout << "Writing " << nom << endl; … … 106 107 for(i=0; i<30; i++) { x = 8.*i/30+0.1; (*vpx)(i) = sin(2.*x)/(2.*x); } 107 108 nom = "vx2"; 108 FIO_T Vector<double> oiov3(vpy);109 FIO_TArray<double> oiov3(vpy); 109 110 oiov3.Write(so, nom); 110 111 cout << "Writing " << nom << endl; … … 163 164 } 164 165 nom = "mtx1"; 165 FIO_T Matrix<double> oiom(mtx);166 FIO_TArray<double> oiom(mtx); 166 167 oiom.Write(so, nom); 167 168 cout << "Writing " << nom << endl;
Note:
See TracChangeset
for help on using the changeset viewer.