Вопрос

I am new in FORTRAN trying to understand some code:

c#define _USE_MPI_

#ifndef _NX_

Is this fortran?

Это было полезно?

Решение

These are pre-processor flags, not valid Fortran. You would need to enable a pre-processor like cpp (gfortran) or fpp (ifort).

With #define you can define a variable or a macro. Using #ifdef and #ifndef you can perform checks on those variables.

I assume these directives are present in your code to enable different routines or statements when compiled with and without MPI - not unlike an if-statement at compile-time. This is usually done to be able to run the code in a purely serial mode as well.

The c before the pre-processor directive is probably to comment it out (which would be FORTRAN syntax), to prevent it from being interpreted by the pre-processor.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top