![]() |
GemaCoreLib
The GeMA Core library
|
Interface class for the implementation of each of the possible interpolation algorithms available in GmInterpolatorType. More...
#include <gmInterpolator.h>
Public Member Functions | |
virtual GmInterpolatorType | type () const =0 |
Returns the interpolator object type. | |
virtual bool | typeParamIsValid (const QVariant &v) const |
Is the given interpolator type parameter valid? The default implementation accepts only empty variants. | |
virtual QString | typeParamToStr (const QVariant &v) const |
Converts an interpolator type parameter to a string. | |
virtual bool | supportsInterpolatorKind (GmInterpolatorKind kind) const =0 |
Returns whether this interpolator object supports the given interpolator kind or not. | |
virtual bool | requiresElement () const |
Does this interpolator object requires that the coordinate set provided to interpolationWeights() contains points from a single element, whose identity can be queried by a call to GmCoordinateSet::cell()? Default = false. | |
virtual bool | requiresMesh () const |
Does this interpolator object requires that the coordinate set provided to interpolationWeights() contains information about the underlying mesh, whose identity can be queried by a call to GmCoordinateSet::mesh()? Default = false. | |
virtual bool | requiresNaturalCoordinates () const |
Does this interpolator object requires that the coordinate passed as parameter to interpolationWeights() be expressed in natural coordinates? By default this is false and the provided coordinate should be cartesian coordinates. | |
virtual bool | interpolationWeights (GmInterpolatorCoordinateSetBinding *pointSet, const GmVector &coord, const QVariant &typeParam, GmVector &weights) const |
Basic function for calculating the interpolation weights that should be associated with each point (coordinate) in the given point set. More... | |
virtual bool | distanceBasedWeights (GmInterpolatorCoordinateSetBinding *pointSet, const GmVector &coord, const GmVector &squaredDistances, const QVariant &typeParam, GmVector &weights) const |
Worker function for the default implementation of interpolationWeights(). This is the function that needs to be reimplemented if the distance based approach used by interpolationWeights() is valid for this object. Otherwise, please reimplement interpolationWeights() itself. More... | |
virtual const GmMatrix & | gaussToNodesExtrapolationMatrix (GmInterpolatorGaussCoordinateSetBinding *pointSet, const QVariant &typeParam, GmMatrix &weights) const |
Basic function for returning the extrapolation matrix used by the GM_GAUSS_TO_NODE_INTERPOLATOR interpolator kind. More... | |
Protected Member Functions | |
GmInterpolatorObject () | |
Protected default constructor to make sure that Interpolator objects are created only by the GmInterpolator friend class. | |
Friends | |
class | GmInterpolator |
Interface class for the implementation of each of the possible interpolation algorithms available in GmInterpolatorType.
An interpolator object should provide either an implementation of the virtual method interpolationWeights() or the method distanceBasedWeights(). The default implementation of interpolationWeights calculates node to point distances and calls distanceBasedWeights().
Also, an interpolator object should clearly state its requirements by reimplementing the following virtual functions if the interpolator requirement is different from the defaults: requiresElement(), requiresMesh() and requiresNaturalCoordinates().
Classes inheriting from InterpolatorObject should be all very lightweight classes in order for the user to be able to create an interpolator object on the stack without performance concerns. By the current design, Interpolator Objects should only override the needed virtual functions and present NO CONTEXT, i.e. an interpolator object should have NO data members (it can have const data members). In this way, the GmInterpolator calss can mantain a static list with Interpolator Objects and reuse the same object whenever a call to GmInterpolator::interpolatorObjectFromType() is made.
|
inlinevirtual |
Worker function for the default implementation of interpolationWeights(). This is the function that needs to be reimplemented if the distance based approach used by interpolationWeights() is valid for this object. Otherwise, please reimplement interpolationWeights() itself.
Function parameters and expected behaviour is the same as documented by interpolationWeights(), except for the extra squaredDistances parameter that contains a vector with size equal to the number of points in the point set. Each vector entry stores the square of the cartesian distance between that point and the given cartesian coordinate in coord.
Reimplemented in GmIdwInterpolatorObject, GmNnInterpolatorObject, and GmMlsInterpolatorObject.
|
inlinevirtual |
Basic function for returning the extrapolation matrix used by the GM_GAUSS_TO_NODE_INTERPOLATOR interpolator kind.
Given the set of coordinates for the known element points (usually integration points), this function should return an extrapolation weight matrix that, when multiplied by the point values, will return the interpolated values for the element nodes. If the point set has 'm' entries, the returned matrix will be an 'n x m' matrix where 'n' is the number of element nodes.
Depending on the interpolator type, the resulting matrix can be a constant matrix per integration rule/element type. In that case, the matrix does not need to be calculated and a reference to a fixed constant matrix can be returned. In those cases, instead of filling the given weight matrix with the values, the function can return a reference to that constant matrix and leave the provided matrix unchanged. On all other cases, the function should fill the weights parameter and return a reference to that parameter matrix.
Reimplemented in GmShapeInterpolatorObject.
|
virtual |
Basic function for calculating the interpolation weights that should be associated with each point (coordinate) in the given point set.
Given the set of points from which the value should be interpolated (pointSet), this function should calculate the weight of the values in those points. The caller of this function will calculate the interpolated value as a sum of the value in each of the set points multiplied by the weight of that set point calculated by this function. IMPORTANT: Calculated weights should be normalized (weights should sum to 1.0).
The default implementation calculates the squared cartesian distance between the coordinate of
the interpolation point and each of the set points forming a vector that will be passed to the worker function distanceBasedWeights().
This function is used by the GM_NODE_TO_POINT_INTERPOLATOR, GM_GAUSS_TO_POINT_INTERPOLATOR, and GM_POINTCLOUD_TO_POINT_INTERPOLATOR interpolator kinds.
pointSet | Coordinate set storing cartesian coordinates for the full set of points that should be considered in the interpolation. It can also provide the cell that contains the given points (if they belong to a single cell) and the underlying mesh. |
coord | The coordinate of the interpolation point. Normally those coordinates should be cartesian coordinates, but if requiresNaturalCoordinates() return true, then the given coordinates should be natural coordinates. This is important, for example, when interpolating using shape functions. |
typeParam | The parameter used to configure the interpolator type. Can be the power used when interpolating by the IDW method, the radial based function for the MLS method, etc. See the documentation of the concrete InterpolatorObject class for the available parameter for each method. |
weights | The vector to be filled with the calculated weights. Its size should be equal to the number of entries in pointSet and its values should be normalized, i.e, the sum of the values in weights should be equal to 1.0. |
Reimplemented in GmShapeInterpolatorObject.