Home
ObjexxFCL 4.2
 

ObjexxFCL: Objexx Fortran-C++ Library

The Objexx Fortran-C++ Library (ObjexxFCL) is a C++ library providing Fortran-compatible array, string, i/o, and intrinsic function support for Fortran-to-C++ migrations. The ObjexxFCL is included with Objexx Fortran to C++ conversion projects and is used to support a range of Fortran--C++ integration goals. The ObjexxFCL components have capabilities beyond those of their Fortran equivalents that are used to support reengineering and modernization of technical C++ applications after the initial migration or integration has been completed.

The Users and Developers Guides describe the ObjexxFCL in detail. Doxygen documentation can also be generated from the source for a full navigable API.


ObjexxFCL Application Archictecture

C++ applications using the ObjexxFCL generally use the library much as the Standard C++, providing types and functions used by certain application components and subsystems. The ObjexxFCL acts much as an adapting layer between the native C++ and the portions of the application that use its services, as shown in the sidebar.


ObjexxFCL Components

The core components of the ObjexxFCL provide the array, string, and intrinsic function support for Objexx Fortran-to-C++ conversions and Fortran—C++ integration. The ObjexxFCL also 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.

Some of the main ObjexxFCL components are described below.

Array

Arrays have the attributes of Fortran arrays, including:

  • Each dimension can have an arbitrary index range.
  • 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.
  • Array sections (slices) and assumed shape array arguments.
  • Treating members of arrays of user-defined types as arrays.
  • Note: This ObjexxFCL variant uses row-major array layout, unlike Fortran's column-major layout.

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 de-centralized 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 Array arrays provide these capabilities that Fortran arrays lack (some of which are provided by Fortran 90 and later standards):

  • Copy construction.
  • Constant arrays and array proxies.
  • Initializer values/functions (more powerful than DATA statements).
  • Optional element initialization.
  • Whole-array value and array assignment.
  • Index range and size accessors.
  • Linear index subscripting for fast inner loop operations.
  • Array sections.
  • Dynamic (run-time) (re)sizing.
  • Optional run-time size reporting.
  • Bounds checking in debug builds.

References

The ObjexxFCL Reference type provides the functionality of a Fortran POINTER: a reference that can be reassociated and directly allocated.

Optional Arguments

ObjexxFCL has an Optional type that provides Fortran's OPTIONAL argument support.

Formatted I/O

The ObjexxFCL provides a Fortran-like formatted i/o system that works within C++ stream-based i/o. Both lower level, per-item format descriptors and format string based i/o are supported.

Byte

The byte type is a C++ equivalent of Fortran's INTEGER*1. The ubyte type is the unsigned variant of byte. Beyond emulating Fortran's INTEGER*1 the byte types support C++ bit operations and avoid unwanted conversions to/from the char type.

Intrinsic Functions

The ObjexxFCL provides Fortran intrinsic functions.

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.

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.

             

ObjexxFCL 4.2
» Fortran 90-2008 compatibility
» New formatted i/o system
» Array sections
» Member arrays
» Row or col-major arrays
» More intrinsic functions

 

 

 



  ObjexxFCL Application Architecture