KASKADE 7 development version
gbit.hh
Go to the documentation of this file.
1/*
2 GBIT - Good Broyden - Error based iterative linear solver
3
4 * Written by L. Weimann
5 * Purpose Iterative solution of large linear systems
6 * Category ???. - Linear systems
7 * Keywords large linear system, iterative solver, Finite elements
8 * Version 2.0
9 * Revision April 2014
10 * Latest Change May 2014
11 * Library NewtonLib
12 * Code C++, Double Precision
13 * Environment Standard C environment on PC's,
14 workstations and hosts.
15 * Copyright (c) Konrad-Zuse-Zentrum fuer
16 Informationstechnik Berlin (ZIB)
17 Takustrasse 7, D-14195 Berlin-Dahlem
18 phone : + 49/30/84185-0
19 fax : + 49/30/84185-125
20 * Contact Lutz Weimann
21 ZIB, Division Scientific Computing,
22 Department Numerical Analysis and Modelling
23 phone : + 49/30/84185-185
24 fax : + 49/30/84185-107
25 e-mail: weimann@zib.de
26
27 ---------------------------------------------------------------
28
29 * Licence
30 KASKADE 7 is distributed under the terms of the ZIB Academic License.
31 see $KASKADE/academic.txt
32
33 ------------------------------------------------------------
34
35 * Class description
36 =================
37
38 The calling interface looks as follows:
39
40 template<class LinearSpace>
41 class Gbit
42
43 The constructor argument list looks like following:
44 Gbit( AssembledGalerkinOperator& a, Precond& preconditioner,
45 double tol, int maximumNoIterations, int verbosity, int maxRestart)
46
47 AssembledGalerkinOperator a:
48 The linear operator obtained after assemblation (see Kaskade7 documentation).
49
50 Preconditioner precon:
51 The preconditioner, which will be used by Gbit.
52
53 double tol: (dune-istl compatibility parameter, see also method setTolerance)
54 The prescribed precision for the final iterate y^i.
55 The default value for tol is 1.0e-10
56
57 int maximumNoIterations: (dune-istl compatibility parameter, see also method
58 setMaximumNoIterations)
59 The maximum number of allowed iterations.
60 The default value for maximumNoIterations is MAXITER_DEFAULT (=1000).
61
62 int verbosity: (dune-istl compatibility parameter, see also method
63 setMonitorLevel)
64 The integer value which corresponds to the monitorLevel PrintLevel.
65 The verbosity default value is 0.
66
67 int maxRestart:
68 The maximum number of Gbit iterations before a restart will be done.
69 The amount of internal storage used by Gbit mainly depend on this parameter.
70 The default value of maxRestart is 9.
71
72 Public types are:
73
74 struct GbitInfo
75 {
76 double precision, normDx;
77 int iterationCount, rcode, noMatVecMult, noPrecondCalls;
78 };
79
80 typedef enum {none=0, minimum=1, verbose=2, debug=3 } PrintLevel;
81
82 The solver must be called by calling the method apply:
83 gbit.apply(CoefficientVectors& y, CoefficientVectors const& b,
84 struct GbitInfo& res)
85
86 The parameters are:
87
88 CoefficientVectors& y :
89 .
90 y must contain on input an initial guess of the linear system
91 solution, which is used as the start-vector of the iteration.
92 On output, the pointed array contains an approximate solution vector y*,
93 which fits the relative error condition epsilon <= rho*||y^i||*opt->tol,
94 where ||y||_A = sqrt( sum_1 to n( (y_i/scale_i)^2 ) / n ) denotes a
95 scaled Euclidian norm, epsilon is an estimate of the quantity
96 ||y^solution-y^i||, and rho <= 1.0 denotes a safety factor.
97
98 CoefficientVectors const& b :
99 b must hold the right hand side of the linear system to solve.
100
101 struct GbitInfo& info:
102 The Gbit info structure. The fields of the structure are set to output
103 info of Gbit.
104
105 info.precision is of type double and is set to the relative error
106 estimate epsilon/(rho*||y^i||). For detailed info, refer to the
107 description of the parameter y above.
108
109 info.iterationCount is set to number of iteration steps done.
110
111 info.noMatVecMult is set to the number of done calls to the matrix times
112 vector multiplication routine a->apply.
113
114 info.noPrecondCalls is set to the number of done calls to the preconditioner
115 routine precon->apply.
116
117 info.rcode is set to the return-code of GBIT. A return-code 0
118 means that Gbit has terminated sucessfully. For the meaning of a
119 nonzero return-code, see the error messages list below.
120
121 The following error conditions may occur: (returned via info.rcode)
122 --------------------------------------------------------------------
123
124 2 Maximum number of iterations (as set by opt->maxiter) exceeded.
125 3 No convergence, error estimate epsilon exceeded the limit 1.0e20.
126 20 Nonpositive input for dimensional parameter n.
127 21 Nonpositive value for tol supplied.
128 22 Negative scaling value for some component of vector scale supplied.
129
130
131 Further methods for setting parameters are:
132
133 void setTolerance( double tol )
134 tol is of type double and must contain the error threshold
135 which the relative error of the final iterate y^i must fit.
136
137 void setMaximumNoIterations( int maximumIter )
138 maximumIter is of type int and must contain the maximum number of allowed
139 iterations. if a zero or negative value is supplied, then the maximum
140 iteration count will be set to MAXITER_DEFAULT (=1000).
141
142 void setSafetyFactor( double safetyFactor )
143 safetyFactor is of type double and must contain a safety factor <= 1.0 by
144 which tol will be multiplied. The default value of safetyFactor is 0.25 .
145
146 void setRescaleMode ( bool rescale )
147 rescale is of type bool.
148 If set to true, the scaling values, which are used in the norm
149 computation, will be adjusted at the start and at each restart
150 to the current iterate.
151 If set to false, the initial scaling values are used unmodified
152 throughout the whole iteration.
153 The default of this parameter is true.
154
155 void setGiantSimpleTermination( bool giantSimple )
156 The flag giantSimple is by default set to false. If it is set to true, a
157 special termination criterium for computing the simplified Newton correction
158 by Giant will be used.
159
160 void setErrorStream( std::ostream& errorStream )
161 errorStream is of type pointer to std::ostream, as defined by the <iostream>
162 header file. It must be set either to a NULL pointer, std::cout, std::cerr,
163 or to another file pointer which has been initialized by a fopen call.
164 If it is set to NULL, errorStream will be set to std:cerr. The error
165 messages will be printed to errorStream.
166
167 void setMonitorStream( std::ostream& monitorStream )
168 monitorStream is of type pointer to std::ostream, as defined by the <iostream>
169 header file. It must be set either to a NULL pointer, std::cout, std::cerr,
170 or to another file pointer which has been initialized by a fopen call.
171 If it is set to NULL, monitorStream will be set to std::cout. The monitor
172 output will be printed to monitorStream.
173
174 void setErrorLevel( PrintLevel errorLevel )
175 errorLevel is of type PrintLevel. If it is set to level None,
176 then no error message will be printed if an error condition occurs.
177 If it is set to level Minimum or any higher level, then error messages
178 will be printed, if appropriate.
179
180 void setMonitorLevel( PrintLevel monitorLevel )
181 monitorLevel is of type PrintLevel. If it is set to level None,
182 then no monitor output will be printed.
183 If it is set to level Minimum, a few infomation will be printed.
184 If set to level Verbose, then some infomation about each iteration
185 step, fitting into a single line, will be printed. The higher level Debug
186 is reserved for future additional information output.
187
188 void setScalingVector( std::vector<double>* scale )
189 scale is a pointer to a std::vector<double> of size n, which must hold
190 nonnegative scaling threshold values. If zero values are supplied,
191 the zeros are replaced by the (possibly adjusted) value of tol.
192 If a zero pointer is supplied, then also all scaling threshold components
193 are set to the value of tol.
194
195 Summary of changes:
196 -------------------
197
198 Version Date Changes
199 2.0 2014/04/28 Special version for use with Kaskade7.2.
200 1.0 2006/11/30 Initial release.
201
202*/
203#ifndef GBIT_HH
204#define GBIT_HH
205#include <cstdlib>
206#include <fstream>
207#include <cmath>
208
209#include <dune/istl/operators.hh>
210#include <dune/istl/preconditioners.hh>
211#include "utilities/timing.hh"
212
213#ifndef MACHCONST_
214#define MACHCONST_
215#define SMALL DBL_EPSILON
216#define EPMACH DBL_MIN
217#endif
218
219namespace Kaskade
220{
229 template<class LinearSpace>
230 class Gbit
231 {
232 #define TAU_MIN 1.0e-8
233 #define TAU_MAX 1.0e2
234 #define EPSILON_LIMIT 1.0e20
235
236 #define MAXITER_DEFAULT 1000
237
238 public:
239 typedef enum {
243 debug=3
244 }
245 PrintLevel ;
246
260 struct GbitInfo
261 {
264 };
265
266 private:
267 typedef enum { initial=1,intermediate=2,solution=3,final=4 } DataMode ;
268
269 struct GbitData
270 {
271 double tau, t, normDx;
272 DataMode mode;
273 };
274
275 public:
276 typedef Dune::LinearOperator<LinearSpace,LinearSpace> AssembledGalerkinOperator;
277 typedef Dune::Preconditioner<LinearSpace,LinearSpace> Precond;
278
294 Gbit( AssembledGalerkinOperator& a_, Precond& precon_, double iteEps_=1.0e-10,
295 int iteSteps_=MAXITER_DEFAULT, int verbosity_=0, int maxRestart_=9):
296 tol(iteEps_), maximumNoIterations(iteSteps_), maxRestart(maxRestart_)
297 {
298 a=&a_;
299 precon = &precon_;
300 rho = 0.25;
301 rescale = true;
302 giantSimplifiedCorrection = false;
303 errorLevel = verbose;
304 monitorLevel = (PrintLevel) verbosity_;
305 errorStream = &(std::cerr);
306 monitorStream = &(std::cout);
307 scale = NULL;
308 delta.resize(maxRestart+2);
309 for (int i=0;i<maxRestart+2;i++) delta[i]=NULL;
310 }
311
313 {
314 for (int i=0;i<maxRestart+2;i++) delete delta[i];
315 }
316
322 void setTolerance( double tol_ ) { tol=tol_; }
323
330 void setMaximumNoIterations( int maximumIter_ ) { maximumNoIterations=maximumIter_; }
331
338 void setSafetyFactor( double safetyFactor_ ) { rho=safetyFactor_; }
339
350 void setRescaleMode ( bool rescale_ ) { rescale=rescale_; }
351
359 void setGiantSimpleTermination( bool giantSimple_ ) { giantSimplifiedCorrection=giantSimple_; }
360
366 void setErrorStream( std::ostream& errorStream_ ) { errorStream=&errorStream_; }
367
373 void setMonitorStream( std::ostream& monitorStream_ ) { monitorStream=&monitorStream_; }
374
380 void setErrorLevel( PrintLevel errorLevel_ ) { errorLevel=errorLevel_; }
381
389 void setMonitorLevel( PrintLevel monitorLevel_ ) { monitorLevel=monitorLevel_; }
390
396 void setStatistics( bool statistics_ ) { statistics=statistics_; }
401 void setScalingVector( std::vector<double>* scale_ )
402 {
403 if ( scale ) delete scale;
404 if ( scale_ ) scale=scale_;
405 }
406
418 void apply(LinearSpace& y, LinearSpace const& b, struct GbitInfo& res, Timings& timer=Timings::instance() )
419 {
420 n=b.dim();
421 LinearSpace qDomain(y),qRange(y);
422 int i, iterationCounter=0, noMatVecMult=0, noPrecondCalls=0;
423 struct GbitData* data=new struct GbitData;
424 if (!data)
425 {
426 fprintf(stderr,"\n could not allocate struct data\n");
427 res.rcode=-994; return;
428 };
429 data->mode = initial;
430 res.rcode = gbitParameterCheckAndPrint();
431 if ( res.rcode !=0 )
432 {
433 if (data) free(data);
434 return;
435 };
436 for (int i=0;i<maxRestart+2;i++)
437 if (!delta[i]) delta[i]=new std::vector<double>(n);
438 std::vector<double> *zeta, *delta0, *deltaOfM, *deltaOfMplusOne, *deltai, *deltaip1;
439 std::vector<double> sigma(maxRestart+2), t(maxRestart+2), q(n), z(n), ythresh(n), y0(n),
440 ydata(n), bdata(n);
441 double gamma, tau, factor, OneMinusTm, ti, epsilon, normOfyIterPlusOne, normdiff, errtol=tol;
442 bool stopIteration;
443 if ( !errorStream && errorLevel>0 ) errorStream = &(std::cerr);
444 if ( !monitorStream && monitorLevel>0 ) monitorStream = &(std::cout);
445 if ( maximumNoIterations <= 0 ) maximumNoIterations = MAXITER_DEFAULT;
446 if ( monitorLevel > 0 ) *monitorStream << std::endl << " GBIT - Version 2.0" << std::endl;
447 zeta = &z;
448 y.write(ydata.begin());
449 b.write(bdata.begin());
450 for (int j=0;j<n;j++) y0[j]=ydata[j];
451 if ( monitorLevel > 1 )
452 *monitorStream << std::endl << " Iter sigma NormIter tau t" <<
453 std::endl << std::endl;
454 for (int j=0;j<n;j++) ythresh[j] = (*scale)[j];
455 delta0 = delta[0];
456
457 /* Initialization */
458 bool doRestart=true, doRestartNow;
459 do
460 {
461 doRestartNow=false;
462 if (rescale) gbitRescale(*scale,ydata,ythresh);
463 if ( iterationCounter > 0 && monitorLevel > 1 ) *monitorStream << " > RESTART" << std::endl;
464 normOfyIterPlusOne = scaledNorm2(ydata,*scale);
465 if (statistics) timer.start("time for matrix times vector");
466 a->apply(y,qRange);
467 if (statistics) timer.stop("time for matrix times vector");
468 noMatVecMult++; qRange.write(z.begin());
469 for (int j=0;j<n;j++) z[j] = bdata[j]-z[j];
470 qRange.read(z.begin());
471 if (statistics) timer.start("time for preconditioner");
472 precon->apply(qDomain,qRange);
473 if (statistics) timer.stop("time for preconditioner");
474 noPrecondCalls++;
475 qDomain.write(delta0->begin());
476 sigma[0] = scaledScalarProduct(*(delta[0]),*(delta[0]),*scale);
477
478 /* Iteration loop (restarts excluded) */
479 stopIteration = false;
480 for (i=0; i<maxRestart+1 && !stopIteration && iterationCounter < maximumNoIterations+1; i++)
481 {
482 qDomain.read(delta[i]->begin());
483 if (statistics) timer.start("time for matrix times vector");
484 a->apply(qDomain,qRange);
485 if (statistics) timer.stop("time for matrix times vector");
486 noMatVecMult++;;
487 if (statistics) timer.start("time for preconditioner");
488 precon->apply(qDomain,qRange); noPrecondCalls++; qDomain.write(zeta->begin());
489 if (statistics) timer.stop("time for preconditioner");
490 for (int m=0;m<i;m++)
491 {
492 OneMinusTm = 1.0-t[m];
493 factor = scaledScalarProduct(*(delta[m]),*zeta,*scale)/sigma[m];
494 deltaOfM = delta[m]; deltaOfMplusOne = delta[m+1];
495 for (int j=0;j<n;j++) (*zeta)[j] += factor*((*deltaOfMplusOne)[j]-OneMinusTm*(*deltaOfM)[j]);
496 };
497 gamma = scaledScalarProduct(*(delta[i]),z,*scale);
498 if ( gamma != 0.0 ) tau = sigma[i]/gamma;
499 else tau = TAU_MAX;
500 if ( tau < TAU_MIN )
501 {
502 if ( monitorLevel > 1 ) *monitorStream << " > tau = " << tau << std::endl;
503 if ( i>0 )
504 {
505 doRestartNow=true;
506 break;
507 }
508 else
509 {
510 t[i] = 1.0;
511 if ( monitorLevel > 0 )
512 *monitorStream << " > Restart condition ignored, set t[0] = " << t[i] << std::endl;
513 };
514 }
515 else
516 {
517 if ( tau <= TAU_MAX )
518 t[i] = tau;
519 else
520 t[i] = 1.0;
521 };
522 ti = t[i]; deltai = delta[i];
523 if ( monitorLevel > 1 )
524 *monitorStream << " " << std::setw(4) << iterationCounter << " " << std::setw(11)
525 << sigma[i] << " " << std::setw(11) << normOfyIterPlusOne << " "
526 << std::setw(11) << tau << " " << std::setw(11)
527 << t[i] << std::endl;
528 data->normDx = sqrt(sigma[i]); data->tau = tau; data->t = t[i];
529 //itlin_dataout(iterationCounter,n,y,data);
530 data->mode = intermediate;
531 for (int j=0;j<n;j++) ydata[j] += ti*(*deltai)[j];
532 y.read(ydata.begin());
533 deltaip1 = delta[i+1];
534 factor = 1.0-ti+tau;
535 for (int j=0;j<n;j++) (*deltaip1)[j] = factor*(*deltai)[j]-tau*z[j];
536 sigma[i+1] = scaledScalarProduct(*deltaip1,*deltaip1,*scale);
537 if ( i>=1 ) epsilon = 0.5*sqrt(sigma[i-1]+2.0*sigma[i]+sigma[i+1]);
538 else epsilon = sqrt(sigma[1]);
539 normOfyIterPlusOne = scaledNorm2(ydata,*scale);
540 if (giantSimplifiedCorrection)
541 {
542 for (int j=0;j<n;j++) q[j]=ydata[j]-y0[j];
543 normdiff = scaledNorm2(q,*scale);
544 stopIteration = (epsilon/normdiff < rho*errtol);
545 }
546 else
547 stopIteration = (epsilon < rho*normOfyIterPlusOne*errtol);
548 iterationCounter++;
549 if ( !stopIteration && epsilon > EPSILON_LIMIT )
550 {
551 res.rcode = 3; break;
552 };
553 };
554 if ( res.rcode != 0 ) break;
555 if ( doRestartNow || ( i>=maxRestart && !stopIteration && iterationCounter<maximumNoIterations) )
556 continue;
557 else
558 doRestart = false;
559 }
560 while ( doRestart ) ;
561 if ( (res.rcode==0) && (iterationCounter >= maximumNoIterations) ) res.rcode = 2;
562
563 if ( monitorLevel > 1 )
564 *monitorStream << " " << std::setw(4) << iterationCounter << " " << std::setw(11)
565 << sigma[i] << " " << std::setw(11) << normOfyIterPlusOne << " "
566 << std::setw(11) << tau << " " << std::setw(11)
567 << t[i-1] << std::endl;
568 data->mode = ( res.rcode==0 ? solution : final );
569 data->normDx = sqrt(sigma[i]); data->tau = tau; data->t = t[i-1];
570 // itlin_dataout(iterationCounter,n,y,data);
571 if ( errorLevel > 0 && res.rcode != 0 )
572 {
573 switch ( res.rcode )
574 {
575 case 2:
576 *errorStream << "\n Error - Maximum allowed number of iterations exceeded\n" ;
577 break;
578 case 3:
579 *errorStream << "\n Error - no convergence, correction too large\n" ;
580 break;
581 default :
582 *errorStream << "\n Error, code=" << res.rcode << std::endl;
583 };
584 };
585 delete data;
586 res.precision = epsilon/(rho*normOfyIterPlusOne);
587 res.normDx = data->normDx;
588 res.iterationCount = iterationCounter;
589 res.noMatVecMult = noMatVecMult;
590 res.noPrecondCalls = noPrecondCalls;
591 }
592
593 private:
594
595 void gbitRescale(std::vector<double>& scale, std::vector<double> const& y,
596 std::vector<double> const& ythresh)
597 {
598 int const n = scale.size();
599 assert ( (y.size()==n) && (ythresh.size()==n) );
600 for (int i=0;i<n;i++)
601 scale[i] = std::max(ythresh[i],std::max(fabs(y[i]),SMALL));
602 }
603
604 int gbitParameterCheckAndPrint()
605 #define TOLMIN 1.0e-15
606 #define TOLMAX 0.5
607 {
608 double large = 1.0/SMALL, default_scale;
609 if ( n<=0 )
610 {
611 if ( errorLevel>0 )
612 *errorStream << "\n Error - Number of Equations/unknowns must be >0\n" ;
613 return 20;
614 };
615 if ( tol <= 0 )
616 {
617 if ( errorLevel>0 )
618 *errorStream << "\n Error - tol must be positive\n" ;
619 return 21;
620 }
621 else
622 {
623 if ( tol > TOLMAX )
624 {
625 tol = TOLMAX;
626 if ( errorLevel>1 )
627 *errorStream <<
628 "\n User prescribed RTOL decreased to reasonable largest value RTOL=" <<
629 tol << std::endl;
630 }
631 else if ( tol < TOLMIN )
632 {
633 tol = TOLMIN;
634 if ( errorLevel>1 )
635 *errorStream <<
636 "\n User prescribed RTOL increased to reasonable smallest value RTOL=" <<
637 tol << std::endl;
638 };
639 };
640 default_scale = 1;
641 if ( !scale )
642 {
643 scale = new std::vector<double>(n);
644 for (int i=0;i<n;i++) (*scale)[i]=default_scale;
645 }
646 else
647 {
648 for (int i=0;i<n;i++)
649 {
650 if ( (*scale)[i] < 0.0 )
651 {
652 if ( errorLevel>0 )
653 *errorStream <<
654 "\n Error - negative value (*scale)[" << i << "] supplied\n";
655 return 22;
656 }
657 else if ( (*scale)[i] == 0.0 )
658 (*scale)[i] = default_scale;
659 else if ( (*scale)[i] < SMALL )
660 {
661 if ( errorLevel>1 )
662 *errorStream <<
663 "\n Warning: (*scale)[" << i << "] too small - increased to "<< SMALL << "\n";
664 (*scale)[i] = SMALL;
665 }
666 else if ( (*scale)[i] > large )
667 {
668 if ( errorLevel>1 )
669 *errorStream <<
670 "\n Warning: (*scale)[" << i << "] too large - decreased to %" << large << "\n";
671 (*scale)[i] = large;
672 };
673 };
674 };
675
676 if ( maxRestart <= 0 )
677 {
678 maxRestart = std::min(10,n);
679 if ( errorLevel > 1 )
680 *errorStream <<
681 " Warning: maxRestart not set; is reset to maxRestart=" << maxRestart << std::endl;
682 }
683 else if ( maxRestart > n )
684 {
685 maxRestart = std::min(10,n);
686 if ( errorLevel > 1 )
687 *errorStream <<
688 " Warning: maxRestart is greater than n; is reset to maxRestart=" << maxRestart << std::endl;
689 };
690
691 if ( rho <= 0.0 )
692 {
693 rho = 1.0;
694 if ( errorLevel > 1 )
695 *errorStream <<
696 " Warning: rho not set; is reset to rho=" << rho << std::endl;
697 };
698
699 if ( monitorLevel==0 ) return 0;
700 *monitorStream << "\n Problem dimension: n = " << n << std::endl;
701 *monitorStream << "\n Prescribed relative precision: " << tol << std::endl;
702 *monitorStream << " The maximum permitted number of iteration steps is: " <<
703 maximumNoIterations << std::endl;
704 *monitorStream << " The maximum number of iterations before restart is: " <<
705 maxRestart << std::endl;
706 *monitorStream << " The safety factor is rho = " << rho << std::endl;
707 return 0;
708 }
709
710 double scaledNorm2(std::vector<double> const& v,std::vector<double> const& scale)
711 {
712 int const n=scale.size();
713 assert( v.size()==n );
714 double t, rval = 0.0;
715 for (int i=0;i<n;i++) {t=v[i]/scale[i]; rval += t*t;};
716 return sqrt( rval / (double)n );
717 }
718
719 double scaledScalarProduct( std::vector<double> const& v1, std::vector<double> const& v2,
720 std::vector<double> const& scale)
721 {
722 int const n=scale.size();
723 assert( (v1.size()==n) && (v2.size()==n) );
724 double t1, t2, rval = 0.0;
725 for (int i=0;i<n;i++)
726 {t1=v1[i]/scale[i]; t2=v2[i]/scale[i]; rval += t1*t2;};
727 return rval / (double)n ;
728 }
729
730 int n;
731 double tol, rho;
732 std::vector<std::vector<double>*> delta;
733 std::vector<double>* scale;
734 int maxRestart, maximumNoIterations;
735 bool rescale, giantSimplifiedCorrection, statistics;
736 PrintLevel errorLevel, monitorLevel, dataLevel;
737 std::ostream *errorStream, *monitorStream;
738 GbitInfo info;
740 Precond* precon;
741 };
742}
743#endif
Iterative solution of a large linear system using an error based termination-criterium....
Definition: gbit.hh:231
void setRescaleMode(bool rescale_)
Sets the rescaling mode. The default value is true.
Definition: gbit.hh:350
void setMonitorLevel(PrintLevel monitorLevel_)
Sets the monitor-output level. The default monitor-output level is the value of the constructur argum...
Definition: gbit.hh:389
void setSafetyFactor(double safetyFactor_)
Sets the safety factor for the precision control. Must be a positive number <= 1.0 by which the toler...
Definition: gbit.hh:338
void setGiantSimpleTermination(bool giantSimple_)
Sets the termination-criterium mode. The default value is false.
Definition: gbit.hh:359
Gbit(AssembledGalerkinOperator &a_, Precond &precon_, double iteEps_=1.0e-10, int iteSteps_=MAXITER_DEFAULT, int verbosity_=0, int maxRestart_=9)
The Gbit constructor routine.
Definition: gbit.hh:294
void setErrorLevel(PrintLevel errorLevel_)
Sets the error-output level. The default error-output level is verbose.
Definition: gbit.hh:380
void setTolerance(double tol_)
Sets the error tolerance which the final approximate solution must fit. The default value is 1....
Definition: gbit.hh:322
void setErrorStream(std::ostream &errorStream_)
Sets the error-output stream. The default error-output stream is std::cerr.
Definition: gbit.hh:366
void setStatistics(bool statistics_)
Sets the Timings statistics flag. The default Timings statistics flag level is off.
Definition: gbit.hh:396
Dune::Preconditioner< LinearSpace, LinearSpace > Precond
Definition: gbit.hh:277
Dune::LinearOperator< LinearSpace, LinearSpace > AssembledGalerkinOperator
Definition: gbit.hh:276
void setScalingVector(std::vector< double > *scale_)
Sets a user-defined scaling-threshold vector.
Definition: gbit.hh:401
void apply(LinearSpace &y, LinearSpace const &b, struct GbitInfo &res, Timings &timer=Timings::instance())
Calls the giantGbit inexact damped Newton-iteration solver.
Definition: gbit.hh:418
void setMaximumNoIterations(int maximumIter_)
Sets the maximum allowed number of Newton-iterations. The default value is the value of the construct...
Definition: gbit.hh:330
void setMonitorStream(std::ostream &monitorStream_)
Sets the monitor-output stream. The default monitor-output stream is std::cout.
Definition: gbit.hh:373
Supports gathering and reporting execution times information for nested program parts.
Definition: timing.hh:64
static Timings & instance()
Returns a reference to a single default instance.
#define SMALL
Definition: gbit.hh:215
#define MAXITER_DEFAULT
Definition: gbit.hh:236
#define EPSILON_LIMIT
Definition: gbit.hh:234
#define TAU_MIN
Definition: gbit.hh:232
#define TAU_MAX
Definition: gbit.hh:233
#define TOLMAX
#define TOLMIN
Dune::FieldVector< T, n > max(Dune::FieldVector< T, n > x, Dune::FieldVector< T, n > const &y)
Componentwise maximum.
Definition: fixdune.hh:110
Dune::FieldVector< T, n > min(Dune::FieldVector< T, n > x, Dune::FieldVector< T, n > const &y)
Componentwise minimum.
Definition: fixdune.hh:122