56 #define PP_EXPAND(x) x
58 #define PP_ARG_N(_1,_2,_3,N,...) N
59 #define PP_RSEQ_N() 3,2,1,0
60 #define PP_NARG_(...) PP_EXPAND(PP_ARG_N(__VA_ARGS__))
61 #define PP_COMMASEQ_N() 1,1,0,0
62 #define PP_COMMA(...) ,
63 #define PP_HASCOMMA(...) PP_NARG_(__VA_ARGS__,PP_COMMASEQ_N())
64 #define PP_NARG(...) PP_NARG_HELPER1(PP_HASCOMMA(__VA_ARGS__),PP_HASCOMMA(PP_COMMA __VA_ARGS__ ()),PP_NARG_(__VA_ARGS__, PP_RSEQ_N()))
65 #define PP_NARG_HELPER1(a,b,N) PP_NARG_HELPER2(a, b, N)
66 #define PP_NARG_HELPER2(a,b,N) PP_NARG_HELPER3_ ## a ## b(N)
67 #define PP_NARG_HELPER3_01(N) 0
68 #define PP_NARG_HELPER3_00(N) 1
69 #define PP_NARG_HELPER3_11(N) N
72 #define __DECn(n, type, name, ...) __DEC ## n(type, name, __VA_ARGS__)
73 #define __DEC0(type, name, void) private: virtual type * name##_impl() const
74 #define __DEC1(type, name, t1) private: virtual type * name##_impl(t1 n1) const
75 #define __DEC2(type, name, t1, t2) private: virtual type * name##_impl(t1 n1, t2 n2) const
78 #define __DEFn(n, type, name, ...) __DEF ## n(type, name, __VA_ARGS__)
79 #define __DEF0(type, name, void) public: inline memory::unique_ptr< type > name() const { return memory::unique_ptr< type >(name##_impl()); }
80 #define __DEF1(type, name, t1) public: inline memory::unique_ptr< type > name(t1 n1) const { return memory::unique_ptr< type >(name##_impl(n1)); }
81 #define __DEF2(type, name, t1, t2) public: inline memory::unique_ptr< type > name(t1 n1, t2 n2) const { return memory::unique_ptr< type >(name##_impl(n1, n2)); }
89 #define GISMO_UPTR_FUNCTION_DEC(type, name, ...) \
90 GISMO_UPTR_FUNCTION_DEC_(PP_NARG(__VA_ARGS__), type, name, __VA_ARGS__)
91 #define GISMO_UPTR_FUNCTION_DEC_(n, type, name, ...) \
92 __DECn(n, type, name, __VA_ARGS__); \
93 __DEFn(n, type, name, __VA_ARGS__)
101 #define GISMO_UPTR_FUNCTION_DEF(type, name, ...) \
102 GISMO_UPTR_FUNCTION_DEF_(PP_NARG(__VA_ARGS__), type, name, __VA_ARGS__)
103 #define GISMO_UPTR_FUNCTION_DEF_(n, type, name, ...) \
104 __DEFn(n, type, name, __VA_ARGS__) \
105 __DECn(n, type, name, __VA_ARGS__)
111 #define GISMO_UPTR_FUNCTION_PURE(type, name, ...) \
112 GISMO_UPTR_FUNCTION_PURE_(PP_NARG(__VA_ARGS__), type, name, __VA_ARGS__)
113 #define GISMO_UPTR_FUNCTION_PURE_(n, type, name, ...) \
114 __DECn(n, type, name, __VA_ARGS__) = 0; \
115 __DEFn(n, type, name, __VA_ARGS__)
121 #define GISMO_UPTR_FUNCTION_NO_IMPLEMENTATION(type, name, ...) \
122 GISMO_UPTR_FUNCTION_NO_IMPLEMENTATION_(PP_NARG(__VA_ARGS__), type, name, __VA_ARGS__)
123 #define GISMO_UPTR_FUNCTION_NO_IMPLEMENTATION_(n, type, name, ...) \
124 __DECn(n, type, name, __VA_ARGS__) { GISMO_NO_IMPLEMENTATION } \
125 __DEFn(n, type, name, __VA_ARGS__)
129 #define GISMO_CLONE_FUNCTION(type) \
130 __DEC0(type, clone, void) { return new type(*this); } \
131 __DEF0(type, clone, void)
135 #define GISMO_OVERRIDE_CLONE_FUNCTION(type) \
136 __DEC0(type, clone, void) override { return new type(*this); } \
137 __DEF0(type, clone, void)
217 template <
typename T>
223 typedef memory::shared_ptr< gsFunctionSet >
Ptr;
226 typedef memory::unique_ptr< gsFunctionSet >
uPtr;
425 bool sameElement =
false)
const;
566 std::pair<short_t, short_t> dimensions()
const {
return std::make_pair(
domainDim(),
targetDim());}
587 virtual std::ostream &
print(std::ostream &os)
const
589 os <<
"gsFunctionSet\n";
597 std::ostream &operator<<(std::ostream &os, const gsFunctionSet<T>& b)
598 {
return b.print(os); }
600 #ifdef GISMO_WITH_PYBIND11
605 void pybind11_init_gsFunctionSet(pybind11::module &m);
607 #endif // GISMO_WITH_PYBIND11
612 #ifndef GISMO_BUILD_LIB
613 #include GISMO_HPP_HEADER(gsFunctionSet.hpp)
gsMatrix< T > deriv2(const gsMatrix< T > &u) const
Evaluates the second derivatives of active (i.e., non-zero) functions at points u.
Definition: gsFunctionSet.hpp:138
virtual std::ostream & print(std::ostream &os) const
Prints the object as a string.
Definition: gsFunctionSet.h:587
#define GISMO_NO_IMPLEMENTATION
Definition: gsDebug.h:129
virtual void compute(const gsMatrix< T > &in, gsFuncData< T > &out) const
Computes function data.
Definition: gsFunctionSet.hpp:175
gsMatrix< index_t > active(const gsMatrix< T > &u) const
Returns the indices of active (nonzero) functions at points u, as a list of indices.
Definition: gsFunctionSet.h:453
#define short_t
Definition: gsConfig.h:35
virtual void evalAllDers_into(const gsMatrix< T > &u, int n, std::vector< gsMatrix< T > > &result, bool sameElement=false) const
Evaluate the nonzero functions and their derivatives up to order n at points u into result...
Definition: gsFunctionSet.hpp:81
gsMatrix< T > deriv(const gsMatrix< T > &u) const
Evaluate the derivatives,.
Definition: gsFunctionSet.hpp:129
virtual index_t size() const
size
Definition: gsFunctionSet.h:578
gsMatrix< T > eval(const gsMatrix< T > &u) const
Evaluate the function,.
Definition: gsFunctionSet.hpp:120
#define index_t
Definition: gsConfig.h:32
A function from a n-dimensional domain to an m-dimensional image.
Definition: gsFunction.h:59
memory::shared_ptr< gsFunctionSet > Ptr
Shared pointer for gsFunctionSet.
Definition: gsFunctionSet.h:223
virtual short_t targetDim() const
Dimension of the target space.
Definition: gsFunctionSet.h:560
virtual const gsFunctionSet & piece(const index_t) const
Returns the piece(s) of the function(s) at subdomain k.
Definition: gsFunctionSet.h:239
memory::unique_ptr< gsFunctionSet > uPtr
Unique pointer for gsFunctionSet.
Definition: gsFunctionSet.h:226
virtual void active_into(const gsMatrix< T > &u, gsMatrix< index_t > &result) const
Indices of active (non-zero) function(s) for each point.
Definition: gsFunctionSet.hpp:56
const gsBasis< T > & basis(const index_t k) const
Helper which casts and returns the k-th piece of this function set as a gsBasis.
Definition: gsFunctionSet.hpp:33
virtual short_t domainDim() const =0
Dimension of the (source) domain.
Interface for the set of functions defined on a domain (the total number of functions in the set equa...
Definition: gsFuncData.h:23
virtual void deriv2_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Second derivatives.
Definition: gsFunctionSet.hpp:77
uPtr clone()
Clone methode. Produceds a deep copy inside a uPtr.
virtual index_t nPieces() const
Number of pieces in the domain of definition.
Definition: gsFunctionSet.h:584
This is the main header file that collects wrappers of Eigen for linear algebra.
std::vector< gsMatrix< T > > evalAllDers(const gsMatrix< T > &u, int n, bool sameElement=false) const
Evaluate all derivatives upto order n,.
Definition: gsFunctionSet.hpp:111
virtual void deriv_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
First derivatives.
Definition: gsFunctionSet.hpp:73
A basis represents a family of scalar basis functions defined over a common parameter domain...
Definition: gsBasis.h:78
virtual void eval_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluates the function(s).
Definition: gsFunctionSet.hpp:66