Xfem
The Xfem Plugin
Loading...
Searching...
No Matches
xfemIntegrationRule.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 _GEMA_XFEM_INTRULE_H_
25#define _GEMA_XFEM_INTRULE_H_
26
27#include <gmCellType.h>
28#include <gmIntegrationRule.h>
29#include <gmMatrix.h>
30
31#include <QVector>
32
33class GmShape;
34class XfemMesh;
35
38{
39public:
40
41 XfemIntegrationRule(int ncoord, int npoints = 0);
42
43 virtual ~XfemIntegrationRule();
44
49 virtual bool isValid() const { return numPoints() > 0; }
50
51 // See comments on the base class
52 virtual int numPoints() const { return _ipList.count(); }
53
54 virtual void integrationPoint(int index, GmVector& naturalCoord, double* weight) const;
55
57 virtual int subElement(int index) const { return _subElemList.at(index); }
58
59 // See comments on the base class
60 virtual int numNaturalCoord() const { return _ncoord; }
61
63 virtual int degree() const { return 0; }
64
65 // Returns the integration rule type. Always returns 0. Can we do better?
66 virtual GmIntegrationRuleType ruleType() const { return (GmIntegrationRuleType)0; }
67
69 virtual QString ruleName() const { return "xfem"; }
70
71 // See comments on the base class
72 virtual int cacheKey() const { return GM_USER_IR_KEY + _internalId; /* TODO: Is this really a good implementation? Do we have another way? */ }
73
74 // See comments on the base class
75 virtual int rulePar(int num) const { Q_UNUSED(num); return -1; }
76
77 // See comments on the base class
78 virtual int ruleParNumPoints(int num) const { Q_UNUSED(num); return -1; }
79
80 void clearPoints();
81 void setNumPoints(int npoints);
82
83 void setIntegrationPoint (int index, const GmVector& naturalCoord, double weight, int subElement);
84 void addIntegrationPoint (const GmVector& naturalCoord, double weight, int subElement);
85 void removeIntegrationPoints(int firstIndex, int num, int seOffset);
86
87 void addIntegrationPoints(GmCellType type, GmCellType seType, const GmMatrix& seNaturalCoords,
88 const GmIntegrationRule* seIr, int subElement);
89 void setIntegrationPoints(int firstIndex, GmCellType type, GmCellType seType,
90 const GmMatrix& seNaturalCoords, const GmIntegrationRule* seIr, int subElement);
91
92private:
94 int nextCacheKey() const { static int globalXfemIrId = 0; return globalXfemIrId++; }
95
96 void fillSubelementIntegrationPoint(GmCellType type, GmCellType seType, const GmShape* seShape,
97 const GmMatrix& seNaturalCoords, const GmIntegrationRule* seIr,
98 int ipIndex, QPair<GmVector, double>& ipData);
99
104};
105
106
107#endif
108
A special integration rule for handling refined xfem elements.
Definition xfemIntegrationRule.h:38
virtual QString ruleName() const
Returns the current ruleName adopted by this integration rule. Always returns "xfem".
Definition xfemIntegrationRule.h:69
int nextCacheKey() const
Returns the next available cache key.
Definition xfemIntegrationRule.h:94
QVector< int > _subElemList
A list storing the subelement that each ip belongs to.
Definition xfemIntegrationRule.h:103
virtual ~XfemIntegrationRule()
Destructor.
Definition xfemIntegrationRule.cpp:71
void setIntegrationPoint(int index, const GmVector &naturalCoord, double weight, int subElement)
Updates the value, weight and sub-element of an existing integration point.
Definition xfemIntegrationRule.cpp:134
virtual bool isValid() const
Returns true if this is a valid integration rule object, false if not.
Definition xfemIntegrationRule.h:49
virtual int degree() const
Returns the integration degree for this rule. Always returns 0.
Definition xfemIntegrationRule.h:63
void addIntegrationPoints(GmCellType type, GmCellType seType, const GmMatrix &seNaturalCoords, const GmIntegrationRule *seIr, int subElement)
Adds a set of integration points corresponding to the default integration points of a sub element of ...
Definition xfemIntegrationRule.cpp:218
virtual int subElement(int index) const
Returns the sub-element number that contains the given integration point.
Definition xfemIntegrationRule.h:57
int _internalId
An unique internal id used as cache key for Xfem integration rules.
Definition xfemIntegrationRule.h:100
void setNumPoints(int npoints)
Adjust the number of integration points to the requested number, adding new entries if necessary....
Definition xfemIntegrationRule.cpp:103
int _ncoord
The number of coordinates in each integration point.
Definition xfemIntegrationRule.h:101
void setIntegrationPoints(int firstIndex, GmCellType type, GmCellType seType, const GmMatrix &seNaturalCoords, const GmIntegrationRule *seIr, int subElement)
Updates the set of integration points corresponding to the default integration points of a sub elemen...
Definition xfemIntegrationRule.cpp:284
void fillSubelementIntegrationPoint(GmCellType type, GmCellType seType, const GmShape *seShape, const GmMatrix &seNaturalCoords, const GmIntegrationRule *seIr, int ipIndex, QPair< GmVector, double > &ipData)
Auxiliary function used by addIntegrationPoints() and setIntegrationPoints() to compute the position ...
Definition xfemIntegrationRule.cpp:322
void addIntegrationPoint(const GmVector &naturalCoord, double weight, int subElement)
Adds a new integration point to the rule.
Definition xfemIntegrationRule.cpp:151
void clearPoints()
Removes all registered integration points from the rule, making it into an invalid rule.
Definition xfemIntegrationRule.cpp:90
QVector< QPair< GmVector, double > > _ipList
The list of integration points and their weights.
Definition xfemIntegrationRule.h:102
XfemIntegrationRule(int ncoord, int npoints=0)
Builds an integration rule that returns integration points with the specified number of natural coord...
Definition xfemIntegrationRule.cpp:49
void removeIntegrationPoints(int firstIndex, int num, int seOffset)
Removes the given range of integration points from the list.
Definition xfemIntegrationRule.cpp:170
Basic class for a XFEM mesh. This is the basic mesh interface for xfem problems adding enrichment cap...
Definition xfemMesh.h:50
GmCellType
GM_USER_IR_KEY
GmIntegrationRuleType
arma::mat GmMatrix
arma::vec GmVector
const T & at(int i) const const
int count(const T &value) const const