OpendTect-6_4  6.4
parametricsurfaceimpl.h
Go to the documentation of this file.
1 #ifndef parametricsurfaceimpl_h
2 #define parametricsurfaceimpl_h
3 
4 /*+
5 ________________________________________________________________________
6 (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7 Author: A.H. Bril
8 Date: 23-10-1996
9 Contents: Ranges
10 RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #define mInsertStart( idxvar, type, nrfunc ) \
16 int idxvar = type##Index(type); \
17 if ( idxvar<-nrtoinsert || idxvar>nrfunc-1+nrtoinsert ) \
18 { \
19  errmsg() = toUiString( \
20  "Cannot insert row or column that is not connected to existing rows."); \
21  return false; \
22 } \
23 const bool addedinfront = idxvar<0; \
24 if ( addedinfront ) \
25 { \
26  idxvar = 0; \
27  origin_.type() -= step_.type()*nrtoinsert; \
28 }\
29 \
30 const int curnrrows = nrRows(); \
31 const int curnrcols = nrCols()
32 
33 
34 #define mReplaceVariable( variable ) \
35 if ( new##variable ) \
36 { \
37  delete variable; \
38  variable = new##variable; \
39 }
40 
41 
42 #define mCloneRowVariable( type, variable, interpolfunc, udf ) \
43 Array2D<type>* new##variable = variable \
44  ? new Array2DImpl<type>(curnrrows+nrtoinsert,curnrcols) : 0; \
45 for ( int idx=0; new##variable && idx<curnrrows+nrtoinsert; idx++ ) \
46 { \
47  for ( int idy=0; idy<curnrcols; idy++ ) \
48  { \
49  if ( idx>=rowidx && idx<rowidx+nrtoinsert ) \
50  { \
51  if ( idx>=curnrrows || idx<nrtoinsert ) \
52  new##variable->set(idx,idy, udf ); \
53  else \
54  { \
55  const float relrow = origin_.row() + \
56  ((float) idx-rowidx)/(nrtoinsert+1)*step_.row(); \
57  const Coord param( relrow, origin_.col()+idy*step_.col() ); \
58  new##variable->set(idx,idy,(type) interpolfunc); \
59  } \
60  } \
61  else \
62  { \
63  const int sourcerow = idx>rowidx ? idx-nrtoinsert : idx; \
64  new##variable->set(idx,idy,variable->get(sourcerow,idy)); \
65  } \
66  } \
67 } \
68 mReplaceVariable( variable )
69 
70 
71 
72 
73 #define mCloneColVariable( type, variable, interpolfunc, udf ) \
74  Array2D<type>* new##variable = variable \
75  ? new Array2DImpl<type>(curnrrows,curnrcols+nrtoinsert) : 0; \
76 for ( int idx=0; new##variable && idx<curnrrows; idx++ ) \
77 { \
78  for ( int idy=0; idy<curnrcols+nrtoinsert; idy++ ) \
79  { \
80  if ( idy>=colidx && idy<colidx+nrtoinsert ) \
81  { \
82  if ( idy>=curnrcols || idy<nrtoinsert ) \
83  new##variable->set(idx,idy, udf ); \
84  else \
85  { \
86  const float relcol = origin_.col() + \
87  ((float) idy-colidx)/(nrtoinsert+1)*step_.col(); \
88  const Coord param( origin_.row()+idx*step_.row(), relcol ); \
89  new##variable->set(idx,idy,(type) interpolfunc); \
90  } \
91  } \
92  else \
93  { \
94  const int sourcecol = idy>colidx ? idy-nrtoinsert : idy; \
95  new##variable->set(idx,idy,variable->get(idx,sourcecol)); \
96  } \
97  } \
98 } \
99 mReplaceVariable( variable )
100 
101 
102 #endif

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019