New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
fortran.c in vendors/AGRIF/dev_r11615_ENHANCE-04_namelists_as_internalfiles_agrif/LIB – NEMO

source: vendors/AGRIF/dev_r11615_ENHANCE-04_namelists_as_internalfiles_agrif/LIB/fortran.c @ 11668

Last change on this file since 11668 was 11668, checked in by acc, 5 years ago

Branch dev_r11615_ENHANCE-04_namelists_as_internalfiles_agrif. Changes to support 2019/dev_r11615_ENHANCE-04_namelists_as_internalfiles developments.
These changes enable sufficient support for allocatable, zero-dimension character variables defined using the:

CHARACTER(LEN=:), ALLOCATABLE :: cstr

syntax. This is supported by:

  1. Adding : as a valid length identifier at line 1028 in fortran.y (and then rebuilding fortran.c and main.c via make -f Makefile.lex)
  2. Adding a carrayu entry to Agrif_Variable_c type in AGRIF_FILES/modtypes.F90 where carrayu is declared as:
character(:) , allocatable
carrayu
Ensuring correct deallocation of carrayu in AGRIF_FILES/modsauv.F90 and AGRIF_FILES/modutil.F90
  • Substituting carrayu in place of carray0 declarations when character length matches : for zero-dimension variables. This occurs twice in LIB/toamr.c, e.g:
  • if (!strcasecmp(var->v_dimchar ,":") && var->v_nbdim == 0 )
    {
    sprintf (tname_2, "%% carrayu");
    } else {
    sprintf (tname_2, "%% carray%d", var->v_nbdim);
    }

    Any such character variables must be allocated by the user. Typically this is done with lines such as:

    IF ( .NOT. ALLOCATED(cdnambuff) ) ALLOCATE( CHARACTER(LEN=kleng)
    cdnambuff )

    making AGRIF accept the CHARACTER(LEN=kleng) :: construct within the ALLOCATE statement was beyond my skills. Fortunately, for the current purpose, this
    isn't necessary since such allocations only occur within utility routines in which the appropriate tabvar has been passed down. So:

    !$AGRIF_DO_NOT_TREAT

    IF ( .NOT. ALLOCATED(cdnambuff) ) ALLOCATE( CHARACTER(LEN=kleng)
    cdnambuff )
    !$AGRIF_END_DO_NOT_TREAT

    avoids the issue.

    • Property svn:keywords set to Id
    File size: 387.7 KB

    HTML preview not available, since the file size exceeds 262144 bytes. Try downloading the file instead.

    Note: See TracBrowser for help on using the repository browser.