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