Example codes
and tutorials
The (Not-so) Quick Guide
List of tutorials/demo codes
Single-Physics Problems
Poisson
Adaptivity illustrated for Poisson
Advection-Diffusion
Unsteady heat equation
Linear wave equation
The Young-Laplace equation
Navier-Stokes
Free-surface Navier-Stokes
Axisymmetric Navier-Stokes
Solid mechanics
Beam structures
Shell structures
Multi-physics Problems
Fluid-structure interaction
Boussinesq convection
Steady thermoelasticity
Methods-based example codes and tutorials
Mesh generation
Linear solvers and preconditioners
Visualisation of the results
Parallel processing
How to write a new element
How to write a new refineable element
Default nonlinear solvers -- the sequence of action functions
...
Documentation
FE theory and top-down discussion of the data structure
The (Not-so) Quick Guide
Comprehensive bottom-up discussion of the data structure
List of available structured and unstructured meshes
Linear solvers and preconditioners
Visualisation of the results
Parallel processing
Coding conventions and C++ style
Creating documentation
Optimisation - robustness vs. "raw speed"
Linear vs. nonlinear problems
Storing shape functions
Changing the default "full" integration scheme
Disabling the ALE formulation of unsteady equations
C vs. C++ output
Different sparse assembly techniques and the STL memory pool
Publications
Publications
Talks
Journal publications
Theses
Picture show
Download
Copyright
Download/installation instructions
Download page
FAQ & Contact
FAQ
Change log
Bugs and other known problems
Completeness of the library & our "To-Do List"
Contact the developers
Get involved

 


Beta release!

Please note that the library has not been "officially" released. While we continue to work on the documentation, these web pages are likely to contain broken links and documents in draft form. Please send an email to

oomph-lib AT maths DOT man DOT ac DOT uk

if you wish to be informed of the library's "official" release.

Coding conventions and C++-style

This document provides an overview of the general coding conventions that are used throughout oomph-lib. Knowledge of these conventions will greatly facilitate the use of the library. Contributors to the library are expected to adhere to these standards.



Naming conventions

File names

All C++ source files end with the standard extensions *.h and *.cc.

General variables

Classes

Private data and access functions to private data

Use a capital first letter for private data, and the all-lowercase equivalent for the access functions. Examples:

Note: Do not use public data -- ever! Make it private and and provide an access function -- even if it seems "perfectly obvious" at the time of writing the class that the internal storage for the data item is "never going to be changed".

Pointers

Access functions to containers

Many classes have member functions that provide access to data in private containers (e.g. vectors); they are usally accompanied by a member function that returns the number of entries in that container. Naming conventions:

Template parameters

Use descriptive function/variable names



Layout etc.

Position of include statements

Layout of blocks

Indentation

Layout of functions, classes, etc.

The oomph-lib namespace

Namespace pollution

Layout of class definitions and include guards.

Here is an example of a complete header file, including include guards and library includes.
     #ifndef OOMPH_SOME_CLASS_HEADER     // Assuming that the file is 
     #define OOMPH_SOME_CLASS_HEADER     // called some_class.h

     // Include generic oomph-lib library
     #include "generic.h"

     // Add to oomph-lib namespace
     namespace oomph
     {

     // =============================================================
     /// Waffle about what the class does etc.
     /// 
     // =============================================================
     template<class T>
     class SomeClass : public SomeBaseClass
      {
        public: 

         /// Constructor: Pass coefficients n1 and n2
         SomeClass(const unsigned& n1, const T& n2) : N1(n1), N2(n2)
          {}
 
         /// Access function to coefficient 
         inline unsigned n1() const
          {
           return N1;
          }
 
         /// Access function to other coefficient
         inline T& n2() const
          {
           return N2;
          }
        

        protected:

           /// Coefficient 
           unsigned N1;

        private:

           /// Second coefficient
           T  N2;

       };

      } 
      #endif



Debugging etc.

The PARANOID flag and error handling

Range checking

Self test routines



Other conventions

Const-ness

Only use int if a variable can actually take negative values

Only use "pass by reference"

Provide fully-functional or deliberately-broken copy constructors and assignment operators

Order of arguments

Access to elements in containers

Macros

Inlining



PDF file

A pdf version of this document is available.
Generated on Mon Aug 10 11:16:30 2009 by  doxygen 1.4.7