Skip to content

Commit

Permalink
chore(geometry): cleanup docstrings in geometry-related classes (#1474)
Browse files Browse the repository at this point in the history
* chore(geometry): cleanup docstrings in geometry-related classes

* forgot to run fprettify in previous commit
  • Loading branch information
emorway-usgs authored Dec 5, 2023
1 parent ddbd760 commit 4e2cd4d
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 106 deletions.
32 changes: 19 additions & 13 deletions src/Model/Geometry/BaseGeometry.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -60,40 +68,38 @@ 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

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
integer(I4B), intent(in) :: 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

Expand Down
64 changes: 18 additions & 46 deletions src/Model/Geometry/CircularGeometry.f90
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ module CircularGeometryModule

type, extends(BaseGeometryType) :: CircularGeometryType
real(DP) :: radius = DZERO

contains

procedure :: area_sat
procedure :: perimeter_sat
procedure :: area_wet
Expand All @@ -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
Expand All @@ -43,43 +40,33 @@ 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
real(DP) :: area_wet
! -- dummy
class(CircularGeometryType) :: this
real(DP), intent(in) :: depth
! ------------------------------------------------------------------------------
!
! -- Calculate area
if (depth <= DZERO) then
Expand All @@ -102,21 +89,16 @@ 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
real(DP) :: perimeter_wet
! -- dummy
class(CircularGeometryType) :: this
real(DP), intent(in) :: depth
! ------------------------------------------------------------------------------
!
! -- Calculate area
if (depth <= DZERO) then
Expand All @@ -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
Expand All @@ -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
Expand All @@ -175,25 +152,20 @@ 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
integer(I4B), intent(in) :: 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)
Expand All @@ -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

Expand Down
Loading

0 comments on commit 4e2cd4d

Please sign in to comment.