From 0e7ee53640a916c6d1b26cf168a59a15b7f857f9 Mon Sep 17 00:00:00 2001 From: Eric Morway Date: Tue, 28 Nov 2023 08:21:11 -0800 Subject: [PATCH] chore(geometry): cleanup docstrings in geometry-related classes --- src/Model/Geometry/BaseGeometry.f90 | 32 ++++++----- src/Model/Geometry/CircularGeometry.f90 | 64 ++++++--------------- src/Model/Geometry/RectangularGeometry.f90 | 66 +++++++--------------- 3 files changed, 56 insertions(+), 106 deletions(-) diff --git a/src/Model/Geometry/BaseGeometry.f90 b/src/Model/Geometry/BaseGeometry.f90 index 0216abb793f..80eee4b8367 100644 --- a/src/Model/Geometry/BaseGeometry.f90 +++ b/src/Model/Geometry/BaseGeometry.f90 @@ -12,7 +12,9 @@ module BaseGeometryModule character(len=20) :: geo_type = 'UNDEFINED' integer(I4B) :: id = 0 character(len=GEONAMELEN) :: name = '' + contains + procedure :: area_sat procedure :: perimeter_sat procedure :: area_wet @@ -28,8 +30,10 @@ function area_sat(this) real(DP) :: area_sat ! -- dummy class(BaseGeometryType) :: this + ! area_sat = 0.d0 - ! -- return + ! + ! -- Return return end function area_sat @@ -38,8 +42,10 @@ function perimeter_sat(this) real(DP) :: perimeter_sat ! -- dummy class(BaseGeometryType) :: this + ! perimeter_sat = 0.d0 - ! -- return + ! + ! -- Return return end function perimeter_sat @@ -49,8 +55,10 @@ function area_wet(this, depth) ! -- dummy class(BaseGeometryType) :: this real(DP), intent(in) :: depth + ! area_wet = 0.d0 - ! -- return + ! + ! -- Return return end function area_wet @@ -60,8 +68,10 @@ function perimeter_wet(this, depth) ! -- dummy class(BaseGeometryType) :: this real(DP), intent(in) :: depth + ! perimeter_wet = 0.d0 - ! -- return + ! + ! -- Return return end function perimeter_wet @@ -69,17 +79,14 @@ subroutine set_attribute(this, line) ! -- dummy class(BaseGeometryType) :: this character(len=*), intent(inout) :: line - ! -- return + ! + ! -- Return return end subroutine set_attribute + !> @brief Print the attributes for this object + !< subroutine print_attributes(this, iout) -! ****************************************************************************** -! print_attributes -- print the attributes for this object -! ***************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- dummy class(BaseGeometryType) :: this ! -- local @@ -87,13 +94,12 @@ subroutine print_attributes(this, iout) ! -- formats character(len=*), parameter :: fmtid = "(4x,a,i0)" character(len=*), parameter :: fmtnm = "(4x,a,a)" -! ------------------------------------------------------------------------------ ! write (iout, fmtid) 'ID = ', this%id write (iout, fmtnm) 'NAME = ', trim(adjustl(this%name)) write (iout, fmtnm) 'GEOMETRY TYPE = ', trim(adjustl(this%geo_type)) ! - ! -- return + ! -- Return return end subroutine print_attributes diff --git a/src/Model/Geometry/CircularGeometry.f90 b/src/Model/Geometry/CircularGeometry.f90 index 18e71a6491d..e84729e69a8 100644 --- a/src/Model/Geometry/CircularGeometry.f90 +++ b/src/Model/Geometry/CircularGeometry.f90 @@ -10,7 +10,9 @@ module CircularGeometryModule type, extends(BaseGeometryType) :: CircularGeometryType real(DP) :: radius = DZERO + contains + procedure :: area_sat procedure :: perimeter_sat procedure :: area_wet @@ -21,20 +23,15 @@ module CircularGeometryModule contains + !> @brief Return area as if geometry is fully saturated + !< function area_sat(this) -! ****************************************************************************** -! area_sat -- return area as if geometry is fully saturated -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- modules use ConstantsModule, only: DTWO, DPI ! -- return real(DP) :: area_sat ! -- dummy class(CircularGeometryType) :: this -! ------------------------------------------------------------------------------ ! ! -- Calculate area area_sat = DPI * this%radius**DTWO @@ -43,35 +40,26 @@ function area_sat(this) return end function area_sat + !> @brief Return perimeter as if geometry is fully saturated + !< function perimeter_sat(this) -! ****************************************************************************** -! perimeter_sat -- return perimeter as if geometry is fully saturated -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- modules use ConstantsModule, only: DTWO, DPI ! -- return real(DP) :: perimeter_sat ! -- dummy class(CircularGeometryType) :: this -! ------------------------------------------------------------------------------ ! ! -- Calculate area perimeter_sat = DTWO * DPI * this%radius ! - ! -- return + ! -- Return return end function perimeter_sat + !> @brief Return wetted area + !< function area_wet(this, depth) -! ****************************************************************************** -! area_wet -- return wetted area -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- modules use ConstantsModule, only: DTWO, DPI, DZERO ! -- return @@ -79,7 +67,6 @@ function area_wet(this, depth) ! -- dummy class(CircularGeometryType) :: this real(DP), intent(in) :: depth -! ------------------------------------------------------------------------------ ! ! -- Calculate area if (depth <= DZERO) then @@ -102,13 +89,9 @@ function area_wet(this, depth) return end function area_wet + !> @brief Return wetted perimeter + !< function perimeter_wet(this, depth) -! ****************************************************************************** -! perimeter_wet -- return wetted perimeter -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- modules use ConstantsModule, only: DTWO, DPI ! -- return @@ -116,7 +99,6 @@ function perimeter_wet(this, depth) ! -- dummy class(CircularGeometryType) :: this real(DP), intent(in) :: depth -! ------------------------------------------------------------------------------ ! ! -- Calculate area if (depth <= DZERO) then @@ -131,17 +113,13 @@ function perimeter_wet(this, depth) perimeter_wet = DTWO * DPI * this%radius end if ! - ! -- return + ! -- Return return end function perimeter_wet + !> @brief Set a parameter for this circular object + !< subroutine set_attribute(this, line) -! ****************************************************************************** -! set_attribute -- set a parameter for this circular object -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- module use InputOutputModule, only: urword use ConstantsModule, only: LINELENGTH @@ -153,7 +131,6 @@ subroutine set_attribute(this, line) ! -- local integer(I4B) :: lloc, istart, istop, ival real(DP) :: rval -! ------------------------------------------------------------------------------ ! ! -- should change this and set id if uninitialized or store it lloc = 1 @@ -175,17 +152,13 @@ subroutine set_attribute(this, line) call store_error(errmsg, terminate=.TRUE.) end select ! - ! -- return + ! -- Return return end subroutine set_attribute + !> @brief Print the attributes for this object + !< subroutine print_attributes(this, iout) -! ****************************************************************************** -! print_attributes -- print the attributes for this object -! ***************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- dummy class(CircularGeometryType) :: this ! -- local @@ -193,7 +166,6 @@ subroutine print_attributes(this, iout) ! -- formats character(len=*), parameter :: fmtnm = "(4x,a,a)" character(len=*), parameter :: fmttd = "(4x,a,1(1PG15.6))" -! ------------------------------------------------------------------------------ ! ! -- call parent to print parent attributes call this%BaseGeometryType%print_attributes(iout) @@ -203,7 +175,7 @@ subroutine print_attributes(this, iout) write (iout, fmttd) 'SATURATED AREA = ', this%area_sat() write (iout, fmttd) 'SATURATED WETTED PERIMETER = ', this%perimeter_sat() ! - ! -- return + ! -- Return return end subroutine print_attributes diff --git a/src/Model/Geometry/RectangularGeometry.f90 b/src/Model/Geometry/RectangularGeometry.f90 index 1df035584de..684b1cc17ba 100644 --- a/src/Model/Geometry/RectangularGeometry.f90 +++ b/src/Model/Geometry/RectangularGeometry.f90 @@ -9,7 +9,9 @@ module RectangularGeometryModule type, extends(BaseGeometryType) :: RectangularGeometryType real(DP) :: height = DZERO real(DP) :: width = DZERO + contains + procedure :: area_sat procedure :: perimeter_sat procedure :: area_wet @@ -20,20 +22,15 @@ module RectangularGeometryModule contains + !> @brief Return saturated area + !< function area_sat(this) -! ****************************************************************************** -! area_sat -- return saturated area -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- modules use ConstantsModule, only: DTWO, DPI ! -- return real(DP) :: area_sat ! -- dummy class(RectangularGeometryType) :: this -! ------------------------------------------------------------------------------ ! ! -- Calculate area area_sat = this%height * this%width @@ -42,35 +39,26 @@ function area_sat(this) return end function area_sat + !> @brief Return saturated perimeter + !< function perimeter_sat(this) -! ****************************************************************************** -! perimeter_sat -- return saturated perimeter -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- modules use ConstantsModule, only: DTWO, DPI ! -- return real(DP) :: perimeter_sat ! -- dummy class(RectangularGeometryType) :: this -! ------------------------------------------------------------------------------ ! ! -- Calculate area perimeter_sat = DTWO * (this%height + this%width) ! - ! -- return + ! -- Return return end function perimeter_sat + !> @brief Return wetted area + !< function area_wet(this, depth) -! ****************************************************************************** -! area_wet -- return wetted area -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- modules use ConstantsModule, only: DTWO, DPI, DZERO ! -- return @@ -78,7 +66,6 @@ function area_wet(this, depth) ! -- dummy class(RectangularGeometryType) :: this real(DP), intent(in) :: depth -! ------------------------------------------------------------------------------ ! ! -- Calculate area if (depth <= DZERO) then @@ -93,13 +80,9 @@ function area_wet(this, depth) return end function area_wet + !> @brief Return wetted perimeter + !< function perimeter_wet(this, depth) -! ****************************************************************************** -! perimeter_wet -- return wetted perimeter -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- modules use ConstantsModule, only: DTWO, DPI ! -- return @@ -107,7 +90,6 @@ function perimeter_wet(this, depth) ! -- dummy class(RectangularGeometryType) :: this real(DP), intent(in) :: depth -! ------------------------------------------------------------------------------ ! ! -- Calculate area if (depth <= DZERO) then @@ -118,17 +100,13 @@ function perimeter_wet(this, depth) perimeter_wet = DTWO * (this%height + this%width) end if ! - ! -- return + ! -- Return return end function perimeter_wet + !> @brief Set a parameter for this rectangular object + !< subroutine set_attribute(this, line) -! ****************************************************************************** -! set_attribute -- set a parameter for this rectangular object -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- module use InputOutputModule, only: urword use ConstantsModule, only: LINELENGTH @@ -140,13 +118,12 @@ subroutine set_attribute(this, line) ! -- local integer(I4B) :: lloc, istart, istop, ival real(DP) :: rval -! ------------------------------------------------------------------------------ ! ! -- should change this and set id if uninitialized or store it lloc = 1 call urword(line, lloc, istart, istop, 2, ival, rval, 0, 0) this%id = ival - + ! ! -- Parse the attribute call urword(line, lloc, istart, istop, 1, ival, rval, 0, 0) select case (line(istart:istop)) @@ -165,17 +142,13 @@ subroutine set_attribute(this, line) call store_error(errmsg, terminate=.TRUE.) end select ! - ! -- return + ! -- Return return end subroutine set_attribute + !> @brief Print the attributes for this object + !< subroutine print_attributes(this, iout) -! ****************************************************************************** -! print_attributes -- print the attributes for this object -! ***************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- dummy class(RectangularGeometryType) :: this ! -- local @@ -183,7 +156,6 @@ subroutine print_attributes(this, iout) ! -- formats character(len=*), parameter :: fmtnm = "(4x,a,a)" character(len=*), parameter :: fmttd = "(4x,a,1(1PG15.6))" -! ------------------------------------------------------------------------------ ! ! -- call parent to print parent attributes call this%BaseGeometryType%print_attributes(iout) @@ -194,7 +166,7 @@ subroutine print_attributes(this, iout) write (iout, fmttd) 'SATURATED AREA = ', this%area_sat() write (iout, fmttd) 'SATURATED WETTED PERIMETER = ', this%perimeter_sat() ! - ! -- return + ! -- Return return end subroutine print_attributes