From 163694f4bc213ddd5418ffab6292821aafb1e1ec Mon Sep 17 00:00:00 2001 From: mferrera Date: Tue, 21 Nov 2023 20:33:30 +0100 Subject: [PATCH] CLN: Remove unused grd3d C code This code was not used and the grd3d variety of functions is meant to be replaced if it is. --- src/clib/xtg/grd3d_copy.c | 129 ----------------------------- src/clib/xtg/grd3d_zcorn_convert.c | 90 -------------------- src/clib/xtg/libxtg.h | 15 ---- 3 files changed, 234 deletions(-) delete mode 100644 src/clib/xtg/grd3d_copy.c delete mode 100644 src/clib/xtg/grd3d_zcorn_convert.c diff --git a/src/clib/xtg/grd3d_copy.c b/src/clib/xtg/grd3d_copy.c deleted file mode 100644 index 38d1f124c..000000000 --- a/src/clib/xtg/grd3d_copy.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - *************************************************************************************** - * - * NAME: - * grd3d_copy.c - * - * DESCRIPTION: - * Copy from input pointer arrays to new - * - * ARGUMENTS: - * ncol,nrow,nlay i Grid dimensions IX JY KZ in input - * p_coord1_v i Grid Z coord for input - * p_zcorn1_v i Grid Z corners for input - * p_actnum1_v i Grid ACTNUM parameter input - * p_coord2_v o Grid Z coord for output - * p_zcorn2_v o Grid Z corners for output - * p_actnum2_v o Grid ACTNUM parameter output - * iflag i Options flag (future use) - * - * RETURNS: - * The C macro EXIT_SUCCESS unless problems + changed pointers - * - * TODO/ISSUES/BUGS: - * None known - * - * LICENCE: - * cf. XTGeo LICENSE - *************************************************************************************** - */ - -#include "libxtg.h" -#include "libxtg_.h" -#include "logger.h" - -int -grd3d_copy(int ncol, - int nrow, - int nlay, - double *p_coord1_v, - double *p_zcorn1_v, - int *p_actnum1_v, - double *p_coord2_v, - double *p_zcorn2_v, - int *p_actnum2_v, - int iflag) -{ - /* locals */ - int ic, icn, jcn, kcn; - long ijo, ibt; - - for (kcn = 1; kcn <= nlay + 1; kcn++) { - for (jcn = 1; jcn <= nrow; jcn++) { - for (icn = 1; icn <= ncol; icn++) { - - if (kcn == 1) { - - ijo = 6 * ((jcn - 1) * (ncol + 1) + icn - 1); - - p_coord2_v[ijo + 0] = p_coord1_v[ijo + 0]; - p_coord2_v[ijo + 1] = p_coord1_v[ijo + 1]; - p_coord2_v[ijo + 2] = p_coord1_v[ijo + 2]; - p_coord2_v[ijo + 3] = p_coord1_v[ijo + 3]; - p_coord2_v[ijo + 4] = p_coord1_v[ijo + 4]; - p_coord2_v[ijo + 5] = p_coord1_v[ijo + 5]; - - if (jcn <= nrow && icn == ncol) { - - ijo = 6 * ((jcn - 1) * (ncol + 1) + icn - 0); - - p_coord2_v[ijo + 0] = p_coord1_v[ijo + 0]; - p_coord2_v[ijo + 1] = p_coord1_v[ijo + 1]; - p_coord2_v[ijo + 2] = p_coord1_v[ijo + 2]; - p_coord2_v[ijo + 3] = p_coord1_v[ijo + 3]; - p_coord2_v[ijo + 4] = p_coord1_v[ijo + 4]; - p_coord2_v[ijo + 5] = p_coord1_v[ijo + 5]; - } - - if (jcn == nrow && icn <= ncol) { - - ijo = 6 * ((jcn - 0) * (ncol + 1) + icn - 1); - - p_coord2_v[ijo + 0] = p_coord1_v[ijo + 0]; - p_coord2_v[ijo + 1] = p_coord1_v[ijo + 1]; - p_coord2_v[ijo + 2] = p_coord1_v[ijo + 2]; - p_coord2_v[ijo + 3] = p_coord1_v[ijo + 3]; - p_coord2_v[ijo + 4] = p_coord1_v[ijo + 4]; - p_coord2_v[ijo + 5] = p_coord1_v[ijo + 5]; - } - - if (jcn == nrow && icn == ncol) { - - ijo = 6 * ((jcn - 0) * (ncol + 1) + icn - 0); - - p_coord2_v[ijo + 0] = p_coord1_v[ijo + 0]; - p_coord2_v[ijo + 1] = p_coord1_v[ijo + 1]; - p_coord2_v[ijo + 2] = p_coord1_v[ijo + 2]; - p_coord2_v[ijo + 3] = p_coord1_v[ijo + 3]; - p_coord2_v[ijo + 4] = p_coord1_v[ijo + 4]; - p_coord2_v[ijo + 5] = p_coord1_v[ijo + 5]; - } - } - - ibt = x_ijk2ib(icn, jcn, kcn, ncol, nrow, nlay + 1, 0); - if (ibt < 0) { - throw_exception("Loop through grid resulted in index outside " - "boundary in grd3d_copy"); - return EXIT_FAILURE; - } - - for (ic = 1; ic <= 4; ic++) { - p_zcorn2_v[4 * ibt + 1 * ic - 1] = p_zcorn1_v[4 * ibt + 1 * ic - 1]; - } - - if (kcn <= nlay) { - ibt = x_ijk2ib(icn, jcn, kcn, ncol, nrow, nlay, 0); - if (ibt < 0) { - throw_exception("Loop through grid resulted in index outside " - "boundary in grd3d_copy"); - return EXIT_FAILURE; - } - - p_actnum2_v[ibt] = p_actnum1_v[ibt]; - } - } - } - } - - return EXIT_SUCCESS; -} diff --git a/src/clib/xtg/grd3d_zcorn_convert.c b/src/clib/xtg/grd3d_zcorn_convert.c deleted file mode 100644 index 16e732687..000000000 --- a/src/clib/xtg/grd3d_zcorn_convert.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - ****************************************************************************** - * - * Convert from Eclipse ZCORN format to XTGeo simplified zcorn - * - ****************************************************************************** - */ - -#include "libxtg.h" -#include "libxtg_.h" - -/* - ****************************************************************************** - * - * NAME: - * grd3d_zcorn_convert.c - * - * - * DESCRIPTION: - * Eclipse style ZCORN to XTGeo style zcornsv - * - * ARGUMENTS: - * nx, ny, nc i Dimensions - * zcorn i ZCORN as input from Eclipse - * coordsv o XTgeo's ZCORN repr - * option i Options flag for later usage - * - * RETURNS: - * Function: 0: upon success. If problems: - * 1: some input points are overlapping - * 2: the input points forms a line - * Result nvector is updated - * - * TODO/ISSUES/BUGS: - * - * LICENCE: - * CF XTGeo's LICENSE - ****************************************************************************** - */ - -void -grd3d_zcorn_convert(int nx, int ny, int nz, float *zcorn, double *zcornsv, int option) -{ - - int ibb = 0; - int ibz = 0; - int kzread = 0; - float fvalue1; - float fvalue2; - int kk = 0, kz, ix, jy; - - for (kz = 1; kz <= 2 * nz; kz++) { - if (kzread == 0) { - kzread = 1; - } else { - kzread = 0; - } - - if (kz == 2 * nz && kzread == 0) - kzread = 1; - - if (kzread == 1) { - kk += 1; - } - for (jy = 1; jy <= ny; jy++) { - /* "left" cell margin */ - for (ix = 1; ix <= nx; ix++) { - fvalue1 = zcorn[ibz++]; - fvalue2 = zcorn[ibz++]; - - ibb = x_ijk2ib(ix, jy, kk, nx, ny, nz + 1, 0); - if (kzread == 1) { - zcornsv[4 * ibb + 1 * 1 - 1] = fvalue1; - zcornsv[4 * ibb + 1 * 2 - 1] = fvalue2; - } - } - /* "right" cell margin */ - for (ix = 1; ix <= nx; ix++) { - fvalue1 = zcorn[ibz++]; - fvalue2 = zcorn[ibz++]; - - ibb = x_ijk2ib(ix, jy, kk, nx, ny, nz + 1, 0); - if (kzread == 1) { - zcornsv[4 * ibb + 1 * 3 - 1] = fvalue1; - zcornsv[4 * ibb + 1 * 4 - 1] = fvalue2; - } - } - } - } -} diff --git a/src/clib/xtg/libxtg.h b/src/clib/xtg/libxtg.h index f5eed90a4..9f8281543 100644 --- a/src/clib/xtg/libxtg.h +++ b/src/clib/xtg/libxtg.h @@ -1228,9 +1228,6 @@ grd3d_roff2xtgeo_splitenz(int nz, long n_swig_np_flt_inplace_v2 // nzcorn ); -void -grd3d_zcorn_convert(int nx, int ny, int nz, float *zcorn, double *zcornsv, int option); - int grd3d_ecl_tsteps(FILE *fc, int *seqnums, int *day, int *mon, int *year, int nmax); @@ -1254,18 +1251,6 @@ grd3d_conv_grid_roxapi(int ncol, long n_swig_np_dbl_aout_v3 // nzcorners ); -int -grd3d_copy(int ncol, - int nrow, - int nlay, - double *p_coord1_v, - double *p_zcorn1_v, - int *p_actnum1_v, - double *p_coord2_v, - double *p_zcorn2_v, - int *p_actnum2_v, - int iflag); - int grd3d_crop_geometry(int nx, int ny,