IAP GITLAB
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
corsika-data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue 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
Air Shower Physics
corsika-data
Commits
165721c9
Commit
165721c9
authored
4 years ago
by
Ralf M Ulrich
Browse files
Options
Downloads
Patches
Plain Diff
clang format
parent
34a4a830
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
readLib/corsika_data/Interface.h
+11
-12
11 additions, 12 deletions
readLib/corsika_data/Interface.h
readLib/source/Interface.boost.cc
+27
-33
27 additions, 33 deletions
readLib/source/Interface.boost.cc
readLib/source/Interface.dummy.cc
+31
-14
31 additions, 14 deletions
readLib/source/Interface.dummy.cc
with
69 additions
and
59 deletions
readLib/corsika_data/Interface.h
+
11
−
12
View file @
165721c9
...
...
@@ -16,23 +16,22 @@
namespace
corsika_data
{
// the c++ interface functions
void
CorDataOpenFile
(
char
*
name
);
void
CorDataFillArray
(
double
*
data
,
const
int
&
length
);
void
CorDataCloseFile
();
double
CorDataNextNumber
();
void
CorDataOpenFile
(
char
*
name
);
void
CorDataFillArray
(
double
*
data
,
const
int
&
length
);
void
CorDataCloseFile
();
double
CorDataNextNumber
();
int
CorDataNextText
(
std
::
string
&
data
);
bool
CorDataCanDeCompress
();
// the fortran interface functions
extern
"C"
{
void
cordataopenfile_
(
char
*
name
);
void
cordatafillarray_
(
double
*
data
,
const
int
&
length
);
void
cordataclosefile_
();
double
cordatanextnumber_
();
int
cordatanexttext_
(
char
*
data
,
int
length
);
int
cordatacandecompress
();
void
cordataopenfile_
(
char
*
name
);
void
cordatafillarray_
(
double
*
data
,
const
int
&
length
);
void
cordataclosefile_
();
double
cordatanextnumber_
();
int
cordatanexttext_
(
char
*
data
,
int
length
);
int
cordatacandecompress
();
}
}
}
// namespace corsika_data
#endif
This diff is collapsed.
Click to expand it.
readLib/source/Interface.boost.cc
+
27
−
33
View file @
165721c9
...
...
@@ -10,11 +10,11 @@
#include
<corsika_data/Interface.h>
#include
<string>
#include
<boost/iostreams/filter/bzip2.hpp>
#include
<boost/iostreams/filtering_stream.hpp>
#include
<fstream>
#include
<iostream>
#include
<boost/iostreams/filtering_stream.hpp>
#include
<boost/iostreams/filter/bzip2.hpp>
#include
<string>
#include
<iostream>
using
namespace
std
;
...
...
@@ -26,15 +26,15 @@ namespace corsika_data {
boost
::
iostreams
::
filtering_istream
in_
;
DataFile
()
{}
~
DataFile
()
{}
void
Open
(
const
char
*
name
)
{
void
Open
(
const
char
*
name
)
{
if
(
file_in_
.
is_open
())
{
std
::
cout
<<
"DataFile is still open! Close it"
<<
std
::
endl
;
file_in_
.
close
();
std
::
cout
<<
"DataFile is still open! Close it"
<<
std
::
endl
;
file_in_
.
close
();
}
std
::
string
s
(
name
);
auto
i1
=
s
.
find_first_not_of
(
"
\t\r\n
"
);
auto
i2
=
s
.
find_first_of
(
"
\t\r\n
"
,
i1
);
std
::
string
trimmed
(
s
.
substr
(
i1
,
i2
-
i1
));
std
::
string
trimmed
(
s
.
substr
(
i1
,
i2
-
i1
));
file_in_
.
open
(
trimmed
,
ios_base
::
in
|
ios_base
::
binary
);
in_
.
reset
();
in_
.
push
(
boost
::
iostreams
::
bzip2_decompressor
());
...
...
@@ -42,8 +42,7 @@ namespace corsika_data {
}
void
Close
()
{
file_in_
.
close
();
}
void
FillArray
(
double
*
data
,
const
int
&
length
)
{
for
(
int
i
=
0
;
i
<
length
;
i
++
)
in_
>>
data
[
i
];
for
(
int
i
=
0
;
i
<
length
;
i
++
)
in_
>>
data
[
i
];
}
double
ReadNextNumber
()
{
double
data
;
...
...
@@ -55,38 +54,33 @@ namespace corsika_data {
return
0
;
}
};
DataFile
global_DataFile
;
void
CorDataOpenFile
(
char
*
name
)
{
global_DataFile
.
Open
(
name
);
}
void
CorDataFillArray
(
double
*
data
,
const
int
&
length
)
{
global_DataFile
.
FillArray
(
data
,
length
);
}
void
CorDataFillArray
(
double
*
data
,
const
int
&
length
)
{
global_DataFile
.
FillArray
(
data
,
length
);
}
void
CorDataCloseFile
()
{
global_DataFile
.
Close
();
}
double
CorDataNextNumber
()
{
return
global_DataFile
.
ReadNextNumber
();
}
int
CorDataNextText
(
char
*
data
,
const
int
length
)
{
std
::
string
STR
;
std
::
string
STR
;
global_DataFile
.
ReadNextText
(
STR
);
for
(
int
i
=
0
;
i
<
length
&&
i
<
(
int
)
STR
.
size
();
++
i
)
data
[
i
]
=
STR
[
i
];
for
(
int
i
=
0
;
i
<
length
&&
i
<
(
int
)
STR
.
size
();
++
i
)
data
[
i
]
=
STR
[
i
];
return
0
;
}
bool
CorDataCanDeCompress
()
{
return
true
;
}
extern
"C"
{
void
cordataopenfile_
(
char
*
name
)
{
CorDataOpenFile
(
name
);
}
void
cordatafillarray_
(
double
*
data
,
const
int
&
length
)
{
global_DataFile
.
FillArray
(
data
,
length
);
}
double
cordatanextnumber_
()
{
return
global_DataFile
.
ReadNextNumber
();
}
int
cordatanexttext_
(
char
*
data
,
const
int
length
)
{
return
CorDataNextText
(
data
,
length
);
}
void
cordataclosefile_
()
{
global_DataFile
.
Close
();
}
int
cordatacandecompress
()
{
return
1
;
}
extern
"C"
{
void
cordataopenfile_
(
char
*
name
)
{
CorDataOpenFile
(
name
);
}
void
cordatafillarray_
(
double
*
data
,
const
int
&
length
)
{
global_DataFile
.
FillArray
(
data
,
length
);
}
double
cordatanextnumber_
()
{
return
global_DataFile
.
ReadNextNumber
();
}
int
cordatanexttext_
(
char
*
data
,
const
int
length
)
{
return
CorDataNextText
(
data
,
length
);
}
void
cordataclosefile_
()
{
global_DataFile
.
Close
();
}
int
cordatacandecompress
()
{
return
1
;
}
}
}
}
// namespace corsika_data
This diff is collapsed.
Click to expand it.
readLib/source/Interface.dummy.cc
+
31
−
14
View file @
165721c9
...
...
@@ -8,26 +8,43 @@
* the license.
*/
#include
<string>
#include
<stdexcept>
#include
<string>
namespace
corsika_data
{
// the c++ interface functions
void
CorDataOpenFile
(
char
*
)
{
std
::
runtime_error
(
"Cannot read compressed data files with dummy library."
);
}
void
CorDataFillArray
(
double
*
,
const
int
&
)
{
std
::
runtime_error
(
"Cannot read compressed data files with dummy library."
);
}
void
CorDataCloseFile
()
{
std
::
runtime_error
(
"Cannot read compressed data files with dummy library."
);
}
double
CorDataNextNumber
()
{
std
::
runtime_error
(
"Cannot read compressed data files with dummy library."
);
return
0
;
}
int
CorDataNextText
(
std
::
string
&
)
{
std
::
runtime_error
(
"Cannot read compressed data files with dummy library."
);
return
0
;
}
void
CorDataOpenFile
(
char
*
)
{
std
::
runtime_error
(
"Cannot read compressed data files with dummy library."
);
}
void
CorDataFillArray
(
double
*
,
const
int
&
)
{
std
::
runtime_error
(
"Cannot read compressed data files with dummy library."
);
}
void
CorDataCloseFile
()
{
std
::
runtime_error
(
"Cannot read compressed data files with dummy library."
);
}
double
CorDataNextNumber
()
{
std
::
runtime_error
(
"Cannot read compressed data files with dummy library."
);
return
0
;
}
int
CorDataNextText
(
std
::
string
&
)
{
std
::
runtime_error
(
"Cannot read compressed data files with dummy library."
);
return
0
;
}
bool
CorDataCanDeCompress
()
{
return
false
;
}
// the fortran interface functions
extern
"C"
{
void
cordataopenfile_
(
char
*
name
)
{
CorDataOpenFile
(
name
);
}
void
cordatafillarray_
(
double
*
data
,
const
int
&
length
)
{
CorDataFillArray
(
data
,
length
);
}
void
cordataclosefile_
()
{
CorDataCloseFile
();
}
double
cordatanextnumber_
()
{
return
CorDataNextNumber
();
}
int
cordatanexttext_
(
char
*
data
)
{
std
::
runtime_error
(
"Cannot read compressed data files with dummy library."
);
return
0
;
}
int
cordatacandecompress
()
{
return
0
;
}
}
}
void
cordataopenfile_
(
char
*
name
)
{
CorDataOpenFile
(
name
);
}
void
cordatafillarray_
(
double
*
data
,
const
int
&
length
)
{
CorDataFillArray
(
data
,
length
);
}
void
cordataclosefile_
()
{
CorDataCloseFile
();
}
double
cordatanextnumber_
()
{
return
CorDataNextNumber
();
}
int
cordatanexttext_
(
char
*
data
)
{
std
::
runtime_error
(
"Cannot read compressed data files with dummy library."
);
return
0
;
}
int
cordatacandecompress
()
{
return
0
;
}
}
}
// namespace corsika_data
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