Jpp  15.0.4
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
JDYNAMICS::JDynamics::JPosition Struct Reference

Dynamic position calibration. More...

#include <JDynamics.hh>

Inheritance diagram for JDYNAMICS::JDynamics::JPosition:
JDYNAMICS::JDynamics::JUTCTracker JUTC::JUTCTimeRange JTOOLS::JRange< T, JComparator_t > JTOOLS::JPair< T, T > JLANG::JEquals< JFirst_t, JSecond_t > JMATH::JMath< JFirst_t, JSecond_t >

Public Types

enum  { NUMBER_OF_POINTS = 7, NUMBER_OF_DEGREES = 2 }
 
typedef JACOUSTICS::JGeometry JGeometry
 
typedef JTOOLS::JElement2D
< double,
JACOUSTICS::JMODEL::JString
element_type
 
typedef
JTOOLS::JPolfitFunction1D
< NUMBER_OF_POINTS,
NUMBER_OF_DEGREES,
element_type,
JTOOLS::JCollection
function_type
 
typedef JTOOLS::JHashMap< int,
function_type
data_type
 
typedef data_type::const_iterator const_iterator
 
typedef
data_type::const_reverse_iterator 
const_reverse_iterator
 
typedef std::pair< T, Tpair_type
 
typedef JRange< T, JComparator_t > range_type
 
typedef JLANG::JClass< T >
::argument_type 
argument_type
 
typedef T key_type
 
typedef T mapped_type
 

Public Member Functions

 JPosition (const JDetector &detector, const double Tmax_s)
 Constructor. More...
 
void load (JObjectIterator< JACOUSTICS::JEvt > &input)
 Load calibration data. More...
 
bool empty () const
 empty More...
 
size_t size () const
 size More...
 
const_iterator begin () const
 begin of calibration data More...
 
const_iterator end () const
 end of calibration data More...
 
const_reverse_iterator rbegin () const
 begin of reverse of calibration data More...
 
const_reverse_iterator rend () const
 begin of reverse of calibration data More...
 
double getCoverage (const JDetector &detector, const double t1_s) const
 Get coverage. More...
 
const JGeometrygetGeometry () const
 Get detector geometry. More...
 
void update (JDetector &detector, const double t1_s)
 Calibrate given detector at given UTC time. More...
 
void reset ()
 Reset. More...
 
void set (const double t0_s)
 Set. More...
 
const JUTCTimeRangegetUTCTimeRange () const
 Get UTC time range. More...
 
void setUTCTimeRange (const JRange< double > &timerange)
 Set UTC time range. More...
 
 operator pair_type () const
 Type conversion operator. More...
 
const range_typegetRange () const
 Get range. More...
 
void setRange (const range_type &range)
 Set range. More...
 
void setRange (argument_type x, argument_type y)
 Set lower and upper limit. More...
 
template<class R >
void setRange (R first, R second)
 Set range. More...
 
template<class JElement_t , class JAllocator_t >
void setRange (const array_type< JElement_t, JAllocator_t > &buffer)
 Set lower and upper limit according to input data. More...
 
T getLowerLimit () const
 Get lower limit. More...
 
T getUpperLimit () const
 Get upper limit. More...
 
void setLowerLimit (argument_type x)
 Set lower limit. More...
 
void setUpperLimit (argument_type y)
 Set upper limit. More...
 
void fixLowerLimit (argument_type x)
 Fix lower limit. More...
 
void fixUpperLimit (argument_type y)
 Fix upper limit. More...
 
bool equals (const range_type &range) const
 Equal method. More...
 
T getLength () const
 Get length (difference between upper and lower limit). More...
 
void setLength (argument_type length)
 Set length (difference between upper and lower limit). More...
 
bool is_valid () const
 Check validity of range. More...
 
bool in_range (argument_type x) const
 Test whether value is inside range. More...
 
bool operator() (argument_type x) const
 Test whether value is inside range. More...
 
T constrain (argument_type x) const
 Constrain value to range. More...
 
T mod (argument_type x) const
 Modulo value with respect to range. More...
 
bool overlap (const range_type &range) const
 Test overlap with given range. More...
 
range_type include (argument_type x)
 Include given value to range. More...
 
range_typejoin (const range_type &range)
 Join ranges. More...
 
range_typecombine (const range_type &range)
 Combine ranges. More...
 
range_typeadd (argument_type x)
 Add offset. More...
 
range_typeadd (const range_type &range)
 Add offsets. More...
 
