G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsMonomialBasis.h
1
2#pragma once
3
4#include <iostream>
5#include <gsCore/gsBasis.h>
6
7
8namespace gismo
9{
10
22template<class T>
23class gsMonomialBasis : public gsBasis<T>
24{
25public:
27 typedef memory::shared_ptr< gsMonomialBasis > Ptr;
28
30 typedef memory::unique_ptr< gsMonomialBasis > uPtr;
31
33 static const int Dim = 1;
34
37 { }
38
41 explicit gsMonomialBasis(int degree);
42
43 // Pure virtual member functions required by the base class
45 virtual short_t domainDim() const;
46
47 GISMO_CLONE_FUNCTION(gsMonomialBasis)
48
49 virtual memory::unique_ptr<gsGeometry<T> > makeGeometry( gsMatrix<T> coefs ) const;
51 virtual std::ostream &print(std::ostream &os) const;
53 virtual index_t size() const;
54
55
56 // Virtual member functions of the base class which need to be redefined
57
59 virtual short_t degree() const { return m_p; }
60
61 virtual short_t setDegree() const { return m_p; } // TODO: really?
62
64 inline short_t deg() const { return m_p; }
65
66 void active_into(const gsMatrix<T> & u, gsMatrix<index_t>& result) const
67 {
68 result.resize(m_p+1,u.cols());
69 result.colwise() =
70 gsVector<index_t>::LinSpaced(m_p+1, 0, m_p); //.template cast<unsigned>();
71 }
72
77 virtual void eval_into(const gsMatrix<T> & u, gsMatrix<T>& result) const;
78
80 virtual void evalSingle_into(index_t i, const gsMatrix<T> & u, gsMatrix<T>& result) const;
81
86 virtual void deriv_into(const gsMatrix<T> & u, gsMatrix<T>& result ) const;
87
89 virtual void derivSingle_into(index_t i, const gsMatrix<T> & u, gsMatrix<T>& result ) const;
90
95 virtual void deriv2_into(const gsMatrix<T> & u, gsMatrix<T>& result ) const;
96
98 virtual void deriv2Single_into(index_t i, const gsMatrix<T> & u, gsMatrix<T>& result ) const;
99
106 virtual void evalAllDers_into(const gsMatrix<T> & u, int n, gsMatrix<T>& result) const;
112 virtual void evalAllDersSingle_into(index_t i, const gsMatrix<T> & u, int n, gsMatrix<T>& result) const;
113
118 virtual void evalDerSingle_into(index_t i, const gsMatrix<T> & u, int n, gsMatrix<T>& result) const;
119
123 virtual gsMatrix<T> support() const
124 {
126 support<<0, 1;
127 return support;
128 }
129
133 virtual gsMatrix<T> support(const index_t & ) const
134 {
136 support<<0, 1;
137 return support;
138 }
139
140 short_t degree(short_t i) const { return m_p; }
141
153 virtual void evalFunc_into(const gsMatrix<T> & u,
154 const gsMatrix<T> & coefs,
155 gsMatrix<T>& result) const;
156
157
158
159// Data members
160private:
163
164}; // class gsMonomialBasis
165
166} // namespce gismo
167
168
169#include <gsPolynomial/gsMonomialBasis.hpp>
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
An univariate monomial polynomial basis. If the degree is p the basis is given by: [ 1,...
Definition gsMonomialBasis.h:24
virtual void deriv2_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluates the second derivative of the basis functions at values u.
Definition gsMonomialBasis.hpp:105
virtual void evalFunc_into(const gsMatrix< T > &u, const gsMatrix< T > &coefs, gsMatrix< T > &result) const
Evaluate the function described by coefs at points u, i.e., evaluates a linear combination of coefs x...
Definition gsMonomialBasis.hpp:207
virtual void evalAllDersSingle_into(index_t i, const gsMatrix< T > &u, int n, gsMatrix< T > &result) const
Evaluates all derivatives up to order n of the i-th basis function at values u.
Definition gsMonomialBasis.hpp:161
memory::shared_ptr< gsMonomialBasis > Ptr
Shared pointer for gsMonomialBasis.
Definition gsMonomialBasis.h:27
virtual gsMatrix< T > support(const index_t &) const
Returns (a bounding box for) the support of the i-th basis function. Returns a 1 x 2 matrix,...
Definition gsMonomialBasis.h:133
gsMonomialBasis()
Default constructor, which sets the degree to 0.
Definition gsMonomialBasis.h:36
virtual void evalSingle_into(index_t i, const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluates the i-th basis function at values u.
Definition gsMonomialBasis.hpp:61
virtual memory::unique_ptr< gsGeometry< T > > makeGeometry(gsMatrix< T > coefs) const
Create a gsGeometry of proper type for this basis with the given coefficient matrix.
Definition gsMonomialBasis.hpp:41
short_t m_p
Degree.
Definition gsMonomialBasis.h:162
memory::unique_ptr< gsMonomialBasis > uPtr
Unique pointer for gsMonomialBasis.
Definition gsMonomialBasis.h:30
short_t degree(short_t i) const
Degree with respect to the i-th variable. If the basis is a tensor product of (piecewise) polynomial ...
Definition gsMonomialBasis.h:140
virtual gsMatrix< T > support() const
Returns (a bounding box for) the domain of the whole basis. Returns a 1 x 2 matrix,...
Definition gsMonomialBasis.h:123
virtual void eval_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluates the basis functions at values u.
Definition gsMonomialBasis.hpp:47
virtual index_t size() const
Returns the numer of basis functions.
Definition gsMonomialBasis.hpp:35
short_t deg() const
Returns the degree of the basis (non-virtual)
Definition gsMonomialBasis.h:64
void active_into(const gsMatrix< T > &u, gsMatrix< index_t > &result) const
Returns the indices of active basis functions at points u, as a list of indices, in result....
Definition gsMonomialBasis.h:66
virtual short_t domainDim() const
Returns the dimension of the parameter domain.
Definition gsMonomialBasis.hpp:20
virtual void evalAllDers_into(const gsMatrix< T > &u, int n, gsMatrix< T > &result) const
Evaluates all derivatives up to order n of the basis functions at values u.
Definition gsMonomialBasis.hpp:139
virtual void deriv_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluates the derivative of the basis functions at values u.
Definition gsMonomialBasis.hpp:73
virtual std::ostream & print(std::ostream &os) const
Prints the object as a string.
Definition gsMonomialBasis.hpp:26
virtual short_t degree() const
Returns the degree of the basis.
Definition gsMonomialBasis.h:59
virtual void deriv2Single_into(index_t i, const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluates the second derivatives of the i-th basis function at values u.
Definition gsMonomialBasis.hpp:123
static const int Dim
Dimension of the parameter domain.
Definition gsMonomialBasis.h:33
virtual void evalDerSingle_into(index_t i, const gsMatrix< T > &u, int n, gsMatrix< T > &result) const
Evaluates the derivative of order n of the i-th basis function at values u.
Definition gsMonomialBasis.hpp:185
virtual void derivSingle_into(index_t i, const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluates the derivatives of the i-th basis function at values u.
Definition gsMonomialBasis.hpp:89
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
Provides declaration of Basis abstract interface.
#define short_t
Definition gsConfig.h:35
#define index_t
Definition gsConfig.h:32
The G+Smo namespace, containing all definitions for the library.