|
dune-istl 2.12-git
|
Loading...
Searching...
No Matches
umfpack.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
187 std::enable_if_t<(std::is_same<M,double>::value) || (std::is_same<M,std::complex<double> >::value)>>
195 std::enable_if_t<(std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value)>>
207 // In case of recursive deduction (e.g., BCRSMatrix<FieldMatrix<...>, Allocator<FieldMatrix<...>>>)
208 // the allocator needs to be converted to the sub-block allocator type too (e.g., Allocator<FieldVector<...>>).
211 using domain_type = BlockVector<UMFPackDomainType<T>, typename std::allocator_traits<A>::template rebind_alloc<UMFPackDomainType<T>>>;
213 using range_type = BlockVector<UMFPackRangeType<T>, typename std::allocator_traits<A>::template rebind_alloc<UMFPackRangeType<T>>>;
219 : public UMFPackVectorChooser<BCRSMatrix<T,A>, std::void_t<UMFPackDomainType<T>, UMFPackRangeType<T>>>
225 : public UMFPackVectorChooser<BCRSMatrix<T,A>, std::void_t<UMFPackDomainType<T>, UMFPackRangeType<T>>>
228 // to make the `UMFPackVectorChooser` work with `MultiTypeBlockMatrix`, we need to add an intermediate step for the rows, which are typically `MultiTypeBlockVector`
231 std::void_t<UMFPackDomainType<FirstBlock>, UMFPackRangeType<FirstBlock>, UMFPackDomainType<Blocks>...>>
234 using domain_type = MultiTypeBlockVector<UMFPackDomainType<FirstBlock>, UMFPackDomainType<Blocks>...>;
242 std::void_t<UMFPackDomainType<FirstRow>, UMFPackRangeType<FirstRow>, UMFPackRangeType<Rows>...>>
247 using range_type = MultiTypeBlockVector< UMFPackRangeType<FirstRow>, UMFPackRangeType<Rows>... >;
307 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
325 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
353 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
368 else DUNE_THROW(Dune::NotImplemented, "The UMFPACK ordering '" << ordering << "' is not implemented");
378 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
396 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
423 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
448 DUNE_THROW(Dune::ISTLError, "Size of right-hand-side vector b does not match the number of matrix rows!");
450 DUNE_THROW(Dune::ISTLError, "Size of solution vector x does not match the number of matrix columns!");
496 void apply (domain_type& x, range_type& b, [[maybe_unused]] double reduction, InverseOperatorResult& res) override
598 auto [flatRows,flatCols] = flatMatrixForEach( matrix, [&](auto&& /*entry*/, auto&& row, auto&& col){
691 // The new version is more flexible and allows, e.g., marking single components of a matrix block.
704 copyToBCCSMatrix(initializer, ISTL::Impl::MatrixRowSubset<Matrix,std::set<typename Matrix::size_type> >(_mat,rowIndexSet));
793 std::cout << "Wallclock Time taken: " << UMF_Decomposition_Info[UMFPACK_NUMERIC_WALLTIME] << " (CPU Time: " << UMF_Decomposition_Info[UMFPACK_NUMERIC_TIME] << ")" << std::endl;
795 std::cout << "Peak Memory Usage: " << UMF_Decomposition_Info[UMFPACK_PEAK_MEMORY]*UMF_Decomposition_Info[UMFPACK_SIZE_OF_UNIT] << " bytes" << std::endl;
796 std::cout << "Condition number estimate: " << 1./UMF_Decomposition_Info[UMFPACK_RCOND] << std::endl;
797 std::cout << "Numbers of non-zeroes in decomposition: L: " << UMF_Decomposition_Info[UMFPACK_LNZ] << " U: " << UMF_Decomposition_Info[UMFPACK_UNZ] << std::endl;
811 std::cout << "Wallclock Time: " << UMF_Info[UMFPACK_SOLVE_WALLTIME] << " (CPU Time: " << UMF_Info[UMFPACK_SOLVE_TIME] << ")" << std::endl;
848 std::is_same_v<Impl::UMFPackDomainType<typename OpTraits::matrix_type>, typename OpTraits::domain_type>
849 && std::is_same_v<Impl::UMFPackRangeType<typename OpTraits::matrix_type>, typename OpTraits::range_type>
850 && std::is_same_v<typename FieldTraits<typename OpTraits::domain_type::field_type>::real_type, double>
Some handy generic functions for ISTL matrices.
A dynamic dense block matrix class.
Implementation of the BCRSMatrix class.
Templates characterizing the type of a solver.
Implementations of the inverse operator interface.
void setSubMatrix(const Matrix &_mat, const std::set< typename Matrix::size_type > &rowIndexSet)
Definition umfpack.hh:692
static void symbolic(size_type m, size_type n, const size_type *cs, const size_type *ri, const double *val, A... args)
Definition umfpack.hh:168
static void solve(size_type m, const size_type *cs, const size_type *ri, std::complex< double > *val, double *x, const double *b, A... args)
Definition umfpack.hh:162
static void numeric(const size_type *cs, const size_type *ri, const double *val, A... args)
Definition umfpack.hh:142
static void report_info(A... args)
Definition umfpack.hh:147
UMFPack(const Matrix &mat_, const ParameterTree &config)
Construct a solver object from a matrix.
Definition umfpack.hh:350
static int load_numeric(A... args)
Definition umfpack.hh:137
static int load_numeric(A... args)
Definition umfpack.hh:79
static void report_status(A... args)
Definition umfpack.hh:94
UMFPack(const Matrix &mat_, const char *file, int verbose=0)
Try loading a decomposition from file and do a decomposition if unsuccessful.
Definition umfpack.hh:393
Impl::UMFPackRangeType< M > range_type
The type of the range of the solver.
Definition umfpack.hh:288
static void symbolic(A... args)
Definition umfpack.hh:109
static void report_info(A... args)
Definition umfpack.hh:89
static void free_symbolic(A... args)
Definition umfpack.hh:74
static int save_numeric(A... args)
Definition umfpack.hh:157
static void free_numeric(A... args)
Definition umfpack.hh:127
static int save_numeric(A... args)
Definition umfpack.hh:99
static void report_status(A... args)
Definition umfpack.hh:152
Impl::UMFPackDomainType< M > domain_type
The type of the domain of the solver.
Definition umfpack.hh:286
void apply(T *x, T *b)
additional apply method with c-arrays in analogy to superlu
Definition umfpack.hh:508
SolverCategory::Category category() const override
Category of the solver (see SolverCategory::Category)
Definition umfpack.hh:291
static void defaults(A... args)
Definition umfpack.hh:122
static void free_numeric(A... args)
Definition umfpack.hh:69
void setVerbosity(int v)
sets the verbosity level for the UMFPack solver
Definition umfpack.hh:716
UMFPack(const char *file, int verbose=0)
try loading a decomposition from file
Definition umfpack.hh:420
void apply(domain_type &x, range_type &b, double reduction, InverseOperatorResult &res) override
apply inverse operator, with given convergence criteria.
Definition umfpack.hh:496
void setMatrix(const Matrix &matrix, const BitVector &bitVector={})
Initialize data from given matrix.
Definition umfpack.hh:562
void saveDecomposition(const char *file)
saves a decomposition to a file
Definition umfpack.hh:545
UMFPackMatrix & getInternalMatrix()
Return the column compress matrix from UMFPack.
Definition umfpack.hh:741
SuiteSparse_long size_type
Definition umfpack.hh:119
UMFPack(const Matrix &matrix, int verbose=0)
Construct a solver object from a matrix.
Definition umfpack.hh:304
ISTL::Impl::BCCSMatrixInitializer< M, size_type > MatrixInitializer
Type of an associated initializer class.
Definition umfpack.hh:284
ISTL::Impl::BCCSMatrix< typename Matrix::field_type, size_type > UMFPackMatrix
The corresponding (scalar) UMFPack matrix type.
Definition umfpack.hh:282
void setOption(unsigned int option, double value)
Set UMFPack-specific options.
Definition umfpack.hh:534
static void free_symbolic(A... args)
Definition umfpack.hh:132
static void defaults(A... args)
Definition umfpack.hh:64
void apply(domain_type &x, range_type &b, InverseOperatorResult &res) override
Apply inverse operator,.
Definition umfpack.hh:445
UMFPack(const Matrix &matrix, int verbose, bool)
Constructor for compatibility with SuperLU standard constructor.
Definition umfpack.hh:322
void * getFactorization()
Return the matrix factorization.
Definition umfpack.hh:732
STL namespace.
typename Impl::voider< Types... >::type void_t
static constexpr size_type M()
#define DUNE_THROW(E,...)
std::pair< std::size_t, std::size_t > flatMatrixForEach(Matrix &&matrix, F &&f, std::size_t rowOffset=0, std::size_t colOffset=0)
Traverse a blocked matrix and call a functor at each scalar entry.
Definition foreach.hh:139
std::size_t flatVectorForEach(Vector &&vector, F &&f, std::size_t offset=0)
Traverse a blocked vector and call a functor at each scalar entry.
Definition foreach.hh:102
Definition matrixutils.hh:221
Block compressed row storage matrix.
Definition experimental/bcrsmatrix.hh:82
std::string get(const std::string &key, const std::string &defaultValue) const
bool hasKey(const std::string &key) const
Sequential overlapping Schwarz preconditioner.
Definition overlappingschwarz.hh:755
Definition overlappingschwarz.hh:694
Statistics about the application of an inverse operator.
Definition solver.hh:50
bool converged
True if convergence criterion has been met.
Definition solver.hh:75
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
Definition solverregistry.hh:97
Definition solvertype.hh:16
Definition solvertype.hh:30
@ value
whether the solver internally uses column compressed storage
Definition solvertype.hh:36
Definition umfpack.hh:54
Definition umfpack.hh:845
T endl(T... args)
T resize(T... args)
T size(T... args)
Legal Statements / Impressum | Hosted by TU Dresden & Uni Heidelberg | Generated by
1.9.8