MODFLOW 6  version 6.7.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 516 of file IdmLogger.f90.

519  real(DP), dimension(:), contiguous, intent(in) :: p_mem !< 1d dbl array
520  character(len=*), intent(in) :: varname !< variable name
521  character(len=*), intent(in) :: mempath !< variable memory path
522  character(len=*), intent(in) :: shapestr !< dfn shape string
523  integer(I4B), intent(in) :: iout
524  integer(I4B), dimension(:), pointer, contiguous :: model_shape
525  real(DP), dimension(:, :, :), pointer, contiguous :: dbl3d
526  real(DP), dimension(:, :), pointer, contiguous :: dbl2d
527  integer(I4B), dimension(3) :: dis3d_shape
528  integer(I4B), dimension(2) :: dis2d_shape
529  integer(I4B), pointer :: distype
530  character(LENMEMPATH) :: input_mempath
531  character(LENCOMPONENTNAME) :: comp, subcomp
532  integer(I4B) :: i, j, k, inunit, export_dim
533  logical(LGP) :: is_layered
534 
535  ! set pointer to DISENUM and MODEL_SHAPE
536  call split_mem_path(mempath, comp, subcomp)
537  input_mempath = create_mem_path(component=comp, context=idm_context)
538  call mem_setptr(distype, 'DISENUM', input_mempath)
539  call mem_setptr(model_shape, 'MODEL_SHAPE', input_mempath)
540 
541  ! set export_dim
542  export_dim = distype_export_dim(distype, shapestr, is_layered)
543 
544  ! create export file(s)
545  select case (export_dim)
546  case (3)
547  ! set reshape array
548  dis3d_shape(1) = model_shape(3)
549  dis3d_shape(2) = model_shape(2)
550  ! allocate and reshape
551  dis3d_shape(3) = model_shape(1)
552  allocate (dbl3d(dis3d_shape(1), dis3d_shape(2), dis3d_shape(3)))
553  dbl3d = reshape(p_mem, dis3d_shape)
554  do k = 1, dis3d_shape(3)
555  ! write export files 3D array
556  inunit = create_export_file(varname, mempath, k, iout)
557  do i = 1, model_shape(2)
558  write (inunit, '(*(G0.10, " "))') (dbl3d(j, i, k), j=1, &
559  dis3d_shape(1))
560  end do
561  close (inunit)
562  end do
563  ! cleanup
564  deallocate (dbl3d)
565  case (2)
566  ! set reshape array
567  dis2d_shape(1) = model_shape(2)
568  dis2d_shape(2) = model_shape(1)
569  ! allocate and reshape
570  allocate (dbl2d(dis2d_shape(1), dis2d_shape(2)))
571  dbl2d = reshape(p_mem, dis2d_shape)
572  if (is_layered) then
573  ! write layered export files 2D array
574  do i = 1, dis2d_shape(2)
575  inunit = create_export_file(varname, mempath, i, iout)
576  write (inunit, '(*(G0.10, " "))') (dbl2d(j, i), j=1, dis2d_shape(1))
577  close (inunit)
578  end do
579  else
580  ! write export file 2D array
581  inunit = create_export_file(varname, mempath, 0, iout)
582  do i = 1, dis2d_shape(2)
583  write (inunit, '(*(G0.10, " "))') (dbl2d(j, i), j=1, dis2d_shape(1))
584  end do
585  close (inunit)
586  end if
587  ! cleanup
588  deallocate (dbl2d)
589  case (1)
590  ! write export file 1D array
591  inunit = create_export_file(varname, mempath, 0, iout)
592  write (inunit, '(*(G0.10, " "))') p_mem
593  close (inunit)
594  case default
595  write (errmsg, '(a,i0)') 'EXPORT unsupported dbl1d export_dim=', &
596  export_dim
597  call store_error(errmsg, .true.)
598  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 603 of file IdmLogger.f90.

606  real(DP), dimension(:, :), contiguous, intent(in) :: p_mem !< 2d dbl array
607  character(len=*), intent(in) :: varname !< variable name
608  character(len=*), intent(in) :: mempath !< variable memory path
609  character(len=*), intent(in) :: shapestr !< dfn shape string
610  integer(I4B), intent(in) :: iout
611  integer(I4B), dimension(:), pointer, contiguous :: model_shape
612  integer(I4B), pointer :: distype
613  character(LENMEMPATH) :: input_mempath
614  character(LENCOMPONENTNAME) :: comp, subcomp
615  integer(I4B) :: i, j, inunit, export_dim
616  logical(LGP) :: is_layered
617 
618  ! set pointer to DISENUM
619  call split_mem_path(mempath, comp, subcomp)
620  input_mempath = create_mem_path(component=comp, context=idm_context)
621  call mem_setptr(distype, 'DISENUM', input_mempath)
622  call mem_setptr(model_shape, 'MODEL_SHAPE', input_mempath)
623 
624  ! set export_dim
625  export_dim = distype_export_dim(distype, shapestr, is_layered)
626 
627  select case (export_dim)
628  case (1)
629  ! write export file 1D array
630  inunit = create_export_file(varname, mempath, 0, iout)
631  do i = 1, size(p_mem, dim=2)
632  write (inunit, '(*(G0.10, " "))') (p_mem(j, i), j=1, size(p_mem, dim=1))
633  end do
634  close (inunit)
635  case (2)
636  if (is_layered) then
637  ! write layered export files 2D array
638  do i = 1, size(p_mem, dim=2)
639  inunit = create_export_file(varname, mempath, i, iout)
640  write (inunit, '(*(G0.10, " "))') (p_mem(j, i), j=1, size(p_mem, dim=1))
641  close (inunit)
642  end do
643  else
644  ! write export file 2D array
645  inunit = create_export_file(varname, mempath, 0, iout)
646  do i = 1, size(p_mem, dim=2)
647  write (inunit, '(*(G0.10, " "))') (p_mem(j, i), j=1, size(p_mem, dim=1))
648  end do
649  close (inunit)
650  end if
651  case default
652  write (errmsg, '(a,i0)') 'EXPORT unsupported dbl2d export_dim=', &
653  export_dim
654  call store_error(errmsg, .true.)
655  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 660 of file IdmLogger.f90.

663  real(DP), dimension(:, :, :), contiguous, intent(in) :: p_mem !< 2d dbl array
664  character(len=*), intent(in) :: varname !< variable name
665  character(len=*), intent(in) :: mempath !< variable memory path
666  character(len=*), intent(in) :: shapestr !< dfn shape string
667  integer(I4B), intent(in) :: iout
668  integer(I4B), dimension(:), pointer, contiguous :: model_shape
669  integer(I4B), pointer :: distype
670  character(LENMEMPATH) :: input_mempath
671  character(LENCOMPONENTNAME) :: comp, subcomp
672  integer(I4B) :: i, j, k, inunit, export_dim
673  logical(LGP) :: is_layered
674 
675  ! set pointer to DISENUM
676  call split_mem_path(mempath, comp, subcomp)
677  input_mempath = create_mem_path(component=comp, context=idm_context)
678  call mem_setptr(distype, 'DISENUM', input_mempath)
679  call mem_setptr(model_shape, 'MODEL_SHAPE', input_mempath)
680 
681  ! set export_dim
682  export_dim = distype_export_dim(distype, shapestr, is_layered)
683 
684  select case (export_dim)
685  case (3)
686  ! write export files 3D array
687  do k = 1, size(p_mem, dim=3)
688  inunit = create_export_file(varname, mempath, k, iout)
689  do i = 1, size(p_mem, dim=2)
690  write (inunit, '(*(G0.10, " "))') (p_mem(j, i, k), j=1, &
691  size(p_mem, dim=1))
692  end do
693  close (inunit)
694  end do
695  case default
696  write (errmsg, '(a,i0)') 'EXPORT unsupported dbl3d export_dim=', &
697  export_dim
698  call store_error(errmsg, .true.)
699  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 326 of file IdmLogger.f90.

329  integer(I4B), dimension(:), contiguous, intent(in) :: p_mem !< 1d integer array
330  character(len=*), intent(in) :: varname !< variable name
331  character(len=*), intent(in) :: mempath !< variable memory path
332  character(len=*), intent(in) :: shapestr !< dfn shape string
333  integer(I4B), intent(in) :: iout
334  integer(I4B), dimension(:), pointer, contiguous :: model_shape
335  integer(I4B), dimension(:, :, :), pointer, contiguous :: int3d
336  integer(I4B), dimension(:, :), pointer, contiguous :: int2d
337  integer(I4B), dimension(3) :: dis3d_shape
338  integer(I4B), dimension(2) :: dis2d_shape
339  integer(I4B), pointer :: distype
340  character(LENMEMPATH) :: input_mempath
341  character(LENCOMPONENTNAME) :: comp, subcomp
342  integer(I4B) :: i, j, k, inunit, export_dim
343  logical(LGP) :: is_layered
344 
345  ! set pointer to DISENUM and MODEL_SHAPE
346  call split_mem_path(mempath, comp, subcomp)
347  input_mempath = create_mem_path(component=comp, context=idm_context)
348  call mem_setptr(distype, 'DISENUM', input_mempath)
349  call mem_setptr(model_shape, 'MODEL_SHAPE', input_mempath)
350 
351  ! set export_dim
352  export_dim = distype_export_dim(distype, shapestr, is_layered)
353 
354  ! create export file(s)
355  select case (export_dim)
356  case (3)
357  ! set reshape array
358  dis3d_shape(1) = model_shape(3)
359  dis3d_shape(2) = model_shape(2)
360  dis3d_shape(3) = model_shape(1)
361  ! allocate and reshape
362  allocate (int3d(dis3d_shape(1), dis3d_shape(2), dis3d_shape(3)))
363  int3d = reshape(p_mem, dis3d_shape)
364  ! write export files 3D array
365  do k = 1, dis3d_shape(3)
366  inunit = create_export_file(varname, mempath, k, iout)
367  do i = 1, model_shape(2)
368  write (inunit, '(*(i0, " "))') (int3d(j, i, k), j=1, &
369  dis3d_shape(1))
370  end do
371  close (inunit)
372  end do
373  ! cleanup
374  deallocate (int3d)
375  case (2)
376  ! set reshape array
377  dis2d_shape(1) = model_shape(2)
378  dis2d_shape(2) = model_shape(1)
379  ! allocate and reshape
380  allocate (int2d(dis2d_shape(1), dis2d_shape(2)))
381  int2d = reshape(p_mem, dis2d_shape)
382  if (is_layered) then
383  ! write layered export files 2D array
384  do i = 1, dis2d_shape(2)
385  inunit = create_export_file(varname, mempath, i, iout)
386  write (inunit, '(*(i0, " "))') (int2d(j, i), j=1, dis2d_shape(1))
387  close (inunit)
388  end do
389  else
390  ! write export file 2D array
391  inunit = create_export_file(varname, mempath, 0, iout)
392  do i = 1, dis2d_shape(2)
393  write (inunit, '(*(i0, " "))') (int2d(j, i), j=1, dis2d_shape(1))
394  end do
395  close (inunit)
396  end if
397  ! cleanup
398  deallocate (int2d)
399  case (1)
400  ! write export file 1D array
401  inunit = create_export_file(varname, mempath, 0, iout)
402  write (inunit, '(*(i0, " "))') p_mem
403  close (inunit)
404  case default
405  write (errmsg, '(a,i0)') 'EXPORT unsupported int1d export_dim=', &
406  export_dim
407  call store_error(errmsg, .true.)
408  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 413 of file IdmLogger.f90.

416  integer(I4B), dimension(:, :), contiguous, intent(in) :: p_mem !< 2d dbl array
417  character(len=*), intent(in) :: varname !< variable name
418  character(len=*), intent(in) :: mempath !< variable memory path
419  character(len=*), intent(in) :: shapestr !< dfn shape string
420  integer(I4B), intent(in) :: iout
421  integer(I4B), dimension(:), pointer, contiguous :: model_shape
422  integer(I4B), pointer :: distype
423  character(LENMEMPATH) :: input_mempath
424  character(LENCOMPONENTNAME) :: comp, subcomp
425  integer(I4B) :: i, j, inunit, export_dim
426  logical(LGP) :: is_layered
427 
428  ! set pointer to DISENUM
429  call split_mem_path(mempath, comp, subcomp)
430  input_mempath = create_mem_path(component=comp, context=idm_context)
431  call mem_setptr(distype, 'DISENUM', input_mempath)
432  call mem_setptr(model_shape, 'MODEL_SHAPE', input_mempath)
433 
434  ! set export_dim
435  export_dim = distype_export_dim(distype, shapestr, is_layered)
436 
437  select case (export_dim)
438  case (1)
439  ! write export file 1D array
440  inunit = create_export_file(varname, mempath, 0, iout)
441  do i = 1, size(p_mem, dim=2)
442  write (inunit, '(*(i0, " "))') (p_mem(j, i), j=1, size(p_mem, dim=1))
443  end do
444  close (inunit)
445  case (2)
446  if (is_layered) then
447  ! write layered export files 2D array
448  do i = 1, size(p_mem, dim=2)
449  inunit = create_export_file(varname, mempath, i, iout)
450  write (inunit, '(*(i0, " "))') (p_mem(j, i), j=1, size(p_mem, dim=1))
451  close (inunit)
452  end do
453  else
454  ! write export file 2D array
455  inunit = create_export_file(varname, mempath, 0, iout)
456  do i = 1, size(p_mem, dim=2)
457  write (inunit, '(*(i0, " "))') (p_mem(j, i), j=1, size(p_mem, dim=1))
458  end do
459  close (inunit)
460  end if
461  case default
462  write (errmsg, '(a,i0)') 'EXPORT unsupported int2d export_dim=', &
463  export_dim
464  call store_error(errmsg, .true.)
465  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 470 of file IdmLogger.f90.

473  integer(I4B), dimension(:, :, :), contiguous, intent(in) :: p_mem !< 2d dbl array
474  character(len=*), intent(in) :: varname !< variable name
475  character(len=*), intent(in) :: mempath !< variable memory path
476  character(len=*), intent(in) :: shapestr !< dfn shape string
477  integer(I4B), intent(in) :: iout
478  integer(I4B), dimension(:), pointer, contiguous :: model_shape
479  integer(I4B), pointer :: distype
480  character(LENMEMPATH) :: input_mempath
481  character(LENCOMPONENTNAME) :: comp, subcomp
482  integer(I4B) :: i, j, k, inunit, export_dim
483  logical(LGP) :: is_layered
484 
485  ! set pointer to DISENUM
486  call split_mem_path(mempath, comp, subcomp)
487  input_mempath = create_mem_path(component=comp, context=idm_context)
488  call mem_setptr(distype, 'DISENUM', input_mempath)
489  call mem_setptr(model_shape, 'MODEL_SHAPE', input_mempath)
490 
491  ! set export_dim
492  export_dim = distype_export_dim(distype, shapestr, is_layered)
493 
494  select case (export_dim)
495  case (3)
496  ! write export files 3D array
497  do k = 1, size(p_mem, dim=3)
498  inunit = create_export_file(varname, mempath, k, iout)
499  do i = 1, size(p_mem, dim=2)
500  write (inunit, '(*(i0, " "))') (p_mem(j, i, k), j=1, size(p_mem, dim=1))
501  end do
502  close (inunit)
503  end do
504  case default
505  write (errmsg, '(a,i0)') 'EXPORT unsupported int3d export_dim=', &
506  export_dim
507  call store_error(errmsg, .true.)
508  end select
Here is the call graph for this function:

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