Jpp
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
JAcoustics
JGeometry.cc
Go to the documentation of this file.
1
#include <iostream>
2
#include <iomanip>
3
#include <fstream>
4
5
#include "
JAcoustics/JGeometry.hh
"
6
#include "
JAcoustics/JModel.hh
"
7
8
#include "
Jeep/JParser.hh
"
9
#include "
Jeep/JMessage.hh
"
10
11
12
/**
13
* Example application for acoustics geometry.
14
*/
15
int
main
(
int
argc,
char
**argv)
16
{
17
using namespace
std;
18
using namespace
JPP;
19
20
JMODEL::JString
parameters
;
21
JMechanics
mechanics;
22
string
outputFile
;
23
int
debug
;
24
25
try
{
26
27
JParser<>
zap(
"Example application for acoustics geometry."
);
28
29
zap[
'S'
] =
make_field
(
parameters
) =
JPARSER::initialised
();
30
zap[
'M'
] =
make_field
(mechanics) =
JPARSER::initialised
();
31
zap[
'o'
] =
make_field
(
outputFile
) =
""
;
32
zap[
'd'
] =
make_field
(
debug
) = 3;
33
34
zap(argc, argv);
35
}
36
catch
(
const
exception &error) {
37
FATAL
(error.what() << endl);
38
}
39
40
41
// build string
42
43
const
double
x0 = 0.0;
44
const
double
y0 = 0.0;
45
const
double
z0 = 0.0;
46
const
double
z1 = 20.0;
47
const
double
dz = 10.0;
48
49
JGEOMETRY::JString
string(
JPosition3D
(x0, y0, z0));
50
51
string
[0] =
JGEOMETRY::JFloor
(z0);
52
53
for
(
int
i = 1; i <= 18; ++i) {
54
string
[i] =
JGEOMETRY::JFloor
(z1 + (i - 1)*dz);
55
}
56
57
string
.mechanics = mechanics;
58
59
for
(
int
i = 1; i <= 18; ++i) {
60
61
const
JPosition3D
pos[] = {
62
string
.
getPosition
(
parameters
, i - 1),
63
string
.
getPosition
(
parameters
, i)
64
};
65
66
cout << setw(2) << i <<
' '
67
<<
FIXED
(7,3) << pos[1].
getX
() <<
' '
68
<<
FIXED
(7,3) << pos[1].
getY
() <<
' '
69
<<
FIXED
(7,3) << pos[1].
getZ
() <<
' '
70
<<
FIXED
(7,3) << pos[1].
getX
() - pos[0].
getX
() <<
' '
71
<<
FIXED
(7,3) << pos[1].
getY
() - pos[0].
getY
() << endl;
72
}
73
74
if
(
outputFile
!=
""
) {
75
76
ofstream out(
outputFile
.c_str());
77
78
for
(
int
i = 1; i <= 18; ++i) {
79
80
const
JPosition3D
pos =
string
.
getPosition
(
parameters
, i);
81
82
out <<
FIXED
(7,3) << pos.
getX
() <<
' '
<<
FIXED
(7,3) << pos.
getZ
() << endl;
83
}
84
85
out.close();
86
}
87
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1500
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
JGeometry.hh
Acoustic geometries.
parameters
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition:
diff-Tuna.sh:38
JPARSER::initialised
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition:
JParser.hh:66
JACOUSTICS::JGEOMETRY::JString
String geometry.
Definition:
JGeometry.hh:122
FIXED
Auxiliary data structure for floating point format specification.
Definition:
JManip.hh:445
outputFile
string outputFile
Definition:
JDAQTimesliceSelector.cc:37
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1961
JGEOMETRY3D::JVector3D::getY
double getY() const
Get y position.
Definition:
JVector3D.hh:104
debug
int debug
debug level
Definition:
JSirene.cc:63
JGEOMETRY3D::JPosition3D::getPosition
const JPosition3D & getPosition() const
Get position.
Definition:
JPosition3D.hh:130
JACOUSTICS::JMODEL::JString
String parameters.
Definition:
JAcoustics/JModel.hh:47
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JParser.hh
Utility class to parse command line options.
JGEOMETRY3D::JVector3D::getX
double getX() const
Get x position.
Definition:
JVector3D.hh:94
JGEOMETRY3D::JPosition3D
Data structure for position in three dimensions.
Definition:
JPosition3D.hh:36
JModel.hh
Model for fit to acoutsics data.
JGEOMETRY3D::JVector3D::getZ
double getZ() const
Get z position.
Definition:
JVector3D.hh:115
JACOUSTICS::JGEOMETRY::JFloor
Floor geometry.
Definition:
JGeometry.hh:58
JACOUSTICS::JMechanics
Auxiliary data structure for parameters of mechanical model.
Definition:
JMechanics.hh:30
Generated by
1.8.5