Ignore:
Timestamp:
12/17/14 11:14:05 (10 years ago)
Author:
rlacroix
Message:

Expose the calendar operations through the Fortran interface.

  • Add arithmetic operations on the xios_duration and xios_date types:
    • xios_duration + xios_duration = xios_duration
    • xios_duration - xios_duration = xios_duration
    • scalar * xios_duration = xios_duration * scalar = xios_duration
    • - xios_duration = xios_duration
    • xios_date + xios_duration = xios_date
    • xios_date - xios_duration = xios_date
    • xios_date - xios_date = xios_duration
  • Add comparison operations on the xios_duration and xios_date types:
    • xios_duration: ==, /=
    • xios_date: ==, /=, <, <=, >, >=
  • Add a new function "xios_date_convert_to_seconds" to convert a date into the number of seconds since the time origin of the calendar
  • Define some constant durations "xios_second", "xios_minute", "xios_hour", "xios_day", "xios_month", "xios_year" et "xios_timestep" to ease the definition of new durations (for example, 10h is just 10 * xios_hour)
  • Add a new function "xios_set_calendar" so that one can manually create the calendar attached to the current context and thus use the calendar operations before calling "xios_close_context_definition". This function can accept optional parameters so that the calendar attributes (calendar_type, start_date, time_origin and timestep) can be easily overwritten. Note that you cannot define a new calendar after one was already created (either because "xios_set_calendar" or "xios_close_context_definition" was used)
  • Readd the function "xios_set_timestep" as a simplified alias of "xios_set_context_attr(context, timestep)" for the current context
File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/interface/fortran/icontext.F90

    r501 r545  
    44   USE, INTRINSIC :: ISO_C_BINDING 
    55   USE CONTEXT_INTERFACE 
     6   USE IDATE 
     7   USE IDURATION 
    68!   USE icontext_attr 
    7    USE IDATE 
    89 
    9      
     10 
    1011   TYPE txios(context) 
    1112      INTEGER(kind = C_INTPTR_T) :: daddr 
    1213   END TYPE txios(context) 
    13        
    14     
     14 
     15 
    1516   CONTAINS ! Fonctions disponibles pour les utilisateurs. 
    16     
     17 
    1718   SUBROUTINE xios(get_context_handle)(idt,ret) 
    1819      IMPLICIT NONE 
    19       CHARACTER(len = *)  , INTENT(IN)  :: idt       
     20      CHARACTER(len = *)  , INTENT(IN)  :: idt 
    2021      TYPE(txios(context)), INTENT(OUT):: ret 
    2122 
    22       CALL cxios_context_handle_create(ret%daddr, idt, len(idt))             
     23      CALL cxios_context_handle_create(ret%daddr, idt, len(idt)) 
    2324   END SUBROUTINE xios(get_context_handle) 
    24     
     25 
     26   SUBROUTINE xios(get_current_context)(context) 
     27      IMPLICIT NONE 
     28 
     29      TYPE(txios(context)), INTENT(IN) :: context 
     30 
     31      CALL cxios_context_get_current(context%daddr) 
     32 
     33   END SUBROUTINE xios(get_current_context) 
     34 
    2535   SUBROUTINE xios(set_current_context)(context, withswap) 
    2636      IMPLICIT NONE 
     
    2838      TYPE(txios(context))          , INTENT(IN) :: context 
    2939      LOGICAL             , OPTIONAL, INTENT(IN) :: withswap 
    30       LOGICAL (kind = 1)                       :: wswap 
     40      LOGICAL (kind = 1)                         :: wswap 
    3141 
    3242      IF (PRESENT(withswap)) THEN 
     
    3848 
    3949   END SUBROUTINE xios(set_current_context) 
    40   
     50 
    4151   LOGICAL FUNCTION xios(is_valid_context)(idt) 
    4252      IMPLICIT NONE 
     
    4959   END FUNCTION  xios(is_valid_context) 
    5060 
    51     
     61 
    5262END MODULE ICONTEXT 
Note: See TracChangeset for help on using the changeset viewer.