ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/staticProps/CorrWrap.cpp
Revision: 810
Committed: Fri Oct 17 21:19:07 2003 UTC (20 years, 9 months ago) by mmeineke
File size: 1567 byte(s)
Log Message:
added the staticProps directory to the build list
for both configure  and configure.in


fixed a number of bugs in the staticProps code. gofr is now working.

File Contents

# User Rev Content
1 mmeineke 803 #include <stdlib.h>
2    
3     #include "CorrWrap.hpp"
4    
5 mmeineke 810 CorrWrap::CorrWrap(){
6 mmeineke 803
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 mmeineke 810 break;
52 mmeineke 803 }
53     }
54    
55    
56     void CorrWrap::init1D( int theNbins ){
57    
58     nBins = theNbins;
59     nDimensions = 1;
60     corrValues1D = new double[nBins];
61     rValues1D = new double[nBins];
62     }
63    
64     void CorrWrap::init2D( int theNbins ){
65     int i;
66    
67     nBins = theNbins;
68     nDimensions = 2;
69     corrValues2D = new double*[nBins];
70     rValues2D = new double*[nBins];
71    
72     for(i=0;i<nBins;i++){
73     corrValues2D[i] = new double[nBins];
74     rValues2D[i] = new double[nBins];
75     }
76     }
77     void CorrWrap::init3D( int theNbins ){
78     int i, j;
79    
80     nBins = theNbins;
81     nDimensions = 3;
82     corrValues3D = new double**[nBins];
83     rValues3D = new double**[nBins];
84    
85     for(i=0;i<nBins;i++){
86     corrValues3D[i] = new double*[nBins];
87     rValues3D[i] = new double*[nBins];
88    
89     for(j=0;j<nBins;j++){
90     corrValues3D[i][j] = new double[nBins];
91     rValues3D[i][j] = new double[nBins];
92     }
93     }
94     }