Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/szaghi/vecfor
Vector algebra class for Fortran poor people
https://github.com/szaghi/vecfor
fortran oop vector vector-algebra
Last synced: 3 days ago
JSON representation
Vector algebra class for Fortran poor people
- Host: GitHub
- URL: https://github.com/szaghi/vecfor
- Owner: szaghi
- Created: 2015-11-03T07:53:58.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-07-06T08:51:57.000Z (over 2 years ago)
- Last Synced: 2024-06-11T18:54:31.245Z (8 months ago)
- Topics: fortran, oop, vector, vector-algebra
- Language: Fortran
- Size: 6.54 MB
- Stars: 29
- Watchers: 7
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.bsd-2.md
Awesome Lists containing this project
README
# VecFor [](https://github.com/szaghi/VecFor/releases) [](https://gitter.im/szaghi/VecFor?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[]()
[]()
[]()
[]()[]()
[](https://github.com/szaghi/VecFor/actions)
[](https://app.codecov.io/gh/szaghi/VecFor)### VecFor, Vector algebra class for Fortran poor people
A KISS pure Fortran OOD class for computing Vectorial (3D) algebra
- VecFor is a pure Fortran (KISS) library for building easily nice Command Line Interfaces (CLI) for modern Fortran projects;
- VecFor is Fortran 2003+ standard compliant;
- VecFor is OOP designed;
- VecFor is a Free, Open Source Project.#### Table of Contents
- [What is VecFor?](#what-is-vecfor)
- [Main features](#main-features)
- [Copyrights](#copyrights)
- [Documentation](#documentation)
- [A Taste of VecFor](#a-taste-of-vecfor)#### Issues
[]()
#### Compiler Support
[]()
[]()
[]()
[]()
[]()
[]()## What is VecFor?
VecFor is a user-friendly and Object-Oriented designed API for handling *vectors* in a (3D) three dimensional frame of reference. It exposes (among others) the *object* **Vector** that posses a far complete set of overloaded operators for performing vectorial calculus algebra.
VecFor adheres to the [KISS](https://en.wikipedia.org/wiki/KISS_principle) concept: it is a pure Fortran (2003+) library coded into a single module file, `vecfor.F90`.
Go to [Top](#top)
## Main features
+ [x] Pure Fortran implementation;
+ [x] KISS and user-friendly:
+ [x] simple API (one main *object* plus few other *helpers*);
+ [x] easy building and porting on heterogeneous architectures:
+ [x] the vector components are defined as real with parametrized kind; the default kind parameter is set to be 64-bit-like finite precision (defined by means of the portable `select_real_kind` intrinsic function), but it can be easily changed at compile time;
+ [x] comprehensive (almost complete set of operators for vectorial calculus algebra);
+ [x] all operators accept mixed type/kind arguments: vectors can be mixed with integers and reals of any kinds by means of generic interfaces with dynamic dispatch resolved at compile time;
+ [x] efficient and *non intrusive* (all object methods and operators are *pure* or *elemental*):
+ [x] threads/processes safe;
+ [x] Tests-Driven Developed ([TDD](https://en.wikipedia.org/wiki/Test-driven_development));
+ [x] well documented:
+ [x] complete [API](http://szaghi.github.io/VecFor/index.html) reference;
+ [x] comprehensive [wiki](https://github.com/szaghi/VecFor/wiki):
+ [x] collaborative developed on [GitHub](https://github.com/szaghi/VecFor);
+ [x] [FOSS licensed](https://github.com/szaghi/VecFor/wiki/Copyrights);Any feature request is welcome.
Go to [Top](#top)
## Copyrights
VecFor is an open source project, it is distributed under a multi-licensing system:
+ for FOSS projects:
- [GPL v3](http://www.gnu.org/licenses/gpl-3.0.html);
+ for closed source/commercial projects:
- [BSD 2-Clause](http://opensource.org/licenses/BSD-2-Clause);
- [BSD 3-Clause](http://opensource.org/licenses/BSD-3-Clause);
- [MIT](http://opensource.org/licenses/MIT).Anyone is interest to use, to develop or to contribute to VecFor is welcome, feel free to select the license that best matches your soul!
More details can be found on [wiki](https://github.com/szaghi/VecFor/wiki/Copyrights).
Go to [Top](#top)
## Documentation
Besides this README file the VecFor documentation is contained into its own [wiki](https://github.com/szaghi/VecFor/wiki). Detailed documentation of the API is contained into the [GitHub Pages](http://szaghi.github.io/VecFor/index.html) that can also be created locally by means of [ford tool](https://github.com/cmacmackin/ford).
### A Taste of VecFor
VecFor allows a very simple, high-level implementation of vectorial calculus algebra.
#### Import VecFor
```fortran
use vecfor ! load vector type and all helpers
```#### Define some vector variables
```fortran
type(vector) :: point1
type(vector) :: point2
type(vector) :: distance
```#### Initialize vectors by high-level math-like syntax
```fortran
point1 = 1 * ex ! ex is the versor along x direction exposed by VecFor
point2 = 1 * ex + 2 * ey ! ey is the versor along y direction exposed by VecFor
```
Note that *ex*, *ey* and *ez* are the Cartesian versors exposed by VecFor.#### Perform vectorial calculus algebra
```fortran
distance = point2 - point1
```#### Use helper methods to simplify your life
```fortran
print "(A)", " Vectorial distance"
call distance%printf
print "(A)", " Distance module"
print*, distance%normL2()
! expected output
! Vectorial distance
! Component x 0.000000000000000E+000
! Component y +0.200000000000000E+001
! Component z 0.000000000000000E+000
! Distance module
! +0.200000000000000E+001
```As you can see from the above example, defining and using a *vector* become very close to the mathematical formulation. Note that, using the dynamic dispatching resolved at compile time, there is no performance penalty on using a `type(vector)` variable instead of an *hard-coded* `real, dimension(3)` array variable (or even more verbose and less clear `real :: x, y, z` variables for each vector...).
Go to [Top](#top)