Skip to content

Commit ca2650f

Browse files
authored
Merge pull request #307 from jcrivenaes/zcorn-etc-as-numpies-primarely
Zcorn etc as numpies primarely
2 parents 03a1c2a + 448752f commit ca2650f

File tree

92 files changed

+6737
-7250
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+6737
-7250
lines changed

docs/datamodels.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ a corner-point grid (Grid class), and a number of assosiated properties
162162
(GridProperty class):
163163

164164
* The geometry is stored as pointers to C arrays; hence the geometry itself is not
165-
directly accessible in Python. The C arrays are usually named p_coord_v, p_zcorn_v,
166-
and p_actnum_v. They are one dimensionial arrays.
165+
directly accessible in Python. The C arrays are usually named coordsv, zcornsv,
166+
and actnumsv. They are one dimensionial arrays.
167167

168168
* The grid dimensions are given by ``ncol * nrow * nlay``
169169

src/xtgeo/clib/cxtgeo.i

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@ import_array();
9999
%apply (double* IN_ARRAY1, long DIM1) {(double *swig_np_dbl_in_v4,
100100
long n_swig_np_dbl_in_v4)};
101101

102+
// IN float64 / double no 5
103+
%apply (double* IN_ARRAY1, long DIM1) {(double *swig_np_dbl_in_v5,
104+
long n_swig_np_dbl_in_v5)};
105+
106+
// IN float64 / double no 6
107+
%apply (double* IN_ARRAY1, long DIM1) {(double *swig_np_dbl_in_v6,
108+
long n_swig_np_dbl_in_v6)};
109+
102110
// INPLACE int no 1
103111
%apply (int* INPLACE_ARRAY1, long DIM1) {(int *swig_np_int_inplace_v1,
104112
long n_swig_np_int_inplace_v1)};

src/xtgeo/clib/etc/ctests/test_eclgridprop.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ int main () {
1212
int nx, ny, nz, ptype, ncodes;
1313
double xori, yori, xinc, yinc, rot;
1414
int mode, debug, ndef, nklist, ndates;
15-
double *p_double_v, *p_zcorn_v, *p_coord_v;
16-
int *p_actnum_v;
15+
double *p_double_v, *zcornsv, *coordsv;
16+
int *actnumsv;
1717
char *p_codenames_v;
1818
int *p_int_v, *p_codevalues_v;
1919
int *day, *mon, *year, *nktype, *dsuccess, *norder, nklist3;
@@ -43,14 +43,14 @@ int main () {
4343
/* file, debug); */
4444

4545

46-
/* p_coord_v = calloc((nx+1)*(ny+1)*2*3, 8); */
47-
/* p_zcorn_v = calloc(nx*ny*(nz+1)*4, 8); */
48-
/* p_actnum_v = calloc(nx*ny*nz, 4); */
46+
/* coordsv = calloc((nx+1)*(ny+1)*2*3, 8); */
47+
/* zcornsv = calloc(nx*ny*(nz+1)*4, 8); */
48+
/* actnumsv = calloc(nx*ny*nz, 4); */
4949

5050
/* grd3d_import_ecl_egrid (0, nx, ny, nz, */
5151
/* &ndef, */
52-
/* p_coord_v, p_zcorn_v, */
53-
/* p_actnum_v, file, debug); */
52+
/* coordsv, zcornsv, */
53+
/* actnumsv, file, debug); */
5454

5555

5656
/* printf("%d\n",nx); */
@@ -92,7 +92,7 @@ int main () {
9292

9393
/* grd3d_import_ecl_prop(5, */
9494
/* nx*ny*nz, */
95-
/* p_actnum_v, */
95+
/* actnumsv, */
9696
/* nklist, */
9797
/* useprops, */
9898
/* ndates, */

src/xtgeo/clib/etc/ctests/test_grd3d_onelayer.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ int main () {
1515
double xstep, ystep, xori, xmin, xmax, yori, ymin, ymax, zmin, zmax;
1616
double *zval_v, *zval2_v;
1717
int numact, numsubs, nx, ny, nz, nactive, status;
18-
int *p_actnum_v, *p_subgrd_v;
18+
int *actnumsv, *p_subgrd_v;
1919
int *p_actnum2_v, *p_subgrd2_v;
20-
double *p_coord_v, *p_zcorn_v, *p_zcorn2_v;
20+
double *coordsv, *zcornsv, *p_zcorn2_v;
2121

2222

2323
xtgverbose(debug);
@@ -38,19 +38,19 @@ int main () {
3838
nz=14;
3939

4040
/* allocate */
41-
p_coord_v = calloc((nx+1)*(ny+1)*2*3,sizeof(double));
42-
p_zcorn_v = calloc(nx*ny*(nz+1)*4,sizeof(double));
43-
p_actnum_v = calloc(nx*ny*nz,sizeof(int));
41+
coordsv = calloc((nx+1)*(ny+1)*2*3,sizeof(double));
42+
zcornsv = calloc(nx*ny*(nz+1)*4,sizeof(double));
43+
actnumsv = calloc(nx*ny*nz,sizeof(int));
4444
p_subgrd_v = calloc(1,sizeof(int));
4545

4646

4747
printf("Reading grid\n");
48-
grd3d_import_roff_grid(&numact, &numsubs, p_coord_v, p_zcorn_v,
49-
p_actnum_v, p_subgrd_v, 1, file, debug);
48+
grd3d_import_roff_grid(&numact, &numsubs, coordsv, zcornsv,
49+
actnumsv, p_subgrd_v, 1, file, debug);
5050

5151
printf("Reading grid done\n");
5252

53-
ok(p_actnum_v[33]==1, "ACTNUM of location 33");
53+
ok(actnumsv[33]==1, "ACTNUM of location 33");
5454

5555

5656
p_zcorn2_v = calloc(nx*ny*(1+1)*4,sizeof(double));
@@ -62,9 +62,9 @@ int main () {
6262
nx,
6363
ny,
6464
nz,
65-
p_zcorn_v,
65+
zcornsv,
6666
p_zcorn2_v,
67-
p_actnum_v,
67+
actnumsv,
6868
p_actnum2_v,
6969
&nactive,
7070
0,
@@ -88,7 +88,7 @@ int main () {
8888
450000,
8989
6700000,
9090
0,
91-
p_coord_v,
91+
coordsv,
9292
p_zcorn2_v,
9393
p_actnum2_v,
9494
p_subgrd2_v,
@@ -102,7 +102,7 @@ int main () {
102102
nx,
103103
ny,
104104
1,
105-
p_coord_v,
105+
coordsv,
106106
p_zcorn2_v,
107107
p_actnum2_v,
108108
file,

src/xtgeo/clib/etc/ctests/test_point_in_cell_profiling.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ int main () {
88
int ib, ier, inside, i;
99
double nvector[4], line_v[6], point_v[3], c[24], myz;
1010
int debug=1, nx, ny, nz, numact, numsubs;
11-
int *p_actnum_v, *p_subgrd_v, ns;
12-
double *p_coord_v, *p_zcorn_v;
11+
int *actnumsv, *p_subgrd_v, ns;
12+
double *coordsv, *zcornsv;
1313
char file[70];
1414
double x, y, z, zadd;
1515
int ibstart;
@@ -28,15 +28,15 @@ int main () {
2828
nz=14;
2929

3030
/* allocate */
31-
p_coord_v = calloc((nx+1)*(ny+1)*2*3,sizeof(double));
32-
p_zcorn_v = calloc(nx*ny*(nz+1)*4,sizeof(double));
33-
p_actnum_v = calloc(nx*ny*nz,sizeof(int));
31+
coordsv = calloc((nx+1)*(ny+1)*2*3,sizeof(double));
32+
zcornsv = calloc(nx*ny*(nz+1)*4,sizeof(double));
33+
actnumsv = calloc(nx*ny*nz,sizeof(int));
3434
p_subgrd_v = calloc(1,sizeof(int));
3535

3636

3737
printf("Reading grid\n");
38-
grd3d_import_roff_grid(&numact, &numsubs, p_coord_v, p_zcorn_v,
39-
p_actnum_v, p_subgrd_v, 1, file, debug);
38+
grd3d_import_roff_grid(&numact, &numsubs, coordsv, zcornsv,
39+
actnumsv, p_subgrd_v, 1, file, debug);
4040

4141
printf("Reading grid done\n");
4242

@@ -57,9 +57,9 @@ int main () {
5757
/* nx, */
5858
/* ny, */
5959
/* nz, */
60-
/* p_coord_v, */
61-
/* p_zcorn_v, */
62-
/* p_actnum_v, */
60+
/* coordsv, */
61+
/* zcornsv, */
62+
/* actnumsv, */
6363
/* 5, */
6464
/* 1, */
6565
/* &ns, */

src/xtgeo/clib/etc/extra/attic/grd3d_adj_z_local.c.unfinished

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ void grd3d_adj_z_local (
2121
int nx,
2222
int ny,
2323
int nz,
24-
double *p_coord_v,
25-
double *p_zcorn_v,
26-
int *p_actnum_v,
24+
double *coordsv,
25+
double *zcornsv,
26+
int *actnumsv,
2727
int iuse,
2828
int juse,
2929
int kuse,
@@ -43,7 +43,7 @@ void grd3d_adj_z_local (
4343

4444
xtg_speak(s,2,"Entering <grd3d_adj_z_local>");
4545
xtg_speak(s,3,"Using IFLAG: %d", iflag);
46-
46+
4747
xtg_speak(s,3,"NX NY NZ: %d %d %d", nx, ny, nz);
4848

4949

@@ -56,24 +56,24 @@ void grd3d_adj_z_local (
5656
nx,
5757
ny,
5858
nz,
59-
p_zcorn_v,
60-
p_actnum_v,
59+
zcornsv,
60+
actnumsv,
6161
0.001,
6262
debug
6363
);
6464

6565
kstart=1;
6666
kstop=nz;
67-
68-
/* Adjust all values along pillar: */
69-
if (iflag==0) {
67+
68+
/* Adjust all values along pillar: */
69+
if (iflag==0) {
7070
for (k = 1; k <= nz+1; k+=1) {
7171
ib=x_ijk2ib(i,j,k,nx,ny,nz+1,0);
72-
p_zcorn_v[4*ib + 1*ic - 1] =
73-
p_zcorn_v[4*ib + 1*ic - 1] + zadj;
72+
zcornsv[4*ib + 1*ic - 1] =
73+
zcornsv[4*ib + 1*ic - 1] + zadj;
7474
}
7575
}
76-
76+
7777

7878

7979

@@ -88,15 +88,12 @@ void grd3d_adj_z_local (
8888
nx,
8989
ny,
9090
nz,
91-
p_zcorn_v,
92-
p_actnum_v,
91+
zcornsv,
92+
actnumsv,
9393
0.001,
9494
debug
9595
);
9696

9797
xtg_speak(s,1,"Adjusting grid to map ... DONE!");
9898
xtg_speak(s,2,"Exiting <grd3d_adj_z_from_map>");
9999
}
100-
101-
102-

0 commit comments

Comments
 (0)