Skip to content

Commit

Permalink
apply style guidelines to comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mjreno authored and mjreno committed Nov 11, 2024
1 parent 9a605cf commit 5ef2aab
Show file tree
Hide file tree
Showing 28 changed files with 2,022 additions and 2,991 deletions.
462 changes: 220 additions & 242 deletions src/Utilities/Export/DisNCMesh.f90

Large diffs are not rendered by default.

458 changes: 212 additions & 246 deletions src/Utilities/Export/DisNCStructured.f90

Large diffs are not rendered by default.

405 changes: 192 additions & 213 deletions src/Utilities/Export/DisvNCMesh.f90

Large diffs are not rendered by default.

180 changes: 82 additions & 98 deletions src/Utilities/Export/MeshNCModel.f90

Large diffs are not rendered by default.

52 changes: 16 additions & 36 deletions src/Utilities/Export/ModelExport.f90
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ function nc_export_active() result(active)
integer(I4B) :: n
type(ExportModelType), pointer :: export_model
active = .false.
!
do n = 1, export_models%Count()
export_model => get_export_model(n)
if (export_model%nctype /= NETCDF_UNDEF) then
Expand Down Expand Up @@ -87,51 +86,48 @@ subroutine modelexports_create(iout)
character(len=LINELENGTH) :: exportstr
integer(I4B) :: n
logical(LGP) :: found
!

do n = 1, model_dynamic_pkgs%Count()
!
! -- allocate and initialize
! allocate and initialize
allocate (export_model)
!
! -- set pointer to dynamic input model instance

! set pointer to dynamic input model instance
model_dynamic_input => GetDynamicModelFromList(model_dynamic_pkgs, n)
!
! --set input mempaths

! set input mempaths
modelnam_mempath = &
create_mem_path(component=model_dynamic_input%modelname, &
subcomponent='NAM', context=idm_context)
model_mempath = create_mem_path(component=model_dynamic_input%modelname, &
context=idm_context)
! -- set pointer to dis enum type
! set pointer to dis enum type
call mem_setptr(disenum, 'DISENUM', model_mempath)
!
! -- initialize model

! initialize model
call export_model%init(model_dynamic_input, disenum, iout)
!
! -- update EXPORT_NETCDF string if provided

! update EXPORT_NETCDF string if provided
call mem_set_value(exportstr, 'EXPORT_NETCDF', modelnam_mempath, found)
if (found) then
if (exportstr == 'STRUCTURED') then
export_model%nctype = NETCDF_STRUCTURED
else
! -- mesh export is default
! mesh export is default
export_model%nctype = NETCDF_UGRID
end if
end if
!
! -- add model to list

! add model to list
call add_export_model(export_model)
end do
end subroutine modelexports_create

!> @brief export model list post prepare step
!!
subroutine modelexports_post_prepare()
! -- local variables
class(*), pointer :: obj
class(ExportModelType), pointer :: export_model
integer(I4B) :: n
!
do n = 1, export_models%Count()
obj => export_models%GetItem(n)
if (associated(obj)) then
Expand All @@ -147,11 +143,9 @@ end subroutine modelexports_post_prepare
!> @brief export model list post step
!!
subroutine modelexports_post_step()
! -- local variables
class(*), pointer :: obj
class(ExportModelType), pointer :: export_model
integer(I4B) :: n
!
do n = 1, export_models%Count()
obj => export_models%GetItem(n)
if (associated(obj)) then
Expand All @@ -167,11 +161,9 @@ end subroutine modelexports_post_step
!> @brief destroy export model list
!!
subroutine modelexports_destroy()
! -- local variables
class(*), pointer :: obj
class(ExportModelType), pointer :: export_model
integer(I4B) :: n
!
do n = 1, export_models%Count()
obj => export_models%GetItem(n)
if (associated(obj)) then
Expand All @@ -197,15 +189,13 @@ subroutine init(this, loaders, disenum, iout)
type(ModelDynamicPkgsType), pointer, intent(in) :: loaders
integer(I4B), intent(in) :: disenum
integer(I4B), intent(in) :: iout
!
this%loaders => loaders
this%modelname = loaders%modelname
this%modeltype = loaders%modeltype
this%modelfname = loaders%modelfname
this%nctype = NETCDF_UNDEF
this%disenum = disenum
this%iout = iout
!
nullify (this%nc_export)
end subroutine init

Expand All @@ -214,7 +204,6 @@ end subroutine init
!<
subroutine post_prepare(this)
class(ExportModelType), intent(inout) :: this
!
if (associated(this%nc_export)) then
call this%nc_export%export_input()
end if
Expand All @@ -225,7 +214,6 @@ end subroutine post_prepare
!<
subroutine post_step(this)
class(ExportModelType), intent(inout) :: this
!
if (associated(this%nc_export)) then
call this%nc_export%step()
end if
Expand All @@ -236,7 +224,6 @@ end subroutine post_step
!<
subroutine destroy(this)
class(ExportModelType), intent(inout) :: this
!
if (associated(this%nc_export)) then
call this%nc_export%destroy()
deallocate (this%nc_export)
Expand All @@ -248,11 +235,8 @@ end subroutine destroy
!!
!<
subroutine add_export_model(export_model)
! -- dummy variables
type(ExportModelType), pointer, intent(inout) :: export_model
! -- local variables
class(*), pointer :: obj
!
obj => export_model
call export_models%Add(obj)
end subroutine add_export_model
Expand All @@ -261,16 +245,12 @@ end subroutine add_export_model
!!
!<
function get_export_model(idx) result(res)
! -- dummy variables
integer(I4B), intent(in) :: idx !< package number
! -- local variables
class(ExportModelType), pointer :: res
class(*), pointer :: obj
!
! -- initialize res
! initialize res
nullify (res)
!
! -- get the object from the list
! get the object from the list
obj => export_models%GetItem(idx)
if (associated(obj)) then
select type (obj)
Expand Down
111 changes: 50 additions & 61 deletions src/Utilities/Export/NCExportCreate.f90
Original file line number Diff line number Diff line change
Expand Up @@ -39,88 +39,86 @@ subroutine create_nc_export(export_model, num_model)
class(Mesh2dDisvExportType), pointer :: ugrid_disv
class(DisNCStructuredType), pointer :: structured_dis
class(DisBaseType), pointer :: disbase
!

