Technical Overview

This section provides general information about the CEETRON SAM SDKs distribution, how to build and link it, and valuable information on various programming topics.

Application Development Environment

Each library contains a set of object oriented modules which implement the functionality of a particular library. Modules are object-based in that they support the encapsulation of a set of functions and data within an object, so that the data is only accessible though a well defined interface. A module (also termed a “class” in object-oriented technology) also supports the instantiation of multiple objects, each with its own private data. An object may be destroyed at any time, freeing its private data and local memory resources.

The application programming interface (API) consists of a header file and a series of entry points defining the functional interface (also termed “methods” in object-oriented technology) for each module. The private data for each module is defined in a C language structure, struct, which is a defined type, typedef. In order to avoid naming conflicts, all function names and defined types of the modules delivered with CEETRON SAM begin with vut_, vml_, vsy_, vis_, vgl_, vfe_, vfs_, vdm_, vfx_`or `msh_. The four character prefix is followed by the module and function name in initial capital letters. For example the function to draw contours on a curvilinear array of computational cells in VisTools is vis_ContourCurv(). All arguments to module functions are either simple variables, arrays or pointers to structures containing the private data of an object. Each module contains functions to begin and end an instance of the module. For example to create a Contour object use vis_ContourBegin(). This function allocates an instance (an object) of the module and returns a pointer (object handle) to a struct containing the private data of the object. If object creation fails, a NULL pointer is returned. The end function destroys the object and frees its memory resources. For example, use vis_ContourEnd() to destroy a Contour object.

Directory Structure

All CEETRON SAM component source libraries require the base source library as a foundation. The installation procedure for CEETRON SAM creates the following directory structure under the CeetronSAM directory.

  • CeetronSAM - CEETRON SAM main CMakeLists.txt

  • CeetronSAM/lib - Empty directory for CEETRON SAM archives

  • CeetronSAM/src/sam/base - CEETRON SAM base source and header files

  • CeetronSAM/src/sam/base/ext - CEETRON SAM ZLIB source

  • CeetronSAM/src/sam/base/exam - CEETRON SAM base examples

  • CeetronSAM/src/legacy/vgl - VglTools source and header files

  • CeetronSAM/src/legacy/vgl/exam - VglTools examples

  • CeetronSAM/src/legacy/vgl/ext - VglTools PNG, TIFF, JPEG source

  • CeetronSAM/src/legacy/vgl/fonts - VglTools FreeType font files

  • CeetronSAM/src/legacy/vgl/test - VglTools feature and performance tests

  • CeetronSAM/src/sam/vis - VisTools source and header files

  • CeetronSAM/src/sam/vis/exam - VisTools examples

  • CeetronSAM/src/sam/vdm - VdmTools source and header files

  • CeetronSAM/src/sam/vdm/exam - VdmTools examples

  • CeetronSAM/src/sam/vfe - VfeTools source and header files

  • CeetronSAM/src/sam/vfe/exam - VfeTools examples

  • CeetronSAM/src/sam/vfs - VfsTools source and header files

  • CeetronSAM/src/sam/vfs/exam - VfsTools examples

  • CeetronSAM/src/sam/vfx - VfxTools source and header files

  • CeetronSAM/src/sam/vfx/exam - VfxTools examples

In addition to the above directories, each toolkit directory contains subdirectories “fortran”, “cplusplus”, and “csharp” that contain the bindings for FORTRAN, C++, and C#, respectively.

Each CEETRON SAM module exists as a source file (.c or .cxx) and associated header file (.h) in the source directory. For example the Contour module source and header files are contour.c and contour.h respectively and reside in the VisTools src/sam/vis directory. There are additional source and header files which contain internal utility procedures and CEETRON SAM-wide macro definitions.

The base directory contains all the foundation module source and header files for all CEETRON SAM components. Examples of foundation modules are Error, List and Stack.

The lib directory contains a set of subdirectories which are empty at initial installation. They may be used to place object or archive files resulting from compiling CEETRON SAM components on a specific platform.

The Built-in CMake System - CMake

The built-in CEETRON SAM CMake system is the easiest way to compile and link with CEETRON SAM. To compile CEETRON SAM and its example programs, follow these steps:

Create a new directory named build using the command:

mkdir build

Change your current directory to the build directory you just created with the command:

cd build

Generate build files for your project. If you are on Windows, use the following command:

cmake --preset=Windows ..

Visual Studio 16 2019 is the default CMake Generator. This generator can be changed to a more recent Visual Studio version or another generator. Visual Studio 17 2022 generator can be enabled with the following command:

cmake --preset=Windows -G "Visual Studio 17 2022" ..

If you are on Linux, use this instead:

cmake --preset=Linux ..

Build your project using the generated build files with the command:

cmake --build .

If you are on Linux, you’ll need to add the path of the dependencies in the thirdparty directory to the LD_LIBRARY_PATH environment variable. This allows the dynamic linker to find them at runtime. Here’s an example of how to do this:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/techsoft3d/CeetronSAM/thirdparty/abaqus-odb_api-2023-linux64/lib

Replace /home/techsoft3d/CeetronSAM/thirdparty/abaqus-odb_api-2023-linux64/lib with the actual path to your thirdparty directory.

The ThirdParty packages included in the distribution - CMakePreset

There are a variety of C preprocessor definitions which are used to conditionally compile source code. The following definitions are set when using the predefined CMake Preset.


: “CeetronSAM”

Project Name


: “Release”

Build type


: “OFF”

Verbose logging flag


: “Static”

Build configuration. Static, Shared for Windows available. Only Static for Linux


: “ON”

Add base sam src directory


: “ON”

Add vdm sam src directory (CEETRON Access)


: “ON”

Add vis sam src directory (CEETRON GlobalModules, MESH)


: “ON”

Add vfe sam src directory (CEETRON Solve)


: “ON”

Add vfs sam src directory (CEETRON Solve)


: “ON”

Add vfx sam src directory (CEETRON Solve)


: “ON”

Add vgl legacy src directory (VKI legacy visualization)


: “ON”

Add vis legacy src directory (CEETRON legacy visualization)


: “ON”

Link against the Data Provider Framework


: “ON”

Add Examples in the current project


: “OFF”

Generate Fortran interface


: “OFF”

Generate C# interface


: “ON”

Link against Abaqus ODB API external library


: “OFF”

Link against Altair H3D API external library


: “ON”

Link against ANSYS DPF API external library


: “ON”

Toggle support for OpenFOAM files. Requires linking with zlib.


: “ON”

Toggle support for PERMAS files. Requires linking with zlib.


: “ON”

Link against CGNS API external library


: “OFF”

Link against PAM API external library


: “OFF”

Link against SAMCEF API external library


: “OFF”

Link against Boost (required for Autodyn library)


: “OFF”

Link against CAPRI


: “ON”

Include additional error checking


: “OFF”

Check floating-point exceptions


: “OFF”

Include memory checks


: “OFF”

Link against FFMPEG (required for vglTools)


: “OFF”

Link against FREETYPE (required for vglTools)


: “OFF”

Link against GLEW (required for VGL)


: “ON”

Link against HDF5 external library (required for CGNS reader)


: “OFF”

Link against HOOPS Exchange (option for CEETRON MESH)


: “ON”

Link against MKL (required for the eigensolver)


: “ON”

Link against MKL (required for the eigensolver)


: “OFF”


: “OFF”


: “OFF”


: “OFF”


: “ON”

Link against OPENMP


: “Intel”

OpenMP version: Intel or Default


: “OFF”


: “OFF”


: “OFF”


: “OFF”


: “thirdparty”

Name of folder where the third-party libraries are located


: “OFF”

Build with Unicode support


: “Internal”

Link against zlib (required for OpenFOAM, Permas reader, and HDF5 link)

The ThirdParty packages included in the distribution - ThirdPartyDist

The built-in CEETRON SAM CMake system is the easiest way to compile and link with CEETRON SAM. The delivered CMakeLists.txt is being instructed to use the thirdparty packages included in this distribution. To this date: Abaqus, Ansys-DPF, CGNS, HDF5 (including zlib) IntelMKL, IntelOpenMP, GKlib and METIS are delivered. Those libraries are being tested linked to CEETRON SAM to guarantee the best functionality.

The version of each of the included libraries is mentioned in the third-party directory.

We acknowledge those packages for granting a license that allow its distribution either by mutual agreement between Tech Soft 3D and the owners, or because of the license terms. Tech Soft 3D is not the author of those packages, the software is distributed as-is. Any distribution of those packages must be in agremeent to the license included for all of them.

[Deprecated] Compiling and Linking CEETRON Solve/Access/Mesh

This method is deprecated and will be removed. Please refer to the Built-in CMake System section.

CEETRON SAM libraries are delivered in obfuscated source code form. This means that the source code has been processed so that it is not readily understandable by human beings but compiles properly on any supported computer platform. As a result, a single CEETRON SAM source code deliverable is generally immune to operating system and compilation system changes. The general concepts of compiling and linking CEETRON SAM source is outlined below. The user may use this information to integrate the compilation of CEETRON SAM source into their custom development environment. As an option, a built-in compilation and linking system is provided which is described in the next section.

Each CEETRON SAM library has a different set of compilation options (C preprocessor directives) which are required for proper compilation on a particular platform, operating system, window system, etc. These options are documented in the “Compiling and Linking” section of each library. The base library must be compiled for all CEETRON SAM installations, along with each of the CEETRON SAM libraries delivered.

The recommended compilation method is the built-in CMake system.

There are a variety of C preprocessor definitions which are used to conditionally compile source code. The following definitions are common to all CEETRON SAM libraries. The primary category is machine architecture which is related to the overall computing platform. The machine architecture implies an operating system such as LINUX, Microsoft Windows and platform dependent varitions of UNIX. Possible architectures are the following,


Hewlett Packard HPUX systems


IBM AIX systems


LINUX operating system


Apple MAC OS X


Silicon Graphics IRIX systems


SUN Solaris systems


MicroSoft Windows

Publicly available external library support for compression. There are two options. The user may conditionally compile source to reference a user supplied installation of the external library or conditionally compile source to reference a modified version of the publicly available source which is delivered in the base/ext directory.


ZLIB user installed external library


ZLIB base/ext/zlib source

Enable Intel’s MKL BLAS functionality. These definitions must be used when compiling all objects in the base, vfs and vfx directories.


Enable MKL sequential BLAS functionality


Enable MKL threaded BLAS functionality

Enable multi-threading functionality which uses OpenMP. These definitions must be used when compiling all objects in the base, vfs and vfx directories.


Enable OpenMP Threading functionality

Enable sockets functionality. This definition must be used when compiling all objects in the base directory.


Enable sockets functionality

In general, most user input arguments to functions are checked for validity. In some cases where the error checking may degrade performance, a compile time option is available to conditionally compile the additional error checking code. This option also adds some memory integrity checking. The compile time definition related to error and memory checking is the following.


Include additional error checking

Additional error checking may be included by activating the CMake option CEE_SAM_OPTION_CHECK_ERRS.

Include Files and Data Types

The first step in writing a CEETRON SAM application is to include the proper header files. All CEETRON SAM applications must include the base.h header file located in the base directory. This file includes typedefs for all basic data types and defined constants. The basic data types are listed below.


character, a single byte


character, single byte or wchar_t


unsigned character


wide character, type wchar_t


short integer, 16 bits


unsigned short integer


integer, 32 bits


unsigned integer


long integer, 64 bits


unsigned long integer


single precision floating point, the same size as Vint


double precision floating point, 64 bits




maximum sizeof Vint, Vfloat and Vobject


quadruple precision floating point, 128 bits

All arguments (other than specific object pointers) passed to any user callable CEETRON SAM function are typed using the above defined types. The Vtchar type is single byte (char) by default or wide character (wchar_t) if the symbol VKI_WIDECHAR is defined.

Pointers to specific object types are typedef ‘ed using a four letter prefix, such as vis_ in the VisTools library, and the name of the module from which the object was instanced. For example, Contour objects are typed as vis_Contour. These module type definitions appear in the header file for each module. The base.h, vis.h, vismesh.h, vgl.h, vfe.h, vfs.h, vfx.h and vdm.h files include all the required module header files. It is recommended that one use the #include pre-processor directive as follows:

#include "base/base.h"
#include "vgl/vgl.h"
#include "vis/vis.h"
#include "vis/vismesh.h"
#include "vdm/vdm.h"
#include "vfe/vfe.h"
#include "vfs/vfs.h"
#include "vfx/vfx.h"

An include file, userdefs.h, is installed in the CeetronSAM/src/sam/base directory specifically for user defined C preprocessor commands and is meant to be edited and customized by the user. This include file is guaranteed to be included by any CEETRON SAM include file. One particular use of userdefs.h is customization with respect to compiling features in VfxTools which are dependent upon underlying toolkits. The following #define ‘s should be added indicating toolkits which are not licensed.



CEETRON SAM releases are named using the Semantic Versioning scheme. The include file base.h contains two macros which can be used for retrieving the version information:

  • SYS_VERSION defines a hexadecimal value built up from major, minor and patch version numbers. This value is guaranteed to be monotonically increasing for each new release.

  • SYS_VERSIONSTR defines a string built up from major, minor and patch version numbers. It may also contain pre-release and other information if available.

C++ Language Bindings

CEETRON SAM supports a C++ language binding. The C++ language binding is a derivative of the C language binding. The object oriented technology of the C language binding maps naturally into C++ classes. The following rules determine the form of the C++ language binding from the C language binding.

  • All CEETRON SAM C language modules map into C++ classes. The “Begin” and “End” functions in a module become the constructor and destructor methods for the corresponding C++ classes. These functions correspond to the new and delete operators in C++. All other module functions map into a corresponding member function of the class. C++ class names are the same as the C language module names.

  • The class methods are derived from the module functions by removing the letters vis_ and the module name. For example, vis_ContourSetObject() now becomes contour->SetObject assuming that the Contour object had been created as follows:

    vis_Contour *contour;
    contour = new vis_Contour;
  • The argument lists are identical except for the elimination of the first argument (the object argument). For example:
    (C) vis_ContourSetTopology(contour,VIS_SHAPEQUAD,0,0)
    (C++) contour->SetTopology(VIS_SHAPEQUAD,0,0).

  • The C++ class definitions and functions are contained in the cplusplus subdirectory in the source directory for each library. For example, the C++ wrapper files for the VisTools library reside in src/sam/vis/cplusplus. The C++ wrapper files need to be compiled only if C++ bindings are required. The header files to be used with the C++ classes are the standard C language header files.

FORTRAN Language Bindings

CEETRON SAM supports a FORTRAN language binding. The FORTRAN language binding is a derivative of the C language binding and maintains the same object oriented technology as the C language binding. Functionality is in all cases identical for all language bindings. The following rules determine the form of the FORTRAN language binding from the C language binding.

  • There is a one to one correspondence between C and FORTRAN entry points. The FORTRAN entry point may be derived from any C entry point by adding a lower case letter f to the 3 letter prefix. For example the entry point to set an attribute object in a Contour object vis_ContourSetObject() becomes visf_ContourSetObject. Note that FORTRAN is case insensitive. The FORTRAN language binding does not conform to the FORTRAN 77 standard in the sense that entry point names exceed 6 characters.

  • All functions in the C binding become subroutine calls in the FORTRAN binding. The argument lists are identical except for those functions in the C binding which have function return values. There are two cases. 1) The object creation functions (eg. vis_ContourBegin()) return an object. The corresponding FORTRAN subroutine returns the object in an argument list (eg. visf_ContourBegin(contour)). Use a double precision variable in FORTRAN to hold the object (eg. real*8 contour). 2) The object error flag return functions (eg. vis_ContourError()) return an integer error flag. The corresponding FORTRAN subroutine returns the error flag at the end of the argument list (eg. visf_ContourError(contour,errorflag)).

  • All defined constants in C become identically named integer parameters in FORTRAN. The FORTRAN entry points are contained in the fortran subdirectory in the source directory for each library. For example, the FORTRAN wrapper files for the VisTools library reside in src/sam/vis/fortran. The FORTRAN wrapper files need to be compiled only if FORTRAN bindings are required. All standard C language header (.h) files have a corresponding include (.inc) file for FORTRAN.

  • Use the following data type translations.























C# Language Bindings

CEETRON SAM supports a C# language binding. The C# language binding is a derivative of the C language binding and maintains the same object oriented technology as the C language binding. Functionality is in all cases identical for all language bindings. The following rules determine the form of the C# language binding from the C language binding.

  • There is a one to one correspondence between C and C# entry points. The C# entry point may be derived from any C entry point by replacing the first _ (underbar) in a function name by a . (dot). For example the entry point to set an attribute object in a Contour object vis_ContourSetObject() becomes vis.ContourSetObject.

  • All strings passed to functions which are defined in C as NULL-terminated arrays of type char become StringBuilder classes. The initial memory allocation of these StringBuilder variables must be large enough to contain the returned value. The vsy.SYS_MAXPATHCHAR macro can be used to initialize them when retrieving paths, while the vsy.SYS_MAXNAME macro can be used in all other cases.

  • All strings which are returned by address in C become type IntPtr. The C# String may be retrieved from the IntPtr using

    String mystring = Marshal.PtrToStringAnsi (myintptr);
  • Multi-dimensional arrays in C become single-dimensional arrays in C#. For example, the C declaration int a[10][3]; becomes int [] a = new int[30]; in C#.

  • All objects become type IntPtr. This means that all Begin methods return IntPtr variables.

  • All function arguments that only return a single variable are passed in C# by reference. Note that all references must be first initialized. For example,

    int id = 0;
    vis.IdTranGetId (idtran,10,ref id);
  • Function arguments that may return one or more values must be declared as arrays, even if only one parameter is being returned.

  • All constant parameters for all modules in each toolkit are contained in their respective classes. For example, TRANSMAP_UP, defined in the TransMap module, is referred to as vis.TRANSMAP_UP in a C# program. Likewise, all parameters defined in the base directory can be accessed using the vsy class name. For example, one would use vsy.SYS_ON, vsy.SYS_RES_D, etc.

  • The C# class definitions and functions are contained in the csharp subdirectory in the source directory for each library. C# wrappers consist of a single class for each directory: vsy, for the base directory; vis, for the vis directory; vgl, for the vgl directory; vdm, for the vdm directory; vfe, for the vfe directory; vfs, for the vfs directory; and vfx, for the vfx directory.

The built-in CEETRON SAM CMake system may be used to build the C# library and examples. The C# library can be built by setting the CMake boolean variable CEE_SAM_INTERFACE_CSHARP to ON.

Parallelization and Thread Safety

All CEETRON SAM toolkits may be used in a straight-forward way to take advantage of multiprocessing computing platforms using an industry standard multithreading API such as OpenMP, Pthreads or Windows threads. Most modules are thread safe in that there are no writable global variables (the only modules which must be executed serially are the graphics device interface modules in the VglTools library). This allows multiple instances of CEETRON SAM objects to be executed simultaneously in a multithreaded, multiprocessor environment.

Single instances of objects containing global data such as finite element model and results information may be reliably shared and accessed by multiple threads through a set of read only functions. These functions will have const declarations of the object in their prototypes. There are additional functions which can be used by multiple threads with a single object which are not declared const. These functions are documented with (thread safe) in the function summary. These functions can not formally be declared as const since the object internal error flag may be set if a user input error is detected.

Certain CEETRON SAM functions are internally parallelized. There are two types of internally parallelized functions.

  • Implicit parallelization using OpenMP. These functions use OpenMP internally and the number of threads to be used is set by the environment variable OMP_NUM_THREADS or alternatively the environment variable VKI_NUM_THREADS. The variable VKI_NUM_THREADS, if defined, takes precedent over the variable OMP_NUM_THREADS. These functions are documented with %(parallel) in the function summary and also listed in a Parallel Functions section for each object. This feature requires compilation with VKI_LIBAPI_OPENMP. If these environment variables are not defined or define a number of threads less than or equal to 1, then serial execution is indicated. The defined number of threads is capped by an internally defined CEETRON SAM maximum.

  • Explicit parallelization set using an object function call such as vfs_DofTabSetNumThreads. All functions which are internally parallelized in this way will be individually documented as such. The default number of threads is 1. A number of threads specified less than 1 will result in an error being generated. A number of threads equal to 1 will result in serial execution. The specified number of threads is capped by an internally defined CEETRON SAM maximum.

Using CEETRON SAM toolkits to implement parallelization may be performed with minimal impact on the host application. All required software architecture is local in scope. The object oriented technology of CEETRON SAM is critical from a practical standpoint to a successful implementation of parallelization in an application with a multithreading API.

Floating Point Precision

A number of CEETRON SAM modules support various levels of floating point precision. The precision levels are the following:

  • SYS_DOUBLE, 64 bit floating point type Vdouble

  • SYS_FLOAT, 32 bit floating point type Vfloat

  • SYS_HALF, 16 bit floating point type Vshort

The reduced precision type, SYS_HALF, is implemented using the 16 bit IEEE floating point standard. This standard represents approximately 3.3 decimal digits of precision. The minimum and maximum representable values are 6.10e-5 and 65504.

The modules which support varying precision levels have facilities for setting and accessing data in float and double precision. These access routines will ensure that the data which is set and returned is properly converted to the internal precision representation.

Programming language standards and compiler requirements

The CEETRON SAM library is built and tested with the following programming language standards:

  • C17, for the C programming language

  • C++17, for the C++ programming language

The enforcement of those standards leads to following minimum requirements on the compiler used to process CEETRON SAM code:

  • GCC 8.1.0

  • LLVM Clang 7.0.0

  • Microsoft Visual C++ VS 2019 (16.8)

Failure to comply with those minimum requirements may lead to a compilation issue.

Major version scripts- Migration

Migration scripts are provided to ease code modifications following a major CEETRON SAM version update. The provided scripts are Python scripts and can be found in the migration_scripts directory of the distribution archive. Each migration script is linked to only 1 increment of the major version numbering. These scripts are designed to update all text files in the current directory and its subdirectories. While these scripts tackle most of the changes, some remaining issues (such as deprecated functions or defines) will need to be manually fixed.

Currently, the following scripts are provided:

  • 2.0 update, can be found in the 2.0 directory of the migration_scripts directory. This script updates includes following the reorganization of the vdm modules, updates includes due to the migration from src to src/sam and src/legacy, updates includes and module names of the renamed meshing modules, and update the prorender module includes and name.