range_typesub (argument_type x)
 Subtract offset. More...
 
range_typesub (const range_type &range)
 Subtract offsets. More...
 
range_typemul (const double factor)
 Multiply range. More...
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object. More...
 
range_typediv (const double factor)
 Divide range. More...
 
T getN (const double R) const
 Get expected number of occurances of given rate within this interval. More...
 
const key_typegetKey () const
 
const mapped_typegetValue () const
 
mapped_typegetValue ()
 

Static Public Member Functions

static T getMinimum ()
 Get minimum possible value. More...
 
static T getMaximum ()
 Get maximum possible value. More...
 

Public Attributes

JComparator_t compare
 Function object. More...
 
T first
 
T second
 

Static Public Attributes

static const JRange< T,
JComparator_t > 
DEFAULT_RANGE
 Default range. More...
 

Protected Member Functions

template<class R >
void setRange (R first, R second, const JLANG::JBool< false > &option)
 Set range. More...
 
template<class R >
void setRange (R first, R second, const JLANG::JBool< true > &option)
 Set range. More...
 

Protected Attributes

JGeometry geometry
 
data_type calibration
 

Detailed Description

Dynamic position calibration.

Definition at line 278 of file JDynamics.hh.

Member Typedef Documentation

Definition at line 286 of file JDynamics.hh.

Definition at line 288 of file JDynamics.hh.

Definition at line 291 of file JDynamics.hh.

Definition at line 293 of file JDynamics.hh.

Definition at line 295 of file JDynamics.hh.

Definition at line 296 of file JDynamics.hh.

template<class T, class JComparator_t = std::less<T>>
typedef std::pair<T,T> JTOOLS::JRange< T, JComparator_t >::pair_type
inherited

Definition at line 45 of file JRange.hh.

template<class T, class JComparator_t = std::less<T>>
typedef JRange<T, JComparator_t> JTOOLS::JRange< T, JComparator_t >::range_type
inherited

Definition at line 46 of file JRange.hh.

template<class T, class JComparator_t = std::less<T>>
typedef JLANG::JClass<T>::argument_type JTOOLS::JRange< T, JComparator_t >::argument_type
inherited

Definition at line 47 of file JRange.hh.

typedef T JTOOLS::JPair< T , T >::key_type
inherited

Definition at line 32 of file JPair.hh.

typedef T JTOOLS::JPair< T , T >::mapped_type
inherited

Definition at line 33 of file JPair.hh.

Member Enumeration Documentation

anonymous enum
Enumerator
NUMBER_OF_POINTS 

number of points for interpolation

NUMBER_OF_DEGREES 

number of degrees for interpolation

Definition at line 281 of file JDynamics.hh.

281  {
282  NUMBER_OF_POINTS = 7, //!< number of points for interpolation
283  NUMBER_OF_DEGREES = 2 //!< number of degrees for interpolation
284  };
number of degrees for interpolation
Definition: JDynamics.hh:283
number of points for interpolation
Definition: JDynamics.hh:282

Constructor & Destructor Documentation

JDYNAMICS::JDynamics::JPosition::JPosition ( const JDetector detector,
const double  Tmax_s 
)
inline

Constructor.

Parameters
detectordetector
Tmax_sapplicability period of calibration [s]

Definition at line 305 of file JDynamics.hh.

