- Notifications
You must be signed in to change notification settings - Fork0
A Fortran 2018 library for conditional (de-)allocation of allocatable objects of intrinsic types.
License
kevinmatthes/fortran2018-conditional-memory
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A Fortran 2018 library for conditional (de-)allocation of allocatable objects ofintrinsic types.
This project's license isGPL-3.0. The whole license text can be found inLICENSE in the main directory of this repository. The brief version is asfollows:
Copyright (C) 2022 Kevin Matthes
This program is free software: you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation, either version 3 of the License, or(at your option) any later version.
This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.
You should have received a copy of the GNU General Public Licensealong with this program. If not, seehttps://www.gnu.org/licenses/.
| Requirement | Type | Role |
|---|---|---|
| Doxygen | application | source code documentation |
| GFortran | application | Fortran 2018 compiler |
| Git | application | build artifact removal |
| Just | Rust binary | execution of the build instructions |
| Latexmk | application | LaTeX compilation of Doxygen manual |
| TeX Live (full) | package | LaTeX environment for Doxygen manual |
| Valgrind | application | memory leak detection |
This library is written in Fortran 2018 such that its build requires a compilersupporting this standard. This project relies onGFortran therefore.
The library build is organised withJust. The corresponding.justfiledoes not only take care for the compilation of the library but also for itsdocumentation and testing.
The documentation is generated byDoxygen. The configured output formatsare listed in the following.
- HTML
- LaTeX
- UNIX manual pages
In order to finalise the LaTeX documentation, an appropriate LaTeX distributionis required. Afull installation ofTeX Live is recommended. Thisproject employsLatexmk as LaTeX build manager for the manual finalisation.
There are unit tests for the library logic written in plain Fortran 2018 withoutrequiring any further libraries. When running the tests,Valgrind willanalyse their memory management.
Build artifacts are prevented from begin committed by the.gitignore thisrepository contains. It furthermore controls which files are going to beremoved bygit clean. Thus, it is the simplest solution to employGit forthe removal of build artifacts.
This repository provides the source code for a library namedlibf18cndmem.a.The purpose of this library is the conditional allocation and deallocation ofallocatable objects of Fortran intrinsic types. It is written in Free FormFortran 2018.
As the deallocation of an allocatable object which is not already allocated willresult in a runtime error, it needs to be checked whether the object todeallocate is allocated at all. The deallocation subroutines this libraryprovides will take care about both this check and the deallocation, if required.All those subroutines are exposed with the generic interfacecnddel which isan abbreviation of "ConditionalDeallocation". At themoment, the following types are supported:
character(default)
Fortran 2018 has automatic reallocation features which allow for a convenientand comprehensive coding style. Under certain circumstances, it might not beobvious if an allocatable object is already allocated such that the automaticreallocation on intrinsic assignment could be processed. Then, it need to betested whether there is already a memory region allocated for the respectiveobject. If not so, an according amount of memory needs to be allocated beforethe assignment can be performed. This library provides a counterpart to theconditional deallocation, namedcndall, to check whether some memory wasalready allocated and to assign the intended object to the target object. Thenamecndall is an abbreviation of "ConditionalAllocation".At the moment, the following types are supported:
character(default)
The build routine is organised by Just and defined in the.justfile in therepository root. To build the library, one of the following instructions canbe executed.
just bjust buildjust ljust library
In addition, an automatic source code documentation with Doxygen is configured.One of the following commands will invoke the compilation.
just djust doxygen
The correctness of this library is ensured by a set of unit tests. They arefurthermore analysed for their memory management by Valgrind. By calling forthe Valgrind analysis, the unit tests are executed implicitly. This can bedone with one of the following commands.
just vjust valgrind
If the compilation of both the library and its documentation is wished, thefollowing instructions can be executed. This will also run all unit tests.
justjust ajust all
About
A Fortran 2018 library for conditional (de-)allocation of allocatable objects of intrinsic types.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.