FMS  2026.01
Flexible Modeling System
fms_platform.h
1 ! -*-f90-*-*
2 !***********************************************************************
3 !* Apache License 2.0
4 !*
5 !* This file is part of the GFDL Flexible Modeling System (FMS).
6 !*
7 !* Licensed under the Apache License, Version 2.0 (the "License");
8 !* you may not use this file except in compliance with the License.
9 !* You may obtain a copy of the License at
10 !*
11 !* http://www.apache.org/licenses/LICENSE-2.0
12 !*
13 !* FMS is distributed in the hope that it will be useful, but WITHOUT
14 !* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied;
15 !* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
16 !* PARTICULAR PURPOSE. See the License for the specific language
17 !* governing permissions and limitations under the License.
18 !***********************************************************************
19 
20 #ifndef __FMS_PLATFORM_
21 #define __FMS_PLATFORM_
22 
23 
24 !Set type kinds.
25 #ifdef PORTABLE_KINDS
26 use,intrinsic :: iso_fortran_env, only: real128
27 use,intrinsic :: iso_c_binding, only: c_double,c_float,c_int64_t, &
28  c_int32_t,c_int16_t,c_intptr_t
29 #define QUAD_KIND real128
30 #define DOUBLE_KIND c_double
31 #define FLOAT_KIND c_float
32 #define LONG_KIND c_int64_t
33 #define INT_KIND c_int32_t
34 #define SHORT_KIND c_int16_t
35 #define POINTER_KIND c_intptr_t
36 #else
37 !These values are not necessarily portable.
38 #define QUAD_KIND 16
39 #define DOUBLE_KIND 8
40 #define FLOAT_KIND 4
41 #define LONG_KIND 8
42 #define INT_KIND 4
43 #define SHORT_KIND 2
44 #define POINTER_KIND 8
45 !DEC$ MESSAGE:'Using 8-byte addressing'
46 #endif
47 
48 !Control "pure" functions.
49 #ifdef NO_F95
50 #define _PURE
51 !DEC$ MESSAGE:'Not using pure routines.'
52 #else
53 #define _PURE pure
54 !DEC$ MESSAGE:'Using pure routines.'
55 #endif
56 
57 !Control array members of derived types.
58 #ifdef NO_F2000
59 #define _ALLOCATABLE pointer
60 #define _NULL =>null()
61 #define _ALLOCATED associated
62 !DEC$ MESSAGE:'Using pointer derived type array members.'
63 #else
64 #define _ALLOCATABLE allocatable
65 #define _NULL
66 #define _ALLOCATED allocated
67 !DEC$ MESSAGE:'Using allocatable derived type array members.'
68 #endif
69 
70 !Control use of cray pointers within mpp_peset
71 !Other cray pointer usage in mpp routines is compiled regardless
72 #ifdef NO_CRAY_POINTERS
73 #undef use_CRI_pointers
74 !DEC$ MESSAGE:'Not using cray pointers.'
75 #else
76 #define use_CRI_pointers
77 !DEC$ MESSAGE:'Using cray pointers.'
78 #endif
79 
80  !If you do not want to use 64-bit integers.
81 #ifdef no_8byte_integers
82 #undef LONG_KIND
83 #define LONG_KIND INT_KIND
84 #endif
85 
86 !If you want to use quad-precision.
87 #ifndef ENABLE_QUAD_PRECISION
88 #undef QUAD_KIND
89 #define QUAD_KIND DOUBLE_KIND
90 #endif
91 
92 !Max string sizes for paths and files
93 #ifndef FMS_MAX_PATH_LEN
94 #define FMS_MAX_PATH_LEN 1024
95 #endif
96 #ifndef FMS_MAX_FILE_LEN
97 #define FMS_MAX_FILE_LEN 255
98 #endif
99 
100 #endif