Loading...
Searching...
No Matches
parameters.hh
Go to the documentation of this file.
// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_AMG_PARAMETERS_HH
#define DUNE_AMG_PARAMETERS_HH
#include <cstddef>
namespace Dune
{
namespace Amg
{
class DependencyParameters
{
public:
DependencyParameters()
: alpha_(1.0/3.0), beta_(1.0E-5)
{}
void setBeta(double b)
{
beta_ = b;
}
double beta() const
{
return beta_;
}
void setAlpha(double a)
{
alpha_ = a;
}
double alpha() const
{
return alpha_;
}
private:
double alpha_, beta_;
};
class AggregationParameters :
public DependencyParameters
{
public:
AggregationParameters()
: maxDistance_(2), minAggregateSize_(4), maxAggregateSize_(6),
connectivity_(15), skipiso_(false)
{}
void setDefaultValuesIsotropic(std::size_t dim, std::size_t diameter=2)
{
maxDistance_=diameter-1;
std::size_t csize=1;
for(; dim>0; dim--) {
csize*=diameter;
maxDistance_+=diameter-1;
}
minAggregateSize_=csize;
maxAggregateSize_=static_cast<std::size_t>(csize*1.5);
}
void setDefaultValuesAnisotropic(std::size_t dim,std::size_t diameter=2)
{
setDefaultValuesIsotropic(dim, diameter);
maxDistance_+=dim-1;
}
std::size_t maxDistance() const { return maxDistance_;}
void setMaxDistance(std::size_t distance) { maxDistance_ = distance;}
bool skipIsolated() const
{
return skipiso_;
}
void setSkipIsolated(bool skip)
{
skipiso_=skip;
}
std::size_t minAggregateSize() const { return minAggregateSize_;}
void setMinAggregateSize(std::size_t size){ minAggregateSize_=size;}
std::size_t maxAggregateSize() const { return maxAggregateSize_;}
void setMaxAggregateSize(std::size_t size){ maxAggregateSize_ = size;}
std::size_t maxConnectivity() const { return connectivity_;}
void setMaxConnectivity(std::size_t connectivity){ connectivity_ = connectivity;}
private:
std::size_t maxDistance_, minAggregateSize_, maxAggregateSize_, connectivity_;
bool skipiso_;
};
enum AccumulationMode {
noAccu = 0,
atOnceAccu=1,
successiveAccu=2
};
class CoarseningParameters : public AggregationParameters
{
public:
void setMaxLevel(int l)
{
maxLevel_ = l;
}
int maxLevel() const
{
return maxLevel_;
}
void setCoarsenTarget(int nodes)
{
coarsenTarget_ = nodes;
}
int coarsenTarget() const
{
return coarsenTarget_;
}
void setMinCoarsenRate(double rate)
{
minCoarsenRate_ = rate;
}
double minCoarsenRate() const
{
return minCoarsenRate_;
}
AccumulationMode accumulate() const
{
return accumulate_;
}
void setAccumulate(AccumulationMode accu)
{
accumulate_=accu;
}
void setAccumulate(bool accu){
accumulate_=accu ? successiveAccu : noAccu;
}
bool useFixedOrder() const
{
return useFixedOrder_;
}
void setUseFixedOrder(bool useFixedOrder)
{
useFixedOrder_ = useFixedOrder;
}
void setProlongationDampingFactor(double d)
{
dampingFactor_ = d;
}
double getProlongationDampingFactor() const
{
return dampingFactor_;
}
CoarseningParameters(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2,
double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu,
bool useFixedOrder = false)
: maxLevel_(maxLevel), coarsenTarget_(coarsenTarget), minCoarsenRate_(minCoarsenRate),
dampingFactor_(prolongDamp), accumulate_( accumulate), useFixedOrder_(useFixedOrder)
{}
private:
int maxLevel_;
int coarsenTarget_;
double minCoarsenRate_;
double dampingFactor_;
AccumulationMode accumulate_;
bool useFixedOrder_;
};
class Parameters : public CoarseningParameters
{
public:
void setDebugLevel(int level)
{
debugLevel_ = level;
}
int debugLevel() const
{
return debugLevel_;
}
void setNoPreSmoothSteps(std::size_t steps)
{
preSmoothSteps_=steps;
}
std::size_t getNoPreSmoothSteps() const
{
return preSmoothSteps_;
}
void setNoPostSmoothSteps(std::size_t steps)
{
postSmoothSteps_=steps;
}
std::size_t getNoPostSmoothSteps() const
{
return postSmoothSteps_;
}
void setGamma(std::size_t gamma)
{
gamma_=gamma;
}
std::size_t getGamma() const
{
return gamma_;
}
void setAdditive(bool additive)
{
additive_=additive;
}
bool getAdditive() const
{
return additive_;
}
Parameters(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2,
double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu, bool useFixedOrder = false)
: CoarseningParameters(maxLevel, coarsenTarget, minCoarsenRate, prolongDamp, accumulate, useFixedOrder)
, debugLevel_(2), preSmoothSteps_(2), postSmoothSteps_(2), gamma_(1),
additive_(false)
{}
private:
int debugLevel_;
std::size_t preSmoothSteps_;
std::size_t postSmoothSteps_;
std::size_t gamma_;
bool additive_;
};
} //namespace AMG
} //namespace Dune
#endif
Dune::Amg::AggregationParameters::setDefaultValuesAnisotropic
void setDefaultValuesAnisotropic(std::size_t dim, std::size_t diameter=2)
Sets reasonable default values for an anisotropic problem.
Definition parameters.hh:132
Dune::Amg::Parameters::setAdditive
void setAdditive(bool additive)
Set whether to use additive multigrid.
Definition parameters.hh:492
Dune::Amg::AggregationParameters::setSkipIsolated
void setSkipIsolated(bool skip)
Set whether isolated aggregates will not be represented on the coarse level.
Definition parameters.hh:171
Dune::Amg::CoarseningParameters::setProlongationDampingFactor
void setProlongationDampingFactor(double d)
Set the damping factor for the prolongation.
Definition parameters.hh:345
Dune::Amg::CoarseningParameters::CoarseningParameters
CoarseningParameters(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2, double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu, bool useFixedOrder=false)
Constructor.
Definition parameters.hh:372
Dune::Amg::DependencyParameters::alpha
double alpha() const
Get the scaling value for marking connections as strong. Default value is 1/3.
Definition parameters.hh:70
Dune::Amg::AggregationParameters::setMaxAggregateSize
void setMaxAggregateSize(std::size_t size)
Set the maximum number of nodes a aggregate is allowed to have.
Definition parameters.hh:201
Dune::Amg::CoarseningParameters::setMinCoarsenRate
void setMinCoarsenRate(double rate)
Set the minimum coarsening rate to be achieved in each coarsening.
Definition parameters.hh:295
Dune::Amg::CoarseningParameters::minCoarsenRate
double minCoarsenRate() const
Get the minimum coarsening rate to be achieved.
Definition parameters.hh:303
Dune::Amg::AggregationParameters::maxAggregateSize
std::size_t maxAggregateSize() const
Get the maximum number of nodes a aggregate is allowed to have.
Definition parameters.hh:193
Dune::Amg::DependencyParameters::setAlpha
void setAlpha(double a)
Set the scaling value for marking connections as strong. Default value is 1/3.
Definition parameters.hh:61
Dune::Amg::Parameters::Parameters
Parameters(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2, double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu, bool useFixedOrder=false)
Constructor.
Definition parameters.hh:516
Dune::Amg::DependencyParameters::beta
double beta() const
Get the threshold for marking nodes as isolated. The default value is 1.0E-5.
Definition parameters.hh:52
Dune::Amg::AggregationParameters::maxConnectivity
std::size_t maxConnectivity() const
Get the maximum number of connections a aggregate is allowed to have.
Definition parameters.hh:210
Dune::Amg::CoarseningParameters::coarsenTarget
int coarsenTarget() const
Get the maximum number of unknowns allowed on the coarsest level.
Definition parameters.hh:285
Dune::Amg::CoarseningParameters::setAccumulate
void setAccumulate(AccumulationMode accu)
Set whether the data should be accumulated on fewer processes on coarser levels.
Definition parameters.hh:318
Dune::Amg::CoarseningParameters::getProlongationDampingFactor
double getProlongationDampingFactor() const
Get the damping factor for the prolongation.
Definition parameters.hh:355
Dune::Amg::CoarseningParameters::accumulate
AccumulationMode accumulate() const
Whether the data should be accumulated on fewer processes on coarser levels.
Definition parameters.hh:311
Dune::Amg::CoarseningParameters::setUseFixedOrder
void setUseFixedOrder(bool useFixedOrder)
Definition parameters.hh:335
Dune::Amg::CoarseningParameters::useFixedOrder
bool useFixedOrder() const
Check if the indices for the coarser levels should be created in a fixed order.
Definition parameters.hh:330
Dune::Amg::AggregationParameters::setMaxConnectivity
void setMaxConnectivity(std::size_t connectivity)
Set the maximum number of connections a aggregate is allowed to have.
Definition parameters.hh:219
Dune::Amg::AggregationParameters::minAggregateSize
std::size_t minAggregateSize() const
Get the minimum number of nodes a aggregate has to consist of.
Definition parameters.hh:180
Dune::Amg::Parameters::getAdditive
bool getAdditive() const
Get whether to use additive multigrid.
Definition parameters.hh:501
Dune::Amg::CoarseningParameters::setMaxLevel
void setMaxLevel(int l)
Set the maximum number of levels allowed in the hierarchy.
Definition parameters.hh:262
Dune::Amg::Parameters::setDebugLevel
void setDebugLevel(int level)
Set the debugging level.
Definition parameters.hh:424
Dune::Amg::Parameters::getGamma
std::size_t getGamma() const
Get the value of gamma; 1 for V-cycle, 2 for W-cycle.
Definition parameters.hh:483
Dune::Amg::Parameters::setNoPostSmoothSteps
void setNoPostSmoothSteps(std::size_t steps)
Set the number of postsmoothing steps to apply.
Definition parameters.hh:460
Dune::Amg::Parameters::getNoPreSmoothSteps
std::size_t getNoPreSmoothSteps() const
Get the number of presmoothing steps to apply.
Definition parameters.hh:451
Dune::Amg::DependencyParameters::DependencyParameters
DependencyParameters()
Constructor.
Definition parameters.hh:34
Dune::Amg::AggregationParameters::setMinAggregateSize
void setMinAggregateSize(std::size_t size)
Set the minimum number of nodes a aggregate has to consist of.
Definition parameters.hh:187
Dune::Amg::CoarseningParameters::maxLevel
int maxLevel() const
Get the maximum number of levels allowed in the hierarchy.
Definition parameters.hh:269
Dune::Amg::AggregationParameters::setDefaultValuesIsotropic
void setDefaultValuesIsotropic(std::size_t dim, std::size_t diameter=2)
Sets reasonable default values for an isotropic problem.
Definition parameters.hh:109
Dune::Amg::AggregationParameters::AggregationParameters
AggregationParameters()
Constructor.
Definition parameters.hh:95
Dune::Amg::AggregationParameters::skipIsolated
bool skipIsolated() const
Whether isolated aggregates will not be represented on the coarse level.
Definition parameters.hh:161
Dune::Amg::CoarseningParameters::setCoarsenTarget
void setCoarsenTarget(int nodes)
Set the maximum number of unknowns allowed on the coarsest level.
Definition parameters.hh:277
Dune::Amg::Parameters::setNoPreSmoothSteps
void setNoPreSmoothSteps(std::size_t steps)
Set the number of presmoothing steps to apply.
Definition parameters.hh:443
Dune::Amg::AccumulationMode
AccumulationMode
Identifiers for the different accumulation modes.
Definition parameters.hh:231
Dune::Amg::DependencyParameters::setBeta
void setBeta(double b)
Set threshold for marking nodes as isolated. The default value is 1.0E-5.
Definition parameters.hh:42
Dune::Amg::AggregationParameters::maxDistance
std::size_t maxDistance() const
Get the maximal distance allowed between two nodes in a aggregate.
Definition parameters.hh:144
Dune::Amg::Parameters::setGamma
void setGamma(std::size_t gamma)
Set the value of gamma; 1 for V-cycle, 2 for W-cycle.
Definition parameters.hh:476
Dune::Amg::CoarseningParameters::setAccumulate
void setAccumulate(bool accu)
Definition parameters.hh:323
Dune::Amg::AggregationParameters::setMaxDistance
void setMaxDistance(std::size_t distance)
Set the maximal distance allowed between two nodes in a aggregate.
Definition parameters.hh:154
Dune::Amg::Parameters::debugLevel
int debugLevel() const
Get the debugging Level.
Definition parameters.hh:434
Dune::Amg::Parameters::getNoPostSmoothSteps
std::size_t getNoPostSmoothSteps() const
Get the number of postsmoothing steps to apply.
Definition parameters.hh:468
Dune::Amg::atOnceAccu
@ atOnceAccu
Accumulate data to one process at once.
Definition parameters.hh:243
Dune::Amg::noAccu
@ noAccu
No data accumulution.
Definition parameters.hh:237
Dune::Amg::successiveAccu
@ successiveAccu
Successively accumulate to fewer processes.
Definition parameters.hh:247
Dune
Definition allocator.hh:11
Dune::Amg
Definition novlpschwarz.hh:256