The Gerris Object System
From Gerris
| Revision as of 16:43, 21 August 2012 GeordieMcBain (Talk | contribs) (linked to GLib, Gnome, GTK+, C operator precedence table, etc.) ← Previous diff |
Revision as of 16:46, 21 August 2012 GeordieMcBain (Talk | contribs) (→Note for dummies: pointers to functions - added navigation to footer) Next diff → |
||
| Line 29: | Line 29: | ||
| we would define a function of an integer returning a pointer to an integer. | we would define a function of an integer returning a pointer to an integer. | ||
| (That [http://www.gnu.org/software/gnu-c-manual/gnu-c-manual.html#Operator-Precedence C operator precedence table] comes in handy here.) | (That [http://www.gnu.org/software/gnu-c-manual/gnu-c-manual.html#Operator-Precedence C operator precedence table] comes in handy here.) | ||
| + | |||
| + | ---- | ||
| + | ⇐ '''previous''': [[Programming the Advection Scheme]], ⇑ '''up''': [[Gerris Flow Solver Programming Course for Dummies]], ⇒ '''next''': [[An Example of Use of the Gerris Object System]] | ||
Revision as of 16:46, 21 August 2012
Gerris and GTS are programmed in a style analogous to that of GLib, Gnome and GTK+. It is a style of C programming that offers several advantages:
- Most aspects of Object-Oriented Programming (OOP), such as the existence of classes with their own methods and inheritance.
- The ability to interface to other programming languages. (As far as I know, this feature is not used in Gerris, but this has been exploited to give GTS Python bindings in PyGTS.)
To implement Object-Oriented Programming, Gerris/GTS uses its own ‘Object system’. This system is analogous to the GLib object system (GObject), but not identical to it.
THIS CHAPTER IS CURRENTLY BEING WRITTEN.
Note for dummies: pointers to functions
At this stage you (or your teacher if this is a live class) should remind the basic facts about pointers to functions. Remember in particular that
int foo(int bar);
declares a function of an integer returning an integer and
int (*ptr_foo) (int bar);
declares a pointer to an integer function. If we were to write
int *ptr_foo (int bar);
In that case, because '()' has precedence over indirection '*', we would define a function of an integer returning a pointer to an integer. (That C operator precedence table comes in handy here.)
⇐ previous: Programming the Advection Scheme, ⇑ up: Gerris Flow Solver Programming Course for Dummies, ⇒ next: An Example of Use of the Gerris Object System

