项目作者: darmar-lt

项目描述 :
Container library for Fortran programming language
高级语言: C
项目地址: git://github.com/darmar-lt/qcontainers.git
创建时间: 2017-03-05T14:17:00Z
项目社区:https://github.com/darmar-lt/qcontainers

开源协议:Other

下载


About

qContainers is a container library for Fortran language.
It enables to store any internal Fortran data type and
any derived data type to the container.
The library wraps a subset of containers from qLibc library for C language and one container
(set) from c-algorithms library.

Following containers are implemented currently:

  • Containers for Key/Value pairs
    • Tree Table (qtreetbl) —- in binary tree (left-leaning red-black tree) data structure.
    • Hash Table (qhashtbl) —- in hash-based data structure.
  • Containers for Objects
    • List (qlist) —- doubly linked list.
    • Vector (qvector) —- growable array of elements.
    • Set (qset) —- collection of unique values.

The library uses some features of Fortran 2003 and TS-29113, therefore a relatively new
compiler version is required. Assumed-type dummy arguments or compiler directives in
the case the compiler doesn’t support assumed-type variables are used to enable store
of any type to the containers.
The containers were tested with Gfortran, Intel, PGI and Oracle Fortran compilers.

License

qContainers is published under 2-clause BSD license known as Simplified BSD License.
Please refer the LICENSE.txt document included in the repository for more details.

API

All container APIs have a consistent look and feel. Type-bound procedures
are used to make the use of the containers more convenient.

An example below illustrates how it looks like.

  1. subroutine colors()
  2. use qtreetbl_m
  3. implicit none
  4. type(qtreetbl_t) :: col
  5. integer :: val(3)
  6. integer :: ret_val(3)
  7. integer :: ns
  8. logical :: found
  9. ! Determine the size in bytes we need to save
  10. ! ns is a number of bytes for 3 integers
  11. ns = storage_size(val) / 8 * size(val)
  12. ! Create a new tree-table
  13. call col%new(ns)
  14. ! Put some values
  15. val = [255, 0, 0]
  16. call col%put("red", val(1)) ! ns bytes from val is copied
  17. val = [0, 255, 0]
  18. call col%put("green", val(1))
  19. !.........
  20. ! Retrieve value
  21. call col%get("red", ret_val(1), found)
  22. print *, "red color = ", ret_val
  23. end subroutine

Installation

Read INSTALL.md file.

Documentation

An introduction tutorial can be found in docs folder. Also, the library has
rather extensive test-cases from which users can learn how to use the library.

Contribution

You can contribute to this project by reporting bugs, suggesting new features,
implementing new features/containers, writing documentation/tutorial or
simply by spreading the word about it.