G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsAffineFunction.h
Go to the documentation of this file.
1 
15 #pragma once
16 
17 #include <gsCore/gsLinearAlgebra.h>
18 #include <gsCore/gsFunction.h>
19 
20 namespace gismo {
21 
28 template <typename T>
29 class gsAffineFunction : public gsFunction<T>
30 {
31 protected:
32  gsMatrix<T> m_mat;
33  gsMatrix<T> m_box1, m_box2;
34  gsVector<T> m_trans;
35 public:
37  typedef memory::shared_ptr< gsAffineFunction > Ptr;
38 
40  typedef memory::unique_ptr< gsAffineFunction > uPtr;
41 
46  : m_mat(other.m_mat), m_trans(other.m_trans)
47  {}
48 
49  GISMO_CLONE_FUNCTION(gsAffineFunction)
50 
51 
57  gsAffineFunction(const gsMatrix<T> mat, const gsVector<T> trans);
58 
67  gsAffineFunction(const gsVector<index_t> &directions, const gsVector<bool> &orientation, const gsMatrix<T> &box1, const gsMatrix<T> &box2);
68 
75  static uPtr make(const gsMatrix<T> mat, const gsVector<T> trans)
76  { return uPtr(new gsAffineFunction(mat, trans)); }
77 
86  static uPtr make(const gsVector<index_t> &directions, const gsVector<bool> &orientation, const gsMatrix<T> &box1, const gsMatrix<T> &box2)
87  { return uPtr(new gsAffineFunction(directions, orientation, box1, box2)); }
88 
89  const gsMatrix<T> & matrix() const { return m_mat; }
90  const gsVector<T> & translation() const { return m_trans; }
91 
92  virtual short_t domainDim() const;
93  virtual short_t targetDim() const;
94  virtual void eval_into(const gsMatrix<T>& u, gsMatrix<T>& result) const;
95  virtual void eval_component_into(const gsMatrix<T>& u,
96  const index_t comp,
97  gsMatrix<T>& result) const;
98  virtual void deriv_into(const gsMatrix<T>& u, gsMatrix<T>& result) const;
99  virtual void deriv2_into( const gsMatrix<T>& u, gsMatrix<T>& result ) const;
100 };
101 
102 
103 } // namespace gismo
104 
105 #ifndef GISMO_BUILD_LIB
106 #include GISMO_HPP_HEADER(gsAffineFunction.hpp)
107 #endif
#define short_t
Definition: gsConfig.h:35
#define index_t
Definition: gsConfig.h:32
A function from a n-dimensional domain to an m-dimensional image.
Definition: gsFunction.h:59
virtual short_t targetDim() const
Dimension of the target space.
Definition: gsAffineFunction.hpp:58
static uPtr make(const gsVector< index_t > &directions, const gsVector< bool > &orientation, const gsMatrix< T > &box1, const gsMatrix< T > &box2)
Construct the affine map that maps box1 to box2 by mapping coordinate i of box1 to coordinate directi...
Definition: gsAffineFunction.h:86
Representation of an affine function.
Definition: gsAffineFunction.h:29
virtual void deriv_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluate derivatives of the function at points u into result.
Definition: gsAffineFunction.hpp:82
virtual void deriv2_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluate second derivatives of the function at points u into result.
Definition: gsAffineFunction.hpp:100
memory::shared_ptr< gsAffineFunction > Ptr
Shared pointer for gsAffineFunction.
Definition: gsAffineFunction.h:37
virtual void eval_component_into(const gsMatrix< T > &u, const index_t comp, gsMatrix< T > &result) const
Evaluate the function for component comp in the target dimension at points u into result...
Definition: gsAffineFunction.hpp:72
static uPtr make(const gsMatrix< T > mat, const gsVector< T > trans)
Affine maps are the composition of a linear map with a translation this constructor takes the two com...
Definition: gsAffineFunction.h:75
gsAffineFunction(const gsAffineFunction &other)
copy constructor
Definition: gsAffineFunction.h:45
virtual short_t domainDim() const
Dimension of the (source) domain.
Definition: gsAffineFunction.hpp:52
This is the main header file that collects wrappers of Eigen for linear algebra.
Provides declaration of Function abstract interface.
virtual void eval_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluate the function at points u into result.
Definition: gsAffineFunction.hpp:64
memory::unique_ptr< gsAffineFunction > uPtr
Unique pointer for gsAffineFunction.
Definition: gsAffineFunction.h:40