Sujet : Re: Is there a way in Fortran to designate an integer value as integer*8 ?
De : lynnmcguire5 (at) *nospam* gmail.com (Lynn McGuire)
Groupes : comp.lang.fortranDate : 26. Oct 2024, 02:26:37
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vfhggd$3digo$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
User-Agent : Mozilla Thunderbird
On 10/24/2024 1:28 AM, Thomas Koenig wrote:
Lynn McGuire <lynnmcguire5@gmail.com> schrieb:
I am going to change all the F77 code to C++ some day. I already have a
heavily modified version of F2C that I have rewritten extensively and
already moved several hundred subroutines from F77 to C++.
Modern Fortran might be the easier way, because a change can be done
incrementally, and this...
The biggest
problem is the F77 write statements.
... would not be an issue. What features is modern Fortran missing that
you need C++ for?
F2C fixes the other big problem
automatically, the change of initial array index from one to zero.
If I remember correctly, it does so by issueing invalid C (or
C++), by using negative offsets from pointers. Might work now,
might not work tomorrow.
But note the IIRC above.
I want to move to a monolanguage environment. 50,000 lines of my calculation engine are C++ already. 850,000 lines to go.
Here is a portion of the translated C++ code from a subroutine called vapres.f. component_data1.triplepointtemperature is a previous fortran common block variable, it is now a static. The index before was [k], now it is [k - 1]. t and star are an argument variables.
int vapres (integer k, doublereal t, doublereal *ps, char *star, doublereal *apc,
doublereal *atb, doublereal *atc, longint *idcomp, doublereal *zcd)
{
if (t <= component_data1.triplepointtemperature[k - 1]) {
solid_vapor_pressure (k, t, ps);
*star = ' ';
goto L99999;
}
L99999:
if (*ps < 1e-20) {
*ps = 1e-20;
}
if (*ps > 1e6) {
*ps = 1e6;
}
return 0;
} /* vapres */
Lynn