Re: ncdigest V1 #610

Hi,

> Date: Fri, 12 Oct 2001 10:52:40 -0700
> From: Charlie Zender <zender@xxxxxxx>
> Subject: Re: ncdigest V1 #609
> 
> I have never used more than 4 dimensions. It sounds like writing
> rank-specific implementations for up to 5 dimensions will handle
> 99.44% of the cases, and higher ranks could always be added later.
> 

the Fortran 90 interface of netcdf itself solves the problem by
generating the complete source code for its interfaces from a set of m4
macros. I have used the same idea in a couple of my own projects, and it
does work quite nicely for the generation of interfaces and if more or
less identical source code using arrays of various ranks is required.
Once I managed to get the macro versions of the sources general enough
to work relyably for 1 and 2d arrays (which usually was a problem of my
lack of understanding of m4), they also worked for higher ranks with
little or no modifications.

What make this approach so simple with Fortran 90 is that much of the
code can be repeated literally for arrays of different rank. For
example, statements like 'x = a + b' apply elementwise in f90's array
syntax. If this would have to be implemented using explicit loops,
however, working with macros probably becomes much more painful.

Hope this helps,

  Chris.


-- 

  Christian Marquardt

  GFZ Potsdam, Div. 1             |       Tel.: (+49) 331-288-1168
  Am Telegrafenberg               |       Fax:  (+49) 331-288-1732
  D-14473 Potsdam                 |       Email: marq@xxxxxxxxxxxxxx


  • 2001 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: