traceio.h

Go to the documentation of this file.
00001 #ifndef __SEAM_TRACEIO
00002 #define __SEAM_TRACEIO
00003 
00004 /* uncomment to force use of file manager */
00005 #define IWAVE_USE_FMGR
00006 
00007 #include "utils.h"
00008 #include "usempi.h"
00009 #include "cubic.h"
00010 /* added 05.03.10 */
00011 #ifdef IWAVE_USE_FMGR
00012 #include "iwave_fopen.h"
00013 #endif
00014 
00015 #ifdef __cplusplus
00016 extern "C" {
00017 #endif
00018 #include "su.h"
00019 #include "header.h"
00020 #include "segy.h"
00021 #ifdef __cplusplus
00022 }
00023 #endif
00024 
00025 /* max number of traces permitted in record */
00026 #define MAX_TRACES 500000  
00027 /* max number of records permitted in data */
00028 #define MAX_RECS 1000
00029 /* tolerance for shot position (fraction of space step) */
00030 #define SRC_TOL 0.001
00031 /* end-of-file flag - should be disinct from other error returns */
00032 #define W_EOF -10
00033 
00034 void mygethdval(segy * tr, const char * ch, Value * val);
00035 void myputhdval(segy * tr, const char * ch, Value * val);
00036 
00037 typedef struct s_offsegy {
00038   off_t m;
00039   segy tr;
00040 } offsegy;
00041 
00060 typedef struct s_tracegeom {
00061 
00063   int nrec;
00065   int irec;
00067   int xrec;
00069   int first;
00071   int last;
00073   /*  int ntr[MAX_RECS]; */
00074   int * ntr;
00076   /*  off_t recoff[MAX_RECS]; */
00077   off_t * recoff;
00079   /*  RPNT src[MAX_RECS]; */
00080   RPNT * src;
00082   int ntraces;     
00084   /*  IPNT ig[MAX_TRACES]; */
00085   IPNT * ig;
00087   /*  RPNT rg[MAX_TRACES]; */
00088   RPNT * rg;
00090   IPNT is;
00092   RPNT rs;
00094   IPNT axord;
00096   int nt;
00098   int ntout;
00100   float dt;
00102   float dtout;
00104   int dtmus;
00106   float tmax;
00108   float t0;
00110   float t0out;
00112   /*  int tracl[MAX_TRACES]; */
00113   int * tracl;
00115   /*  int tracr[MAX_TRACES]; */
00116   int * tracr;
00118   /*  int fldr[MAX_TRACES]; */
00119   int * fldr;
00121   /*  int tracf[MAX_TRACES]; */
00122   int * tracf;
00124   int scalel;
00126   int scalco;
00128   float * buf;
00130   int interp;
00132   int ndim;
00134   ireal dvol;
00136   FILE * fpin;
00138   /*  off_t troff[MAX_TRACES]; */
00139   off_t * troff;
00140 #ifdef IWAVE_USE_MPI
00141 
00142   MPI_Datatype p;
00143 #endif
00144 } tracegeom;
00145 
00168 int construct_tracegeom(tracegeom * tg,
00169             const char * fin,
00170             float dt,
00171             float tol,
00172             FILE * stream);
00173 
00280 // added irec - external control of record 11.01.14
00281 int init_tracegeom(tracegeom * tg, 
00282            int irec,
00283            RPNT og,
00284            IPNT n, RPNT d, RPNT o, 
00285            IPNT axord,
00286            int order,
00287            int ndim,
00288            int initbuf,
00289            FILE * stream);
00290 
00293 void destroy_tracegeom(tracegeom * tg);
00294 
00300 void setnull_tracegeom(tracegeom * tg);
00301 
00303 void fprint_tracegeom(tracegeom const * tg, FILE * fp);
00304 
00306 void print_tracegeom(tracegeom const * tg);
00307 
00348 /*
00349   outdated material:
00350 
00351     Version 1.1 addendum: this function now both samples the field to the
00352     output trace buffer (save mode), and adjoint-samples the trace buffer
00353     onto the field (load) mode. The load flag determines which option is
00354     taken. In load mode, an additional option is provided to scale the 
00355     updated field values by another multiplier field and multiplication by
00356     the time step. This option is switched by the multiplier field pointer; 
00357     a null value indicates no scaling. Global grid geometry data supplied,
00358     since this array may not have same size and shape as sampled field, so
00359     offsets must be computed independently.
00360 
00361     @param[in] allocstrides_mult (\ref IPNT) number of samples on each
00362     local ALLOCATED grid axis for multiplier array;
00363     @param[in] allocorigs_mult (\ref IPNT) index tuple of local ALLOCATED grid
00364     origin relative to global grid for multiplier array;
00365     @param[in] strides_mult (\ref IPNT) number of samples on each
00366     local COMPUTATIONAL grid axis (updated points) for multiplier array;
00367     @param[in] origs_mult (\ref IPNT) index tuple of local COMPUTATIONAL grid 
00368     origin relative to global grid for multiplier array;
00369     @param[in] mult (float *) buffer for multiplier field. ignored on save, 
00370     optionally used to scale input data on load. default value is null, which
00371     indicates no scaling.
00372 */
00373 void sampletraces(tracegeom * tg, 
00374           int order,
00375           int load,
00376           int it,
00377           IPNT allocstrides,
00378           IPNT allocorigs,
00379           IPNT strides,
00380           IPNT origs,
00381           ireal * field,
00382           /*          IPNT allocstrides_mult,
00383           //          IPNT allocorigs_mult,
00384           //          IPNT strides_mult,
00385           //          IPNT origs_mult,
00386           //          int * mult); */
00387           ireal mult);
00388 
00389 void tapermutetraces(tracegeom * tg,
00390                      int it,
00391                      float dx,
00392                      int width,     // width of taper
00393                      int wtime,     // width of time taper, in ms
00394                      float mslope,  // slope of mute (dt/dx) (ms/m) 
00395                      float mzotime, // mute onset at zero offset, time AFTER first sample (ms)
00396                      float mwidth); // width of mute zone (ms)
00397 
00412 int writetraces(tracegeom const * tg, 
00413         RPNT d,
00414         RPNT og,
00415         FILE * stream);
00416 
00417 /* 13.03.11: compute first and last record indices for current group
00418 */
00419 void calc_group(int * first, int * last, int nrec);
00420 
00428 void indexrange(tracegeom const * tg,
00429         IPNT gmin,
00430         IPNT gmax);
00431 
00432 #endif

Generated on 5 Jan 2017 for IWAVETRACE by  doxygen 1.4.7