GemaCoreLib
The GeMA Core library
Loading...
Searching...
No Matches
GmLinearMultiTableIntegrationRule< N > Class Template Reference

A helper class used to combine 1, 2 or 3 single "line" integration rule tables into a multi-dimensional integration rule. The combined rule has the same number of natural coordinates as the number of supplied tables. Also, each rule parameter corresponds to a table and rule degree. More...

#include <gmIntegrationRule.h>

Inheritance diagram for GmLinearMultiTableIntegrationRule< N >:
Collaboration diagram for GmLinearMultiTableIntegrationRule< N >:

Public Member Functions

bool isValid () const
 Returns true if this is a valid integration rule object, false if not.
 
virtual int numPoints () const
 Returns the number of integration points returned by this rule.
 
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 of the given integration point.

 
virtual int numNaturalCoord () const
 Returns the number of natural coordinates used by this integration rule.
 
virtual int degree () const
 Returns the integration degree for this rule (The polynomial degree for which this rule is exact)
 
virtual GmIntegrationRuleType ruleType () const
 Returns the type of the integration rule.
 
virtual QString ruleName () const
 Returns the current ruleName adopted by this integration rule.
 
virtual int rulePar (int num) const
 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
 
virtual int cacheKey () const
 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).
 
void integrationPoint (int index, GmVector &naturalCoord, double *weight) const
 This function returns weights and points to be sampled for 1D quadrature integration.
 
void integrationPoint (int index, GmVector &naturalCoord, double *weight) const
 This function returns weights and points to be sampled for 2D quadrature integration over a quadrilateral with axis Xi and Eta.
 
void integrationPoint (int index, GmVector &naturalCoord, double *weight) const
 This function returns weights and points to be sampled for 3D quadrature integration over a hexahedron with axis Xi, Eta and Zeta.
 
- Public Member Functions inherited from GmIntegrationRule
virtual ~GmIntegrationRule ()
 Virtual destructor.
 
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.
 

Protected Member Functions

 GmLinearMultiTableIntegrationRule (GmIntegrationRuleType ruleType, GmIntegrationRuleCacheKeyBase cacheKeyBase, int rule1, const QVector< QPair< double, double > > *table1, int degree1, int rule2=-1, const QVector< QPair< double, double > > *table2=NULL, int degree2=0, int rule3=-1, const QVector< QPair< double, double > > *table3=NULL, int degree3=0)
 Constructor. Receives the rule type + cache key base, along with the set of rule numbers + the table defining the integration rule in that dimension.
 
- Protected Member Functions inherited from GmIntegrationRule
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.
 

Protected Attributes

GmIntegrationRuleType _rtype
 The rule type.
 
int _degree
 The combined rule degree (the minimum of the individual rule degrees)
 
int _nip
 The number of integration points.
 
int _rules [3]
 The rule numbers. -1 if unused. If a rule is -1, all following rules are also -1.
 
const QVector< QPair< double, double > > * _tables [3]
 Tables with point & weight data for the given rule. NULL if unused. If a table is NULL, all following tables are NULL.
 
GmIntegrationRuleCacheKeyBase _keyBase
 The base cache key.
 

Additional Inherited Members

- Static Public Member Functions inherited from GmIntegrationRule
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.

 

Detailed Description

template<int N>
class GmLinearMultiTableIntegrationRule< N >

A helper class used to combine 1, 2 or 3 single "line" integration rule tables into a multi-dimensional integration rule. The combined rule has the same number of natural coordinates as the number of supplied tables. Also, each rule parameter corresponds to a table and rule degree.

The number of points is equal to the product of the individual table sizes.
The combined rule degree is the minimum of the individual degrees.

The template parameter is the number of tables. It is used so that the integrationPoint() method can be specialized without runtime conditions overhead.

Constructor & Destructor Documentation

◆ GmLinearMultiTableIntegrationRule()

template<int N>
GmLinearMultiTableIntegrationRule< N >::GmLinearMultiTableIntegrationRule ( GmIntegrationRuleType ruleType,
GmIntegrationRuleCacheKeyBase cacheKeyBase,
int rule1,
const QVector< QPair< double, double > > * table1,
int degree1,
int rule2 = -1,
const QVector< QPair< double, double > > * table2 = NULL,
int degree2 = 0,
int rule3 = -1,
const QVector< QPair< double, double > > * table3 = NULL,
int degree3 = 0 )
protected

Constructor. Receives the rule type + cache key base, along with the set of rule numbers + the table defining the integration rule in that dimension.

Creates an invalid object for rules outside the valid range (table == NULL). See comments on GmIntegrationRule::isValid()

Member Function Documentation

◆ cacheKey()

template<int N>
virtual int GmLinearMultiTableIntegrationRule< N >::cacheKey ( ) const
inlinevirtual

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().

Implements GmIntegrationRule.

◆ degree()

template<int N>
virtual int GmLinearMultiTableIntegrationRule< N >::degree ( ) const
inlinevirtual

