G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsMappedSingleSpline.h
Go to the documentation of this file.
1 
14 #pragma once
15 
16 #include <gsCore/gsGeometry.h>
19 
20 namespace gismo
21 {
22 
23 template<short_t d,class T> class gsMappedSpline;
24 
33 template<short_t d,class T>
35 {
36 private:
37  typedef gsFunction<T> Base;
38 
40 
41 public:
43  typedef memory::shared_ptr< gsMappedSingleSpline > Ptr;
44 
46  typedef memory::unique_ptr< gsMappedSingleSpline > uPtr;
47 
48 private:
50  gsMappedSingleSpline() : m_spline(nullptr) { }
51 
52 public:
53 
55  gsMappedSingleSpline(gsMappedSpline<d,T> * spline, unsigned const & i = 0)
56  : m_spline(spline),m_index(i)
57  {
58  GISMO_ASSERT( i<unsigned(m_spline->nPatches()),"Invalid spline function index" );
59  }
60 
61  gsMappedSingleSpline( const gsMappedSingleSpline& other ) : Base( other )
62  {
63  m_spline = other.m_spline;
64  m_index = other.m_index;
65  }
66 
67  static uPtr make( const gsMappedSingleSpline& other)
68  { return uPtr( new gsMappedSingleSpline( other ) ); }
69 
70  ~gsMappedSingleSpline() { } //destructor
71 
72  GISMO_BASIS_ACCESSORS
73 
74 public:
75 
77  {
78  return d;
79  }
80 
82  { return m_spline->m_global.cols(); }
83 
85  void eval_into(const gsMatrix<T> & u, gsMatrix<T>& result) const
86  {
87  // m_spline->evalGlobal_into(m_index,u,result);
88  m_spline->eval_into(m_index,u,result);
89  }
90 
92  void deriv_into(const gsMatrix<T> & u, gsMatrix<T>& result ) const
93  {
94  m_spline->deriv_into(m_index,u,result);
95  }
96 
98  void deriv2_into(const gsMatrix<T> & u, gsMatrix<T>& result ) const
99  {
100  m_spline->deriv2_into(m_index,u,result);
101  }
102 
105  void evalAllDers_into(const gsMatrix<T> & u, int n, std::vector<gsMatrix<T> >& result,
106  bool sameElement = false) const
107  {
108  m_spline->evalAllDers_into(m_index,u,n,result,sameElement);
109  }
110 
111  // support (domain of definition)
112  gsMatrix<T> support() const
113  { return m_spline->supportOf(m_index); }
114 
115 
116  GISMO_CLONE_FUNCTION(gsMappedSingleSpline)
117 
118  std::ostream &print(std::ostream &os) const
119  {
120  GISMO_UNUSED(os);
122  }
123 
125  // Virtual member that may be implemented or not by the derived class
127 
130  {
131  return m_spline->degree(m_index,i);
132  }
133 
136  void setPiece( unsigned const & i )
137  {
138  GISMO_ASSERT( i<unsigned(m_spline->nPatches()),"Invalid spline index" );
139  m_index = i;
140  }
141 
142  void setSource(gsMappedSpline<d,T> & s)
143  { m_spline = &s; }
144 
145 // Data members
146 private:
147  gsMappedSpline<d,T> * m_spline;
148  mutable index_t m_index;
149 
150 }; // class gsMappedSingleSpline
151 
152 
153 } // namespace gismo
Class gsMappedSingleSpline represents an individual .....of a.
Definition: gsMappedSingleSpline.h:34
#define GISMO_NO_IMPLEMENTATION
Definition: gsDebug.h:129
Class gsMappedSingleBasis represents an indivisual .....of a.
Definition: gsMappedBasis.h:29
#define short_t
Definition: gsConfig.h:35
short_t domainDim() const
Dimension of the (source) domain.
Definition: gsMappedSingleSpline.h:76
Provides declaration of Geometry abstract interface.
#define index_t
Definition: gsConfig.h:32
A function from a n-dimensional domain to an m-dimensional image.
Definition: gsFunction.h:59
void deriv2_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluates the (partial) derivatives of the nonzero spline functions at points u into result...
Definition: gsMappedSingleSpline.h:98
void deriv_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluates the (partial) derivatives of non-zero spline functions at (the columns of) u...
Definition: gsMappedSingleSpline.h:92
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
void evalAllDers_into(const gsMatrix< T > &u, int n, std::vector< gsMatrix< T > > &result, bool sameElement=false) const
Evaluate the nonzero spline functions and their derivatives up to order n at points u into result...
Definition: gsMappedSingleSpline.h:105
gsMappedSingleSpline(gsMappedSpline< d, T > *spline, unsigned const &i=0)
Construct a spline function by a pointer to a spline and an index i.
Definition: gsMappedSingleSpline.h:55
Implementation of a piece of the gsMappedBasis.
Interface for the set of functions defined on a domain (the total number of functions in the set equa...
Definition: gsFuncData.h:23
void setPiece(unsigned const &i)
Definition: gsMappedSingleSpline.h:136
Provides declaration of Basis abstract interface.
void eval_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluates the non-zero spline functions at value u.
Definition: gsMappedSingleSpline.h:85
memory::unique_ptr< gsMappedSingleSpline > uPtr
Unique pointer for gsMappedSingleSpline.
Definition: gsMappedSingleSpline.h:46
short_t targetDim() const
Dimension of the target space.
Definition: gsMappedSingleSpline.h:81
std::ostream & print(std::ostream &os) const
Prints the object as a string.
Definition: gsMappedSingleSpline.h:118
#define GISMO_UNUSED(x)
Definition: gsDebug.h:112
short_t degree(short_t i) const
Returns the polynomial degree.
Definition: gsMappedSingleSpline.h:129
memory::shared_ptr< gsMappedSingleSpline > Ptr
Shared pointer for gsMappedSingleSpline.
Definition: gsMappedSingleSpline.h:43
gsMappedSingleSpline()
Default empty constructor.
Definition: gsMappedSingleSpline.h:50