BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
Bin.cpp File Reference

Implements structs Bin1D, Bin1DCVector. More...

Include dependency graph for Bin.cpp:

Go to the source code of this file.

Functions

bool BinContains (const Bin1D &bin, double value)
 Checks if value is contained in bin: value in [m_lower, m_upper) More...
 

Detailed Description

Implements structs Bin1D, Bin1DCVector.

Homepage:\n http://www.bornagainproject.org
License:\n GNU General Public License v3 or higher (see COPYING)
Authors
Scientific Computing Group at MLZ (see CITATION, AUTHORS)

Definition in file Bin.cpp.

Function Documentation

◆ BinContains()

bool BinContains ( const Bin1D bin,
double  value 
)

Checks if value is contained in bin: value in [m_lower, m_upper)

Definition at line 18 of file Bin.cpp.

19 {
20  if (bin.binSize() == 0.0)
21  return false;
22  double coordinate = (value - bin.m_lower) / bin.binSize();
23  if (coordinate < 0.0)
24  return false;
25  if (coordinate >= 1.0)
26  return false;
27  return true;
28 }
double binSize() const
Definition: Bin.h:26
double m_lower
lower bound of the bin
Definition: Bin.h:23

References Bin1D::binSize(), and Bin1D::m_lower.

Here is the call graph for this function: