Commit b9e620fa authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

mo_cdi.f90 update.

parent 7ec18a4a
......@@ -824,20 +824,20 @@ int cdiDefKeyInt(int cdiID, int varID, int key, int value);
int cdiInqKeyInt(int cdiID, int varID, int key, int *value);
// cdiDefKeyBytes: Define a bytes array from a key of a CDI variable
int cdiDefKeyBytes(int cdiID, int varID, int key, const unsigned char *bytes, int length);
int cdiDefKeyBytes(int cdiID, int varID, int key, const unsigned char bytes[], int length);
// cdiInqKeyBytes: Get a bytes array from a key of a CDI variable
int cdiInqKeyBytes(int cdiID, int varID, int key, unsigned char *bytes, int *length);
int cdiInqKeyBytes(int cdiID, int varID, int key, unsigned char bytes[], int *length);
// cdiDefKeyString: Define a string value from a key of a CDI variable
int cdiDefKeyString(int cdiID, int varID, int key, const char *string);
// cdiInqKeyLen: Get the length of the string representation of the key
int cdiInqKeyLen(int cdiID, int varID, int key, int *length);
// cdiInqKeyString: Get a string value from a key of a CDI variable
int cdiInqKeyString(int cdiID, int varID, int key, char *string, int *length);
// cdiInqKeyLen: Get the length of the string representation of the key
int cdiInqKeyLen(int cdiID, int varID, int key, int *length);
int cdiCopyKeys(int cdiID1, int varID1, int cdiID2, int varID2);
// CDI grid keys
......@@ -963,18 +963,10 @@ void gridDefReference(int gridID, const char *reference);
int gridInqReference(int gridID, char *reference);
/* gridDefUUID: Define the UUID of an unstructured grid */
#ifdef __cplusplus
void gridDefUUID(int gridID, const unsigned char *uuid);
#else
void gridDefUUID(int gridID, const unsigned char uuid[CDI_UUID_SIZE]);
#endif
/* gridInqUUID: Get the UUID of an unstructured grid */
#ifdef __cplusplus
void gridInqUUID(int gridID, unsigned char *uuid);
#else
void gridInqUUID(int gridID, unsigned char uuid[CDI_UUID_SIZE]);
#endif
/* Rotated Lon/Lat grid */
void gridDefParamRLL(int gridID, double xpole, double ypole, double angle);
......
......@@ -482,8 +482,19 @@ module mo_cdi
integer(c_int), public, parameter :: CDI_KEY_NUMBEROFFORECASTSINENSEMBLE =&
& 809
integer(c_int), public, parameter :: CDI_KEY_PERTURBATIONNUMBER = 810
integer(c_int), public, parameter :: CDI_KEY_CENTRE = 811
integer(c_int), public, parameter :: CDI_KEY_SUBCENTRE = 812
integer(c_int), public, parameter :: CDI_KEY_MPIMTYPE = 813
integer(c_int), public, parameter :: CDI_KEY_MPIMCLASS = 814
integer(c_int), public, parameter :: CDI_KEY_MPIMUSER = 815
integer(c_int), public, parameter :: CDI_KEY_REVSTATUS = 816
integer(c_int), public, parameter :: CDI_KEY_REVNUMBER = 817
public :: cdiDefKeyInt
public :: cdiInqKeyInt
public :: cdiDefKeyString
public :: cdiInqKeyString
public :: cdiInqKeyLen
public :: cdiCopyKeys
integer(c_int), public, parameter :: CDI_KEY_XNAME = 901
integer(c_int), public, parameter :: CDI_KEY_XDIMNAME = 902
integer(c_int), public, parameter :: CDI_KEY_XLONGNAME = 903
......@@ -1930,6 +1941,26 @@ module mo_cdi
integer(c_int) :: f_result
end function cdiInqKeyInt
function cdiInqKeyLen(cdiID_dummy, varID_dummy, key_dummy, length_dummy)&
& bind(c, name = 'cdiInqKeyLen') result(f_result)
import c_int
integer(c_int), value :: cdiID_dummy
integer(c_int), value :: varID_dummy
integer(c_int), value :: key_dummy
integer(c_int), intent(inout) :: length_dummy
integer(c_int) :: f_result
end function cdiInqKeyLen
function cdiCopyKeys(cdiID1_dummy, varID1_dummy, cdiID2_dummy,&
& varID2_dummy) bind(c, name = 'cdiCopyKeys') result(f_result)
import c_int
integer(c_int), value :: cdiID1_dummy
integer(c_int), value :: varID1_dummy
integer(c_int), value :: cdiID2_dummy
integer(c_int), value :: varID2_dummy
integer(c_int) :: f_result
end function cdiCopyKeys
function cdiZaxisDefKeyFlt(zaxisID_dummy, key_dummy, value_dummy) bind(c,&
& name = 'cdiZaxisDefKeyFlt') result(f_result)
import c_double, c_int
......@@ -4830,6 +4861,76 @@ contains
end if
end function gridNamePtr
function cdiDefKeyString(cdiID_dummy, varID_dummy, key_dummy, string_dummy)&
& result(f_result)
integer(c_int) :: f_result
integer(c_int), value :: cdiID_dummy
integer(c_int), value :: varID_dummy
integer(c_int), value :: key_dummy
character(kind = c_char, len = *), intent(in) :: string_dummy
character(kind = c_char) :: string_temp(len(string_dummy) + 1)
integer :: string_i
interface
function lib_cdiDefKeyString(cdiID_dummy, varID_dummy, key_dummy,&
& string_dummy) bind(c, name = 'cdiDefKeyString') result(c_result)
import c_char, c_int
integer(c_int) :: c_result
integer(c_int), value :: cdiID_dummy
integer(c_int), value :: varID_dummy
integer(c_int), value :: key_dummy
character(kind = c_char) :: string_dummy(*)
end function lib_cdiDefKeyString
end interface
do string_i = 1, len(string_dummy)
string_temp(string_i) = string_dummy(string_i:string_i)
end do
string_temp(len(string_dummy) + 1) = c_null_char
f_result = lib_cdiDefKeyString(cdiID_dummy, varID_dummy, key_dummy,&
& string_temp)
end function cdiDefKeyString
function cdiInqKeyString(cdiID_dummy, varID_dummy, key_dummy, string_dummy,&
& length_dummy) result(f_result)
integer(c_int) :: f_result
integer(c_int), value :: cdiID_dummy
integer(c_int), value :: varID_dummy
integer(c_int), value :: key_dummy
character(kind = c_char, len = *), intent(inout) :: string_dummy
integer(c_int), intent(inout) :: length_dummy
character(kind = c_char) :: string_temp(len(string_dummy) + 1)
integer :: string_i
interface
function lib_cdiInqKeyString(cdiID_dummy, varID_dummy, key_dummy,&
& string_dummy, length_dummy) bind(c, name = 'cdiInqKeyString')&
& result(c_result)
import c_char, c_int
integer(c_int) :: c_result
integer(c_int), value :: cdiID_dummy
integer(c_int), value :: varID_dummy
integer(c_int), value :: key_dummy
character(kind = c_char) :: string_dummy(*)
integer(c_int), intent(inout) :: length_dummy
end function lib_cdiInqKeyString
end interface
string_temp(len(string_dummy) + 1) = c_null_char
do string_i = len(string_dummy), 1, -1
if(string_dummy(string_i:string_i) /= ' ') exit
string_temp(string_i) = c_null_char
end do
do string_i = string_i, 1, -1
string_temp(string_i) = string_dummy(string_i:string_i)
end do
f_result = lib_cdiInqKeyString(cdiID_dummy, varID_dummy, key_dummy,&
& string_temp, length_dummy)
do string_i = 1, len(string_dummy)
if(string_temp(string_i) == c_null_char) exit
string_dummy(string_i:string_i) = string_temp(string_i)
end do
do string_i = string_i, len(string_dummy)
string_dummy(string_i:string_i) = ' '
end do
end function cdiInqKeyString
function cdiGridDefKeyStr(gridID_dummy, key_dummy, size_dummy, mesg_dummy)&
& result(f_result)
integer(c_int) :: f_result
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment