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

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