G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsOverIntegrateRule.h
Go to the documentation of this file.
1
14#pragma once
15
17#include <gsCore/gsBasis.h>
18
19namespace gismo
20{
21
29template<class T>
30class gsOverIntegrateRule GISMO_FINAL : public gsQuadRule<T>
31{
32public:
33
34 typedef memory::unique_ptr<gsOverIntegrateRule> uPtr;
35
38 :
39 m_basis(nullptr),
40 m_interior(),
41 m_boundary()
42 {}
43
54 const std::vector<gsQuadRule<T> > & quadInterior,
55 const std::vector<gsQuadRule<T> > & quadBoundary)
56 :
57 m_basis(&basis),
58 m_interior(quadInterior),
59 m_boundary(quadBoundary)
60 {
61 std::vector< gsVector<T> > nodes(m_basis->dim());
62 m_start = m_basis->support().col(0);
63 m_end = m_basis->support().col(1);
64 };
65
75 static uPtr make( const gsBasis<T> & basis,
76 const std::vector<gsQuadRule<T> > & quadInterior,
77 const std::vector<gsQuadRule<T> > & quadBoundary )
78 { return uPtr( new gsOverIntegrateRule(basis,quadInterior,quadBoundary) ); }
79
80 //const unsigned digits = std::numeric_limits<T>::digits10 );
81
83
84public:
86 index_t dim() const { return m_basis->dim(); }
87
96 using gsQuadRule<T>::mapTo;
97 void mapTo( const gsVector<T>& lower, const gsVector<T>& upper,
98 gsMatrix<T> & nodes, gsVector<T> & weights ) const
99 {
100
101 gsVector<T> bot = lower-m_start;
102 gsVector<T> top = upper-m_end;
103 std::vector<gsVector<T> > elNodes(m_basis->dim());
104 std::vector<gsVector<T> > elWeights(m_basis->dim());
105 gsMatrix<T> tmp;
106 for (index_t d = 0; d!=dim(); d++)
107 {
108 if (bot[d]==0.0 || top[d]==0.0) // is the coordinate on a side?
109 {
110 m_boundary[d].mapTo( lower[d], upper[d], tmp, elWeights[d]);
111 GISMO_ASSERT(tmp.rows()==1,"Dimension of the nodes is wrong!");
112 elNodes[d] = tmp.transpose();
113 }
114 else
115 {
116 m_interior[d].mapTo( lower[d], upper[d], tmp, elWeights[d]);
117 GISMO_ASSERT(tmp.rows()==1,"Dimension of the nodes is wrong!");
118 elNodes[d] = tmp.transpose();
119 }
120 }
121 this->computeTensorProductRule_into(elNodes,elWeights,nodes,weights);
122 }
123
124private:
125 const gsBasis<T> * m_basis;
126 std::vector<gsQuadRule<T> > m_interior, m_boundary;
127 gsVector<T> m_start,m_end;
128
129}; // class gsOverIntegrateRule
130
131} // namespace gismo
A basis represents a family of scalar basis functions defined over a common parameter domain.
Definition gsBasis.h:79
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
Class that defines a mixed quadrature rule with different rules for the interior and the boundaries.
Definition gsOverIntegrateRule.h:31
gsOverIntegrateRule(const gsBasis< T > &basis, const std::vector< gsQuadRule< T > > &quadInterior, const std::vector< gsQuadRule< T > > &quadBoundary)
Constructor.
Definition gsOverIntegrateRule.h:53
index_t dim() const
Dimension of the rule.
Definition gsOverIntegrateRule.h:86
gsOverIntegrateRule()
Default empty constructor.
Definition gsOverIntegrateRule.h:37
void mapTo(const gsVector< T > &lower, const gsVector< T > &upper, gsMatrix< T > &nodes, gsVector< T > &weights) const
Maps quadrature rule (i.e., points and weights) from the reference domain to an element.
Definition gsOverIntegrateRule.h:97
static uPtr make(const gsBasis< T > &basis, const std::vector< gsQuadRule< T > > &quadInterior, const std::vector< gsQuadRule< T > > &quadBoundary)
Construct a smart-pointer to the rule.
Definition gsOverIntegrateRule.h:75
Class representing a reference quadrature rule.
Definition gsQuadRule.h:29
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
Provides declaration of Basis abstract interface.
#define index_t
Definition gsConfig.h:32
#define GISMO_ASSERT(cond, message)
Definition gsDebug.h:89
Provides a base class for a quadrature rule.
The G+Smo namespace, containing all definitions for the library.