Changeset 807 in Sophya


Ignore:
Timestamp:
Apr 3, 2000, 7:44:06 PM (25 years ago)
Author:
ansari
Message:

Amelioration tests - Adaptation modifs TArray<T>,PPersist - Reza 03/04/2000

Location:
trunk/SophyaProg/Tests
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaProg/Tests/arrt.cc

    r789 r807  
    77#include "tarrinit.h"
    88#include "tarray.h"
     9#include "fioarr.h"
    910#include "matharr.h"
    1011#include "timing.h"
    1112
     13
     14void tstioarr(TArray<int_4> & ia, TArray<int_4> & ib, TArray<int_4> & ic);
     15void tstmtx();
    1216
    1317int main(int narg, char* arg[])
     
    2125  int i,j,k;
    2226
    23   if (narg > 1) n = atoi(arg[1]);
     27  bool tio = false;
     28  if (narg > 1) tio = true;
    2429
    25  
    2630  try {
    2731  cout << "\n -----> Testing TArray <---- " << endl; 
     
    3236  cout << " ----- matrix IA = \n " << ia << endl;
    3337  // 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));
    3539  cout << " ----- matrix IC IA(Range(2,3),Range(1,2)) = \n " << ic << endl;
    3640  // we set the sub-array to zero, this should reflect in the original array
     
    4852  // Sub array extraction  X from 1 , size 4 - Y from 2 , size 3 , in Z default, from 0, size 1
    4953  // 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;
    5155  cout << " -- matrix IB , Apres ib(Range(1,3),Range(2,1))*=3 : " << endl;
    5256  cout << ib;
     
    6367  cout << " ------ sin(fa2=fa*2*Pi) = \n" << sin(fa2) << endl;
    6468  cout << " ------ cos(fa2=fa*2*Pi) = \n" << cos(fa2) << endl;
     69
     70  if (tio) tstioarr(ia, ib, ic);
     71
    6572  }
    6673  catch (PThrowable exc) {
     
    7279  cout << " ---------------  END of Programme -------------- " << endl;
    7380}
     81
     82void 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  
    2323
    2424  if (narg > 1) n = atoi(arg[1]);
    25   cout << "rztest_lapack - Size=" << n << endl;
     25  cout << ":::::::: rztest_lapack - Size=" << n << "  ::::::::: " << endl;
    2626  try {
    2727  TArray<r_4> a(n,n);
     
    3838  }
    3939
    40   cout << " ------------ Matrix A = \n " << a << "\n" << endl;
    41   cout << " ------------ Matrix X = \n " << x << "\n" << endl;
    42   cout << " ------------ Matrix B = \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;
    4343
    4444  cout << "\n     Calling rztest_lapack ... " << endl;
  • trunk/SophyaProg/Tests/scanppf.cc

    r742 r807  
    2222SambaInitiator smbinit;
    2323
    24 if (narg < 2) {
    25   cerr << " Usage: scanppf filename [s]\n " <<  endl;
     24if ((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;
    2629  exit(0);
    2730  }
     
    2932try {
    3033  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   
    3349  PPersist* op = NULL;
    3450  cout << " Opening PPF file " << flnm << endl;
    3551  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    }
    4466    for(int i=0; i<nt; i++) {
    4567      cout << ">>> TagNum= " << i << " TagName= " << s.GetTagName(i) << endl;
    4668      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) {
    5369      op = s.ReadObject();
    5470      cout << " Object Type " << typeid(*op).name() << endl;
  • trunk/SophyaProg/Tests/tobjio.cc

    r768 r807  
    1414#include "fmath.h"
    1515#include "nbrandom.h"
     16#include "fioarr.h"
    1617
    1718
     
    9697  for(i=0; i<20; i++) { x = 8.*i/20;  (*vpx)(i) = x;  (*vpy)(i) = 3*cos(x)+2*sin(x); }
    9798  nom = "vx1";
    98   FIO_TVector<double>  oiov1(vpx);
     99  FIO_TArray<double>  oiov1(vpx);
    99100  oiov1.Write(so, nom);
    100101  cout << "Writing " << nom << endl;
    101102  nom = "vy1";
    102   FIO_TVector<double>  oiov2(vpy);
     103  FIO_TArray<double>  oiov2(vpy);
    103104  oiov2.Write(so, nom);
    104105  cout << "Writing " << nom << endl;
     
    106107  for(i=0; i<30; i++) { x = 8.*i/30+0.1;  (*vpx)(i) = sin(2.*x)/(2.*x); }
    107108  nom = "vx2";
    108   FIO_TVector<double>  oiov3(vpy);
     109  FIO_TArray<double>  oiov3(vpy);
    109110  oiov3.Write(so, nom);
    110111  cout << "Writing " << nom << endl;
     
    163164     }
    164165  nom = "mtx1";
    165   FIO_TMatrix<double> oiom(mtx);
     166  FIO_TArray<double> oiom(mtx);
    166167  oiom.Write(so, nom);
    167168  cout << "Writing " << nom << endl;
Note: See TracChangeset for help on using the changeset viewer.