306  :
308  geometry(detector)
309  {
310  using namespace JPP;
311 
312  if (getDetectorVersion(detector.getVersion()) < JDetectorVersion::V4) {
313  THROW(JValueOutOfRange, "Detector version " << detector.getVersion() << " < " << JDetectorVersion::V4);
314  }
315  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
const std::string & getVersion() const
Get version.
JUTCTracker(const double Tmax_s)
Constructor.
Definition: JDynamics.hh:75
static const JGetDetectorVersion getDetectorVersion
Function object to map detector version to numerical value.
Exception for accessing a value in a collection that is outside of its range.
Definition: JException.hh:162
then usage $script< detector file >< tripodfile >< stage > input file nInput files correspond to the output of JAcousticsEventBuilder[.sh] nFirst stage eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY eval JPrintDetector a $DETECTOR O CAN source JAcoustics sh $DETECTOR_ID typeset A CONFIGURATION for key in Tmax_s

Member Function Documentation

void JDYNAMICS::JDynamics::JPosition::load ( JObjectIterator< JACOUSTICS::JEvt > &  input)
inline

Load calibration data.

Parameters
inputcalibration data

Definition at line 323 of file JDynamics.hh.

324  {
325  using namespace JPP;
326 
327  this->reset();
328 
329  while (input.hasNext()) {
330 
331  const JACOUSTICS::JEvt* evt = input.next();
332  const double t1_s = 0.5 * (evt->UNIXTimeStart + evt->UNIXTimeStop);
333 
334  for (JACOUSTICS::JEvt::const_iterator i = evt->begin(); i != evt->end(); ++i) {
335  calibration[i->id][t1_s] = JMODEL::JString(i->tx, i->ty);
336  }
337  }
338 
339  for (data_type::iterator i = calibration.begin(); i != calibration.end(); ++i) {
340  i->second.compile();
341  }
342  }
double UNIXTimeStop
stop time
virtual const pointer_type & next()=0
Get next element.
Acoustic event fit.
virtual bool hasNext()=0
Check availability of next element.
double UNIXTimeStart
start time
container_type::iterator iterator
Definition: JHashMap.hh:88
bool JDYNAMICS::JDynamics::JPosition::empty ( ) const
inline

empty

Definition at line 345 of file JDynamics.hh.

size_t JDYNAMICS::JDynamics::JPosition::size ( ) const
inline

size

Definition at line 346 of file JDynamics.hh.

const_iterator JDYNAMICS::JDynamics::JPosition::begin ( ) const
inline

begin of calibration data

Definition at line 347 of file JDynamics.hh.

const_iterator JDYNAMICS::JDynamics::JPosition::end ( ) const
inline

end of calibration data

Definition at line 348 of file JDynamics.hh.

const_reverse_iterator JDYNAMICS::JDynamics::JPosition::rbegin ( ) const
inline

begin of reverse of calibration data

Definition at line 349 of file JDynamics.hh.

const_reverse_iterator JDYNAMICS::JDynamics::JPosition::rend ( ) const
inline

begin of reverse of calibration data

Definition at line 350 of file JDynamics.hh.

double JDYNAMICS::JDynamics::JPosition::getCoverage ( const JDetector detector,
const double  t1_s 
) const
inline

Get coverage.

Parameters
detectordetector
t1_sUTC time [s]
Returns
coverage [0,1]

Definition at line 360 of file JDynamics.hh.

361  {
362  int n0 = 0;
363  int n1 = 0;
364 
365  std::set<int> string;
366 
367  for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
368  if (module->getFloor() != 0) {
369  string.insert(module->getString());
370  }
371  }
372 
373  for (std::set<int>::const_iterator i = string.begin(); i != string.end(); ++i) {
374 
375  ++n0;
376 
377  if (calibration.has(*i) && !calibration.get(*i).empty()) {
378  if (calibration[*i].getXmin() <= t1_s &&
379  calibration[*i].getXmax() >= t1_s) {
380  ++n1;
381  }
382  }
383  }
384 
385  return (double) n1 / (double) n0;
386  }
virtual mapped_type & get(typename JClass< key_type >::argument_type key) override
Get mapped value.
Definition: JHashMap.hh:119
const_iterator begin() const
begin of calibration data
Definition: JDynamics.hh:347
bool has(const T &value) const
Test whether given value is present.
const JGeometry& JDYNAMICS::JDynamics::JPosition::getGeometry ( ) const
inline

Get detector geometry.

Returns
detector geometry

Definition at line 394 of file JDynamics.hh.

395  {
396  return geometry;
397  }
void JDYNAMICS::JDynamics::JPosition::update ( JDetector detector,
const double  t1_s 
)
inline

Calibrate given detector at given UTC time.

Parameters
detectordetector (I/O)
t1_sUTC time [s]

Definition at line 406 of file JDynamics.hh.

407  {
408  using namespace std;
409  using namespace JPP;
410 
411  if (!calibration.empty()) {
412 
413  if (!in_range(t1_s)) {
414 
416 
417  for (JDetector::iterator module = detector.begin(); module != detector.end(); ++module) {
418 
419  if (module->getFloor() != 0) {
420 
421  if (!buffer.has(module->getString())) {
422 
423  if (calibration.has(module->getString())) {
424 
425  const function_type& f1 = calibration.get(module->getString());
426 
427  if (!f1.empty()) {
428  if (t1_s >= f1.getXmin() && t1_s <= f1.getXmax()) {
429  buffer[module->getString()] = f1(t1_s);
430  }
431  }
432  }
433  }
434 
435  if (buffer.has(module->getString())) {
436  module->set(geometry[module->getString()].getPosition(buffer[module->getString()], module->getFloor()) - getPiezoPosition());
437  }
438  }
439  }
440 
441  set(t1_s);
442  }
443  }
444  }
void set(const double t0_s)
Set.
Definition: JDynamics.hh:94
General purpose class for hash map of unique keys.
Definition: JHashMap.hh:72
virtual mapped_type & get(typename JClass< key_type >::argument_type key) override
Get mapped value.
Definition: JHashMap.hh:119
bool in_range(argument_type x) const
Test whether value is inside range.
Definition: JRange.hh:323
JPosition3D getPiezoPosition()
Get relative position of piezo in optical module.
bool has(const T &value) const
Test whether given value is present.
JTOOLS::JPolfitFunction1D< NUMBER_OF_POINTS, NUMBER_OF_DEGREES, element_type, JTOOLS::JCollection > function_type
Definition: JDynamics.hh:291
void JDYNAMICS::JDynamics::JUTCTracker::reset ( )
inlineinherited

Reset.

Definition at line 83 of file JDynamics.hh.

84  {
85  set(0.0);
86  }
void set(const double t0_s)
Set.
Definition: JDynamics.hh:94
void JDYNAMICS::JDynamics::JUTCTracker::set ( const double  t0_s)
inlineinherited

Set.

Parameters
t0_sUTC time [s]

Definition at line 94 of file JDynamics.hh.

95  {
96  const double Tmax_s = 0.5 * (getUpperLimit() - getLowerLimit());
97 
98  setRange(t0_s - Tmax_s, t0_s + Tmax_s);
99  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
void setRange(const range_type &range)
Set range.
Definition: JRange.hh:146
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
then usage $script< detector file >< tripodfile >< stage > input file nInput files correspond to the output of JAcousticsEventBuilder[.sh] nFirst stage eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY eval JPrintDetector a $DETECTOR O CAN source JAcoustics sh $DETECTOR_ID typeset A CONFIGURATION for key in Tmax_s
const JUTCTimeRange& JUTC::JUTCTimeRange::getUTCTimeRange ( ) const
inlineinherited

Get UTC time range.

Returns
UTC time range

Definition at line 63 of file JUTCTimeRange.hh.

64  {
65  return static_cast<const JUTCTimeRange&>(*this);
66  }
UTC time range [s].
void JUTC::JUTCTimeRange::setUTCTimeRange ( const JRange< double > &  timerange)
inlineinherited

Set UTC time range.

Parameters
timerangeUTC time range

Definition at line 74 of file JUTCTimeRange.hh.

75  {
76  static_cast<JUTCTimeRange&>(*this) = timerange;
77  }
UTC time range [s].
template<class T, class JComparator_t = std::less<T>>
JTOOLS::JRange< T, JComparator_t >::operator pair_type ( ) const
inlineinherited

Type conversion operator.

Returns
piar

Definition at line 124 of file JRange.hh.

125  {
127  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
std::pair< T, T > pair_type
Definition: JRange.hh:45
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
template<class T, class JComparator_t = std::less<T>>
const range_type& JTOOLS::JRange< T, JComparator_t >::getRange ( ) const
inlineinherited

Get range.

Returns
range

Definition at line 135 of file JRange.hh.

136  {
137  return static_cast<const range_type&>(*this);
138  }
JRange< T, JComparator_t > range_type
Definition: JRange.hh:46
template<class T, class JComparator_t = std::less<T>>
void JTOOLS::JRange< T, JComparator_t >::setRange ( const range_type range)
inlineinherited

Set range.

Parameters
rangerange

Definition at line 146 of file JRange.hh.

147  {
148  static_cast<range_type&>(*this) = range;
149  }
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
JRange< T, JComparator_t > range_type
Definition: JRange.hh:46
template<class T, class JComparator_t = std::less<T>>
void JTOOLS::JRange< T, JComparator_t >::setRange ( argument_type  x,
argument_type  y 
)
inlineinherited

Set lower and upper limit.

Parameters
xlower limit
yupper limit

Definition at line 158 of file JRange.hh.

159  {
160  this->first = x;
161  this->second = y;
162  }
template<class T, class JComparator_t = std::less<T>>
template<class R >
void JTOOLS::JRange< T, JComparator_t >::setRange ( R  first,
R  second 
)
inlineinherited

Set range.


The arguments could be values or iterators.

Parameters
firstfirst
secondsecond

Definition at line 173 of file JRange.hh.

174  {
175  using namespace JLANG;
176 
178  }
Auxiliary template class for type bool.
Definition: JBool.hh:20
Data structure to check whether given data type is an iterator.
Definition: JClass.hh:62
void setRange(const range_type &range)
Set range.
Definition: JRange.hh:146
template<class T, class JComparator_t = std::less<T>>
template<class JElement_t , class JAllocator_t >
void JTOOLS::JRange< T, JComparator_t >::setRange ( const array_type< JElement_t, JAllocator_t > &  buffer)
inlineinherited

Set lower and upper limit according to input data.

Parameters
bufferinput data

Definition at line 187 of file JRange.hh.

188  {
190 
191  for (typename array_type<JElement_t, JAllocator_t>::const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
192  include(*i);
193  }
194  }
range_type include(argument_type x)
Include given value to range.
Definition: JRange.hh:398
static T getMinimum()
Get minimum possible value.
Definition: JRange.hh:547
void setRange(const range_type &range)
Set range.
Definition: JRange.hh:146
static T getMaximum()
Get maximum possible value.
Definition: JRange.hh:558
Auxiliary data structure for return type of make methods.
Definition: JVectorize.hh:26
template<class T, class JComparator_t = std::less<T>>
template<class R >
void JTOOLS::JRange< T, JComparator_t >::setRange ( R  first,
R  second,
const JLANG::JBool< false > &  option 
)
inlineprotectedinherited

Set range.

Parameters
firstfirst
secondsecond
optionfalse

Definition at line 589 of file JRange.hh.

590  {
592  }
void setRange(const range_type &range)
Set range.
Definition: JRange.hh:146
JLANG::JClass< T >::argument_type argument_type
Definition: JRange.hh:47
template<class T, class JComparator_t = std::less<T>>
template<class R >
void JTOOLS::JRange< T, JComparator_t >::setRange ( R  first,
R  second,
const JLANG::JBool< true > &  option 
)
inlineprotectedinherited

Set range.

Parameters
firstfirst
secondsecond
optiontrue

Definition at line 603 of file JRange.hh.

604  {
606 
607  for (R i = first; i != second; ++i) {
608  include(*i);
609  }
610  }
range_type include(argument_type x)
Include given value to range.
Definition: JRange.hh:398
static T getMinimum()
Get minimum possible value.
Definition: JRange.hh:547
void setRange(const range_type &range)
Set range.
Definition: JRange.hh:146
static T getMaximum()
Get maximum possible value.
Definition: JRange.hh:558
then usage $script[distance] fi case set_variable R
Definition: JDrawLED.sh:43
template<class T, class JComparator_t = std::less<T>>
T JTOOLS::JRange< T, JComparator_t >::getLowerLimit ( ) const
inlineinherited

Get lower limit.

Returns
lower limit

Definition at line 202 of file JRange.hh.

203  {
204  return this->first;
205  }
template<class T, class JComparator_t = std::less<T>>
T JTOOLS::JRange< T, JComparator_t >::getUpperLimit ( ) const
inlineinherited

Get upper limit.

Returns
upper limit

Definition at line 213 of file JRange.hh.

214  {
215  return this->second;
216  }
template<class T, class JComparator_t = std::less<T>>
void JTOOLS::JRange< T, JComparator_t >::setLowerLimit ( argument_type  x)
inlineinherited

Set lower limit.

Parameters
xlower limit

Definition at line 224 of file JRange.hh.

225  {
226  this->first = x;
227  }
template<class T, class JComparator_t = std::less<T>>
void JTOOLS::JRange< T, JComparator_t >::setUpperLimit ( argument_type  y)
inlineinherited

Set upper limit.

Parameters
yupper limit

Definition at line 235 of file JRange.hh.

236  {
237  this->second = y;
238  }
template<class T, class JComparator_t = std::less<T>>
void JTOOLS::JRange< T, JComparator_t >::fixLowerLimit ( argument_type  x)
inlineinherited

Fix lower limit.

The range is shifted to the given lower limit.

Parameters
xlower limit

Definition at line 248 of file JRange.hh.

249  {
250  this->second += x - this->first;
251  this->first = x;
252  }
template<class T, class JComparator_t = std::less<T>>
void JTOOLS::JRange< T, JComparator_t >::fixUpperLimit ( argument_type  y)
inlineinherited

Fix upper limit.

The range is shifted to the given upper limit.

Parameters
yupper limit

Definition at line 262 of file JRange.hh.

263  {
264  this->first += y - this->second;
265  this->second = y;
266  }
template<class T, class JComparator_t = std::less<T>>
bool JTOOLS::JRange< T, JComparator_t >::equals ( const range_type range) const
inlineinherited

Equal method.

Parameters
rangerange
Returns
true if this module range equal to given module range; else false

Definition at line 275 of file JRange.hh.

276  {
277  return (!this->compare(this->getLowerLimit(), range.getLowerLimit()) &&
278  !this->compare(range.getLowerLimit(), this->getLowerLimit()) &&
279  !this->compare(this->getUpperLimit(), range.getUpperLimit()) &&
280  !this->compare(range.getUpperLimit(), this->getUpperLimit()));
281  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
JComparator_t compare
Function object.
Definition: JRange.hh:578
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
template<class T, class JComparator_t = std::less<T>>
T JTOOLS::JRange< T, JComparator_t >::getLength ( ) const
inlineinherited

Get length (difference between upper and lower limit).

Returns
length

Definition at line 289 of file JRange.hh.

290  {
291  return getUpperLimit() - getLowerLimit();
292  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
template<class T, class JComparator_t = std::less<T>>
void JTOOLS::JRange< T, JComparator_t >::setLength ( argument_type  length)
inlineinherited

Set length (difference between upper and lower limit).

Parameters
lengthlength

Definition at line 300 of file JRange.hh.

301  {
302  setUpperLimit(getLowerLimit() + length);
303  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
void setUpperLimit(argument_type y)
Set upper limit.
Definition: JRange.hh:235
template<class T, class JComparator_t = std::less<T>>
bool JTOOLS::JRange< T, JComparator_t >::is_valid ( ) const
inlineinherited

Check validity of range.

Returns
true if lower limit less than or equal to upper limit; else false

Definition at line 311 of file JRange.hh.

312  {
313  return !compare(getUpperLimit(), getLowerLimit());
314  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
JComparator_t compare
Function object.
Definition: JRange.hh:578
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
template<class T, class JComparator_t = std::less<T>>
bool JTOOLS::JRange< T, JComparator_t >::in_range ( argument_type  x) const
inlineinherited

Test whether value is inside range.

Parameters
xvalue
Returns
true if lower limit <= value <= upper limit; else false

Definition at line 323 of file JRange.hh.

324  {
325  return (!compare(x, getLowerLimit()) &&
326  !compare(getUpperLimit(), x));
327  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
JComparator_t compare
Function object.
Definition: JRange.hh:578
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
template<class T, class JComparator_t = std::less<T>>
bool JTOOLS::JRange< T, JComparator_t >::operator() ( argument_type  x) const
inlineinherited

Test whether value is inside range.

Parameters
xvalue
Returns
true if lower limit <= value <= upper limit; else false

Definition at line 336 of file JRange.hh.

337  {
338  return in_range(x);
339  }
bool in_range(argument_type x) const
Test whether value is inside range.
Definition: JRange.hh:323
template<class T, class JComparator_t = std::less<T>>
T JTOOLS::JRange< T, JComparator_t >::constrain ( argument_type  x) const
inlineinherited

Constrain value to range.


This method returns the original value if it is in this range, else lower limit if value < lower limit or upper limit if value > upper limit.

Parameters
xvalue
Returns
lower limit <= x <= upper limit

Definition at line 350 of file JRange.hh.

351  {
352  if (compare(x, getLowerLimit())) { return getLowerLimit(); }
353  if (compare(getUpperLimit(), x)) { return getUpperLimit(); }
354 
355  return x;
356  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
JComparator_t compare
Function object.
Definition: JRange.hh:578
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
template<class T, class JComparator_t = std::less<T>>
T JTOOLS::JRange< T, JComparator_t >::mod ( argument_type  x) const
inlineinherited

Modulo value with respect to range.


Parameters
xvalue
Returns
lower limit <= x <= upper limit

Definition at line 365 of file JRange.hh.

366  {
367  if (compare(x, getLowerLimit()))
368  return x + getLength() * floor((getUpperLimit() - x) / getLength());
369  else if (compare(getUpperLimit(), x))
370  return x - getLength() * floor((x - getLowerLimit()) / getLength());
371  else
372  return x;
373  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
JComparator_t compare
Function object.
Definition: JRange.hh:578
T getLength() const
Get length (difference between upper and lower limit).
Definition: JRange.hh:289
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
template<class T, class JComparator_t = std::less<T>>
bool JTOOLS::JRange< T, JComparator_t >::overlap ( const range_type range) const
inlineinherited

Test overlap with given range.


The result is equivalent to join(range).is_valid().

Parameters
rangerange
Returns
true if there is a non-zero overlap; else false

Definition at line 383 of file JRange.hh.

384  {
385  return (compare(getLowerLimit(), range.getUpperLimit()) &&
386  compare(range.getLowerLimit(), getUpperLimit()));
387  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
JComparator_t compare
Function object.
Definition: JRange.hh:578
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
template<class T, class JComparator_t = std::less<T>>
range_type JTOOLS::JRange< T, JComparator_t >::include ( argument_type  x)
inlineinherited

Include given value to range.


The new lower limit is the minimim of the original lower limit and given value and
the new upper limit is the maximum of the original upper limit and given value;

Parameters
xvalue
Returns
range

Definition at line 398 of file JRange.hh.

399  {
400  if (compare(x, getLowerLimit())) { setLowerLimit(x); }
401  if (compare(getUpperLimit(), x)) { setUpperLimit(x); }
402 
403  return *this;
404  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
JComparator_t compare
Function object.
Definition: JRange.hh:578
void setUpperLimit(argument_type y)
Set upper limit.
Definition: JRange.hh:235
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
void setLowerLimit(argument_type x)
Set lower limit.
Definition: JRange.hh:224
template<class T, class JComparator_t = std::less<T>>
range_type& JTOOLS::JRange< T, JComparator_t >::join ( const range_type range)
inlineinherited

Join ranges.


The new lower limit is the maximim of the two lower limits and
the new upper limit is the minimum of the two upper limits.
This operation results in an equal or smaller range and may result in an unphysical range (i.e. lower limit > upper limit).

Parameters
rangerange

Definition at line 416 of file JRange.hh.

417  {
418  if (compare(getLowerLimit(), range.getLowerLimit())) { setLowerLimit(range.getLowerLimit()); }
419  if (compare(range.getUpperLimit(), getUpperLimit())) { setUpperLimit(range.getUpperLimit()); }
420 
421  return *this;
422  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
JComparator_t compare
Function object.
Definition: JRange.hh:578
void setUpperLimit(argument_type y)
Set upper limit.
Definition: JRange.hh:235
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
void setLowerLimit(argument_type x)
Set lower limit.
Definition: JRange.hh:224
template<class T, class JComparator_t = std::less<T>>
range_type& JTOOLS::JRange< T, JComparator_t >::combine ( const range_type range)
inlineinherited

Combine ranges.


The new lower limit is the minimim of the two lower limits and
the new upper limit is the maximum of the two upper limits.
This operation results in an equal or larger range.

Parameters
rangerange

Definition at line 433 of file JRange.hh.

434  {
435  if (compare(range.getLowerLimit(), getLowerLimit())) { setLowerLimit(range.getLowerLimit()); }
436  if (compare(getUpperLimit(), range.getUpperLimit())) { setUpperLimit(range.getUpperLimit()); }
437 
438  return *this;
439  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
JComparator_t compare
Function object.
Definition: JRange.hh:578
void setUpperLimit(argument_type y)
Set upper limit.
Definition: JRange.hh:235
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
void setLowerLimit(argument_type x)
Set lower limit.
Definition: JRange.hh:224
template<class T, class JComparator_t = std::less<T>>
range_type& JTOOLS::JRange< T, JComparator_t >::add ( argument_type  x)
inlineinherited

Add offset.

Parameters
xoffset

Definition at line 447 of file JRange.hh.

448  {
449  this->first += x;
450  this->second += x;
451 
452  return *this;
453  }
template<class T, class JComparator_t = std::less<T>>
range_type& JTOOLS::JRange< T, JComparator_t >::add ( const range_type range)
inlineinherited

Add offsets.


The new lower limit is the sum of the two lower limits and
the new upper limit is the sum of the two upper limits.

Parameters
rangeoffset

Definition at line 477 of file JRange.hh.

478  {
479  this->first += range.getLowerLimit();
480  this->second += range.getUpperLimit();
481 
482  return *this;
483  }
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
template<class T, class JComparator_t = std::less<T>>
range_type& JTOOLS::JRange< T, JComparator_t >::sub ( argument_type  x)
inlineinherited

Subtract offset.

Parameters
xoffset

Definition at line 461 of file JRange.hh.

462  {
463  this->first -= x;
464  this->second -= x;
465 
466  return *this;
467  }
template<class T, class JComparator_t = std::less<T>>
range_type& JTOOLS::JRange< T, JComparator_t >::sub ( const range_type range)
inlineinherited

Subtract offsets.


The new lower limit is the difference of the two lower limits and
the new upper limit is the difference of the two upper limits.

Parameters
rangeoffset

Definition at line 493 of file JRange.hh.

494  {
495  this->first -= range.getLowerLimit();
496  this->second -= range.getUpperLimit();
497 
498  return *this;
499  }
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
template<class T, class JComparator_t = std::less<T>>
range_type& JTOOLS::JRange< T, JComparator_t >::mul ( const double  factor)
inlineinherited

Multiply range.

Parameters
factorfactor

Definition at line 507 of file JRange.hh.

508  {
509  this->first *= factor;
510  this->second *= factor;
511 
512  return *this;
513  }
template<class JFirst_t, class JSecond_t = JNullType>
JFirst_t& JMATH::JMath< JFirst_t, JSecond_t >::mul ( const JSecond_t &  object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 357 of file JMath.hh.

358  {
359  return static_cast<JFirst_t&>(*this) = JCalculator<JFirst_t>::calculator.mul(static_cast<const JFirst_t&>(*this), object);
360  }
Auxiliary class for arithmetic operations on objects.
Definition: JCalculator.hh:18
template<class T, class JComparator_t = std::less<T>>
range_type& JTOOLS::JRange< T, JComparator_t >::div ( const double  factor)
inlineinherited

Divide range.

Parameters
factorfactor

Definition at line 521 of file JRange.hh.

522  {
523  this->first /= factor;
524  this->second /= factor;
525 
526  return *this;
527  }
template<class T, class JComparator_t = std::less<T>>
T JTOOLS::JRange< T, JComparator_t >::getN ( const double  R) const
inlineinherited

Get expected number of occurances of given rate within this interval.

Parameters
Rrate
Returns
expectation value

Definition at line 536 of file JRange.hh.

537  {
538  return R * (getUpperLimit() - getLowerLimit());
539  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
then usage $script[distance] fi case set_variable R
Definition: JDrawLED.sh:43
template<class T, class JComparator_t = std::less<T>>
static T JTOOLS::JRange< T, JComparator_t >::getMinimum ( )
inlinestaticinherited

Get minimum possible value.

Returns
minimum possible value

Definition at line 547 of file JRange.hh.

548  {
549  return JMATH::JLimits<T>::min();
550  }
float min()
Definition: JLimits.hh:96
template<class T, class JComparator_t = std::less<T>>
static T JTOOLS::JRange< T, JComparator_t >::getMaximum ( )
inlinestaticinherited

Get maximum possible value.

Returns
maximum possible value

Definition at line 558 of file JRange.hh.

559  {
560  return JMATH::JLimits<T>::max();
561  }
const key_type& JTOOLS::JPair< T , T >::getKey ( ) const
inlineinherited

Definition at line 123 of file JPair.hh.

123 { return this->first; }
const mapped_type& JTOOLS::JPair< T , T >::getValue ( ) const
inlineinherited

Definition at line 124 of file JPair.hh.

124 { return this->second; }
mapped_type& JTOOLS::JPair< T , T >::getValue ( )
inlineinherited

Definition at line 126 of file JPair.hh.

126 { return this->second; }

Member Data Documentation

JGeometry JDYNAMICS::JDynamics::JPosition::geometry
protected

Definition at line 447 of file JDynamics.hh.

data_type JDYNAMICS::JDynamics::JPosition::calibration
protected

Definition at line 448 of file JDynamics.hh.

template<class T, class JComparator_t = std::less<T>>
const JRange< T, JComparator_t > JTOOLS::JRange< T, JComparator_t >::DEFAULT_RANGE
staticinherited

Default range.

This range corresponds to an unphysical range.

Definition at line 568 of file JRange.hh.

template<class T, class JComparator_t = std::less<T>>
JComparator_t JTOOLS::JRange< T, JComparator_t >::compare
inherited

Function object.

Parameters
firstfirst argument
secondsecond argument
Returns
true if first < second; else false

Definition at line 578 of file JRange.hh.

T JTOOLS::JPair< T , T >::first
inherited

Definition at line 128 of file JPair.hh.

T JTOOLS::JPair< T , T >::second
inherited

Definition at line 129 of file JPair.hh.


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