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
cdo
Commits
f5d23847
Commit
f5d23847
authored
Dec 25, 2017
by
Uwe Schulzweida
Browse files
Changed data type of full search to double.
parent
ecbf5106
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/grid_search.cc
View file @
f5d23847
...
@@ -20,8 +20,8 @@
...
@@ -20,8 +20,8 @@
#define PI2 (2.0*PI)
#define PI2 (2.0*PI)
#define FLDATATYPE
float
#define FLDATATYPE
double
#define NFDATATYPE
float
#define NFDATATYPE
double
static
GridsearchMethod
gridsearch_method_nn
(
GridsearchMethod
::
kdtree
);
static
GridsearchMethod
gridsearch_method_nn
(
GridsearchMethod
::
kdtree
);
...
@@ -145,8 +145,7 @@ struct gridsearch *gridsearch_create_reg2d(bool xIsCyclic, size_t dims[2], const
...
@@ -145,8 +145,7 @@ struct gridsearch *gridsearch_create_reg2d(bool xIsCyclic, size_t dims[2], const
size_t
nx
=
dims
[
0
];
size_t
nx
=
dims
[
0
];
size_t
ny
=
dims
[
0
];
size_t
ny
=
dims
[
0
];
size_t
nxm
=
nx
;
size_t
nxm
=
xIsCyclic
?
nx
+
1
:
nx
;
if
(
xIsCyclic
)
nxm
++
;
double
*
reg2d_center_lon
=
(
double
*
)
Malloc
(
nxm
*
sizeof
(
double
));
double
*
reg2d_center_lon
=
(
double
*
)
Malloc
(
nxm
*
sizeof
(
double
));
double
*
reg2d_center_lat
=
(
double
*
)
Malloc
(
ny
*
sizeof
(
double
));
double
*
reg2d_center_lat
=
(
double
*
)
Malloc
(
ny
*
sizeof
(
double
));
...
@@ -167,6 +166,7 @@ struct gridsearch *gridsearch_create_reg2d(bool xIsCyclic, size_t dims[2], const
...
@@ -167,6 +166,7 @@ struct gridsearch *gridsearch_create_reg2d(bool xIsCyclic, size_t dims[2], const
coslon
[
n
]
=
cos
(
rlon
);
coslon
[
n
]
=
cos
(
rlon
);
sinlon
[
n
]
=
sin
(
rlon
);
sinlon
[
n
]
=
sin
(
rlon
);
}
}
for
(
size_t
n
=
0
;
n
<
ny
;
++
n
)
for
(
size_t
n
=
0
;
n
<
ny
;
++
n
)
{
{
coslat
[
n
]
=
cos
(
lats
[
n
]);
coslat
[
n
]
=
cos
(
lats
[
n
]);
...
@@ -531,8 +531,8 @@ size_t gs_nearest_full(void *search_container, double lon, double lat, double *p
...
@@ -531,8 +531,8 @@ size_t gs_nearest_full(void *search_container, double lon, double lat, double *p
FLDATATYPE
dist
=
FLT_MAX
;
FLDATATYPE
dist
=
FLT_MAX
;
for
(
size_t
i
=
0
;
i
<
n
;
i
++
)
for
(
size_t
i
=
0
;
i
<
n
;
i
++
)
{
{
FLDATATYPE
d
=
distance
<
FLDATATYPE
>
(
query_pt
,
pts
[
i
]);
FLDATATYPE
d
=
(
float
)
distance
<
FLDATATYPE
>
(
query_pt
,
pts
[
i
]);
if
(
closestpt
>=
n
||
d
<
dist
||
(
d
<=
dist
&&
i
<
closestpt
)
)
if
(
closestpt
>=
n
||
d
<
dist
||
(
d
<=
dist
&&
i
<
closestpt
)
)
{
{
dist
=
d
;
dist
=
d
;
closestpt
=
i
;
closestpt
=
i
;
...
...
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