Dune Core Modules (unstable)

parameters.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4// vi: set et ts=4 sw=2 sts=2:
5#ifndef DUNE_AMG_PARAMETERS_HH
6#define DUNE_AMG_PARAMETERS_HH
7
8#include <cstddef>
9
10namespace Dune
11{
12 namespace Amg
13 {
31 {
32 public:
35 : alpha_(1.0/3.0), beta_(1.0E-5)
36 {}
37
42 void setBeta(double b)
43 {
44 beta_ = b;
45 }
46
52 double beta() const
53 {
54 return beta_;
55 }
56
61 void setAlpha(double a)
62 {
63 alpha_ = a;
64 }
65
70 double alpha() const
71 {
72 return alpha_;
73 }
74
75 private:
76 double alpha_, beta_;
77 };
78
84 {
85 public:
96 : maxDistance_(2), minAggregateSize_(4), maxAggregateSize_(6),
97 connectivity_(15), skipiso_(false)
98 {}
99
109 void setDefaultValuesIsotropic(std::size_t dim, std::size_t diameter=2)
110 {
111 maxDistance_=diameter-1;
112 std::size_t csize=1;
113
114 for(; dim>0; dim--) {
115 csize*=diameter;
116 maxDistance_+=diameter-1;
117 }
118 minAggregateSize_=csize;
119 maxAggregateSize_=static_cast<std::size_t>(csize*1.5);
120 }
121
132 void setDefaultValuesAnisotropic(std::size_t dim,std::size_t diameter=2)
133 {
134 setDefaultValuesIsotropic(dim, diameter);
135 maxDistance_+=dim-1;
136 }
144 std::size_t maxDistance() const { return maxDistance_;}
145
154 void setMaxDistance(std::size_t distance) { maxDistance_ = distance;}
155
161 bool skipIsolated() const
162 {
163 return skipiso_;
164 }
165
171 void setSkipIsolated(bool skip)
172 {
173 skipiso_=skip;
174 }
175
180 std::size_t minAggregateSize() const { return minAggregateSize_;}
181
187 void setMinAggregateSize(std::size_t size){ minAggregateSize_=size;}
188
193 std::size_t maxAggregateSize() const { return maxAggregateSize_;}
194
201 void setMaxAggregateSize(std::size_t size){ maxAggregateSize_ = size;}
202
210 std::size_t maxConnectivity() const { return connectivity_;}
211
219 void setMaxConnectivity(std::size_t connectivity){ connectivity_ = connectivity;}
220
221 private:
222 std::size_t maxDistance_, minAggregateSize_, maxAggregateSize_, connectivity_;
223 bool skipiso_;
224
225 };
226
227
248 };
249
250
251
252
257 {
258 public:
262 void setMaxLevel(int l)
263 {
264 maxLevel_ = l;
265 }
269 int maxLevel() const
270 {
271 return maxLevel_;
272 }
273
277 void setCoarsenTarget(int nodes)
278 {
279 coarsenTarget_ = nodes;
280 }
281
285 int coarsenTarget() const
286 {
287 return coarsenTarget_;
288 }
289
295 void setMinCoarsenRate(double rate)
296 {
297 minCoarsenRate_ = rate;
298 }
299
303 double minCoarsenRate() const
304 {
305 return minCoarsenRate_;
306 }
307
312 {
313 return accumulate_;
314 }
319 {
320 accumulate_=accu;
321 }
322
323 void setAccumulate(bool accu){
324 accumulate_=accu ? successiveAccu : noAccu;
325 }
326
330 bool useFixedOrder() const
331 {
332 return useFixedOrder_;
333 }
334
335 void setUseFixedOrder(bool useFixedOrder)
336 {
337 useFixedOrder_ = useFixedOrder;
338 }
339
346 {
347 dampingFactor_ = d;
348 }
349
356 {
357 return dampingFactor_;
358 }
373 double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu,
374 bool useFixedOrder = false)
375 : maxLevel_(maxLevel), coarsenTarget_(coarsenTarget), minCoarsenRate_(minCoarsenRate),
376 dampingFactor_(prolongDamp), accumulate_( accumulate), useFixedOrder_(useFixedOrder)
377 {}
378
379 private:
383 int maxLevel_;
387 int coarsenTarget_;
391 double minCoarsenRate_;
395 double dampingFactor_;
400 AccumulationMode accumulate_;
406 bool useFixedOrder_;
407 };
408
416 {
417 public:
424 void setDebugLevel(int level)
425 {
426 debugLevel_ = level;
427 }
428
434 int debugLevel() const
435 {
436 return debugLevel_;
437 }
438
443 void setNoPreSmoothSteps(std::size_t steps)
444 {
445 preSmoothSteps_=steps;
446 }
451 std::size_t getNoPreSmoothSteps() const
452 {
453 return preSmoothSteps_;
454 }
455
460 void setNoPostSmoothSteps(std::size_t steps)
461 {
462 postSmoothSteps_=steps;
463 }
468 std::size_t getNoPostSmoothSteps() const
469 {
470 return postSmoothSteps_;
471 }
472
476 void setGamma(std::size_t gamma)
477 {
478 gamma_=gamma;
479 }
483 std::size_t getGamma() const
484 {
485 return gamma_;
486 }
487
492 void setAdditive(bool additive)
493 {
494 additive_=additive;
495 }
496
501 bool getAdditive() const
502 {
503 return additive_;
504 }
505
516 Parameters(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2,
517 double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu, bool useFixedOrder = false)
519 , debugLevel_(2), preSmoothSteps_(2), postSmoothSteps_(2), gamma_(1),
520 additive_(false)
521 {}
522 private:
523 int debugLevel_;
524 std::size_t preSmoothSteps_;
525 std::size_t postSmoothSteps_;
526 std::size_t gamma_;
527 bool additive_;
528 };
529
530 } //namespace AMG
531
532} //namespace Dune
533#endif
Parameters needed for the aggregation process.
Definition: parameters.hh:84
Parameters for the complete coarsening process.
Definition: parameters.hh:257
Parameters needed to check whether a node depends on another.
Definition: parameters.hh:31
All parameters for AMG.
Definition: parameters.hh:416
void setDefaultValuesAnisotropic(std::size_t dim, std::size_t diameter=2)
Sets reasonable default values for an anisotropic problem.
Definition: parameters.hh:132
void setAdditive(bool additive)
Set whether to use additive multigrid.
Definition: parameters.hh:492
void setSkipIsolated(bool skip)
Set whether isolated aggregates will not be represented on the coarse level.
Definition: parameters.hh:171
void setProlongationDampingFactor(double d)
Set the damping factor for the prolongation.
Definition: parameters.hh:345
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
double alpha() const
Get the scaling value for marking connections as strong. Default value is 1/3.
Definition: parameters.hh:70
void setMaxAggregateSize(std::size_t size)
Set the maximum number of nodes a aggregate is allowed to have.
Definition: parameters.hh:201
void setMinCoarsenRate(double rate)
Set the minimum coarsening rate to be achieved in each coarsening.
Definition: parameters.hh:295
double minCoarsenRate() const
Get the minimum coarsening rate to be achieved.
Definition: parameters.hh:303
std::size_t maxAggregateSize() const
Get the maximum number of nodes a aggregate is allowed to have.
Definition: parameters.hh:193
void setAlpha(double a)
Set the scaling value for marking connections as strong. Default value is 1/3.
Definition: parameters.hh:61
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
double beta() const
Get the threshold for marking nodes as isolated. The default value is 1.0E-5.
Definition: parameters.hh:52
std::size_t maxConnectivity() const
Get the maximum number of connections a aggregate is allowed to have.
Definition: parameters.hh:210
int coarsenTarget() const
Get the maximum number of unknowns allowed on the coarsest level.
Definition: parameters.hh:285
void setAccumulate(AccumulationMode accu)
Set whether the data should be accumulated on fewer processes on coarser levels.
Definition: parameters.hh:318
double getProlongationDampingFactor() const
Get the damping factor for the prolongation.
Definition: parameters.hh:355
AccumulationMode accumulate() const
Whether the data should be accumulated on fewer processes on coarser levels.
Definition: parameters.hh:311
bool useFixedOrder() const
Check if the indices for the coarser levels should be created in a fixed order.
Definition: parameters.hh:330
void setMaxConnectivity(std::size_t connectivity)
Set the maximum number of connections a aggregate is allowed to have.
Definition: parameters.hh:219
std::size_t minAggregateSize() const
Get the minimum number of nodes a aggregate has to consist of.
Definition: parameters.hh:180
bool getAdditive() const
Get whether to use additive multigrid.
Definition: parameters.hh:501
void setMaxLevel(int l)
Set the maximum number of levels allowed in the hierarchy.
Definition: parameters.hh:262
void setDebugLevel(int level)
Set the debugging level.
Definition: parameters.hh:424
std::size_t getGamma() const
Get the value of gamma; 1 for V-cycle, 2 for W-cycle.
Definition: parameters.hh:483
void setNoPostSmoothSteps(std::size_t steps)
Set the number of postsmoothing steps to apply.
Definition: parameters.hh:460
std::size_t getNoPreSmoothSteps() const
Get the number of presmoothing steps to apply.
Definition: parameters.hh:451
DependencyParameters()
Constructor.
Definition: parameters.hh:34
void setMinAggregateSize(std::size_t size)
Set the minimum number of nodes a aggregate has to consist of.
Definition: parameters.hh:187
int maxLevel() const
Get the maximum number of levels allowed in the hierarchy.
Definition: parameters.hh:269
void setDefaultValuesIsotropic(std::size_t dim, std::size_t diameter=2)
Sets reasonable default values for an isotropic problem.
Definition: parameters.hh:109
AggregationParameters()
Constructor.
Definition: parameters.hh:95
bool skipIsolated() const
Whether isolated aggregates will not be represented on the coarse level.
Definition: parameters.hh:161
void setCoarsenTarget(int nodes)
Set the maximum number of unknowns allowed on the coarsest level.
Definition: parameters.hh:277
void setNoPreSmoothSteps(std::size_t steps)
Set the number of presmoothing steps to apply.
Definition: parameters.hh:443
AccumulationMode
Identifiers for the different accumulation modes.
Definition: parameters.hh:231
void setBeta(double b)
Set threshold for marking nodes as isolated. The default value is 1.0E-5.
Definition: parameters.hh:42
std::size_t maxDistance() const
Get the maximal distance allowed between two nodes in a aggregate.
Definition: parameters.hh:144
void setGamma(std::size_t gamma)
Set the value of gamma; 1 for V-cycle, 2 for W-cycle.
Definition: parameters.hh:476
void setMaxDistance(std::size_t distance)
Set the maximal distance allowed between two nodes in a aggregate.
Definition: parameters.hh:154
int debugLevel() const
Get the debugging Level.
Definition: parameters.hh:434
std::size_t getNoPostSmoothSteps() const
Get the number of postsmoothing steps to apply.
Definition: parameters.hh:468
@ atOnceAccu
Accumulate data to one process at once.
Definition: parameters.hh:243
@ noAccu
No data accumulution.
Definition: parameters.hh:237
@ successiveAccu
Successively accumulate to fewer processes.
Definition: parameters.hh:247
Dune namespace.
Definition: alignedallocator.hh:13
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition: integersequence.hh:75
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 21, 23:30, 2024)