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

Integration rule base classe. More...

#include <gmIntegrationRule.h>

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

Public Member Functions

virtual ~GmIntegrationRule ()
 Virtual destructor.
 
virtual bool isValid () const =0
 Returns true if this is a valid integration rule object, false if not. More...
 
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 of the given integration point. More...
 
virtual int numNaturalCoord () const =0
 Returns the number of natural coordinates used by this integration rule.
 
virtual int degree () const =0
 Returns the integration degree for this rule (The polynomial degree for which this rule is exact)
 
virtual GmIntegrationRuleType ruleType () const =0
 Returns the type of the integration rule.
 
virtual QString ruleName () const =0
 Returns the current ruleName adopted by this integration rule.
 
virtual int rulePar (int num) const =0
 Returns the value of the numbered rule parameter received in the rule constructor (-1 if unused). Num should be a value between 1 and 3.
 
virtual int ruleParNumPoints (int num) const =0
 
virtual int cacheKey () const =0
 Returns an unique integer that can be used to uniquelly represent this kind of integration rule (i.e, two objects with the same cache key should return exactly the same set of integration points). More...
 
virtual const QVector< int > & closestIntegrationIndex (GmCellType type, int P, int Q, int nodeIndex) const
 Returns a list with the index of the closest(s) integraion points from nodeIndex. More...
 

Static Public Member Functions

static GmIntegrationRuleinstance (GmCellType type, int P, int Q, GmIntegrationRuleType irType, int rule1=-1, int rule2=-1, int rule3=-1)
 Instanciates an integration rule for the specified element type using the provided parameters. Returns NULL if the parameter set results in an invalid integration rule. More...
 

Protected Member Functions

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.
 
QString makeRuleName (GmIntegrationRuleType irType, int rule1, int rule2=-1, int rule3=-1) const
 Returns a standard rule name based on rule type and rule parameters.
 

Static Private Attributes

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 cell node.
 
static QMutex _cipCacheMutex
 The mutex protecting _cipCache.
 

Detailed Description

Integration rule base classe.

Member Function Documentation

◆ cacheKey()

virtual int GmIntegrationRule::cacheKey ( ) const
pure virtual

Returns an unique integer that can be used to uniquelly represent this kind of integration rule (i.e, two objects with the same cache key should return exactly the same set of integration points).

The returned value is used together with an element type as a cache key in closestIntegrationIndex() and in GmShape::gaussExtrapolationMatrix().

Implemented in GmSingleTableIntegrationRule< N >, GmSingleTableIntegrationRule< 3 >, GmLinearMultiTableIntegrationRule< N >, GmLinearMultiTableIntegrationRule< 1 >, GmLinearMultiTableIntegrationRule< 2 >, GmLinearMultiTableIntegrationRule< 3 >, GmProxyBorderIntegrationRule, and GmWedgeGaussIntegrationRule.

◆ closestIntegrationIndex()

const QVector< int > & GmIntegrationRule::closestIntegrationIndex ( GmCellType  type,
int  P,
int  Q,
int  nodeIndex 
) const
virtual

Returns a list with the index of the closest(s) integraion points from nodeIndex.

If more than one integration points are at the same distance to the query index, both will be returned in the list. This function keeps a cache organized by element type / integartion rule storing the list of closests points to a cell node and so, for efficiency, returns a const reference to an internal list.

Parameters
typeThe element type
P,QOrder parameters for hierarchical elements. Used only for those element types (such as GM_HQUADP or GM_HHEXP). Can be set to 0 for "common" element types.
nodeIndexThe (local) index of the query point inside the element.
Returns
Returns a list with the indices of the closets integration points to the node.

All returned points are at the same distance to the node.

◆ instance()

GmIntegrationRule * GmIntegrationRule::instance ( GmCellType  type,
int  P,
int  Q,
GmIntegrationRuleType  irType,
int  rule1 = -1,
int  rule2 = -1,
int  rule3 = -1 
)
static

Instanciates an integration rule for the specified element type using the provided parameters. Returns NULL if the parameter set results in an invalid integration rule.

Parameters P and Q are needed only when working with hierarchical element types, such as GM_HQUADP or GM_HHEXP. They can be set to 0 for "common" element types.

Obs: A call with irType == GM_AUTO_RULE_TYPE and all rules set to -1 will always succeed.

◆ integrationPoint()

virtual void GmIntegrationRule::integrationPoint ( int  index,
GmVector naturalCoord,
double *  weight 
) const
pure virtual

Given an index from 0 to numPoints() - 1, fills naturalCoord and weight with the position and weigth of the given integration point.

After filled, naturalCoord will be a vector with size equal to numNaturalCoord(), which should be equal to the number of natural coordinates of the shape function of the element that this rule will be tied to.

Implemented in GmReducedBarycentricSingleTableIntegrationRule< N >, GmReducedBarycentricSingleTableIntegrationRule< 2 >, GmSingleTableIntegrationRule< N >, GmSingleTableIntegrationRule< 3 >, GmLinearMultiTableIntegrationRule< N >, GmLinearMultiTableIntegrationRule< 1 >, GmLinearMultiTableIntegrationRule< 2 >, GmLinearMultiTableIntegrationRule< 3 >, GmProxyBorderIntegrationRule, and GmWedgeGaussIntegrationRule.

◆ isValid()

virtual bool GmIntegrationRule::isValid ( ) const
pure virtual

Returns true if this is a valid integration rule object, false if not.

An invalid object can be created when an invalid rule number is passed to the constructor of an integration rule. The result of calling a method other then isValid() over an invalid integration rule is undefined.

Implemented in GmSingleTableIntegrationRule< N >, GmSingleTableIntegrationRule< 3 >, GmLinearMultiTableIntegrationRule< N >, GmLinearMultiTableIntegrationRule< 1 >, GmLinearMultiTableIntegrationRule< 2 >, GmLinearMultiTableIntegrationRule< 3 >, GmProxyBorderIntegrationRule, and GmWedgeGaussIntegrationRule.

◆ ruleParNumPoints()

virtual int GmIntegrationRule::ruleParNumPoints ( int  num) const
pure virtual

Returns the number of integration points associated with the given rule parameter. This is usefull for compound rules to access the number of points in each "dimension". For non compound rules, returns the number of points. Keep in mind that following the rulePar way, it returns -1 for a unknown parameter. In a 2 x 3 quad rule, for example, it should return 2 for parameter 0 and 3 for parameter 1. This method is necessary since for Newton Coates rules for tri/tet elements the number of points is NOT equal to the parameter and when combined in a Wedge this information is necessary.

Implemented in GmSingleTableIntegrationRule< N >, GmSingleTableIntegrationRule< 3 >, GmLinearMultiTableIntegrationRule< N >, GmLinearMultiTableIntegrationRule< 1 >, GmLinearMultiTableIntegrationRule< 2 >, GmLinearMultiTableIntegrationRule< 3 >, GmProxyBorderIntegrationRule, and GmWedgeGaussIntegrationRule.


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