The Gerris Object System

From Gerris

Jump to: navigation, search

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 recall 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

Personal tools
communication