forked from NOAA-GFDL/FMS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fms_platform.h
121 lines (102 loc) · 3.2 KB
/
fms_platform.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
! -*-f90-*-*
!***********************************************************************
!* GNU Lesser General Public License
!*
!* This file is part of the GFDL Flexible Modeling System (FMS).
!*
!* FMS is free software: you can redistribute it and/or modify it under
!* the terms of the GNU Lesser General Public License as published by
!* the Free Software Foundation, either version 3 of the License, or (at
!* your option) any later version.
!*
!* FMS is distributed in the hope that it will be useful, but WITHOUT
!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
!* for more details.
!*
!* You should have received a copy of the GNU Lesser General Public
!* License along with FMS. If not, see <http://www.gnu.org/licenses/>.
!***********************************************************************
#ifndef __FMS_PLATFORM_
#define __FMS_PLATFORM_
!Set type kinds.
#ifdef PORTABLE_KINDS
use,intrinsic :: iso_fortran_env, only: real128
use,intrinsic :: iso_c_binding, only: c_double,c_float,c_int64_t, &
c_int32_t,c_int16_t,c_intptr_t
#define QUAD_KIND real128
#define DOUBLE_KIND c_double
#define FLOAT_KIND c_float
#define LONG_KIND c_int64_t
#define INT_KIND c_int32_t
#define SHORT_KIND c_int16_t
#define POINTER_KIND c_intptr_t
#else
!These values are not necessarily portable.
#define QUAD_KIND 16
#define DOUBLE_KIND 8
#define FLOAT_KIND 4
#define LONG_KIND 8
#define INT_KIND 4
#define SHORT_KIND 2
#define POINTER_KIND 8
!DEC$ MESSAGE:'Using 8-byte addressing'
#endif
!Control "pure" functions.
#ifdef NO_F95
#define _PURE
!DEC$ MESSAGE:'Not using pure routines.'
#else
#define _PURE pure
!DEC$ MESSAGE:'Using pure routines.'
#endif
!Control array members of derived types.
#ifdef NO_F2000
#define _ALLOCATABLE pointer
#define _NULL =>null()
#define _ALLOCATED associated
!DEC$ MESSAGE:'Using pointer derived type array members.'
#else
#define _ALLOCATABLE allocatable
#define _NULL
#define _ALLOCATED allocated
!DEC$ MESSAGE:'Using allocatable derived type array members.'
#endif
!Control use of cray pointers.
#ifdef NO_CRAY_POINTERS
#undef use_CRI_pointers
!DEC$ MESSAGE:'Not using cray pointers.'
#else
#define use_CRI_pointers
!DEC$ MESSAGE:'Using cray pointers.'
#endif
!Control size of integers that will hold address values.
!Appears for legacy reasons, but seems rather dangerous.
#ifdef _32bits
#define POINTER_KIND 4
!DEC$ MESSAGE:'Using 4-byte addressing'
#endif
!If you do not want to use 64-bit integers.
#ifdef no_8byte_integers
#define LONG_KIND INT_KIND
#endif
!If you do not want to use 32-bit floats.
#ifdef no_4byte_reals
#define FLOAT_KIND DOUBLE_KIND
#define NF_GET_VAR_REAL nf_get_var_double
#define NF_GET_VARA_REAL nf_get_vara_double
#define NF_GET_ATT_REAL nf_get_att_double
#undef OVERLOAD_R4
#undef OVERLOAD_C4
#endif
!If you want to use quad-precision.
! The NO_QUAD_PRECISION macro will be deprecated and removed at some future time.
! Model code will rely solely upon the ENABLE_QUAD_PRECISION macro thereafer.
#if defined(ENABLE_QUAD_PRECISION)
#undef NO_QUAD_PRECISION
#else
#define NO_QUAD_PRECISION
#undef QUAD_KIND
#define QUAD_KIND DOUBLE_KIND
#endif
#endif