24#ifndef _GEMA_INT_RULE_H_
25#define _GEMA_INT_RULE_H_
159 assert(rule1 < 100 && rule2 < 100 && rule3 < 100);
160 assert(base >= 10000000);
161 int key = base + (closed * 1000000) + rule1;
162 if(rule2 != -1) key += rule2 * 100;
163 if(rule3 != -1) key += rule3 * 10000;
193 static_assert(N >= 1 && N <= 3,
"Unexpeced number of tables");
200 virtual int numPoints()
const { assert(isValid());
return _nip; }
208 virtual int degree()
const { assert(isValid());
return _degree; }
214 virtual QString ruleName()
const {
return makeRuleName(_rtype, _rules[0], _rules[1], _rules[2]); }
217 virtual int rulePar(
int num)
const { assert(num >= 1 && num <= 3);
return _rules[num-1]; }
222 assert(num >= 1 && num <= 3);
223 return _tables[num-1] ? _tables[num-1]->size() : -1;
259 virtual int numPoints()
const { assert(isValid());
return _table->size(); }
261 virtual void integrationPoint(
int index,
GmVector& naturalCoord,
double* weight)
const;
267 virtual int degree()
const { assert(isValid());
return _degree; }
276 virtual int rulePar(
int num)
const {
return (num == 1) ? _rule : -1; }
307 virtual void integrationPoint(
int index,
GmVector& naturalCoord,
double* weight)
const;
Integration rule base classe.
Definition gmIntegrationRule.h:89
virtual int rulePar(int num) const =0
Returns the value of the numbered rule parameter received in the rule constructor (-1 if unused)....
virtual QString ruleName() const =0
Returns the current ruleName adopted by this integration rule.
virtual ~GmIntegrationRule()
Virtual destructor.
Definition gmIntegrationRule.h:92
virtual int degree() const =0
Returns the integration degree for this rule (The polynomial degree for which this rule is exact)
virtual int numNaturalCoord() const =0
Returns the number of natural coordinates used by this integration rule.
int makeCacheKey(GmIntegrationRuleCacheKeyBase base, bool closed, int rule1, int rule2=-1, int rule3=-1) const
Creates an unique cache key based on the rule type cache key and the rule parameters.
Definition gmIntegrationRule.h:157
virtual int ruleParNumPoints(int num) const =0
virtual int numPoints() const =0
Returns the number of integration points returned by this rule.
virtual void integrationPoint(int index, GmVector &naturalCoord, double *weight) const =0
Given an index from 0 to numPoints() - 1, fills naturalCoord and weight with the position and weigth ...
static QMap< QPair< GmCellType, int >, QVector< QVector< int > > > _cipCache
A global cache, keyed by cell type + cacheKey(), storing the list of closest integration points to a ...
Definition gmIntegrationRule.h:173
static QMutex _cipCacheMutex
The mutex protecting _cipCache.
Definition gmIntegrationRule.h:176
virtual GmIntegrationRuleType ruleType() const =0
Returns the type of the integration rule.
virtual int cacheKey() const =0
Returns an unique integer that can be used to uniquelly represent this kind of integration rule (i....
virtual bool isValid() const =0
Returns true if this is a valid integration rule object, false if not.
A helper class used to combine 1, 2 or 3 single "line" integration rule tables into a multi-dimension...
Definition gmIntegrationRule.h:192
GmIntegrationRuleType _rtype
The rule type.
Definition gmIntegrationRule.h:235
virtual int numNaturalCoord() const
Returns the number of natural coordinates used by this integration rule.
Definition gmIntegrationRule.h:205
GmIntegrationRuleCacheKeyBase _keyBase
The base cache key.
Definition gmIntegrationRule.h:240
virtual int numPoints() const
Returns the number of integration points returned by this rule.
Definition gmIntegrationRule.h:200
int _nip
The number of integration points.
Definition gmIntegrationRule.h:237
virtual void integrationPoint(int index, GmVector &naturalCoord, double *weight) const
Given an index from 0 to numPoints() - 1, fills naturalCoord and weight with the position and weigth ...
bool isValid() const
Returns true if this is a valid integration rule object, false if not.
Definition gmIntegrationRule.h:197
virtual int cacheKey() const
Returns an unique integer that can be used to uniquelly represent this kind of integration rule (i....
Definition gmIntegrationRule.h:227
virtual GmIntegrationRuleType ruleType() const
Returns the type of the integration rule.
Definition gmIntegrationRule.h:211
virtual int degree() const
Returns the integration degree for this rule (The polynomial degree for which this rule is exact)
Definition gmIntegrationRule.h:208
int _degree
The combined rule degree (the minimum of the individual rule degrees)
Definition gmIntegrationRule.h:236
virtual QString ruleName() const
Returns the current ruleName adopted by this integration rule.
Definition gmIntegrationRule.h:214
virtual int ruleParNumPoints(int num) const
Definition gmIntegrationRule.h:220
virtual int rulePar(int num) const
Returns the value of the numbered rule parameter received in the rule constructor (-1 if unused)....
Definition gmIntegrationRule.h:217
An especialization of the barycentric, single table, integration rule class to treat the case when th...
Definition gmIntegrationRule.h:305
A helper class used to implement rules based on a single table storing the full natural coordinate + ...
Definition gmIntegrationRule.h:253
int _degree
The rule degree.
Definition gmIntegrationRule.h:289
int _rule
The rule number.
Definition gmIntegrationRule.h:290
bool isValid() const
Returns true if this is a valid integration rule object, false if not.
Definition gmIntegrationRule.h:256
virtual int rulePar(int num) const
Returns the value of the numbered rule parameter received in the rule constructor (-1 if unused)....
Definition gmIntegrationRule.h:276
virtual QString ruleName() const
Returns the current ruleName adopted by this integration rule.
Definition gmIntegrationRule.h:273
GmIntegrationRuleType _rtype
The rule type.
Definition gmIntegrationRule.h:288
virtual int degree() const
Returns the integration degree for this rule (The polynomial degree for which this rule is exact)
Definition gmIntegrationRule.h:267
GmIntegrationRuleCacheKeyBase _keyBase
The base cache key.
Definition gmIntegrationRule.h:292
virtual int numNaturalCoord() const
Returns the number of natural coordinates used by this integration rule.
Definition gmIntegrationRule.h:264
virtual int cacheKey() const
Returns an unique integer that can be used to uniquelly represent this kind of integration rule (i....
Definition gmIntegrationRule.h:282
virtual int ruleParNumPoints(int num) const
Definition gmIntegrationRule.h:279
const QVector< QPair< GmVector, double > > * _table
The selected rule table or NULL for invalid rules.
Definition gmIntegrationRule.h:291
virtual GmIntegrationRuleType ruleType() const
Returns the type of the integration rule.
Definition gmIntegrationRule.h:270
virtual int numPoints() const
Returns the number of integration points returned by this rule.
Definition gmIntegrationRule.h:259
Declaration of the GmCellType enum.
GmCellType
Mesh Cell types. Don't change type orders or add types without reading comments below.
Definition gmCellType.h:31
Declaration of useful configuration definitions for the Core library.
#define GMC_API_EXPORT
Macro for controlling if the class is being exported (GEMA_CORE_LIB defined) or imported (GEMA_CORE_L...
Definition gmCoreConfig.h:35
GmIntegrationRuleCacheKeyBase
Enumeration used to define global cache keys for integration rules. These values are used by implemen...
Definition gmIntegrationRule.h:41
@ GM_QUAD_NIR_KEY
Base cache key for 2D Newton cotes quad rules.
Definition gmIntegrationRule.h:52
@ GM_HEX_LIR_KEY
Base cache key for 3D Lobatto hex rules.
Definition gmIntegrationRule.h:60
@ GM_TRI_GIR_KEY
Base cache key for 2D Gauss triangle rules.
Definition gmIntegrationRule.h:44
@ GM_LINE_NIR_KEY
Base cache key for 1D Newton cotes line rules.
Definition gmIntegrationRule.h:51
@ GM_HEX_GIR_KEY
Base cache key for 3D Gauss hex rules.
Definition gmIntegrationRule.h:45
@ GM_TET_NIR_KEY
Base cache key for 3D Newton cotes tetrahedron rules.
Definition gmIntegrationRule.h:55
@ GM_WEDGE_GIR_KEY
Base cache key for 3D Gauss wedge rules.
Definition gmIntegrationRule.h:47
@ GM_TRI_NIR_KEY
Base cache key for 2D Newton cotes triangle rules.
Definition gmIntegrationRule.h:53
@ GM_TET_GIR_KEY
Base cache key for 3D Gauss tetrahedron rules.
Definition gmIntegrationRule.h:46
@ GM_INT_GIR_KEY
Base cache key for 3D Gauss triangle interface rules.
Definition gmIntegrationRule.h:49
@ GM_QUAD_GIR_KEY
Base cache key for 2D Gauss quad rules.
Definition gmIntegrationRule.h:43
@ GM_LINE_GIR_KEY
Base cache key for 1D Gauss line rules.
Definition gmIntegrationRule.h:42
@ GM_USER_IR_KEY
Base cache key for user derived classes.
Definition gmIntegrationRule.h:63
@ GM_INT_NIR_KEY
Base cache key for 3D Newton triangle interface rules.
Definition gmIntegrationRule.h:56
@ GM_HEX_NIR_KEY
Base cache key for 3D Newton cotes hex rules.
Definition gmIntegrationRule.h:54
@ GM_QUAD_LIR_KEY
Base cache key for 2D Lobatto quad rules.
Definition gmIntegrationRule.h:59
@ GM_LINE_LIR_KEY
Base cache key for 1D Lobatto line rules.
Definition gmIntegrationRule.h:58
@ GM_PYRA_GIR_KEY
Base cache key for 3D Gauss pyramid rules.
Definition gmIntegrationRule.h:48
GmIntegrationRuleType
The type of desired integration rule (Gauss quadrature, Lobatto quadrature, etc)
Definition gmIntegrationRule.h:68
@ GM_CLOSED_NEWTON_RULE_TYPE
Closed Newton-Cotes rules.
Definition gmIntegrationRule.h:77
@ GM_AUTO_RULE_TYPE
The type of rule should be choosed by the default for the target element type.
Definition gmIntegrationRule.h:84
@ GM_NUM_RULE_TYPES
Nota a rule, the number of rules above.
Definition gmIntegrationRule.h:83
@ GM_GAUSS_RULE_TYPE
Gauss rules.
Definition gmIntegrationRule.h:75
@ GM_LOBATTO_RULE_TYPE
Lobatto rules.
Definition gmIntegrationRule.h:76
@ GM_OPEN_NEWTON_RULE_TYPE
Open Newton-Cotes rules.
Definition gmIntegrationRule.h:78
GmSingleTableIntegrationRule< N > GmBarycentricSingleTableIntegrationRule
An alias for GmSingleTableIntegrationRule used for barycentric coordianate based classes.
Definition gmIntegrationRule.h:296
Declaration of the GmVector class.
arma::vec GmVector
The basic type for a GeMA vector object. Currently based on an Armadillo vector.
Definition gmVector.h:34