/*************************************************************************** SIA - system for advanced seismic data analysis Copyright (c) 1995-2003, I. B. Morozov ****************************************************************************/ //#define DEBUG #include "sia_module.C.h" #include "templ1e.h" double TEMPL1E::time_shift(TRACE *t, TRACE *t2 ) { double par1 = param1.value(t); // this obtains parameter value from t /*--- examples of obtaining the typical trace parameters -------*/ int ns = t->num_samples(); // number of trace data samples double si = t->sample_interval(), // sampling interval ts = t->time_start(); DATA_SAMPLE *d = t->data_start(); // pointer to the trace data array } boolean TEMPL1E::proc(ENSEMBLE *e ) { /*-- go through all trace pairs and measure cross-correlations */ for ( TRACE *t1 = e->first_trace; t1; t1 = t1->next ) for ( TRACE *t2 = t1->next; t2; t2 = t2->next ) { double dt = time_shift(t2,t1); // ...... and so on } /*--- process phase functions return Boolean values ----------*/ return OK; // OK means the trace has been processed and passed to the output // FAIL (FALSE) woul mean "wait for more input data" } /*========================================================================== Process phase - called every time the system tries to produce an output (e.g., when there is a trace in the input gather) ==========================================================================*/ boolean TEMPL1E::process() { GATHER *input = SIA.input(); // input trace ensemble gather if ( !input->num_ensembles ) // no input, wait for more return FAIL; /*----- wait for a closed ensemble -------------------------------*/ if ( final_eof() ) // no more inputs expected input->first_ensemble->close(FALSE); else if ( !input->first_ensemble->closed() ) // not end-of-ensemble flag yet return FAIL; /*-- at this point, we have a complete ensemble at input; pass it to the output and process ----------------------*/ ENSEMBLE *e = input->pass_ensemble(SIA.output()); return e ? proc(e) : FAIL; }