Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LEFEBVREJP email
radix
Commits
cf0e0f2e
Commit
cf0e0f2e
authored
Mar 21, 2018
by
LEFEBVREJP email
Browse files
Starting on F71Stream.
parent
f05ea3e9
Pipeline
#12632
passed with stages
in 5 minutes and 28 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
radixio/CMakeLists.txt
View file @
cf0e0f2e
...
...
@@ -8,6 +8,7 @@ SET(SOURCE
eafstream.cc
endian.cc
gfsfile.cc
f71stream.cc
hcdump.cc
hysplitcdump.cc
)
...
...
@@ -20,6 +21,8 @@ SET(HEADERS
eafstream.hh
endian.hh
gfsfile.hh
f71stream.hh
f71stream.i.hh
hcdump.hh
hysplitcdump.hh
hysplitcdump.i.hh
...
...
radixio/f71stream.cc
0 → 100644
View file @
cf0e0f2e
#include
"radixio/f71stream.hh"
#include
"radixbug/bug.hh"
#include
"radixmath/util.hh"
namespace
radix
{
F71Stream
::
F71Stream
(
const
std
::
string
&
file
)
:
mFile
(
file
)
,
mStream
(
file
.
c_str
())
{
}
}
// namespace radix
radixio/f71stream.hh
0 → 100644
View file @
cf0e0f2e
#ifndef RADIX_RADIXIO_F71STREAM_HH_
#define RADIX_RADIXIO_F71STREAM_HH_
#include
<algorithm>
#include
<cmath>
#include
<iomanip>
#include
<sstream>
#include
<string>
#include
<vector>
#include
"radixio/eafstream.hh"
#include
"radixdl/visibility.hh"
namespace
radix
{
class
F71Stream
{
private:
std
::
string
mFile
;
eafstream
mStream
;
public:
F71Stream
()
=
delete
;
F71Stream
(
const
std
::
string
&
mFile
);
template
<
typename
f71case_type
>
bool
load_next
(
f71case_type
&
inventory
);
};
// class F71Stream
}
// namespace radix
#include
"radixio/f71stream.i.hh"
#endif
/** RADIX_RADIXIO_F71STREAM_HH_ */
radixio/f71stream.i.hh
0 → 100644
View file @
cf0e0f2e
#ifndef RADIX_RADIXIO_F71STREAM_I_HH_
#define RADIX_RADIXIO_F71STREAM_I_HH_
#include
"radixio/f71stream.hh"
#include
"radixbug/bug.hh"
#include
"radixcore/stringfunctions.hh"
#include
"radixio/eafstream.hh"
namespace
radix
{
template
<
typename
f71case_type
>
bool
F71Stream
::
load_next
(
f71case_type
&
inventory
)
{
// check if the file is open
if
(
!
mStream
.
is_open
())
{
mStream
.
open
(
mFile
.
c_str
(),
std
::
ios
::
binary
);
}
if
(
!
mStream
.
is_open
())
{
throw
std
::
runtime_error
(
"Failed to open file: '"
+
mFile
+
"'"
);
}
if
(
!
mStream
.
good
())
return
false
;
// header
mStream
.
readHeader
();
// read record content
int
num_nuclides
=
mStream
.
readInt
();
// ITXX
mStream
.
readInt
();
// ILITE
mStream
.
readInt
();
// IACT =
mStream
.
readInt
();
// IFP =
mStream
.
readInt
();
// NRFLAG =
mStream
.
readInt
();
// MSUB1 =
mStream
.
readInt
();
// NSTEPO =
mStream
.
readInt
();
// KASEPO =
mStream
.
readInt
();
// JOBPOS =
mStream
.
readInt
();
// NOCS =
mStream
.
readInt
();
// NOBLND =
mStream
.
readInt
();
// NDSET =
mStream
.
readInt
();
// NTYPE =
mStream
.
readInt
();
// NGRP =
mStream
.
readInt
();
// NELEM =
mStream
.
readInt
();
// NVERT =
mStream
.
readInt
();
// NG =
mStream
.
readInt
();
// MMN =
mStream
.
readInt
();
// MOUT =
mStream
.
readInt
();
// INDEX =
mStream
.
readInt
();
// MSTAR =
mStream
.
readInt
();
// NUNIT =
mStream
.
readInt
();
// KBLEND =
int
num_light_element_groups
=
mStream
.
readInt
();
// NENLE =
int
num_actinide_groups
=
mStream
.
readInt
();
// NENAC =
int
num_fission_product_groups
=
mStream
.
readInt
();
// NENFP =
mStream
.
readInt
();
// L1 =
mStream
.
readInt
();
// L2 =
mStream
.
readInt
();
// L3 =
mStream
.
readInt
();
// L4 =
mStream
.
readFloat
();
// TMO =
mStream
.
readFloat
();
// FRACPW =
mStream
.
readFloat
();
// TCONST =
mStream
.
readString
(
4
);
// TUNIT =
mStream
.
readFloat
();
// TWRITE =
mStream
.
readFloat
();
// PWRITE =
mStream
.
readFloat
();
// FWRITE =
// read end of record
mStream
.
readFooter
();
// read record 2: the nuclides and their amounts
// read header
mStream
.
readHeader
();
std
::
vector
<
int
>
iza_list
((
size_t
(
num_nuclides
)));
mStream
>>
iza_list
;
std
::
vector
<
float
>
abundances
((
size_t
(
num_nuclides
)));
mStream
>>
abundances
;
std
::
string
title
=
trim_string
(
mStream
.
readString
(
80
));
std
::
string
basis
=
trim_string
(
mStream
.
readString
(
40
));
std
::
vector
<
float
>
gamma_le_bounds
((
size_t
(
num_light_element_groups
)));
mStream
>>
gamma_le_bounds
;
std
::
vector
<
float
>
gamma_ae_bounds
((
size_t
(
num_actinide_groups
)));
mStream
>>
gamma_ae_bounds
;
std
::
vector
<
float
>
gamma_fpe_bounds
((
size_t
(
num_fission_product_groups
)));
mStream
>>
gamma_fpe_bounds
;
mStream
.
peek
();
// peek into the next bit. This ensures EOF is seen in good()
// call
}
}
// namespace radix
#endif
/** RADIX_RADIXIO_F71STREAM_I_HH_ */
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment