33 #ifndef __H__UG__LIB_DISC__OPERATOR__LINEAR_OPERATOR__ASSEMBLED_LINEAR_OPERATOR_IMPL__
34 #define __H__UG__LIB_DISC__OPERATOR__LINEAR_OPERATOR__ASSEMBLED_LINEAR_OPERATOR_IMPL__
41 #define ASS_PROFILE_FUNC() PROFILE_FUNC()
42 #define ASS_PROFILE_BEGIN(name) PROFILE_BEGIN_GROUP(name, "discretization")
43 #define ASS_PROFILE_END() PROFILE_END()
45 #define ASS_PROFILE_FUNC()
46 #define ASS_PROFILE_BEGIN(name)
47 #define ASS_PROFILE_END()
52 template <
typename TAlgebra>
57 UG_THROW(
"AssembledLinearOperator: Assembling routine not set.");
61 m_spAss->assemble_jacobian(*
this, u, m_gridLevel);
63 UG_CATCH_THROW(
"AssembledLinearOperator: Cannot assemble Jacobi matrix.");
67 template <
typename TAlgebra>
72 UG_THROW(
"AssembledLinearOperator: Assembling routine not set.");
79 m_spAss->assemble_linear(*
this, dummy, m_gridLevel);
81 UG_CATCH_THROW(
"AssembledLinearOperator::init: Cannot assemble Matrix.");
85 template <
typename TAlgebra>
92 UG_THROW(
"AssembledLinearOperator: Assembling routine not set.");
96 m_spAss->assemble_linear(*
this, b, m_gridLevel);
99 " Cannot assemble Matrix and Rhs.");
102 template <
typename TAlgebra>
108 UG_THROW(
"Inadequate storage format of Vector c.");
112 if(c.size() != this->num_cols() || d.size() != this->num_rows())
113 UG_THROW(
"AssembledLinearOperator::apply: Size of matrix A ["<<
115 "sizes of vectors x ["<<c.size()<<
"], b ["<<d.size()<<
"] for the "
116 " operation b = A*x. Maybe the operator is not initialized ?");
119 base_type::apply(d, c);
123 template <
typename TAlgebra>
129 UG_THROW(
"Inadequate storage format of Vector d.");
131 UG_THROW(
"Inadequate storage format of Vector c.");
135 if(c.size() != this->num_cols() || d.size() != this->num_rows())
136 UG_THROW(
"AssembledLinearOperator::apply_sub: Size of matrix A ["<<
138 "sizes of vectors x ["<<c.size()<<
"], b ["<<d.size()<<
"] for the "
139 " operation b -= A*x. Maybe the operator is not initialized ?");
142 base_type::matmul_minus(d,c);
146 template <
typename TAlgebra>
150 if(m_spAss.invalid())
151 UG_THROW(
"AssembledLinearOperator: Assembling routine not set.");
155 m_spAss->adjust_solution(u, m_gridLevel);
158 " Cannot assemble solution.");
165 template <
typename TAlgebra>
168 typename TAlgebra::vector_type& u,
169 typename TAlgebra::vector_type& b)
184 }
UG_CATCH_THROW(
"Cannot set the dirichlet values in the solution.");
#define ASS_PROFILE_BEGIN(name)
Definition: assembled_linear_operator_impl.h:42
#define ASS_PROFILE_END()
Definition: assembled_linear_operator_impl.h:43
matrix operator based on the assembling of a problem
Definition: assembled_linear_operator.h:60
void init_op_and_rhs(vector_type &b)
initializes the operator and assembles the passed rhs vector
Definition: assembled_linear_operator_impl.h:87
TAlgebra::vector_type vector_type
Type of Vector.
Definition: assembled_linear_operator.h:66
virtual void apply_sub(vector_type &d, const vector_type &c)
Compute d := d - J(u)*c.
Definition: assembled_linear_operator_impl.h:125
virtual void init()
initialize the operator
Definition: assembled_linear_operator_impl.h:69
virtual void apply(vector_type &d, const vector_type &c)
compute d = J(u)*c (here, J(u) is a Matrix)
Definition: assembled_linear_operator_impl.h:104
void set_dirichlet_values(vector_type &u)
Set Dirichlet values.
Definition: assembled_linear_operator_impl.h:147
@ PST_CONSISTENT
Definition: parallel_storage_type.h:68
@ PST_ADDITIVE
Definition: parallel_storage_type.h:69
#define UG_CATCH_THROW(msg)
Definition: error.h:64
#define UG_THROW(msg)
Definition: error.h:57
void AssembleLinearOperatorRhsAndSolution(AssembledLinearOperator< TAlgebra > &op, typename TAlgebra::vector_type &u, typename TAlgebra::vector_type &b)
help function to assemble a linear operator
Definition: assembled_linear_operator_impl.h:167
size_t num_rows() const
Definition: sparsematrix_interface.h:38
size_t num_cols() const
Definition: sparsematrix_interface.h:39