|
| Formula (bool inputsareseries, const SpecVarSet &, const char *txt=nullptr) |
|
| Formula (bool inputsareseries=true, const char *txt=nullptr) |
|
| Formula (const Formula &) |
|
| ~Formula () |
|
void | clearAllDefs () |
|
void | clearInputDefs () |
|
Formula & | copyFrom (const Math::Formula &) |
| *< Does not use the description and values More...
|
|
const char * | description () const |
|
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...
|
|
void | getInputMnemonics (MnemonicSelection &) const |
|
const TypeSet< int > & | getShifts (int iinp) const |
|
double | getValue (const double *) const |
|
double | getValue (const double *vals, bool internuns) const |
|
float | getValue (const float *vals, bool internuns=true) const |
|
bool | hasFixedUnits () const |
|
const char * | inputDef (int iinp) const |
|
const char * | inputDescription (int iinp) const |
|
const UnitOfMeasure * | inputFormUnit (int iinp) const |
|
const Mnemonic * | inputMnemonic (int iinp) const |
|
bool | inputsAreSeries () const |
|
const char * | inputVar (int iinp) const |
|
bool | isBad () const |
|
bool | isCompatibleWith (const Formula &) const |
|
bool | isCompatibleWith (const Mnemonic &, const MnemonicSelection *inps=nullptr) 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 | nrSpecs () const |
|
int | nrValues2Provide () const |
|
bool | operator!= (const Formula &) const |
| *< Does not use the description More...
|
|
Formula & | operator= (const Formula &) |
| *< Does not use the description More...
|
|
bool | operator== (const Formula &) const |
|
const UnitOfMeasure * | outputFormUnit () const |
|
const Mnemonic * | outputMnemonic () const |
|
TypeSet< double > & | recStartVals () |
|
void | setDescription (const char *descstr) |
| *< Does not copy input definitions and descriptions More...
|
|
void | setInputDef (int, const char *) |
|
void | setInputDescription (int, const char *) |
| Optional description of an input. More...
|
|
void | setInputFormUnit (int, const UnitOfMeasure *) |
| The input unit within the expression. More...
|
|
void | setInputMnemonic (int, const Mnemonic *) |
|
void | setInputValUnit (int, const UnitOfMeasure *) |
| The input unit of incoming values. More...
|
|
void | setOutputFormUnit (const UnitOfMeasure *uom) |
| The output unit of the math expression. More...
|
|
void | setOutputMnemonic (const Mnemonic *mn) |
|
void | setOutputValUnit (const UnitOfMeasure *uom) |
| The unit of the returned value (getValue) More...
|
|
virtual 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 |
|
| NamedObject (const char *nm=nullptr) |
|
| NamedObject (const NamedObject &oth) |
|
virtual | ~NamedObject () |
|
virtual BufferString | getName () const |
|
bool | getNameFromPar (const IOPar &) |
|
const name_type & | name () const override |
|
NamedObject & | operator= (const NamedObject &) |
|
bool | operator== (const NamedObject &oth) const |
|
virtual void | setName (const char *nm) |
|
virtual | ~ObjectWithName () |
|
bool | hasName (const char *nm) const |
|
bool | hasName (const name_type &nm) const |
|
void | putNameInPar (IOPar &) const |
|
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 setInputFormUnit(idx) before calculation, this unit is the unit that the user wants the variable value to be used into the mathexpression. setOutputFormUnit(idx) will specify the unit of the variable return by 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 match the form input units, otherwise setInputValUnit must be called. The output values will match the form output unit, unless setOutputValUnit was called.
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).
<>