Explain what's going in this code

double *T;
int *listprop;
double **listval;
double *Final_T;
double *perm;
double *permx;
double *permx_orig;
double *time_orig;
double *dtc;
double *porosity;
double *porosity_orig;
double *source;

permx_orig=new double[npixels];
time_orig=new double[npixels];
dtc=new double[npixels];
porosity_orig=new double[npixels];
Final_T=new double[npixels];
perm=new double[npixels];
permx=new double[npixels];
porosity=new double[npixels];

source=new double[num_source*num_source*3];

int kk;
kk=-1;

for(int i=0;i<num_source;i++){
for(int j=0;j<num_source;j++){
k=0;
kk=kk+1;

source[3*kk]=nx/2+1;
source[3*kk+1]=ny/2+1;
source[3*kk+2]=nz/2+1;
cout<<source[3*(kk)]<<"-"<<source[3*kk+1]<<"-"<<source[3*kk+2]<<endl;

}
}

for (int ii=0;ii<npixels;ii++){
permx[ii]=1;
permx_orig[ii]=1;
porosity[ii]=1;
porosity_orig[ii]=1;
}
int ii;





T= Final_T;
F=permx;
SourcePoints=source;

/* Pixels which are processed and have a final distance are frozen */
Frozen = new bool[npixels];
for(q=0;q<npixels;q++){Frozen[q]=0; T[q]=-1;}
Please use code tags when posting code, to make it more readable:

http://www.cplusplus.com/articles/jEywvCM9/
ASQ19's code with code tags:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
double *T;
int *listprop;
double **listval;
double *Final_T;
double *perm;
double *permx;
double *permx_orig;
double *time_orig;
double *dtc;
double *porosity;
double *porosity_orig;
double *source;

permx_orig=new double[npixels];
time_orig=new double[npixels];
dtc=new double[npixels];
porosity_orig=new double[npixels];
Final_T=new double[npixels];
perm=new double[npixels];
permx=new double[npixels];
porosity=new double[npixels];

source=new double[num_source*num_source*3];

int kk;
kk=-1;

for(int i=0;i<num_source;i++){
for(int j=0;j<num_source;j++){
k=0;
kk=kk+1;

source[3*kk]=nx/2+1;
source[3*kk+1]=ny/2+1;
source[3*kk+2]=nz/2+1;
cout<<source[3*(kk)]<<"-"<<source[3*kk+1]<<"-"<<source[3*kk+2]<<endl;

}
}

for (int ii=0;ii<npixels;ii++){
permx[ii]=1;
permx_orig[ii]=1;
porosity[ii]=1;
porosity_orig[ii]=1;
}
int ii;





T= Final_T;
F=permx;
SourcePoints=source;

/* Pixels which are processed and have a final distance are frozen */
Frozen = new bool[npixels];
for(q=0;q<npixels;q++){Frozen[q]=0; T[q]=-1;}
Topic archived. No new replies allowed.