OpendTect  6.3
rockphysics.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: Bert Bril
8  Date: Feb 2012
9 ________________________________________________________________________
10 
11 
12 -*/
13 
14 #include "generalmod.h"
15 #include "propertyref.h"
16 #include "repos.h"
17 class MathProperty;
18 class ascistream;
19 class ascostream;
20 
21 
32 namespace RockPhysics
33 {
34 
35 mExpClass(General) Formula : public NamedObject
36 {
37 public:
38 
40 
41  Formula( PropType t, const char* nm=0 )
42  : NamedObject(nm)
43  , type_(t) {}
44 
45  static Formula* get(const IOPar&);
46  ~Formula();
47  Formula( const Formula& f ) { *this = f; }
48  Formula& operator =(const Formula&);
49  inline bool operator ==( const Formula& pr ) const
50  { return name() == pr.name(); }
51  inline bool operator !=( const Formula& pr ) const
52  { return name() != pr.name(); }
53 
54  inline bool hasPropType( PropType t ) const
55  { return type_ == t; }
56 
57  mExpClass(General) ConstDef : public NamedObject
58  {
59  public:
60  ConstDef( const char* nm )
61  : NamedObject(nm)
62  , typicalrg_(mUdf(float),mUdf(float))
63  , defaultval_(mUdf(float)) {}
66  float defaultval_;
67  };
68  mExpClass(General) VarDef : public NamedObject
69  {
70  public:
71  VarDef( const char* nm, PropType t )
72  : NamedObject(nm)
73  , type_(t) {}
75  PropType type_;
77  };
78 
79  PropType type_;
86 
87  bool usePar(const IOPar&);
88  void fillPar(IOPar&) const;
89 
90  bool setDef(const char*); // Will add var- and constdefs
91  MathProperty* getProperty(const PropertyRef* pr=0) const;
92 
93 };
94 
95 
96 mExpClass(General) FormulaSet : public ObjectSet<const Formula>
97 {
98 public:
100  { deepErase( *(ObjectSet<Formula>*)this ); }
101  int getIndexOf(const char*) const;
102  void getRelevant(PropertyRef::StdType,
103  BufferStringSet&) const;
104 
105  const Formula* getByName( const char* nm ) const
106  {
107  const int idxof = getIndexOf( nm );
108  return idxof<0 ? 0 : (*this)[idxof];
109  }
110 
111  bool save(Repos::Source) const;
112 
113  void readFrom(ascistream&);
114  bool writeTo(ascostream&) const;
115 
116 };
117 
118 
119 
120 } // namespace RockPhysics
121 
123 mGlobal(General) inline RockPhysics::FormulaSet& eROCKPHYSFORMS()
124 { return const_cast<RockPhysics::FormulaSet&>( ROCKPHYSFORMS() ); }
#define mExpClass(module)
Definition: commondefs.h:157
Ref Data for a (usually petrophysical) property.
Definition: rockphysics.h:32
Calculated property.
Definition: mathproperty.h:30
const Formula * getByName(const char *nm) const
Definition: rockphysics.h:105
Definition: rockphysics.h:96
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:51
ObjectSet< ConstDef > constdefs_
Definition: rockphysics.h:83
Definition: rockphysics.h:68
~FormulaSet()
Definition: rockphysics.h:99
#define mGlobal(module)
Definition: commondefs.h:160
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:200
OpendTect standard ascii format file writing.
Definition: ascstream.h:30
Ref Data for a (usually petrophysical) property.
Definition: propertyref.h:40
RockPhysics::FormulaSet & eROCKPHYSFORMS()
Definition: rockphysics.h:123
Interval< float > typicalrg_
Definition: rockphysics.h:65
Set of BufferString objects.
Definition: bufstringset.h:25
float defaultval_
Definition: rockphysics.h:66
BufferString unit_
Definition: rockphysics.h:82
ConstDef(const char *nm)
Definition: rockphysics.h:60
Set of pointers to objects.
Definition: commontypes.h:28
Definition: rockphysics.h:35
BufferString unit_
Definition: rockphysics.h:76
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:53
BufferString def_
Definition: rockphysics.h:80
VarDef(const char *nm, PropType t)
Definition: rockphysics.h:71
Formula(const Formula &f)
Definition: rockphysics.h:47
ObjectSet< VarDef > vardefs_
Definition: rockphysics.h:84
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:270
Source
Definition: repos.h:23
const RockPhysics::FormulaSet & ROCKPHYSFORMS()
PropType type_
Definition: rockphysics.h:75
Repos::Source src_
Definition: rockphysics.h:85
Formula(PropType t, const char *nm=0)
Definition: rockphysics.h:41
bool operator!=(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:60
bool hasPropType(PropType t) const
Definition: rockphysics.h:54
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:187
OpendTect standard ascii format file reading.
Definition: ascstream.h:81
BufferString desc_
Definition: rockphysics.h:74
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:38
object with a name.
Definition: namedobj.h:20
BufferString desc_
Definition: rockphysics.h:81
Definition: rockphysics.h:57
StdType
Definition: propertyref.h:44
PropertyRef::StdType PropType
Definition: rockphysics.h:39
BufferString desc_
Definition: rockphysics.h:64
virtual const OD::String & name() const
Definition: namedobj.h:33
PropType type_
Definition: rockphysics.h:79
void deepErase(ObjectSet< T > &os)
empty the ObjectSet deleting all objects pointed to.
Definition: objectset.h:122

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