home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programming
/
powerprogramming1994.iso
/
progtool
/
microcrn
/
issue_40.arc
/
DAIMS.ARC
/
README
< prev
next >
Wrap
Text File
|
1988-02-10
|
3KB
|
63 lines
These are some example C++ files from the DAIMS project mentioned in
issue #40 (March-April 1988) of Micro Cornucopia: "A Programmer's
Introduction to C++" by Bruce Eckel. The DAIMS project is funded by the
Institute of Naval Oceanography and the results of the project are in
the public domain. You can use this code any way you want, but please
leave author information in and mention DAIMS and the INO.
DAIMS will continue until the summer of 1989. The goal is to
produce at least one working medium-sized ocean model using C++, as well
as all the tools we can produce. We hope this will provide incentive
for oceanographers (and other scientists) to move to C++.
Please be warned: this code was developed on a Sun 3 workstation
running a port of the AT&T C compiler version 1.1. The examples you see
here are from two projects: one is an interpreter which uses a parser
generated by Yacc and a lexical analyzer generated by Lex. At this
time, the Advantage C++ compiler was unable to handle the size of the
Yacc-generated parser, and the Guidelines C++ compiler choked on the
lexical analyzer as well. Thus, while the classes compiled fine, you
won't find the interpreter in here. Advantage is working on the size
problem, but their latest Beta release had a note that said they bailed
out on using memory from 640K-1M for their compiler stack (which
probably would have solved the problem). I'm hoping they will just use
LIM 4.0 memory instead.
The second project is a demonstration of the two-dimensional
ocean spin-up problem. Air from the gulfstream moving across the ocean
forces the thermocline (the place where the water temperature changes
abruptly) down. This model shows the depression of the thermocline as
time progresses, allowing you to change the way the wind moves and the
resolution of the model. The display occurred through sunwindows on the
sun workstation, thus you will see a number of strangely-named "plain" c
files and there won't be any sources for them. This is because they are
sunwindows code and won't run on the PC.
The code here isn't useless on a PC by any means. I have
compiled most of it on a PC and made sample programs. I think you'll
find the "matrix" class (matrix1.C, matrix2.C and matrix.hxx) the most
useful -- it allows you to transpose, invert, take the determinant and
generate the inverse of an arbitrarily-sized matrix (limited only by the
PC's memory, of course). It also demonstrates some of the more subtle
programming tricks in C++: creating and manipulating objects of an
arbitrary size and setting large objects equal to each other without
doing a bit-copy (a method called "reference counting" which allows many
objects to point to the same physical memory so if one gets changed,
they all change. If you're looking at a cat through many different
windows of a house and the cat changes, you want the change to show in
all the windows).
If you have a sun and want the full sources for the interpreter
or the ocean demo, I can be contacted in a number of ways:
Bruce Eckel
eckel@sperm.ocean.washington.edu
uw-beaver!beluga!eckel
bitnet: eckel%namu.ocean.washington.edu@UWAVM
We will eventually get a unix bulletin board running or at the
very least, the ability to do anonymous ftp.
I don't log into the Micro C BBS very often, so that isn't a
very good way to reach me.