source: XIOS/trunk/src/interface/fortran/ifile.F90 @ 932

Last change on this file since 932 was 545, checked in by rlacroix, 9 years ago

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
  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
File size: 1.6 KB
Line 
1#include "xios_fortran_prefix.hpp"
2
3MODULE IFILE
4   USE, INTRINSIC :: ISO_C_BINDING
5   USE FILE_INTERFACE
6   USE FILEGROUP_INTERFACE
7!   USE IFILE_ATTR
8!   USE IFILEGROUP_ATTR
9   USE IDURATION
10   
11   TYPE txios(file)
12      INTEGER(kind = C_INTPTR_T) :: daddr
13   END TYPE txios(file)
14   
15   TYPE txios(filegroup)
16      INTEGER(kind = C_INTPTR_T) :: daddr
17   END TYPE txios(filegroup)
18   
19   CONTAINS ! Fonctions disponibles pour les utilisateurs.
20
21   SUBROUTINE xios(get_file_handle)( idt, ret)
22      IMPLICIT NONE
23      CHARACTER(len = *),   INTENT(IN) :: idt     
24      TYPE(txios(file)) , INTENT(OUT):: ret
25
26      CALL cxios_file_handle_create(ret%daddr, idt, len(idt))           
27
28   END SUBROUTINE xios(get_file_handle)
29   
30   SUBROUTINE xios(get_filegroup_handle)(idt,ret)
31      IMPLICIT NONE
32      CHARACTER(len = *)    ,   INTENT(IN) :: idt     
33      TYPE(txios(filegroup)), INTENT(OUT):: ret
34
35      CALL cxios_filegroup_handle_create(ret%daddr, idt, len(idt))           
36
37   END SUBROUTINE xios(get_filegroup_handle)
38
39   LOGICAL FUNCTION xios(is_valid_file)(idt)
40      IMPLICIT NONE
41      CHARACTER(len  = *)    , INTENT(IN) :: idt
42      LOGICAL  (kind = 1)                 :: val
43
44      CALL cxios_file_valid_id(val, idt, len(idt));
45      xios(is_valid_file) = val
46
47   END FUNCTION  xios(is_valid_file)
48
49   LOGICAL FUNCTION xios(is_valid_filegroup)(idt)
50      IMPLICIT NONE
51      CHARACTER(len  = *)    , INTENT(IN) :: idt
52      LOGICAL  (kind = 1)                 :: val
53
54      CALL cxios_filegroup_valid_id(val, idt, len(idt));
55      xios(is_valid_filegroup) = val
56
57   END FUNCTION  xios(is_valid_filegroup)
58
59   
60END MODULE IFILE
Note: See TracBrowser for help on using the repository browser.