Table Functions
Overview
This class manages tabular data that represents scalar or vector values as a function of an independent variable. Typical use cases include temperature-dependent material data or time-dependent load factors. Table functions can be defined from scratch, merged from existing functions and evaluated at arbitrary independent values.
The functions associated with a TableFunction object are the following.
- Definition and parameters
define()- Define functionTypeand dimensioninquire()- Inquire defined function type and dimensionsetFactor()- Set scale, shift, divisor or offset (TableParameter)getFactor()- Get scale, shift, divisor or offsetsetDoubleParameter()- Set tolerance (DoubleParameter)setIntegerParameter()- Set extrapolation flag (IntegerParameter)getIntegerParameter()- Query integer parameter
- Piecewise linear definition
setPiecewiseLinear()- Define piecewise linear data (float or double)getPointCount()- Query number of tabulated pointsgetIndependentValues()- Get independent values for selected pointsgetDependentValues()- Get dependent values for selected pointssetDependentValues()- Overwrite dependent values for selected points
- Evaluation and combination
evaluate()- Evaluate the function (float or double)merge()- Merge multiple functions into onecheckMatchingIndependentValues()- Check if independent values match another table
- General functions
getErrorCode()- Get current error codesetId()- Set identifiergetId()- Get identifiersetName()- Set name stringgetName()- Get name stringprint()- Print contentsisEqualTo()- Compare two table functions
Define the function type and dimensionality with
define(). Tabular data is entered
with setPiecewiseLinear(),
which accepts arrays of independent and dependent values in either
single or double precision. Once defined, the number of points,
independent values and dependent values can be queried with
getPointCount(),
getIndependentValues() and
getDependentValues(). Use
setDependentValues() to modify
existing data without redefining the complete function.
Table parameters control how the input argument is transformed before interpolation. The evaluation follows
Scale, Shift, Divisor and Offset are defined with
setFactor(). Additional behavior
is configured through DoubleParameter
and IntegerParameter, allowing
you to set interpolation tolerance, enable or disable extrapolation and
specify evaluation hints.
Use evaluate() to compute values
for any set of independent arguments. Functions can be merged into
higher dimensional tables with merge(),
and checkMatchingIndependentValues()
helps verify that two tables share the same sampling of the independent
variable before combining their data.
Class Members Descriptions
The currently available TableFunction enumerations and functions are described in detail in this section.
-
class
TableFunction Public Types
-
enum class
Type Table function type.
Values:
-
enumerator
PWLINEAR Piecewise linear function.
-
enumerator
EQUATION Equation-based function.
-
enumerator
EXPRESSION Expression-based function.
-
enumerator
-
enum class
TableParameter Table parameter types for scaling and shifting.
Values:
-
enumerator
SCALE Scale factor.
-
enumerator
SHIFT Shift value.
-
enumerator
DIVISOR Divisor value.
-
enumerator
OFFSET Offset value.
-
enumerator
Public Functions
-
ErrorCode
getErrorCode() Return the current
ErrorCodeof the TableFunction object.Returns: ErrorCode- The current error code, orNONEif no error.
-
Status
getId(int *id) Get the table function id.
Parameters: id – [out] Table function id Returns: Status
-
Status
setName(const char *name) Attach a name to the table function. Inquire of specified name as an output argument using
getName().Parameters: name – String with table function name Returns: Status
-
Status
getName(char name[]) Get the table function name string.
See Also
setName()Parameters: name – [out] Table function name Returns: Status
-
Status
define(Type type, int dimension) Specify the type (
Type) and dimension of the table function. For a scalar function of an independent variable enter dimension = 1. UsesetPiecewiseLinear()to enter the values of the function for all values of the independent variable. Usemerge()to define a function as the combination of functions.- Errors
-
VALUEis generated if an improper dimension is specified.
Parameters: - type –
Type - dimension – Dimension of vector valued function
Returns:
-
Status
inquire(Type *type, int *dimension) Inquire of defined type and dimension as output arguments.
See Also
define()Parameters: - type – [out]
Type - dimension – [out] Dimension of vector valued function
Returns: - type – [out]
-
Status
setFactor(TableParameter type, float factor) Specify table parameter type (
TableParameter) and value factor. The evaluation function is of the form:By default,y(x) = Scale * CURVE((x - Offset) / Divisor) - Shift
SCALEis set to 1,SHIFTis set to 0,DIVISORis set to 1, andOFFSETis set to 0.Parameters: - type –
TableParameter - factor – Value to set
Returns: - type –
-
Status
setFactor(TableParameter type, double factor) Specify table parameter type (
TableParameter) and value factor. SeesetFactor()(float version) for details.Parameters: - type –
TableParameter - factor – Value to set
Returns: - type –
-
Status
getFactor(TableParameter type, float *factor) Get table parameter type (
TableParameter) as float.Parameters: - type –
TableParameter - factor – [out] Value retrieved
Returns: - type –
-
Status
getFactor(TableParameter type, double *factor) Get table parameter type (
TableParameter) as double.Parameters: - type –
TableParameter - factor – [out] Value retrieved
Returns: - type –
-
Status
setDoubleParameter(DoubleParameter type, double value) Specify a double parameter value: value for type type.
Parameters: - type –
DoubleParameter - value – Value to set
Returns: - type –
-
Status
setIntegerParameter(IntegerParameter type, int value) Specify an integer parameter value: value for type: type
Parameters: - type –
IntegerParameter - value – Value to set
Returns: - type –
-
Status
getIntegerParameter(IntegerParameter type, int *value) Return a defined real parameter as double.
Parameters: - type –
IntegerParameter - value – [out] Value retrieved
Returns: - type –
-
Status
setPiecewiseLinear(int pointCount, float x[], float y[]) Define a function as a piecewise linear function at pointCount values of the independent variable x. The function values y are input as a vector valued function of dimension specified in
define().Parameters: - pointCount – Number of points for which function is defined
- x – Array of values of independent variable
- y – Array of values of function
Returns:
-
Status
setPiecewiseLinear(int pointCount, double x[], double y[]) Define a function as a piecewise linear function at pointCount values of the independent variable x (double version). The function values y are input as a vector valued function of dimension specified in
define().Parameters: - pointCount – Number of points for which function is defined
- x – Array of values of independent variable
- y – Array of values of function
Returns:
-
Status
getPointCount(int *count) Query for the number of values of the independent variable for which the function is defined.
Parameters: count – [out] Number of points on function curve Returns: Status
-
Status
getIndependentValues(int pointCount, int pointIndexes[], float values[]) Query for the values of the independent variable for which the function is defined. The point indices pointIndexes are indexed starting from 1.
Parameters: - pointCount – Number of points on function curve to return
- pointIndexes – Array of point indices
- values – [out] Values of independent variable
Returns:
-
Status
getIndependentValues(int pointCount, int pointIndexes[], double values[]) Query for the values of the independent variable for which the function is defined. The point indices pointIndexes are indexed starting from 1.
Parameters: - pointCount – Number of points on function curve to return
- pointIndexes – Array of point indices
- values – [out] Values of independent variable
Returns:
-
Status
getDependentValues(int pointCount, int pointIndexes[], float values[]) Query for the values of the dependent variable for which the function is defined.
Parameters: - pointCount – Number of points on function curve to return
- pointIndexes – Array of point indices
- values – [out] Values of dependent variable
Returns:
-
Status
getDependentValues(int pointCount, int pointIndexes[], double values[]) Query for the values of the dependent variable for which the function is defined.
Parameters: - pointCount – Number of points on function curve to return
- pointIndexes – Array of point indices
- values – [out] Values of dependent variable
Returns:
-
Status
setDependentValues(int pointCount, int pointIndexes[], float values[]) Set the values of the dependent variable for the function.
Parameters: - pointCount – Number of points on function curve to set
- pointIndexes – Array of point indices
- values – Values of dependent variable
Returns:
-
Status
setDependentValues(int pointCount, int pointIndexes[], double values[]) Set the values of the dependent variable for the function.
Parameters: - pointCount – Number of points on function curve to set
- pointIndexes – Array of point indices
- values – Values of dependent variable
Returns:
-
Status
evaluate(int pointCount, float independentValues[], float dependentValues[]) Evaluate the function at pointCount values independentValues of the independent variable.
Parameters: - pointCount – Number of points to evaluate
- independentValues – Values of independent variable
- dependentValues – [out] Values of function
Returns:
-
Status
evaluate(int pointCount, double independentValues[], double dependentValues[]) Evaluate the function at pointCount values independentValues of the independent variable.
Parameters: - pointCount – Number of points to evaluate
- independentValues – Values of independent variable
- dependentValues – [out] Values of function
Returns:
-
Status
merge(int count, TableFunction **functionArray) Define a function as a combination of count functions functionArray. The dimension of the function defined using
define()must be equal to the sum of the dimensions of the count functions functionArray. The number of values of the independent variable will be equal to the union of the values of the functions functionArray. The function must be of typePWLINEAR.Parameters: - count – Number of functions to merge
- functionArray – Array of pointers to TableFunction objects to merge
Returns:
-
Status
checkMatchingIndependentValues(int pointCount, float independentValues[], int *flag) Check if the given independent values match those of the function.
Parameters: - pointCount – Number of points to check
- independentValues – Values of independent variable
- flag – [out] 1 if matching, 0 otherwise
Returns:
-
int
isEqualTo(TableFunction *function) Check if this TableFunction is equal to another TableFunction.
Parameters: function – TableFunction to compare with Returns: 1 if equal, 0 otherwise
-
enum class