Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=r64), | intent(in) | :: | T | |||
character(len=*), | intent(in), | optional | :: | calledfrom |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
FUNCTION PsyPsatFnTemp(T,calledfrom) RESULT(Pascal)
! FUNCTION INFORMATION:
! AUTHOR Linda Lawrie
! DATE WRITTEN March 2013
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS FUNCTION:
! Provide a "cache" of results for the given argument (T) and pressure (Pascal) output result.
! METHODOLOGY EMPLOYED:
! Use grid shifting and masking to provide hash into the cache. Use Equivalence to
! make Fortran ignore "types".
! REFERENCES:
! na
! USE STATEMENTS:
! na
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! FUNCTION ARGUMENT DEFINITIONS:
REAL(r64), intent(in) :: T ! dry-bulb temperature {C}
character(len=*), intent(in), optional :: calledfrom ! routine this function was called from (error messages)
REAL(r64) :: Pascal ! result=> saturation pressure {Pascals}
! FUNCTION PARAMETER DEFINITIONS:
integer(i64), parameter :: Grid_Shift=(64 - 12 - psatPrecision_bits)
! integer(i64), parameter :: Grid_Mask=NOT(ISHFT(1_i64, Grid_Shift)-1)
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! FUNCTION LOCAL VARIABLE DECLARATIONS:
integer(i64) :: Tdb_tag
integer(i64) :: hash
real(r64) :: Tdb_tag_r
# 2154
Tdb_tag=Transfer(T,Tdb_tag)
!Both Intel & GNU are happy to use .iand.
Tdb_tag = ISHFT(Tdb_tag, -Grid_Shift)
hash = IAND(Tdb_tag, INT(psatcache_size - 1,i64))
IF (cached_psat(hash)%iTdb /= Tdb_tag) THEN
cached_Psat(hash)%iTdb = Tdb_tag
Tdb_tag_r = Transfer(ISHFT(Tdb_tag, Grid_shift), Tdb_tag_r)
IF (PRESENT(calledfrom)) THEN
cached_Psat(hash)%Psat = PsyPsatFnTemp_raw(Tdb_tag_r,calledfrom)
ELSE
cached_Psat(hash)%Psat = PsyPsatFnTemp_raw(Tdb_tag_r)
ENDIF
END IF
Pascal = cached_Psat(hash)%Psat
RETURN
END FUNCTION PsyPsatFnTemp