Code Monkey home page Code Monkey logo

feq-parse's Introduction

Fortran Equation Parser

Copyright 2020 Fluid Numerics LLC

feqparse is an equation parser Fortran class that is used to interpret and evaluate functions provided as strings.

Learn how to contribute to this repository

Installation

For a quick installation to /usr/local/feqparse,

cd build/
cmake ../
make
sudo make install

If you'd like to run the provided tests to verify your installation,

  1. Navigate to the test/ directory underneath the build/ directory.
cd test/
  1. Use ctest to run the provided tests
ctest .

The above steps install

/opt/feqparse/lib/libfeqparse.a
/opt/feqparse/include/FEQParse.mod

Fortran Package Manager

A Fortran Package Manager manifest file is also included, so that the library and test cases can be compiled with FPM. For example:

fpm build --profile release
fpm test --profile release

To use feq-parse within your fpm project, add the following to your fpm.toml file:

[dependencies]
feq-parse = { git="https://github.com/FluidNumerics/feq-parse.git" }

Or, to use a specific version:

[dependencies]
feq-parse = { git="https://github.com/FluidNumerics/feq-parse.git", tag = "v1.1.0" }

Usage

Demo Program

Example Makefile

FC = gfortran
FLIBS += -L/opt/feqparse/lib -lfeqparse
FFLAGS += -I/opt/feqparse/include

demo : FEqParseDemo.f90
	${FC} -c FEqParseDemo.f90 ${FFLAGS}
	${FC} FEqParseDemo.o ${FFLAGS} ${FLIBS} -o $@

Example program

PROGRAM FEqParseDemo

USE FEQParse

IMPLICIT NONE

  TYPE(EquationParser) :: f
  CHARACTER(LEN=1), DIMENSION(1:3) :: independentVars
  CHARACTER(LEN=30) :: eqChar
  REAL :: x(1:3)

    ! Specify the independent variables
    independentVars = (/ 'x', 'y', 'z' /)

    ! Specify an equation string that we want to evaluate
    eqChar = 'f = exp( -(x^2 + y^2 + z^2) )'

    ! Create the EquationParser object
    f = EquationParser(eqChar, independentVars)

    ! Evaluate the equation
    x = (/ 0.0, 0.0, 0.0 /)
    PRINT*, f % evaluate( x )

    ! Clean up memory
    CALL f % Destruct()


END PROGRAM FEqParseDemo

Contributors

  • (Maintainer) Joe Schoonover, Fluid Numerics LLC

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.