MURE
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
BinaryFormat2.hxx
Go to the documentation of this file.
1 #ifndef _BINARYFORMAT2_
2 #define _BINARYFORMAT2_
3 
4 #include <fstream>
5 using namespace std;
6 
20 struct FileHeader
22 {
23  FileHeader() {Version=1;}
24  short Version;
25  float Time;
26  float K;
27  float Kerr;
28  int NCells;
29  void write(ofstream &out);
30  void read(ifstream &in);
31 };
32 
34 struct CellHeader
35 {
36  int CellNumber;
37  float Volume;
38  float Flux;
39  float FluxErr;
41  void write(ofstream &out);
42  void read(ifstream &in);
43 };
44 
47 {
48  short Z;
49  short A;
50  short I;
51  float Mass;
52  float Proportion;
54  void write(ofstream &out);
55  void read(ifstream &in);
56 };
57 
60 {
61  short Code;
62  float Sigma;
63  float SigmaErr;
64  void write(ofstream &out);
65  void read(ifstream &in);
66 };
67 //--------------------------------------------------------
68 // Implementation of methods
69 //-------------------------------------------------------
70 void FileHeader::write(ofstream &out)
71 {
72  out.write((char*)&Version,sizeof(Version));
73  out.write((char*)&Time,sizeof(Time));
74  out.write((char*)&K,sizeof(K));
75  out.write((char*)&Kerr,sizeof(Kerr));
76  out.write((char*)&NCells,sizeof(NCells));
77 }
78 
79 void FileHeader::read(ifstream &in)
80 {
81  in.read((char*)&Version,sizeof(Version));
82  in.read((char*)&Time,sizeof(Time));
83  in.read((char*)&K,sizeof(K));
84  in.read((char*)&Kerr,sizeof(Kerr));
85  in.read((char*)&NCells,sizeof(NCells));
86 }
87 
88 void CellHeader::write(ofstream &out)
89 {
90  out.write((char*)&CellNumber,sizeof(CellNumber));
91  out.write((char*)&Volume,sizeof(Volume));
92  out.write((char*)&Flux,sizeof(Flux));
93  out.write((char*)&FluxErr,sizeof(FluxErr));
94  out.write((char*)&NNucleusRecords,sizeof(NNucleusRecords));
95 }
96 
97 void CellHeader::read(ifstream &in)
98 {
99  in.read((char*)&CellNumber,sizeof(CellNumber));
100  in.read((char*)&Volume,sizeof(Volume));
101  in.read((char*)&Flux,sizeof(Flux));
102  in.read((char*)&FluxErr,sizeof(FluxErr));
103  in.read((char*)&NNucleusRecords,sizeof(NNucleusRecords));
104 }
105 
106 void NucleusRecord::write(ofstream &out)
107 {
108  out.write((char*)&Z,sizeof(Z));
109  out.write((char*)&A,sizeof(A));
110  out.write((char*)&I,sizeof(I));
111  out.write((char*)&Mass,sizeof(Mass));
112  out.write((char*)&Proportion,sizeof(Proportion));
113  out.write((char*)&NReactionRecords,sizeof(NReactionRecords));
114 }
115 
116 void NucleusRecord::read(ifstream &in)
117 {
118  in.read((char*)&Z,sizeof(Z));
119  in.read((char*)&A,sizeof(A));
120  in.read((char*)&I,sizeof(I));
121  in.read((char*)&Mass,sizeof(Mass));
122  in.read((char*)&Proportion,sizeof(Proportion));
123  in.read((char*)&NReactionRecords,sizeof(NReactionRecords));
124 }
125 
126 void ReactionRecord::write(ofstream &out)
127 {
128  out.write((char*)&Code,sizeof(Code));
129  out.write((char*)&Sigma,sizeof(Sigma));
130  out.write((char*)&SigmaErr,sizeof(SigmaErr));
131 }
132 
133 void ReactionRecord::read(ifstream &in)
134 {
135  in.read((char*)&Code,sizeof(Code));
136  in.read((char*)&Sigma,sizeof(Sigma));
137  in.read((char*)&SigmaErr,sizeof(SigmaErr));
138 }
139 
140 
141 #endif
float Volume
Volume of the cell.
Definition: BinaryFormat2.hxx:37
float K
keff
Definition: BinaryFormat2.hxx:26
float Proportion
Number of this nuclei in cell.
Definition: BinaryFormat2.hxx:52
int NNucleusRecords
Number of nuclei records in this cell.
Definition: BinaryFormat2.hxx:40
float Kerr
keff error
Definition: BinaryFormat2.hxx:27
short Version
Binary gile version.
Definition: BinaryFormat2.hxx:24
int CellNumber
MCNP number of this cell.
Definition: BinaryFormat2.hxx:36
Record of a reaction in a binary file.
Definition: BinaryFormat2.hxx:59
void write(ofstream &out)
Write the record into a stream.
Definition: BinaryFormat2.hxx:106
Record of a nucleus in a binary file.
Definition: BinaryFormat2.hxx:46
short Z
Proton number of the nucleus.
Definition: BinaryFormat2.hxx:48
int NCells
Number of evolving cells.
Definition: BinaryFormat2.hxx:28
float Mass
Atomic mass.
Definition: BinaryFormat2.hxx:51
void write(ofstream &out)
Write the header into a stream.
Definition: BinaryFormat2.hxx:88
float SigmaErr
Cross-section error.
Definition: BinaryFormat2.hxx:63
void read(ifstream &in)
Read the record from a stream.
Definition: BinaryFormat2.hxx:133
void read(ifstream &in)
Read the header from a stream.
Definition: BinaryFormat2.hxx:97
short I
Isomeric state of the nucleus.
Definition: BinaryFormat2.hxx:50
short Code
Reaction code.
Definition: BinaryFormat2.hxx:61
short NReactionRecords
Number of reaction records of this nucleus.
Definition: BinaryFormat2.hxx:53
Header of an evolving cell in a binary file.
Definition: BinaryFormat2.hxx:34
void write(ofstream &out)
Write the record into a stream.
Definition: BinaryFormat2.hxx:126
float Time
Time of MCNP step at which this file is printed.
Definition: BinaryFormat2.hxx:25
float Sigma
Reaction cross-section.
Definition: BinaryFormat2.hxx:62
float FluxErr
Flux error.
Definition: BinaryFormat2.hxx:39
FileHeader()
Constructor.
Definition: BinaryFormat2.hxx:23
void read(ifstream &in)
Read the header from a stream.
Definition: BinaryFormat2.hxx:79
float Flux
Flux in this cell.
Definition: BinaryFormat2.hxx:38
short A
Nucleon number of the nucleus.
Definition: BinaryFormat2.hxx:49
void write(ofstream &out)
Write the header into a stream.
Definition: BinaryFormat2.hxx:70
Header of MURE output binary file.
Definition: BinaryFormat2.hxx:21
void read(ifstream &in)
Read the record from a stream.
Definition: BinaryFormat2.hxx:116

MURE Project, documentation generated by Doxygen 1.8.5 - Mon Nov 17 2014