Mantid
Loading...
Searching...
No Matches
Unit.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2008 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9//----------------------------------------------------------------------
10// Includes
11//----------------------------------------------------------------------
13#include <utility>
14
15#include <unordered_map>
16#include <vector>
17#ifndef Q_MOC_RUN
18#include <memory>
19#endif
20
21#include "tbb/concurrent_unordered_map.h"
22
23namespace Mantid {
24namespace Kernel {
25
27
28// list of parameter names and values - some code may relay on map behaviour
29// where [] creates element with value 0 if param name not present
30using UnitParametersMap = std::unordered_map<UnitParams, double>;
31
41class MANTID_KERNEL_DLL Unit {
42public:
44 Unit();
46 virtual ~Unit() = default;
47
49 virtual Unit *clone() const = 0;
50
57 virtual const std::string unitID() const = 0;
60 virtual const std::string caption() const = 0;
61
64 virtual const UnitLabel label() const = 0;
65
68 virtual bool isConvertible() const { return true; }
69
70 // Equality operators based on the value returned by unitID();
71 bool operator==(const Unit &u) const;
72 bool operator!=(const Unit &u) const;
73
74 // Check whether the unit can be converted to another via a simple factor
75 bool quickConversion(const Unit &destination, double &factor, double &power) const;
76 bool quickConversion(std::string destUnitName, double &factor, double &power) const;
77
91 void toTOF(std::vector<double> &xdata, std::vector<double> &ydata, const double &_l1, const int &_emode,
92 std::initializer_list<std::pair<const UnitParams, double>> params);
93 void toTOF(std::vector<double> &xdata, std::vector<double> &ydata, const double &_l1, const int &_emode,
94 const UnitParametersMap &params);
95
108 double convertSingleToTOF(const double xvalue, const double &l1, const int &emode, const UnitParametersMap &params);
109
123 void fromTOF(std::vector<double> &xdata, std::vector<double> &ydata, const double &_l1, const int &_emode,
124 std::initializer_list<std::pair<const UnitParams, double>> params);
125
126 void fromTOF(std::vector<double> &xdata, std::vector<double> &ydata, const double &_l1, const int &_emode,
127 const UnitParametersMap &params);
128
142 double convertSingleFromTOF(const double xvalue, const double &l1, const int &emode, const UnitParametersMap &params);
143
157 void initialize(const double &_l1, const int &_emode, const UnitParametersMap &params);
158
161 virtual void init() = 0;
162
167 virtual double singleToTOF(const double x) const = 0;
168
173 virtual double singleFromTOF(const double tof) const = 0;
174
176 bool isInitialized() const { return initialized; }
177
181 virtual double conversionTOFMin() const = 0;
182
185 virtual double conversionTOFMax() const = 0;
186
189 virtual std::pair<double, double> conversionRange() const;
190
191protected:
192 // Add a 'quick conversion' for a unit pair
193 void addConversion(std::string to, const double &factor, const double &power = 1.0) const;
194
195 // validate the contents of the unit parameters map. Throw
196 // std::invalid_argument if it's a global error or std::runtime_error if it's
197 // a detector specific error
198 virtual void validateUnitParams(const int emode, const UnitParametersMap &params);
199
203 double l1;
206 int emode;
213
214private:
217 using ConstantAndPower = std::pair<double, double>;
220 using UnitConversions = tbb::concurrent_unordered_map<std::string, ConstantAndPower>;
223 using ConversionsMap = tbb::concurrent_unordered_map<std::string, UnitConversions>;
226};
227
229using Unit_sptr = std::shared_ptr<Unit>;
231using Unit_const_sptr = std::shared_ptr<const Unit>;
232
233//----------------------------------------------------------------------
234// Now the concrete units classes
235//----------------------------------------------------------------------
236
238namespace Units {
239
240//=================================================================================================
242class MANTID_KERNEL_DLL Empty : public Unit {
243public:
244 const std::string unitID() const override;
245 const std::string caption() const override { return ""; }
246 const UnitLabel label() const override;
247
248 bool isConvertible() const override { return false; }
249 double singleToTOF(const double x) const override;
250 double singleFromTOF(const double tof) const override;
251 void init() override;
252 Unit *clone() const override;
253
254 double conversionTOFMin() const override;
255 double conversionTOFMax() const override;
256
258 Empty() : Unit() {}
259};
260
261//=================================================================================================
263class MANTID_KERNEL_DLL Label : public Empty {
264public:
265 const std::string unitID() const override;
266 const std::string caption() const override { return m_caption; }
267 const UnitLabel label() const override;
268
269 Label();
270 Label(const std::string &caption, const std::string &label);
271 void setLabel(const std::string &cpt, const UnitLabel &lbl = UnitLabel(""));
272 Unit *clone() const override;
273
274private:
276 std::string m_caption;
279};
280
281//=================================================================================================
283class MANTID_KERNEL_DLL TOF : public Unit {
284public:
285 const std::string unitID() const override;
286 const std::string caption() const override { return "Time-of-flight"; }
287 const UnitLabel label() const override;
288
289 TOF();
290 void init() override;
291 double singleToTOF(const double x) const override;
292 double singleFromTOF(const double tof) const override;
293 Unit *clone() const override;
295 double conversionTOFMin() const override;
297 double conversionTOFMax() const override;
298};
299
300//=================================================================================================
302class MANTID_KERNEL_DLL Wavelength : public Unit {
303public:
304 const std::string unitID() const override;
305 const std::string caption() const override { return "Wavelength"; }
306 const UnitLabel label() const override;
307
308 double singleToTOF(const double x) const override;
309 double singleFromTOF(const double tof) const override;
310 void init() override;
311 Unit *clone() const override;
312
313 double conversionTOFMin() const override;
314 double conversionTOFMax() const override;
315
317 Wavelength();
318
319protected:
320 void validateUnitParams(const int emode, const UnitParametersMap &params) override;
321 double efixed;
322 double sfpTo;
323 double factorTo;
324 double sfpFrom;
325 double factorFrom;
327};
328
329//=================================================================================================
331class MANTID_KERNEL_DLL Energy : public Unit {
332public:
333 const std::string unitID() const override;
334 const std::string caption() const override { return "Energy"; }
335 const UnitLabel label() const override;
336
337 double singleToTOF(const double x) const override;
338 double singleFromTOF(const double tof) const override;
339 void init() override;
340 Unit *clone() const override;
341
342 double conversionTOFMin() const override;
343 double conversionTOFMax() const override;
344
346 Energy();
347
348protected:
349 void validateUnitParams(const int emode, const UnitParametersMap &params) override;
350 double factorTo;
351 double factorFrom;
352};
353
354//=================================================================================================
356class MANTID_KERNEL_DLL Energy_inWavenumber : public Unit {
357public:
358 const std::string unitID() const override;
359 const std::string caption() const override { return "Energy"; }
360 const UnitLabel label() const override;
361
362 double singleToTOF(const double x) const override;
363 double singleFromTOF(const double tof) const override;
364 void init() override;
365 Unit *clone() const override;
366 double conversionTOFMin() const override;
367 double conversionTOFMax() const override;
368
371
372protected:
373 void validateUnitParams(const int emode, const UnitParametersMap &params) override;
374 double factorTo;
375 double factorFrom;
376};
377
378MANTID_KERNEL_DLL double tofToDSpacingFactor(const double l1, const double l2, const double twoTheta,
379 const double offset);
380
381//=================================================================================================
383class MANTID_KERNEL_DLL dSpacing : public Unit {
384public:
385 const std::string unitID() const override;
386 const std::string caption() const override { return "d-Spacing"; }
387 const UnitLabel label() const override;
388 double singleToTOF(const double x) const override;
389 double singleFromTOF(const double tof) const override;
390 void init() override;
391 Unit *clone() const override;
392 double conversionTOFMin() const override;
393 double conversionTOFMax() const override;
394 double calcTofMin(const double difc, const double difa, const double tzero, const double tofmin = 0.);
395 double calcTofMax(const double difc, const double difa, const double tzero, const double tofmax = 0.);
396
398 dSpacing();
399
400protected:
401 void validateUnitParams(const int emode, const UnitParametersMap &params) override;
402 std::string toDSpacingError;
403 double difa;
404 double difc;
405 double tzero;
406};
407
408//=================================================================================================
410class MANTID_KERNEL_DLL dSpacingPerpendicular : public Unit {
411public:
412 const std::string unitID() const override;
413 const std::string caption() const override { return "d-SpacingPerpendicular"; }
414 const UnitLabel label() const override;
415
416 double singleToTOF(const double x) const override;
417 double singleFromTOF(const double tof) const override;
418 void init() override;
419 Unit *clone() const override;
420 double conversionTOFMin() const override;
421 double conversionTOFMax() const override;
422
425
426protected:
427 void validateUnitParams(const int emode, const UnitParametersMap &params) override;
428 double twoTheta;
429 double factorTo;
430 double sfpTo;
431 double factorFrom;
432 double sfpFrom;
433};
434
435//=================================================================================================
437class MANTID_KERNEL_DLL MomentumTransfer : public Unit {
438public:
439 const std::string unitID() const override;
440 const std::string caption() const override { return "q"; }
441 const UnitLabel label() const override;
442
443 double singleToTOF(const double x) const override;
444 double singleFromTOF(const double tof) const override;
445 void init() override;
446 Unit *clone() const override;
447 double conversionTOFMin() const override;
448 double conversionTOFMax() const override;
451
452protected:
453 void validateUnitParams(const int emode, const UnitParametersMap &params) override;
454 double difc;
455};
456
457//=================================================================================================
459class MANTID_KERNEL_DLL QSquared : public MomentumTransfer {
460public:
461 const std::string unitID() const override;
462 const std::string caption() const override { return "Q2"; }
463 const UnitLabel label() const override;
464
465 double singleToTOF(const double x) const override;
466 double singleFromTOF(const double tof) const override;
467 Unit *clone() const override;
468 double conversionTOFMin() const override;
469 double conversionTOFMax() const override;
470
472 QSquared();
473};
474
475//=================================================================================================
477class MANTID_KERNEL_DLL DeltaE : public Unit {
478public:
479 const std::string unitID() const override;
480 const std::string caption() const override { return "Energy transfer"; }
481 const UnitLabel label() const override;
482
483 double singleToTOF(const double x) const override;
484 double singleFromTOF(const double tof) const override;
485 void init() override;
486 Unit *clone() const override;
487
488 double conversionTOFMin() const override;
489 double conversionTOFMax() const override;
490
492 DeltaE();
493
494protected:
495 void validateUnitParams(const int emode, const UnitParametersMap &params) override;
496 double efixed;
497 double factorTo;
498 double factorFrom;
499 double t_other;
500 double t_otherFrom;
501 double unitScaling;
502};
503
504//=================================================================================================
506class MANTID_KERNEL_DLL DeltaE_inWavenumber : public DeltaE {
507public:
508 const std::string unitID() const override;
509 const std::string caption() const override { return "Energy transfer"; }
510 const UnitLabel label() const override;
511
512 void init() override;
513 Unit *clone() const override;
514 double conversionTOFMin() const override;
515 double conversionTOFMax() const override;
518};
519
520//=================================================================================================
522class MANTID_KERNEL_DLL DeltaE_inFrequency : public DeltaE {
523public:
524 const std::string unitID() const override;
525 const std::string caption() const override { return "Energy transfer"; }
526 const UnitLabel label() const override;
527
528 void init() override;
529 Unit *clone() const override;
530 double conversionTOFMin() const override;
531 double conversionTOFMax() const override;
534};
535
536//=================================================================================================
538class MANTID_KERNEL_DLL Momentum : public Unit {
539public:
540 const std::string unitID() const override;
541 const std::string caption() const override { return "Momentum"; }
542 const UnitLabel label() const override;
543
544 double singleToTOF(const double ki) const override;
545 double singleFromTOF(const double tof) const override;
546 void init() override;
547 Unit *clone() const override;
548 double conversionTOFMin() const override;
549 double conversionTOFMax() const override;
550
552 Momentum();
553
554protected:
555 void validateUnitParams(const int emode, const UnitParametersMap &params) override;
556 double efixed;
557 double sfpTo;
558 double factorTo;
559 double sfpFrom;
560 double factorFrom;
562};
563
564//=================================================================================================
566class MANTID_KERNEL_DLL SpinEchoLength : public Wavelength {
567public:
568 const std::string unitID() const override;
569 const std::string caption() const override { return "Spin Echo Length"; }
570 const UnitLabel label() const override;
571
572 double singleToTOF(const double x) const override;
573 double singleFromTOF(const double tof) const override;
574 void init() override;
575 Unit *clone() const override;
576 double conversionTOFMin() const override;
577 double conversionTOFMax() const override;
578
581
582private:
583 double efixed;
584};
585
586//=================================================================================================
588class MANTID_KERNEL_DLL SpinEchoTime : public Wavelength {
589public:
590 const std::string unitID() const override;
591 const std::string caption() const override { return "Spin Echo Time"; }
592 const UnitLabel label() const override;
593
594 double singleToTOF(const double x) const override;
595 double singleFromTOF(const double tof) const override;
596 void init() override;
597 Unit *clone() const override;
598 double conversionTOFMin() const override;
599 double conversionTOFMax() const override;
600
602 SpinEchoTime();
603
604private:
605 double efixed;
606};
607
608//=================================================================================================
610class MANTID_KERNEL_DLL Time : public Unit {
611public:
612 const std::string unitID() const override;
613 const std::string caption() const override { return "t"; }
614 const UnitLabel label() const override;
615
616 bool isConvertible() const override { return false; }
617 double singleToTOF(const double x) const override;
618 double singleFromTOF(const double tof) const override;
619 double conversionTOFMax() const override;
620 double conversionTOFMin() const override;
621 void init() override;
622 Unit *clone() const override;
623
625 Time();
626
627protected:
628 double factorTo;
629 double factorFrom;
630};
631
632//=================================================================================================
634class MANTID_KERNEL_DLL Degrees : public Empty {
635public:
636 Degrees();
637 const std::string unitID() const override;
638 const std::string caption() const override { return "Scattering angle"; }
639 const UnitLabel label() const override;
640
641 void init() override;
642 Unit *clone() const override;
643
644 double singleToTOF(const double x) const override;
645 double singleFromTOF(const double tof) const override;
646 double conversionTOFMin() const override;
647 double conversionTOFMax() const override;
648
649private:
651};
652
653//=================================================================================================
655class MANTID_KERNEL_DLL Phi : public Degrees {
656 const std::string unitID() const override;
657 const std::string caption() const override { return "Phi"; }
658 Unit *clone() const override { return new Phi(*this); }
659};
660
661//=================================================================================================
663class MANTID_KERNEL_DLL Temperature : public Empty {
664public:
665 Temperature();
666 const std::string unitID() const override;
667 const std::string caption() const override { return "Temperature"; }
668 const UnitLabel label() const override;
669
670 void init() override;
671 Unit *clone() const override;
672
673 double singleToTOF(const double x) const override;
674 double singleFromTOF(const double tof) const override;
675 double conversionTOFMin() const override;
676 double conversionTOFMax() const override;
677
678private:
680};
681
682//=================================================================================================
684class MANTID_KERNEL_DLL AtomicDistance : public Empty {
685public:
687 const std::string unitID() const override;
688 const std::string caption() const override { return "Atomic Distance"; }
689 const UnitLabel label() const override;
690
691 void init() override;
692 Unit *clone() const override;
693
694 double singleToTOF(const double x) const override;
695 double singleFromTOF(const double tof) const override;
696 double conversionTOFMin() const override;
697 double conversionTOFMax() const override;
698
699private:
701};
702
703//=================================================================================================
704
705MANTID_KERNEL_DLL double timeConversionValue(const std::string &input_unit, const std::string &output_unit);
706
707template <typename T>
708void timeConversionVector(std::vector<T> &vec, const std::string &input_unit, const std::string &output_unit) {
709 double factor = timeConversionValue(std::move(input_unit), std::move(output_unit));
710 if (factor != 1.0)
711 std::transform(vec.begin(), vec.end(), vec.begin(), [factor](T x) -> T { return x * static_cast<T>(factor); });
712}
713
714} // namespace Units
715
716} // namespace Kernel
717} // namespace Mantid
A base-class for the a class that is able to return unit labels in different representations.
Definition: UnitLabel.h:20
The base units (abstract) class.
Definition: Unit.h:41
virtual Unit * clone() const =0
const UnitParametersMap * m_params
additional parameters l2 :: distance from sample to detector (in metres) twoTheta :: scattering angle...
Definition: Unit.h:212
virtual void init()=0
Finalize the initialization.
virtual ~Unit()=default
Virtual destructor.
virtual const UnitLabel label() const =0
A label for the unit to be printed on axes,.
virtual double conversionTOFMin() const =0
some units can be converted from TOF only in the range of TOF ; This function returns minimal TOF val...
virtual double conversionTOFMax() const =0
This function returns maximal TOF value still reversibly convertible into the unit.
virtual double singleToTOF(const double x) const =0
Convert a single X value to TOF.
virtual bool isConvertible() const
Returns if the unit can be used in conversions.
Definition: Unit.h:68
bool initialized
The unit values have been initialized.
Definition: Unit.h:201
virtual const std::string caption() const =0
The full name of the unit.
tbb::concurrent_unordered_map< std::string, UnitConversions > ConversionsMap
The possible 'quick conversions' are held in a map with the starting unit as the key.
Definition: Unit.h:223
virtual const std::string unitID() const =0
The name of the unit.
std::pair< double, double > ConstantAndPower
A 'quick conversion' requires the constant by which to multiply the input and the power to which to r...
Definition: Unit.h:217
virtual double singleFromTOF(const double tof) const =0
Convert a single tof value to this unit.
tbb::concurrent_unordered_map< std::string, ConstantAndPower > UnitConversions
Lists, for a given starting unit, the units to which a 'quick conversion' can be made.
Definition: Unit.h:220
double l1
l1 :: The source-sample distance (in metres)
Definition: Unit.h:203
static ConversionsMap s_conversionFactors
The table of possible 'quick conversions'.
Definition: Unit.h:225
int emode
emode :: The energy mode (0=elastic, 1=direct geometry, 2=indirect geometry)
Definition: Unit.h:206
bool isInitialized() const
Definition: Unit.h:176
Atomic Distance in Angstroms.
Definition: Unit.h:684
const std::string caption() const override
The full name of the unit.
Definition: Unit.h:688
const std::string unitID() const override
"AtomicDistance"
Degrees that has degrees as unit and "Scattering angle" as title.
Definition: Unit.h:634
const std::string unitID() const override
"Empty"
const std::string caption() const override
< Degrees
Definition: Unit.h:638
Energy transfer in units of frequency (MHz)
Definition: Unit.h:522
const std::string caption() const override
The full name of the unit.
Definition: Unit.h:525
const std::string unitID() const override
"DeltaE_inFrequency"
Energy transfer in units of wavenumber (cm^-1)
Definition: Unit.h:506
const std::string caption() const override
The full name of the unit.
Definition: Unit.h:509
const std::string unitID() const override
"DeltaE_inWavenumber"
Energy transfer in milli-electronvolts.
Definition: Unit.h:477
const std::string unitID() const override
"DeltaE"
const std::string caption() const override
The full name of the unit.
Definition: Unit.h:480
double factorFrom
Constant factor for from conversion.
Definition: Unit.h:498
double factorTo
Constant factor for to conversion.
Definition: Unit.h:497
double t_otherFrom
Energy mode dependent factor in from conversion.
Definition: Unit.h:500
double unitScaling
Apply unit scaling to energy value.
Definition: Unit.h:501
double t_other
Energy mode dependent factor in to conversion.
Definition: Unit.h:499
const std::string caption() const override
The full name of the unit.
Definition: Unit.h:245
Empty()
Constructor.
Definition: Unit.h:258
const std::string unitID() const override
"Empty"
bool isConvertible() const override
Returns if the unit can be used in conversions.
Definition: Unit.h:248
Absolute energy in units of wavenumber (cm^-1)
Definition: Unit.h:356
const std::string unitID() const override
"Energy_inWavenumber"
double factorFrom
Constant factor for from conversion.
Definition: Unit.h:375
const std::string caption() const override
The full name of the unit.
Definition: Unit.h:359
double factorTo
Constant factor for to conversion.
Definition: Unit.h:374
Energy in milli-electronvolts.
Definition: Unit.h:331
const std::string unitID() const override
"Energy"
const std::string caption() const override
The full name of the unit.
Definition: Unit.h:334
double factorTo
Constant factor for to conversion.
Definition: Unit.h:350
double factorFrom
Constant factor for from conversion.
Definition: Unit.h:351
const std::string caption() const override
The full name of the unit.
Definition: Unit.h:266
UnitLabel m_label
Label.
Definition: Unit.h:278
std::string m_caption
Caption.
Definition: Unit.h:276
const std::string unitID() const override
"Label"
Momentum Transfer in Angstrom^-1.
Definition: Unit.h:437
const std::string unitID() const override
"MomentumTransfer"
const std::string caption() const override
The full name of the unit.
Definition: Unit.h:440
Momentum in Angstrom^-1.
Definition: Unit.h:538
double sfpTo
Extra correction factor in to conversion.
Definition: Unit.h:557
const std::string unitID() const override
"Momentum"
const std::string caption() const override
The full name of the unit.
Definition: Unit.h:541
double sfpFrom
Extra correction factor in from conversion.
Definition: Unit.h:559
bool do_sfpFrom
Apply the sfpFrom value.
Definition: Unit.h:561
double factorTo
Constant factor for to conversion.
Definition: Unit.h:558
double factorFrom
Constant factor for from conversion.
Definition: Unit.h:560
Phi that has degrees as unit and "Phi" as title.
Definition: Unit.h:655
const std::string caption() const override
< Degrees
Definition: Unit.h:657
Unit * clone() const override
Definition: Unit.h:658
const std::string unitID() const override
"Empty"
Momentum transfer squared in Angstrom^-2.
Definition: Unit.h:459
const std::string unitID() const override
"QSquared"
const std::string caption() const override
The full name of the unit.
Definition: Unit.h:462
SpinEchoLength in nm.
Definition: Unit.h:566
const std::string unitID() const override
"SpinEchoLength"
const std::string caption() const override
The full name of the unit.
Definition: Unit.h:569
SpinEchoTime in ns.
Definition: Unit.h:588
const std::string unitID() const override
"SpinEchoTime"
const std::string caption() const override
The full name of the unit.
Definition: Unit.h:591
Time of flight in microseconds.
Definition: Unit.h:283
const std::string caption() const override
The full name of the unit.
Definition: Unit.h:286
const std::string unitID() const override
"TOF"
Temperature in kelvin.
Definition: Unit.h:663
const std::string unitID() const override
"Temperature"
const std::string caption() const override
The full name of the unit.
Definition: Unit.h:667
Time In Second.
Definition: Unit.h:610
double factorFrom
Constant factor for from conversion.
Definition: Unit.h:629
const std::string caption() const override
The full name of the unit.
Definition: Unit.h:613
const std::string unitID() const override
"Time"
bool isConvertible() const override
Returns if the unit can be used in conversions.
Definition: Unit.h:616
double factorTo
Constant factor for to conversion.
Definition: Unit.h:628
Wavelength in Angstrom.
Definition: Unit.h:302
const std::string caption() const override
The full name of the unit.
Definition: Unit.h:305
const std::string unitID() const override
"Wavelength"
bool do_sfpFrom
Apply the sfpFrom value.
Definition: Unit.h:326
double sfpFrom
Extra correction factor in from conversion.
Definition: Unit.h:324
double factorTo
Constant factor for to conversion.
Definition: Unit.h:323
double sfpTo
Extra correction factor in to conversion.
Definition: Unit.h:322
double factorFrom
Constant factor for from conversion.
Definition: Unit.h:325
d-SpacingPerpendicular in Angstrom
Definition: Unit.h:410
const std::string caption() const override
The full name of the unit.
Definition: Unit.h:413
double sfpFrom
Extra correction factor in to conversion.
Definition: Unit.h:432
double factorFrom
Constant factor for from conversion.
Definition: Unit.h:431
double factorTo
Constant factor for to conversion.
Definition: Unit.h:429
const std::string unitID() const override
"dSpacingPerpendicular"
double sfpTo
Extra correction factor in to conversion.
Definition: Unit.h:430
d-Spacing in Angstrom
Definition: Unit.h:383
std::string toDSpacingError
Definition: Unit.h:402
const std::string unitID() const override
"dSpacing"
const std::string caption() const override
The full name of the unit.
Definition: Unit.h:386
void timeConversionVector(std::vector< T > &vec, const std::string &input_unit, const std::string &output_unit)
Definition: Unit.h:708
MANTID_KERNEL_DLL double tofToDSpacingFactor(const double l1, const double l2, const double twoTheta, const double offset)
Calculate and return conversion factor from tof to d-spacing.
Definition: Unit.cpp:568
MANTID_KERNEL_DLL double timeConversionValue(const std::string &input_unit, const std::string &output_unit)
Definition: Unit.cpp:1435
std::unordered_map< UnitParams, double > UnitParametersMap
Definition: Unit.h:30
std::shared_ptr< const Unit > Unit_const_sptr
Shared pointer to the Unit base class (const version)
Definition: Unit.h:231
std::shared_ptr< Unit > Unit_sptr
Shared pointer to the Unit base class.
Definition: Unit.h:229
Helper class which provides the Collimation Length for SANS instruments.
constexpr bool operator==(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)
constexpr bool operator!=(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)