BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
DetectorUtils.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Device/Detector/DetectorUtils.cpp
6 //! @brief Implements namespace DetectorUtils.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
17 
19 {
20  ASSERT(det.dimension() == 2);
21  if (det.axis(0).size() != det.axis(1).size())
22  return false;
23  if (std::abs(det.axis(0).span() - det.axis(1).span())
24  > 1e-12 * (det.axis(0).span() + det.axis(1).span()))
25  return false;
26  return true;
27 }
#define ASSERT(condition)
Definition: Assert.h:31
Defines namespace DetectorUtils.
Defines interface IDetector2D.
double span() const
Returns distance from first to last point.
Definition: IAxis.cpp:42
virtual size_t size() const =0
retrieve the number of bins
Abstract 2D detector interface.
Definition: IDetector2D.h:31
size_t dimension() const
Returns actual dimensionality of the detector (number of defined axes)
Definition: IDetector.cpp:46
const IAxis & axis(size_t index) const
Definition: IDetector.cpp:56
bool isQuadratic(const IDetector2D &det)