| 1 |
mmeineke |
803 |
#include <stdlib.h> |
| 2 |
|
|
|
| 3 |
|
|
#include "CorrWrap.hpp" |
| 4 |
|
|
|
| 5 |
|
|
corrWrap::CorrWrap(){ |
| 6 |
|
|
|
| 7 |
|
|
nBins = 0; |
| 8 |
|
|
nDimensions = 0; |
| 9 |
|
|
} |
| 10 |
|
|
|
| 11 |
|
|
CorrWrap::~CorrWrap(){ |
| 12 |
|
|
|
| 13 |
|
|
int i, j; |
| 14 |
|
|
|
| 15 |
|
|
switch (nDimensions){ |
| 16 |
|
|
|
| 17 |
|
|
case 1: |
| 18 |
|
|
delete[] corrValues1D; |
| 19 |
|
|
delete[] rValues1D; |
| 20 |
|
|
break; |
| 21 |
|
|
|
| 22 |
|
|
case 2: |
| 23 |
|
|
|
| 24 |
|
|
for(i=0;i<nBins;i++){ |
| 25 |
|
|
delete[] corrValues2D[i]; |
| 26 |
|
|
delete[] rValues2D[i]; |
| 27 |
|
|
} |
| 28 |
|
|
|
| 29 |
|
|
delete[] corrValues2D; |
| 30 |
|
|
delete[] rValues2D; |
| 31 |
|
|
break; |
| 32 |
|
|
|
| 33 |
|
|
case 3: |
| 34 |
|
|
|
| 35 |
|
|
for(i=0;i<nBins;i++){ |
| 36 |
|
|
for(j=0;j<nBins;j++){ |
| 37 |
|
|
delete[] corrValues3D[i][j]; |
| 38 |
|
|
delete[] rValues3D[i][j]; |
| 39 |
|
|
} |
| 40 |
|
|
delete[] corrValues3D[i]; |
| 41 |
|
|
delete[] rValues3D[i]; |
| 42 |
|
|
} |
| 43 |
|
|
|
| 44 |
|
|
delete[] corrValues3D; |
| 45 |
|
|
delete[] rValues3D; |
| 46 |
|
|
break; |
| 47 |
|
|
|
| 48 |
|
|
default: |
| 49 |
|
|
|
| 50 |
|
|
// empty case |
| 51 |
|
|
} |
| 52 |
|
|
} |
| 53 |
|
|
|
| 54 |
|
|
|
| 55 |
|
|
void CorrWrap::init1D( int theNbins ){ |
| 56 |
|
|
|
| 57 |
|
|
nBins = theNbins; |
| 58 |
|
|
nDimensions = 1; |
| 59 |
|
|
corrValues1D = new double[nBins]; |
| 60 |
|
|
rValues1D = new double[nBins]; |
| 61 |
|
|
} |
| 62 |
|
|
|
| 63 |
|
|
void CorrWrap::init2D( int theNbins ){ |
| 64 |
|
|
int i; |
| 65 |
|
|
|
| 66 |
|
|
nBins = theNbins; |
| 67 |
|
|
nDimensions = 2; |
| 68 |
|
|
corrValues2D = new double*[nBins]; |
| 69 |
|
|
rValues2D = new double*[nBins]; |
| 70 |
|
|
|
| 71 |
|
|
for(i=0;i<nBins;i++){ |
| 72 |
|
|
corrValues2D[i] = new double[nBins]; |
| 73 |
|
|
rValues2D[i] = new double[nBins]; |
| 74 |
|
|
} |
| 75 |
|
|
} |
| 76 |
|
|
void CorrWrap::init3D( int theNbins ){ |
| 77 |
|
|
int i, j; |
| 78 |
|
|
|
| 79 |
|
|
nBins = theNbins; |
| 80 |
|
|
nDimensions = 3; |
| 81 |
|
|
corrValues3D = new double**[nBins]; |
| 82 |
|
|
rValues3D = new double**[nBins]; |
| 83 |
|
|
|
| 84 |
|
|
for(i=0;i<nBins;i++){ |
| 85 |
|
|
corrValues3D[i] = new double*[nBins]; |
| 86 |
|
|
rValues3D[i] = new double*[nBins]; |
| 87 |
|
|
|
| 88 |
|
|
for(j=0;j<nBins;j++){ |
| 89 |
|
|
corrValues3D[i][j] = new double[nBins]; |
| 90 |
|
|
rValues3D[i][j] = new double[nBins]; |
| 91 |
|
|
} |
| 92 |
|
|
} |
| 93 |
|
|
} |