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
fc7e3eac
Commit
fc7e3eac
authored
2 years ago
by
Uwe Schulzweida
Browse files
Options
Downloads
Patches
Plain Diff
streamWriteRecordF: fallback not needed anymore.
parent
36fc8053
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#17630
failed
1 month ago
Stage: external
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/stream_write.c
+4
-29
4 additions, 29 deletions
src/stream_write.c
with
4 additions
and
29 deletions
src/stream_write.c
+
4
−
29
View file @
fc7e3eac
...
...
@@ -312,13 +312,9 @@ cdiStreamWriteVarChunk_(int streamID, int varID, int memtype, const int rect[][2
}
}
static
int
static
void
stream_write_record
(
int
streamID
,
int
memtype
,
const
void
*
data
,
SizeType
nmiss
)
{
// May fail if memtype == MEMTYPE_FLOAT and the file format does not support single precision writing.
// A value > 0 is returned in this case, otherwise it returns zero.
int
status
=
0
;
check_parg
(
data
);
stream_t
*
streamptr
=
stream_to_pointer
(
streamID
);
...
...
@@ -339,20 +335,10 @@ stream_write_record(int streamID, int memtype, const void *data, SizeType nmiss)
case
CDI_FILETYPE_IEG
:
ieg_write_record
(
streamptr
,
memtype
,
data
);
break
;
#endif
#ifdef HAVE_LIBNETCDF
case
CDI_FILETYPE_NETCDF
:
{
cdf_write_record
(
streamptr
,
memtype
,
data
,
nmiss
);
break
;
}
case
CDI_FILETYPE_NETCDF
:
cdf_write_record
(
streamptr
,
memtype
,
data
,
nmiss
);
break
;
#endif
default:
{
Error
(
"%s support not compiled in!"
,
strfiletype
(
streamptr
->
filetype
));
break
;
}
default:
Error
(
"%s support not compiled in!"
,
strfiletype
(
streamptr
->
filetype
));
break
;
}
return
status
;
}
/*
...
...
@@ -379,16 +365,5 @@ streamWriteRecord(int streamID, const double *data, SizeType nmiss)
void
streamWriteRecordF
(
int
streamID
,
const
float
*
data
,
SizeType
nmiss
)
{
if
(
stream_write_record
(
streamID
,
MEMTYPE_FLOAT
,
(
const
void
*
)
data
,
nmiss
))
{
// In case the file format does not support single precision writing,
// we fall back to double precision writing, converting the data on the fly.
stream_t
*
streamptr
=
stream_to_pointer
(
streamID
);
const
int
varID
=
streamptr
->
record
->
varID
;
const
SizeType
elementCount
=
gridInqSize
(
vlistInqVarGrid
(
streamInqVlist
(
streamID
),
varID
));
double
*
conversionBuffer
=
(
double
*
)
Malloc
(
elementCount
*
sizeof
(
*
conversionBuffer
));
for
(
SizeType
i
=
elementCount
;
i
--
;)
conversionBuffer
[
i
]
=
(
double
)
data
[
i
];
streamWriteRecord
(
streamID
,
conversionBuffer
,
nmiss
);
Free
(
conversionBuffer
);
}
stream_write_record
(
streamID
,
MEMTYPE_FLOAT
,
(
const
void
*
)
data
,
nmiss
);
}
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