G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsGeometryTransform.h
Go to the documentation of this file.
1
14#pragma once
15
17
18namespace gismo {
19
26template <typename T>
28{
29protected:
30 const gsGeometry<T> * m_geo;
32public:
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
74template<class T> void
76{
77 m_geo->eval_into(u, result);
78 result = ( m_af.matrix() * result ).colwise() + m_af.translation();
79}
80
81template<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
Representation of an affine function.
Definition gsAffineFunction.h:30
A function from a n-dimensional domain to an m-dimensional image.
Definition gsFunction.h:60
Representation of a transformed geometry.
Definition gsGeometryTransform.h:28
virtual void deriv2_into(const gsMatrix< T > &, gsMatrix< T > &) const
Evaluate second derivatives of the function at points u into result.
Definition gsGeometryTransform.h:70
virtual short_t domainDim() const
Dimension of the (source) domain.
Definition gsGeometryTransform.h:61
virtual short_t targetDim() const
Dimension of the target space.
Definition gsGeometryTransform.h:62
memory::unique_ptr< gsGeometryTransform > uPtr
Unique pointer for gsGeometryTransform.
Definition gsGeometryTransform.h:37
virtual void eval_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluate the function at points u into result.
Definition gsGeometryTransform.h:75
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
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
Abstract base class representing a geometry map.
Definition gsGeometry.h:93
short_t targetDim() const
Dimension of the ambient physical space (overriding gsFunction::targetDim())
Definition gsGeometry.h:286
void eval_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluate the function at points u into result.
Definition gsGeometry.hpp:166
virtual short_t domainDim() const
Dimension d of the parameter domain (overriding gsFunction::domainDim()).
Definition gsGeometry.hpp:184
virtual void deriv_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Evaluate derivatives of the function at points u into result.
Definition gsGeometry.hpp:170
gsMatrix< T > support() const
Returns the range of parameters (same as parameterRange())
Definition gsGeometry.hpp:193
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
Implements an affine function.
#define short_t
Definition gsConfig.h:35
#define index_t
Definition gsConfig.h:32
#define GISMO_NO_IMPLEMENTATION
Definition gsDebug.h:129
The G+Smo namespace, containing all definitions for the library.