BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
Bin.cpp File Reference
Include dependency graph for Bin.cpp:

Go to the source code of this file.

Functions

bool BinContains (const Bin1D &bin, double value)
 

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 17 of file Bin.cpp.

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

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

Here is the call graph for this function: