Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
c5255e07
Commit
c5255e07
authored
Mar 02, 2016
by
Uwe Schulzweida
Browse files
added function cdiGridDefString() and cdiGridInqString()
parent
cbbd383b
Changes
9
Hide whitespace changes
Inline
Side-by-side
doc/tex/c_quick_ref.tex
View file @
c5255e07
...
...
@@ -103,6 +103,15 @@ Define the UUID of an unstructured grid.
Define the bounds of a X-axis.
\section*
{
\tt
\htmlref
{
gridDefXdimname
}{
gridDefXdimname
}}
\begin{verbatim}
void gridDefXdimname (int gridID, const char *xdimname);
\end{verbatim}
Define the dimension name of a X-axis.
\section*
{
\tt
\htmlref
{
gridDefXlongname
}{
gridDefXlongname
}}
\begin{verbatim}
...
...
@@ -157,6 +166,15 @@ Define the values of a X-axis.
Define the bounds of a Y-axis.
\section*
{
\tt
\htmlref
{
gridDefYdimname
}{
gridDefYdimname
}}
\begin{verbatim}
void gridDefYdimname (int gridID, const char *ydimname);
\end{verbatim}
Define the dimension name of a Y-axis.
\section*
{
\tt
\htmlref
{
gridDefYlongname
}{
gridDefYlongname
}}
\begin{verbatim}
...
...
@@ -310,6 +328,15 @@ Get the UUID of an unstructured grid.
Get the bounds of a X-axis.
\section*
{
\tt
\htmlref
{
gridInqXdimname
}{
gridInqXdimname
}}
\begin{verbatim}
void gridInqXdimname (int gridID, char *xdimname);
\end{verbatim}
Get the dimension name of a X-axis.
\section*
{
\tt
\htmlref
{
gridInqXlongname
}{
gridInqXlongname
}}
\begin{verbatim}
...
...
@@ -382,6 +409,15 @@ Get all values of a X-axis.
Get the bounds of a Y-axis.
\section*
{
\tt
\htmlref
{
gridInqYdimname
}{
gridInqYdimname
}}
\begin{verbatim}
void gridInqYdimname (int gridID, char *ydimname);
\end{verbatim}
Get the dimension name of a Y-axis.
\section*
{
\tt
\htmlref
{
gridInqYlongname
}{
gridInqYlongname
}}
\begin{verbatim}
...
...
@@ -1229,6 +1265,15 @@ Get the standard name of a Variable.
Return subtype ID for a given variable..
\section*
{
\tt
\htmlref
{
vlistInqVarTsteptype
}{
vlistInqVarTsteptype
}}
\begin{verbatim}
int vlistInqVarTsteptype (int vlistID, int varID);
\end{verbatim}
Get the timestep type of a Variable.
\section*
{
\tt
\htmlref
{
vlistInqVarUnits
}{
vlistInqVarUnits
}}
\begin{verbatim}
...
...
doc/tex/f_quick_ref.tex
View file @
c5255e07
...
...
@@ -103,6 +103,15 @@ Define the UUID of an unstructured grid.
Define the bounds of a X-axis.
\section*
{
\tt
\htmlref
{
gridDefXdimname
}{
gridDefXdimname
}}
\begin{verbatim}
SUBROUTINE gridDefXdimname (INTEGER gridID, CHARACTER*(*) xdimname)
\end{verbatim}
Define the dimension name of a X-axis.
\section*
{
\tt
\htmlref
{
gridDefXlongname
}{
gridDefXlongname
}}
\begin{verbatim}
...
...
@@ -157,6 +166,15 @@ Define the values of a X-axis.
Define the bounds of a Y-axis.
\section*
{
\tt
\htmlref
{
gridDefYdimname
}{
gridDefYdimname
}}
\begin{verbatim}
SUBROUTINE gridDefYdimname (INTEGER gridID, CHARACTER*(*) ydimname)
\end{verbatim}
Define the dimension name of a Y-axis.
\section*
{
\tt
\htmlref
{
gridDefYlongname
}{
gridDefYlongname
}}
\begin{verbatim}
...
...
@@ -310,6 +328,15 @@ Get the UUID of an unstructured grid.
Get the bounds of a X-axis.
\section*
{
\tt
\htmlref
{
gridInqXdimname
}{
gridInqXdimname
}}
\begin{verbatim}
SUBROUTINE gridInqXdimname (INTEGER gridID, CHARACTER*(*) xdimname)
\end{verbatim}
Get the dimension name of a X-axis.
\section*
{
\tt
\htmlref
{
gridInqXlongname
}{
gridInqXlongname
}}
\begin{verbatim}
...
...
@@ -382,6 +409,15 @@ Get all values of a X-axis.
Get the bounds of a Y-axis.
\section*
{
\tt
\htmlref
{
gridInqYdimname
}{
gridInqYdimname
}}
\begin{verbatim}
SUBROUTINE gridInqYdimname (INTEGER gridID, CHARACTER*(*) ydimname)
\end{verbatim}
Get the dimension name of a Y-axis.
\section*
{
\tt
\htmlref
{
gridInqYlongname
}{
gridInqYlongname
}}
\begin{verbatim}
...
...
@@ -1250,6 +1286,15 @@ Get the standard name of a Variable.
Return subtype ID for a given variable..
\section*
{
\tt
\htmlref
{
vlistInqVarTsteptype
}{
vlistInqVarTsteptype
}}
\begin{verbatim}
INTEGER FUNCTION vlistInqVarTsteptype (INTEGER vlistID, INTEGER varID)
\end{verbatim}
Get the timestep type of a Variable.
\section*
{
\tt
\htmlref
{
vlistInqVarUnits
}{
vlistInqVarUnits
}}
\begin{verbatim}
...
...
src/Makefile.in
View file @
c5255e07
...
...
@@ -946,8 +946,8 @@ distclean-generic:
maintainer-clean-generic
:
@
echo
"This command is intended for maintainers to use"
@
echo
"it deletes files that may require special tools to rebuild."
@ENABLE_CDI_LIB_FALSE@uninstall-local
:
@ENABLE_CDI_LIB_FALSE@install-exec-local
:
@ENABLE_CDI_LIB_FALSE@uninstall-local
:
clean
:
clean-am
clean-am
:
clean-generic clean-libLTLIBRARIES clean-libtool
\
...
...
src/cdi.h
View file @
c5255e07
...
...
@@ -756,6 +756,22 @@ void gridDefYvals(int gridID, const double yvals[]);
/* gridInqYvals: Get all values of a Y-axis */
int
gridInqYvals
(
int
gridID
,
double
yvals
[]);
/* CDI grid string key values */
#define CDI_GRID_XNAME 901 // X-axis name
#define CDI_GRID_YNAME 902 // Y-axis name
#define CDI_GRID_XDIMNAME 903 // X-axis dimension name
#define CDI_GRID_YDIMNAME 904 // Y-axis dimension name
#define CDI_GRID_XLONGNAME 905 // X-axis longname
#define CDI_GRID_YLONGNAME 906 // Y-axis longname
#define CDI_GRID_XUNITS 907 // X-axis units
#define CDI_GRID_YUNITS 908 // Y-axis units
// cdiGridDefString: Define a CDI grid string value from a key
int
cdiGridDefString
(
int
gridID
,
int
key
,
int
size
,
const
char
*
mesg
);
// cdiGridInqString: Get a CDI grid string value from a key
int
cdiGridInqString
(
int
gridID
,
int
key
,
int
size
,
char
*
mesg
);
/* gridDefXdimname: Define the dimension name of a X-axis */
void
gridDefXdimname
(
int
gridID
,
const
char
*
xdimname
);
...
...
src/cdi.inc
View file @
c5255e07
!
This
file
was
automatically
generated
,
don
'
t
edit
!
!
!
Fortran
interface
for
CDI
library
version
1.7.
1
!
Fortran
interface
for
CDI
library
version
1.7.
2
!
!
Author
:
!
-------
!
Uwe
Schulzweida
,
MPI
-
MET
,
Hamburg
,
February
2016
!
Uwe
Schulzweida
,
MPI
-
MET
,
Hamburg
,
March
2016
!
INTEGER
CDI_MAX_NAME
...
...
@@ -1523,6 +1523,49 @@
!
DOUBLEPRECISION
yvals
(
*
))
EXTERNAL
gridInqYvals
!
!
CDI
grid
string
key
values
!
INTEGER
CDI_GRID_XNAME
PARAMETER
(
CDI_GRID_XNAME
=
901
)
INTEGER
CDI_GRID_YNAME
PARAMETER
(
CDI_GRID_YNAME
=
902
)
INTEGER
CDI_GRID_XDIMNAME
PARAMETER
(
CDI_GRID_XDIMNAME
=
903
)
INTEGER
CDI_GRID_YDIMNAME
PARAMETER
(
CDI_GRID_YDIMNAME
=
904
)
INTEGER
CDI_GRID_XLONGNAME
PARAMETER
(
CDI_GRID_XLONGNAME
=
905
)
INTEGER
CDI_GRID_YLONGNAME
PARAMETER
(
CDI_GRID_YLONGNAME
=
906
)
INTEGER
CDI_GRID_XUNITS
PARAMETER
(
CDI_GRID_XUNITS
=
907
)
INTEGER
CDI_GRID_YUNITS
PARAMETER
(
CDI_GRID_YUNITS
=
908
)
INTEGER
cdiGridDefString
!
(
INTEGER
gridID
,
!
INTEGER
key
,
!
INTEGER
size
,
!
CHARACTER
*
(
*
)
mesg
)
EXTERNAL
cdiGridDefString
INTEGER
cdiGridInqString
!
(
INTEGER
gridID
,
!
INTEGER
key
,
!
INTEGER
size
,
!
CHARACTER
*
(
*
)
mesg
)
EXTERNAL
cdiGridInqString
!
gridDefXdimname
!
(
INTEGER
gridID
,
!
CHARACTER
*
(
*
)
xdimname
)
EXTERNAL
gridDefXdimname
!
gridInqXdimname
!
(
INTEGER
gridID
,
!
CHARACTER
*
(
*
)
xdimname
)
EXTERNAL
gridInqXdimname
!
gridDefXname
!
(
INTEGER
gridID
,
!
CHARACTER
*
(
*
)
xname
)
...
...
@@ -1553,6 +1596,16 @@
!
CHARACTER
*
(
*
)
xunits
)
EXTERNAL
gridInqXunits
!
gridDefYdimname
!
(
INTEGER
gridID
,
!
CHARACTER
*
(
*
)
ydimname
)
EXTERNAL
gridDefYdimname
!
gridInqYdimname
!
(
INTEGER
gridID
,
!
CHARACTER
*
(
*
)
ydimname
)
EXTERNAL
gridInqYdimname
!
gridDefYname
!
(
INTEGER
gridID
,
!
CHARACTER
*
(
*
)
yname
)
...
...
src/cdiFortran.c
View file @
c5255e07
...
...
@@ -324,12 +324,21 @@ FCALLSCSUB2 (gridDefXvals, GRIDDEFXVALS, griddefxvals, INT, DOUBLEV)
FCALLSCFUN2
(
INT
,
gridInqXvals
,
GRIDINQXVALS
,
gridinqxvals
,
INT
,
DOUBLEV
)
FCALLSCSUB2
(
gridDefYvals
,
GRIDDEFYVALS
,
griddefyvals
,
INT
,
DOUBLEV
)
FCALLSCFUN2
(
INT
,
gridInqYvals
,
GRIDINQYVALS
,
gridinqyvals
,
INT
,
DOUBLEV
)
/* CDI grid string key values */
FCALLSCFUN4
(
INT
,
cdiGridDefString
,
CDIGRIDDEFSTRING
,
cdigriddefstring
,
INT
,
INT
,
INT
,
STRING
)
FCALLSCFUN4
(
INT
,
cdiGridInqString
,
CDIGRIDINQSTRING
,
cdigridinqstring
,
INT
,
INT
,
INT
,
PSTRING
)
FCALLSCSUB2
(
gridDefXdimname
,
GRIDDEFXDIMNAME
,
griddefxdimname
,
INT
,
STRING
)
FCALLSCSUB2
(
gridInqXdimname
,
GRIDINQXDIMNAME
,
gridinqxdimname
,
INT
,
PSTRING
)
FCALLSCSUB2
(
gridDefXname
,
GRIDDEFXNAME
,
griddefxname
,
INT
,
STRING
)
FCALLSCSUB2
(
gridInqXname
,
GRIDINQXNAME
,
gridinqxname
,
INT
,
PSTRING
)
FCALLSCSUB2
(
gridDefXlongname
,
GRIDDEFXLONGNAME
,
griddefxlongname
,
INT
,
STRING
)
FCALLSCSUB2
(
gridInqXlongname
,
GRIDINQXLONGNAME
,
gridinqxlongname
,
INT
,
PSTRING
)
FCALLSCSUB2
(
gridDefXunits
,
GRIDDEFXUNITS
,
griddefxunits
,
INT
,
STRING
)
FCALLSCSUB2
(
gridInqXunits
,
GRIDINQXUNITS
,
gridinqxunits
,
INT
,
PSTRING
)
FCALLSCSUB2
(
gridDefYdimname
,
GRIDDEFYDIMNAME
,
griddefydimname
,
INT
,
STRING
)
FCALLSCSUB2
(
gridInqYdimname
,
GRIDINQYDIMNAME
,
gridinqydimname
,
INT
,
PSTRING
)
FCALLSCSUB2
(
gridDefYname
,
GRIDDEFYNAME
,
griddefyname
,
INT
,
STRING
)
FCALLSCSUB2
(
gridInqYname
,
GRIDINQYNAME
,
gridinqyname
,
INT
,
PSTRING
)
FCALLSCSUB2
(
gridDefYlongname
,
GRIDDEFYLONGNAME
,
griddefylongname
,
INT
,
STRING
)
...
...
src/grid.c
View file @
c5255e07
...
...
@@ -240,6 +240,22 @@ unsigned cdiGridCount(void)
return
reshCountType
(
&
gridOps
);
}
static
inline
void
gridSetString
(
char
*
gridstrname
,
const
char
*
name
,
size_t
len
)
{
if
(
len
>
CDI_MAX_NAME
)
len
=
CDI_MAX_NAME
;
strncpy
(
gridstrname
,
name
,
len
);
gridstrname
[
len
-
1
]
=
0
;
}
static
inline
void
gridGetString
(
char
*
name
,
const
char
*
gridstrname
,
size_t
len
)
{
if
(
len
>
CDI_MAX_NAME
)
len
=
CDI_MAX_NAME
;
strncpy
(
name
,
gridstrname
,
len
);
name
[
len
-
1
]
=
0
;
}
static
inline
void
gridSetName
(
char
*
gridstrname
,
const
char
*
name
)
{
...
...
@@ -585,6 +601,88 @@ void gridName(int gridtype, char *gridname)
strcpy
(
gridname
,
gridNamePtr
(
gridtype
));
}
/*
@Function cdiGridDefString
@Title Define a CDI grid string value from a key
@Prototype int cdiGridDefString(int gridID, int key, int size, const char *mesg)
@Parameter
@Item gridID Grid ID, from a previous call to @fref{gridCreate}.
@Item key The key to be searched
@Item size The allocated length of the string on input
@Item mesg The address of a string where the data will be read
@Description
The function @func{cdiGridDefString} defines a CDI grid string value from a key.
@Result
@func{cdiGridDefString} returns 0 if OK and integer value on error.
@EndFunction
*/
int
cdiGridDefString
(
int
gridID
,
int
key
,
int
size
,
const
char
*
mesg
)
{
if
(
size
==
0
||
mesg
==
NULL
||
*
mesg
==
0
)
return
-
1
;
grid_t
*
gridptr
=
gridID2Ptr
(
gridID
);
char
*
gridstring
=
NULL
;
switch
(
key
)
{
case
CDI_GRID_XDIMNAME
:
gridstring
=
gridptr
->
xdimname
;
break
;
default:
Warning
(
"CDI grid string key %d not supported!"
,
key
);
return
-
1
;
}
gridSetString
(
gridstring
,
mesg
,
size
);
gridMark4Update
(
gridID
);
return
0
;
}
/*
@Function cdiGridInqString
@Title Get a CDI grid string value from a key
@Prototype int cdiGridInqString(int gridID, int key, int size, char *mesg)
@Parameter
@Item gridID Grid ID, from a previous call to @fref{gridCreate}.
@Item key The key to be searched.
@Item size The allocated length of the string on input.
@Item mesg The address of a string where the data will be retrieved.
The caller must allocate space for the returned string.
The maximum possible length, in characters, of the string
is given by the predefined constant @func{CDI_MAX_NAME}.
@Description
The function @func{cdiGridInqString} return a CDI grid string value from a key.
@Result
@func{cdiGridInqString} returns 0 if OK and integer value on error.
@EndFunction
*/
int
cdiGridInqString
(
int
gridID
,
int
key
,
int
size
,
char
*
mesg
)
{
if
(
size
==
0
||
mesg
==
NULL
||
*
mesg
==
0
)
return
-
1
;
grid_t
*
gridptr
=
gridID2Ptr
(
gridID
);
const
char
*
gridstring
=
NULL
;
switch
(
key
)
{
case
CDI_GRID_XDIMNAME
:
gridstring
=
gridptr
->
xdimname
;
break
;
default:
Warning
(
"CDI grid string key %d not supported!"
,
key
);
return
-
1
;
}
gridGetString
(
mesg
,
gridstring
,
size
);
return
0
;
}
/*
@Function gridDefXdimname
@Title Define the dimension name of a X-axis
...
...
src/make_fint.c
View file @
c5255e07
...
...
@@ -15,7 +15,7 @@
#endif
//#include "config.h"
#define VERSION "1.7.
1
"
#define VERSION "1.7.
2
"
typedef
struct
{
size_t
naline
;
...
...
src/mo_cdi.f90
View file @
c5255e07
...
...
@@ -444,6 +444,16 @@ module mo_cdi
public
::
gridInqXvals
public
::
gridDefYvals
public
::
gridInqYvals
integer
(
c_int
),
public
,
parameter
::
CDI_GRID_XNAME
=
901
integer
(
c_int
),
public
,
parameter
::
CDI_GRID_YNAME
=
902
integer
(
c_int
),
public
,
parameter
::
CDI_GRID_XDIMNAME
=
903
integer
(
c_int
),
public
,
parameter
::
CDI_GRID_YDIMNAME
=
904
integer
(
c_int
),
public
,
parameter
::
CDI_GRID_XLONGNAME
=
905
integer
(
c_int
),
public
,
parameter
::
CDI_GRID_YLONGNAME
=
906
integer
(
c_int
),
public
,
parameter
::
CDI_GRID_XUNITS
=
907
integer
(
c_int
),
public
,
parameter
::
CDI_GRID_YUNITS
=
908
public
::
cdiGridDefString
public
::
cdiGridInqString
public
::
gridDefXdimname
public
::
gridInqXdimname
public
::
gridDefXname
...
...
@@ -4905,6 +4915,73 @@ contains
end
if
end
function
gridNamePtr
function
cdiGridDefString
(
gridID_dummy
,
key_dummy
,
size_dummy
,
mesg_dummy
)&
&
result
(
f_result
)
integer
(
c_int
)
::
f_result
integer
(
c_int
),
value
::
gridID_dummy
integer
(
c_int
),
value
::
key_dummy
integer
(
c_int
),
value
::
size_dummy
character
(
kind
=
c_char
,
len
=
*
),
intent
(
in
)
::
mesg_dummy
character
(
kind
=
c_char
)
::
mesg_temp
(
len
(
mesg_dummy
)
+
1
)
integer
::
mesg_i
interface
function
lib_cdiGridDefString
(
gridID_dummy
,
key_dummy
,
size_dummy
,&
&
mesg_dummy
)
bind
(
c
,
name
=
'cdiGridDefString'
)
result
(
c_result
)
import
c_char
,
c_int
integer
(
c_int
)
::
c_result
integer
(
c_int
),
value
::
gridID_dummy
integer
(
c_int
),
value
::
key_dummy
integer
(
c_int
),
value
::
size_dummy
character
(
kind
=
c_char
)
::
mesg_dummy
(
*
)
end
function
lib_cdiGridDefString
end
interface
do
mesg_i
=
1
,
len
(
mesg_dummy
)
mesg_temp
(
mesg_i
)
=
mesg_dummy
(
mesg_i
:
mesg_i
)
end
do
mesg_temp
(
len
(
mesg_dummy
)
+
1
)
=
c_null_char
f_result
=
lib_cdiGridDefString
(
gridID_dummy
,
key_dummy
,
size_dummy
,&
&
mesg_temp
)
end
function
cdiGridDefString
function
cdiGridInqString
(
gridID_dummy
,
key_dummy
,
size_dummy
,
mesg_dummy
)&
&
result
(
f_result
)
integer
(
c_int
)
::
f_result
integer
(
c_int
),
value
::
gridID_dummy
integer
(
c_int
),
value
::
key_dummy
integer
(
c_int
),
value
::
size_dummy
character
(
kind
=
c_char
,
len
=
*
),
intent
(
inout
)
::
mesg_dummy
character
(
kind
=
c_char
)
::
mesg_temp
(
len
(
mesg_dummy
)
+
1
)
integer
::
mesg_i
interface
function
lib_cdiGridInqString
(
gridID_dummy
,
key_dummy
,
size_dummy
,&
&
mesg_dummy
)
bind
(
c
,
name
=
'cdiGridInqString'
)
result
(
c_result
)
import
c_char
,
c_int
integer
(
c_int
)
::
c_result
integer
(
c_int
),
value
::
gridID_dummy
integer
(
c_int
),
value
::
key_dummy
integer
(
c_int
),
value
::
size_dummy
character
(
kind
=
c_char
)
::
mesg_dummy
(
*
)
end
function
lib_cdiGridInqString
end
interface
mesg_temp
(
len
(
mesg_dummy
)
+
1
)
=
c_null_char
do
mesg_i
=
len
(
mesg_dummy
),
1
,
-1
if
(
mesg_dummy
(
mesg_i
:
mesg_i
)
/
=
' '
)
exit
mesg_temp
(
mesg_i
)
=
c_null_char
end
do
do
mesg_i
=
mesg_i
,
1
,
-1
mesg_temp
(
mesg_i
)
=
mesg_dummy
(
mesg_i
:
mesg_i
)
end
do
f_result
=
lib_cdiGridInqString
(
gridID_dummy
,
key_dummy
,
size_dummy
,&
&
mesg_temp
)
do
mesg_i
=
1
,
len
(
mesg_dummy
)
if
(
mesg_temp
(
mesg_i
)
==
c_null_char
)
exit
mesg_dummy
(
mesg_i
:
mesg_i
)
=
mesg_temp
(
mesg_i
)
end
do
do
mesg_i
=
mesg_i
,
len
(
mesg_dummy
)
mesg_dummy
(
mesg_i
:
mesg_i
)
=
' '
end
do
end
function
cdiGridInqString
subroutine
gridDefXdimname
(
gridID_dummy
,
xdimname_dummy
)
integer
(
c_int
),
value
::
gridID_dummy
character
(
kind
=
c_char
,
len
=
*
),
intent
(
in
)
::
xdimname_dummy
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment