MODFLOW 6  version 6.6.0.dev0
USGS Modular Hydrologic Model
idmloggermodule::idm_export Interface Reference
Collaboration diagram for idmloggermodule::idm_export:
Collaboration graph

Private Member Functions

subroutine idm_export_int1d (p_mem, varname, mempath, shapestr, iout)
 Create export file int1d. More...
 
subroutine idm_export_int2d (p_mem, varname, mempath, shapestr, iout)
 Create export file int2d. More...
 
subroutine idm_export_int3d (p_mem, varname, mempath, shapestr, iout)
 Create export file int3d. More...
 
subroutine idm_export_dbl1d (p_mem, varname, mempath, shapestr, iout)
 Create export file dbl1d. More...
 
subroutine idm_export_dbl2d (p_mem, varname, mempath, shapestr, iout)
 Create export file dbl2d. More...
 
subroutine idm_export_dbl3d (p_mem, varname, mempath, shapestr, iout)
 Create export file dbl3d. More...
 

Detailed Description

Definition at line 33 of file IdmLogger.f90.

Member Function/Subroutine Documentation

◆ idm_export_dbl1d()

subroutine idmloggermodule::idm_export::idm_export_dbl1d ( real(dp), dimension(:), intent(in), contiguous  p_mem,
character(len=*), intent(in)  varname,
character(len=*), intent(in)  mempath,
character(len=*), intent(in)  shapestr,
integer(i4b), intent(in)  iout 
)
private

export layered dbl1d parameters with NODES shape

Parameters
[in]p_mem1d dbl array
[in]varnamevariable name
[in]mempathvariable memory path
[in]shapestrdfn shape string

Definition at line 534 of file IdmLogger.f90.

537  real(DP), dimension(:), contiguous, intent(in) :: p_mem !< 1d dbl array
538  character(len=*), intent(in) :: varname !< variable name
539  character(len=*), intent(in) :: mempath !< variable memory path
540  character(len=*), intent(in) :: shapestr !< dfn shape string
541  integer(I4B), intent(in) :: iout
542  ! -- dummy
543  integer(I4B), dimension(:), pointer, contiguous :: model_shape
544  real(DP), dimension(:, :, :), pointer, contiguous :: dbl3d
545  real(DP), dimension(:, :), pointer, contiguous :: dbl2d
546  integer(I4B), dimension(3) :: dis3d_shape
547  integer(I4B), dimension(2) :: dis2d_shape
548  integer(I4B), pointer :: distype
549  character(LENMEMPATH) :: input_mempath
550  character(LENCOMPONENTNAME) :: comp, subcomp
551  integer(I4B) :: i, j, k, inunit, export_dim
552  logical(LGP) :: is_layered
553  !
554  ! -- set pointer to DISENUM and MODEL_SHAPE
555  call split_mem_path(mempath, comp, subcomp)
556  input_mempath = create_mem_path(component=comp, context=idm_context)
557  call mem_setptr(distype, 'DISENUM', input_mempath)
558  call mem_setptr(model_shape, 'MODEL_SHAPE', input_mempath)
559  !
560  ! -- set export_dim
561  export_dim = distype_export_dim(distype, shapestr, is_layered)
562  !
563  ! -- create export file(s)
564  select case (export_dim)
565  case (3)
566  ! -- set reshape array
567  dis3d_shape(1) = model_shape(3)
568  dis3d_shape(2) = model_shape(2)
569  ! -- allocate and reshape
570  dis3d_shape(3) = model_shape(1)
571  allocate (dbl3d(dis3d_shape(1), dis3d_shape(2), dis3d_shape(3)))
572  dbl3d = reshape(p_mem, dis3d_shape)
573  do k = 1, dis3d_shape(3)
574  ! -- write export files 3D array
575  inunit = create_export_file(varname, mempath, k, iout)
576  do i = 1, model_shape(2)
577  write (inunit, '(*(G0.10, " "))') (dbl3d(j, i, k), j=1, &
578  dis3d_shape(1))
579  end do
580  close (inunit)
581  end do
582  ! -- cleanup
583  deallocate (dbl3d)
584  case (2)
585  ! -- set reshape array
586  dis2d_shape(1) = model_shape(2)
587  dis2d_shape(2) = model_shape(1)
588  ! -- allocate and reshape
589  allocate (dbl2d(dis2d_shape(1), dis2d_shape(2)))
590  dbl2d = reshape(p_mem, dis2d_shape)
591  if (is_layered) then
592  ! -- write layered export files 2D array
593  do i = 1, dis2d_shape(2)
594  inunit = create_export_file(varname, mempath, i, iout)
595  write (inunit, '(*(G0.10, " "))') (dbl2d(j, i), j=1, dis2d_shape(1))
596  close (inunit)
597  end do
598  else
599  ! -- write export file 2D array
600  inunit = create_export_file(varname, mempath, 0, iout)
601  do i = 1, dis2d_shape(2)
602  write (inunit, '(*(G0.10, " "))') (dbl2d(j, i), j=1, dis2d_shape(1))
603  end do
604  close (inunit)
605  end if
606  ! -- cleanup
607  deallocate (dbl2d)
608  case (1)
609  ! -- write export file 1D array
610  inunit = create_export_file(varname, mempath, 0, iout)
611  write (inunit, '(*(G0.10, " "))') p_mem
612  close (inunit)
613  case default
614  write (errmsg, '(a,i0)') 'EXPORT unsupported dbl1d export_dim=', &
615  export_dim
616  call store_error(errmsg, .true.)
617  end select
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
subroutine split_mem_path(mem_path, component, subcomponent)
Split the memory path into component(s)
Here is the call graph for this function:

◆ idm_export_dbl2d()

subroutine idmloggermodule::idm_export::idm_export_dbl2d ( real(dp), dimension(:, :), intent(in), contiguous  p_mem,
character(len=*), intent(in)  varname,
character(len=*), intent(in)  mempath,
character(len=*), intent(in)  shapestr,
integer(i4b), intent(in)  iout 
)
private
Parameters
[in]p_mem2d dbl array
[in]varnamevariable name
[in]mempathvariable memory path
[in]shapestrdfn shape string

Definition at line 622 of file IdmLogger.f90.

625  real(DP), dimension(:, :), contiguous, intent(in) :: p_mem !< 2d dbl array
626  character(len=*), intent(in) :: varname !< variable name
627  character(len=*), intent(in) :: mempath !< variable memory path
628  character(len=*), intent(in) :: shapestr !< dfn shape string
629  integer(I4B), intent(in) :: iout
630  ! -- dummy
631  integer(I4B), dimension(:), pointer, contiguous :: model_shape
632  integer(I4B), pointer :: distype
633  character(LENMEMPATH) :: input_mempath
634  character(LENCOMPONENTNAME) :: comp, subcomp
635  integer(I4B) :: i, j, inunit, export_dim
636  logical(LGP) :: is_layered
637  !
638  ! -- set pointer to DISENUM
639  call split_mem_path(mempath, comp, subcomp)
640  input_mempath = create_mem_path(component=comp, context=idm_context)
641  call mem_setptr(distype, 'DISENUM', input_mempath)
642  call mem_setptr(model_shape, 'MODEL_SHAPE', input_mempath)
643  !
644  ! -- set export_dim
645  export_dim = distype_export_dim(distype, shapestr, is_layered)
646  !
647  select case (export_dim)
648  case (1)
649  ! -- write export file 1D array
650  inunit = create_export_file(varname, mempath, 0, iout)
651  do i = 1, size(p_mem, dim=2)
652  write (inunit, '(*(G0.10, " "))') (p_mem(j, i), j=1, size(p_mem, dim=1))
653  end do
654  close (inunit)
655  case (2)
656  if (is_layered) then
657  ! -- write layered export files 2D array
658  do i = 1, size(p_mem, dim=2)
659  inunit = create_export_file(varname, mempath, i, iout)
660  write (inunit, '(*(G0.10, " "))') (p_mem(j, i), j=1, size(p_mem, dim=1))
661  close (inunit)
662  end do
663  else
664  ! -- write export file 2D array
665  inunit = create_export_file(varname, mempath, 0, iout)
666  do i = 1, size(p_mem, dim=2)
667  write (inunit, '(*(G0.10, " "))') (p_mem(j, i), j=1, size(p_mem, dim=1))
668  end do
669  close (inunit)
670  end if
671  case default
672  write (errmsg, '(a,i0)') 'EXPORT unsupported dbl2d export_dim=', &
673  export_dim
674  call store_error(errmsg, .true.)
675  end select
Here is the call graph for this function:

◆ idm_export_dbl3d()

subroutine idmloggermodule::idm_export::idm_export_dbl3d ( real(dp), dimension(:, :, :), intent(in), contiguous  p_mem,
character(len=*), intent(in)  varname,
character(len=*), intent(in)  mempath,
character(len=*), intent(in)  shapestr,
integer(i4b), intent(in)  iout 
)
private
Parameters
[in]p_mem2d dbl array
[in]varnamevariable name
[in]mempathvariable memory path
[in]shapestrdfn shape string

Definition at line 680 of file IdmLogger.f90.

683  real(DP), dimension(:, :, :), contiguous, intent(in) :: p_mem !< 2d dbl array
684  character(len=*), intent(in) :: varname !< variable name
685  character(len=*), intent(in) :: mempath !< variable memory path
686  character(len=*), intent(in) :: shapestr !< dfn shape string
687  integer(I4B), intent(in) :: iout
688  ! -- dummy
689  integer(I4B), dimension(:), pointer, contiguous :: model_shape
690  integer(I4B), pointer :: distype
691  character(LENMEMPATH) :: input_mempath
692  character(LENCOMPONENTNAME) :: comp, subcomp
693  integer(I4B) :: i, j, k, inunit, export_dim
694  logical(LGP) :: is_layered
695  !
696  ! -- set pointer to DISENUM
697  call split_mem_path(mempath, comp, subcomp)
698  input_mempath = create_mem_path(component=comp, context=idm_context)
699  call mem_setptr(distype, 'DISENUM', input_mempath)
700  call mem_setptr(model_shape, 'MODEL_SHAPE', input_mempath)
701  !
702  ! -- set export_dim
703  export_dim = distype_export_dim(distype, shapestr, is_layered)
704  !
705  select case (export_dim)
706  case (3)
707  ! -- write export files 3D array
708  do k = 1, size(p_mem, dim=3)
709  inunit = create_export_file(varname, mempath, k, iout)
710  do i = 1, size(p_mem, dim=2)
711  write (inunit, '(*(G0.10, " "))') (p_mem(j, i, k), j=1, &
712  size(p_mem, dim=1))
713  end do
714  close (inunit)
715  end do
716  case default
717  write (errmsg, '(a,i0)') 'EXPORT unsupported dbl3d export_dim=', &
718  export_dim
719  call store_error(errmsg, .true.)
720  end select
Here is the call graph for this function:

◆ idm_export_int1d()

subroutine idmloggermodule::idm_export::idm_export_int1d ( integer(i4b), dimension(:), intent(in), contiguous  p_mem,
character(len=*), intent(in)  varname,
character(len=*), intent(in)  mempath,
character(len=*), intent(in)  shapestr,
integer(i4b), intent(in)  iout 
)
private

export layered int1d parameter files

Parameters
[in]p_mem1d integer array
[in]varnamevariable name
[in]mempathvariable memory path
[in]shapestrdfn shape string

Definition at line 341 of file IdmLogger.f90.

344  integer(I4B), dimension(:), contiguous, intent(in) :: p_mem !< 1d integer array
345  character(len=*), intent(in) :: varname !< variable name
346  character(len=*), intent(in) :: mempath !< variable memory path
347  character(len=*), intent(in) :: shapestr !< dfn shape string
348  integer(I4B), intent(in) :: iout
349  ! -- dummy
350  integer(I4B), dimension(:), pointer, contiguous :: model_shape
351  integer(I4B), dimension(:, :, :), pointer, contiguous :: int3d
352  integer(I4B), dimension(:, :), pointer, contiguous :: int2d
353  integer(I4B), dimension(3) :: dis3d_shape
354  integer(I4B), dimension(2) :: dis2d_shape
355  integer(I4B), pointer :: distype
356  character(LENMEMPATH) :: input_mempath
357  character(LENCOMPONENTNAME) :: comp, subcomp
358  integer(I4B) :: i, j, k, inunit, export_dim
359  logical(LGP) :: is_layered
360  !
361  ! -- set pointer to DISENUM and MODEL_SHAPE
362  call split_mem_path(mempath, comp, subcomp)
363  input_mempath = create_mem_path(component=comp, context=idm_context)
364  call mem_setptr(distype, 'DISENUM', input_mempath)
365  call mem_setptr(model_shape, 'MODEL_SHAPE', input_mempath)
366  !
367  ! -- set export_dim
368  export_dim = distype_export_dim(distype, shapestr, is_layered)
369  !
370  ! -- create export file(s)
371  select case (export_dim)
372  case (3)
373  ! -- set reshape array
374  dis3d_shape(1) = model_shape(3)
375  dis3d_shape(2) = model_shape(2)
376  dis3d_shape(3) = model_shape(1)
377  ! -- allocate and reshape
378  allocate (int3d(dis3d_shape(1), dis3d_shape(2), dis3d_shape(3)))
379  int3d = reshape(p_mem, dis3d_shape)
380  ! -- write export files 3D array
381  do k = 1, dis3d_shape(3)
382  inunit = create_export_file(varname, mempath, k, iout)
383  do i = 1, model_shape(2)
384  write (inunit, '(*(i0, " "))') (int3d(j, i, k), j=1, &
385  dis3d_shape(1))
386  end do
387  close (inunit)
388  end do
389  ! -- cleanup
390  deallocate (int3d)
391  case (2)
392  ! -- set reshape array
393  dis2d_shape(1) = model_shape(2)
394  dis2d_shape(2) = model_shape(1)
395  ! -- allocate and reshape
396  allocate (int2d(dis2d_shape(1), dis2d_shape(2)))
397  int2d = reshape(p_mem, dis2d_shape)
398  if (is_layered) then
399  ! -- write layered export files 2D array
400  do i = 1, dis2d_shape(2)
401  inunit = create_export_file(varname, mempath, i, iout)
402  write (inunit, '(*(i0, " "))') (int2d(j, i), j=1, dis2d_shape(1))
403  close (inunit)
404  end do
405  else
406  ! -- write export file 2D array
407  inunit = create_export_file(varname, mempath, 0, iout)
408  do i = 1, dis2d_shape(2)
409  write (inunit, '(*(i0, " "))') (int2d(j, i), j=1, dis2d_shape(1))
410  end do
411  close (inunit)
412  end if
413  ! -- cleanup
414  deallocate (int2d)
415  case (1)
416  ! -- write export file 1D array
417  inunit = create_export_file(varname, mempath, 0, iout)
418  write (inunit, '(*(i0, " "))') p_mem
419  close (inunit)
420  case default
421  write (errmsg, '(a,i0)') 'EXPORT unsupported int1d export_dim=', &
422  export_dim
423  call store_error(errmsg, .true.)
424  end select
Here is the call graph for this function:

◆ idm_export_int2d()

subroutine idmloggermodule::idm_export::idm_export_int2d ( integer(i4b), dimension(:, :), intent(in), contiguous  p_mem,
character(len=*), intent(in)  varname,
character(len=*), intent(in)  mempath,
character(len=*), intent(in)  shapestr,
integer(i4b), intent(in)  iout 
)
private
Parameters
[in]p_mem2d dbl array
[in]varnamevariable name
[in]mempathvariable memory path
[in]shapestrdfn shape string

Definition at line 429 of file IdmLogger.f90.

432  integer(I4B), dimension(:, :), contiguous, intent(in) :: p_mem !< 2d dbl array
433  character(len=*), intent(in) :: varname !< variable name
434  character(len=*), intent(in) :: mempath !< variable memory path
435  character(len=*), intent(in) :: shapestr !< dfn shape string
436  integer(I4B), intent(in) :: iout
437  ! -- dummy
438  integer(I4B), dimension(:), pointer, contiguous :: model_shape
439  integer(I4B), pointer :: distype
440  character(LENMEMPATH) :: input_mempath
441  character(LENCOMPONENTNAME) :: comp, subcomp
442  integer(I4B) :: i, j, inunit, export_dim
443  logical(LGP) :: is_layered
444  !
445  ! -- set pointer to DISENUM
446  call split_mem_path(mempath, comp, subcomp)
447  input_mempath = create_mem_path(component=comp, context=idm_context)
448  call mem_setptr(distype, 'DISENUM', input_mempath)
449  call mem_setptr(model_shape, 'MODEL_SHAPE', input_mempath)
450  !
451  ! -- set export_dim
452  export_dim = distype_export_dim(distype, shapestr, is_layered)
453  !
454  select case (export_dim)
455  case (1)
456  ! -- write export file 1D array
457  inunit = create_export_file(varname, mempath, 0, iout)
458  do i = 1, size(p_mem, dim=2)
459  write (inunit, '(*(i0, " "))') (p_mem(j, i), j=1, size(p_mem, dim=1))
460  end do
461  close (inunit)
462  case (2)
463  if (is_layered) then
464  ! -- write layered export files 2D array
465  do i = 1, size(p_mem, dim=2)
466  inunit = create_export_file(varname, mempath, i, iout)
467  write (inunit, '(*(i0, " "))') (p_mem(j, i), j=1, size(p_mem, dim=1))
468  close (inunit)
469  end do
470  else
471  ! -- write export file 2D array
472  inunit = create_export_file(varname, mempath, 0, iout)
473  do i = 1, size(p_mem, dim=2)
474  write (inunit, '(*(i0, " "))') (p_mem(j, i), j=1, size(p_mem, dim=1))
475  end do
476  close (inunit)
477  end if
478  case default
479  write (errmsg, '(a,i0)') 'EXPORT unsupported int2d export_dim=', &
480  export_dim
481  call store_error(errmsg, .true.)
482  end select
Here is the call graph for this function:

◆ idm_export_int3d()

subroutine idmloggermodule::idm_export::idm_export_int3d ( integer(i4b), dimension(:, :, :), intent(in), contiguous  p_mem,
character(len=*), intent(in)  varname,
character(len=*), intent(in)  mempath,
character(len=*), intent(in)  shapestr,
integer(i4b), intent(in)  iout 
)
private
Parameters
[in]p_mem2d dbl array
[in]varnamevariable name
[in]mempathvariable memory path
[in]shapestrdfn shape string

Definition at line 487 of file IdmLogger.f90.

490  integer(I4B), dimension(:, :, :), contiguous, intent(in) :: p_mem !< 2d dbl array
491  character(len=*), intent(in) :: varname !< variable name
492  character(len=*), intent(in) :: mempath !< variable memory path
493  character(len=*), intent(in) :: shapestr !< dfn shape string
494  integer(I4B), intent(in) :: iout
495  ! -- dummy
496  integer(I4B), dimension(:), pointer, contiguous :: model_shape
497  integer(I4B), pointer :: distype
498  character(LENMEMPATH) :: input_mempath
499  character(LENCOMPONENTNAME) :: comp, subcomp
500  integer(I4B) :: i, j, k, inunit, export_dim
501  logical(LGP) :: is_layered
502  !
503  ! -- set pointer to DISENUM
504  call split_mem_path(mempath, comp, subcomp)
505  input_mempath = create_mem_path(component=comp, context=idm_context)
506  call mem_setptr(distype, 'DISENUM', input_mempath)
507  call mem_setptr(model_shape, 'MODEL_SHAPE', input_mempath)
508  !
509  ! -- set export_dim
510  export_dim = distype_export_dim(distype, shapestr, is_layered)
511  !
512  select case (export_dim)
513  case (3)
514  ! -- write export files 3D array
515  do k = 1, size(p_mem, dim=3)
516  inunit = create_export_file(varname, mempath, k, iout)
517  do i = 1, size(p_mem, dim=2)
518  write (inunit, '(*(i0, " "))') (p_mem(j, i, k), j=1, size(p_mem, dim=1))
519  end do
520  close (inunit)
521  end do
522  case default
523  write (errmsg, '(a,i0)') 'EXPORT unsupported int3d export_dim=', &
524  export_dim
525  call store_error(errmsg, .true.)
526  end select
Here is the call graph for this function:

The documentation for this interface was generated from the following file: