Changeset 807 in Sophya for trunk/SophyaProg/Tests/arrt.cc


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

File:
1 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}
Note: See TracChangeset for help on using the changeset viewer.