Skip to content

Commit

Permalink
Added units_mod
Browse files Browse the repository at this point in the history
* Basic units module
* Implements some operator overloads
* Needs extension to more units
  • Loading branch information
Kyle Horne committed Sep 28, 2016
1 parent 0ec7cc0 commit 1cb76eb
Show file tree
Hide file tree
Showing 3 changed files with 409 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ set(modules_src
"src/spline.f90"
"src/stats.f90"
"src/time.f90"
"src/units.f90"
"src/autoDiff/autoDiff.f90"
"src/autoDiff/autoDiffArray.f90"
"src/autoDiff/autoDiffExponential.f90"
Expand Down Expand Up @@ -170,7 +171,7 @@ function(addTest name)
endfunction(addTest)

addTest("testArray")
# addTest("testAutoDiff")
addTest("testAutoDiff")
addTest("testConfig")
addTest("testIterate")
addTest("testKinds")
Expand All @@ -180,6 +181,7 @@ addTest("testStats")
addTest("testTensor")
addTest("testText")
addTest("testTime")
addTest("testUnits")
addTest("testVtkIO")

add_dependencies(testConfig symlinks)
Expand Down
28 changes: 28 additions & 0 deletions src/test/testUnits.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
program testUnits_prg
!! Test program for units_mod
!! @todo
!! Needs serious improvements
use kinds_mod, only: wp
use units_mod
implicit none

call testUnits

contains

subroutine testUnits
type(quantity_t)::dP
type(quantity_t)::rho
type(quantity_t)::V

rho = quantity_t(1.225_wp,'kg')/quantity_t(1.0_wp,'m')**3
dP = quantity_t(7.25E-2_wp,'psi')
dP = dP%convert( quantity_t(1.0_wp,'Pa') )

V = sqrt(2.0_wp*dP/rho)

write(*,*) V%value,V%getChar()
end subroutine testUnits

end program testUnits_prg

Loading

0 comments on commit 1cb76eb

Please sign in to comment.