My Project
programmer's documentation
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-2019 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 
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,
122  );
123 
124 /*----------------------------------------------------------------------------
125  * Compute the erf function of x.
126  *
127  * Fortran interface
128  *
129  * subroutine cserf (x, g)
130  * ******************
131  *
132  * double precision x : <-- : input value
133  * double precision ferf : --> : output value
134  *----------------------------------------------------------------------------*/
135 
136 void CS_PROCF (cserf, CSERF)
137 (
138  const cs_real_t *x,
139  cs_real_t *ferf
140  );
141 
142 /*----------------------------------------------------------------------------
143  * Get log name file information.
144  *
145  * When log file output is suppressed, it returns the name of the
146  * bit buck file ("/dev/null")
147  *
148  * Fortran interface
149  *
150  * subroutine cslogname (len, name)
151  * ********************
152  *
153  * integer len : <-- : maximum string length
154  * character* name : --> : Fortran string
155  *----------------------------------------------------------------------------*/
156 
157 void CS_PROCF (cslogname, CSLOGNAME)
158 (
159  const cs_int_t *len,
160  char *dir
161  CS_ARGF_SUPP_CHAINE /* (possible 'length' arguments added
162  by many Fortran compilers) */
163 );
164 
165 /*----------------------------------------------------------------------------
166  * Get package data path information.
167  *
168  * The aim of this function is to aviod issues with Fortran array bounds
169  * checking when compilers such as icc 11 consider a character array from C
170  * as an array of 1-character length strings.
171  *
172  * Fortran interface
173  *
174  * subroutine csdatadir (len, dir)
175  * ********************
176  *
177  * integer len : <-- : maximum string length
178  * character* dir : --> : Fortran string
179  *----------------------------------------------------------------------------*/
180 
181 void CS_PROCF (csdatadir, CSDATADIR)
182 (
183  const cs_int_t *len,
184  char *dir
185  CS_ARGF_SUPP_CHAINE /* (possible 'length' arguments added
186  by many Fortran compilers) */
187 );
188 
189 /*=============================================================================
190  * Public function prototypes
191  *============================================================================*/
192 
193 /*----------------------------------------------------------------------------
194  * Replace default bft_printf() mechanism with internal mechanism.
195  *
196  * This variant is designed to allow switching from C to Fortran output,
197  * whithout disabling regular C stdout output when switched to Fortran.
198  *
199  * This allows redirecting or suppressing logging for different ranks.
200  *
201  * parameters:
202  * log_name <-- base file name for log, or NULL for stdout
203  * rn_log_flag <-- redirection for ranks > 0 log:
204  * false: to "/dev/null" (suppressed)
205  * true: redirected to <log_name>_n*.log" file;
206  *----------------------------------------------------------------------------*/
207 
208 void
209 cs_base_fortran_bft_printf_set(const char *log_name,
210  bool rn_log_flag);
211 
212 /*----------------------------------------------------------------------------
213  * Switch bft_printf() mechanism to C output.
214  *
215  * This function may only be called after cs_base_fortran_bft_printf_set()
216  *----------------------------------------------------------------------------*/
217 
218 void
220 
221 /*----------------------------------------------------------------------------
222  * Switch bft_printf() mechanism to Fortran output.
223  *
224  * This function may only be called after cs_base_fortran_bft_printf_set()
225  *----------------------------------------------------------------------------*/
226 
227 void
229 
230 /*----------------------------------------------------------------------------
231  * Wrappers for Fortran C
232  *----------------------------------------------------------------------------*/
233 
234 void
236 
237 void
239 
240 void
242  cs_real_t *st_exp,
243  cs_real_t *st_imp);
244 
245 void
247 
248 void
250 
251 void
253 
254 void
256 
257 /*----------------------------------------------------------------------------*/
258 
260 
261 #endif /* __CS_BASE_FORTRAN_H__ */
f_id
void const int * f_id
Definition: cs_gui.h:292
cs_user_parameters_wrapper
void cs_user_parameters_wrapper(void)
Definition: cs_base_fortran.c:651
len
size_t len
Definition: mei_scanner.c:560
dirlen
void const cs_int_t * dirlen
Definition: cs_base_fortran.h:104
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
cs_real_t
double cs_real_t
Floating-point value.
Definition: cs_defs.h:302
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
CS_PROCF
void CS_PROCF(csexit, CSEXIT)(const cs_int_t *status)
Definition: cs_base_fortran.c:238
cs_user_extra_operations_initialize_wrapper
void cs_user_extra_operations_initialize_wrapper(void)
Definition: cs_base_fortran.c:616
cs_base_fortran_bft_printf_to_c
void cs_base_fortran_bft_printf_to_c(void)
Definition: cs_base_fortran.c:539
cs_user_source_terms_wrapper
void cs_user_source_terms_wrapper(int f_id, cs_real_t *st_exp, cs_real_t *st_imp)
Definition: cs_base_fortran.c:628
ferf
void cs_real_t * ferf
Definition: cs_base_fortran.h:140
cs_user_finalize_setup_wrapper
void cs_user_finalize_setup_wrapper(void)
Definition: cs_base_fortran.c:657
CS_ARGF_SUPP_CHAINE
void char *dir CS_ARGF_SUPP_CHAINE
Definition: cs_base_fortran.h:163
cs_user_initialization_wrapper
void cs_user_initialization_wrapper(void)
Definition: cs_base_fortran.c:645
gamma
void cs_real_t * gamma
Definition: cs_base_fortran.h:122
cs_int_t
int cs_int_t
Fortran-compatible integer.
Definition: cs_defs.h:301
cs_base_fortran_bft_printf_to_f
void cs_base_fortran_bft_printf_to_f(void)
Definition: cs_base_fortran.c:573
cs_base_fortran_bft_printf_set
void cs_base_fortran_bft_printf_set(const char *log_name, bool rn_log_flag)
Definition: cs_base_fortran.c:457
cs_user_extra_operations_wrapper
void cs_user_extra_operations_wrapper(void)
Definition: cs_base_fortran.c:639
cs_base.h
cs_user_physical_properties_wrapper
void cs_user_physical_properties_wrapper(void)
Definition: cs_base_fortran.c:622