G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsBlockOp.h
Go to the documentation of this file.
1
13#pragma once
14
15#include <gsCore/gsExport.h>
18
19namespace gismo
20{
21
42template<class T>
43class gsBlockOp GISMO_FINAL : public gsLinearOperator<T>
44{
45public:
46
48 typedef memory::shared_ptr< gsBlockOp<T> > Ptr;
49
51 typedef memory::unique_ptr< gsBlockOp<T> > uPtr;
52
54 typedef memory::shared_ptr< gsLinearOperator<T> > BasePtr;
55
57 gsBlockOp(index_t nRows, index_t nCols);
58
60 static uPtr make(index_t nRows, index_t nCols)
61 { return memory::make_unique( new gsBlockOp(nRows,nCols) ); }
62
69 void addOperator(index_t row, index_t col, const BasePtr& op);
70
78 const BasePtr & getOperator(index_t row, index_t col) const {
79 return m_blockPrec(row,col);
80 }
81
87 void apply(const gsMatrix<T> & input, gsMatrix<T> & result) const;
88
90 index_t rowBlocks() const {return m_blockPrec.rows();}
92 index_t colBlocks() const {return m_blockPrec.cols();}
93
94 index_t rows() const {return m_blockTargetPositions.sum();}
95 index_t cols() const {return m_blockInputPositions.sum() ;}
96
97private:
98
99 gsEigen::Array<BasePtr, Dynamic, Dynamic> m_blockPrec;
100
101 //Contains the size of the target vector for each block
102 gsVector<index_t> m_blockTargetPositions;
103 //Contains the size of the input vector for each block
104 gsVector<index_t> m_blockInputPositions;
105
106};
107
108} // namespace gismo
109
110#ifndef GISMO_BUILD_LIB
111#include GISMO_HPP_HEADER(gsBlockOp.hpp)
112#endif
Simple class create a block operator structure.
Definition gsBlockOp.h:44
index_t rows() const
Returns the number of rows of the operator.
Definition gsBlockOp.h:94
memory::shared_ptr< gsLinearOperator< T > > BasePtr
Base class.
Definition gsBlockOp.h:54
memory::unique_ptr< gsBlockOp< T > > uPtr
Unique pointer for gsBlockOp.
Definition gsBlockOp.h:51
static uPtr make(index_t nRows, index_t nCols)
Make function returning a smart pointer.
Definition gsBlockOp.h:60
const BasePtr & getOperator(index_t row, index_t col) const
Returns the pointer to a linear operator of a specific block (if existent)
Definition gsBlockOp.h:78
memory::shared_ptr< gsBlockOp< T > > Ptr
Shared pointer for gsBlockOp.
Definition gsBlockOp.h:48
void addOperator(index_t row, index_t col, const BasePtr &op)
Add a preconditioner to the block structure.
Definition gsBlockOp.hpp:30
index_t colBlocks() const
Number of col blocks.
Definition gsBlockOp.h:92
void apply(const gsMatrix< T > &input, gsMatrix< T > &result) const
Apply the correct segment of the input vector on the preconditioners in the block structure and store...
Definition gsBlockOp.hpp:46
index_t cols() const
Returns the number of columns of the operator.
Definition gsBlockOp.h:95
index_t rowBlocks() const
Number of row blocks.
Definition gsBlockOp.h:90
Simple abstract class for discrete operators.
Definition gsLinearOperator.h:29
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
#define index_t
Definition gsConfig.h:32
Handles shared library creation and other class attributes.
This is the main header file that collects wrappers of Eigen for linear algebra.
Simple abstract class for (discrete) linear operators.
unique_ptr< T > make_unique(T *x)
Definition gsMemory.h:198
The G+Smo namespace, containing all definitions for the library.