G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsKroneckerOp.h
Go to the documentation of this file.
1 
13 #pragma once
14 
16 
17 namespace gismo
18 {
19 
27 template <class T>
28 class gsKroneckerOp GISMO_FINAL : public gsLinearOperator<T>
29 {
30  typedef typename gsLinearOperator<T>::Ptr BasePtr;
31 public:
32 
34  typedef memory::shared_ptr<gsKroneckerOp> Ptr;
35 
37  typedef memory::unique_ptr<gsKroneckerOp> uPtr;
38 
40  gsKroneckerOp(std::vector< BasePtr > ops)
41  : m_ops(give(ops))
42  { }
43 
45  gsKroneckerOp(BasePtr op0, BasePtr op1)
46  : m_ops(2)
47  { m_ops[0] = give(op0); m_ops[1] = give(op1); }
48 
50  gsKroneckerOp(BasePtr op0, BasePtr op1, BasePtr op2)
51  : m_ops(3)
52  { m_ops[0] = give(op0); m_ops[1] = give(op1); m_ops[2] = give(op2); }
53 
55  static uPtr make(std::vector< BasePtr > ops)
56  { return uPtr( new gsKroneckerOp(give(ops)) ); }
57 
60  static uPtr make(BasePtr op0, BasePtr op1)
61  { return uPtr( new gsKroneckerOp(give(op0),give(op1)) ); }
62 
65  static uPtr make(BasePtr op0, BasePtr op1, BasePtr op2)
66  { return uPtr( new gsKroneckerOp(give(op0),give(op1),give(op2)) ); }
67 
71  void addOperator( BasePtr op )
72  { m_ops.push_back(give(op)); }
73 
74  virtual void apply(const gsMatrix<T> & input, gsMatrix<T> & x) const;
75  virtual index_t rows() const;
76  virtual index_t cols() const;
77 
79  const std::vector<BasePtr>& getOps() const { return m_ops; }
80 
82  static void apply(const std::vector<BasePtr> & ops, const gsMatrix<T> & input, gsMatrix<T> & x);
83 
84 private:
85  std::vector<BasePtr> m_ops;
86 };
87 
88 }
89 
90 #ifndef GISMO_BUILD_LIB
91 #include GISMO_HPP_HEADER(gsKroneckerOp.hpp)
92 #endif
static uPtr make(BasePtr op0, BasePtr op1)
Definition: gsKroneckerOp.h:60
static uPtr make(std::vector< BasePtr > ops)
Make command returning a smart pointer.
Definition: gsKroneckerOp.h:55
gsKroneckerOp(BasePtr op0, BasePtr op1, BasePtr op2)
Convenience constructor for Kronecker product of three linear operators.
Definition: gsKroneckerOp.h:50
virtual index_t rows() const
Returns the number of rows of the operator.
Definition: gsKroneckerOp.hpp:92
Class for representing a Kronecker product of operators of type gsLinearOperator. ...
Definition: gsKroneckerOp.h:28
S give(S &x)
Definition: gsMemory.h:266
#define index_t
Definition: gsConfig.h:32
virtual void apply(const gsMatrix< T > &input, gsMatrix< T > &x) const
apply the operator on the input vector and store the result in x
Definition: gsKroneckerOp.hpp:86
static uPtr make(BasePtr op0, BasePtr op1, BasePtr op2)
Definition: gsKroneckerOp.h:65
memory::shared_ptr< gsLinearOperator > Ptr
Shared pointer for gsLinearOperator.
Definition: gsLinearOperator.h:33
virtual index_t cols() const
Returns the number of columns of the operator.
Definition: gsKroneckerOp.hpp:101
memory::shared_ptr< gsKroneckerOp > Ptr
Shared pointer for gsKroneckerOp.
Definition: gsKroneckerOp.h:34
Simple abstract class for discrete operators.
Definition: gsLinearOperator.h:28
gsKroneckerOp(std::vector< BasePtr > ops)
Kronecker product of a given list of operators.
Definition: gsKroneckerOp.h:40
memory::unique_ptr< gsKroneckerOp > uPtr
Unique pointer for gsKroneckerOp.
Definition: gsKroneckerOp.h:37
const std::vector< BasePtr > & getOps() const
Return a vector of shared pointers to all operators.
Definition: gsKroneckerOp.h:79
gsKroneckerOp(BasePtr op0, BasePtr op1)
Convenience constructor for Kronecker product of two linear operators.
Definition: gsKroneckerOp.h:45
void addOperator(BasePtr op)
Definition: gsKroneckerOp.h:71
Simple abstract class for (discrete) linear operators.