Libraries

libgenua

libgenua is a library of basic geometric and numeric support functions. It contains classes for the efficient representation of meshes for different applications, support for various file formats and wrappers around a number of external library interfaces. The library components can be grouped into a set of modules, which are shortly described below.

Numerical Algorithms

libgenua provides classes which are meant to serve as building blocks for the implementation of more involved numerical methods. Furthermore, interfaces between these classes and a number of optional external libraries are defined.

At present, this group defines numerical integration rules, vectors and matrices (both stack- and heap-based) for general linear algebra work, and support for sparse matrices.

The SIMD short vectors are meant to aid in vectorization. Please refrain from using these objects for linear algebra or geometry as that usually does not yield any speedup. Instead, replace scalar operations one-to-one with SIMD vectors which support most operations that scalar floating-point variables can perform.

Depending on the configuration selected (or auto-detected on Mac and Linux) through the QMake .pro files, interfaces are optionally compiled into libgenua. Some interfaces are also defined exclusively through header files, so that no additional dependecies arise unless the particular header is included.

Optional interfaces are defined for

Furthermore, the repository contains a version of NLopt that has been slightly modified to compile with the Visual Studio 2013 compiler.

Geometry

This module defines basic geometric primitives for topology operations, such as simple classes which can be used to efficiently compute element and node connectivity tables for various types of meshes. Furthermore, a collection of basic intersection tests on triangles and lines is implemented.

A second class of objects is used to implement efficient bounding-volume hierarchies such as k-DOP trees in various dimensions. Many of the corresponding algorithms and containers have been used for a long time and have therefore seen relatively extensive optimization (and therefore allow, for example, to create low-overhead representations such as implicit binary trees defined by storage order).

To support visualization applications, containers for typical triangle-only meshes (including triangle strips and fans) are available.

Mesh Handling

A large part of libgenua serves to support mesh generation implemented in libsurf and sumo. There is a fairly wide range of functionality which serves to represent meshes of different types in memory and read/write different formats.

File formats compiled into libgenua include

Optional interfaces are defined for the TAU CFD solver via NetCDF, when the NetCDF library is detected at compile time.

libsurf

libsurf contains components which together make up a geometry kernel for surface modeling and unstructured mesh generation.

Geometry

A large part of libsurf implements curve and surface geometry objects which are used in the mesh generation functions. Further functionality concerns the efficient computation of intersection lines, even for multiple surfaces simultaneously, and low-level fundamental functions which facilitate mesh generation.

Note that even though a wide variety of different types of curves and surfaces are equally fully supported, their performance characteristics differ, simply because of the mathematical complexity of their evaluation. Significant effort has been expended to speed up the evaluation of cubic (non-rational) b-spline curves and surfaces.

Interoperability

In order to be able to exchange geometry information with external CAD systems, libsurf implements reading and writing of IGES and STEP AP203 files. More objects support output IGES than STEP i/o.

When exporting geometry from libsurf to CAD, note that most CAD systems do not fully support the standard formats as they are documented. One important limitation which is often present regards the number of control points in spline surfaces and the maximum permit variation of tangent directions. If any of these limits is exceeded, the corresponding surface is either not imported at all or automatically split on import.

Mesh Generation

libsurf contains two Delaunay-based surface mesh generators. The legacy generator used by sumo 2.x uses the classes prefixed by "Dn" while the new, much more flexible system is marked by "Dc". The main differences are that the "Dc" generator has support for explicitly defined topology information and the possibility to work on mapped domains.

Some support for volume mesh generation is present in the form of interfaces to TetGen. Furthermore, class PentaGrow can be used to generate hybrid tetrahedral-pentahedral volume meshes for RANS solvers, but requires TetGen to be available for the tetrahedral domain.

Structural Modeling

Classes prefixed with "Sm" can be used to simplify the creation of global shell-and-beam element finite-element models as they are typical for global full aircraft models for load distribution and dynamic analyses.

The group of classes prefixed with "Nst" is designed to read and write files to interface with the NASTRAN family of structural finite-element solvers originating at NASA.

Example

Here's a 27-line program that reads an IGES file, extracts all spline curves of degree smaller or equal 3 and writes them out as a 3-axis g-code program skeleton for NC machines which support the BSPLINE word.

int main(int argc, char *argv[])
{
    IgesFile ifile;
    ifile.read(argv[1]);
    string outfile("out.mpf");
    if (argc > 2)
        outfile = argv[2];
    ofstream os(outfile);
    os.precision(7);
    IgesDirEntry entry;
    const int ndir = ifile.nDirEntries();
    for (int i=0; i<ndir; ++i) {
        ifile.dirEntry(2*i+1, entry);
        if (entry.etype == 126) {
            PolySplineCurve spl;
            if (spl.fromIges(ifile, entry)) {
                int p = spl.basis().degree();
                if (p < 4)
                    spl.writeGCode(os);
                else
                    cerr << "Entity " << 2*i+1 << " at " << entry.pdata
                         << "P, has degree " << p << " > 3" << endl;
            }
        }
    }
    return EXIT_SUCCESS;
}

Availability

Software which is released under the GNU Public License, can be linked to any of the libraries above (in GPL configuration). In order to link any other software against libgenua or libsurf, a separate license is required. GPL software developers are free to access the libraries and their dependencies through subversion read-only access using the links below.

Component library svn link
config https://svn.larosterna.com/oss/trunk/config
boost https://svn.larosterna.com/oss/thirdparty/boost
predicates https://svn.larosterna.com/oss/thirdparty/predicates
eigen https://svn.larosterna.com/oss/thirdparty/eigen
nlopt https://svn.larosterna.com/oss/thirdparty/nlopt
genua https://svn.larosterna.com/oss/trunk/genua
surf https://svn.larosterna.com/oss/trunk/surf

A plain tarball of the above libraries including the source code for the open-source applications is also available for download.