select case (export_model%disenum)
case (DIS)
! -- allocate nc structured grid export object
! allocate nc structured grid export object
if (export_model%nctype == NETCDF_UGRID) then
!
! -- allocate nc structured grid export object
! allocate nc structured grid export object
allocate (ugrid_dis)
!
! -- set dis base type

! set dis base type
disbase => num_model%dis
select type (disbase)
type is (DisType)
ugrid_dis%dis => disbase
end select
!
! -- set dynamic loaders

! set dynamic loaders
call create_export_pkglist(ugrid_dis%pkglist, export_model%loaders, &
export_model%iout)
!
! -- initialize export object

! initialize export object
call ugrid_dis%init(export_model%modelname, export_model%modeltype, &
export_model%modelfname, export_model%disenum, &
NETCDF_UGRID, export_model%iout)
!
! -- define export object

! define export object
call ugrid_dis%df()
!
! -- set base pointer

! set base pointer
export_model%nc_export => ugrid_dis
else if (export_model%nctype == NETCDF_STRUCTURED) then
!
! -- allocate nc structured grid export object
! allocate nc structured grid export object
allocate (structured_dis)
!
! -- set dis base type

! set dis base type
disbase => num_model%dis
select type (disbase)
type is (DisType)
structured_dis%dis => disbase
end select
!
! -- set dynamic loaders

! set dynamic loaders
call create_export_pkglist(structured_dis%pkglist, export_model%loaders, &
export_model%iout)
!
! -- initialize export object

! initialize export object
call structured_dis%init(export_model%modelname, export_model%modeltype, &
export_model%modelfname, export_model%disenum, &
NETCDF_STRUCTURED, export_model%iout)
!
! -- define export object

! define export object
call structured_dis%df()
!
! -- set base pointer

! set base pointer
export_model%nc_export => structured_dis
end if
case (DISV)
if (export_model%nctype == NETCDF_UGRID) then
! -- allocate nc structured grid export object
! allocate nc structured grid export object
allocate (ugrid_disv)
!
! -- set dis base type

! set dis base type
disbase => num_model%dis
select type (disbase)
type is (DisvType)
ugrid_disv%disv => disbase
end select
!
! -- set dynamic loaders

! set dynamic loaders
call create_export_pkglist(ugrid_disv%pkglist, export_model%loaders, &
export_model%iout)
!
! -- initialize export object

! initialize export object
call ugrid_disv%init(export_model%modelname, export_model%modeltype, &
export_model%modelfname, export_model%disenum, &
NETCDF_UGRID, export_model%iout)
!
! -- define export object

! define export object
call ugrid_disv%df()
!
! -- set base pointer

! set base pointer
export_model%nc_export => ugrid_disv
else
errmsg = 'DISV model discretization only &
Expand Down Expand Up @@ -155,43 +153,39 @@ subroutine create_export_pkglist(pkglist, loaders, iout)
class(*), pointer :: obj
logical(LGP) :: found
integer(I4B) :: n
!
! -- create list of in scope loaders

! create list of in scope loaders
allocate (export_arrays)
!

do n = 1, loaders%pkglist%Count()
!
! -- initialize export arrays option
! initialize export arrays option
export_arrays = 0
!

dynamic_pkg => loaders%get(n)
!
! -- update export arrays option

! update export arrays option
call mem_set_value(export_arrays, 'EXPORT_NC', &
dynamic_pkg%mf6_input%mempath, found)
!

if (export_arrays > 0 .and. dynamic_pkg%readasarrays) then
select type (dynamic_pkg)
type is (Mf6FileDynamicPkgLoadType)
!
rp_loader => dynamic_pkg%rp_loader
!
select type (rp_loader)
type is (BoundGridInputType)
! -- create the export object
! create the export object
allocate (export_pkg)
call export_pkg%init(rp_loader%mf6_input, &
rp_loader%bound_context%mshape, &
rp_loader%param_names, rp_loader%nparam)
obj => export_pkg
call pkglist%add(obj)
!
end select
end select
end if
end do
!
! -- cleanup

! cleanup
deallocate (export_arrays)
end subroutine create_export_pkglist

Expand All @@ -205,24 +199,19 @@ subroutine nc_export_create()
type(ExportModelType), pointer :: export_model
class(NumericalModelType), pointer :: num_model
integer(I4B) :: im
!
do n = 1, export_models%Count()
! -- set pointer to export model
! set pointer to export model
export_model => get_export_model(n)
if (export_model%nctype /= NETCDF_UNDEF) then
!
! -- netcdf export is active identify model
! netcdf export is active identify model
do im = 1, basemodellist%Count()
!
! -- set model pointer
! set model pointer
num_model => GetNumericalModelFromList(basemodellist, im)
if (num_model%name == export_model%modelname .and. &
num_model%macronym == export_model%modeltype) then
!
! -- allocate and initialize nc export model
! allocate and initialize nc export model
call create_nc_export(export_model, num_model)
exit
!
end if
end do
end if
Expand Down
Loading

0 comments on commit 5ef2aab

Please sign in to comment.