dune-fem  2.4.1-rc
double.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_DOUBLE_HH
2 #define DUNE_FEM_DOUBLE_HH
3 
4 //- system includes
5 #include <iostream>
6 #include <cmath>
7 #include <limits>
8 #include <string>
9 
10 //- Dune includes
14 
15 namespace Dune
16 {
17 
18  namespace Fem
19  {
20 
21 #ifdef COUNT_FLOPS
22 
23  template< class FloatImp >
24  class FlOpCounter;
25 
26 
27  template <class FloatImp>
28  class FlOpSummary
29  {
30  typedef FlOpSummary< FloatImp > ThisType;
31 
32  std::string name_;
33  ThreadSafeValue< unsigned long > count_;
34 
35  FlOpSummary(const std::string& name) : name_(name), count_( 0 ) {}
36  public:
37  ~FlOpSummary ()
38  {
39  unsigned long totalCount = 0;
40  for( size_t i=0; i<count_.size(); ++i )
41  {
42  std::cout << name_ << " thread[ " << i << " ]: " << count_[ i ] << std::endl;
43  totalCount += count_[ i ];
44  }
45 
46  std :: cout << "Total number of floating point operations (" << name_ << "): "
47  << totalCount << std :: endl;
48  }
49 
50  inline void add( const unsigned long count, const int thread )
51  {
52  count_[ thread ] += count ;
53  }
54 
55  inline static ThisType& instance( const std::string& name )
56  {
57  static ThisType instance( name );
58  return instance;
59  }
60  };
61 
62 
63  template< class FloatImp >
64  class FlOpCounter
65  {
66  public:
67  typedef FloatImp FloatType;
68 
69  private:
70  typedef FlOpCounter< FloatType > ThisType;
71 
72  protected:
73  unsigned long count_;
74  const int thread_;
75 
76  protected:
77  inline FlOpCounter ()
78  : count_( 0 ), thread_( ThreadManager::thread() )
79  {
80  FlOpSummary< FloatImp > :: instance( FloatImp::typeName() ) ;
81  }
82 
83  public:
84  inline ~FlOpCounter ()
85  {
86  FlOpSummary< FloatImp > :: instance( FloatImp::typeName() ).add( count_, thread_ );
87  }
88 
89  inline ThisType &operator++ ()
90  {
91  ++(count_);
92  return *this;
93  }
94 
95  inline ThisType &operator += ( const unsigned long i )
96  {
97  count_ += i;
98  return *this;
99  }
100 
101  inline static ThisType &instance ()
102  {
103  static thread_local ThisType instance;
104  return instance;
105  }
106  };
107 
108 #else
109 
110  template< class FloatImp >
112  {
113  public:
114  typedef FloatImp FloatType;
115 
116  private:
117  typedef FlOpCounter< FloatType > ThisType;
118 
119  protected:
120  inline FlOpCounter ()
121  {
122  }
123 
124  public:
125  inline ThisType &operator++ ()
126  {
127  return *this;
128  }
129 
130  inline ThisType &operator += ( const unsigned long i )
131  {
132  return *this;
133  }
134 
135  inline static ThisType &instance ()
136  {
137  static thread_local ThisType instance;
138  return instance;
139  }
140  };
141 
142 #endif
143 
144  //- forward declaration
145  class Double;
146  // wrap of std log
147  static double log (const Double& v);
148  // wrap of std sqrt
149  static double sqrt(const Double& v);
150  // wrap of std sin
151  static double cos (const Double& v);
152  // wrap of std cos
153  static double sin(const Double& v);
154 
155  // wrap of std min
156  static inline double min (const Double& v, const double p);
157  // wrap of std min
158  static inline double min (const double v, const Double& p);
159  // wrap of std max
160  static inline double max (const Double& v, const double p);
161  // wrap of std max
162  static inline double max (const double v, const Double& p);
163 
164 
165  // numeric limits
166  // --------------
167 
168  class Double
169  {
170  private:
171  typedef Double ThisType;
172 
173  friend Double operator+ ( const Double&, const Double& );
174  friend Double operator+ ( const Double&, const double );
175  friend Double operator+ ( const double, const Double& );
176  friend Double operator+ ( const Double&, const int );
177  friend Double operator+ ( const int, const Double& );
178  friend Double operator+ ( const Double&, const unsigned int );
179  friend Double operator+ ( const unsigned int, const Double& );
180 
181  friend Double operator- ( const Double&, const Double& );
182  friend Double operator- ( const Double&, const double );
183  friend Double operator- ( const double, const Double& );
184  friend Double operator- ( const Double&, const int );
185  friend Double operator- ( const int, const Double& );
186  friend Double operator- ( const Double&, const unsigned int );
187  friend Double operator- ( const unsigned int, const Double& );
188 
189  friend Double operator* ( const Double&, const Double& );
190  friend Double operator* ( const Double&, const double );
191  friend Double operator* ( const double, const Double& );
192  friend Double operator* ( const Double&, const int );
193  friend Double operator* ( const int, const Double& );
194  friend Double operator* ( const Double&, const unsigned int );
195  friend Double operator* ( const unsigned int, const Double& );
196 
197  friend Double operator/ ( const Double&, const Double& );
198  friend Double operator/ ( const double, const Double& );
199  friend Double operator/ ( const Double&, const double );
200  friend Double operator/ ( const int, const Double& );
201  friend Double operator/ ( const Double&, const int );
202  friend Double operator/ ( const unsigned int, const Double& );
203  friend Double operator/ ( const Double&, const unsigned int );
204 
205  friend bool operator== ( const Double&, const Double& );
206  friend bool operator== ( const double, const Double& );
207  friend bool operator== ( const Double&, const double );
208  friend bool operator== ( const int, const Double& );
209  friend bool operator== ( const Double&, const int );
210  friend bool operator== ( const unsigned int, const Double& );
211  friend bool operator== ( const Double&, const unsigned int );
212 
213  friend bool operator!= ( const Double&, const Double& );
214  friend bool operator!= ( const double, const Double& );
215  friend bool operator!= ( const Double&, const double );
216  friend bool operator!= ( const int, const Double& );
217  friend bool operator!= ( const Double&, const int );
218  friend bool operator!= ( const unsigned int, const Double& );
219  friend bool operator!= ( const Double&, const unsigned int );
220 
221  friend bool operator< ( const Double&, const Double& );
222  friend bool operator< ( const double, const Double& );
223  friend bool operator< ( const Double&, const double );
224  friend bool operator< ( const int, const Double& );
225  friend bool operator< ( const Double&, const int );
226  friend bool operator< ( const unsigned int, const Double& );
227  friend bool operator< ( const Double&, const unsigned int );
228 
229  friend bool operator<= ( const Double&, const Double& );
230  friend bool operator<= ( const double, const Double& );
231  friend bool operator<= ( const Double&, const double );
232  friend bool operator<= ( const int, const Double& );
233  friend bool operator<= ( const Double&, const int );
234  friend bool operator<= ( const unsigned int, const Double& );
235  friend bool operator<= ( const Double&, const unsigned int );
236 
237  friend bool operator> ( const Double&, const Double& );
238  friend bool operator> ( const double, const Double& );
239  friend bool operator> ( const Double&, const double );
240  friend bool operator> ( const int, const Double& );
241  friend bool operator> ( const Double&, const int );
242  friend bool operator> ( const unsigned int, const Double& );
243  friend bool operator> ( const Double&, const unsigned int );
244 
245  friend bool operator>= ( const Double&, const Double& );
246  friend bool operator>= ( const double, const Double& );
247  friend bool operator>= ( const Double&, const double );
248  friend bool operator>= ( const int, const Double& );
249  friend bool operator>= ( const Double&, const int );
250  friend bool operator>= ( const unsigned int, const Double& );
251  friend bool operator>= ( const Double&, const unsigned int );
252 
253  friend std :: ostream &operator<< ( std :: ostream&, const Double& );
254  friend std :: istream &operator>> ( std :: istream&, Double& );
255 
256  template< class Traits >
258  operator<< ( OutStreamInterface< Traits > &, const Double );
259  template< class Traits >
262 
263  friend double pow (const Double& v, const double p);
264  friend double log (const Double& v);
265  friend double sqrt(const Double& v);
266  friend double sin(const Double& v);
267  friend double cos(const Double& v);
268 
269  friend Double abs ( const Double & );
270  friend double min(const Double&, const double);
271  friend double min(const double, const Double&);
272  friend double max(const Double&, const double);
273  friend double max(const double, const Double&);
274 
275  friend double real( const std::complex<Double>& );
276  friend double real( const Double& );
277  friend double imag( const std::complex<Double>& );
278  friend double imag( const Double& );
279 
280 #if DUNE_FEM_COMPATIBILITY
281  friend struct XdrIO< Double >;
282 #endif
283 
284  friend void field_cast ( const Double &, double & );
285 
286  protected:
288 
289  protected:
290  double value_;
291 
292  public:
293  operator double ()
294  {
295  return value_;
296  }
297  operator const double () const
298  {
299  return value_;
300  }
301 
302  inline Double ()
303  // : value_( 0 )
304 //#ifndef NDEBUG
305 // : value_( std::numeric_limits< double >::signaling_NaN() )
306 //#endif
307  {
308  }
309 
310  inline Double ( const double value )
311  : value_( value )
312  {}
313 
314  inline Double ( const ThisType &other )
315  : value_( other.value_ )
316  {}
317 
318  inline ThisType &operator= ( const ThisType other )
319  {
320  // flOp();
321  value_ = other.value_;
322  return *this;
323  }
324 
325  inline ThisType &operator+= ( const ThisType other )
326  {
327  flOp();
328  value_ += other.value_;
329  return *this;
330  }
331 
332  inline ThisType &operator-= ( const ThisType other )
333  {
334  flOp();
335  value_ -= other.value_;
336  return *this;
337  }
338 
339  inline ThisType &operator*= ( const ThisType other )
340  {
341  flOp();
342  value_ *= other.value_;
343  return *this;
344  }
345 
346  inline ThisType &operator/= ( const ThisType other )
347  {
348  flOp();
349  value_ /= other.value_;
350  return *this;
351  }
352 
353  Double operator- () const
354  {
355  flOp();
356  return Double( -value_ );
357  }
358 
359  static std :: string typeName ()
360  {
361  return "Double";
362  }
363 
364  protected:
365  static inline void flOp ()
366  {
367  ++(FlOpCounterType :: instance());
368  }
369  };
370 
371  // min/max
372  // ---------
373 
374  // wrap of std min
375  static inline double min (const Double& v, const double p)
376  {
377  return (v.value_ > p) ? p : v.value_;
378  }
379 
380  // wrap of std min
381  static inline double min (const double v, const Double& p)
382  {
383  return (v > p.value_) ? p.value_ : v;
384  }
385 
386  // wrap of std max
387  static inline double max (const Double& v, const double p)
388  {
389  return (v.value_ < p) ? p : v.value_;
390  }
391 
392  // wrap of std max
393  static inline double max (const double v, const Double& p)
394  {
395  return (v < p.value_) ? p.value_ : v;
396  }
397 
398  // operator+
399  // ---------
400 
401  inline Double operator+ ( const Double &a, const Double &b )
402  {
403  Double :: flOp();
404  return Double( a.value_ + b.value_ );
405  }
406 
407  inline Double operator+ ( const double a, const Double &b )
408  {
409  Double :: flOp();
410  return Double( a + b.value_ );
411  }
412 
413  inline Double operator+ ( const Double &a, const double b )
414  {
415  Double :: flOp();
416  return Double( a.value_ + b );
417  }
418 
419  inline Double operator+ ( const int a, const Double &b )
420  {
421  Double :: flOp();
422  return Double( a + b.value_ );
423  }
424 
425  inline Double operator+ ( const Double &a, const int b )
426  {
427  Double :: flOp();
428  return Double( a.value_ + b );
429  }
430 
431  inline Double operator+ ( const unsigned int a, const Double &b )
432  {
433  Double :: flOp();
434  return Double( a + b.value_ );
435  }
436 
437  inline Double operator+ ( const Double &a, const unsigned int b )
438  {
439  Double :: flOp();
440  return Double( a.value_ + b );
441  }
442 
443 
444 
445  // operator-
446  // ---------
447 
448  inline Double operator- ( const Double &a, const Double &b )
449  {
450  Double :: flOp();
451  return Double( a.value_ - b.value_ );
452  }
453 
454  inline Double operator- ( const double a, const Double &b )
455  {
456  Double :: flOp();
457  return Double( a - b.value_ );
458  }
459 
460  inline Double operator- ( const Double &a, const double b )
461  {
462  Double :: flOp();
463  return Double( a.value_ - b );
464  }
465 
466  inline Double operator- ( const int a, const Double &b )
467  {
468  Double :: flOp();
469  return Double( a - b.value_ );
470  }
471 
472  inline Double operator- ( const Double &a, const int b )
473  {
474  Double :: flOp();
475  return Double( a.value_ - b );
476  }
477 
478  inline Double operator- ( const unsigned int a, const Double &b )
479  {
480  Double :: flOp();
481  return Double( a - b.value_ );
482  }
483 
484  inline Double operator- ( const Double &a, const unsigned int b )
485  {
486  Double :: flOp();
487  return Double( a.value_ - b );
488  }
489 
490 
491 
492  // operator*
493  // ---------
494 
495  inline Double operator* ( const Double &a, const Double &b )
496  {
497  Double :: flOp();
498  return Double( a.value_ * b.value_ );
499  }
500 
501  inline Double operator* ( const double a, const Double &b )
502  {
503  Double :: flOp();
504  return Double( a * b.value_ );
505  }
506 
507  inline Double operator* ( const Double &a, const double b )
508  {
509  Double :: flOp();
510  return Double( a.value_ * b );
511  }
512 
513  inline Double operator* ( const int a, const Double &b )
514  {
515  Double :: flOp();
516  return Double( a * b.value_ );
517  }
518 
519  inline Double operator* ( const Double &a, const int b )
520  {
521  Double :: flOp();
522  return Double( a.value_ * b );
523  }
524 
525  inline Double operator* ( const unsigned int a, const Double &b )
526  {
527  Double :: flOp();
528  return Double( a * b.value_ );
529  }
530 
531  inline Double operator* ( const Double &a, const unsigned int b )
532  {
533  Double :: flOp();
534  return Double( a.value_ * b );
535  }
536 
537 
538 
539  // operator/
540  // ---------
541 
542  inline Double operator/ ( const Double &a, const Double &b )
543  {
544  Double :: flOp();
545  return Double( a.value_ / b.value_ );
546  }
547 
548  inline Double operator/ ( const double a, const Double &b )
549  {
550  Double :: flOp();
551  return Double( a / b.value_ );
552  }
553 
554  inline Double operator/ ( const Double &a, const double b )
555  {
556  Double :: flOp();
557  return Double( a.value_ / b );
558  }
559 
560  inline Double operator/ ( const int a, const Double &b )
561  {
562  Double :: flOp();
563  return Double( a / b.value_ );
564  }
565 
566  inline Double operator/ ( const Double &a, const int b )
567  {
568  Double :: flOp();
569  return Double( a.value_ / b );
570  }
571 
572  inline Double operator/ ( const unsigned int a, const Double &b )
573  {
574  Double :: flOp();
575  return Double( a / b.value_ );
576  }
577 
578  inline Double operator/ ( const Double &a, const unsigned int b )
579  {
580  Double :: flOp();
581  return Double( a.value_ / b );
582  }
583 
584 
585 
586  // operator==
587  // ----------
588 
589  inline bool operator== ( const Double &a, const Double &b )
590  {
591  return (a.value_ == b.value_);
592  }
593 
594  inline bool operator== ( const double a, const Double &b )
595  {
596  return (a == b.value_);
597  }
598 
599  inline bool operator== ( const Double &a, const double b )
600  {
601  return (a.value_ == b);
602  }
603 
604  inline bool operator== ( const int a, const Double &b )
605  {
606  return (a == b.value_);
607  }
608 
609  inline bool operator== ( const Double &a, const int b )
610  {
611  return (a.value_ == b);
612  }
613 
614  inline bool operator== ( const unsigned int a, const Double &b )
615  {
616  return (a == b.value_);
617  }
618 
619  inline bool operator== ( const Double &a, const unsigned int b )
620  {
621  return (a.value_ == b);
622  }
623 
624 
625 
626  // operator!=
627  // ----------
628 
629  inline bool operator!= ( const Double &a, const Double &b )
630  {
631  return (a.value_ != b.value_);
632  }
633 
634  inline bool operator!= ( const double a, const Double &b )
635  {
636  return (a != b.value_);
637  }
638 
639  inline bool operator!= ( const Double &a, const double b )
640  {
641  return (a.value_ != b);
642  }
643 
644  inline bool operator!= ( const int a, const Double &b )
645  {
646  return (a != b.value_);
647  }
648 
649  inline bool operator!= ( const Double &a, const int b )
650  {
651  return (a.value_ != b);
652  }
653 
654  inline bool operator!= ( const unsigned int a, const Double &b )
655  {
656  return (a != b.value_);
657  }
658 
659  inline bool operator!= ( const Double &a, const unsigned int b )
660  {
661  return (a.value_ != b);
662  }
663 
664 
665 
666  // operator<
667  // ---------
668 
669  inline bool operator< ( const Double &a, const Double &b )
670  {
671  return (a.value_ < b.value_);
672  }
673 
674  inline bool operator< ( const double a, const Double &b )
675  {
676  return (a < b.value_);
677  }
678 
679  inline bool operator< ( const Double &a, const double b )
680  {
681  return (a.value_ < b);
682  }
683 
684  inline bool operator< ( const int a, const Double &b )
685  {
686  return (a < b.value_);
687  }
688 
689  inline bool operator< ( const Double &a, const int b )
690  {
691  return (a.value_ < b);
692  }
693 
694  inline bool operator< ( const unsigned int a, const Double &b )
695  {
696  return (a < b.value_);
697  }
698 
699  inline bool operator< ( const Double &a, const unsigned int b )
700  {
701  return (a.value_ < b);
702  }
703 
704 
705 
706  // operator<=
707  // ----------
708 
709  inline bool operator<= ( const Double &a, const Double &b )
710  {
711  return (a.value_ <= b.value_);
712  }
713 
714  inline bool operator<= ( const double a, const Double &b )
715  {
716  return (a <= b.value_);
717  }
718 
719  inline bool operator<= ( const Double &a, const double b )
720  {
721  return (a.value_ <= b);
722  }
723 
724  inline bool operator<= ( const int a, const Double &b )
725  {
726  return (a <= b.value_);
727  }
728 
729  inline bool operator<= ( const Double &a, const int b )
730  {
731  return (a.value_ <= b);
732  }
733 
734  inline bool operator<= ( const unsigned int a, const Double &b )
735  {
736  return (a <= b.value_);
737  }
738 
739  inline bool operator<= ( const Double &a, const unsigned int b )
740  {
741  return (a.value_ <= b);
742  }
743 
744 
745 
746  // operator>
747  // ---------
748 
749  inline bool operator> ( const Double &a, const Double &b )
750  {
751  return (a.value_ > b.value_);
752  }
753 
754  inline bool operator> ( const double a, const Double &b )
755  {
756  return (a > b.value_);
757  }
758 
759  inline bool operator> ( const Double &a, const double b )
760  {
761  return (a.value_ > b);
762  }
763 
764  inline bool operator> ( const int a, const Double &b )
765  {
766  return (a > b.value_);
767  }
768 
769  inline bool operator> ( const Double &a, const int b )
770  {
771  return (a.value_ > b);
772  }
773 
774  inline bool operator> ( const unsigned int a, const Double &b )
775  {
776  return (a > b.value_);
777  }
778 
779  inline bool operator> ( const Double &a, const unsigned int b )
780  {
781  return (a.value_ > b);
782  }
783 
784 
785 
786  // operator>=
787  // ----------
788 
789  inline bool operator>= ( const Double &a, const Double &b )
790  {
791  return (a.value_ >= b.value_);
792  }
793 
794  inline bool operator>= ( const double a, const Double &b )
795  {
796  return (a >= b.value_);
797  }
798 
799  inline bool operator>= ( const Double &a, const double b )
800  {
801  return (a.value_ >= b);
802  }
803 
804  inline bool operator>= ( const int a, const Double &b )
805  {
806  return (a >= b.value_);
807  }
808 
809  inline bool operator>= ( const Double &a, const int b )
810  {
811  return (a.value_ >= b);
812  }
813 
814  inline bool operator>= ( const unsigned int a, const Double &b )
815  {
816  return (a >= b.value_);
817  }
818 
819  inline bool operator>= ( const Double &a, const unsigned int b )
820  {
821  return (a.value_ >= b);
822  }
823 
824 
825 
826  // stream operators
827  // ----------------
828 
829  inline std :: ostream &operator<< ( std :: ostream &out, const Double &a )
830  {
831  return out << a.value_;
832  }
833 
834  inline std :: istream &operator>> ( std :: istream &in, Double &a )
835  {
836  return in >> a.value_;
837  }
838 
839  template< class Traits >
841  operator<< ( OutStreamInterface< Traits > &out,
842  const Double a )
843  {
844  return out << a.value_;
845  }
846 
847  template< class Traits >
850  Double &a )
851  {
852  return in >> a.value_;
853  }
854 
855 
856 
857  // standard functions
858  // ------------------
859 
860  inline Double abs ( const Double &a )
861  {
862  return Double( std::abs( a.value_ ) );
863  }
864 
865  static inline double log (const Double& v)
866  {
867  return std::log(v.value_);
868  }
869 
870  static inline double sqrt(const Double& v)
871  {
872  return std::sqrt(v.value_);
873  }
874 
875  static inline double sin (const Double& v)
876  {
877  return std::sin(v.value_);
878  }
879 
880  static inline double cos(const Double& v)
881  {
882  return std::cos(v.value_);
883  }
884 
885  inline void field_cast ( const Double &f1, double &f2 )
886  {
887  f2 = f1.value_;
888  }
889 
890  inline double real (const std::complex<Double>& x)
891  {
892  return x.real().value_;
893  }
894 
895  inline double real (const Double& x)
896  {
897  return x.value_;
898  }
899 
900  inline double imag (const std::complex<Double>& x)
901  {
902  return x.imag().value_;
903  }
904 
905  inline double imag (const Double& x)
906  {
907  return x.value_;
908  }
909 
910  } // namespace Fem
911 
912 using Fem :: Double ;
913 
914 } // namespace Dune
915 
916 
917 namespace std
918 {
920  {
921  return Dune::Fem::abs( a );
922  }
923 
924  // wrap of std min
925  inline double min (const Dune::Fem::Double& v, const double p)
926  {
927  return Dune::Fem::min(v,p);
928  }
929 
930  // wrap of std min
931  inline double min (const double v, const Dune::Fem::Double& p)
932  {
933  return Dune::Fem::min(v,p);
934  }
935 
936  // wrap of std max
937  inline double max (const Dune::Fem::Double& v, const double p)
938  {
939  return Dune::Fem::max(v,p);
940  }
941 
942  // wrap of std max
943  inline double max (const double v, const Dune::Fem::Double& p)
944  {
945  return Dune::Fem::max(v,p);
946  }
947 
948  // wrap of std power
949  inline double sqrt( const Dune::Fem::Double& v )
950  {
951  return Dune::Fem::sqrt( v );
952  }
953 
954  // wrap of std real
955  inline double real (const complex<Dune::Fem::Double>& x)
956  {
957  return Dune::Fem::real( x );
958  }
959 
960  // wrap of std real
961  inline double real (const Dune::Fem::Double& x)
962  {
963  return Dune::Fem::real( x );
964  }
965 
966  // wrap of std imag
967  inline double imag (const complex<Dune::Fem::Double>& x)
968  {
969  return Dune::Fem::imag( x );
970  }
971 
972  // wrap of std imag
973  inline double imag (const Dune::Fem::Double& x)
974  {
975  return Dune::Fem::imag( x );
976  }
977 
978 
979 
980  // numeric limits
981  // --------------
982 
983  template<>
984  struct numeric_limits< Dune::Fem::Double >
985  {
986  static const bool is_specialized = true;
987 
988  static const int radix = numeric_limits< double > :: radix;
989  static const int digits = numeric_limits< double > :: digits;
990  static const int digits10 = numeric_limits< double > :: digits10;
991 
992  static const bool is_signed = numeric_limits< double > :: is_signed;
993  static const bool is_integer = numeric_limits< double > :: is_integer;
994  static const bool is_exact = numeric_limits< double > :: is_exact;
995 
996  inline static Dune::Fem::Double min () throw ()
997  {
998  return Dune::Fem::Double( numeric_limits< double > :: min() );
999  }
1000 
1001  inline static Dune::Fem::Double max () throw ()
1002  {
1003  return Dune::Fem::Double( numeric_limits< double > :: max() );
1004  }
1005 
1006  inline static Dune::Fem::Double epsilon () throw ()
1007  {
1008  return Dune::Fem::Double( numeric_limits< double > :: epsilon() );
1009  }
1010 
1011  inline static Dune::Fem::Double round_error () throw ()
1012  {
1013  return Dune::Fem::Double( numeric_limits< double > :: round_error() );
1014  }
1015 
1016  inline static Dune::Fem::Double infinity () throw ()
1017  {
1018  return Dune::Fem::Double( numeric_limits< double > :: infinity() );
1019  }
1020 
1021  inline static Dune::Fem::Double quiet_NaN () throw ()
1022  {
1023  return Dune::Fem::Double( numeric_limits< double > :: quiet_NaN() );
1024  }
1025 
1026  inline static Dune::Fem::Double signaling_NaN () throw ()
1027  {
1028  return Dune::Fem::Double( numeric_limits< double > :: signaling_NaN() );
1029  }
1030 
1031  inline static Dune::Fem::Double denorm_min () throw ()
1032  {
1033  return Dune::Fem::Double( numeric_limits< double > :: denorm_min() );
1034  }
1035 
1036  static const int min_exponent = numeric_limits< double > :: min_exponent;
1037  static const int max_exponent = numeric_limits< double > :: max_exponent;
1038  static const int min_exponent10 = numeric_limits< double > :: min_exponent10;
1039  static const int max_exponent10 = numeric_limits< double > :: max_exponent10;
1040 
1041  static const bool has_infinity = numeric_limits< double > :: has_infinity;
1042  static const bool has_quiet_NaN = numeric_limits< double > :: has_quiet_NaN;
1043  static const bool has_signaling_NaN = numeric_limits< double > :: has_signaling_NaN;
1044  static const float_denorm_style has_denorm = numeric_limits< double > :: has_denorm;
1045  static const bool has_denorm_loss = numeric_limits< double > :: has_denorm_loss;
1046 
1047  static const bool is_iec559 = numeric_limits< double > :: is_iec559;
1048  static const bool is_bounded = numeric_limits< double > :: is_bounded;
1049  static const bool is_modulo = numeric_limits< double > :: is_modulo;
1050 
1051  static const bool traps = numeric_limits< double > :: traps;
1052  static const bool tinyness_before = numeric_limits< double > :: tinyness_before;
1053  static const float_round_style round_style
1054  = numeric_limits< double > :: round_style;
1055 
1056  };
1057 
1058 } // namespace std
1059 
1060 #endif // #ifndef DUNE_FEM_DOUBLE_HH
double imag(const std::complex< Double > &x)
Definition: double.hh:900
static Dune::Fem::Double epsilon()
Definition: double.hh:1006
static double sqrt(const Double &v)
Definition: double.hh:870
void field_cast(const Double &f1, double &f2)
Definition: double.hh:885
static void flOp()
Definition: double.hh:365
static ThisType & instance()
Definition: double.hh:135
static double sin(const Double &v)
Definition: double.hh:875
static Dune::Fem::Double quiet_NaN()
Definition: double.hh:1021
FloatImp FloatType
Definition: double.hh:114
double value_
Definition: double.hh:290
Double()
Definition: double.hh:302
InStreamInterface< StreamTraits > & operator>>(InStreamInterface< StreamTraits > &in, DiscreteFunctionInterface< Impl > &df)
read a discrete function from an input stream
Definition: discretefunction_inline.hh:395
static Dune::Fem::Double min()
Definition: double.hh:996
static Dune::Fem::Double signaling_NaN()
Definition: double.hh:1026
FlOpCounter< ThisType > FlOpCounterType
Definition: double.hh:287
static double max(const Double &v, const double p)
Definition: double.hh:387
bool operator>(const Double &a, const Double &b)
Definition: double.hh:749
Definition: double.hh:168
static Dune::Fem::Double infinity()
Definition: double.hh:1016
bool operator>=(const Double &a, const Double &b)
Definition: double.hh:789
Double(const ThisType &other)
Definition: double.hh:314
static std::string typeName()
Definition: double.hh:359
Double abs(const Double &a)
Definition: double.hh:860
static double log(const Double &v)
Definition: double.hh:865
bool operator!=(const Double &a, const Double &b)
Definition: double.hh:629
bool operator==(const Double &a, const Double &b)
Definition: double.hh:589
bool operator<=(const Double &a, const Double &b)
Definition: double.hh:709
Definition: coordinate.hh:4
static double cos(const Double &v)
Definition: double.hh:880
abstract interface for an input stream
Definition: streams.hh:177
Definition: double.hh:111
bool operator<(const Double &a, const Double &b)
Definition: double.hh:669
Double operator*(const Double &a, const Double &b)
Definition: double.hh:495
static Dune::Fem::Double max()
Definition: double.hh:1001
FlOpCounter()
Definition: double.hh:120
STL namespace.
static Dune::Fem::Double denorm_min()
Definition: double.hh:1031
Double operator-(const Double &a, const Double &b)
Definition: double.hh:448
static Dune::Fem::Double round_error()
Definition: double.hh:1011
double real(const std::complex< Double > &x)
Definition: double.hh:890
Double operator/(const Double &a, const Double &b)
Definition: double.hh:542
OutStreamInterface< StreamTraits > & operator<<(OutStreamInterface< StreamTraits > &out, const DiscreteFunctionInterface< Impl > &df)
write a discrete function into an output stream
Definition: discretefunction_inline.hh:375
Double operator+(const Double &a, const Double &b)
Definition: double.hh:401
static double min(const Double &v, const double p)
Definition: double.hh:375
Double(const double value)
Definition: double.hh:310
abstract interface for an output stream
Definition: streams.hh:44