![]() |
|
#include <complex_smoother.h>
Public Member Functions | |
ComplexDampedJacobi (const double &omega=0.5) | |
Constructor (empty) More... | |
~ComplexDampedJacobi () | |
Empty destructor. More... | |
void | clean_up_memory () |
Cleanup data that's stored for resolve (if any has been stored) More... | |
ComplexDampedJacobi (const ComplexDampedJacobi &)=delete | |
Broken copy constructor. More... | |
void | operator= (const ComplexDampedJacobi &)=delete |
Broken assignment operator. More... | |
void | calculate_omega (const double &k, const double &h) |
double & | omega () |
Get access to the value of Omega (lvalue) More... | |
void | complex_smoother_setup (Vector< CRDoubleMatrix * > helmholtz_matrix_pt) |
Setup: Pass pointer to the matrix and store in cast form. More... | |
void | complex_smoother_solve (const Vector< DoubleVector > &rhs, Vector< DoubleVector > &solution) |
void | solve (Problem *const &problem_pt, DoubleVector &result) |
unsigned | iterations () const |
Number of iterations taken. More... | |
![]() | |
HelmholtzSmoother () | |
Empty constructor. More... | |
virtual | ~HelmholtzSmoother () |
Virtual empty destructor. More... | |
void | complex_matrix_multiplication (Vector< CRDoubleMatrix * > matrices_pt, const Vector< DoubleVector > &x, Vector< DoubleVector > &soln) |
template<typename MATRIX > | |
void | check_validity_of_solve_helper_inputs (CRDoubleMatrix *const &real_matrix_pt, CRDoubleMatrix *const &imag_matrix_pt, const Vector< DoubleVector > &rhs, Vector< DoubleVector > &solution, const double &n_dof) |
![]() | |
IterativeLinearSolver () | |
IterativeLinearSolver (const IterativeLinearSolver &)=delete | |
Broken copy constructor. More... | |
void | operator= (const IterativeLinearSolver &)=delete |
Broken assignment operator. More... | |
virtual | ~IterativeLinearSolver () |
Destructor (empty) More... | |
Preconditioner *& | preconditioner_pt () |
Access function to preconditioner. More... | |
Preconditioner *const & | preconditioner_pt () const |
Access function to preconditioner (const version) More... | |
double & | tolerance () |
Access to convergence tolerance. More... | |
unsigned & | max_iter () |
Access to max. number of iterations. More... | |
void | enable_doc_convergence_history () |
Enable documentation of the convergence history. More... | |
void | disable_doc_convergence_history () |
Disable documentation of the convergence history. More... | |
void | open_convergence_history_file_stream (const std::string &file_name, const std::string &zone_title="") |
void | close_convergence_history_file_stream () |
Close convergence history output stream. More... | |
double | jacobian_setup_time () const |
double | linear_solver_solution_time () const |
return the time taken to solve the linear system More... | |
virtual double | preconditioner_setup_time () const |
returns the the time taken to setup the preconditioner More... | |
void | enable_setup_preconditioner_before_solve () |
Setup the preconditioner before the solve. More... | |
void | disable_setup_preconditioner_before_solve () |
Don't set up the preconditioner before the solve. More... | |
void | enable_error_after_max_iter () |
Throw an error if we don't converge within max_iter. More... | |
void | disable_error_after_max_iter () |
Don't throw an error if we don't converge within max_iter (default). More... | |
void | enable_iterative_solver_as_preconditioner () |
void | disable_iterative_solver_as_preconditioner () |
![]() | |
LinearSolver () | |
Empty constructor, initialise the member data. More... | |
LinearSolver (const LinearSolver &dummy)=delete | |
Broken copy constructor. More... | |
void | operator= (const LinearSolver &)=delete |
Broken assignment operator. More... | |
virtual | ~LinearSolver () |
Empty virtual destructor. More... | |
void | enable_doc_time () |
Enable documentation of solve times. More... | |
void | disable_doc_time () |
Disable documentation of solve times. More... | |
bool | is_doc_time_enabled () const |
Is documentation of solve times enabled? More... | |
bool | is_resolve_enabled () const |
Boolean flag indicating if resolves are enabled. More... | |
virtual void | enable_resolve () |
virtual void | disable_resolve () |
virtual void | solve (DoubleMatrixBase *const &matrix_pt, const DoubleVector &rhs, DoubleVector &result) |
virtual void | solve (DoubleMatrixBase *const &matrix_pt, const Vector< double > &rhs, Vector< double > &result) |
virtual void | solve_transpose (Problem *const &problem_pt, DoubleVector &result) |
virtual void | solve_transpose (DoubleMatrixBase *const &matrix_pt, const DoubleVector &rhs, DoubleVector &result) |
virtual void | solve_transpose (DoubleMatrixBase *const &matrix_pt, const Vector< double > &rhs, Vector< double > &result) |
virtual void | resolve (const DoubleVector &rhs, DoubleVector &result) |
virtual void | resolve_transpose (const DoubleVector &rhs, DoubleVector &result) |
virtual void | enable_computation_of_gradient () |
void | disable_computation_of_gradient () |
void | reset_gradient () |
void | get_gradient (DoubleVector &gradient) |
function to access the gradient, provided it has been computed More... | |
![]() | |
DistributableLinearAlgebraObject () | |
Default constructor - create a distribution. More... | |
DistributableLinearAlgebraObject (const DistributableLinearAlgebraObject &matrix)=delete | |
Broken copy constructor. More... | |
void | operator= (const DistributableLinearAlgebraObject &)=delete |
Broken assignment operator. More... | |
virtual | ~DistributableLinearAlgebraObject () |
Destructor. More... | |
LinearAlgebraDistribution * | distribution_pt () const |
access to the LinearAlgebraDistribution More... | |
unsigned | nrow () const |
access function to the number of global rows. More... | |
unsigned | nrow_local () const |
access function for the num of local rows on this processor. More... | |
unsigned | nrow_local (const unsigned &p) const |
access function for the num of local rows on this processor. More... | |
unsigned | first_row () const |
access function for the first row on this processor More... | |
unsigned | first_row (const unsigned &p) const |
access function for the first row on this processor More... | |
bool | distributed () const |
distribution is serial or distributed More... | |
bool | distribution_built () const |
void | build_distribution (const LinearAlgebraDistribution *const dist_pt) |
void | build_distribution (const LinearAlgebraDistribution &dist) |
Private Member Functions | |
void | complex_solve_helper (const Vector< DoubleVector > &rhs, Vector< DoubleVector > &solution) |
This is where the actual work is done. More... | |
Private Attributes | |
bool | Matrix_can_be_deleted |
CRDoubleMatrix * | Matrix_real_pt |
Pointer to the real part of the system matrix. More... | |
CRDoubleMatrix * | Matrix_imag_pt |
Pointer to the real part of the system matrix. More... | |
Vector< double > | Matrix_diagonal_real |
Vector containing the diagonal entries of A_r (real(A)) More... | |
Vector< double > | Matrix_diagonal_imag |
Vector containing the diagonal entries of A_c (imag(A)) More... | |
Vector< double > | Matrix_diagonal_inv_sq |
Vector whose j'th entry is given by 1/(A_r(j,j)^2 + A_c(j,j)^2) More... | |
unsigned | Iterations |
Number of iterations taken. More... | |
double | Omega |
Damping factor. More... | |
//////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// Damped Jacobi "solver" templated by matrix type. The "solver" exists in many different incarnations: It's an IterativeLinearSolver, and a Smoother, all of which use the same basic iteration.
|
inline |
Constructor (empty)
|
inline |
Empty destructor.
References oomph::ComplexDampedJacobi< MATRIX >::clean_up_memory().
|
delete |
Broken copy constructor.
|
inline |
Function to calculate the value of Omega by passing in the value of k and h [see Elman et al. "A multigrid method enhanced by Krylov subspace iteration for discrete Helmholtz equations", p.1303]
References cos(), k, oomph::ComplexDampedJacobi< MATRIX >::omega(), oomph::ComplexDampedJacobi< MATRIX >::Omega, constants::pi, oomph::MathematicalConstants::Pi, Eigen::bfloat16_impl::pow(), sin(), and oomph::IterativeLinearSolver::tolerance().
Referenced by oomph::HelmholtzMGPreconditioner< DIM >::setup_smoothers().
|
inlinevirtual |
Cleanup data that's stored for resolve (if any has been stored)
Reimplemented from oomph::LinearSolver.
References oomph::ComplexDampedJacobi< MATRIX >::Matrix_can_be_deleted, oomph::ComplexDampedJacobi< MATRIX >::Matrix_imag_pt, and oomph::ComplexDampedJacobi< MATRIX >::Matrix_real_pt.
Referenced by oomph::ComplexDampedJacobi< MATRIX >::~ComplexDampedJacobi().
|
inlinevirtual |
Setup: Pass pointer to the matrix and store in cast form.
Implements oomph::HelmholtzSmoother.
References oomph::CRDoubleMatrix::diagonal_entries(), i, oomph::ComplexDampedJacobi< MATRIX >::Matrix_can_be_deleted, oomph::ComplexDampedJacobi< MATRIX >::Matrix_diagonal_imag, oomph::ComplexDampedJacobi< MATRIX >::Matrix_diagonal_inv_sq, oomph::ComplexDampedJacobi< MATRIX >::Matrix_diagonal_real, oomph::ComplexDampedJacobi< MATRIX >::Matrix_imag_pt, oomph::ComplexDampedJacobi< MATRIX >::Matrix_real_pt, oomph::CRDoubleMatrix::nrow(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
|
inlinevirtual |
The smoother_solve function performs fixed number of iterations on the system A*result=rhs. The number of (smoothing) iterations is the same as the max. number of iterations in the underlying IterativeLinearSolver class.
Implements oomph::HelmholtzSmoother.
References oomph::ComplexDampedJacobi< MATRIX >::complex_solve_helper(), BiharmonicTestFunctions1::solution(), and oomph::HelmholtzSmoother::Use_as_smoother.
|
private |
This is where the actual work is done.
\[ \|a\|_2^2=\sum_{i=0}^{i=n-1}\real(a[i])^2+\imag(a[i])^2. \]
\[ \|a\|_2^2=\|\real(a)\|_2^2+\|\imag(a)\|_2^2. \]
References oomph::DoubleVector::build(), i, Global_Variables::Iterations, oomph::BlackBoxFDNewtonSolver::Max_iter, oomph::DoubleVector::norm(), oomph::SarahBL::Omega, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, BiharmonicTestFunctions1::solution(), sqrt(), oomph::Global_string_for_annotation::string(), and oomph::TimingHelpers::timer().
Referenced by oomph::ComplexDampedJacobi< MATRIX >::complex_smoother_solve().
|
inlinevirtual |
Number of iterations taken.
Implements oomph::IterativeLinearSolver.
References oomph::ComplexDampedJacobi< MATRIX >::Iterations.
|
inline |
Get access to the value of Omega (lvalue)
References oomph::ComplexDampedJacobi< MATRIX >::Omega.
Referenced by oomph::ComplexDampedJacobi< MATRIX >::calculate_omega().
|
delete |
Broken assignment operator.
|
inlinevirtual |
Use damped Jacobi iteration as an IterativeLinearSolver: This obtains the Jacobian matrix J and the residual vector r (needed for the Newton method) from the problem's get_jacobian function and returns the result of Jx=r.
Implements oomph::LinearSolver.
References oomph::BrokenCopy::broken_assign().
|
private |
Number of iterations taken.
Referenced by oomph::ComplexDampedJacobi< MATRIX >::iterations().
|
private |
Boolean flag to indicate if the matrices pointed to by Matrix_real_pt and Matrix_imag_pt can be deleted.
Referenced by oomph::ComplexDampedJacobi< MATRIX >::clean_up_memory(), and oomph::ComplexDampedJacobi< MATRIX >::complex_smoother_setup().
|
private |
Vector containing the diagonal entries of A_c (imag(A))
Referenced by oomph::ComplexDampedJacobi< MATRIX >::complex_smoother_setup().
|
private |
Vector whose j'th entry is given by 1/(A_r(j,j)^2 + A_c(j,j)^2)
Referenced by oomph::ComplexDampedJacobi< MATRIX >::complex_smoother_setup().
|
private |
Vector containing the diagonal entries of A_r (real(A))
Referenced by oomph::ComplexDampedJacobi< MATRIX >::complex_smoother_setup().
|
private |
Pointer to the real part of the system matrix.
Referenced by oomph::ComplexDampedJacobi< MATRIX >::clean_up_memory(), and oomph::ComplexDampedJacobi< MATRIX >::complex_smoother_setup().
|
private |
Pointer to the real part of the system matrix.
Referenced by oomph::ComplexDampedJacobi< MATRIX >::clean_up_memory(), and oomph::ComplexDampedJacobi< MATRIX >::complex_smoother_setup().
|
private |
Damping factor.
Referenced by oomph::ComplexDampedJacobi< MATRIX >::calculate_omega(), and oomph::ComplexDampedJacobi< MATRIX >::omega().