GemaCoreLib
The GeMA Core library
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Private Attributes | List of all members
GmInterpolator Class Reference

Interpolator class used for managing available interpolator algorithms and providing basic support functions with operations common to every derived class. More...

#include <gmInterpolator.h>

Inheritance diagram for GmInterpolator:
Inheritance graph
[legend]
Collaboration diagram for GmInterpolator:
Collaboration graph
[legend]

Public Member Functions

virtual ~GmInterpolator ()
 Virtual destructor.
 
bool isValid () const
 Is this a valid object? Invalid objects can arise, for example, if the interpolator type given in the constructor is not appropriate for this interpolator class kind.
 
const GmInterpolatorObjectinterpolatorObject () const
 Returns the interpolator object used by this interpolator.
 
const GmMeshmesh () const
 Returns the mesh associated with this interpolator. Can be NULL.
 
QString interpolatorTypeToStr () const
 Returns a string representing the interpolator object.
 

Static Public Member Functions

static bool initInterpolators ()
 Initializes the interpolator module. Must be called ONCE before any calls to interpolatorObjectFromType()
 
static QString interpolatorTypeToStr (GmInterpolatorType type, const QVariant &typeParam)
 Converts an interpolation type to a string. If typeParam is different from QVariant(), the parameter is included in the resulting string.
 
static int strToInterpolatorType (QString str, bool acceptsNo=false)
 Converts a string to a GmInterpolatorType. Returns -1 if no match is found. Returns GM_DEFAULT_INTERPOLATOR for empty strings. More...
 
static bool validInterpolatorForKind (GmInterpolatorType type, const QVariant &typeParam, GmInterpolatorKind kind)
 Returns true if the given parameters are valid for the given interpolator type and if it supports the requested interpolator kind.
 

Protected Member Functions

 GmInterpolator (GmInterpolatorKind kind, GmInterpolatorType type, const QVariant &typeParam, const GmValueAccessor *coordAccessor, const GmMesh *mesh, bool skipTests=false)
 Interpolator basic constructor. Protected since this class should be used only as a base class for the real interpolator classes. More...
 
bool interpolate (GmInterpolatorCoordinateSetBinding *pointSet, GmInterpolatorInputDataBinding *inData, GmInterpolatorOutputDataBinding *outData, const GmInterpolatorOutputCoordinateBinding &coord) const
 Generic interpolation routine, receiving the needed data through several binding objects. More...
 
void gaussToNodesInterpolate (GmInterpolatorGaussCoordinateSetBinding *pointSet, GmInterpolatorInputDataBinding *inData, GmInterpolatorOutputMultiDataBinding *outData) const
 Generic interpolation routine for calculating multiple values, especifically node values from a point cloud internal to an element. More...
 

Static Protected Member Functions

static void scalarVectorListToVector (const QList< GmVector > &vectorList, GmVector &scalarVector)
 Converts the data in the given list to a single vector. Can be used only when all vectors in the list are effectivelly scalars (num elements = 1).
 
static const GmInterpolatorObjectinterpolatorObjectFromType (GmInterpolatorType type)
 Factory function for returning the interpolator object associated with the requested interpolator type. More...
 

Protected Attributes

const GmInterpolatorObject_interp
 The interpolator object for the requested interpolation type. NULL if this interpolator is invalid.
 
QVariant _interpParam
 The interpolator parameter received on the constructor.
 
const GmValueAccessor_coordAc
 The accessor for node coordinates.
 
const GmMesh_mesh
 The mesh containing the source data points. Can be NULL since it is required by only some interpolators.
 

Static Private Attributes

static const GmInterpolatorObject_iObjects [GM_NUM_INTERPOLATORS] = {NULL}
 The global list with available interpolator objects.
 

Detailed Description

Interpolator class used for managing available interpolator algorithms and providing basic support functions with operations common to every derived class.

This class should not be used directly (except for its public static functions). Use classes such as GmNodeToElementPointInterpolator, GmGaussToElementNodeInterpolator and friends instead.

Constructor & Destructor Documentation

◆ GmInterpolator()

GmInterpolator::GmInterpolator ( GmInterpolatorKind  kind,
GmInterpolatorType  type,
const QVariant typeParam,
const GmValueAccessor coordAccessor,
const GmMesh mesh,
bool  skipTests = false 
)
protected

Interpolator basic constructor. Protected since this class should be used only as a base class for the real interpolator classes.

This constructor instances the interpolator object that will be used for executing the interpolation by calling GmInterpolator::interpolatorObjectFromType() and also stores internally the given accessors, mesh and type parameters.

If the given type /parameter is invalid or incompatible with the interpolator kind, the constructed object will be invalid (_interp member == NULL) and can not be used.

This should be checked by a call to GmInterpolator::isValid().

Parameters
kindThe interpolator kind. Used to check if the interpolator type is compatible with the interpolator kind
typeThe required interpolator type
typeParamExtra parameter used by the interpolator
coordAccessorAccessor for retrieving node coordinates. Needed also to calculate

Gauss points coordinates.

Parameters
meshThe mesh associated with the coordinate accessor. Required only if the underlying interpolator requires mesh information.
skipTestsIf set to true, the constructor will NOT check if the obtained interpolator is really valid, supporting the requested kind, etc. Should be used only if the derived class intends to do this checks by itself.

Member Function Documentation

◆ gaussToNodesInterpolate()

void GmInterpolator::gaussToNodesInterpolate ( GmInterpolatorGaussCoordinateSetBinding pointSet,
GmInterpolatorInputDataBinding inData,
GmInterpolatorOutputMultiDataBinding outData 
) const
protected

Generic interpolation routine for calculating multiple values, especifically node values from a point cloud internal to an element.

Parameters
pointSetThe object providing coordinates for the set of points containing the known values upon which the interpolation will be based
inDataThe object storing values for each point in pointSet. Can store single or multiple values for each point.
outDataThe object storing the data structure where calculated results will be stored.

◆ interpolate()

bool GmInterpolator::interpolate ( GmInterpolatorCoordinateSetBinding pointSet,
GmInterpolatorInputDataBinding inData,
GmInterpolatorOutputDataBinding outData,
const GmInterpolatorOutputCoordinateBinding coord 
) const
protected

Generic interpolation routine, receiving the needed data through several binding objects.

Parameters
pointSetThe object providing coordinates for the set of points containing the known values upon which the interpolation will be based
inDataThe object storing values for each point in pointSet. Can store single or multiple values for each point.
outDataThe object storing the data structure where calculated results will be stored.
coordAn object providing the coordinate of the interpolated point, either in cartesian or natural coordinates, according to the interpolator requirements.

◆ interpolatorObjectFromType()

const GmInterpolatorObject * GmInterpolator::interpolatorObjectFromType ( GmInterpolatorType  type)
staticprotected

Factory function for returning the interpolator object associated with the requested interpolator type.

IMPORTANT: This function returns the SAME object for all calls with the same type. This makes it a fast function and no allocation is needed.

◆ strToInterpolatorType()

int GmInterpolator::strToInterpolatorType ( QString  str,
bool  acceptsNo = false 
)
static

Converts a string to a GmInterpolatorType. Returns -1 if no match is found. Returns GM_DEFAULT_INTERPOLATOR for empty strings.

The acceptsNo parameter controls if this function accepts the "no" string. If true, returns GM_NO_INTERPOLATOR for str == "no". If false, returns -1.


The documentation for this class was generated from the following files: