programmer's documentation
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
src
base
cs_base_fortran.h
Go to the documentation of this file.
1
#ifndef __CS_BASE_FORTRAN_H__
2
#define __CS_BASE_FORTRAN_H__
3
4
/*============================================================================
5
* Initializtion and handling of Fortran-related mechanisms
6
*============================================================================*/
7
8
/*
9
This file is part of Code_Saturne, a general-purpose CFD tool.
10
11
Copyright (C) 1998-2013 EDF S.A.
12
13
This program is free software; you can redistribute it and/or modify it under
14
the terms of the GNU General Public License as published by the Free Software
15
Foundation; either version 2 of the License, or (at your option) any later
16
version.
17
18
This program is distributed in the hope that it will be useful, but WITHOUT
19
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21
details.
22
23
You should have received a copy of the GNU General Public License along with
24
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25
Street, Fifth Floor, Boston, MA 02110-1301, USA.
26
*/
27
28
/*----------------------------------------------------------------------------*/
29
30
/*----------------------------------------------------------------------------
31
* Local headers
32
*----------------------------------------------------------------------------*/
33
34
#include "
cs_base.h
"
35
36
/*----------------------------------------------------------------------------*/
37
38
BEGIN_C_DECLS
39
40
/*=============================================================================
41
* Macro definitions
42
*============================================================================*/
43
44
/*============================================================================
45
* Type definitions
46
*============================================================================*/
47
48
/*============================================================================
49
* Static global variables
50
*============================================================================*/
51
52
/*============================================================================
53
* Public function prototypes for Fortran API
54
*============================================================================*/
55
56
/*----------------------------------------------------------------------------
57
* Call exit routine from Fortran code
58
*
59
* Fortran interface:
60
*
61
* subroutine csexit (status)
62
* *****************
63
*
64
* integer status : <-- : 0 for success, 1+ for error
65
*----------------------------------------------------------------------------*/
66
67
void
CS_PROCF
(
csexit
, CSEXIT)
68
(
69
const
cs_int_t
*status
70
);
71
72
/*----------------------------------------------------------------------------
73
* Elapsed time since execution start
74
*
75
* Fortran interface:
76
*
77
* subroutine dmtmps (tw)
78
* *****************
79
*
80
* double precision tw : <-- : elapsed time
81
*----------------------------------------------------------------------------*/
82
83
void
CS_PROCF
(
dmtmps
, DMTMPS)
84
(
85
cs_real_t
*tw
86
);
87
88
/*----------------------------------------------------------------------------
89
* Create a directory, or check it exists.
90
*
91
* Fortran interface
92
*
93
* subroutine csmkdr (dirnam, dirlen)
94
* *****************
95
*
96
* character* dirnam : --> : Directory name
97
* integer dirlen : --> : Directory name length
98
*----------------------------------------------------------------------------*/
99
100
void
CS_PROCF
(
csmkdr
, CSMKDR)
101
(
102
const
char
*dirnam,
103
const
cs_int_t
*dirlen
104
);
105
106
/*----------------------------------------------------------------------------
107
* Compute the gamma function of x.
108
*
109
* Fortran interface
110
*
111
* subroutine csgamma (x, g)
112
* ******************
113
*
114
* double precision x : <-- : input value
115
* double precision gamma : --> : output value
116
*----------------------------------------------------------------------------*/
117
118
void
CS_PROCF
(
csgamma
, CSGAMMA)
119
(
120
const
cs_real_t
*x,
121
cs_real_t
*gamma
122
);
123
124
/*----------------------------------------------------------------------------
125
* Copy a Fortan string buffer to a C string buffer
126
*
127
* The aim of this function is to aviod issues with Fortran array bounds
128
* checking when compilers such as icc 11 consider a character array from C
129
* as an array of 1-character length strings.
130
*
131
* Fortran interface
132
*
133
* subroutine cssf2c (len, cstr, fstr)
134
* *****************
135
*
136
* integer len : <-- : String length
137
* character* fstr : <-- : Fortran string
138
* character* cstr : --> : C string
139
*----------------------------------------------------------------------------*/
140
141
void
CS_PROCF
(
cssf2c
, CSSF2C)
142
(
143
const
cs_int_t
*len,
144
const
char
*fstr,
145
char
*cstr
146
CS_ARGF_SUPP_CHAINE
/* (possible 'length' arguments added
147
by many Fortran compilers) */
148
);
149
150
/*----------------------------------------------------------------------------
151
* Get log name file information.
152
*
153
* When log file output is suppressed, it returns the name of the
154
* bit buck file ("/dev/null")
155
*
156
* Fortran interface
157
*
158
* subroutine cslogname (len, name)
159
* ********************
160
*
161
* integer len : <-- : maximum string length
162
* character* name : --> : Fortran string
163
*----------------------------------------------------------------------------*/
164
165
void
CS_PROCF
(
cslogname
, CSLOGNAME)
166
(
167
const
cs_int_t
*len,
168
char
*dir
169
CS_ARGF_SUPP_CHAINE
/* (possible 'length' arguments added
170
by many Fortran compilers) */
171
);
172
173
/*----------------------------------------------------------------------------
174
* Get package data path information.
175
*
176
* The aim of this function is to aviod issues with Fortran array bounds
177
* checking when compilers such as icc 11 consider a character array from C
178
* as an array of 1-character length strings.
179
*
180
* Fortran interface
181
*
182
* subroutine csdatadir (len, dir)
183
* ********************
184
*
185
* integer len : <-- : maximum string length
186
* character* dir : --> : Fortran string
187
*----------------------------------------------------------------------------*/
188
189
void
CS_PROCF
(
csdatadir
, CSDATADIR)
190
(
191
const
cs_int_t
*len,
192
char
*dir
193
CS_ARGF_SUPP_CHAINE
/* (possible 'length' arguments added
194
by many Fortran compilers) */
195
);
196
197
/*=============================================================================
198
* Public function prototypes
199
*============================================================================*/
200
201
/*----------------------------------------------------------------------------
202
* Replace default bft_printf() mechanism with internal mechanism.
203
*
204
* This variant is designed to allow switching from C to Fortran output,
205
* whithout disabling regular C stdout output when switched to Fortran.
206
*
207
* This allows redirecting or suppressing logging for different ranks.
208
*
209
* parameters:
210
* log_name <-- base file name for log, or NULL for stdout
211
* r0_log_flag <-- redirection for rank 0 log;
212
* 0: not redirected; 1: redirected to <log_name> file
213
* rn_log_flag <-- redirection for ranks > 0 log:
214
* 0: not redirected; 1: redirected to <log_name>_n*" file;
215
* 2: redirected to "/dev/null" (suppressed)
216
*----------------------------------------------------------------------------*/
217
218
void
219
cs_base_fortran_bft_printf_set
(
const
char
*log_name,
220
int
r0_log_flag,
221
int
rn_log_flag);
222
223
/*----------------------------------------------------------------------------
224
* Switch bft_printf() mechanism to C output.
225
*
226
* This function may only be called after cs_base_fortran_bft_printf_set()
227
*----------------------------------------------------------------------------*/
228
229
void
230
cs_base_fortran_bft_printf_to_c
(
void
);
231
232
/*----------------------------------------------------------------------------
233
* Switch bft_printf() mechanism to Fortran output.
234
*
235
* This function may only be called after cs_base_fortran_bft_printf_set()
236
*----------------------------------------------------------------------------*/
237
238
void
239
cs_base_fortran_bft_printf_to_f
(
void
);
240
241
/*----------------------------------------------------------------------------*/
242
243
END_C_DECLS
244
245
#endif
/* __CS_BASE_FORTRAN_H__ */
Generated on Thu Feb 27 2014 19:21:34 by
1.8.3.1