NGL - Numerical and Graphical Libraries - [Home]

C++ Libraries Development

Summary

The objectives of the NGL project is the development of many Open Source, C++ packages to deal with many scientific problems. In summary, the main goal is the creation of

·         Generic C++ numerical libraries for advanced scientific computation

·         OpenSceneGraph (OSG) wrappers for advanced graphic visualization

·         Dedicated packages for

o   Robotics

o   Automatic Differentiation

o   Tensors

 

Required Knowledge

The development of such libraries requires some knowledge about C++. It is assumed that each developer owns a basic knowledge of C++ in order to effectively contribute to NGL. In particular the following concepts should be clear in each developer’s mind:

·         C++ basics (mandatory)

·         C++ advanced features on (less mandatory but still very important)

o   Inheritance

o   Polymorphism

o   Standard Template Library (STL)

·         Software Design Techniques (not mandatory…but very helpful in many cases)

o   Object-Oriented Programming

o   Design Patterns

o   Generic Programming

o   Test-Driven Development (TDD)

o   Extreme Programming (absolutely not mandatory, at this time…)

o  

 

Detailed Summary

In this section the main goal of the NGL project are detailed.

Generic C++Numerical Libraries

This is perhaps the first and absolutely the main goal of the NGL project. The objective is to create a large (…and larger…) set of C++ routines that facilitates the scientific computation from many points of view:

·         Quality of the developed software

o   Avoid “anti-patterns”

o   Avoid memory leakages

o   Avoid all the bad things the reader can imagine…

·         Clearness of the developed software

o   User-friendly function calls

o   User-friendly basic operations between the basic data types (e. g. sum, product…)

o   Self-explaining function and variable names

·         Software performance

o   Speed

o   Accuracy

·         Cover the largest  possible number of fields where scientific computation is needed

All the developments in NGL must accomplish the previous points. In particular, the quality of the developed software is a mandatory requirement even for trial versions, while the other points are less crucial, at least in the beginning phases of the development.

The term generic means “to be provided potentially to all the meaningful data types”. While the term numerical means that all the computations are performed with numeric quantities: NGL are not symbolic computation C++ libraries.

The basic packages of NGL should be

·         N-dimensional arrays manipulation

·         Generic and general functions manipulation (here general means: “that can deal with a generic number of inputs”)

·         BLAS (Basic Linear Algebra Support)

·         Geometric objects

o   3D quantities (also with homogeneous forms, if possible)

§  Points

§  Vectors

§  Surfaces

§  Solids

o   Computational geometry routines

§  Curve and surface interpolation

§  Curve fitting

§ 

·         Exception management

·         Message management (for debug purposes, log file building,…)

·         Utilities

o   File I/O management

o   String parser (for rapid array creation…)

·         XML support (optional)

·         Multi-language support (optional)

OpenSceneGraph Wrappers

OpenSceneGraph (OSG) are very powerful open-source graphics libraries written in C++. These libraries allow to easily produce an amazing graphic application and provide many built-in utilities for 3D visualization.

However, from an “end-user point of view”, too many “unnecessary” lines of code are required to view a simple 3D object into a window on the screen. For this reason a set of wrappers to OSG are sought to obtain easy-to-use commands to build 3D graphic windows on the screen.

Example:

                If I want to view a surface (mySurf) in 3D space I’d want to write only:

                               Plot(mySurf);

                Clearly mySurf must be a properly defined object.

Dedicated Packages

A challenging task is to extend the basic NGL libraries with the following packages:

·         Robotics

o   Calculus with Twists and Wrenches

o   Open and Closed chains kinematics

o   Serial and Parallel manipulators dynamics

o   Mobile robotics

o   Robots control

o   Powerful graphic visualization

·         Automatic Differentiation

o   Perhaps this is the most challenging task: build a well-designed data structure to allow the numerical calculation of the k-th order derivative of a given function, with respect to one or more given variables, without neither any symbolic computation nor a finite differences approach.

o   Basic data types such as Arrays and Functions must be extended to deal with automatic differentiation.

o   The goal is to obtain an easy-to-use and user-friendly interface to effectively calculate the derivative of all the functions with respect to any given variable.

·         Tensors

o   Covariant and Contravariant components

o   Parallel transport

o   Levi-Civita connection

o   Covariant derivative

o   …and so on…

 

How Can I Contribute to NGL?

Everyone can contribute to NGL project. The only constraint is that everything is performed accordingly to the remaining part of NGL. For this reason each package, sub-package, sub-sub-package, sub-sub-sub...etc…must be checked to be compatible with the last “official” release of NGL.

Major changes in NGL releases are also allowed as long as these are sufficiently tested to be really a better choice (and/or implementation) and bug-free. A better choice is something that is more general and/or faster than the previous version of NGL. Each potential change must be obviously tested on all the test-cases of all the previous versions of NGL.

After one has developed its own package, he/she must send its package to the NGL project leaders that, after a testing step, will value it for insertion in the next release and suggest for modifications/extension of the developed package.

 

Rules for the Developer

A developer who is interested in increasing the power of NGL should hold in mind the following rules:

1.       Do things once only

2.       Do things well

3.       Do things better, and further better….…

4.       Make things work (test your code with many and many cases)

5.       Do things easy-to-use (a monkey should be able to use your C++ libraries)

6.       Do things fool-proof (also if there will be always exist a very-fool that is more fool than what you could ever think)

7.       Remember that the Murphy Law is always close to you…

G       Remember that Google is your friend.

 

    Download section

      - NGL C++ Libraries for Scientific Computation and Visualization (Updated 12.12.2008)

     - NGL Solution for Visual Studio 2008 (Updated 12.12.2008)

[Home]

Andrea Bracci (andrea.bracci (at) ing.unipi.it) / Updated 12 December 2008.