dune-istl  2.2.0
parameters.hh
Go to the documentation of this file.
1 #ifndef DUNE_AMG_PARAMETERS_HH
2 #define DUNE_AMG_PARAMETERS_HH
3 
4 #include<cstddef>
5 
6 namespace Dune
7 {
8  namespace Amg
9  {
27  {
28  public:
31  : alpha_(1.0/3.0), beta_(1.0E-5)
32  {}
33 
38  void setBeta(double b)
39  {
40  beta_ = b;
41  }
42 
48  double beta() const
49  {
50  return beta_;
51  }
52 
57  void setAlpha(double a)
58  {
59  alpha_ = a;
60  }
61 
66  double alpha() const
67  {
68  return alpha_;
69  }
70 
71  private:
72  double alpha_, beta_;
73  };
74 
80  {
81  public:
92  : maxDistance_(2), minAggregateSize_(4), maxAggregateSize_(6),
93  connectivity_(15), skipiso_(false)
94  {}
95 
105  void setDefaultValuesIsotropic(std::size_t dim, std::size_t diameter=2)
106  {
107  maxDistance_=diameter-1;
108  std::size_t csize=1;
109 
110  for(;dim>0;dim--){
111  csize*=diameter;
112  maxDistance_+=diameter-1;
113  }
114  minAggregateSize_=csize;
115  maxAggregateSize_=static_cast<std::size_t>(csize*1.5);
116  }
117 
128  void setDefaultValuesAnisotropic(std::size_t dim,std::size_t diameter=2)
129  {
130  setDefaultValuesIsotropic(dim, diameter);
131  maxDistance_+=dim-1;
132  }
140  std::size_t maxDistance() const { return maxDistance_;}
141 
150  void setMaxDistance(std::size_t distance) { maxDistance_ = distance;}
151 
157  bool skipIsolated() const
158  {
159  return skipiso_;
160  }
161 
167  void setSkipIsolated(bool skip)
168  {
169  skipiso_=skip;
170  }
171 
176  std::size_t minAggregateSize() const { return minAggregateSize_;}
177 
184  void setMinAggregateSize(std::size_t size){ minAggregateSize_=size;}
185 
190  std::size_t maxAggregateSize() const{ return maxAggregateSize_;}
191 
198  void setMaxAggregateSize(std::size_t size){ maxAggregateSize_ = size;}
199 
207  std::size_t maxConnectivity() const{ return connectivity_;}
208 
216  void setMaxConnectivity(std::size_t connectivity){ connectivity_ = connectivity;}
217 
218  private:
219  std::size_t maxDistance_, minAggregateSize_, maxAggregateSize_, connectivity_;
220  bool skipiso_;
221 
222  };
223 
224 
234  noAccu = 0,
245  };
246 
247 
248 
249 
254  {
255  public:
259  void setMaxLevel(int l)
260  {
261  maxLevel_ = l;
262  }
266  int maxLevel() const
267  {
268  return maxLevel_;
269  }
270 
274  void setCoarsenTarget(int nodes)
275  {
276  coarsenTarget_ = nodes;
277  }
278 
282  int coarsenTarget() const
283  {
284  return coarsenTarget_;
285  }
286 
292  void setMinCoarsenRate(double rate)
293  {
294  minCoarsenRate_ = rate;
295  }
296 
300  double minCoarsenRate() const
301  {
302  return minCoarsenRate_;
303  }
304 
309  {
310  return accumulate_;
311  }
316  {
317  accumulate_=accu;
318  }
319 
320  void setAccumulate(bool accu){
321  accumulate_=accu?successiveAccu:noAccu;
322  }
329  {
330  dampingFactor_ = d;
331  }
332 
339  {
340  return dampingFactor_;
341  }
353  double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu)
354  : maxLevel_(maxLevel), coarsenTarget_(coarsenTarget), minCoarsenRate_(minCoarsenRate),
355  dampingFactor_(prolongDamp), accumulate_( accumulate)
356  {}
357 
358  private:
362  int maxLevel_;
366  int coarsenTarget_;
370  double minCoarsenRate_;
374  double dampingFactor_;
379  AccumulationMode accumulate_;
380  };
381 
389  {
390  public:
397  void setDebugLevel(int level)
398  {
399  debugLevel_ = level;
400  }
401 
407  int debugLevel() const
408  {
409  return debugLevel_;
410  }
411 
416  void setNoPreSmoothSteps(std::size_t steps)
417  {
418  preSmoothSteps_=steps;
419  }
424  std::size_t getNoPreSmoothSteps() const
425  {
426  return preSmoothSteps_;
427  }
428 
433  void setNoPostSmoothSteps(std::size_t steps)
434  {
435  postSmoothSteps_=steps;
436  }
441  std::size_t getNoPostSmoothSteps() const
442  {
443  return postSmoothSteps_;
444  }
445 
449  void setGamma(std::size_t gamma)
450  {
451  gamma_=gamma;
452  }
456  std::size_t getGamma() const
457  {
458  return gamma_;
459  }
460 
465  void setAdditive(bool additive)
466  {
467  additive_=additive;
468  }
469 
474  bool getAdditive() const
475  {
476  return additive_;
477  }
478 
489  Parameters(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2,
490  double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu)
492  , debugLevel_(2), preSmoothSteps_(2), postSmoothSteps_(2), gamma_(1),
493  additive_(false)
494  {}
495  private:
496  int debugLevel_;
497  std::size_t preSmoothSteps_;
498  std::size_t postSmoothSteps_;
499  std::size_t gamma_;
500  bool additive_;
501  };
502 
503  }//namespace AMG
504 
505 }//namespace Dune
506 #endif