Jpp 20.0.0-rc.9-29-gccc23c492-D
the software that should make you happy
Loading...
Searching...
No Matches
Classes | Public Member Functions | Friends | List of all members
JACOUSTICS::JGEOMETRY::JDetector Struct Reference

Detector geometry. More...

#include <JGeometry.hh>

Inheritance diagram for JACOUSTICS::JGEOMETRY::JDetector:

Classes

struct  module_type
 Auxiliary data structure for module location and position. More...
 

Public Member Functions

 JDetector ()
 Default constructor.
 
 JDetector (const JDETECTOR::JDetector &detector, const std::vector< JHydrophone > &hydrophones=std::vector< JHydrophone >())
 Constructor.
 
bool hasString (int string) const
 Check if this detector has given string.
 
bool hasLocation (const JLocation &location) const
 Check if this detector has given location.
 

Friends

std::ostream & operator<< (std::ostream &out, const JDetector &detector)
 Write detector parameters to output stream.
 

Detailed Description

Detector geometry.

Definition at line 499 of file JGeometry.hh.

Constructor & Destructor Documentation

◆ JDetector() [1/2]

JACOUSTICS::JGEOMETRY::JDetector::JDetector ( )
inline

Default constructor.

Definition at line 505 of file JGeometry.hh.

506 {}

◆ JDetector() [2/2]

JACOUSTICS::JGEOMETRY::JDetector::JDetector ( const JDETECTOR::JDetector & detector,
const std::vector< JHydrophone > & hydrophones = std::vector<JHydrophone>() )
inline

Constructor.

Note that the positions of the base modules correspond to the reference position of the string.
As a consequence, a base module (i.e. floor = 0) is required for each string.
Missing base modules should therefore be added beforehand (e.g. using application JDetectorDB.cc).

Note that if the position of a hydrophone is not available, it is assumed that there is no hydrophone on that string.
If the position of the hydrophone is manually set, the corresponding parameter JString::has_hydrophone should be set to true.

Parameters
detectordetector
hydrophonescontainer with data of hydrophones

Definition at line 524 of file JGeometry.hh.

526 {
527 using namespace std;
528 using namespace JPP;
529
530 map<int, vector<module_type> > buffer; // string -> modules
531
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()));
534 }
535
536 for (map<int, vector<module_type> >::iterator i = buffer.begin(); i != buffer.end(); ++i) {
537
538 sort(i->second.begin(), i->second.end(), make_comparator(&module_type::getFloor));
539
540 if (i->second[0].getFloor() == 0) {
541
542 JString& string = (*this)[i->first];
543
544 vector<module_type>::iterator p = i->second.begin();
545
546 ++p;
547
548 string = JGEOMETRY::JString(i->second[0].getPosition(), getMechanics(i->first), p, i->second.end());
549
550 try {
551
552 string.hydrophone = getPosition(hydrophones.begin(),
553 hydrophones.end(),
554 make_predicate(&JHydrophone::getString, i->first));
555
556 string.has_hydrophone = true;
557 }
558 catch(const exception&) {
559 string.has_hydrophone = false;
560 }
561
562 } else {
563
564 THROW(JNoValue, "No floor 0 in string " << i->first << "; use e.g. JDetectorDB -W.");
565 }
566 }
567 }
JVector3D getPosition(T __begin, T __end, const JPredicate< JTypename_t, JComparator_t > &predicate)
Get position from element in data which corresponds to given predicate.
static JDetectorMechanics getMechanics
Function object to get string mechanics.

Member Function Documentation

◆ hasString()

bool JACOUSTICS::JGEOMETRY::JDetector::hasString ( int string) const
inline

Check if this detector has given string.

Parameters
stringstring
Returns
true if string present; else false

Definition at line 576 of file JGeometry.hh.

577 {
578 return this->has(string);
579 }

◆ hasLocation()

bool JACOUSTICS::JGEOMETRY::JDetector::hasLocation ( const JLocation & location) const
inline

Check if this detector has given location.

Parameters
locationlocation
Returns
true if location present; else false

Definition at line 588 of file JGeometry.hh.

589 {
590 return this->hasString(location.getString()) && (*this)[location.getString()].hasFloor(location.getFloor());
591 }
bool hasString(int string) const
Check if this detector has given string.
Definition JGeometry.hh:576

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & out,
const JDetector & detector )
friend

Write detector parameters to output stream.

Parameters
outoutput stream
detectordetector
Returns
output stream

Definition at line 601 of file JGeometry.hh.

602 {
603 using namespace std;
604
605 for (JDetector::const_iterator i = detector.begin(); i != detector.end(); ++i) {
606 out << setw(4) << i->first << endl << i->second;
607 }
608
609 return out;
610 }

The documentation for this struct was generated from the following file: