An abstract class is defined with the keyword abstract. It tells the class it cannot be instantiated. On the other hand, it can be used as shared behavior between related classes. That’s when a subclass is created by referring its parent. How to define an abstract class: Note two procedures are defined: getSpecies implementation is…
read moreElemental statement provides a simple and generic interface for a procedure regarding its rank -dimensions-. Due to Fortran strong typing programming style, It was a bit challenging to provide generic functions. It required to implement all possible forms (type and rank-dimensions-). Elemental focus in the rank issue with a simple interface. Note an elemental procedure…
read moreDue to Fortran being a strong type language It is required to have an implementation of the same algorithm for each type. Once done, it provides a generic subroutine. In order to achieve it in Fortran it is must be implemented in the following way: Finally: Output: ./a.out 5 11.0000000 15 No need to say…
read moreJetBrains-cLion is a non-open source (paying) IDE for C/C++. It has support for CMake, GIT, Refactoring and many other features. Because of the payment, there is a 30 days trial period. It is worth mention because it has a Fortran plugin. It enables the possibility to enjoy all features mentioned above in a very stable…
read moreCodeBlocks is an open source Fortran IDE which runs on Linux and Windows. The application does not directly allow you to import a CMake project. However, it is possible to do it in a few simple steps. Check below the steps: # goto source project dir mkdir build cd build cmake -G”CodeBlocks – Unix Makefiles”…
read moreFypp preprocessor generates Fortran code based on Python language. However, in some cases it is not straightforward. Read below to discover how to create higher level functions. Let’s say our program requires to allocate an array for N supported ranks. dim is an array with the size of each rank. To make it possible We…
read moreOverloading a subroutine means to redefine its internal functionality for a customized behavior. Overall it adapts the class new characteristics to already wide-spread Fortran functionalities (==, =, + ,-, …). Specifically, this post only focus on the operators (+,-,*,/). In the following example, mynumber is generic class to hold any type of an integer number.…
read moreOverloading a subroutine means to redefine its internal functionality for a customized behavior. Overall it adapts the class new characteristics to already wide-spread Fortran functionalities (==, =, + ,-, …). Specifically, this post only focus on assignment (=). In the following example, Mynumber is generic class to hold any type of real number. For that…
read moreValgrind is tool to analyze the memory on an application at runtime. For instance, It helps in the discovery memory issues. If it is not the case then random errors and/or behaviors might start showing up. It can be the case when working with pointers as they allow to do several tricks. Which it could…
read moreDeferred procedures are those functions/subroutines that will be later implemented in a specific derived type. For instance, It can only be declared on abstract derived types. To illustrate it, our problem requires a generic class that enforces the equal (==) property. Fortran classes must implement/overload the generic ‘==’ so it is possible to compare them.…
read more-
« Previous
1
2
3
Next »