Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
cdo
Commits
eaaf2476
Commit
eaaf2476
authored
Mar 18, 2016
by
Ralf Mueller
Browse files
[cdo-mapReduce] copy/create bounds for grid selection
parent
07431a73
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/grid.c
View file @
eaaf2476
...
@@ -1236,8 +1236,16 @@ int gridToCurvilinear(int gridID1, int lbounds)
...
@@ -1236,8 +1236,16 @@ int gridToCurvilinear(int gridID1, int lbounds)
int
gridToUnstructuredSelecton
(
int
gridID1
,
int
lbounds
,
int
selectionSize
,
int
*
selectionIndexList
)
int
gridToUnstructuredSelecton
(
int
gridID1
,
int
lbounds
,
int
selectionSize
,
int
*
selectionIndexList
)
{
{
/* transform input grid into a unstructured Version {{{ */
/* transform input grid into a unstructured Version if necessary {{{ */
int
unstructuredGridID
=
gridToUnstructured
(
gridID1
,
1
);
int
unstructuredGridID
;
if
(
GRID_UNSTRUCTURED
==
gridInqType
(
gridID1
))
{
unstructuredGridID
=
gridID1
;
}
else
{
unstructuredGridID
=
gridToUnstructured
(
gridID1
,
TRUE
);
}
int
unstructuredGridSize
=
gridInqSize
(
unstructuredGridID
);
int
unstructuredGridSize
=
gridInqSize
(
unstructuredGridID
);
int
unstructuredSelectionGridID
=
gridCreate
(
GRID_UNSTRUCTURED
,
selectionSize
);
int
unstructuredSelectionGridID
=
gridCreate
(
GRID_UNSTRUCTURED
,
selectionSize
);
...
@@ -1269,12 +1277,21 @@ int gridToUnstructuredSelecton(int gridID1, int lbounds, int selectionSize, int
...
@@ -1269,12 +1277,21 @@ int gridToUnstructuredSelecton(int gridID1, int lbounds, int selectionSize, int
double
*
yvalsUnstructured
=
(
double
*
)
Malloc
(
unstructuredGridSize
*
sizeof
(
double
));
double
*
yvalsUnstructured
=
(
double
*
)
Malloc
(
unstructuredGridSize
*
sizeof
(
double
));
gridInqXvals
(
unstructuredGridID
,
xvalsUnstructured
);
gridInqXvals
(
unstructuredGridID
,
xvalsUnstructured
);
gridInqYvals
(
unstructuredGridID
,
yvalsUnstructured
);
gridInqYvals
(
unstructuredGridID
,
yvalsUnstructured
);
int
nvertex
=
gridInqNvertex
(
unstructuredGridID
);
double
*
xboundsUnstructured
=
(
double
*
)
Malloc
(
nvertex
*
unstructuredGridSize
*
sizeof
(
double
));
double
*
yboundsUnstructured
=
(
double
*
)
Malloc
(
nvertex
*
unstructuredGridSize
*
sizeof
(
double
));
gridInqXbounds
(
unstructuredGridID
,
xboundsUnstructured
);
gridInqYbounds
(
unstructuredGridID
,
yboundsUnstructured
);
gridDefXsize
(
unstructuredSelectionGridID
,
selectionSize
);
gridDefXsize
(
unstructuredSelectionGridID
,
selectionSize
);
gridDefYsize
(
unstructuredSelectionGridID
,
selectionSize
);
gridDefYsize
(
unstructuredSelectionGridID
,
selectionSize
);
double
*
xvals
=
(
double
*
)
Malloc
(
selectionSize
*
sizeof
(
double
));
double
*
xvals
=
(
double
*
)
Malloc
(
selectionSize
*
sizeof
(
double
));
double
*
yvals
=
(
double
*
)
Malloc
(
selectionSize
*
sizeof
(
double
));
double
*
yvals
=
(
double
*
)
Malloc
(
selectionSize
*
sizeof
(
double
));
double
*
xbounds
=
(
double
*
)
Malloc
(
nvertex
*
selectionSize
*
sizeof
(
double
));
double
*
ybounds
=
(
double
*
)
Malloc
(
nvertex
*
selectionSize
*
sizeof
(
double
));
cdoPrint
(
"nvertex = %d"
,
nvertex
);
for
(
int
i
=
0
;
i
<
selectionSize
;
i
++
)
for
(
int
i
=
0
;
i
<
selectionSize
;
i
++
)
{
{
xvals
[
i
]
=
xvalsUnstructured
[
selectionIndexList
[
i
]];
xvals
[
i
]
=
xvalsUnstructured
[
selectionIndexList
[
i
]];
...
@@ -1283,9 +1300,18 @@ int gridToUnstructuredSelecton(int gridID1, int lbounds, int selectionSize, int
...
@@ -1283,9 +1300,18 @@ int gridToUnstructuredSelecton(int gridID1, int lbounds, int selectionSize, int
cdoPrint("xval[%d](%d) = %g",i,selectionIndexList[i],xvals[i]);
cdoPrint("xval[%d](%d) = %g",i,selectionIndexList[i],xvals[i]);
cdoPrint("yval[%d](%d) = %g",i,selectionIndexList[i],yvals[i]);
cdoPrint("yval[%d](%d) = %g",i,selectionIndexList[i],yvals[i]);
*/
*/
for
(
int
k
=
0
;
k
<
nvertex
;
k
++
)
{
xbounds
[
i
*
nvertex
+
k
]
=
xboundsUnstructured
[
selectionIndexList
[
i
]
*
nvertex
+
k
];
ybounds
[
i
*
nvertex
+
k
]
=
yboundsUnstructured
[
selectionIndexList
[
i
]
*
nvertex
+
k
];
}
}
}
gridDefXvals
(
unstructuredSelectionGridID
,
xvals
);
gridDefXvals
(
unstructuredSelectionGridID
,
xvals
);
gridDefYvals
(
unstructuredSelectionGridID
,
yvals
);
gridDefYvals
(
unstructuredSelectionGridID
,
yvals
);
gridDefNvertex
(
unstructuredSelectionGridID
,
nvertex
);
gridDefXbounds
(
unstructuredSelectionGridID
,
xbounds
);
gridDefYbounds
(
unstructuredSelectionGridID
,
ybounds
);
/* }}} */
/* }}} */
Free
(
xvalsUnstructured
);
Free
(
xvalsUnstructured
);
...
...
Write
Preview
Supports
Markdown
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