OpendTect
6.6
|
Math formula: (expression, inputs, units, calculation, storage). More...
Classes | |
class | InpDef |
Public Member Functions | |
Formula (bool inputsareseries, const SpecVarSet &, const char *txt=0) | |
Formula (bool inputsareseries=true, const char *txt=0) | |
Formula (const Formula &) | |
~Formula () | |
void | clearInputDefs () |
const char * | errMsg () const |
const Expression * | expression () const |
void | fillPar (IOPar &) const |
double | getConstVal (int) const |
if isConst returns toDouble(inputDef(i)), else Udf More... | |
const TypeSet< int > & | getShifts (int iinp) const |
double | getValue (const double *, bool internal_units=true) const |
float | getValue (const float *, bool internal_units=true) const |
const char * | inputDef (int iinp) const |
bool | inputsAreSeries () const |
const UnitOfMeasure * | inputUnit (int iinp) const |
bool | isBad () const |
bool | isConst (int iinp) const |
bool | isOK () const |
bool | isRecursive () const |
bool | isSpec (int iinp) const |
int | maxRecShift () const |
int | nrConsts () const |
int | nrExternalInputs () const |
int | nrInputs () const |
int | nrValues2Provide () const |
Formula & | operator= (const Formula &) |
const UnitOfMeasure * | outputUnit () const |
TypeSet< double > & | recStartVals () |
void | setInputDef (int, const char *) |
void | setInputUnit (int, const UnitOfMeasure *) |
void | setOutputUnit (const UnitOfMeasure *uom) |
void | setText (const char *) |
Interval< int > | shiftRange (int iinp) const |
int | specIdx (int) const |
const SpecVarSet & | specVars () const |
void | startNewSeries () const |
const char * | text () const |
void | usePar (const IOPar &) |
const char * | userDispText () const |
const char * | variableName (int iinp) const |
Static Public Member Functions | |
static const char * | sKeyExpression () |
static const char * | sKeyFileType () |
static const char * | sKeyRecStartVals () |
Protected Member Functions | |
void | addShift (int, int, int &, TypeSet< TypeSet< int > > &) |
int | varNameIdx (const char *varnm) const |
Protected Attributes | |
BufferString | errmsg_ |
Expression * | expr_ |
Threads::Lock | formlock_ |
TypeSet< int > | inpidxs_ |
TypeSet< InpDef > | inps_ |
const bool | inputsareseries_ |
const UnitOfMeasure * | outputunit_ |
TypeSet< double > | prevvals_ |
TypeSet< int > | recshifts_ |
TypeSet< double > | recstartvals_ |
const SpecVarSet * | specvars_ |
BufferString | text_ |
TypeSet< int > | validxs_ |
Math formula: (expression, inputs, units, calculation, storage).
Before construction gather your 'special variables'. Users can insert them and they are not 'regular input'. See SpecVars and SpecVarSet.
At construction or when calling setText(), the input text is parsed. Then, the variable definitions are known. You can use setInputUnit(idx) before calculation, this unit is the unit that the user wants the variable value to be converted to before inserting it into the mathexpression.
When you know what is required, you can provide numbers for the different inputs and get a result using getValue(). The input values you provide must be in internal units.
If your formula is to work on a series of input vectors, then two things become possible: 1) Recursive values. This is when the user uses out[i] ot this[i]. 2) Input shifts. For example: ampl[-1] or den[3]. For (1), you can specify start values. The maximum shift is the size of the TypeSet. These recursive variables will not show up in the inputs. For (2), you need to have extra values in the input value array (i.e. you need to loop over the getShifts(iinp).
Before using getValue(), you want to use setInputDef(idx) and maybe set the input unit conversions. This makes it possible to store/retrieve in IOPar, but this is aso required if there are constants in the expression.
The setOutputUnit() can be used to keep track of what the result means, or to get the result in that unit from getValue().
Lastly, the SpecVarSet you provide usually lives forever, but should at least stay alive during the lifetime of the formula (it is not copied).
<>
Math::Formula::Formula | ( | bool | inputsareseries = true , |
const char * | txt = 0 |
||
) |
Math::Formula::Formula | ( | bool | inputsareseries, |
const SpecVarSet & | , | ||
const char * | txt = 0 |
||
) |
Math::Formula::Formula | ( | const Formula & | ) |
Math::Formula::~Formula | ( | ) |
void Math::Formula::clearInputDefs | ( | ) |
|
inline |
|
inline |
void Math::Formula::fillPar | ( | IOPar & | ) | const |
double Math::Formula::getConstVal | ( | int | ) | const |
if isConst returns toDouble(inputDef(i)), else Udf
|
inline |
double Math::Formula::getValue | ( | const double * | , |
bool | internal_units = true |
||
) | const |
float Math::Formula::getValue | ( | const float * | , |
bool | internal_units = true |
||
) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
int Math::Formula::nrConsts | ( | ) | const |
int Math::Formula::nrExternalInputs | ( | ) | const |
|
inline |
int Math::Formula::nrValues2Provide | ( | ) | const |
|
inline |
|
inline |
void Math::Formula::setInputDef | ( | int | , |
const char * | |||
) |
void Math::Formula::setInputUnit | ( | int | , |
const UnitOfMeasure * | |||
) |
|
inline |
void Math::Formula::setText | ( | const char * | ) |
|
inline |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
int Math::Formula::specIdx | ( | int | ) | const |
|
inline |
void Math::Formula::startNewSeries | ( | ) | const |
|
inline |
void Math::Formula::usePar | ( | const IOPar & | ) |
const char* Math::Formula::userDispText | ( | ) | const |
|
inline |
|
protected |
|
mutableprotected |
|
protected |
|
mutableprotected |
|
protected |
|
protected |
|
protected |
|
mutableprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2022