Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
81a3a524
Commit
81a3a524
authored
Mar 06, 2009
by
Uwe Schulzweida
Browse files
grid_check_cyclic: support for curvilinear grids without bounds
parent
a63da19b
Changes
7
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
81a3a524
...
...
@@ -4,6 +4,7 @@
* add support for GRID type LCC2 (LCC PROJ.4 version)
* grbDefTime: define tunit also for absolute time [report: Pruek Pongprueksa]
* change default calendar to CALENDAR_PROLEPTIC
* grid_check_cyclic: support for curvilinear grids without bounds
* streamOpenAppen: set ncmode to 2 (bug fix)
* Version 1.3.0 released
...
...
Makefile.am
View file @
81a3a524
...
...
@@ -2,6 +2,6 @@
#
SUBDIRS
=
src app examples tests
#
EXTRA_DIST
=
config/default doc/cdi_cman.pdf doc/cdi_fman.pdf
EXTRA_DIST
=
config/default doc/cdi_cman.pdf doc/cdi_fman.pdf
src/cfortran.doc
#
CLEANFILES
=
`
ls
*
~
`
Makefile.in
View file @
81a3a524
...
...
@@ -180,7 +180,7 @@ top_srcdir = @top_srcdir@
#
SUBDIRS
=
src app examples tests
#
EXTRA_DIST
=
config/default doc/cdi_cman.pdf doc/cdi_fman.pdf
EXTRA_DIST
=
config/default doc/cdi_cman.pdf doc/cdi_fman.pdf
src/cfortran.doc
#
CLEANFILES
=
`
ls
*
~
`
all
:
all-recursive
...
...
acinclude.m4
View file @
81a3a524
...
...
@@ -3,20 +3,22 @@ dnl UD_CHECK_CFINT
dnl
dnl Check C / Fortran interface
dnl
define(UD_CHECK_CFINT,
[
AC_MSG_CHECKING([whether the C / Fortran interface works])
changequote(,)
changequote([,])
echo '#include "XXX"' | sed -e "s-XXX-$1-" > conftest.c
rm -f conftest.o
$CC -c $CFLAGS $CFINT conftest.c >& conftestout
rm -f conftest.c conftestout
if test -f conftest.o ; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CF_INTERFACE, [1], [Define if C / Fortran interface cfortran.h works])
else
AC_MSG_RESULT(no)
fi
rm -f conftest.o
])
AC_DEFUN([UD_CHECK_CFINT],
[
AC_CACHE_CHECK([whether the C / Fortran interface works],[ud_c_cfint],
[AC_LANG_PUSH([C])
ud_save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $CFINT"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include "$1"],[])],
[ud_c_cfint=yes],
[ud_c_cfint=yes])
CFLAGS=$ud_save_CFLAGS
AC_LANG_POP([C])])
AS_IF([test x$ud_c_cfint = xyes],
[AC_DEFINE(HAVE_CF_INTERFACE, [1],
[Define if C / Fortran interface cfortran.h works])])
])
dnl
dnl Local Variables:
dnl mode: autoconf
dnl End:
configure
View file @
81a3a524
...
...
@@ -6482,25 +6482,75 @@ fi
{
echo
"
$as_me
:
$LINENO
: checking whether the C / Fortran interface works"
>
&5
echo
$ECHO_N
"checking whether the C / Fortran interface works...
$ECHO_C
"
>
&6
;
}
if
test
"
${
ud_c_cfint
+set
}
"
=
set
;
then
echo
$ECHO_N
"(cached)
$ECHO_C
"
>
&6
else
ac_ext
=
c
ac_cpp
=
'$CPP $CPPFLAGS'
ac_compile
=
'$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link
=
'$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu
=
$ac_cv_c_compiler_gnu
ud_save_CFLAGS
=
$CFLAGS
CFLAGS
=
"
$CFLAGS
$CFINT
"
cat
>
conftest.
$ac_ext
<<
_ACEOF
/* confdefs.h. */
_ACEOF
cat
confdefs.h
>>
conftest.
$ac_ext
cat
>>
conftest.
$ac_ext
<<
_ACEOF
/* end confdefs.h. */
#include "
$srcdir
/src/cfortran.h"
int
main ()
{
echo
'#include "XXX"'
|
sed
-e
"s-XXX-
$srcdir
/src/cfortran.h-"
>
conftest.c
rm
-f
conftest.o
$CC
-c
$CFLAGS
$CFINT
conftest.c
>
& conftestout
rm
-f
conftest.c conftestout
if
test
-f
conftest.o
;
then
{
echo
"
$as_me
:
$LINENO
: result: yes"
>
&5
echo
"
${
ECHO_T
}
yes"
>
&6
;
}
;
return 0;
}
_ACEOF
rm
-f
conftest.
$ac_objext
if
{
(
ac_try
=
"
$ac_compile
"
case
"((
$ac_try
"
in
*
\"
*
|
*
\`
*
|
*
\\
*
)
ac_try_echo
=
\$
ac_try
;;
*
)
ac_try_echo
=
$ac_try
;;
esac
eval
"echo
\"\$
as_me:
$LINENO
:
$ac_try_echo
\"
"
)
>
&5
(
eval
"
$ac_compile
"
)
2>conftest.er1
ac_status
=
$?
grep
-v
'^ *+'
conftest.er1
>
conftest.err
rm
-f
conftest.er1
cat
conftest.err
>
&5
echo
"
$as_me
:
$LINENO
:
\$
? =
$ac_status
"
>
&5
(
exit
$ac_status
)
;
}
&&
{
test
-z
"
$ac_c_werror_flag
"
||
test
!
-s
conftest.err
}
&&
test
-s
conftest.
$ac_objext
;
then
ud_c_cfint
=
yes
else
echo
"
$as_me
: failed program was:"
>
&5
sed
's/^/| /'
conftest.
$ac_ext
>
&5
ud_c_cfint
=
yes
fi
rm
-f
core conftest.err conftest.
$ac_objext
conftest.
$ac_ext
CFLAGS
=
$ud_save_CFLAGS
ac_ext
=
c
ac_cpp
=
'$CPP $CPPFLAGS'
ac_compile
=
'$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link
=
'$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu
=
$ac_cv_c_compiler_gnu
fi
{
echo
"
$as_me
:
$LINENO
: result:
$ud_c_cfint
"
>
&5
echo
"
${
ECHO_T
}
$ud_c_cfint
"
>
&6
;
}
if
test
x
$ud_c_cfint
=
xyes
;
then
cat
>>
confdefs.h
<<
\
_ACEOF
#define HAVE_CF_INTERFACE 1
_ACEOF
else
{
echo
"
$as_me
:
$LINENO
: result: no"
>
&5
echo
"
${
ECHO_T
}
no"
>
&6
;
}
fi
rm
-f
conftest.o
fi
...
...
@@ -6509,6 +6559,7 @@ FC=$F77
ac_config_files
=
"
$ac_config_files
Makefile src/Makefile app/Makefile tests/Makefile examples/Makefile"
cat
>
confcache
<<
\
_ACEOF
...
...
configure.ac
View file @
81a3a524
...
...
@@ -223,9 +223,9 @@ fi
# Check C / Fortran interface
UD_CHECK_CFINT([$srcdir/src/cfortran.h])
AC_SUBST([CPPFLAGS])
AC_SUBST([FC],$F77)
AC_SUBST([CFINT])
AC_SUBST([CPPFLAGS])
AC_SUBST([AR])
AC_OUTPUT(Makefile src/Makefile app/Makefile tests/Makefile examples/Makefile)
...
...
src/grid.c
View file @
81a3a524
...
...
@@ -2121,10 +2121,11 @@ void gridChangeType(int gridID, int gridtype)
}
static
void
grid_check_cyclic
(
grid_t
*
gridptr
)
static
void
grid_check_cyclic
(
grid_t
*
gridptr
)
{
int
xsize
,
ysize
,
gridsize
;
int
i1
,
i2
,
j
,
k1
,
k2
,
nc
;
int
i1
,
i2
,
in
,
j
,
k1
,
k2
,
nc
;
double
xinc
,
x0
;
const
double
*
xvals
,
*
xbounds
;
...
...
@@ -2141,14 +2142,46 @@ static void grid_check_cyclic(grid_t *gridptr)
if
(
xvals
&&
xsize
>
1
)
{
xinc
=
xvals
[
1
]
-
xvals
[
0
];
if
(
IS_EQUAL
(
xinc
,
0
)
)
xinc
=
(
xvals
[
xsize
-
1
]
-
xvals
[
0
])
/
(
xsize
-
1
);
x0
=
2
*
xvals
[
xsize
-
1
]
-
xvals
[
xsize
-
2
]
-
360
;
if
(
IS_NOT_EQUAL
(
xvals
[
0
],
xvals
[
xsize
-
1
])
)
if
(
fabs
(
x0
-
xvals
[
0
])
<
1.e-4
)
gridptr
->
isCyclic
=
TRUE
;
/* if ( IS_EQUAL(x0, xvals[0]) ) gridptr->isCyclic = TRUE; */
if
(
fabs
(
x0
-
xvals
[
0
])
<
0
.
01
*
xinc
)
gridptr
->
isCyclic
=
TRUE
;
}
}
else
if
(
gridptr
->
type
==
GRID_CURVILINEAR
)
{
if
(
xvals
&&
xsize
>
1
)
{
double
val1
,
val2
,
valn
;
nc
=
0
;
gridptr
->
isCyclic
=
FALSE
;
for
(
j
=
0
;
j
<
ysize
;
++
j
)
{
i1
=
j
*
xsize
;
i2
=
j
*
xsize
+
1
;
in
=
j
*
xsize
+
(
xsize
-
1
);
val1
=
xvals
[
i1
];
val2
=
xvals
[
i2
];
valn
=
xvals
[
in
];
xinc
=
fabs
(
val2
-
val1
);
if
(
val1
<
1
&&
valn
>
300
)
val1
+=
360
;
if
(
valn
<
1
&&
val1
>
300
)
valn
+=
360
;
if
(
val1
<
-
179
&&
valn
>
120
)
val1
+=
360
;
if
(
valn
<
-
179
&&
val1
>
120
)
valn
+=
360
;
if
(
valn
>
val1
)
x0
=
valn
-
xinc
;
else
x0
=
valn
+
xinc
;
if
(
fabs
(
x0
-
val1
)
<
0
.
5
*
xinc
)
nc
++
;
}
if
(
nc
>
0
.
5
*
ysize
)
gridptr
->
isCyclic
=
TRUE
;
}
if
(
xbounds
&&
xsize
>
1
)
{
double
val1
,
val2
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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