Dune Core Modules (2.4.1)

gmpfield.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_GMPFIELD_HH
4#define DUNE_GMPFIELD_HH
5
10#include <iostream>
11#include <string>
12
13#if HAVE_GMP
14
15#include <gmpxx.h>
16
17namespace Dune
18{
19
20 template< unsigned int precision >
21 class GMPField
22 : public mpf_class
23 {
24 typedef mpf_class Base;
25
26 public:
28 GMPField ()
29 : Base(0,precision)
30 {}
31
35 GMPField ( const char* str )
36 : Base(str,precision)
37 {}
38
42 GMPField ( const std::string& str )
43 : Base(str,precision)
44 {}
45
48 template< class T,
49 typename EnableIf = typename std::enable_if<
50 std::is_convertible<T, mpf_class>::value>::type
51 >
52 GMPField ( const T &v )
53 : Base( v,precision )
54 {}
55
56 // type conversion operators
57 operator double () const
58 {
59 return this->get_d();
60 }
61
62 };
63
64}
65
66#endif // HAVE_GMP
67
68#endif // #ifndef DUNE_GMPFIELD_HH
Dune namespace.
Definition: alignment.hh:10
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 24, 23:30, 2024)