Returns the integration degree for this rule (The polynomial degree for which this rule is exact)

Implements GmIntegrationRule.

◆ integrationPoint() [1/4]

template<int N>
virtual void GmLinearMultiTableIntegrationRule< N >::integrationPoint ( int index,
GmVector & naturalCoord,
double * weight ) const
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.

Implements GmIntegrationRule.

◆ integrationPoint() [2/4]

void GmLinearMultiTableIntegrationRule< 1 >::integrationPoint ( int index,
GmVector & naturalCoord,
double * weight ) const
virtual

This function returns weights and points to be sampled for 1D quadrature integration.

In 1D, quadrature integration states that the integral from -1 to 1 of F(x) dx is aproximately equal to the sum from i=1 to p of wi * F(xi), where p is the rule number.

See Felippa, chapter 17, eq 17.11 and table 17.1 (pages 17-6 and 17-7) for Gauss rules

Parameters
indexIndex (i, from 0 to numPoints()-1) of the point to be sampled
naturalCoordReturns the point where the function F should be sampled (xi)
weightReturns the weight of this point (wi)

Implements GmIntegrationRule.

◆ integrationPoint() [3/4]

void GmLinearMultiTableIntegrationRule< 2 >::integrationPoint ( int index,
GmVector & naturalCoord,
double * weight ) const
virtual

This function returns weights and points to be sampled for 2D quadrature integration over a quadrilateral with axis Xi and Eta.

In 2D for a quadrilateral, where the function variables are independent, the 2D product rule states that the double integral from -1 to 1 in both variables, Xi and Eta, of F(Xi, Eta) dXi dEta is equal to the sum from i = 1 to p1 of the sum from j = 1 to p2 of wi * wj * F(Xii, Etaj), where p1 is the quadrature rule number in the Xi direction and p2 the rule number in the Eta direction.

See Felippa, chapter 17, eq 17.15 (page 17-8) for Gauss rules.

Parameters
indexIndex (i, from 0 to numPoints()-1) of the point to be sampled
naturalCoordReturns the point where the function F should be sampled (Xii, Etaj)
weightReturns the weight of this point (wi * wj)

Implements GmIntegrationRule.

◆ integrationPoint() [4/4]

void GmLinearMultiTableIntegrationRule< 3 >::integrationPoint ( int index,
GmVector & naturalCoord,
double * weight ) const
virtual

This function returns weights and points to be sampled for 3D quadrature integration over a hexahedron with axis Xi, Eta and Zeta.

In 3D for a hexahedron, where the function variables are independent, the 3D product rule states that the triple integral from -1 to 1 in all variables, Xi, Eta and Zeta, of F(Xi, Eta, Zeta) dXi dEta dZeta is equal to the sum from i = 1 to p1 of the sum from j = 1 to p2 of the sum from k = 1 to p3 of wi * wj * wk * F(Xii, Etaj, Zetak), where p1 is the quadrature rule number in the Xi direction, p2 the rule number in the Eta direction and p3 the rule number in the Zeta direction.

Parameters
indexIndex (i, from 0 to numPoints()-1) of the point to be sampled
naturalCoordReturns the point where the function F should be sampled (Xii, Etaj, Zetak)
weightReturns the weight of this point (wi * wj * wk)

Implements GmIntegrationRule.

◆ isValid()

template<int N>
bool GmLinearMultiTableIntegrationRule< N >::isValid ( ) const
inlinevirtual

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.

Implements GmIntegrationRule.

◆ numNaturalCoord()

template<int N>
virtual int GmLinearMultiTableIntegrationRule< N >::numNaturalCoord ( ) const
inlinevirtual

Returns the number of natural coordinates used by this integration rule.

Implements GmIntegrationRule.

◆ numPoints()

template<int N>
virtual int GmLinearMultiTableIntegrationRule< N >::numPoints ( ) const
inlinevirtual

Returns the number of integration points returned by this rule.

Implements GmIntegrationRule.

◆ ruleName()

template<int N>
virtual QString GmLinearMultiTableIntegrationRule< N >::ruleName ( ) const
inlinevirtual

Returns the current ruleName adopted by this integration rule.

Implements GmIntegrationRule.

◆ rulePar()

template<int N>
virtual int GmLinearMultiTableIntegrationRule< N >::rulePar ( int num) const
inlinevirtual

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.

Implements GmIntegrationRule.

◆ ruleParNumPoints()

template<int N>
virtual int GmLinearMultiTableIntegrationRule< N >::ruleParNumPoints ( int num) const
inlinevirtual

Returns the number of integration points associated with the given rule parameter. This is useful 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.

Implements GmIntegrationRule.

◆ ruleType()

template<int N>
virtual GmIntegrationRuleType GmLinearMultiTableIntegrationRule< N >::ruleType ( ) const
inlinevirtual

Returns the type of the integration rule.

Implements GmIntegrationRule.


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