Skip to content
Snippets Groups Projects
Commit 0c2560dd authored by Rebecca Neumann's avatar Rebecca Neumann
Browse files

add member variable verbosity_ to AMG, check verbosity before printing output

[[Imported from SVN: r1474]]
parent 1dc39dab
No related branches found
No related tags found
No related merge requests found
......@@ -266,6 +266,8 @@ namespace Dune
bool buildHierarchy_;
bool additive;
Smoother *coarseSmoother_;
/** @brief The verbosity level. */
std::size_t verbosity_;
};
template<class M, class X, class S, class PI, class A>
......@@ -276,7 +278,7 @@ namespace Dune
: matrices_(&matrices), smootherArgs_(smootherArgs),
smoothers_(), solver_(&coarseSolver), scalarProduct_(0),
gamma_(gamma), preSteps_(preSmoothingSteps), postSteps_(postSmoothingSteps), buildHierarchy_(false),
additive(additive_), coarseSmoother_()
additive(additive_), coarseSmoother_(), verbosity_(2)
{
assert(matrices_->isBuilt());
......@@ -292,7 +294,7 @@ namespace Dune
smoothers_(), solver_(&coarseSolver), scalarProduct_(0),
gamma_(parms.getGamma()), preSteps_(parms.getNoPreSmoothSteps()),
postSteps_(parms.getNoPostSmoothSteps()), buildHierarchy_(false),
additive(parms.getAdditive()), coarseSmoother_()
additive(parms.getAdditive()), coarseSmoother_(), verbosity_(parms.debugLevel())
{
assert(matrices_->isBuilt());
......@@ -312,7 +314,7 @@ namespace Dune
: smootherArgs_(smootherArgs),
smoothers_(), solver_(), scalarProduct_(0), gamma_(gamma),
preSteps_(preSmoothingSteps), postSteps_(postSmoothingSteps), buildHierarchy_(true),
additive(additive_), coarseSmoother_()
additive(additive_), coarseSmoother_(), verbosity_(criterion.debugLevel())
{
dune_static_assert(static_cast<int>(M::category)==static_cast<int>(S::category),
"Matrix and Solver must match in terms of category!");
......@@ -327,7 +329,7 @@ namespace Dune
// build the necessary smoother hierarchies
matrices_->coarsenSmoother(smoothers_, smootherArgs_);
if(criterion.debugLevel()>0 && matrices_->parallelInformation().finest()->communicator().rank()==0)
if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator().rank()==0)
std::cout<<"Building Hierarchy of "<<matrices_->maxlevels()<<" levels took "<<watch.elapsed()<<" seconds."<<std::endl;
}
......@@ -341,7 +343,7 @@ namespace Dune
smoothers_(), solver_(), scalarProduct_(0),
gamma_(criterion.getGamma()), preSteps_(criterion.getNoPreSmoothSteps()),
postSteps_(criterion.getNoPostSmoothSteps()), buildHierarchy_(true),
additive(criterion.getAdditive()), coarseSmoother_()
additive(criterion.getAdditive()), coarseSmoother_(), verbosity_(criterion.debugLevel())
{
dune_static_assert(static_cast<int>(M::category)==static_cast<int>(S::category),
"Matrix and Solver must match in terms of category!");
......@@ -356,7 +358,7 @@ namespace Dune
// build the necessary smoother hierarchies
matrices_->coarsenSmoother(smoothers_, smootherArgs_);
if(criterion.debugLevel()>0 && matrices_->parallelInformation().finest()->communicator().rank()==0)
if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator().rank()==0)
std::cout<<"Building Hierarchy of "<<matrices_->maxlevels()<<" levels took "<<watch.elapsed()<<" seconds."<<std::endl;
}
......@@ -443,7 +445,8 @@ namespace Dune
|| (matrices_->parallelInformation().coarsest().isRedistributed()
&& matrices_->parallelInformation().coarsest().getRedistributed().communicator().size()==1
&& matrices_->parallelInformation().coarsest().getRedistributed().communicator().size()>0)) { // redistribute and 1 proc
std::cout<<"Using superlu"<<std::endl;
if(verbosity_>0 && matrices_->parallelInformation().coarsest()->communicator().rank()==0)
std::cout<<"Using superlu"<<std::endl;
if(matrices_->parallelInformation().coarsest().isRedistributed())
{
if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment