CppNoddy  0.92



What is it?

A simple (aka Noddy) collection of object orientated numerical routines written in C++, aimed at undergraduate projects and starting graduate students. In the current version, the test/example cases solve (amongst others):

Example output: pressure contours of a linear acoustic wave hitting a body of differing acoustic properties.


A breakdown of examples into groups is found under the 'Modules' link above. Alternatively, a complete list of examples can be found at this link Tests

The library provides:

What is it for?

It exists for two reasons:

Getting and running it

You need a machine with a recent C++ compiler and 'git' to clone the latest version. The build system uses 'meson'. The source is hosted on Github and can be obtained using 'git' via

  git clone git://github.com/hewitt/CppNoddy.git

A minimal install can be achieved via

  meson --buildtype=debugoptimized build

  cd build


The self-tests can be executed via

  ninja tests 

Optionally you can link to PETSc (for sparse matrix problems) and SLEPc (for sparse matrix eigenvalue problems) via

  meson configure -Dpetscz=true -Dslepc=true

for complex arithmetic, or

  meson configure -Dpetscd=true -Dslepc=true

for real arithmetic. If PETSc/SLEPc are not installed system-wide, you will need to set PKG_CONFIG_PATH to point to PETSc.pc and SLEPc.pc via

  export PKG_CONFIG_PATH=$PETSC_DIR/$PETSC_ARCH/lib/pkgconfig:$SLEPC/$PETSC_ARCH/lib/pkgconfig

assuming a bash shell. The environment variables $PETSC_DIR/$SLEPC_DIR point to the base locations of the respective source trees, whilst $PETSC_ARCH is the name of the build directory (assumed to be the same in both cases). Suggested configure options for PETSc are

 ./configure --download-superlu_dist --download-mpich --download-metis --download-parmetis --download-cmake --download-scalapack --download-mumps --with-scalar-type=complex

for complex arithmetic or use –with-scalar-type=real for real arithmetic.

See the Tests for a starting point.

Is it fast/accurate?

The matrix classes have native solvers that are naive unoptimised Gaussian elimination algorithms. These routines will only be practical (if at all!) for rather `small' matrix/band sizes and do not scale well. If the problem is of even moderate size, then you should link to your local LAPACK/PETSc routines. LAPACK/PETSc/SLEPc libraries are not shipped with CppNoddy, you have to install them separately yourself if they are not available by default.

The code is not especially optimised, in fact in many places the code is deliberately un-optimised for greater transparency; it is not intended for 'heavy duty' problems. The only sanity checks applied are those listed in the test/example codes Tests.

It made my machine burst into flames

I never said it wouldn't ;-) The code comes with no guarantees.

I think it needs a CppNoddy::foo<bar> class

Feel free to add something. If you're an undergraduate looking for a final-year project or an MSc. student and have an idea of something to include (or wish to redesign something that I did in a stupid way), then let me know.

This software is licenced under the CC-GNU GPL.
© Content created by R.E. Hewitt, 2007.

© 2012

R.E. Hewitt