MAST3
Multidisciplinary-design Adaptation and Sensitivity Toolkit (MAST)
mast_data_types.h
Go to the documentation of this file.
1 /*
2  * MAST: Multidisciplinary-design Adaptation and Sensitivity Toolkit
3  * Copyright (C) 2013-2020 Manav Bhatia and MAST authors
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #ifndef __mast__data_types__
21 #define __mast__data_types__
22 
23 // MAST configuration
24 #include <mast/base/mast_config.h>
25 
26 // Eigen includes
27 #include <Eigen/Dense>
28 #include <Eigen/SparseCore>
29 
30 #if MAST_ENABLE_ADOLC == 1
31 // AdolC includes
32 #include <adolc/adtl.h>
33 #include <adolc/adouble.h>
34 // Eigen support for Adol-C
35 #include <unsupported/Eigen/AdolcForward>
36 // adouble for trace mode
37 typedef adouble adouble_t;
38 // traceless adouble
39 typedef adtl::adouble adouble_tl_t;
40 #endif
41 
42 typedef double real_t;
43 typedef unsigned int uint_t;
44 typedef int int_t;
45 typedef std::complex<real_t> complex_t;
46 #define ComplexStepDelta 1.e-12
47 
48 namespace MAST {
49 
50 template <typename NodalScalarType, typename SolScalarType>
51 struct DeducedScalarType { };
52 
53 template <>
54 struct DeducedScalarType<real_t, real_t> { using type = real_t;};
55 
56 template <>
57 struct DeducedScalarType<std::complex<real_t>, real_t> { using type = std::complex<real_t>;};
58 
59 template <>
60 struct DeducedScalarType<real_t, std::complex<real_t>> { using type = std::complex<real_t>;};
61 
62 template <>
63 struct DeducedScalarType<std::complex<real_t>, std::complex<real_t>> { using type = std::complex<real_t>;};
64 
65 #if MAST_ENABLE_ADOLC == 1
66 template <>
67 struct DeducedScalarType<adouble_tl_t, real_t> { using type = adouble_tl_t;};
68 
69 template <>
70 struct DeducedScalarType<real_t, adouble_tl_t> { using type = adouble_tl_t;};
71 
72 template <>
73 struct DeducedScalarType<adouble_tl_t, adouble_tl_t> { using type = adouble_tl_t;};
74 #endif
75 }
76 
77 #endif // __mast__data_types__
std::complex< real_t > complex_t
int int_t
unsigned int uint_t
double real_t