Dune Core Modules (2.6.0)

parameters.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_AMG_PARAMETERS_HH
4#define DUNE_AMG_PARAMETERS_HH
5
6#include <cstddef>
7
8namespace Dune
9{
10 namespace Amg
11 {
29 {
30 public:
33 : alpha_(1.0/3.0), beta_(1.0E-5)
34 {}
35
40 void setBeta(double b)
41 {
42 beta_ = b;
43 }
44
50 double beta() const
51 {
52 return beta_;
53 }
54
59 void setAlpha(double a)
60 {
61 alpha_ = a;
62 }
63
68 double alpha() const
69 {
70 return alpha_;
71 }
72
73 private:
74 double alpha_, beta_;
75 };
76
82 {
83 public:
94 : maxDistance_(2), minAggregateSize_(4), maxAggregateSize_(6),
95 connectivity_(15), skipiso_(false)
96 {}
97
107 void setDefaultValuesIsotropic(std::size_t dim, std::size_t diameter=2)
108 {
109 maxDistance_=diameter-1;
110 std::size_t csize=1;
111
112 for(; dim>0; dim--) {
113 csize*=diameter;
114 maxDistance_+=diameter-1;
115 }
116 minAggregateSize_=csize;
117 maxAggregateSize_=static_cast<std::size_t>(csize*1.5);
118 }
119
130 void setDefaultValuesAnisotropic(std::size_t dim,std::size_t diameter=2)
131 {
132 setDefaultValuesIsotropic(dim, diameter);
133 maxDistance_+=dim-1;
134 }
142 std::size_t maxDistance() const { return maxDistance_;}
143
152 void setMaxDistance(std::size_t distance) { maxDistance_ = distance;}
153
159 bool skipIsolated() const
160 {
161 return skipiso_;
162 }
163
169 void setSkipIsolated(bool skip)
170 {
171 skipiso_=skip;
172 }
173
178 std::size_t minAggregateSize() const { return minAggregateSize_;}
179
186 void setMinAggregateSize(std::size_t size){ minAggregateSize_=size;}
187
192 std::size_t maxAggregateSize() const { return maxAggregateSize_;}
193
200 void setMaxAggregateSize(std::size_t size){ maxAggregateSize_ = size;}
201
209 std::size_t maxConnectivity() const { return connectivity_;}
210
218 void setMaxConnectivity(std::size_t connectivity){ connectivity_ = connectivity;}
219
220 private:
221 std::size_t maxDistance_, minAggregateSize_, maxAggregateSize_, connectivity_;
222 bool skipiso_;
223
224 };
225
226
247 };
248
249
250
251
256 {
257 public:
261 void setMaxLevel(int l)
262 {
263 maxLevel_ = l;
264 }
268 int maxLevel() const
269 {
270 return maxLevel_;
271 }
272
276 void setCoarsenTarget(int nodes)
277 {
278 coarsenTarget_ = nodes;
279 }
280
284 int coarsenTarget() const
285 {
286 return coarsenTarget_;
287 }
288
294 void setMinCoarsenRate(double rate)
295 {
296 minCoarsenRate_ = rate;
297 }
298
302 double minCoarsenRate() const
303 {
304 return minCoarsenRate_;
305 }
306
311 {
312 return accumulate_;
313 }
318 {
319 accumulate_=accu;
320 }
321
322 void setAccumulate(bool accu){
323 accumulate_=accu ? successiveAccu : noAccu;
324 }
331 {
332 dampingFactor_ = d;
333 }
334
341 {
342 return dampingFactor_;
343 }
355 double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu)
356 : maxLevel_(maxLevel), coarsenTarget_(coarsenTarget), minCoarsenRate_(minCoarsenRate),
357 dampingFactor_(prolongDamp), accumulate_( accumulate)
358 {}
359
360 private:
364 int maxLevel_;
368 int coarsenTarget_;
372 double minCoarsenRate_;
376 double dampingFactor_;
381 AccumulationMode accumulate_;
382 };
383
391 {
392 public:
399 void setDebugLevel(int level)
400 {
401 debugLevel_ = level;
402 }
403
409 int debugLevel() const
410 {
411 return debugLevel_;
412 }
413
418 void setNoPreSmoothSteps(std::size_t steps)
419 {
420 preSmoothSteps_=steps;
421 }
426 std::size_t getNoPreSmoothSteps() const
427 {
428 return preSmoothSteps_;
429 }
430
435 void setNoPostSmoothSteps(std::size_t steps)
436 {
437 postSmoothSteps_=steps;
438 }
443 std::size_t getNoPostSmoothSteps() const
444 {
445 return postSmoothSteps_;
446 }
447
451 void setGamma(std::size_t gamma)
452 {
453 gamma_=gamma;
454 }
458 std::size_t getGamma() const
459 {
460 return gamma_;
461 }
462
467 void setAdditive(bool additive)
468 {
469 additive_=additive;
470 }
471
476 bool getAdditive() const
477 {
478 return additive_;
479 }
480
491 Parameters(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2,
492 double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu)
494 , debugLevel_(2), preSmoothSteps_(2), postSmoothSteps_(2), gamma_(1),
495 additive_(false)
496 {}
497 private:
498 int debugLevel_;
499 std::size_t preSmoothSteps_;
500 std::size_t postSmoothSteps_;
501 std::size_t gamma_;
502 bool additive_;
503 };
504
505 } //namespace AMG
506
507} //namespace Dune
508#endif
Parameters needed for the aggregation process,.
Definition: parameters.hh:82
Parameters for the complete coarsening process.
Definition: parameters.hh:256
Parameters needed to check whether a node depends on another.
Definition: parameters.hh:29
All parameters for AMG.
Definition: parameters.hh:391
void setDefaultValuesAnisotropic(std::size_t dim, std::size_t diameter=2)
Sets reasonable default values for an aisotropic problem.
Definition: parameters.hh:130
void setAdditive(bool additive)
Set whether to use additive multigrid.
Definition: parameters.hh:467
void setSkipIsolated(bool skip)
Set whether isolated aggregates will not be represented on the coarse level.
Definition: parameters.hh:169
void setProlongationDampingFactor(double d)
Set the damping factor for the prolongation.
Definition: parameters.hh:330
double alpha() const
Get the scaling value for marking connections as strong. Default value is 1/3.
Definition: parameters.hh:68
void setMaxAggregateSize(std::size_t size)
Set the maximum number of nodes a aggregate is allowed to have.
Definition: parameters.hh:200
void setMinCoarsenRate(double rate)
Set the minimum coarsening rate to be achieved in each coarsening.
Definition: parameters.hh:294
double minCoarsenRate() const
Get the minimum coarsening rate to be achieved.
Definition: parameters.hh:302
std::size_t maxAggregateSize() const
Get the maximum number of nodes a aggregate is allowed to have.
Definition: parameters.hh:192
void setAlpha(double a)
Set the scaling value for marking connections as strong. Default value is 1/3.
Definition: parameters.hh:59
double beta() const
Get the threshold for marking nodes as isolated. The default value is 1.0E-5.
Definition: parameters.hh:50
std::size_t maxConnectivity() const
Get the maximum number of connections a aggregate is allowed to have.
Definition: parameters.hh:209
int coarsenTarget() const
Get the maximum number of unknowns allowed on the coarsest level.
Definition: parameters.hh:284
void setAccumulate(AccumulationMode accu)
Set whether he data should be accumulated on fewer processes on coarser levels.
Definition: parameters.hh:317
double getProlongationDampingFactor() const
Get the damping factor for the prolongation.
Definition: parameters.hh:340
AccumulationMode accumulate() const
Whether the data should be accumulated on fewer processes on coarser levels.
Definition: parameters.hh:310
void setMaxConnectivity(std::size_t connectivity)
Set the maximum number of connections a aggregate is allowed to have.
Definition: parameters.hh:218
std::size_t minAggregateSize() const
Get the minimum number of nodes a aggregate has to consist of.
Definition: parameters.hh:178
bool getAdditive() const
Get whether to use additive multigrid.
Definition: parameters.hh:476
void setMaxLevel(int l)
Set the maximum number of levels allowed in the hierarchy.
Definition: parameters.hh:261
void setDebugLevel(int level)
Set the debugging level.
Definition: parameters.hh:399
std::size_t getGamma() const
Get the value of gamma; 1 for V-cycle, 2 for W-cycle.
Definition: parameters.hh:458
void setNoPostSmoothSteps(std::size_t steps)
Set the number of postsmoothing steps to apply.
Definition: parameters.hh:435
std::size_t getNoPreSmoothSteps() const
Get the number of presmoothing steps to apply.
Definition: parameters.hh:426
DependencyParameters()
Constructor.
Definition: parameters.hh:32
void setMinAggregateSize(std::size_t size)
Set the minimum number of nodes a aggregate has to consist of.
Definition: parameters.hh:186
int maxLevel() const
Get the maximum number of levels allowed in the hierarchy.
Definition: parameters.hh:268
void setDefaultValuesIsotropic(std::size_t dim, std::size_t diameter=2)
Sets reasonable default values for an isotropic problem.
Definition: parameters.hh:107
AggregationParameters()
Constructor.
Definition: parameters.hh:93
bool skipIsolated() const
Whether isolated aggregates will not be represented on the coarse level.
Definition: parameters.hh:159
Parameters(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2, double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu)
Constructor.
Definition: parameters.hh:491
void setCoarsenTarget(int nodes)
Set the maximum number of unknowns allowed on the coarsest level.
Definition: parameters.hh:276
void setNoPreSmoothSteps(std::size_t steps)
Set the number of presmoothing steps to apply.
Definition: parameters.hh:418
AccumulationMode
Identifiers for the different accumulation modes.
Definition: parameters.hh:230
void setBeta(double b)
Set threshold for marking nodes as isolated. The default value is 1.0E-5.
Definition: parameters.hh:40
std::size_t maxDistance() const
Get the maximal distance allowed between to nodes in a aggregate.
Definition: parameters.hh:142
CoarseningParameters(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2, double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu)
Constructor.
Definition: parameters.hh:354
void setGamma(std::size_t gamma)
Set the value of gamma; 1 for V-cycle, 2 for W-cycle.
Definition: parameters.hh:451
void setMaxDistance(std::size_t distance)
Set the maximal distance allowed between to nodes in a aggregate.
Definition: parameters.hh:152
int debugLevel() const
Get the debugging Level.
Definition: parameters.hh:409
std::size_t getNoPostSmoothSteps() const
Get the number of postsmoothing steps to apply.
Definition: parameters.hh:443
@ atOnceAccu
Accumulate data to on process at once.
Definition: parameters.hh:242
@ noAccu
No data accumulution.
Definition: parameters.hh:236
@ successiveAccu
Successively accumulate to fewer processes.
Definition: parameters.hh:246
Dune namespace.
Definition: alignedallocator.hh:10
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 13, 23:29, 2024)