Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libcdi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mpim-sw
libcdi
Commits
1ab5afb9
Commit
1ab5afb9
authored
9 years ago
by
Thomas Jahns
Committed by
Sergey Kosukhin
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Replace single-image operation with overrideable function call.
parent
77f2f51c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!34
Version 2.2.0
,
!13
Consolidation with CDI-PIO (develop)
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/stream_cdf_o.c
+12
-9
12 additions, 9 deletions
src/stream_cdf_o.c
with
12 additions
and
9 deletions
src/stream_cdf_o.c
+
12
−
9
View file @
1ab5afb9
...
...
@@ -560,11 +560,11 @@ cdfDefAxisCommon(stream_t *streamptr, int gridID, int gridIndex, int ndims, bool
ncgrid_t
*
ncgrid
=
streamptr
->
ncgrid
;
const
double
*
pvals
=
gridAxisInq
->
axisValsPtr
(
gridID
);
bool
hasVals
=
gridInqPropPresence
(
gridID
,
gridAxisInq
->
valsQueryKey
);
char
dimname
[
CDI_MAX_NAME
+
3
];
dimname
[
0
]
=
0
;
int
length
=
sizeof
(
dimname
);
if
(
ndims
&&
pvals
==
NULL
)
cdiInqKeyString
(
gridID
,
axisKey
,
CDI_KEY_DIMNAME
,
dimname
,
&
length
);
if
(
ndims
&&
hasVals
)
cdiInqKeyString
(
gridID
,
axisKey
,
CDI_KEY_DIMNAME
,
dimname
,
&
length
);
for
(
int
index
=
0
;
index
<
gridIndex
;
++
index
)
{
...
...
@@ -605,7 +605,7 @@ cdfDefAxisCommon(stream_t *streamptr, int gridID, int gridIndex, int ndims, bool
checkGridName
(
axisname
,
fileID
);
const
size_t
axisnameLen
=
strlen
(
axisname
);
bool
switchNCMode
=
streamptr
->
ncmode
==
2
&&
(
pv
als
||
ndims
);
bool
switchNCMode
=
streamptr
->
ncmode
==
2
&&
(
hasV
als
||
ndims
);
if
(
switchNCMode
)
{
cdf_redef
(
fileID
);
...
...
@@ -620,7 +620,7 @@ cdfDefAxisCommon(stream_t *streamptr, int gridID, int gridIndex, int ndims, bool
if
(
dimID
==
CDI_UNDEFID
)
cdf_def_dim
(
fileID
,
dimname
,
dimlen
,
&
dimID
);
}
if
(
pv
als
)
if
(
hasV
als
)
{
cdf_def_var
(
fileID
,
axisname
,
xtype
,
ndims
,
&
dimID
,
&
ncvarid
);
...
...
@@ -640,15 +640,18 @@ cdfDefAxisCommon(stream_t *streamptr, int gridID, int gridIndex, int ndims, bool
char
axisStr
[
2
]
=
{
axisLetter
,
'\0'
};
cdf_put_att_text
(
fileID
,
ncvarid
,
"axis"
,
1
,
axisStr
);
}
cdfPostDefActionAddPutVal
(
&
delayed
,
fileID
,
ncvarid
,
pvals
,
(
void
(
*
)(
void
*
))
memFree
);
void
(
*
mycdfPostDefActionGridProp
)(
int
,
int
,
int
,
enum
gridPropInq
,
struct
cdfPostDefActionList
**
)
=
namespaceSwitchGet
(
NSSWITCH_CDF_POSTDEFACTION_GRID_PROP
).
func
;
mycdfPostDefActionGridProp
(
gridID
,
fileID
,
ncvarid
,
gridAxisInq
->
valsQueryKey
,
&
delayed
);
bool
gen
_b
ounds
=
false
,
hasBounds
=
gridInqPropPresence
(
gridID
,
gridAxisInq
->
bndsQueryKey
);
bool
gen
B
ounds
=
false
,
hasBounds
=
gridInqPropPresence
(
gridID
,
gridAxisInq
->
bndsQueryKey
);
const
bool
grid_is_cyclic
=
gridIsCircular
(
gridID
)
>
0
;
double
*
restrict
pbounds
;
size_t
nvertex
=
gridInqNvertex
(
gridID
);
if
(
CDI_CMOR_Mode
&&
grid_is_cyclic
&&
!
hasBounds
)
{
gen_bounds
=
true
;
const
double
*
pvals
=
gridAxisInq
->
axisValsPtr
(
gridID
);
genBounds
=
true
;
nvertex
=
2
;
pbounds
=
(
double
*
)
Malloc
(
2
*
dimlen
*
sizeof
(
double
));
for
(
size_t
i
=
0
;
i
<
dimlen
-
1
;
++
i
)
...
...
@@ -666,7 +669,7 @@ cdfDefAxisCommon(stream_t *streamptr, int gridID, int gridIndex, int ndims, bool
{
if
(
nc_inq_dimid
(
fileID
,
bndsName
,
&
nvdimID
)
!=
NC_NOERR
)
cdf_def_dim
(
fileID
,
bndsName
,
nvertex
,
&
nvdimID
);
}
if
(
pb
ounds
&&
nvdimID
!=
CDI_UNDEFID
)
if
(
(
hasBounds
||
genB
ounds
)
&&
nvdimID
!=
CDI_UNDEFID
)
{
char
boundsname
[
CDI_MAX_NAME
];
memcpy
(
boundsname
,
axisname
,
axisnameLen
);
...
...
@@ -677,7 +680,7 @@ cdfDefAxisCommon(stream_t *streamptr, int gridID, int gridIndex, int ndims, bool
cdf_def_var
(
fileID
,
boundsname
,
xtype
,
2
,
dimIDs
,
&
ncbvarid
);
cdf_put_att_text
(
fileID
,
ncvarid
,
"bounds"
,
axisnameLen
+
sizeof
(
bndsName
),
boundsname
);
cdfPostDefActionAddPutVal
(
&
delayed
,
fileID
,
ncbvarid
,
pbounds
,
gen
_b
ounds
?
cdfDelayedPutVarDeepCleanup
:
(
void
(
*
)(
void
*
))
memFree
);
gen
B
ounds
?
cdfDelayedPutVarDeepCleanup
:
(
void
(
*
)(
void
*
))
memFree
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment