[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20040810: mixed programming, C and Fortran and netcdf



Ufuk,

> Date:    Fri, 30 Jul 2004 10:35:07 +0300
> From:    "ufuk turuncoglu" <address@hidden>
> To:      "Russ Rew" <address@hidden>
> Subject: Re: mixed programming, C and Fortran and netcdf 

The above message contained the following:

> i place the two netcdf file into fallowing directory to determine the
> problem.
> 
> http://www.be.itu.edu.tr/~turuncu/IC.nc (created using C, size ~ 4.5 mb)
> http://www.be.itu.edu.tr/~turuncu/pom2k.nc (read from f77 and created in
> f77, size ~ 16 mb)
> 
> The file IC.nc is created using mixed language programming, the variables
> calculated in f90 and the C interface is used for creating netcdf. To avoid
> memory allocation differencies between C and f90, one extra subroutine  is
> added to C and it convert the input data (from f90) to C array indexing
> format and correct it...

As you discovered, mixed-language programming can be difficult.
Therefore, it is best not to do it unless absolutely necessary.  It does
not appear to be necessary in your case because the variables are
computed by a Fortran-90 program and the netCDF library has a Fortran-90
interface.  Therefore, the program that computes the values should use
the Fortran-90 netCDF interface to store the values.

Please modify your program so that it uses the Fortran-90 interface to
save the data.  If you still have a problem after doing this, then
contact address@hidden.

Regards,
Steve Emmerson