Giter Club home page Giter Club logo

fpl's Introduction

#FPL Fortran Parameter List

Build Status codecov.io

##License

License

##What is FPL?

FPL is pure fortran 2003 library that can manage the parameters of your program from a single point.

FPL is an extendible container (dictionary) of <Key, Value> pairs, where the Key is a character string and the Value can be, by the default, of the following data types:

  • Integer (kinds 1, 2, 4, 8)
  • Real (kinds 4, 8)
  • Logical
  • String

Value can be a scalar or an array of any dimension.

FPL stores copies of the passed data by assignment.

FPL is based in Teuchos::ParameterList of the Trilinos project.

##How to get FPL

git clone --recursive https://github.com/victorsndvg/FPL.git

##Compilation

FPL compile with GNU Fortran compiler 5.1 (and newer versions) and Intel Fortran compiler 15.0.1 (and newer versions).

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

FPL uses CMake as a portable compilation system.

The easiest way to compile FPL under Linux is:

$ cd FPL
$ mkdir build
$ cd build
$ cmake ../
$ make

To compile FPL under Windows use de equivalent commands

##Getting started with FPL

###Using FPL in your program

USE FPL

type(ParameterList_t) :: My_List

call FPL_Init()
call My_List%Init()

... [Program boddy]

call My_List%Free()
call FPL_Finalize()

###Setting parameters

FPLError = My_List%Set(Key='Max Iters', Value=1500)
FPLError = My_List%Set(Key='Tolerance', Value=1.e-10)
FPLError = My_List%Set(Key='Solver', Value='GMRES')

###Getting parameters

integer :: MaxIters

FPLError = My_List%Get(Key='Max Iters', Value=MaxIters)

###Deleting parameters

call My_List%Del(Key='Max Iters')

###Checking if a parameter is present

logical :: solver_defined

solver_defined = My_List%isPresent(Key='Solver')

###Checking if a parameter is of the expected data type

logical :: has_same_type
real    :: Tolerance

has_same_type = My_List%isOfDataType(Key='Tolerance', Mold=Tolerance)

###Checking the shape of a parameter

logical :: has_same_type
integer, allocatable :: Shape(:)

FPLError = My_List%GetShape(Key='Tolerance', Shape=Shape)

###Working with parameter sublists

Every parameter list can recursively store other parameter sublists that have the same functionality of the original.

type(ParameterList_t), pointer :: Prec_List

Prec_List => My_List%NewSubList(Key='Preconditioner')

call Prec_List%Set(Key='Type', Value='ILU')
call Prec_List%Set(Key='Drop Tolerance', Value=1.e-3)

###Checking if is a parameter sublist

logical :: solver_defined

prec_defined = My_List%isSubList(Key='Preconditioner')

###Print the content of a parameter list

call My_List%Print()

fpl's People

Contributors

femparadmin avatar victorsndvg avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.