{"id":25456900,"url":"https://github.com/victorsndvg/fpl","last_synced_at":"2026-02-23T08:02:48.008Z","repository":{"id":52887161,"uuid":"44166103","full_name":"victorsndvg/FPL","owner":"victorsndvg","description":"Fortran Parameter List. A fortran dictionary where to put the parameters of your application.","archived":false,"fork":false,"pushed_at":"2021-05-09T03:32:22.000Z","size":6144,"stargazers_count":30,"open_issues_count":6,"forks_count":9,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-01-29T08:48:46.610Z","etag":null,"topics":["datastructures","dictionary","fortran","fpl","object-oriented"],"latest_commit_sha":null,"homepage":"","language":"FORTRAN","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/victorsndvg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-13T09:31:57.000Z","updated_at":"2022-09-15T09:26:08.000Z","dependencies_parsed_at":"2022-08-23T13:01:29.412Z","dependency_job_id":null,"html_url":"https://github.com/victorsndvg/FPL","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorsndvg%2FFPL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorsndvg%2FFPL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorsndvg%2FFPL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorsndvg%2FFPL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/victorsndvg","download_url":"https://codeload.github.com/victorsndvg/FPL/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239394674,"owners_count":19631122,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["datastructures","dictionary","fortran","fpl","object-oriented"],"created_at":"2025-02-18T01:51:38.185Z","updated_at":"2025-10-25T06:04:19.162Z","avatar_url":"https://github.com/victorsndvg.png","language":"FORTRAN","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FPL\n**F**ortran **P**arameter **L**ist\n\n[![Build Status](https://travis-ci.org/victorsndvg/FPL.svg?branch=master)](https://travis-ci.org/victorsndvg/FPL)\n[![codecov.io](https://codecov.io/github/victorsndvg/FPL/coverage.svg?branch=master)](https://codecov.io/github/victorsndvg/FPL?branch=master)\n\n## License\n\n[![License](https://img.shields.io/badge/license-GNU%20LESSER%20GENERAL%20PUBLIC%20LICENSE%20v3%2C%20LGPLv3-red.svg)](http://www.gnu.org/licenses/lgpl-3.0.txt)\n\n## What is FPL?\n\n**FPL** is pure fortran 2003 library that can manage the parameters of your program from a single point.\n\n**FPL** is an extendible container (dictionary) of ```\u003cKey, Value\u003e``` pairs, where the *Key* is a character string and the *Value* can be, by the default, of the following data types:\n\n- Integer (kinds 1, 2, 4, 8)\n- Real (kinds 4, 8)\n- Logical\n- String\n\nValue can be a scalar or an array of any dimension.\n\n**FPL** stores copies of the passed data by assignment.\n\n**FPL** is based in [Teuchos::ParameterList](https://trilinos.org/docs/dev/packages/teuchos/doc/html/classTeuchos_1_1ParameterList.html)  of the [Trilinos](https://trilinos.org/) project.\n\n## How to get FPL\n\n```git clone --recursive https://github.com/victorsndvg/FPL.git ```\n\n## Compilation\n\n**FPL** compile with GNU Fortran compiler 5.1 (and newer versions) and Intel Fortran compiler 15.0.1 (and newer versions).\n\n**Note:** *Due to an issue with IBM XLF 14.0.1 Fortran compiler, if you want to use this compiler use the branch XLF_workaround*\n\n**FPL** uses [CMake](https://cmake.org/) as a portable compilation system. \n\nThe easiest way to compile **FPL** under Linux is:\n\n```\n$ cd FPL\n$ mkdir build\n$ cd build\n$ cmake ../\n$ make\n```\n\n*To compile FPL under Windows use de equivalent commands*\n\n\n## Getting started with FPL\n\nNotes:\n- [Source code documentation](http://victorsndvg.github.io/FPL/)\n- **FPL** cannot handle non-allocated variables while calling `Set(Key, Value)` or `Get(Key, Value)` procedures.\n- To succesfull get a stored value into your target variable, **data type** and **shape** of both variables must agree.\n\n\n### Using FPL in your program\n\n```fortran\nUSE FPL\n\ntype(ParameterList_t) :: My_List\n\ncall FPL_Init()\ncall My_List%Init()\n\n... [Program body]\n\ncall My_List%Free()\ncall FPL_Finalize()\n```\n\n### Setting parameters\n\n```fortran\nFPLError = My_List%Set(Key='Max Iters', Value=1500)\nFPLError = My_List%Set(Key='Tolerance', Value=1.e-10)\nFPLError = My_List%Set(Key='Solver', Value='GMRES')\n```\n\n### Getting parameters\n\n```fortran\ninteger :: MaxIters\n\nFPLError = My_List%Get(Key='Max Iters', Value=MaxIters)\n```\n\n### Getting parameters as strings\n\n```fortran\ncharacter(len=:), allocatable :: MaxItersString\n\nFPLError = My_List%GetAsString(Key='Max Iters', String=MaxItersString)\n```\n\n### Check if you can assign a parameter to your variable\n\nCheck if the target variable has the same type and shape as the stored variable :bangbang:\n\n```fortran\ninteger :: MaxIters\n\nif(My_List%isAssignable(Key='Max Iters', Value=MaxIters)) then\n    FPLError = My_List%Get(Key='Max Iters', Value=MaxIters)\nendif\n```\n\n### Deleting parameters\n\n```fortran\ncall My_List%Del(Key='Max Iters')\n```\n\n### Checking if a parameter is present\n\n```fortran\nlogical :: solver_defined\n\nsolver_defined = My_List%isPresent(Key='Solver')\n```\n\n### Checking if a parameter is of the expected data type\n\n```fortran\nlogical :: has_same_type\nreal    :: Tolerance\n\nhas_same_type = My_List%isOfDataType(Key='Tolerance', Mold=Tolerance)\n```\n\n### Checking the shape of a parameter\n\n```fortran\nlogical :: has_same_type\ninteger, allocatable :: Shape(:)\n\nFPLError = My_List%GetShape(Key='Tolerance', Shape=Shape)\n```\n\n### Working with parameter sublists\n\nEvery parameter list can recursively store parameter sublists.\n\n```fortran\ntype(ParameterList_t), pointer :: Prec_List\n\nPrec_List =\u003e My_List%NewSubList(Key='Preconditioner')\n\ncall Prec_List%Set(Key='Type', Value='ILU')\ncall Prec_List%Set(Key='Drop Tolerance', Value=1.e-3)\n```\n\n### Checking if it is a parameter sublist\n\n```fortran\nlogical :: prec_defined\n\nprec_defined = My_List%isSubList(Key='Preconditioner')\n```\n\n### Print (recursive) the content of a parameter list\n\n```fortran\ncall My_List%Print()\n```\n\n### Iterate on a ParameterList\n\nParameterList also includes a derived type that works like an iterator to go through all stored parameters without asking for the key.\n\nParameterList_Iterator interface is almost the same than ParameterList interface plus some procedures like `HasFinished()` and `Next()` to manage the advance of the iterator.\n\nThe example below iterates on a ParameterList containing integer vectors and getting the stored values.\n\n```fortran\ntype(ParameterListIterator_t) :: Iterator\ninteger,allocatable :: array(:)\ninteger,allocatable :: shape(:)\n\nIterator = Parameters%GetIterator()\ndo while (.not. Iterator%HasFinished())\n    if(Iterator%GetDimensions() /= 1) stop -1\n    if(Iterator%GetShape(Shape=shape) /= 0) stop -1\n    if(.not. Iterator%IsOfDataType(Mold=array)) stop -1\n    if(allocated(array)) deallocate(array)\n    allocate(array(shape(1)))\n    if(Iterator%Get(array) /= 0) stop -1\n    print*, '  Key = '//Iterator%GetKey()\n    print*, '  Bytes = ', Iterator%DataSizeInBytes()\n    print*, '  Dimensions = ', Iterator%GetDimensions()\n    print*, '  Value = ', array)\n    call Iterator%Next()\nenddo\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictorsndvg%2Ffpl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvictorsndvg%2Ffpl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictorsndvg%2Ffpl/lists"}