G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsGeometryTransform.h
Go to the documentation of this file.
1 
14 #pragma once
15 
17 
18 namespace gismo {
19 
26 template <typename T>
28 {
29 protected:
30  const gsGeometry<T> * m_geo;
32 public:
34  typedef memory::shared_ptr< gsGeometryTransform > Ptr;
35 
37  typedef memory::unique_ptr< gsGeometryTransform > uPtr;
38 
39  GISMO_CLONE_FUNCTION(gsGeometryTransform)
40 
41 
49  const gsMatrix<T> mat, const gsVector<T> trans)
50  : m_geo(geo), m_af(mat,trans) { }
51 
58  static uPtr make(const gsMatrix<T> mat, const gsVector<T> trans)
59  { return uPtr(new gsGeometryTransform(mat, trans)); }
60 
61  virtual short_t domainDim() const { return m_geo->domainDim(); }
62  virtual short_t targetDim() const { return m_geo->targetDim(); }
63 
64  gsMatrix<T> support() const { return m_geo->support(); }
65 
66  virtual void eval_into(const gsMatrix<T>& u, gsMatrix<T>& result) const;
67 
68  virtual void deriv_into(const gsMatrix<T>& u, gsMatrix<T>& result) const;
69 
70  virtual void deriv2_into( const gsMatrix<T>& u, gsMatrix<T>& result ) const
72 };
73 
74 template<class T> void
76 {
77  m_geo->eval_into(u, result);
78  result = ( m_af.matrix() * result ).colwise() + m_af.translation();
79 }
80 
81 template<class T> void
83 {
84  m_geo->deriv_into(u, result);
85  auto Jt = result.reshaped( u.rows(), result.size()/u.rows() );
86  gsMatrix<T> tmp;
87  index_t n = m_geo->targetDim();
88  for(index_t i = 0; i!=u.cols(); ++i)
89  {
90  tmp = Jt.middleCols(n*i,n);
91  Jt.middleCols(n*i,n).noalias() = tmp * m_af.matrix().transpose();
92  }
93 }
94 
95 } // namespace gismo
96 
97 //#ifndef GISMO_BUILD_LIB
98 //#include GISMO_HPP_HEADER(gsGeometryTransform.hpp)
99 //#endif
Abstract base class representing a geometry map.
Definition: gsGeometry.h:92
#define GISMO_NO_IMPLEMENTATION
Definition: gsDebug.h:129
#define short_t
Definition: gsConfig.h:35
Implements an affine function.
virtual void deriv_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluate derivatives of the function at points u into result.
Definition: gsGeometryTransform.h:82
#define index_t
Definition: gsConfig.h:32
A function from a n-dimensional domain to an m-dimensional image.
Definition: gsFunction.h:59
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: gsGeometryTransform.h:58
memory::shared_ptr< gsGeometryTransform > Ptr
Shared pointer for gsGeometryTransform.
Definition: gsGeometryTransform.h:34
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition: gsMatrix.h:38
memory::unique_ptr< gsFunction > uPtr
Unique pointer for gsFunction.
Definition: gsFunction.h:68
gsGeometryTransform(const gsGeometry< T > *geo, 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: gsGeometryTransform.h:48
virtual short_t domainDim() const
Dimension of the (source) domain.
Definition: gsGeometryTransform.h:61
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition: gsVector.h:35
Representation of an affine function.
Definition: gsAffineFunction.h:29
virtual void deriv2_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluate second derivatives of the function at points u into result.
Definition: gsGeometryTransform.h:70
virtual short_t targetDim() const
Dimension of the target space.
Definition: gsGeometryTransform.h:62
Representation of a transformed geometry.
Definition: gsGeometryTransform.h:27
virtual void eval_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluate the function at points u into result.
Definition: gsGeometryTransform.h:75
memory::unique_ptr< gsGeometryTransform > uPtr
Unique pointer for gsGeometryTransform.
Definition: gsGeometryTransform.h:37