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

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