JavaScript is not enabled in your browser
Objexx Engineering

ObjexxFCL: Objexx Fortran-C++ Library

The ObjexxFCL is an open source C++ library that provides Fortran-compatible array, string, formatted i/o, and intrinsic function support for Fortran-to-C++ migrations and some additional components and capabilities to support reengineering and modernization of technical C++ applications.

Fortran Migration

The core components of the ObjexxFCL provide the array, string, and intrinsic function support for Objexx Fortran-to-C++ conversions and Fortran—C++ integration.

Array

ObjexxFCL Arrays have the attributes of Fortran 77-2018 arrays, including:

  • Each dimension can have an arbitrary index range.
  • Column major element ordering: Nested loops ordered to provide efficient contiguous element access are still efficient in the C++.
  • Array passing "tricks": Arrays and array elements can be passed to functions where they are declared with a different rank or dimensions.
  • Assumed size array arguments.
  • Assumed shape array arguments.
  • Array slice (section) support.
  • "Member" array usage for arrays of user-defined types.

Fstring

Fstrings have the attributes of Fortran strings, including:

  • Fixed length.
  • Characters are indexed starting from 1.
  • "Live" substrings.
  • Concatenation support.
  • Trailing space ignored by comparison operations.

Formatted I/O

The ObjexxFCL has an elegant Fortran-compatible formatted i/o system that works within C++ stream-based i/o and provides both very complete Fortran formatting support and excellent integration with native C++ stream i/o.

Byte

The byte type is a C++ equivalent of Fortran's INTEGER*1.

Intrinsic Functions

The ObjexxFCL provides wide coverage of Fortran 77-2018 intrinsic functions.

C++ Evolution

The ObjexxFCL contains components that support the evolution of technical applications after conversion from Fortran to C++ or as part of a modernization process. There are also components and functions that provide useful services for technical computing that C++ and its standard library are missing.

Array

Technical applications often depend on fast, safe arrays and the ObjexxFCL provides some powerful array support, such as the ability to migrate to dynamic array sizing via explicit calls or a decentralized automatic mechanism for the common situation where the sizes for different parts of the array dimensions are determined in locations scattered throughout the code.

The Arrays provide these capabilities that Fortran arrays lack:

  • Full bounds checking in debug builds.
  • Initializer functions (more powerful than DATA statements).
  • Data-preserving redimension operations.
  • Move and swap operations for efficiency.
  • Linear index subscripting for fast inner loop operations.
  • Row-major version of the arrays (and a process for converting code to row-major).
  • Grow-friendly std::vector compatible 1D array API
  • Array support for std::unique_ptr and similar movable elements
  • Optional memory-aligned array data for vectorization.
  • Optional proxy array const-correctness checking.
  • Automatic dynamic allocation and sizing system.
  • Optional run-time size reporting.

ChunkVector: Very Large Vectors

ChunkVector is similar in interface to std::vector but uses multiple contiguous "chunks" of user-specified size to avoid allocation failures for very large vectors in a fragmented memory environment and to greatly reduce the performance cost of resizing operations. In typical use there is no performance degradation for ChunkVector element access compared to std::vector.

CArray & Cstring: Safe C-Style Array and String Wrappers

These are lightweight wrappers around C-style arrays and strings that catch memory errors such as leaks and buffer overflows. This allows the safe use of functions requiring those C-style types.

Small Vectors

Vector2, Vector3, and Vector4 are fast, loop-free 2, 3, and 4 element vector class templates that can give technical applications a big performance boost over arrays. The Vectors provide a set of fast operations such as magnitude, normalization, distance, min/max, and dot and cross products. The Vector types interoperate with std::vector, std::array, and the ObjexxFCL Arrays.

Byte Types

The byte and ubyte types are signed and unsigned single byte numeric types. Beyond emulating Fortran's INTEGER*1 the byte types support C++ bit operations and avoid unwanted conversions to/from the char type.

Numeric, String, and Character Functions

In addition to the Fortran intrinsic support there are numeric, string, and character functions that extend and fill holes in the C++ standard library.

Platforms

The ObjexxFCL is written in ISO Standard C++ and is known to be compatible with the current releases of the major C++ compilers and should be compatible with all standard compliant C++ and later compilers.

Licensing

The ObjexxFCL is included with our Fortran-to-C++ conversion projects and can be licensed separately. The ObjexxFCL is provided in C++ source form with a perpetual, royalty-free license.

Contact Objexx for current ObjexxFCL licensing information.