source: Sophya/trunk/AddOn/TAcq/tbrpaq.cc@ 3878

Last change on this file since 3878 was 3675, checked in by ansari, 16 years ago

Correction bug avec reduction taille de paquet - Reza 15/11/2009

File size: 2.2 KB
RevLine 
[3537]1// Utilisation de SOPHYA pour faciliter les tests ...
2#include "sopnamsp.h"
3#include "machdefs.h"
4
5// include standard c/c++
6#include <math.h>
7#include <stdio.h>
8
9#include <iostream>
10#include <string>
11
12#include "pexceptions.h" // les exceptions SOPHYA
13
14// Include sophya des tableaux
15#include "tvector.h" // Pour l'utilisation des classes TArray, TMatrix , TVector
16#include "fioarr.h" // Pour IO PPF TArray
17#include "sopemtx.h"
18#include "matharr.h"
19#include "tarrinit.h" // Pour l'utilisation des classes TArray, TMatrix , TVecto
20// include sophya mesure ressource CPU/memoire ...
21#include "resusage.h"
22#include "ctimer.h"
23#include "timing.h"
24
25// ---- ENTETE classe BRPaquet
26#include "brpaqu.h"
27
28int main(int narg, char* arg[])
29{
30 /*
31 cout << " sizeof(UInt32)= " << sizeof(UInt32) << endl;
32 cout << " sizeof(UInt64)= " << sizeof(UInt64) << endl;
33 UInt64 i1,i2,i3;
34 i1 = 0xFF000000;
35 i2 = i1*256;
36 i3 = 20000000000L;
37 cout << " i1= " << i1 << " i2 = " << i2 << " 0x" << hex << i2
38 << dec << " i3=" << i3 << " 0x"<< hex << i3 << dec << endl;
39 */
40
41 if (narg < 3) {
[3675]42 cout << "tbrpaq.cc/Erreur arg: tbrpaq paqsz paqredsz [neltsprint=8] [OutPPFFileName]" << endl;
[3537]43 return 1;
44 }
45
46 // Sophya modules initialization
47 TArrayInitiator _inia;
48 //------- AU LIEU DE ------> SophyaInit();
49
50 InitTim(); // Initializing the CPU timer
51
52 int paqsz = atoi(arg[1]);
[3675]53 int redpsz = atoi(arg[2]);
[3537]54 int nelt = 8;
55 if (narg>3) nelt = atoi(arg[3]);
56
[3675]57 cout << " tbrpaq : PaqSize=" << paqsz << " RedPaqSize " << endl;
[3537]58 Byte * src = new Byte[paqsz];
59 Byte * dst = new Byte[paqsz];
60
[3675]61 for(int kk=0; kk<paqsz; kk++) src[kk]=kk%256;
[3537]62 cout << " tbrpaq : Creating BRPaquet(src,dst,paqsz) ... " << endl;
63
64 BRPaquet paq(src, dst, paqsz);
65 cout << " tbrpaq : Appel paq.Print(cout) ... " << endl;
66 paq.Print(cout, nelt, true);
67
[3675]68 int NN=100;
69 Byte * rdst = new Byte[NN*redpsz];
70
71 for(int n=0; n<NN; n++) {
72 BRPaquet paqc(rdst+n*redpsz, redpsz);
73 paqc.CopyFrom(paq, BR_TwoChanReduc, 0);
74 if ((n==0)||(n==NN-1)) paqc.Print(cout, nelt, true);
[3537]75 }
[3675]76
[3537]77 // Cleanup
78 delete[] src;
79 delete[] dst;
[3675]80 delete[] rdst;
[3537]81
82 PrtTim("FIN tbrpaq.cc");
83 cout << " ---------- FIN tbrpaq -----------" << endl;
84 return 0;
85}
Note: See TracBrowser for help on using the repository browser.