G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsMonomialBasis.h
1 
2 #pragma once
3 
4 #include <iostream>
5 #include <gsCore/gsBasis.h>
6 
7 
8 namespace gismo
9 {
10 
22 template<class T>
23 class gsMonomialBasis : public gsBasis<T>
24 {
25 public:
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
160 private:
163 
164 }; // class gsMonomialBasis
165 
166 } // namespce gismo
167 
168 
169 #include <gsPolynomial/gsMonomialBasis.hpp>
virtual gsMatrix< T > support() const
Returns (a bounding box for) the domain of the whole basis. Returns a 1 x 2 matrix, containing the two diagonally extreme corners of a hypercube.
Definition: gsMonomialBasis.h:123
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
Abstract base class representing a geometry map.
Definition: gsGeometry.h:92
gsMonomialBasis()
Default constructor, which sets the degree to 0.
Definition: gsMonomialBasis.h:36
virtual index_t size() const
Returns the numer of basis functions.
Definition: gsMonomialBasis.hpp:35
#define short_t
Definition: gsConfig.h:35
memory::shared_ptr< gsMonomialBasis > Ptr
Shared pointer for gsMonomialBasis.
Definition: gsMonomialBasis.h:27
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::unique_ptr< gsMonomialBasis > uPtr
Unique pointer for gsMonomialBasis.
Definition: gsMonomialBasis.h:30
Provides declaration of Basis abstract interface.
virtual short_t domainDim() const
Returns the dimension of the parameter domain.
Definition: gsMonomialBasis.hpp:20
#define index_t
Definition: gsConfig.h:32
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition: gsMatrix.h:38
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
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
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
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition: gsVector.h:35
virtual void eval_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluates the basis functions at values u.
Definition: gsMonomialBasis.hpp:47
virtual std::ostream & print(std::ostream &os) const
Prints the object as a string.
Definition: gsMonomialBasis.hpp:26
An univariate monomial polynomial basis. If the degree is p the basis is given by: [ 1...
Definition: gsMonomialBasis.h:23
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 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
short_t m_p
Degree.
Definition: gsMonomialBasis.h:162
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 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
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
short_t deg() const
Returns the degree of the basis (non-virtual)
Definition: gsMonomialBasis.h:64
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 short_t degree() const
Returns the degree of the basis.
Definition: gsMonomialBasis.h:59
A basis represents a family of scalar basis functions defined over a common parameter domain...
Definition: gsBasis.h:78
static const int Dim
Dimension of the parameter domain.
Definition: gsMonomialBasis.h:33
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
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