1 #ifndef __JACOUSTICS__JGEOMETRY__
2 #define __JACOUSTICS__JGEOMETRY__
38 namespace JACOUSTICS {}
39 namespace JPP {
using namespace JACOUSTICS; }
41 namespace JACOUSTICS {
164 const double x = 1.0 - mechanics.
a*height;
166 return sqrt(1.0 + T2) * height + T2*mechanics.
b *
log(x) + 0.5*T2*mechanics.
a*mechanics.
b*mechanics.
b * (1.0/x - 1.0);
184 const size_t MAXIMUM_NUMBER_OF_ITERATIONS = 10;
190 for (
size_t i = 0;
i != MAXIMUM_NUMBER_OF_ITERATIONS; ++
i) {
192 const double ls =
getLength(parameters, mechanics, z) - length;
194 if (fabs(ls) <= precision) {
198 const double vs = 1.0 - mechanics.
a*mechanics.
b / (1.0 - mechanics.
a*z);
200 z -= ls / (1.0 + 0.5*T2 * vs*
vs);
219 const double h1 = height * (1.0 + parameters.
vs);
220 const double z1 = mechanics.
getHeight(h1);
223 parameters.
ty * z1 + parameters.
ty2 * h1*h1,
283 for (
T i = __begin;
i != __end; ++
i) {
286 i->getY() - this->
getY()));
310 if (floor >= this->size()) {
311 this->resize(floor + 1);
329 return (floor < this->size());
348 return (*
this)[floor].getHeight();
360 const size_t floor)
const
402 const size_t floor)
const
418 const size_t floor)
const
424 }
else if (floor < this->size()) {
427 const double height = (*this)[floor].getHeight();
428 const double h1 = height * (1.0 + parameters.
vs);
431 const double tx = parameters.
tx;
432 const double ty = parameters.
ty;
433 const double tz = sqrt(1.0 - tx*tx - ty*ty);
435 const double dx = pos.
getX() - position.
getX();
436 const double dy = pos.
getY() - position.
getY();
437 const double dz = pos.
getZ() - position.
getZ();
439 const double D = sqrt(dx*dx + dy*dy + dz*dz);
444 z1 * dy / D - height * (ty / tz) * dz / D,
447 height * vw * (tx * dx + ty * dy) / D + h1 * (dz / vs) / D);
467 for (
size_t i = 0;
i !=
string.size(); ++
i) {
469 out << setw(2) <<
i <<
' '
470 <<
FIXED(7,3) <<
string[
i] <<
" | "
471 <<
string.getPosition(
i) <<
' '
472 <<
string.mechanics << endl;
532 for (JDETECTOR::JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
533 buffer[module->getString()].push_back(
module_type(module->getLocation(), module->getPosition()));
538 sort(
i->second.begin(),
i->second.end(),
make_comparator(&module_type::getFloor));
540 if (
i->second[0].getFloor() == 0) {
542 JString&
string = (*this)[
i->first];
556 string.has_hydrophone =
true;
558 catch(
const exception&) {
559 string.has_hydrophone =
false;
564 THROW(
JNoValue,
"No floor 0 in string " <<
i->first <<
"; use e.g. JDetectorDB -W.");
578 return this->has(
string);
606 out << setw(4) <<
i->first << endl <<
i->second;
static double getHeight(const JMODEL::JString ¶meters, const JMechanics &mechanics, const double length, const double precision=PRECISION_M)
Get approximate height of string.
Data structure for vector in two dimensions.
Mechanical modelling of string.
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
const JMechanics & getMechanics() const
Get mechanical model parameters.
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
int getFloor() const
Get floor number.
static JPosition3D getPosition(const JMODEL::JString ¶meters, const JMechanics &mechanics, const double height)
Get position at given height according to given string model parameters and mechanics.
friend std::ostream & operator<<(std::ostream &out, const JFloor &floor)
Write floor parameters to output stream.
then set_variable DIR else fatal Wrong number of arguments fi for INPUT_FILE in ls rt $DIR stage * log
General purpose class for hash map of unique elements.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
double getHeight(const size_t floor) const
Get height of receiver at given floor with respect to reference position.
*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
JString()
Default constructor.
const JVector3D & getPosition() const
Get position of this floor.
Auxiliary data structure for floating point format specification.
double getDistance(const JVector3D &pos) const
Get distance to point.
JFloor()
Default constructor.
Data structure for detector geometry and calibration.
JPosition3D getPosition(const size_t floor) const
Get position of receiver at given floor.
Auxiliary data structure for module location and position.
Type definition of hydrophone.
static constexpr double PRECISION_M
precision of height evaluation [m]
Data structure for hydrophone.
friend std::ostream & operator<<(std::ostream &out, const JString &string)
Write string parameters to output stream.
bool hasString(int string) const
Check if this detector has given string.
JGEOMETRY::JDetector JGeometry
Type definition of detector geometry.
Exception for missing value.
module_type(const JLocation &location, const JPosition3D &position)
Constructor.
JString(const JVector3D &position, const JMechanics &mechanics)
Constructor.
Data structure for vector in three dimensions.
Logical location of module.
double getDistance(const JMODEL::JString ¶meters, const JVector3D &position, const size_t floor) const
Get distance between given position and floor according to given string model parameters.
JPosition3D getPosition(const JMODEL::JString ¶meters, const size_t floor) const
Get position of receiver at given floor according to given string model parameters.
JMODEL::JString getGradient(const JMODEL::JString ¶meters, const JVector3D &position, const size_t floor) const
Get model gradient of distance between given position and floor according to given string model param...
do set_variable OUTPUT_DIRECTORY $WORKDIR T
static double getLength(const JMODEL::JString ¶meters, const JMechanics &mechanics, const double height)
Get approximate length of string.
double a
0 <= a < (maximal height)⁻1; [m^-1]
double getHeight(const double height) const
Get effective height for given actual height.
double getLengthSquared() const
Get length squared.
double getY() const
Get y position.
const JPosition3D & getPosition() const
Get position.
JDetector(const JDETECTOR::JDetector &detector, const std::vector< JHydrophone > &hydrophones=std::vector< JHydrophone >())
Constructor.
double getLength() const
Get length.
Logical location of module.
JString(const JVector3D &position, const JMechanics &mechanics, T __begin, T __end)
Constructor.
JFloor & operator[](size_t floor)
Get floor data.
bool hasFloor(size_t floor) const
Check if this string has receiver at given floor.
int getString() const
Get string number.
friend std::ostream & operator<<(std::ostream &out, const JDetector &detector)
Write detector parameters to output stream.
JPosition3D hydrophone
Hydrophone.
JMechanics mechanics
Mechanical data.
JPosition3D getPiezoPosition()
Get relative position of piezo in optical module.
JPosition3D()
Default constructor.
JDetector()
Default constructor.
double getX() const
Get x position.
bool hasLocation(const JLocation &location) const
Check if this detector has given location.
Auxiliary data structure to list files in directory.
Data structure for position in three dimensions.
double getHeight() const
Get height of this floor.
Exception for accessing a value in a collection that is outside of its range.
JFloor(const double height, const JVector2D &position=JVector2D())
Constructor.
Model for fit to acoutsics data.
do echo Generating $dir eval D
double getZ() const
Get z position.
Auxiliary data structure for parameters of mechanical model.