/* ======== IGeoS ===== Distribition full ===== IGeoS ========= ** ** templrd_pp.C : Created by 'seisweb' on Wed Apr 1 17:31:52 2020 ** ** Product : IGeoS - Integrated Geoscience Software ** ** Description : System for seismic, well log, and potential-field data analysis ** ** =================== Limited License: =================================== ** ** This software is provided free under the following terms and conditions: ** ** 1. Permission to use, copy, and modify this software ** for non-commercial purposes without fee is hereby granted, provided ** that this copyright notice, the warranty disclaimer, and this ** permission notice appear in all copies. ** ** 2. Distribution of this software or any part of it "bundled" in with ** any product is considered to be a 'commercial purpose'. ** ** 3. Any new or adapted code developed to operate as a part of this ** software shall be contributed to the authors and distributed under ** the same license. ** ** ================== Warranty Disclaimer: ================================ ** ** This software is provided "as is", with no support and without ** obligation on the part of the author to assist in its use, correction, ** modification, or enhancement. No guarantees or warranties, ** either express or implied, and regarding the accuracy, safety, or ** fitness for any particular purpose are provided by any contributor ** to this software package. ** ** ======== IGeoS ===== Distribition full ===== IGeoS ========= */ /* ========= S - I - A === S - I - A === S - I - A === S - I - A ========== ** ** templrd_pp.C: Created by 'seisweb' on Fri Oct 20 19:19:52 2006 ** This file is a part of SIA distribution 'full' ** ** Copyright (c) 1995-2006, Igor Morozov, all rights reserved ** ** =================== Limited License: =================================== ** This software is provided free under the following terms and conditions: ** ** 1. Permission to use, copy, and modify this software ** for non-commercial purposes without fee is hereby granted, provided ** that this copyright notice, the warranty disclaimer, and this ** permission notice appear in all copies. ** ** 2. Distribution of this software or any part of it "bundled" in with ** any product is considered to be a 'commercial purpose'. ** ** 3. Any new or adapted code developed to operate as a part of this ** software shall be contributed to the authors and distributed under ** the same license. ** ** ================== Warranty Disclaimer: ================================ ** This software is provided "as is", with no support and without ** obligation on the part of the author to assist in its use, correction, ** modification, or enhancement. No guarantees or warranties, ** either express or implied, and regarding the accuracy, safety, or ** fitness for any particular purpose are provided by any contributor ** to this software package. ** ** ========= S - I - A ========== S - I - A ========== S - I - A ========== */ //#define DEBUG // uncomment this to enable debugging printouts, if any #include "sia_module.C.h" #include "templrd.h" boolean TEMPLRD::proc( int count ) { // if 'count' is out of range, return FAIL (meainng no output done) // change this condition to something more meaningful! if ( count < 0 ) return FAIL; // need to determine the number of records per trace // and the number of samples per record int nr=1, // these are just arbitrary values for an example ns=111; // create a new trace ensemble ENSEMBLE *e = SIA.output()->add_ensemble(); if ( e ) { // for each value of 'key', create a trace (2-D in this case) for ( int k=0; k < key.length; k++ ) { TRACE *t = e->add_trace(ns,nr); if ( t ) { // read the trace data for ( int i=0; i < t->num_records(); i++ ) { DATA_SAMPLE *d = t->data_start(i); // beginning of record number #i // put the values in array d[] ... } } } e->close(); // close the ensemble (set LASTTRC header = 1 ) return OK; // OK means the trace is ready to be picked up from the output } return FAIL; // FAIL (FALSE) means "wait for more input data" or // "quit" if no more data is going to be loaded } /*========================================================================== Process phase - called every time the system tries to produce an output (e.g., when there is a trace in the input gather) ==========================================================================*/ boolean TEMPLRD::process() { /*--------------------------------------------------------------- If there is a trace at the input, pass it to the output, otherwise read a new trace and output it. Return OK if a trace was added to tyhe output gather. _count s incremented if a trace is loaded ---------------------------------------------------------------*/ return SIA.input()->pass_trace(SIA.output()) ? OK : proc(_count++); } boolean TEMPLRD::operation( int type, int instr, const char *param ) { if ( param ) // param string should contain the number of requested trace { switch ( instr ) { case MODULE_OP_RESET : _count=atoi(param); break; case MODULE_OP_START : case MODULE_OP_EXEC : return proc(atoi(param)); // load the requested trace } return OK; } return FAIL; }