OpendTect  6.3
embodyoperator.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: Yuancheng Liu
8  Date: Feb 2009
9 ________________________________________________________________________
10 
11 
12 -*/
13 
14 #include "earthmodelmod.h"
15 #include "arrayndinfo.h"
16 #include "enums.h"
17 #include "iopar.h"
18 #include "dbkey.h"
19 #include "paralleltask.h"
20 #include "trigonometry.h"
21 
22 class TaskRunner;
23 class Plane3;
24 class DAGTetrahedraTree;
25 
26 template<class T> class Array3D;
27 
28 namespace EM
29 {
30 
31 class Body;
32 class ImplicitBody;
33 
40 {
41 public:
42  BodyOperator();
43  ~BodyOperator();
44  enum Action { Union, IntSect, Minus };
46 
47  bool isOK() const;
48 
49  bool createImplicitBody(ImplicitBody*&,TaskRunner*) const;
50  /*<Make a body using b0 u/n/- b1. If use "Minus"
51  b0-b1,it means the body part in b0 but not in b1.
52  Set two inputs and one Action before use it. */
53 
54  ImplicitBody* createImplicitBody(const TypeSet<Coord3>& bodypts,
55  TaskRunner* tskr=0) const;
56  /*<This is an independent function which creates an
57  implicite body with position value -1,0,1 depends on
58  the position is inside, on or outside the
59  triangulated body for a set of random points. Users
60  don't have to set any action or body. */
61 
62  void setInput(bool body0,const DBKey&);
63  void setInput(bool body0,BodyOperator*);
65  BodyOperator* getChildOprt(bool body0) const;
66  bool getChildOprt(int freeid,BodyOperator&);
67 
68  void setAction(Action);
69  Action getAction() const { return action_; }
70  int getID() const { return id_; }
71  /*<If id_ is 0, it is on the top of a tree struct. */
72  static int getFreeID();
73 
74  bool usePar(const IOPar&);
75  void fillPar(IOPar&);
76 
77  static const char* sKeyID() { return "ID"; }
78  static const char* sKeyAction() { return "Action"; }
79  static const char* sKeyBodyID0() { return "BodyID0"; }
80  static const char* sKeyBodyID1() { return "BodyID1"; }
81 
82 protected:
83 
84  ImplicitBody* getOperandBody(bool body0,TaskRunner* tskr) const;
85 
87  BodyOperator* inputbodyop0_;
88 
90  BodyOperator* inputbodyop1_;
91 
92  int id_;
94 };
95 
96 
97 /*
98 \brief Converts an explicit body to implicit.
99 
100  Given a triangulated body, extract position value on each trace based on
101  threshold value. The arr's size is based on inlrg, crlrg, zrg. The value at
102  each point is the min distance to the body, inside to be negative, and
103  outside to be positive.
104 */
105 
107 {
108 public:
110  const StepInterval<int>& inlrg,
111  const StepInterval<int>& crlrg,
112  const StepInterval<float>& zrg,
113  Array3D<float>& arr);
114 
115  od_int64 nrIterations() const;
116 
117 private:
118 
119  bool doPrepare(int nrthreads);
120  bool doWork(od_int64,od_int64,int);
121 
129 };
130 
131 } // namespace EM
#define mExpClass(module)
Definition: commondefs.h:157
DBKey inputbody0_
Definition: embodyoperator.h:86
static const char * sKeyBodyID1()
Definition: embodyoperator.h:80
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:200
#define od_int64
Definition: plftypes.h:34
Definition: embodyoperator.h:44
A Plane3 is a plane in space, with the equation: Ax + By + Cz + D = 0.
Definition: trigonometry.h:449
int getID() const
Definition: embodyoperator.h:70
Delaunay triangulation for 3D points. Should make sure all the points are defined.
Definition: delaunay3d.h:23
#define mDeclareEnumUtils(enm)
Some utilities surrounding the often needed enum <-> string table.
Definition: enums.h:188
Operators for implicit body. Each BodyOperator has two children, either a Body or a BodyOperator...
Definition: embodyoperator.h:39
Generalization of a task that can be run in parallel.
Definition: paralleltask.h:64
static const char * sKeyID()
Definition: embodyoperator.h:77
DBKey inputbody1_
Definition: embodyoperator.h:89
const StepInterval< int > & crlrg_
Definition: embodyoperator.h:125
Set of (small) copyable elements.
Definition: commontypes.h:26
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:53
Class that can execute a task.
Definition: task.h:193
static const char * sKeyBodyID0()
Definition: embodyoperator.h:79
BodyOperator * inputbodyop0_
Definition: embodyoperator.h:87
const DAGTetrahedraTree & tree_
Definition: embodyoperator.h:122
Action action_
Definition: embodyoperator.h:93
TypeSet< Plane3 > planes_
Definition: embodyoperator.h:128
int id_
Definition: embodyoperator.h:92
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:187
Action
Definition: embodyoperator.h:44
FixedString Body()
Definition: keystrs.h:41
Array3D< float > & arr_
Definition: embodyoperator.h:126
StepInterval< float > zrg_
Definition: embodyoperator.h:123
Earth Model objects like horizons, faults, fault-sticks and bodies.
Definition: embody.h:23
Implicit representation of a body.
Definition: embody.h:30
Action getAction() const
Definition: embodyoperator.h:69
Full key to any object in the OpendTect data store.
Definition: dbkey.h:36
const StepInterval< int > & inlrg_
Definition: embodyoperator.h:124
static const char * sKeyAction()
Definition: embodyoperator.h:78
TypeSet< int > tri_
Definition: embodyoperator.h:127
Definition: embodyoperator.h:106
Array3D ( Subclass of ArrayND ) is a three dimensional array.
Definition: arraynd.h:149
BodyOperator * inputbodyop1_
Definition: embodyoperator.h:90

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