G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsMvLegandreBasis.h
1#pragma once
2#include <cmath>
3
4//#include <gismo.h>
6//#include "gsMvLegendreBasis.hpp"
8
9namespace gismo
10{
11
12// forward declaration
13template< class T> class gsMvLegendreBasis;
14template <class T> class gsMvLegendrePoly;
15
23template<class T>
24class gsMvLegendreBasis : public gsBasis<T>
25{
26public:
27 typedef gsBasis<T> Base;
28
30 typedef T Scalar_t;
31
33 typedef gsMvLegendrePoly<T> GeometryType;
34
37
39 static const int Dim = 1;
40
42 typedef memory::shared_ptr< gsMvLegendreBasis > Ptr;
43
45 typedef memory::unique_ptr< gsMvLegendreBasis > uPtr;
46
47 static Ptr Make ( const gsVector<T> & vec, const T & start, const T & end) // TODO: remove?
48 { return Ptr( new gsMvLegendreBasis(vec,start,end) ); }
49
50public:
52 explicit gsMvLegendreBasis (const index_t deg, const T & start = 1, const T & end = 1) :
53 m_ubasis(deg,start, m_end)
54 { }
55
56public:
57
59 int dim() const { return Dim; }
60
63 void active_into(const gsMatrix<T> & u, gsMatrix<index_t>& result) const;
64
66 void numActive_into(const gsMatrix<T> & u, gsVector<index_t>& result) const
67 {
68 result.setConstant(1, u.cols(), m_p+1);
69 }
70
73 {
74 gsMatrix<T> res(1,2);
75 res << m_start , m_end ;
76 return res;
77 }
78
80 gsMatrix<T> support(const index_t & i) const
81 {
82 return support();
83 }
84
86 void eval_into(const gsMatrix<T> & u, gsMatrix<T>& result) const;
87
89 void deriv_into(const gsMatrix<T> & u, gsMatrix<T>& result ) const;
90
93 void deriv2_into(const gsMatrix<T> & u, gsMatrix<T>& result ) const;
94
95 GISMO_CLONE_FUNCTION(gsMvLegendreBasis)
96
97 GISMO_MAKE_GEOMETRY_NEW
98
100 std::ostream &print(std::ostream &os) const
101 {
102 os << "MvLegendre Basis: deg=" << this->degree()
103 << ", size="<< this->size()
104 << ", interval= [" << m_start << "," << m_end << "].\n";
105 return os;
106 }
107
109 int size() const { return m_p+1; }
110
115
118 {
119 return m_p;
120 }
121
122private:
123
124 inline T _getA(const index_t j)
125 {
126 return (T)(2*j-1)/j;
127 return math::sqrt((T)(2*j-1)) * math::sqrt((T)(2*j+1)) / (j*math::sqrt((T)3));
128 }
129
130 inline T _getB(const index_t j)
131 {
132 return 0;
133 }
134
135 inline T _getC(const index_t j)
136 {
137 return (T)(j-1)/j;
138 return _getA(j) / _getA(j-1);
139 }
140
141private:
142 gsLegendreBasis<T> m_ubasis;
143}; // class gsMvLegendreBasis
144
145} // namespace gismo
146
147
148//include the hpp file that contains the file definitions
149//#include "gsMvLegendreBasis.hpp"
150
A basis represents a family of scalar basis functions defined over a common parameter domain.
Definition gsBasis.h:79
Class representing a domain. i.e. a collection of elements (triangles, rectangles,...
Definition gsDomain.h:32
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
A multivariate Legendre basis.
Definition gsMvLegandreBasis.h:25
void deriv2_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
memory::shared_ptr< gsMvLegendreBasis > Ptr
Shared pointer for gsMvLegendreBasis.
Definition gsMvLegandreBasis.h:42
GISMO_MAKE_GEOMETRY_NEW std::ostream & print(std::ostream &os) const
Prints the object as a string.
Definition gsMvLegandreBasis.h:100
void numActive_into(const gsMatrix< T > &u, gsVector< index_t > &result) const
Returns the number of active (nonzero) basis functions at points u in result.
Definition gsMvLegandreBasis.h:66
gsMvLegendrePoly< T > GeometryType
Associated geometry type.
Definition gsMvLegandreBasis.h:33
T Scalar_t
Coefficient type.
Definition gsMvLegandreBasis.h:30
void eval_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluates the non-zero basis functions at value u.
void active_into(const gsMatrix< T > &u, gsMatrix< index_t > &result) const
gsMvLegendreBasis< T > BoundaryBasisType
Associated Boundary basis type.
Definition gsMvLegandreBasis.h:36
int dim() const
Returns the dimension d of the parameter space.
Definition gsMvLegandreBasis.h:59
gsMvLegendreBasis(const index_t deg, const T &start=1, const T &end=1)
Construct MvLegendre basis along the parameter pars and Interval [start,end].
Definition gsMvLegandreBasis.h:52
gsMatrix< T > support(const index_t &i) const
Returns a bounding box for the basis' domain.
Definition gsMvLegandreBasis.h:80
memory::unique_ptr< gsMvLegendreBasis > uPtr
Unique pointer for gsMvLegendreBasis.
Definition gsMvLegandreBasis.h:45
void deriv_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluates the (partial) derivatives of non-zero basis functions at (the columns of) u.
gsMatrix< T > support() const
Returns a bounding box for the basis' domain.
Definition gsMvLegandreBasis.h:72
gsDomain< T > * domain() const
Definition gsMvLegandreBasis.h:113
static const int Dim
Dimension of the parameter domain.
Definition gsMvLegandreBasis.h:39
short_t degree() const
Returns the polynomial degree.
Definition gsMvLegandreBasis.h:117
int size() const
Returns the number of basis functions in the basis.
Definition gsMvLegandreBasis.h:109
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
Provides combinatorial unitilies.
#define short_t
Definition gsConfig.h:35
#define index_t
Definition gsConfig.h:32
#define GISMO_NO_IMPLEMENTATION
Definition gsDebug.h:129
Provides forward declarations of types and structs.
The G+Smo namespace, containing all definitions for the library.