Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cdo
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor 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
cdo
Commits
fe7d506e
Commit
fe7d506e
authored
3 months ago
by
Oliver Heidmann
Browse files
Options
Downloads
Patches
Plain Diff
removed unused files
parent
4fa27338
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/cdo_benchmark.h
+0
-28
0 additions, 28 deletions
src/cdo_benchmark.h
src/namelistdump.cc
+0
-88
0 additions, 88 deletions
src/namelistdump.cc
with
0 additions
and
116 deletions
src/cdo_benchmark.h
deleted
100644 → 0
+
0
−
28
View file @
4fa27338
#ifndef CDO_BENCHMARK_H
#define CDO_BENCHMARK_H
#define DBE2
#ifdef DBE2
#include
<iostream>
#include
<chrono>
template
<
typename
func
>
void
cdo_benchmark
(
func
lambda
)
{
auto
start
=
std
::
chrono
::
steady_clock
::
now
();
lambda
();
auto
end
=
std
::
chrono
::
steady_clock
::
now
();
auto
elapsedm
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
nanoseconds
>
(
end
-
start
).
count
();
// time end
std
::
cout
<<
"time: "
<<
elapsedm
<<
" ns"
<<
std
::
endl
;
}
#define CDO_BENCH(x) cdo_benchmark(x)
#else
#define CDO_BENCH(x) \
std::cout << "benchmark found, please remove. " << __FILE__ << ": " << __LINE__ << std::endl; \
x()
#endif
#endif
This diff is collapsed.
Click to expand it.
src/namelistdump.cc
deleted
100644 → 0
+
0
−
88
View file @
4fa27338
/*
This file is part of CDO. CDO is a collection of Operators to manipulate and analyse Climate model Data.
Author: Uwe Schulzweida
*/
#include
<cstdio>
#include
<cstdlib>
#include
<cstring>
#include
<cerrno>
#include
<sys/stat.h>
#include
"namelist.h"
int
main
(
int
argc
,
char
*
argv
[])
{
if
(
argc
!=
2
)
{
fprintf
(
stderr
,
"Usage: %s namelist
\n
"
,
argv
[
0
]);
return
-
1
;
}
const
char
*
filename
=
argv
[
1
];
printf
(
"Parse namelist %s:
\n
"
,
filename
);
struct
stat
sbuf
;
size_t
filesize
=
(
stat
(
filename
,
&
sbuf
)
==
0
)
?
sbuf
.
st_size
:
0
;
if
(
filesize
==
0
)
{
fprintf
(
stderr
,
"Empty table file: %s
\n
"
,
filename
);
return
-
1
;
}
FILE
*
fp
=
std
::
fopen
(
filename
,
"r"
);
if
(
fp
==
nullptr
)
{
fprintf
(
stderr
,
"Open failed on %s: %s
\n
"
,
filename
,
strerror
(
errno
));
return
-
1
;
}
char
*
buffer
=
(
char
*
)
std
::
malloc
(
filesize
);
size_t
nitems
=
fread
(
buffer
,
1
,
filesize
,
fp
);
std
::
fclose
(
fp
);
if
(
nitems
!=
filesize
)
{
fprintf
(
stderr
,
"Read failed on %s!
\n
"
,
filename
);
std
::
free
(
buffer
);
return
-
1
;
}
NamelistParser
p
;
NamelistError
status
=
p
.
parse
(
buffer
,
filesize
);
printf
(
"Processed number of lines: %lu
\n
"
,
p
.
lineno
-
1
);
if
(
status
!=
NamelistError
::
UNDEFINED
)
{
switch
(
status
)
{
case
NamelistError
::
INVAL
:
fprintf
(
stderr
,
"Namelist error: Invalid character in %s (line=%lu character='%c')!
\n
"
,
filename
,
p
.
lineno
,
buffer
[
p
.
pos
]);
break
;
case
NamelistError
::
PART
:
fprintf
(
stderr
,
"Namelist error: End of string not found in %s (line=%lu)!
\n
"
,
filename
,
p
.
lineno
);
break
;
case
NamelistError
::
INKEY
:
fprintf
(
stderr
,
"Namelist error: Invalid keyword in %s (line=%lu)!
\n
"
,
filename
,
p
.
lineno
);
break
;
case
NamelistError
::
INTYP
:
fprintf
(
stderr
,
"Namelist error: Invalid keyword type in %s (line=%lu)!
\n
"
,
filename
,
p
.
lineno
);
break
;
case
NamelistError
::
INOBJ
:
fprintf
(
stderr
,
"Namelist error: Invalid object in %s (line=%lu)!
\n
"
,
filename
,
p
.
lineno
);
break
;
case
NamelistError
::
EMKEY
:
fprintf
(
stderr
,
"Namelsit error: Emtry key name in %s (line=%lu)!
\n
"
,
filename
,
p
.
lineno
);
break
;
default:
fprintf
(
stderr
,
"Namelsit error in %s (line=%lu)!
\n
"
,
filename
,
p
.
lineno
);
break
;
}
}
p
.
dump
(
buffer
);
std
::
free
(
buffer
);
return
0
;
}
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