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

Defines structs Bin1D, Bin1DCVector. More...

Include dependency graph for Bin.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Bin1D
 
class  Bin1DCVector
 An one-dimensional range of cvector_t's. More...
 
struct  Bin1DKVector
 An one-dimensional range of kvector_t's. More...
 

Functions

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

Detailed Description

Defines 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.h.

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: