Jpp
test-rotations-old-533-g2bdbdb559
the software that should make you happy
Loading...
Searching...
No Matches
examples
JPhysics
JSeaWater.cc
Go to the documentation of this file.
1
#include <string>
2
#include <iostream>
3
#include <cmath>
4
5
#include "
JPhysics/JSeaWater.hh
"
6
7
#include "
JLang/JManip.hh
"
8
9
#include "
Jeep/JParser.hh
"
10
11
12
namespace
{
13
14
/**
15
* Write atomic parameters of sea water to output stream.
16
*
17
* \param out output stream
18
* \param object atomic parameters
19
* \return output stream
20
*/
21
inline
std::ostream&
operator<<
(std::ostream& out,
const
JPHYSICS::JSeaWater::atom_type
&
object
)
22
{
23
using namespace
std
;
24
25
return
out << setw(2) << left <<
object
.ps << right <<
' '
26
<<
FIXED
(5,1) <<
object
.Z <<
' '
27
<<
FIXED
(5,1) <<
object
.A <<
' '
28
<<
FIXED
(7,4) <<
object
.f;
29
}
30
}
31
32
int
main
(
int
argc,
char
**argv)
33
{
34
using namespace
std
;
35
using namespace
JPP
;
36
37
double
precision;
38
int
debug
;
39
40
try
{
41
42
JParser<>
zap;
43
44
zap[
'p'
] =
make_field
(precision) = 1.0e-10;
45
zap[
'd'
] =
make_field
(
debug
) = 3;
46
47
zap(argc, argv);
48
}
49
catch
(
const
exception &error) {
50
FATAL
(error.what() << endl);
51
}
52
53
54
{
55
double
F = 0.0;
56
57
#ifndef RADIATION
58
const
auto
buffer = { JSeaWater::O, JSeaWater::H, JSeaWater::Na, JSeaWater::Cl };
59
#else
60
const
auto
buffer = { JSeaWater::O, JSeaWater::H, JSeaWater::Na, JSeaWater::Cl, JSeaWater::Ca, JSeaWater::Mg, JSeaWater::K, JSeaWater::S };
61
#endif
62
for
(
const
auto
& i : buffer) {
63
64
cout << i << endl;
65
66
F += i.f;
67
}
68
69
ASSERT
(fabs(F - 1.0) <= precision,
"Test total mass fraction "
<<
SCIENTIFIC
(12,3) << (F - 1.0));
70
}
71
}
JManip.hh
I/O manipulators.
ASSERT
#define ASSERT(A,...)
Assert macro.
Definition
JMessage.hh:90
FATAL
#define FATAL(A)
Definition
JMessage.hh:67
debug
int debug
debug level
Definition
JSirene.cc:72
JParser.hh
Utility class to parse command line options.
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition
JParser.hh:2142
main
int main(int argc, char **argv)
Definition
JSeaWater.cc:32
JSeaWater.hh
JPARSER::JParser
Utility class to parse command line options.
Definition
JParser.hh:1698
operator<<
std::ostream & operator<<(std::ostream &stream, const CLBCommonHeader &header)
Definition
clb_common_header.hh:72
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition
JAAnetToolkit.hh:45
std
Definition
JSTDTypes.hh:14
FIXED
Auxiliary data structure for floating point format specification.
Definition
JManip.hh:448
JPHYSICS::JSeaWater::atom_type
Definition
JSeaWater.hh:18
SCIENTIFIC
Auxiliary data structure for floating point format specification.
Definition
JManip.hh:488
Generated by
1.12.0