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

Last change on this file since 3645 was 3538, checked in by ansari, 17 years ago

This commit was generated by cvs2svn to compensate for changes in r3537,
which included commits to RCS files with non-trunk default branches.

File size: 2.4 KB
Line 
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) {
42 cout << "tbrpaq.cc/Erreur arg: tbrpaq paqsz filename [neltsprint=8] [OutPPFFileName]" << endl;
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]);
53 string filename = arg[2];
54 int nelt = 8;
55 if (narg>3) nelt = atoi(arg[3]);
56
57 cout << " tbrpaq : reading from file " << filename
58 << " PaqSize=" << paqsz << endl;
59 FILE* fip = NULL;
60 fip = fopen(filename.c_str(),"rb");
61 if (fip == NULL) {
62 cout << " tbrpaq : ERROR opening file" << endl;
63 return 2;
64 }
65 Byte * src = new Byte[paqsz];
66 Byte * dst = new Byte[paqsz];
67
68 fread(src, 1, (size_t)(paqsz), fip);
69 fclose(fip);
70
71 cout << " tbrpaq : Creating BRPaquet(src,dst,paqsz) ... " << endl;
72
73 BRPaquet paq(src, dst, paqsz);
74 cout << " tbrpaq : Appel paq.Print(cout) ... " << endl;
75 paq.Print(cout, nelt, true);
76
77 if (narg>4) {
78 string outppf = arg[4];
79 cout << " tbrpaq: Creating OutPPF file from data to file" << outppf << endl;
80 TVector<int_2> vd(paq.DataSize());
81 for(int k=0; k<paq.DataSize(); k++) vd(k) = (int_2)(*(paq.Data()+k));
82 POutPersist po(outppf);
83 po << vd;
84 }
85 // Cleanup
86 delete[] src;
87 delete[] dst;
88
89 PrtTim("FIN tbrpaq.cc");
90 cout << " ---------- FIN tbrpaq -----------" << endl;
91 return 0;
92}
Note: See TracBrowser for help on using the repository browser.