G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsPatchRule.h
Go to the documentation of this file.
1
14#pragma once
15
17
18namespace gismo
19{
20
83template<class T>
84class gsPatchRule GISMO_FINAL : public gsQuadRule<T>
85{
86public:
87
88 typedef memory::unique_ptr<gsPatchRule> uPtr;
89
92 :
93 m_basis(nullptr),
94 m_deg(0),
95 m_reg(0),
96 m_over(false),
97 m_fixDir(-1)
98 {};
99
108 gsPatchRule(const gsBasis<T> & basis,
109 const index_t degree,
110 const index_t regularity,
111 const bool overintegrate,
112 const short_t fixDir = -1);
113
115
126 static uPtr make( const gsBasis<T> & basis,
127 const index_t degree,
128 const index_t regularity,
129 const bool overintegrate,
130 const short_t fixDir = -1)
131 { return uPtr( new gsPatchRule(basis,degree,regularity,overintegrate,fixDir) ); }
132
133
138
139public:
140
151 void mapTo( const gsVector<T>& lower, const gsVector<T>& upper,
152 gsMatrix<T> & nodes, gsVector<T> & weights ) const;
153
155 void mapTo( T startVal, T endVal,
156 gsMatrix<T> & nodes, gsVector<T> & weights ) const;
157
159 void mapToAll( const std::vector<T> &,
160 gsMatrix<T> &, gsVector<T> &) const
162
163 index_t dim() const { return m_basis->dim(); }
164
165 gsVector<T> nodes(const index_t d=0) const { return m_nodes.at(d); }
166 gsVector<T> weights(const index_t d=0) const { return m_weights.at(d); }
167
168protected:
169
178 {
179 index_t ndof = (m_deg + 1)*knots.numElements() - (m_reg+1)*(knots.numElements()-1);
180 ndof = static_cast<index_t>(std::ceil(ndof/2.0));
181 return ndof;
182 }
183
191 bool _isSymmetric(const gsKnotVector<T> knots) const
192 {
193 gsKnotVector<T> copy = knots;
194 copy.reverse();
195 std::vector<T> result;
196 knots.symDifference(copy,result);
197 return result.size()==0 ? true : false;
198 }
199
200
212 gsKnotVector<T> _init(const gsBSplineBasis<T> * Bbasis) const;
213
223 std::pair<gsMatrix<T>,gsVector<T> > _integrate(const gsKnotVector<T> & knots ) const;
224
235 std::pair<gsVector<T>,gsVector<T> > _compute(const gsKnotVector<T> & knots,
236 const gsMatrix<T> & greville,
237 const gsVector<T> & integrals,
238 const T tol = 1e-10) const;
239
240private:
241 const gsBasis<T> * m_basis;
242 const index_t m_deg,m_reg;
243 const bool m_over;
244 const short_t m_fixDir;
245
246 std::vector<gsVector<T> > m_nodes;
247 std::vector<gsVector<T> > m_weights;
248
249 gsVector<T> m_end;
250
251 mutable typename gsSparseSolver<T>::QR m_solver;
252
253 size_t m_dim;
254
255 std::vector<std::map<T,T> > m_maps;
256}; // class gsPatchRule
257
258} // namespace gismo
259
260
261#ifndef GISMO_BUILD_LIB
262#include GISMO_HPP_HEADER(gsPatchRule.hpp)
263#endif
A univariate B-spline basis.
Definition gsBSplineBasis.h:700
A basis represents a family of scalar basis functions defined over a common parameter domain.
Definition gsBasis.h:79
Class for representing a knot vector.
Definition gsKnotVector.h:80
void symDifference(const gsKnotVector< T > &other, std::vector< T > &result) const
Computes the symmetric difference between this knot-vector and other.
Definition gsKnotVector.hpp:172
size_t numElements() const
Number of knot intervals inside domain.
Definition gsKnotVector.h:268
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
Class that represents the (tensor) patch quadrature rule.
Definition gsPatchRule.h:85
void mapToAll(const std::vector< T > &, gsMatrix< T > &, gsVector< T > &) const
Not implemented! See gsQuadRule for documentation.
Definition gsPatchRule.h:159
gsPatchRule()
Default empty constructor.
Definition gsPatchRule.h:91
std::pair< gsVector< T >, gsVector< T > > _compute(const gsKnotVector< T > &knots, const gsMatrix< T > &greville, const gsVector< T > &integrals, const T tol=1e-10) const
Computes the points and weights for the patch rule using Newton iterations.
Definition gsPatchRule.hpp:325
static uPtr make(const gsBasis< T > &basis, const index_t degree, const index_t regularity, const bool overintegrate, const short_t fixDir=-1)
Make function returning a smart pointer.
Definition gsPatchRule.h:126
bool _isSymmetric(const gsKnotVector< T > knots) const
Determines whether the specified knot vector is symmetric.
Definition gsPatchRule.h:191
gsKnotVector< T > _init(const gsBSplineBasis< T > *Bbasis) const
Initializes the knot vector for the patch-rule implementation.
Definition gsPatchRule.hpp:210
~gsPatchRule()
Destructor.
Definition gsPatchRule.h:137
index_t _numQuads(const gsKnotVector< T > knots) const
Computes the number of quadrature points to exactly integrate the space.
Definition gsPatchRule.h:177
void mapTo(const gsVector< T > &lower, const gsVector< T > &upper, gsMatrix< T > &nodes, gsVector< T > &weights) const
Maps the points in the d-dimensional cube with points lower and upper.
Definition gsPatchRule.hpp:134
std::pair< gsMatrix< T >, gsVector< T > > _integrate(const gsKnotVector< T > &knots) const
Integrates all basis functions from a knot vector (numerically with Gauss)
Definition gsPatchRule.hpp:292
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
#define short_t
Definition gsConfig.h:35
#define index_t
Definition gsConfig.h:32
#define GISMO_NO_IMPLEMENTATION
Definition gsDebug.h:129
Provides a base class for a quadrature rule.
The G+Smo namespace, containing all definitions for the library.