#include "geoslib_old_f.h"
#include "geoslib_enum.h"
#include "Enum/EJustify.hpp"
#include "Basic/Law.hpp"
#include "Db/Db.hpp"
#include "Db/DbGrid.hpp"
#include "Model/Model.hpp"
#include "Basic/Utilities.hpp"
#include "Basic/String.hpp"
#include "Basic/OptDbg.hpp"
#include "Basic/Memory.hpp"
#include "Core/Seismic.hpp"
#include <math.h>
Classes | |
struct | ST_Seismic_Neigh |
Functions | |
static int | st_velocity_minmax (int nech, double *vv, double *v0, double *v1, double *vmin, double *vmax) |
static void | st_yxtoxy (int nx, double dx, double x0, const double *y, int ny, double dy, double y0, double xylo, double xyhi, double *x) |
static double | dsinc (double x) |
static void | stoepd (int n, const double *r, const double *g, double *f, double *a) |
static void | st_mksinc (double d, int lsinc, double *sinc) |
static void | st_intt8r (int ntable, double table[][LTABLE], int nxin, double dxin, double fxin, const double *yin, double yinl, double yinr, int nxout, const double *xout, double *yout) |
static void | st_weights (double table[][LTABLE]) |
static void | st_seismic_debug (int rankz, int nz, double z0, double dz, int rankt, int nt, double t0, double dt, double vmin, double vmax) |
int | seismic_z2t_grid (int verbose, DbGrid *db_z, int iatt_v, int *nx, double *x0, double *dx) |
int | seismic_t2z_grid (int verbose, DbGrid *db_t, int iatt_v, int *nx, double *x0, double *dx) |
static void | st_copy (int mode, DbGrid *db, int iatt, int ival, double *tab) |
static int | st_match (DbGrid *db_z, DbGrid *db_t) |
static void | st_seismic_z2t_convert (DbGrid *db_z, int iatt_z, int nz, double z0, double, double dz, DbGrid *db_t, int iatt_t, int nt, double t0, double t1, double dt, DbGrid *db_v, int iatt_v, int natt, double *tz, double *zt, double *at, double *az) |
static void | st_seismic_t2z_convert (DbGrid *db_t, int iatt_t, int nt, double t0, double t1, double dt, DbGrid *db_z, int iatt_z, int nz, double z0, double z1, double dz, DbGrid *db_v, int iatt_v, int natt, double *tz, double *zt, double *at, double *az) |
static double | TR_IN (Db *db, int iatt_in, int iatt, int itrace, int it) |
static void | TR_OUT (Db *db, int iatt_out, int iatt, int itr, int it, double value) |
static int | st_seismic_operate (Db *db, int oper, int natt, int nt, int iatt_in, int iatt_out, double dt) |
static double * | st_seismic_wavelet (int verbose, int type, int ntw, int tindex, double dt, double fpeak, double period, double amplitude, double distort) |
static void | st_seismic_convolve (int nx, int ix0, const double *x, int ny, int iy0, const double *y, int nz, int iz0, double *z) |
int | seismic_z2t_convert (DbGrid *db_z, int iatt_v, DbGrid *db_t) |
int | seismic_t2z_convert (DbGrid *db_t, int iatt_v, DbGrid *db_z) |
int | seismic_operate (DbGrid *db, int oper) |
static void | st_seismic_affect (Db *, int nz, int shift, double val_before, double val_middle, double val_after, const double *tab0, double *tab1) |
static void | st_seismic_contrast (int nz, double *tab) |
int | seismic_convolve (DbGrid *db, int flag_operate, int flag_contrast, int type, int ntw, int option, int tindex, double fpeak, double period, double amplitude, double distort, double val_before, double val_middle, double val_after, double *wavelet) |
static int | st_absolute_index (DbGrid *db, int ix, int iz) |
static void | st_sample_remove_central (ST_Seismic_Neigh *ngh) |
static void | st_sample_add (DbGrid *db, int iatt_z1, int iatt_z2, int flag_test, int ix, int iz, ST_Seismic_Neigh *ngh) |
static void | st_estimate_check_presence (DbGrid *db, int ivar, int *npres, int *presence) |
static void | st_estimate_neigh_init (ST_Seismic_Neigh *ngh) |
static ST_Seismic_Neigh * | st_estimate_neigh_management (int mode, int nvois, ST_Seismic_Neigh *ngh) |
static int | st_estimate_neigh_unchanged (ST_Seismic_Neigh *ngh_old, ST_Seismic_Neigh *ngh_cur) |
static void | st_estimate_neigh_copy (ST_Seismic_Neigh *ngh_cur, ST_Seismic_Neigh *ngh_old) |
static void | st_estimate_neigh_print (ST_Seismic_Neigh *ngh, int ix0, int iz0) |
static int | st_estimate_neigh_create (DbGrid *db, int flag_exc, int iatt_z1, int iatt_z2, int ix0, int iz0, int nbench, int nv2max, int[2], int *presence[2], ST_Seismic_Neigh *ngh) |
static void | st_estimate_flag (ST_Seismic_Neigh *ngh, int nfeq, int *flag, int *nred) |
static void | st_estimate_var0 (Model *model, double *var0) |
static void | st_estimate_c00 (Model *model, double *c00) |
static void | st_estimate_lhs (ST_Seismic_Neigh *ngh, Model *model, int nfeq, int nred, int *flag, double *lhs) |
static void | st_estimate_rhs (ST_Seismic_Neigh *ngh, Model *model, int nfeq, int nred, int *flag, double *rhs) |
static void | st_wgt_print (ST_Seismic_Neigh *ngh, int nvar, int nech, int nred, const int *flag, const double *wgt) |
static int | st_estimate_wgt (ST_Seismic_Neigh *ngh, Model *, int nred, int *flag, double *lhs, double *rhs, double *wgt) |
static void | st_estimate_result (Db *db, ST_Seismic_Neigh *ngh, int flag_std, int, int nred, const int *flag, const double *wgt, const double *rhs, const double *var0, int *iatt_est, int *iatt_std) |
static void | st_simulate_result (DbGrid *db, int ix0, int iz0, ST_Seismic_Neigh *ngh, int nbsimu, int, int nred, const int *flag, const double *wgt, const double *rhs, const double *c00, int *iatt_sim) |
static int | st_estimate_sort (const int *presence, int *rank) |
int | seismic_estimate_XZ (DbGrid *db, Model *model, int nbench, int nv2max, int flag_ks, int flag_std, int flag_sort, int flag_stat) |
static void | st_copy_attribute (Db *db, int nbsimu, int *iatt) |
int | seismic_simulate_XZ (DbGrid *db, Model *model, int nbench, int nv2max, int nbsimu, int seed, int flag_ks, int flag_sort, int flag_stat) |
Variables | |
static MatrixSquareGeneral | covtab |
static double | DX |
static double | DZ |
static int | NX |
static int | NY |
static int | NZ |
static int | NVAR |
static int | NTRACE |
static double | VFACT = 1000. |
static int | IECH_OUT = -1 |
|
static |
int seismic_convolve | ( | DbGrid * | db, |
int | flag_operate, | ||
int | flag_contrast, | ||
int | type, | ||
int | ntw, | ||
int | option, | ||
int | tindex, | ||
double | fpeak, | ||
double | period, | ||
double | amplitude, | ||
double | distort, | ||
double | val_before, | ||
double | val_middle, | ||
double | val_after, | ||
double * | wavelet | ||
) |
Convolve with a given wavelet
[in] | db | Db structure |
[in] | flag_operate | 1 to perform the convolution; 0 otherwise |
[in] | flag_contrast | 1 to perform contrast; 0 otherwise |
[in] | type | Type of the wavelet (ENUM_WAVELETS) |
[in] | ntw | half-length of the wavelet excluding center (samples) |
[in] | option | option used to perform the convolution
|
[in] | tindex | time index to locate the spike (Spike) |
[in] | fpeak | peak frequency of the Ricker wavelet |
[in] | period | wavelet period (s) (Ricker) |
[in] | amplitude | wavelet amplitude (Ricker) |
[in] | distort | wavelet distortion factor (Ricker) |
[in] | val_before | Replacement value for undefined element before first defined sample |
[in] | val_middle | Replacement value for undefined element between defined samples |
[in] | val_after | Replacement value for undefined element after last defined sample |
[in] | wavelet | Wavelet defined as input (Dimension: 2*ntw+1) |
int seismic_estimate_XZ | ( | DbGrid * | db, |
Model * | model, | ||
int | nbench, | ||
int | nv2max, | ||
int | flag_ks, | ||
int | flag_std, | ||
int | flag_sort, | ||
int | flag_stat | ||
) |
Perform a bivariate estimation on a grid
[in,out] | db | Grid Db structure |
[in] | model | Model structure |
[in] | nbench | Vertical Radius of the neighborhood (center excluded) |
[in] | nv2max | Maximum number of traces of second variable on each side of the target trace |
[in] | flag_ks | 1 for a Simple Kriging; otherwise Ordinary Kriging |
[in] | flag_std | 1 for the calculation of the St. Dev. |
[in] | flag_sort | 1 if the traces to be treated are sorted by increasing distance to trace where first variable is defined |
[in] | flag_stat | 1 for producing final statistics |
int seismic_operate | ( | DbGrid * | db, |
int | oper | ||
) |
Do unary arithmetic operation on traces
[in] | db | Db structure |
[in] | oper | Operator flag (ENUM_SEISMICS) |
int seismic_simulate_XZ | ( | DbGrid * | db, |
Model * | model, | ||
int | nbench, | ||
int | nv2max, | ||
int | nbsimu, | ||
int | seed, | ||
int | flag_ks, | ||
int | flag_sort, | ||
int | flag_stat | ||
) |
Perform a bivariate cosimulation on a grid
[in,out] | db | Grid Db structure |
[in] | model | Model structure |
[in] | nbench | Vertical Radius of the neighborhood (center excluded) |
[in] | nv2max | Maximum number of traces of second variable on each side of the target trace |
[in] | nbsimu | Number of simulations |
[in] | seed | Seed for the random number generator |
[in] | flag_ks | 1 for a Simple Kriging; otherwise Ordinary Kriging |
[in] | flag_sort | 1 if the traces to be treated are sorted by increasing distance to trace where first variable is defined |
[in] | flag_stat | 1 for producing final statistics |
int seismic_t2z_grid | ( | int | verbose, |
DbGrid * | db_t, | ||
int | iatt_v, | ||
int * | nx, | ||
double * | x0, | ||
double * | dx | ||
) |
Define the Depth Grid characteristics from the Time Grid
[in] | verbose | Verbose flag |
[in] | db_t | Time Grid structure |
[in] | iatt_v | Attribute address of the Velocity (in Time grid) |
[out] | nx | Number of grid nodes along each direction |
[out] | x0 | Origin of the grid along each direction |
[out] | dx | Mesh of the grid along each direction |
Resample from depth to time
[in] | db_z | Depth Grid structure |
[in] | iatt_v | Address of the Velocity variable (in Depth grid) |
[out] | db_t | Time Grid structure |
int seismic_z2t_grid | ( | int | verbose, |
DbGrid * | db_z, | ||
int | iatt_v, | ||
int * | nx, | ||
double * | x0, | ||
double * | dx | ||
) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Establish the Kriging flag
[in] | ngh | Current ST_Seismic_Neigh structure |
[in] | nfeq | Number of drift condition per variable |
[out] | flag | Array containing the Kriging flag |
[out] | nred | Reduced number of equations |
|
static |
Establish the Kriging L.H.S.
[in] | ngh | Current ST_Seismic_Neigh structure |
[in] | model | Model structure |
[in] | nfeq | Number of drift condition per variable |
[in] | nred | Reduced number of equations |
[in] | flag | Array giving the flag |
[out] | lhs | Array containing the Kriging L.H.S. |
|
static |
Copy the current neighborhood into the old one
[in] | ngh_cur | Current ST_Seismic_Neigh structure |
[out] | ngh_old | Old ST_Seismic_Neigh structure |
|
static |
Establish the neighborhood
[in] | db | Grid Db structure |
[in] | flag_exc | 1 if the target sample must be excluded |
[in] | iatt_z1 | Address of the first data attribute |
[in] | iatt_z2 | Address of the second data attribute |
[in] | ix0 | Rank of the target trace |
[in] | iz0 | Rank of the target sample within the target trace |
[in] | nbench | Vertical Radius of the neighborhood (center excluded) |
[in] | nv2max | Maximum number of traces of second variable on each side of the target trace |
[in] | presence | Array giving the number of valid samples per trace |
[out] | ngh | Current ST_Seismic_Neigh structure |
|
static |
Initialize the ST_Seismic_Neigh structure
[in] | ngh | ST_Seismic_Neigh structure to be freed (if mode<0) |
|
static |
Manage the ST_Seismic_Neigh structure
[in] | mode | Type of management
|
[in] | nvois | Maximum number of samples in the neighborhood |
[in] | ngh | ST_Seismic_Neigh structure to be freed (if mode<0) |
|
static |
Print the Kriging Information
[in] | ngh | Current ST_Seismic_Neigh structure |
[in] | ix0 | Rank of the target trace |
[in] | iz0 | Rank of the target sample within the target trace |
|
static |
Check if the neighborhood has changed
[in] | ngh_old | Previous ST_Seismic_Neigh structure |
[in] | ngh_cur | Current ST_Seismic_Neigh structure |
|
static |
Perform the Kriging
[in] | db | Grid Db structure |
[in] | ngh | Current ST_Seismic_Neigh structure |
[in] | flag_std | 1 for the calculation of the St. Dev. |
[in] | nred | Reduced number of equations |
[in] | flag | Array giving the flag |
[in] | wgt | Array containing the Kriging weights |
[in] | rhs | Array containing the R.H.S. member |
[in] | var0 | Array containing the C00 terms |
[in] | iatt_est | Array of pointers to the kriged result |
[in] | iatt_std | Array of pointers to the variance of estimation |
|
static |
Establish the Kriging R.H.S.
[in] | ngh | Current ST_Seismic_Neigh structure |
[in] | model | Model structure |
[in] | nfeq | Number of drift condition per variable |
[in] | nred | Reduced number of equations |
[in] | flag | Array giving the flag |
[out] | rhs | Array containing the Kriging R.H.S. |
|
static |
|
static |
|
static |
Establish the Kriging Weights
[in] | ngh | Current ST_Seismic_Neigh structure |
[in] | nred | Reduced number of Kriging equations |
[in] | flag | Array giving the flag |
[in] | lhs | Array of Kriging L.H.S. |
[in] | rhs | Array of Kriging R.H.S. |
[out] | wgt | Array containing the Kriging Weights |
|
static |
Interpolation of a uniformly-sampled complex function y(x) via a table of 8-coefficient interpolators
[in] | ntable | number of tabulated interpolation operators; ntable>=2 |
[in] | table | array of tabulated 8-point interpolation operators |
[in] | nxin | number of x values at which y(x) is input |
[in] | dxin | x sampling interval for input y(x) |
[in] | fxin | x value of first sample input |
[in] | yin | array of input y(x) values: yin[0] = y(fxin), etc. |
[in] | yinl | value used to extrapolate yin values to left of yin[0] |
[in] | yinr | value used to extrapolate yin values to right of yin[nxin-1] |
[in] | nxout | number of x values a which y(x) is output |
[in] | xout | array of x values at which y(x) is output |
[out] | yout | array of output y(x) values: yout[0] = y(xout[0]), etc. |
|
static |
Compute least-squares optimal sinc interpolation coefficients.
[in] | d | fractional distance to interpolation point; 0.0<=d<=1.0 |
[in] | lsinc | length of sinc approximation; lsinc%2==0 and lsinc<=20 |
[out] | sinc | array[lsinc] containing interpolation coefficients |
|
static |
Add the sample to the neighborhood
[in] | db | Grid Db structure |
[in] | iatt_z1 | Address of the first data attribute |
[in] | iatt_z2 | Address of the second data attribute |
[in] | flag_test | Flag to check if the sample must be added
|
[in] | ix | Rank of the trace |
[in] | iz | Rank of the target sample within the target trace |
[in,out] | ngh | ST_Seismic_Neigh structure |
|
static |
Remove the sample which coincides with the target site from the neighborhood
[in,out] | ngh | ST_Seismic_Neigh structure |
|
static |
Loads the values of a Db column in the output array Completes undefined values
[in] | nz | Number of elements in the column |
[in] | shift | The shift of the trace before convolution |
[in] | val_before | Replacement value for undefined element before first defined sample |
[in] | val_middle | Replacement value for undefined element between defined samples |
[in] | val_after | Replacement value for undefined element after last defined sample |
[in] | tab0 | Input array (Dimension: nz) |
[out] | tab1 | Output array (Dimension: nz) |
|
static |
Converts an impedance into a contrast
[in] | nz | Number of elements in the column |
[out] | tab | Output array (Dimension: nz) |
|
static |
Compute the convolution of two input vector arrays
[in] | nx | length of x array |
[in] | ix0 | sample index of first x |
[in] | x | array[nx] to be convolved with y |
[in] | ny | length of y array |
[in] | iy0 | sample index of first y |
[in] | y | array[ny] with which x is to be convolved |
[in] | nz | length of z array |
[in] | iz0 | sample index of first z |
[out] | z | array[nz] containing x convolved with y |
|
static |
Debugging printout for the seismic time-to-depth conversion
[in] | rankz | Rank for Depth (0 for Input; 1 for Output) |
[in] | nz | number of depth samples |
[in] | z0 | first depth value |
[in] | dz | depth sampling interval |
[in] | rankt | Rank for Time (0 for Input; 1 for Output) |
[in] | nt | number of time samples |
[in] | t0 | first time value |
[in] | dt | time sampling interval |
[in] | vmin | Minimum velocity value |
[in] | vmax | Maximum velocity value |
|
static |
Do unary arithmetic operation on traces
[in] | db | Db structure |
[in] | oper | Operator flag (ENUM_SEISMICS) |
[in] | natt | Number of seismic attributes |
[in] | nt | Number of samples on input trace |
[in] | iatt_in | Address of the first input attribute |
[in] | iatt_out | Address of the first output attribute |
[in] | dt | time sampling interval |
|
static |
Resample from time to depth
[in] | db_t | Time Db |
[in] | iatt_t | Address of the first variable of the Time Db |
[in] | nt | Number of meshes of the Time Db |
[in] | t0 | First Time |
[in] | t1 | Last Time |
[in] | dt | Mesh of the Time Db |
[in] | db_z | Depth Db |
[in] | iatt_z | Address of the first variable of the Depth Db |
[in] | nz | Number of meshes of the Depth Db |
[in] | z0 | First Depth |
[in] | z1 | Last Depth |
[in] | dz | Mesh of the Depth Db |
[in] | db_v | Velocity Db |
[in] | iatt_v | Address of the velocity variable in Depth Db |
[in] | natt | Number of seismic attributes |
[out] | tz | Working array (dimension: nt) |
[out] | zt | Working array (dimension: nz) |
[out] | at | Working array (dimension: nt) |
[out] | az | Working array (dimension: nz) |
|
static |
Defining some wavelets for modeling of seimic data
[in] | verbose | 1 for a verbose output; 0 otherwise |
[in] | type | Type of the wavelet (ENUM_WAVELETS) |
[in] | ntw | half-length of the wavelet excluding center (samples) |
[in] | tindex | time index to locate the spike (Spike) |
[in] | dt | time step |
[in] | fpeak | peak frequency of the Ricker wavelet |
[in] | period | wavelet period (s) (Ricker) |
[in] | amplitude | wavelet amplitude (Ricker) |
[in] | distort | wavelet distortion factor (Ricker) |
|
static |
Resample from depth to time
[in] | db_z | Depth Db |
[in] | iatt_z | Address of the first variable of the Depth Db |
[in] | nz | Number of meshes of the Depth Db |
[in] | z0 | First Depth |
[in] | dz | Mesh of the Depth Db |
[in] | db_t | Time Db |
[in] | iatt_t | Address of the first variable of the Time Db |
[in] | nt | Number of meshes of the Time Db |
[in] | t0 | First Time |
[in] | t1 | Last Time |
[in] | dt | Mesh of the Time Db |
[in] | db_v | Velocity Db |
[in] | iatt_v | Address of the velocity variable in Depth Db |
[in] | natt | Number of seismic attributes |
[out] | tz | Working array (dimension: nt) |
[out] | zt | Working array (dimension: nz) |
[out] | at | Working array (dimension: nt) |
[out] | az | Working array (dimension: nz) |
|
static |
Perform the Simulation
[in] | db | Grid Db structure |
[in] | ix0 | Rank of the target trace |
[in] | iz0 | Rank of the target sample within the target trace |
[in] | ngh | Current ST_Seismic_Neigh structure |
[in] | nbsimu | Number of simulations |
[in] | nred | Reduced number of equations |
[in] | flag | Array giving the flag |
[in] | wgt | Array containing the Kriging weights |
[in] | rhs | Array containing the R.H.S. member |
[in] | c00 | Array containing the C00 terms |
[in] | iatt_sim | Array of pointers to the simulated results |
|
static |
Calculate the extrema of the velocity array vv[]
[in] | nech | Number of samples in the array vv[] |
[in] | vv | Array of interest |
[out] | v0 | Initial velocity value |
[out] | v1 | Last velocity value |
[out] | vmin | Minimum value |
[out] | vmax | Maximum value |
|
static |
Interpolation of a uniformly-sampled real function y(x) via a table of 8-coefficient sinc approximations
[out] | table | array of weights |
|
static |
Print the kriging weights
[in] | ngh | ST_Seismic_Neigh structure |
[in] | nvar | Number of variables |
[in] | nech | Number of active points |
[in] | nred | Reduced number of equations |
[in] | flag | Flag array |
[in] | wgt | Array of Kriging weights |
|
static |
Compute regularly-sampled monotonically increasing function x(y) from regularly-sampled monotonically increasing function y(x) by inverse linear interpolation
[in] | nx | number of samples of y(x) |
[in] | dx | x sampling interval; dx>0.0 is required |
[in] | x0 | first x |
[in] | y | array[nx] of y(x) values; y[0] < ... < y[nx-1] required |
[in] | ny | number of samples of x(y) |
[in] | dy | y sampling interval; dy>0.0 is required |
[in] | y0 | first y |
[in] | xylo | x value assigned to x(y) when y is less than smallest y(x) |
[in] | xyhi | x value assigned to x(y) when y is greater than largest y(x) |
[out] | x | array[ny] of x(y) values |
|
static |
Solve a symmetric Toeplitz linear system of equations Rf=g for f
[in] | n | dimension of system |
[in] | r | array[n] of top row of Toeplitz matrix |
[in] | g | array[n] of right-hand-side column vector |
[out] | f | array[n] of solution (left-hand-side) column vector |
[out] | a | array[n] of solution to Ra=v (Claerbout, FGDP, p. 57) |
|
static |
Local function to read the Data Base
[in] | db | Db structure |
[in] | iatt_in | Address of the first input attribute |
[in] | iatt | Rank of the internal attribute |
[in] | itrace | Rank of the trace |
[in] | it | Rank of the sample on the trace |
|
static |
Local function to write into the Data Base
[in] | db | Db structure |
[in] | iatt_out | Address of the first input attribute |
[in] | iatt | Rank of the internal attribute |
[in] | itr | Rank of the trace |
[in] | it | Rank of the sample on the trace |
[in] | value | Value to be stored |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |