A.vmult (y,x);
// Main loop
- for (int iter=0; conv==SolverControl::iterate; iter++)
+ int iter=0;
+ for (; conv==SolverControl::iterate; iter++)
{
y.add(additional_data.shift, x);
// Check the change of the eigenvalue
// Brrr, this is not really a good criterion
- conv = this->control().check (iter, std::fabs(1./length-1./old_length));
+ conv = this->iteration_status (iter, std::fabs(1./length-1./old_length), x);
}
this->memory.free(Vy);
deallog.pop();
// in case of failure: throw exception
- if (this->control().last_check() != SolverControl::success)
- AssertThrow(false, SolverControl::NoConvergence (this->control().last_step(),
- this->control().last_value()));
+ AssertThrow(conv == SolverControl::success, SolverControl::NoConvergence (iter,
+ std::fabs(1./length-1./old_length)));
+
// otherwise exit as normal
}
x.scale(1./length);
// Main loop
- for (size_type iter=0; conv==SolverControl::iterate; iter++)
+ double res = -std::numeric_limits<double>::max();
+ size_type iter=0;
+ for (; conv==SolverControl::iterate; iter++)
{
solver.solve (A_s, y, x, prec);
y.equ (value, x);
A.vmult(r,x);
r.sadd(-1., value, x);
- double res = r.l2_norm();
+ res = r.l2_norm();
// Check the residual
- conv = this->control().check (iter, res);
+ conv = this->iteration_status (iter, res, x);
}
else
{
- conv = this->control().check (iter, std::fabs(1./value-1./old_value));
+ res = std::fabs(1./value-1./old_value);
+ conv = this->iteration_status (iter, res, x);
}
old_value = value;
}
// in case of failure: throw
// exception
- if (this->control().last_check() != SolverControl::success)
- throw SolverControl::NoConvergence (this->control().last_step(),
- this->control().last_value());
+ AssertThrow (conv == SolverControl::success,
+ SolverControl::NoConvergence (iter,
+ res));
// otherwise exit as normal
}
#include <deal.II/base/config.h>
#include <deal.II/base/subscriptor.h>
#include <deal.II/lac/vector_memory.h>
+#include <deal.II/lac/solver_control.h>
+
+#include <boost/signals2.hpp>
DEAL_II_NAMESPACE_OPEN
template <typename number> class Vector;
-class SolverControl;
/**
* A base class for iterative linear solvers. This class
*/
Solver (SolverControl &solver_control);
- /**
- * Return a reference to the object that controls
- * convergence.
- */
- SolverControl &control() const;
-
protected:
/**
* A static vector memory object
mutable GrowingVectorMemory<VECTOR> static_vector_memory;
/**
- * Reference to the object that determines convergence.
+ * A reference to an object that provides memory for auxiliary vectors.
*/
- SolverControl &cntrl;
+ VectorMemory<VECTOR> &memory;
+private:
/**
- * A reference to an object that provides memory for auxiliary vectors.
+ * A class whose operator() combines two states indicating whether
+ * we should continue iterating or stop, and returns a state that
+ * dominates. The rules are:
+ * - If one of the two states indicates failure, return failure.
+ * - Otherwise, if one of the two states indicates to continue
+ * iterating, then continue iterating.
+ * - Otherwise, return success.
*/
- VectorMemory<VECTOR> &memory;
+ struct StateCombiner
+ {
+ typedef SolverControl::State result_type;
+
+ SolverControl::State operator() (const SolverControl::State state1,
+ const SolverControl::State state2) const;
+
+ template <typename Iterator>
+ SolverControl::State operator() (const Iterator begin,
+ const Iterator end) const;
+ };
+
+protected:
+ /**
+ * A signal that iterative solvers can execute at the end of every
+ * iteration (or in an otherwise periodic fashion) to find out whether
+ * we should continue iterating or not. The signal may call one or
+ * more slots that each will make this determination by themselves,
+ * and the result over all slots (function calls) will be determined
+ * by the StateCombiner object.
+ *
+ * The arguments passed to the signal are (i) the number of the current
+ * iteration; (ii) the value that is used to determine convergence (oftentimes
+ * the residual, but in other cases other quantities may be used as long
+ * as they converge to zero as the iterate approaches the solution of
+ * the linear system); and (iii) a vector that corresponds to the current
+ * best guess for the solution at the point where the signal is called.
+ * Note that some solvers do not update the approximate solution in every
+ * iteration but only after convergence or failure has been determined
+ * (GMRES is an example); in such cases, the vector passed as the last
+ * argument to the signal is simply the best approximate at the time
+ * the signal is called, but not the vector that will be returned if
+ * the signal's return value indicates that the iteration should be
+ * terminated.
+ */
+ boost::signals2::signal<SolverControl::State (const unsigned int iteration,
+ const double check_value,
+ const VECTOR ¤t_iterate),
+ StateCombiner> iteration_status;
};
/*-------------------------------- Inline functions ------------------------*/
+
+template <class VECTOR>
+inline
+SolverControl::State
+Solver<VECTOR>::StateCombiner::operator ()(const SolverControl::State state1,
+ const SolverControl::State state2) const
+{
+ if ((state1 == SolverControl::failure)
+ ||
+ (state2 == SolverControl::failure))
+ return SolverControl::failure;
+ else if ((state1 == SolverControl::iterate)
+ ||
+ (state2 == SolverControl::iterate))
+ return SolverControl::iterate;
+ else
+ return SolverControl::success;
+}
+
+
+template <class VECTOR>
+template <typename Iterator>
+inline
+SolverControl::State
+Solver<VECTOR>::StateCombiner::operator ()(const Iterator begin,
+ const Iterator end) const
+{
+ Assert (begin != end, ExcMessage ("You can't combine iterator states if no state is given."));
+
+ // combine the first with all of the following states
+ SolverControl::State state = *begin;
+ Iterator p = begin;
+ ++p;
+ for (; p != end; ++p)
+ state = this->operator()(state, *p);
+
+ return state;
+}
+
+
template<class VECTOR>
inline
Solver<VECTOR>::Solver (SolverControl &solver_control,
VectorMemory<VECTOR> &vector_memory)
:
- cntrl(solver_control),
memory(vector_memory)
-{}
+{
+ // connect the solver control object to the signal. SolverControl::check
+ // only takes two arguments, the iteration and the check_value, and so
+ // we simply ignore the third argument that is passed in whenever the
+ // signal is executed
+ iteration_status.connect (std_cxx11::bind(&SolverControl::check,
+ std_cxx11::ref(solver_control),
+ std_cxx11::_1,
+ std_cxx11::_2));
+}
inline
Solver<VECTOR>::Solver (SolverControl &solver_control)
:
- cntrl(solver_control),
+ // use the static memory object this class owns
memory(static_vector_memory)
-{}
-
-
-
-template <class VECTOR>
-inline
-SolverControl &
-Solver<VECTOR>::control() const
{
- return cntrl;
+ // connect the solver control object to the signal. SolverControl::check
+ // only takes two arguments, the iteration and the check_value, and so
+ // we simply ignore the third argument that is passed in whenever the
+ // signal is executed
+ iteration_status.connect (std_cxx11::bind(&SolverControl::check,
+ std_cxx11::ref(solver_control),
+ std_cxx11::_1,
+ std_cxx11::_2));
}
SolverControl::State start(const MATRIX &A);
/**
- * The iteration loop itself.
+ * A structure returned by the iterate() function representing
+ * what it found is happening during the iteration.
*/
- template<class MATRIX, class PRECONDITIONER>
- bool
- iterate(const MATRIX &A, const PRECONDITIONER &precondition);
+ struct IterationResult
+ {
+ bool breakdown;
+ SolverControl::State state;
+ unsigned int last_step;
+ double last_residual;
+
+ IterationResult (const bool breakdown,
+ const SolverControl::State state,
+ const unsigned int last_step,
+ const double last_residual);
+ };
+ /**
+ * The iteration loop itself. The function returns a structure
+ * indicating what happened in this function.
+ */
+ template<class MATRIX, class PRECONDITIONER>
+ IterationResult
+ iterate(const MATRIX &A,
+ const PRECONDITIONER &precondition);
};
/*@}*/
#ifndef DOXYGEN
+
+template<class VECTOR>
+SolverBicgstab<VECTOR>::IterationResult::IterationResult(const bool breakdown,
+ const SolverControl::State state,
+ const unsigned int last_step,
+ const double last_residual)
+ :
+ breakdown (breakdown),
+ state (state),
+ last_step (last_step),
+ last_residual (last_residual)
+{}
+
+
template<class VECTOR>
SolverBicgstab<VECTOR>::SolverBicgstab (SolverControl &cn,
VectorMemory<VECTOR> &mem,
Vr->sadd(-1.,1.,*Vb);
res = Vr->l2_norm();
- return this->control().check(step, res);
+ return this->iteration_status(step, res, *Vx);
}
template<class VECTOR>
template<class MATRIX, class PRECONDITIONER>
-bool
+typename SolverBicgstab<VECTOR>::IterationResult
SolverBicgstab<VECTOR>::iterate(const MATRIX &A,
const PRECONDITIONER &precondition)
{
//TODO:[?] Find better breakdown criterion
if (std::fabs(alpha) > 1.e10)
- return true;
+ return IterationResult(true, state, step, res);
r.add(-alpha, v);
// check for early success, see the lac/bicgstab_early testcase as to
// why this is necessary
- if (this->control().check(step, r.l2_norm()) == SolverControl::success)
+ //
+ // note: the vector *Vx we pass to the iteration_status signal here is only
+ // the current approximation, not the one we will return with,
+ // which will be x=*Vx + alpha*y
+ res = r.l2_norm();
+ if (this->iteration_status(step, res, *Vx) == SolverControl::success)
{
Vx->add(alpha, y);
print_vectors(step, *Vx, r, y);
- return false;
+ return IterationResult(false, SolverControl::success, step, res);
}
precondition.vmult(z,r);
else
res = r.l2_norm();
- state = this->control().check(step, res);
+ state = this->iteration_status(step, res, *Vx);
print_vectors(step, *Vx, r, y);
}
while (state == SolverControl::iterate);
- return false;
+ return IterationResult(false, state, step, res);
}
step = 0;
- bool state;
+ IterationResult state(false,SolverControl::failure,0,0);
+ // iterate while the inner iteration returns a breakdown
do
{
if (step != 0)
deallog << "Restart step " << step << std::endl;
if (start(A) == SolverControl::success)
- break;
+ {
+ state.state = SolverControl::success;
+ break;
+ }
state = iterate(A, precondition);
}
- while (state);
+ while (state.breakdown == true);
this->memory.free(Vr);
this->memory.free(Vrbar);
deallog.pop();
// in case of failure: throw exception
- if (this->control().last_check() != SolverControl::success)
- AssertThrow(false, SolverControl::NoConvergence (this->control().last_step(),
- this->control().last_value()));
+ AssertThrow(state.state == SolverControl::success,
+ SolverControl::NoConvergence (state.last_step,
+ state.last_residual));
// otherwise exit as normal
}
std::vector<double> diagonal;
std::vector<double> offdiagonal;
+ int it=0;
+ double res = -std::numeric_limits<double>::max();
+
try
{
// define some aliases for simpler access
g.reinit(x, true);
d.reinit(x, true);
h.reinit(x, true);
- // Implementation taken from the DEAL
- // library
- int it=0;
- double res,gh,alpha,beta;
+
+ double gh,alpha,beta;
// compute residual. if vector is
// zero, then short-circuit the
g.equ(-1.,b);
res = g.l2_norm();
- conv = this->control().check(0,res);
- if (conv)
+ conv = this->iteration_status(0, res, x);
+ if (conv != SolverControl::iterate)
{
cleanup();
return;
print_vectors(it, x, g, d);
- conv = this->control().check(it,res);
+ conv = this->iteration_status(it, res, x);
if (conv != SolverControl::iterate)
break;
// Deallocate Memory
cleanup();
// in case of failure: throw exception
- if (this->control().last_check() != SolverControl::success)
- AssertThrow(false, SolverControl::NoConvergence (this->control().last_step(),
- this->control().last_value()));
+ if (conv != SolverControl::success)
+ AssertThrow(false, SolverControl::NoConvergence (it, res));
// otherwise exit as normal
}
unsigned int dim = 0;
SolverControl::State iteration_state = SolverControl::iterate;
+ double last_res = -std::numeric_limits<double>::max();
// switch to determine whether we want a left or a right preconditioner. at
// present, left is default, but both ways are implemented
// check here, the next scaling operation would produce garbage
if (use_default_residual)
{
- iteration_state = this->control().check (
- accumulated_iterations, rho);
+ last_res = rho;
+ iteration_state = this->iteration_status (accumulated_iterations, rho, x);
if (iteration_state != SolverControl::iterate)
break;
precondition.vmult(*r,v);
double res = r->l2_norm();
- iteration_state = this->control().check (
- accumulated_iterations, res);
+ last_res = res;
+ iteration_state = this->iteration_status (accumulated_iterations, res, x);
if (iteration_state != SolverControl::iterate)
{
{
precondition.vmult(p, tmp_vectors[inner_iteration]);
A.vmult(vv,p);
- };
+ }
dim = inner_iteration+1;
for (unsigned int i=0; i<dim+1; ++i)
H_orig(i,inner_iteration) = h(i);
- // Transformation into triagonal structure
+ // Transformation into tridiagonal structure
givens_rotation(h,gamma,ci,si,inner_iteration);
// append vector on matrix
rho = std::fabs(gamma(dim));
if (use_default_residual)
- iteration_state = this->control().check (
- accumulated_iterations, rho);
+ {
+ last_res = rho;
+ iteration_state = this->iteration_status (accumulated_iterations, rho, x);
+ }
else
{
deallog << "default_res=" << rho << std::endl;
if (left_precondition)
{
const double res=r->l2_norm();
+ last_res = res;
- iteration_state = this->control().check (
- accumulated_iterations, res);
+ iteration_state = this->iteration_status (accumulated_iterations, res, x);
}
else
{
precondition.vmult(*x_, *r);
const double preconditioned_res=x_->l2_norm();
+ last_res = preconditioned_res;
- iteration_state = this->control().check (
- accumulated_iterations, preconditioned_res);
+ iteration_state = this->iteration_status (accumulated_iterations,
+ preconditioned_res, x);
}
}
};
}
deallog.pop();
+
// in case of failure: throw exception
- if (this->control().last_check() != SolverControl::success)
- AssertThrow(false, SolverControl::NoConvergence (this->control().last_step(),
- this->control().last_value()));
- // otherwise exit as normal
+ AssertThrow(iteration_state == SolverControl::success,
+ SolverControl::NoConvergence (accumulated_iterations,
+ last_res));
}
Vector<double> y;
// Iteration starts here
+ double res = -std::numeric_limits<double>::max();
VECTOR *aux = this->memory.alloc();
aux->reinit(x);
aux->sadd(-1., 1., b);
double beta = aux->l2_norm();
- if (this->control().check(accumulated_iterations,beta)
- == SolverControl::success)
+ res = beta;
+ iteration_state = this->iteration_status(accumulated_iterations, res, x);
+ if (iteration_state == SolverControl::success)
break;
H.reinit(basis_size+1, basis_size);
y.reinit(j);
projected_rhs(0) = beta;
H1.fill(H);
+
+ // check convergence. note that the vector 'x' we pass to the
+ // criterion is not the final solution we compute if we
+ // decide to jump out of the iteration (we update 'x' again
+ // right after the current loop)
Householder<double> house(H1);
- double res = house.least_squares(y, projected_rhs);
- iteration_state = this->control().check(++accumulated_iterations, res);
+ res = house.least_squares(y, projected_rhs);
+ iteration_state = this->iteration_status(++accumulated_iterations, res, x);
if (iteration_state != SolverControl::iterate)
break;
}
}
+
// Update solution vector
for (unsigned int j=0; j<y.size(); ++j)
x.add(y(j), z[j]);
-
}
while (iteration_state == SolverControl::iterate);
deallog.pop();
// in case of failure: throw exception
- if (this->control().last_check() != SolverControl::success)
- AssertThrow(false, SolverControl::NoConvergence (this->control().last_step(),
- this->control().last_value()));
+ if (iteration_state != SolverControl::success)
+ AssertThrow(false, SolverControl::NoConvergence (accumulated_iterations,
+ res));
}
#endif // DOXYGEN
m[1]->reinit(b);
m[2]->reinit(b);
- conv = this->control().check(0,r_l2);
+ conv = this->iteration_status(0, r_l2, x);
while (conv==SolverControl::iterate)
{
d = std::sqrt (d_*d_ + delta[2]);
- if (j>1) tau *= s / c;
+ if (j>1)
+ tau *= s / c;
c = d_ / d;
tau *= c;
x.add (tau, *m[0]);
r_l2 *= std::fabs(s);
- conv = this->control().check(j,r_l2);
+ conv = this->iteration_status(j, r_l2, x);
// next iteration step
++j;
deallog.pop ();
// in case of failure: throw exception
- if (this->control().last_check() != SolverControl::success)
- AssertThrow(false, SolverControl::NoConvergence (this->control().last_step(),
- this->control().last_value()));
+ AssertThrow(conv == SolverControl::success,
+ SolverControl::NoConvergence (j, r_l2));
+
// otherwise exit as normal
}
* the square root of the @p res2 value.
*/
double res2;
+
/**
- * Additional parameters..
+ * Additional parameters.
*/
AdditionalData additional_data;
+
private:
+
+ /**
+ * A structure returned by the iterate() function representing
+ * what it found is happening during the iteration.
+ */
+ struct IterationResult
+ {
+ SolverControl::State state;
+ double last_residual;
+
+ IterationResult (const SolverControl::State state,
+ const double last_residual);
+ };
+
+
/**
- * The iteration loop itself.
+ * The iteration loop itself. The function returns a structure
+ * indicating what happened in this function.
*/
template<class MATRIX, class PRECONDITIONER>
- bool
- iterate(const MATRIX &A, const PRECONDITIONER &precondition);
+ IterationResult
+ iterate (const MATRIX &A,
+ const PRECONDITIONER &precondition);
+
/**
- * The current iteration step.
+ * Number of the current iteration (accumulated over restarts)
*/
unsigned int step;
};
#ifndef DOXYGEN
+template<class VECTOR>
+SolverQMRS<VECTOR>::IterationResult::IterationResult(const SolverControl::State state,
+ const double last_residual)
+ :
+ state (state),
+ last_residual (last_residual)
+{}
+
+
template<class VECTOR>
SolverQMRS<VECTOR>::SolverQMRS(SolverControl &cn,
VectorMemory<VECTOR> &mem,
step = 0;
- bool state;
+ IterationResult state (SolverControl::failure,0);
do
{
- if (step)
+ if (step > 0)
deallog << "Restart step " << step << std::endl;
state = iterate(A, precondition);
}
- while (state);
+ while (state.state == SolverControl::iterate);
// Deallocate Memory
this->memory.free(Vv);
deallog.pop();
// in case of failure: throw exception
- if (this->control().last_check() != SolverControl::success)
- AssertThrow(false, SolverControl::NoConvergence (this->control().last_step(),
- this->control().last_value()));
+ AssertThrow(state.state == SolverControl::success,
+ SolverControl::NoConvergence (step,
+ state.last_residual));
// otherwise exit as normal
}
template<class VECTOR>
template<class MATRIX, class PRECONDITIONER>
-bool
+typename SolverQMRS<VECTOR>::IterationResult
SolverQMRS<VECTOR>::iterate(const MATRIX &A,
const PRECONDITIONER &precondition)
{
v.sadd(-1.,1.,b);
res = v.l2_norm();
- if (this->control().check(step, res) == SolverControl::success)
- return false;
+ if (this->iteration_status(step, res, x) == SolverControl::success)
+ return IterationResult(SolverControl::success, res);
p = v;
//TODO:[?] Find a really good breakdown criterion. The absolute one detects breakdown instead of convergence
if (std::fabs(sigma/rho) < additional_data.breakdown)
- return true;
+ return IterationResult(SolverControl::iterate, std::fabs(sigma/rho));
// Step 3
alpha = rho/sigma;
}
else
res = std::sqrt((it+1)*tau);
- state = this->control().check(step,res);
+ state = this->iteration_status(step,res,x);
if ((state == SolverControl::success)
|| (state == SolverControl::failure))
- return false;
+ return IterationResult(state, res);
// Step 6
if (std::fabs(rho) < additional_data.breakdown)
- return true;
+ return IterationResult(SolverControl::iterate, std::fabs(rho));
// Step 7
rho_old = rho;
precondition.vmult(q,v);
p.sadd(beta,v);
precondition.vmult(q,p);
}
- return false;
+ return IterationResult(SolverControl::success, std::fabs(rho));
}
#endif // DOXYGEN
deallog.push("Relaxation");
+ int iter=0;
try
{
// Main loop
- for (int iter=0; conv==SolverControl::iterate; iter++)
+ for (; conv==SolverControl::iterate; iter++)
{
// Compute residual
A.vmult(r,x);
// residual is computed in
// criterion() and stored
// in res.
- conv = this->control().check (iter, r.l2_norm());
+ conv = this->iteration_status (iter, r.l2_norm(), x);
if (conv != SolverControl::iterate)
break;
R.step(x,b);
deallog.pop();
// in case of failure: throw exception
- if (this->control().last_check() != SolverControl::success)
- AssertThrow(false, SolverControl::NoConvergence (this->control().last_step(),
- this->control().last_value()));
+ AssertThrow(conv == SolverControl::success,
+ SolverControl::NoConvergence (iter, r.l2_norm()));
// otherwise exit as normal
}
{
SolverControl::State conv=SolverControl::iterate;
+ double last_criterion = -std::numeric_limits<double>::max();
+
+ unsigned int iter = 0;
+
// Memory allocation
Vr = this->memory.alloc();
VECTOR &r = *Vr;
try
{
// Main loop
- for (int iter=0; conv==SolverControl::iterate; iter++)
+ while (conv==SolverControl::iterate)
{
// Do not use residual,
// but do it in 2 steps
// residual is computed in
// criterion() and stored
// in res.
- conv = this->control().check (iter, criterion());
-// conv = this->control().check (iter, std::sqrt(A.matrix_norm_square(r)));
+ last_criterion = criterion();
+ conv = this->iteration_status (iter, last_criterion, x);
if (conv != SolverControl::iterate)
break;
x.add(additional_data.omega,d);
print_vectors(iter,x,r,d);
+
+ ++iter;
}
}
catch (...)
deallog.pop();
// in case of failure: throw exception
- if (this->control().last_check() != SolverControl::success)
- AssertThrow(false, SolverControl::NoConvergence (this->control().last_step(),
- this->control().last_value()));
+ if (conv != SolverControl::success)
+ AssertThrow(false, SolverControl::NoConvergence (iter,
+ last_criterion));
// otherwise exit as normal
}
const PRECONDITIONER &precondition)
{
SolverControl::State conv=SolverControl::iterate;
+ double last_criterion = -std::numeric_limits<double>::max();
+
+ unsigned int iter = 0;
// Memory allocation
Vr = this->memory.alloc();
try
{
// Main loop
- for (int iter=0; conv==SolverControl::iterate; iter++)
+ while (conv==SolverControl::iterate)
{
// Do not use Tresidual,
// but do it in 2 steps
r.sadd(-1.,1.,b);
precondition.Tvmult(d,r);
- conv = this->control().check (iter, criterion());
+ last_criterion = criterion();
+ conv = this->iteration_status (iter, last_criterion, x);
if (conv != SolverControl::iterate)
break;
x.add(additional_data.omega,d);
print_vectors(iter,x,r,d);
+
+ ++iter;
}
}
catch (...)
this->memory.free(Vd);
deallog.pop();
// in case of failure: throw exception
- if (this->control().last_check() != SolverControl::success)
- AssertThrow(false, SolverControl::NoConvergence (this->control().last_step(),
- this->control().last_value()));
+ if (conv != SolverControl::success)
+ AssertThrow(false, SolverControl::NoConvergence (iter, last_criterion));
+
// otherwise exit as normal
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
SolverMinRes<> solver(control, mem);
PreconditionIdentity preconditioner;
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
SolverQMRS<> solver(control, mem);
PreconditionIdentity preconditioner;
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
DEAL:sor:Richardson::Convergence step 7 value 0.0004339
DEAL:sor:cg::Starting value 3.000
DEAL:sor:cg::Failure step 100 value 0.2585
-DEAL:sor::Exception: SolverControl::NoConvergence (this->control().last_step(), this->control().last_value())
+DEAL:sor::Exception: SolverControl::NoConvergence (it, res)
DEAL:sor:Bicgstab::Starting value 3.000
DEAL:sor:Bicgstab::Convergence step 5 value 0
DEAL:sor:GMRES::Starting value 1.462
DEAL:psor:Richardson::Convergence step 8 value 0.0004237
DEAL:psor:cg::Starting value 3.000
DEAL:psor:cg::Failure step 100 value 0.1024
-DEAL:psor::Exception: SolverControl::NoConvergence (this->control().last_step(), this->control().last_value())
+DEAL:psor::Exception: SolverControl::NoConvergence (it, res)
DEAL:psor:Bicgstab::Starting value 3.000
DEAL:psor:Bicgstab::Convergence step 4 value 0.0007969
DEAL:psor:GMRES::Starting value 1.467
DEAL::SOR-diff:0
DEAL:no-fail:cg::Starting value 11.00
DEAL:no-fail:cg::Failure step 10 value 0.1496
-DEAL:no-fail::Exception: SolverControl::NoConvergence (this->control().last_step(), this->control().last_value())
+DEAL:no-fail::Exception: SolverControl::NoConvergence (it, res)
DEAL:no-fail:Bicgstab::Starting value 11.00
DEAL:no-fail:Bicgstab::Failure step 10 value 0.002830
DEAL:no-fail:Bicgstab::Failure step 10 value 0.001961
-DEAL:no-fail::Exception: SolverControl::NoConvergence (this->control().last_step(), this->control().last_value())
+DEAL:no-fail::Exception: SolverControl::NoConvergence (state.last_step, state.last_residual)
DEAL:no-fail:GMRES::Starting value 11.00
DEAL:no-fail:GMRES::Failure step 10 value 0.8414
-DEAL:no-fail::Exception: SolverControl::NoConvergence (this->control().last_step(), this->control().last_value())
+DEAL:no-fail::Exception: SolverControl::NoConvergence (accumulated_iterations, last_res)
DEAL:no-fail:GMRES::Starting value 11.00
DEAL:no-fail:GMRES::Failure step 10 value 0.8414
-DEAL:no-fail::Exception: SolverControl::NoConvergence (this->control().last_step(), this->control().last_value())
+DEAL:no-fail::Exception: SolverControl::NoConvergence (accumulated_iterations, last_res)
DEAL:no-fail:QMRS::Starting value 11.00
DEAL:no-fail:QMRS::Failure step 10 value 0.4215
-DEAL:no-fail::Exception: SolverControl::NoConvergence (this->control().last_step(), this->control().last_value())
+DEAL:no-fail::Exception: SolverControl::NoConvergence (step, state.last_residual)
DEAL:no:Richardson::Starting value 11.00
DEAL:no:Richardson::Failure step 100 value 0.3002
-DEAL:no::Exception: SolverControl::NoConvergence (this->control().last_step(), this->control().last_value())
+DEAL:no::Exception: SolverControl::NoConvergence (iter, last_criterion)
DEAL:no:cg::Starting value 11.00
DEAL:no:cg::Convergence step 15 value 0.0005794
DEAL:no:Bicgstab::Starting value 11.00
DEAL:no:QMRS::Convergence step 16 value 0.0002583
DEAL:rich:Richardson::Starting value 11.00
DEAL:rich:Richardson::Failure step 100 value 1.219
-DEAL:rich::Exception: SolverControl::NoConvergence (this->control().last_step(), this->control().last_value())
+DEAL:rich::Exception: SolverControl::NoConvergence (iter, last_criterion)
DEAL:rich:cg::Starting value 11.00
DEAL:rich:cg::Convergence step 15 value 0.0005794
DEAL:rich:Bicgstab::Starting value 11.00
DEAL:sor:Richardson::Convergence step 88 value 0.0009636
DEAL:sor:cg::Starting value 11.00
DEAL:sor:cg::Failure step 100 value 5.643
-DEAL:sor::Exception: SolverControl::NoConvergence (this->control().last_step(), this->control().last_value())
+DEAL:sor::Exception: SolverControl::NoConvergence (it, res)
DEAL:sor:Bicgstab::Starting value 11.00
DEAL:sor:Bicgstab::Convergence step 14 value 0.0009987
DEAL:sor:GMRES::Starting value 7.322
DEAL:psor:Richardson::Convergence step 89 value 0.0009736
DEAL:psor:cg::Starting value 11.00
DEAL:psor:cg::Failure step 100 value 2.935
-DEAL:psor::Exception: SolverControl::NoConvergence (this->control().last_step(), this->control().last_value())
+DEAL:psor::Exception: SolverControl::NoConvergence (it, res)
DEAL:psor:Bicgstab::Starting value 11.00
DEAL:psor:Bicgstab::Convergence step 11 value 0.0005151
DEAL:psor:GMRES::Starting value 7.345
DEAL:no-fail:cg::Condition number estimate: 54.75
DEAL:no-fail:cg::Failure step 10 value 0.1496
DEAL:no-fail:cg:: 0.1363 0.6565 1.499 2.357 3.131 3.994 5.392 6.576 7.464
-DEAL:no-fail::Exception: SolverControl::NoConvergence (this->control().last_step(), this->control().last_value())
+DEAL:no-fail::Exception: SolverControl::NoConvergence (it, res)
DEAL:no:cg::Starting value 11.00
DEAL:no:cg::Condition number estimate: 11.01
DEAL:no:cg::Condition number estimate: 21.10
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
GrowingVectorMemory<PETScWrappers::Vector> mem;
SolverCG<PETScWrappers::Vector> solver(control,mem);
PreconditionIdentity preconditioner;
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
GrowingVectorMemory<PETScWrappers::Vector>::release_unused_memory ();
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- const unsigned int steps = solver.control().last_step();
+ const unsigned int steps = solver_control.last_step();
if (steps >= 49 && steps <= 51)
{
deallog << "Solver stopped within 49 - 51 iterations"
}
else
{
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
}
GrowingVectorMemory<PETScWrappers::Vector> mem;
SolverBicgstab<PETScWrappers::Vector> solver(control,mem);
PreconditionIdentity preconditioner;
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
GrowingVectorMemory<PETScWrappers::Vector>::release_unused_memory ();
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
GrowingVectorMemory<PETScWrappers::Vector> mem;
SolverGMRES<PETScWrappers::Vector> solver(control,mem);
PreconditionIdentity preconditioner;
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
GrowingVectorMemory<PETScWrappers::Vector>::release_unused_memory ();
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
GrowingVectorMemory<PETScWrappers::Vector> mem;
SolverMinRes<PETScWrappers::Vector> solver(control,mem);
PreconditionIdentity preconditioner;
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
GrowingVectorMemory<PETScWrappers::Vector>::release_unused_memory ();
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
GrowingVectorMemory<PETScWrappers::Vector> mem;
SolverQMRS<PETScWrappers::Vector> solver(control,mem);
PreconditionIdentity preconditioner;
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
GrowingVectorMemory<PETScWrappers::Vector>::release_unused_memory ();
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
deallog << "Exception: " << e.get_exc_name() << std::endl;
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
PETScWrappers::SolverRichardson solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
deallog << "Exception: " << e.get_exc_name() << std::endl;
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
PETScWrappers::SolverChebychev solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
PETScWrappers::SolverCG solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
PETScWrappers::SolverCG solver(control);
PETScWrappers::PreconditionNone preconditioner(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
PETScWrappers::SolverCG solver(control);
PETScWrappers::PreconditionBoomerAMG preconditioner(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
PETScWrappers::SolverCG solver(control);
PETScWrappers::PreconditionBoomerAMG preconditioner(A, true);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
PETScWrappers::SolverCG solver(control);
PETScWrappers::PreconditionEisenstat preconditioner(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
PETScWrappers::SolverCG solver(control);
PETScWrappers::PreconditionICC preconditioner(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
PETScWrappers::SolverCG solver(control);
PETScWrappers::PreconditionILU preconditioner(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
// we use a direct solver as a
// preconditioner. this should
// converge in one step!
- Assert (solver.control().last_step() == 1,
+ Assert (solver_control.last_step() == 1,
ExcInternalError());
}
PETScWrappers::SolverCG solver(control);
PETScWrappers::PreconditionLU preconditioner(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
PETScWrappers::SolverCG solver(control);
PETScWrappers::PreconditionParaSails preconditioner(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
PETScWrappers::SolverCG solver(control);
PETScWrappers::PreconditionSOR preconditioner(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
PETScWrappers::SolverCG solver(control);
PETScWrappers::PreconditionSSOR preconditioner(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
PETScWrappers::SolverBiCG solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
PETScWrappers::SolverGMRES solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
PETScWrappers::SolverBicgstab solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
PETScWrappers::SolverCGS solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
PETScWrappers::SolverTFQMR solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
PETScWrappers::SolverTCQMR solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
PETScWrappers::SolverCR solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
deallog << "Catched exception dealii::SolverControl::NoConvergence" << std::endl;
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
PETScWrappers::SolverLSQR solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
solver.solve(A,u,f,P);
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
PETScWrappers::SolverPreOnly solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
//run twice because this errored out at some point
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
solver.solve(A,u,f,P);
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
PETScWrappers::PreconditionJacobi preconditioner(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
deallog << u.l2_norm() << std::endl;
- check_solve (solver, A,t,u, preconditioner);
+ check_solve (solver, control, A,t,u, preconditioner);
deallog << t.l2_norm() << std::endl;
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
#include <deal.II/lac/vector_memory.h>
#include <typeinfo>
-template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
-void
-check_solve( SOLVER &solver, const MATRIX &A,
- VECTOR &u, VECTOR &f, const PRECONDITION &P)
-{
- deallog << "Solver type: " << typeid(solver).name() << std::endl;
-
- u = 0.;
- f = 1.;
- try
- {
- solver.solve(A,u,f,P);
- }
- catch (std::exception &e)
- {
- deallog << e.what() << std::endl;
- abort ();
- }
-
- deallog << "Solver stopped after " << solver.control().last_step()
- << " iterations" << std::endl;
-}
int main(int argc, char **argv)
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
GrowingVectorMemory<TrilinosWrappers::Vector> mem;
SolverCG<TrilinosWrappers::Vector> solver(control, mem);
PreconditionIdentity preconditioner;
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- const unsigned int steps = solver.control().last_step();
+ const unsigned int steps = solver_control.last_step();
if (steps >= 49 && steps <= 51)
{
deallog << "Solver stopped within 49 - 51 iterations"
}
else
{
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
}
GrowingVectorMemory<TrilinosWrappers::Vector> mem;
SolverBicgstab<TrilinosWrappers::Vector> solver(control,mem);
PreconditionIdentity preconditioner;
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
GrowingVectorMemory<TrilinosWrappers::Vector> mem;
SolverGMRES<TrilinosWrappers::Vector> solver(control,mem);
PreconditionIdentity preconditioner;
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
GrowingVectorMemory<TrilinosWrappers::Vector> mem;
SolverMinRes<TrilinosWrappers::Vector> solver(control,mem);
PreconditionIdentity preconditioner;
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
GrowingVectorMemory<TrilinosWrappers::Vector> mem;
SolverQMRS<TrilinosWrappers::Vector> solver(control,mem);
PreconditionIdentity preconditioner;
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
deallog << e.what() << std::endl;
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
GrowingVectorMemory<TrilinosWrappers::Vector> mem;
SolverRichardson<TrilinosWrappers::Vector> solver(control,mem,0.1);
PreconditionIdentity preconditioner;
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
TrilinosWrappers::SolverCG solver(control);
TrilinosWrappers::PreconditionJacobi preconditioner;
preconditioner.initialize(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
TrilinosWrappers::SolverGMRES solver(control);
TrilinosWrappers::PreconditionJacobi preconditioner;
preconditioner.initialize(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}
// ---------------------------------------------------------------------
//
-// Copyright (C) 2004 - 2013 by the deal.II authors
+// Copyright (C) 2004 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
+check_solve( SOLVER &solver,
+ const SolverControl &solver_control,
+ const MATRIX &A,
VECTOR &u, VECTOR &f, const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
abort ();
}
- deallog << "Solver stopped after " << solver.control().last_step()
+ deallog << "Solver stopped after " << solver_control.last_step()
<< " iterations" << std::endl;
}
TrilinosWrappers::SolverCGS solver(control);
TrilinosWrappers::PreconditionJacobi preconditioner;
preconditioner.initialize(A);
- check_solve (solver, A,u,f, preconditioner);
+ check_solve (solver, control, A,u,f, preconditioner);
}
}