UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
zd_useismic.hpp
1 /* zd_useismic.hpp */
2 /* $Id: zd_useismic.hpp,v 1.13 2009/02/13 11:57:01 vlad Exp $ */
3 #ifndef __zd_useismic_hpp
4 #define __zd_useismic_hpp
5 
6 #include <vector>
7 #include <ldb/trset.h>
8 #include <ldb/trselect.h>
9 #include <zq/zqb_header.hpp>
10 #include <zq/zd_seismic_set.hpp>
11 
12 
15 #define ZDUS_EXTRA_HW_SIZE 8
16 
17 
33 class ZdUSeismic : public ZdSeismicSet
34 {
35 public:
36 
40  ZdUSeismic (TrSet* pTS, int nExtraHW = 0, const char* szDocName = NULL);
41 
46  ZdUSeismic (const char* szProject, const char* szSeisFile,
47  int nExtraHW = 0, const char* szDocName = NULL);
48 
50  virtual ~ZdUSeismic ();
51 
52 
53  /*
54  * Hacker's facilities
55  */
56 
58  TrSet* handle ();
59 
61  const TrSet* handle () const;
62 
64  const TrIndexTable* indexTable () const;
65 
67  int extraHeaderWords () const;
68 
69 
70  /*
71  * Basic information
72  */
73 
76  virtual bool getCoordRange (double c[2]);
77 
79  virtual double averageCoordStep ();
80 
82  virtual const ZqbAbstrTrace& tracePar () const;
83 
85  virtual int traceCount () const;
86 
88  virtual void getAllTraceIds (TraceIdsV& viTraceIds) const;
89 
90  /*
91  * Coordinate based services (see ZdCoordObjStream)
92  */
93 
95  virtual int coordCount () const;
96 
99  virtual int coordToTraceId (double fCoord,
100  int iEnsIndex = 0);
101 
104  virtual void coordToTraceIds (double fCoord,
105  TraceIdsV& viTraceIds);
106 
108  virtual void getCoords (CoordsV& vfCoords);
109 
112  virtual double traceIdToCoord (int iTraceId,
113  int* piEnsIndex = NULL);
114 
115 
116  /*
117  * Write-only access features
118  */
119 
123  virtual bool modify ();
124 
127  virtual bool isModifiable () const;
128 
133  virtual bool setHeader (int id, const ZqbHeader& hdr);
134 
138  virtual bool setTrace (int id, const ZqbRealTrace& rtr);
139 
144  virtual bool setSamples (int id, const float* pSamples);
145 
146 
147  /*
148  * Read-only access features
149  */
150 
153  virtual const ZqbHeader* headerById (int id);
154 
157  virtual const float* samplesById (int id);
158 
161  virtual const ZqbRealTrace* traceById (int id);
162 
163 
164  /*
165  * Iterator methods.
166  */
167 
169  virtual void setCustomCoord (int iCoordHW,
170  ZqbOrder eOrder = Z_O_ASCENT);
171 
173  virtual void setSecondaryOrder (int iSecondaryHW,
174  ZqbOrder eOrder = Z_O_ASCENT);
175 
177  virtual void setTertiaryOrder (int iTertiaryHW,
178  ZqbOrder eOrder = Z_O_ASCENT);
179 
181  virtual void setCustomHdrWord (int iCustomHW);
182 
183 
186  virtual bool goFirstCoord ();
187 
190  virtual bool goNextCoord ();
191 
194  virtual double coord ();
195 
200  virtual void* custom (int ens_index = 0,
201  ZqbType* pRetType = NULL);
202 
205  virtual int ensembleLength ();
206 
208  virtual int maxEnsembleLength ();
209 
212  virtual const ZqbRealTrace& trace (int ens_index = 0);
213 
216  virtual const ZqbHeader& header (int ens_index = 0);
217 
221  virtual int traceId (int ens_index = 0);
222 
223 
224  /*
225  * Special functionality for sort & split support
226  */
227 
231  void getValuesList (int hwId, std::vector<int>& vValues);
232 
236  void getValuesList (int hwId, std::vector<float>& vValues);
237 
238 
239  /*
240  * Additional service
241  */
242 
244  virtual void globalAmplInfo (double pfAmm[2]);
245 
248  virtual const char* coordMeaning () const;
249 
251  virtual const char* coordUnit () const;
252 
254  virtual const char* timeMeaning () const;
255 
257  virtual const char* timeUnit () const;
258 
259 
260  /*
261  * General services
262  */
263 
270  static void initialize (int nExtraHW = 0,
271  const ZqbHdrField* pExtraHW = NULL,
272  void (*InitExtraHW)(ZqbHeader&) = NULL);
273 
275  static ZqbType hwType (int hwId);
276 
279  static ZqbHdrField* hwInfo (int hwId);
280 
281 
282  /*
283  * Local services
284  */
285 
287  bool properOrder () const;
288 
292  void applyOrder ();
293 
294 protected:
295 
297  int curEnsSize (int iCurTrace);
298 
300  void constructor ();
301 
303  void setSortOrder (ZqbHeader& hdr);
304 
307 
311 
314  struct TraceItem {
315  TraceItem ()
316  : m_bLoaded(false), m_iTraceId(-1), m_pTrace(NULL) {}
317 
318  TraceItem (int id, const ZqbAbstrTrace& atr,
319  const ZqbHeader& hdr)
320  : m_bLoaded(false), m_iTraceId(id), m_pTrace(NULL)
321  {
322  m_pTrace = new ZqbRealTrace(atr, hdr);
323  }
324 
325  TraceItem (const TraceItem& trit)
326  : m_bLoaded(trit.m_bLoaded), m_iTraceId(trit.m_iTraceId), m_pTrace(NULL)
327  {
328  if(NULL != trit.m_pTrace)
329  m_pTrace = new ZqbRealTrace(*trit.m_pTrace);
330  }
331 
332  ~TraceItem ()
333  {
334  delete m_pTrace;
335  }
336 
337  bool operator< (const TraceItem& trit) const
338  {
339  if(NULL != m_pTrace && NULL != trit.m_pTrace)
340  return *m_pTrace < *trit.m_pTrace;
341  return m_iTraceId < trit.m_iTraceId;
342  }
343 
344  TraceItem& operator= (const TraceItem& trit)
345  {
346  m_bLoaded = trit.m_bLoaded;
347  m_iTraceId = trit.m_iTraceId;
348  if(NULL != trit.m_pTrace)
349  {
350  if(NULL != m_pTrace)
351  m_pTrace = new ZqbRealTrace(*trit.m_pTrace);
352  else
353  *m_pTrace = *trit.m_pTrace;
354  }
355  return *this;
356  }
357 
358  void loadTrace (const float* trace)
359  {
360  if(NULL != m_pTrace)
361  {
362  *m_pTrace = trace;
363  m_bLoaded = true;
364  }
365  }
366 
367  bool m_bLoaded;
368  int m_iTraceId;
369  ZqbRealTrace *m_pTrace;
370  };
371 
374  std::vector<TraceItem> m_vTraces;
375 
377  std::vector<std::pair<int,ZqbOrder> > m_vOrder;
378 
381 
384 
388 
391 
394 
397  static void (*s_initExtraHW)(ZqbHeader&);
398 
400  std::vector<double> m_vfCoords;
401 
403  std::vector<int> m_viStartEns;
404 
406  std::vector<int> m_viEnsLengths;
407 
410  std::map<int,int> m_mId2I;
411 
414 
415 private:
416 
418  int m_iCustomHW;
419 
421  union {
422  int m_iValue;
423  float m_fValue;
424  char m_cValue;
425  } m_rCustom;
426 
428  void loadProjectAttr (const char* szProject);
429 
432  TrSet *m_pOwnTS;
433 
435  static int s_iNameCounter;
436 
438  static char *s_szOwnType;
439 
440 };
441 
442 
443 #endif /* zd_useismic.hpp */
Definition: zqb_hdr_field.h:16
std::vector< int > m_viStartEns
Definition: zd_useismic.hpp:403
virtual int maxEnsembleLength()
virtual const ZqbRealTrace & trace(int ens_index=0)
virtual void getAllTraceIds(TraceIdsV &viTraceIds) const
virtual bool goNextCoord()
std::vector< double > CoordsV
Definition: zd_seismic_set.hpp:25
virtual bool setSamples(int id, const float *pSamples)
static ZqbType hwType(int hwId)
int extraHeaderWords() const
virtual bool goFirstCoord()
UnitId m_eLengthUnitId
Definition: zd_useismic.hpp:413
virtual void setCustomCoord(int iCoordHW, ZqbOrder eOrder=Z_O_ASCENT)
virtual bool modify()
virtual int ensembleLength()
std::map< int, int > m_mId2I
Definition: zd_useismic.hpp:410
virtual const float * samplesById(int id)
Definition: zqb_header.hpp:27
virtual const ZqbRealTrace * traceById(int id)
virtual const char * timeUnit() const
std::vector< TraceItem > m_vTraces
Definition: zd_useismic.hpp:374
virtual const char * coordUnit() const
ZdUSeismic(TrSet *pTS, int nExtraHW=0, const char *szDocName=NULL)
virtual double coord()
virtual void globalAmplInfo(double pfAmm[2])
int m_iCurTrace
Definition: zd_useismic.hpp:387
virtual ~ZdUSeismic()
virtual const char * timeMeaning() const
void getValuesList(int hwId, std::vector< int > &vValues)
virtual const char * coordMeaning() const
virtual const ZqbHeader * headerById(int id)
TrSet * handle()
static void initialize(int nExtraHW=0, const ZqbHdrField *pExtraHW=NULL, void(*InitExtraHW)(ZqbHeader &)=NULL)
void setSortOrder(ZqbHeader &hdr)
void constructor()
int m_nMaxEnsSize
Definition: zd_useismic.hpp:393
ZqbAbstrTrace m_aTrace
Definition: zd_useismic.hpp:380
Definition: zqb_abstr_trace.hpp:13
TrIndexTable m_it
Definition: zd_useismic.hpp:310
std::vector< int > TraceIdsV
Definition: zd_seismic_set.hpp:22
virtual void setSecondaryOrder(int iSecondaryHW, ZqbOrder eOrder=Z_O_ASCENT)
virtual bool setTrace(int id, const ZqbRealTrace &rtr)
Definition: zqb_real_trace.hpp:19
TrSet * m_pTS
Definition: zd_useismic.hpp:306
virtual void getCoords(CoordsV &vfCoords)
std::vector< int > m_viEnsLengths
Definition: zd_useismic.hpp:406
Definition: trset.h:56
int curEnsSize(int iCurTrace)
virtual int traceId(int ens_index=0)
virtual void setCustomHdrWord(int iCustomHW)
static void(* s_initExtraHW)(ZqbHeader &)
Definition: zd_useismic.hpp:397
virtual bool setHeader(int id, const ZqbHeader &hdr)
int m_nExtraHW
Definition: zd_useismic.hpp:390
Definition: zd_useismic.hpp:314
virtual const ZqbAbstrTrace & tracePar() const
virtual bool isModifiable() const
virtual const ZqbHeader & header(int ens_index=0)
ZqbRealTrace m_EmptyTrace
Definition: zd_useismic.hpp:383
static ZqbHdrField * hwInfo(int hwId)
const TrIndexTable * indexTable() const
virtual int coordCount() const
Definition: zd_seismic_set.hpp:17
Definition: zd_useismic.hpp:33
void applyOrder()
virtual void * custom(int ens_index=0, ZqbType *pRetType=NULL)
virtual int coordToTraceId(double fCoord, int iEnsIndex=0)
Definition: trset.h:96
virtual double traceIdToCoord(int iTraceId, int *piEnsIndex=NULL)
virtual double averageCoordStep()
bool properOrder() const
std::vector< double > m_vfCoords
Definition: zd_useismic.hpp:400
virtual void setTertiaryOrder(int iTertiaryHW, ZqbOrder eOrder=Z_O_ASCENT)
virtual int traceCount() const
virtual bool getCoordRange(double c[2])
std::vector< std::pair< int, ZqbOrder > > m_vOrder
Definition: zd_useismic.hpp:377
virtual void coordToTraceIds(double fCoord, TraceIdsV &viTraceIds)