Re: Netcdf++ and Fortran arrays

Following up on my own message of February 4:

phil writes:
 > I'd appreciate any information/hints about adding the ability to
 > read/write column major matrices using netcdf++.  It looks like I
 > need to add C++ wrappers for ncvgt_ and ncvptg_, has anyone beaten
 > me to this?

Evidently the answer was no--so I went ahead and attempted this.  

First: a disclaimer--I know just slightly more about C++ than Nancy
Sinatra does, so anyone using my patches does so at their peril.

Second: another lobbying attempt--as a Fortran programming professor
looking for an free alternative to Fortran-90 and trying to come to grips
with the fact that our computer science department is teaching only
Scheme and C++ (the token f77 course taught by an elderly faculty
member has retired with him), these column major C++ array packages
are a godsend.  I also think they will be at the heart of numerical
C++, and encourage people to take a look at, for example the features
offered by A++/P++ (http://www.c3.lanl.gov/~dquinlan/home.html) and
the High Performance C++ initiative that will be built on A++/P++
(http://www.extreme.indiana.edu/hpc++).  I see from the faq that
"Continued improvements to C++ interface, implementation" is on
the todo list, and hope that column major support might be a part
of this.

As for my changes, I wanted to derive a new set of classes and
overload put, get, edges, and add_var, but I couldn't see how to do
that without virtual function definitions in the base classes.  I
experimented with adding an enum called StorageOrder to these methods,
which would default to RowMajor, but that seemed to interfere with the
overloading of the addvar, put and get methods with variable numbers
of dimensions.  So I retreated from any attempt at elegance and just
defined add_varCol, edgesCol, putCol and getCol, with a global
function reverse working as in jackets.c, and this does the job
for me (I've done nothing with records, which I don't usually use).

Anyone who'd like to test this is welcome to the diffs via email.

Regards, Phil

Phil Austin             INTERNET: phil@xxxxxxxxxxx
(604) 822-2175          FAX:      (604) 822-6150

http://www.geog.ubc.ca/~phil
Associate Professor
Atmospheric Sciences Programme
Geography #217
University of British Columbia
1984 W Mall
Vancouver, BC  V6T 1Z2
CANADA


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