24 #ifndef DIRECT_LINEAR_SOLVER_H_
25 #define DIRECT_LINEAR_SOLVER_H_
27 #include <deal.II/lac/vector.h>
28 #include <deal.II/lac/block_sparsity_pattern.h>
29 #include <deal.II/lac/block_sparse_matrix.h>
30 #include <deal.II/lac/compressed_simple_sparsity_pattern.h>
31 #include <deal.II/lac/solver_cg.h>
32 #include <deal.II/lac/precondition.h>
33 #include <deal.II/lac/full_matrix.h>
34 #include <deal.II/lac/sparse_direct.h>
35 #include <deal.II/dofs/dof_tools.h>
36 #include <deal.II/numerics/vector_tools.h>
57 template <
typename SPARSITYPATTERN,
typename MATRIX,
typename VECTOR>
70 template<
typename PROBLEM>
91 template<
typename PROBLEM,
typename INTEGRATOR>
92 void Solve(PROBLEM& pde, INTEGRATOR& integr, VECTOR &rhs, VECTOR &solution,
bool force_matrix_build=
false);
97 SPARSITYPATTERN sparsity_pattern_;
100 dealii::SparseDirectUMFPACK* A_direct_;
106 template <
typename SPARSITYPATTERN,
typename MATRIX,
typename VECTOR>
113 template <
typename SPARSITYPATTERN,
typename MATRIX,
typename VECTOR>
122 template <
typename SPARSITYPATTERN,
typename MATRIX,
typename VECTOR>
125 if(A_direct_ != NULL)
133 template <
typename SPARSITYPATTERN,
typename MATRIX,
typename VECTOR>
134 template<
typename PROBLEM>
138 pde.ComputeSparsityPattern(sparsity_pattern_);
139 matrix_.reinit(sparsity_pattern_);
141 if(A_direct_ != NULL)
150 template <
typename SPARSITYPATTERN,
typename MATRIX,
typename VECTOR>
151 template<
typename PROBLEM,
typename INTEGRATOR>
156 bool force_matrix_build)
158 if(force_matrix_build)
160 integr.ComputeMatrix (pde,matrix_);
163 integr.ApplyNewtonBoundaryValues(pde,matrix_,rhs,solution);
165 if(A_direct_ == NULL)
167 A_direct_ =
new dealii::SparseDirectUMFPACK;
168 A_direct_->initialize(matrix_);
170 else if(force_matrix_build)
172 A_direct_->factorize(matrix_);
175 dealii::Vector<double> sol;
177 A_direct_->solve(sol);
180 pde.GetDoFConstraints().distribute(solution);
Definition: parameterreader.h:36
~DirectLinearSolverWithMatrix()
Definition: directlinearsolver.h:123
static void declare_params(ParameterReader ¶m_reader)
Definition: directlinearsolver.h:107
void ReInit(PROBLEM &pde)
Definition: directlinearsolver.h:135
DirectLinearSolverWithMatrix(ParameterReader ¶m_reader)
Definition: directlinearsolver.h:114
void Solve(PROBLEM &pde, INTEGRATOR &integr, VECTOR &rhs, VECTOR &solution, bool force_matrix_build=false)
Definition: directlinearsolver.h:152
Definition: directlinearsolver.h:58