Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Table of Contents | ||||||
---|---|---|---|---|---|---|
|
Introduction
The aim of this document is to give OpenRadioss development guidelines. These guidelines cover the style and the efficiency of the code. OpenRadioss is mostly written in Fortran (Fortran77 and Fortran90 and above) https://fortran-lang.org/. A few functions are written in C and C++. The following rules apply for new code
OpenRadioss Coding Standards
Expand | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Fortran LanguageFortran90 is the programming language used for OpenRadioss development. Fortran95, Fortran2003, Fortran2008 and future extensions may be used only if necessary, and explicitly approved by OpenRadioss maintainers. In such case, these programming guidelines will have to be amended accordingly. It is allowed to use Intrinsic functions coming from Fortran95 up to Fortran2008 For Fortran code, the files should be named “<subroutine_name>.F”, “<module_name>_mod.F>” and “<include_file_name>.inc”. Only fixed format is allowed, extended to 132 columns C/C++ LanguageC routines deal with low level I/O, system calls. C++11 may be used PreprocessorC Preprocessor directives can be used to include files, define constants and macros IMPLICIT NONEEvery OpenRadioss Fortran routine needs to include implicit_f.inc that contains Fortran90 RestrictionsFortran90 features that penalize performance should be avoided:
Obsolete Fortran77 CodingThe following statements are not allowed in new code:
It is also forbidden to use label for Data TypesIntegerAll integers are by default 32-bit integers ( RealThe Logical
In particular, it is forbidden to use “ Derived Data TypeThe name of a new type should use suffix Example:
Intrinsic FunctionsProgrammers are only allowed to use generic functions compatible with both single and double precision: Explicitly typed functions are prohibited: Numerical ConstantsAll real constant variables are declared inside constant.inc common and initialized using Examples:
Zero and Infinite ValuesTo avoid division by zero, it is advised to test against EM20 To avoid infinite value, it is advised to test against EP20 These values are generally a good compromise for both double and single precision Interfacing Fortran and CCalling ConventionHere is described the way it is handled in OpenRadioss by defining every potential calling convention Fortran90 Calling Routine and C Callee Routine
Argument Variable Correspondence
A variable of type
|
\uD83D\uDCCB Related articles
OpenRadioss HMPP Development InsightsOpenRadioss Coding Recommendations
OpenRadioss Performance Aspects: Vectorization and Optimization