GemaLuaCoreLib
The GeMA Lua Core library
Loading...
Searching...
No Matches
gmLuaInterpolator.h
Go to the documentation of this file.
1/************************************************************************
2**
3** Copyright (C) 2014 by Carlos Augusto Teixera Mendes
4** All rights reserved.
5**
6** This file is part of the "GeMA" software. It's use should respect
7** the terms in the license agreement that can be found together
8** with this source code.
9** It is provided AS IS, with NO WARRANTY OF ANY KIND,
10** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR
11** A PARTICULAR PURPOSE.
12**
13************************************************************************/
14
24#ifndef _GEMALUA_INTERPOLATOR_H_
25#define _GEMALUA_INTERPOLATOR_H_
26
27#include "gmLuaObject.h"
28
29#include <gmVector.h>
30
31class GmInterpolator;
32class GmValueAccessor;
33class GmGaussAccessor;
34class GmSpatialIndex;
35class GmNumSolver;
36
41class GML_API_EXPORT GmLuaNodeToPointInterpolator : public GmLuaObject
42{
43public:
45
46 // See comments on the base class
47 virtual const char* typeName() const { return "nodeToPointInterpolator"; }
48
49 virtual QString toString() const;
50
51 virtual void fillMetatable(lua_State* L, int index);
52
54 virtual void* getClassMetatableID() { static int classID = 0; return &classID; }
55
56 static GmLuaNodeToPointInterpolator* createInterpolator(lua_State* L, bool element, const GmLogCategory& logger);
57
58private:
59 GmLuaNodeToPointInterpolator(GmInterpolator* interp, bool element, bool multi, bool result, const GmLogCategory& logger);
60
61 int interpolate(lua_State* L);
62
63protected:
66 bool _multi;
67 bool _resultAc;
68};
69
70
74class GML_API_EXPORT GmLuaGaussToPointInterpolator : public GmLuaObject
75{
76public:
78
79 // See comments on the base class
80 virtual const char* typeName() const { return "gaussToPointInterpolator"; }
81
82 virtual QString toString() const;
83
84 virtual void fillMetatable(lua_State* L, int index);
85
87 virtual void* getClassMetatableID() { static int classID = 0; return &classID; }
88
89 static GmLuaGaussToPointInterpolator* createInterpolator(lua_State* L, const GmLogCategory& logger);
90
91private:
92 GmLuaGaussToPointInterpolator(GmInterpolator* interp, bool multi, const GmLogCategory& logger);
93
94 int interpolate(lua_State* L);
95
96protected:
98 bool _multi;
99};
100
104class GML_API_EXPORT GmLuaGaussToNodeInterpolator : public GmLuaObject
105{
106public:
108
109 // See comments on the base class
110 virtual const char* typeName() const { return "gaussToNodeInterpolator"; }
111
112 virtual QString toString() const;
113
114 virtual void fillMetatable(lua_State* L, int index);
115
117 virtual void* getClassMetatableID() { static int classID = 0; return &classID; }
118
119 static GmLuaGaussToNodeInterpolator* createInterpolator(lua_State* L, const GmLogCategory& logger);
120
121private:
122 GmLuaGaussToNodeInterpolator(GmInterpolator* interp, bool multi, const GmLogCategory& logger);
123
124 int interpolate(lua_State* L);
125
126protected:
128 bool _multi;
129};
130
135{
136public:
138
139 // See comments on the base class
140 virtual const char* typeName() const { return "gaussNeighborsToNodeInterpolator"; }
141
142 virtual QString toString() const;
143
144 virtual void fillMetatable(lua_State* L, int index);
145
147 virtual void* getClassMetatableID() { static int classID = 0; return &classID; }
148
149 static GmLuaGaussNeighborsToNodeInterpolator* createInterpolator(lua_State* L, const GmLogCategory& logger);
150
151private:
152 GmLuaGaussNeighborsToNodeInterpolator(GmInterpolator* interp, bool multi, bool result, const GmLogCategory& logger);
153
154 int interpolate(lua_State* L);
155
156protected:
158 bool _multi;
160};
161
166{
167public:
169
170 // See comments on the base class
171 virtual const char* typeName() const { return "nodeCloudToPointInterpolator"; }
172
173 virtual QString toString() const;
174
175 virtual void fillMetatable(lua_State* L, int index);
176
178 virtual void* getClassMetatableID() { static int classID = 0; return &classID; }
179
180 static GmLuaNodeCloudToPointInterpolator* createInterpolator(lua_State* L, const GmLogCategory& logger);
181
182private:
183 GmLuaNodeCloudToPointInterpolator(GmInterpolator* interp, bool multi, const GmLogCategory& logger);
184
185 int interpolate(lua_State* L);
186
187protected:
189 bool _multi;
190};
191
192
197{
198public:
200
201 // See comments on the base class
202 virtual const char* typeName() const { return "gaussCloudToPointInterpolator"; }
203
204 virtual QString toString() const;
205
206 virtual void fillMetatable(lua_State* L, int index);
207
209 virtual void* getClassMetatableID() { static int classID = 0; return &classID; }
210
211 static GmLuaGaussCloudToPointInterpolator* createInterpolator(lua_State* L, const GmLogCategory& logger);
212
213private:
214 GmLuaGaussCloudToPointInterpolator(GmInterpolator* interp, bool multi, const GmLogCategory& logger);
215
216 int interpolate(lua_State* L);
217
218protected:
220 bool _multi;
221};
222
223
226{
227 int pushResults(lua_State* L, const GmVector& result, const QVector<GmVector>& resultList,
228 const GmLogCategory& logger, bool resultsCanBeEmpty = false);
229
230 template<class T, class P> void parseValueAccessors(lua_State* L, int vIndex, int cIndex, const T*& valueAc, QVector<const T*>& valueAcList,
231 const GmValueAccessor*& coordAc, const char* acType);
232
233 template<class T, class P, class V> void parseResultAccessors(lua_State* L, int index, T*& resultAc, QVector<T*>& resultAcList,
234 const V* valueAc, const QVector<const V*>& valueAcList, const char* acType);
235
236 void parseCommonParams(lua_State* L, bool nodeBased, const char* fname, const GmLogCategory** logger,
237 int* interpType, QVariant* interpParam, int* searchMode, double* searchDomain,
238 GmSpatialIndex** spIndex);
239
240 void parseCommonSplineParams(lua_State* L, bool nodeBased, int solverIndex, const char* fname,
241 const GmLogCategory** logger, int* searchMode, double* searchDomain,
242 GmSpatialIndex** spIndex, GmNumSolver** solver);
243
244 void checkRuleSets(lua_State* L, const QVector<GmGaussAccessor*>& list, const GmLogCategory& logger, bool warn);
245 void checkRuleSets(lua_State* L, const QVector<const GmGaussAccessor*>& list, const GmLogCategory& logger, bool warn);
246}
247
248
249#endif
A proxy class to export GmGaussCloudToPointInterpolator and GmGaussCloudToPointMInterpolator methods ...
Definition gmLuaInterpolator.h:197
GmInterpolator * _interp
The interpolator, owned by this proxy object.
Definition gmLuaInterpolator.h:219
bool _multi
Is the interpolator a multi attribute interpolator or for a single one?
Definition gmLuaInterpolator.h:220
virtual void * getClassMetatableID()
Returns an unique identifier to identify an user object as a GmLuaMesh object.
Definition gmLuaInterpolator.h:209
virtual const char * typeName() const
Returns the object type as will be stored in the object metatable.
Definition gmLuaInterpolator.h:202
A proxy class to export GmGaussNeighborsToNodeInterpolator and GmGaussNeighborsToNodeMInterpolator me...
Definition gmLuaInterpolator.h:135
virtual const char * typeName() const
Returns the object type as will be stored in the object metatable.
Definition gmLuaInterpolator.h:140
bool _resultAc
Does the interpolator stores result accessors?
Definition gmLuaInterpolator.h:159
virtual void * getClassMetatableID()
Returns an unique identifier to identify an user object as a GmLuaMesh object.
Definition gmLuaInterpolator.h:147
bool _multi
Is the interpolator a multi attribute interpolator or for a single one?
Definition gmLuaInterpolator.h:158
GmInterpolator * _interp
The interpolator, owned by this proxy object.
Definition gmLuaInterpolator.h:157
A proxy class to export GmGaussToElementNodeInterpolator and GmGaussToElementNodeMInterpolator method...
Definition gmLuaInterpolator.h:105
GmInterpolator * _interp
The interpolator, owned by this proxy object.
Definition gmLuaInterpolator.h:127
bool _multi
Is the interpolator a multi attribute interpolator or for a single one?
Definition gmLuaInterpolator.h:128
virtual const char * typeName() const
Returns the object type as will be stored in the object metatable.
Definition gmLuaInterpolator.h:110
virtual void * getClassMetatableID()
Returns an unique identifier to identify an user object as a GmLuaMesh object.
Definition gmLuaInterpolator.h:117
A proxy class to export GmGaussToElementPointInterpolator and GmGaussToElementPointMInterpolator meth...
Definition gmLuaInterpolator.h:75
virtual const char * typeName() const
Returns the object type as will be stored in the object metatable.
Definition gmLuaInterpolator.h:80
virtual void * getClassMetatableID()
Returns an unique identifier to identify an user object as a GmLuaMesh object.
Definition gmLuaInterpolator.h:87
GmInterpolator * _interp
The interpolator, owned by this proxy object.
Definition gmLuaInterpolator.h:97
bool _multi
Is the interpolator a multi attribute interpolator or for a single one?
Definition gmLuaInterpolator.h:98
A proxy class to export GmNodeCloudToPointInterpolator and GmNodeCloudToPointMInterpolator methods to...
Definition gmLuaInterpolator.h:166
virtual void * getClassMetatableID()
Returns an unique identifier to identify an user object as a GmLuaMesh object.
Definition gmLuaInterpolator.h:178
virtual const char * typeName() const
Returns the object type as will be stored in the object metatable.
Definition gmLuaInterpolator.h:171
GmInterpolator * _interp
The interpolator, owned by this proxy object.
Definition gmLuaInterpolator.h:188
bool _multi
Is the interpolator a multi attribute interpolator or for a single one?
Definition gmLuaInterpolator.h:189
A proxy class to export GmNodeToCellPointInterpolator, GmNodeToCellPointMInterpolator,...
Definition gmLuaInterpolator.h:42
virtual const char * typeName() const
Returns the object type as will be stored in the object metatable.
Definition gmLuaInterpolator.h:47
virtual void * getClassMetatableID()
Returns an unique identifier to identify an user object as a GmLuaMesh object.
Definition gmLuaInterpolator.h:54
bool _resultAc
Does the interpolator stores result accessors?
Definition gmLuaInterpolator.h:67
GmInterpolator * _interp
The interpolator, owned by this proxy object.
Definition gmLuaInterpolator.h:64
bool _multi
Is the interpolator a multi attribute interpolator or for a single one?
Definition gmLuaInterpolator.h:66
bool _elementBased
Is the interpolator element based (true) or cell based (false)?
Definition gmLuaInterpolator.h:65
A proxy class to export object methods to the Lua environment.
Definition gmLuaObject.h:36
virtual QString toString() const
Default method used by the __tostring metamethod to capture the result of tostring() over an object.
Definition gmLuaObject.h:55
virtual void fillMetatable(lua_State *L, int index)=0
Function called by populateMetatable() to fill the metatable with exported methods by derived classes...
Declaration of the GmLuaObject class.
arma::vec GmVector
Aux functions used by several of the interpolator proxy classes.
Definition gmLuaInterpolator.h:226
void checkRuleSets(lua_State *L, const QVector< GmGaussAccessor * > &list, const GmLogCategory &logger, bool warn)
Overload for non constant accessors.
Definition gmLuaInterpolator.cpp:1863
void parseCommonSplineParams(lua_State *L, bool nodeBased, int solverIndex, const char *fname, const GmLogCategory **logger, int *searchMode, double *searchDomain, GmSpatialIndex **spIndex, GmNumSolver **solver)
Parses the set of common parameters used by all types of LuaSplineMeshXxxToMeshXxxInterpolation() imp...
Definition gmLuaInterpolator.cpp:1791
void parseResultAccessors(lua_State *L, int index, T *&resultAc, QVector< T * > &resultAcList, const V *valueAc, const QVector< const V * > &valueAcList, const char *acType)
Loads from the Lua stack the set of result accessors, if any, filling either resultAc or resultAcList...
Definition gmLuaInterpolator.cpp:1668
void parseCommonParams(lua_State *L, bool nodeBased, const char *fname, const GmLogCategory **logger, int *interpType, QVariant *interpParam, int *searchMode, double *searchDomain, GmSpatialIndex **spIndex)
Parses the set of common parameters used by all types of LuaMeshXxxToMeshXxxInterpolation() implement...
Definition gmLuaInterpolator.cpp:1731
void parseValueAccessors(lua_State *L, int vIndex, int cIndex, const T *&valueAc, QVector< const T * > &valueAcList, const GmValueAccessor *&coordAc, const char *acType)
Loads from the Lua stack the set of value accessors and the coordinate accessor, filling either value...
Definition gmLuaInterpolator.cpp:1634
int pushResults(lua_State *L, const GmVector &result, const QVector< GmVector > &resultList, const GmLogCategory &logger, bool resultsCanBeEmpty=false)
Auxiliary function that given the results filing either result or resultLIst, pushes in the lua stack...
Definition gmLuaInterpolator.cpp:1577