Changeset 945 in Sophya
- Timestamp:
- Apr 16, 2000, 2:18:26 PM (25 years ago)
- Location:
- trunk/SophyaProg/Tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaProg/Tests/Makefile
r768 r945 15 15 LIBF = $(SLB)libsophya.so 16 16 #LIBS = -L$(SLB) -lPI -lsophya -lm 17 LIBS = -L$(SLB) -l extsophya -lsophya -lm17 LIBS = -L$(SLB) -lPI -lextsophya -lsophya -lm 18 18 ifeq ($(MACHEROS),Linux) 19 19 LIBS := $(LIBS) -ldl -
trunk/SophyaProg/Tests/tstndblk.cc
r768 r945 5 5 #include <string.h> 6 6 #include <math.h> 7 #include <complex> 8 #include <unistd.h> 7 9 #include "ntoolsinit.h" 8 10 #include "pexceptions.h" 9 11 #include "ndatablock.h" 10 12 11 ////////////////////////////////////////////////////////////////////////////// //////////13 ////////////////////////////////////////////////////////////////////////////// 12 14 int main(int narg,char *arg[]) 13 15 { 16 //-- Decodage arguments 17 int lp = 0; 18 char c; 19 while((c = getopt(narg,arg,"hd:")) != -1) { 20 switch (c) { 21 case 'd' : 22 sscanf(optarg,"%d",&lp); 23 break; 24 case 'h' : 25 cout<<"tstndblk [-h] [-d debug_level]"<<endl; 26 exit(-1); 27 } 28 } 29 30 //-- Initialization 14 31 SophyaInit(); 15 float x1[5] = {1.,2.,3.,4.,5.}; 16 float x2[5] = {10.,20.,30.,40.,50.}; 17 float x3[5] = {100.,200.,300.,400.,500.}; 32 const int NDim = 8; 33 float *x1 = new float[NDim]; 34 float *x2 = new float[NDim]; 35 float *x3 = new float[NDim]; 36 for(int k=0;k<NDim;k++) 37 {x1[k]=k+1; x2[k]=(k+1)*10; x3[k]=(k+1)*100;} 38 39 NDataBlock<int_4>::SetPrintDebug(lp); 40 NDataBlock<r_4>::SetPrintDebug(lp); 41 NDataBlock<r_8>::SetPrintDebug(lp); 42 NDataBlock< complex<r_4> >::SetPrintDebug(lp); 43 NDataBlock< complex<r_8> >::SetPrintDebug(lp); 18 44 19 45 { // Pour voir explicitement le travail du destructeur … … 32 58 cout<<endl<<"Createur A1(3)"<<endl; 33 59 NDataBlock<float> A1(3); 34 cout<<endl<<"Createur B1( 5)"<<endl;35 NDataBlock<float> B1( 5);36 A1.FillFrom( 5,x1); A1.Print(0,999);37 B1.FillFrom( 5,x1); B1.Print(0,999);60 cout<<endl<<"Createur B1("<<NDim<<")"<<endl; 61 NDataBlock<float> B1(NDim); 62 A1.FillFrom(NDim,x1); A1.Print(0,999); 63 B1.FillFrom(NDim,x1); B1.Print(0,999); 38 64 39 65 cout<<endl<<"Createur A2(3)"<<endl; 40 66 NDataBlock<float> A2(3); 41 A2.FillFrom( 5,x2); A2.Print(0,999);42 cout<<endl<<"Createur B2( 5)"<<endl;43 NDataBlock<float> B2( 5);44 B2.FillFrom( 5,x2); B2.Print(0,999);67 A2.FillFrom(NDim,x2); A2.Print(0,999); 68 cout<<endl<<"Createur B2("<<NDim<<")"<<endl; 69 NDataBlock<float> B2(NDim); 70 B2.FillFrom(NDim,x2); B2.Print(0,999); 45 71 46 72 cout<<endl<<"Createur A3(3)"<<endl; 47 73 NDataBlock<float> A3(3); 48 A3.FillFrom( 5,x3); A3.Print(0,999);49 cout<<endl<<"Createur B3( 5)"<<endl;50 NDataBlock<float> B3( 5);51 B3.FillFrom( 5,x3); B3.Print(0,999);74 A3.FillFrom(NDim,x3); A3.Print(0,999); 75 cout<<endl<<"Createur B3("<<NDim<<")"<<endl; 76 NDataBlock<float> B3(NDim); 77 B3.FillFrom(NDim,x3); B3.Print(0,999); 52 78 53 79 //----------------------------------------------------- … … 61 87 NDataBlock<float> BBB1(B1);} 62 88 63 {cout<<endl<<"Createur avec bridge {Abr( 5,x3,new Bridge)}"<<endl;64 NDataBlock<float> Abr( 5,x3,new Bridge);89 {cout<<endl<<"Createur avec bridge {Abr("<<NDim<<",x3,new Bridge)}"<<endl; 90 NDataBlock<float> Abr(NDim,x3,new Bridge); 65 91 Abr.Print(0,999); 66 92 cout<<"x3 existe encore: "<<x3[0]<<",...,"<<x3[4]<<endl;} 67 93 68 {cout<<endl<<"Createur avec bridge {Abr( 5,dum,NULL)}"<<endl;94 {cout<<endl<<"Createur avec bridge {Abr("<<NDim<<",dum,NULL)}"<<endl; 69 95 float *dum = new float[10]; 70 96 for(int i=0;i<10;i++) dum[i] = 1000.+i; … … 152 178 } // Pour voir explicitement le travail du destructeur 153 179 cout<<"Fin du Job"<<endl; 180 cout<<"delete x1"<<endl; delete [] x1; 181 cout<<"delete x2"<<endl; delete [] x2; 182 cout<<"delete x3"<<endl; delete [] x3; 183 184 //---- Final debug print 185 cout<<endl<<endl<<"FINAL DEBUG SUMMARY : lp="<<lp<<endl<<endl; 186 cout<<"DEBUG int_4:\n"; NDataBlock<int_4>::PrintDebug(); 187 cout<<"DEBUG r_4:\n"; NDataBlock<r_4>::PrintDebug(); 188 cout<<"DEBUG r_8:\n"; NDataBlock<r_8>::PrintDebug(); 189 cout<<"DEBUG complex<r_4>:\n"; NDataBlock< complex<r_4> >::PrintDebug(); 190 cout<<"DEBUG complex<r_8>:\n"; NDataBlock< complex<r_8> >::PrintDebug(); 154 191 155 192 exit(0);
Note:
See TracChangeset
for help on using the changeset viewer.