forked from yuanyuxin0077/FD-RTM-FWI-2018.01.31backup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
adcigs_chouxi.c
55 lines (39 loc) · 1.08 KB
/
adcigs_chouxi.c
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
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
int main(int argc, char* argv[])
{
int nz,nx,dcdp,na,ix,iz,ia,id,ido,nna;
float *in,*out;
char FN1[250]={"adcigs_laplace.dat"};
char FN2[250]={"adcigs_chouxi.dat"};
FILE *fp1, *fp2;
fp1 = fopen (FN1,"rb");
fp2 = fopen (FN2,"wb");
nx=711;
nz=300;
na=65;
dcdp=45;
nna=40;
in = (float*)malloc(nx*nz*na*sizeof(float));printf("----\n");
out = (float*)malloc(nx/dcdp*nz*nna*sizeof(float));printf("----\n");
fread(in,sizeof(float),nx*nz*na,fp1);printf("----2\n");
for (ix=0; ix<nx; ix++)
{
for (ia=0; ia<na; ia++)
{
for (iz=0; iz<nz; iz++)
{
id=ix*na*nz+ia*nz+iz;
if(ix%dcdp==0&&ia<40)
{
ido=ix/dcdp*nna*nz+ia*nz+iz;
out[ido]=in[id];
}
}
}
}
fwrite(out,sizeof(float),nx/dcdp*nz*nna,fp2);
exit(0);
}