next up previous contents
Next: 5.1 A template for Up: The Gerris Tutorial Previous: 4.3 Adding diffusion terms   Contents

5 Writing new objects

If you want to implement your own boundary conditions, initial conditions, outputs, criterium for adaptive mesh refinement etc... you will need to learn how to write new objects within the gerris framework. As gerris is written in C, a basic knowledge of C programming will help a lot.

Gerris uses the object-oriented framework provided by GTS. This is essentially a set of structures and functions implementing the fundamental concepts of object-oriented programming (essentially data and methods inheritance and overloading) using C. Of course, as C is not an object-oriented language, it does not provide direct (syntaxical) support for this and consequently, as we will see, the expression of these concepts is rather more verbose than in, say, C++, python, smalltalk or Java.

So, why use C and not an object-oriented language? An exhaustive discussion would be too long for this tutorial. In short, the strongest case for this approach is that C is the smallest common denominator between most of the languages out there: it is possible to use the gerris library with any one of C++, Fortran 90, Java, Perl, python, ruby etc...but it would not be the case if gerris was written in any of these other languages.



Subsections
next up previous contents
Next: 5.1 A template for Up: The Gerris Tutorial Previous: 4.3 Adding diffusion terms   Contents