MADNESS 0.10.1
fortran_ctypes.h
Go to the documentation of this file.
1/*
2 This file is part of MADNESS.
3
4 Copyright (C) 2007,2010 Oak Ridge National Laboratory
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20 For more information please contact:
21
22 Robert J. Harrison
23 Oak Ridge National Laboratory
24 One Bethel Valley Road
25 P.O. Box 2008, MS-6367
26
27 email: harrisonrj@ornl.gov
28 tel: 865-241-3937
29 fax: 865-572-0680
30*/
31
32/**
33 \file fortran_ctypes.h
34 \brief Correspondence between C++ and Fortran types.
35*/
36
37#ifndef FORTRAN_CTYPES_H
38#define FORTRAN_CTYPES_H
39
40#include <complex>
41#include <stdint.h>
43
44/// Fortran type for 4-byte integers.
45typedef int32_t integer4;
46#define HAVE_INTEGER4
47# ifdef HAVE_INT64_T
48/// Fortran type for 8-byte integers.
49typedef int64_t integer8;
50#define HAVE_INTEGER8
51# endif // HAVE_INT64_T
52
53// Set the default Fortran integer type
54#if (MADNESS_FORTRAN_DEFAULT_INTEGER_SIZE == 8)
55
56#ifdef HAVE_INTEGER8
57/// Set the default Fortran integer type to integer*8.
58typedef integer8 integer;
59#else
60/// Set the default Fortran integer type to integer*4.
61typedef integer4 integer;
62#endif // HAVE_INT64_T
63
64#else // (MADNESS_FORTRAN_DEFAULT_INTEGER_SIZE == 4)
65
66/// Set the default Fortran integer type to integer*4.
68
69#endif // (MADNESS_FORTRAN_DEFAULT_INTEGER_SIZE == 8)
70
71
72/// Fortran double precision.
73typedef double real8;
74/// Fortran double precision.
75typedef double double_precision;
76
77/// Fortran single precision.
78typedef float real4;
79/// Fortran single precision.
80typedef float single_precision;
81
82/// Fortran double complex.
83typedef std::complex<double> complex_real8;
84/// Fortran double complex.
85typedef std::complex<double> double_precision_complex;
86
87/// Fortran single complex.
88typedef std::complex<float> complex_real4;
89/// Fortran single complex.
90typedef std::complex<float> single_precision_complex;
91
92/// Type of variable appended to argument list for length of fortran character strings.
93typedef int char_len;
94
95
96#endif
double double_precision
Fortran double precision.
Definition fortran_ctypes.h:75
std::complex< double > complex_real8
Fortran double complex.
Definition fortran_ctypes.h:83
std::complex< float > complex_real4
Fortran single complex.
Definition fortran_ctypes.h:88
int char_len
Type of variable appended to argument list for length of fortran character strings.
Definition fortran_ctypes.h:93
double real8
Fortran double precision.
Definition fortran_ctypes.h:73
integer4 integer
Set the default Fortran integer type to integer*4.
Definition fortran_ctypes.h:67
float real4
Fortran single precision.
Definition fortran_ctypes.h:78
float single_precision
Fortran single precision.
Definition fortran_ctypes.h:80
std::complex< float > single_precision_complex
Fortran single complex.
Definition fortran_ctypes.h:90
std::complex< double > double_precision_complex
Fortran double complex.
Definition fortran_ctypes.h:85
int32_t integer4
Fortran type for 4-byte integers.
Definition fortran_ctypes.h:45
Macros and tools pertaining to the configuration of MADNESS.