source: XIOS/trunk/src/interface/fortran/ifield.F90 @ 549

Last change on this file since 549 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: 2.4 KB
Line 
1#include "xios_fortran_prefix.hpp"
2
3MODULE IFIELD
4   USE, INTRINSIC :: ISO_C_BINDING
5   USE FIELD_INTERFACE
6   USE FIELDGROUP_INTERFACE
7!   USE IFIELD_ATTR
8!   USE IFIELDGROUP_ATTR
9   USE IDURATION
10   
11   TYPE txios(field)
12      INTEGER(kind = C_INTPTR_T) :: daddr
13   END TYPE txios(field)
14   
15   TYPE txios(fieldgroup)
16      INTEGER(kind = C_INTPTR_T) :: daddr
17   END TYPE txios(fieldgroup)
18   
19   CONTAINS ! Fonctions disponibles pour les utilisateurs.
20
21   SUBROUTINE xios(get_field_handle)(idt, ret)
22      IMPLICIT NONE
23      CHARACTER(len = *), INTENT(IN)   :: idt     
24      TYPE(txios(field)), INTENT(OUT) :: ret
25      CALL cxios_field_handle_create(ret%daddr, idt, len(idt))           
26   END SUBROUTINE xios(get_field_handle)
27   
28   SUBROUTINE xios(get_fieldgroup_handle)(idt,ret)
29      IMPLICIT NONE
30      CHARACTER(len = *)     , INTENT(IN) :: idt     
31      TYPE(txios(fieldgroup)), INTENT(OUT):: ret
32
33      CALL cxios_fieldgroup_handle_create(ret%daddr, idt, len(idt))           
34
35   END SUBROUTINE xios(get_fieldgroup_handle)
36   
37
38   LOGICAL FUNCTION xios(is_valid_field)(idt)
39      IMPLICIT NONE
40      CHARACTER(len  = *)    , INTENT(IN) :: idt
41      LOGICAL  (kind = 1)                 :: val
42     
43      CALL cxios_field_valid_id(val, idt, len(idt));
44      xios(is_valid_field) = val
45
46   END FUNCTION  xios(is_valid_field)
47
48   LOGICAL FUNCTION xios(is_valid_fieldgroup)(idt)
49      IMPLICIT NONE
50      CHARACTER(len  = *)    , INTENT(IN) :: idt
51      LOGICAL  (kind = 1)                 :: val
52      CALL cxios_fieldgroup_valid_id(val, idt, len(idt));
53      xios(is_valid_fieldgroup) = val
54
55   END FUNCTION  xios(is_valid_fieldgroup)
56   
57  LOGICAL FUNCTION xios(field_is_active_id(field_id))
58      IMPLICIT NONE
59      CHARACTER(len  = *)    , INTENT(IN) :: field_id
60      LOGICAL  (kind = 1)                 :: val
61      TYPE(txios(field))                 :: field_hdl
62     
63      CALL xios(get_field_handle)(field_id,field_hdl)
64      xios(field_is_active_id)=xios(field_is_active_hdl(field_hdl))
65
66   END FUNCTION  xios(field_is_active_id)
67   
68   
69   LOGICAL FUNCTION xios(field_is_active_hdl(field_hdl))
70      IMPLICIT NONE
71      TYPE(txios(field)),INTENT(IN)       :: field_hdl
72      LOGICAL  (kind = 1)                 :: ret
73     
74      CALL cxios_field_is_active(field_hdl%daddr, ret);
75      xios(field_is_active_hdl) = ret
76     
77   END FUNCTION  xios(field_is_active_hdl) 
78 
79
80END MODULE IFIELD
Note: See TracBrowser for help on using the repository browser.