BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
InterferenceFunctionFinite2DLattice.h
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/Aggregate/InterferenceFunctionFinite2DLattice.h
6 //! @brief Defines class InterferenceFunctionFinite2DLattice.
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 
15 #ifndef BORNAGAIN_CORE_AGGREGATE_INTERFERENCEFUNCTIONFINITE2DLATTICE_H
16 #define BORNAGAIN_CORE_AGGREGATE_INTERFERENCEFUNCTIONFINITE2DLATTICE_H
17 
20 
21 //! Interference function of a finite 2D lattice.
22 //! @ingroup interference
23 
25 {
26 public:
27  InterferenceFunctionFinite2DLattice(const Lattice2D& lattice, unsigned N_1, unsigned N_2);
28  InterferenceFunctionFinite2DLattice(double length_1, double length_2, double alpha, double xi,
29  unsigned N_1, unsigned N_2);
31 
32  InterferenceFunctionFinite2DLattice* clone() const override final;
33 
34  void accept(INodeVisitor* visitor) const override final { visitor->visit(this); }
35 
36  static InterferenceFunctionFinite2DLattice* createSquare(double lattice_length, double xi,
37  unsigned N_1, unsigned N_2);
38  static InterferenceFunctionFinite2DLattice* createHexagonal(double lattice_length, double xi,
39  unsigned N_1, unsigned N_2);
40 
41  unsigned numberUnitCells1() const { return m_N_1; }
42  unsigned numberUnitCells2() const { return m_N_2; }
43 
44  void setIntegrationOverXi(bool integrate_xi);
45  bool integrationOverXi() const { return m_integrate_xi; }
46 
47  const Lattice2D& lattice() const;
48 
49  //! Returns the particle density associated with this 2d lattice
50  double getParticleDensity() const override final;
51 
52  std::vector<const INode*> getChildren() const override final;
53 
54 private:
55  double iff_without_dw(const kvector_t q) const override final;
56  void setLattice(const Lattice2D& lattice);
57 
58  double interferenceForXi(double xi) const;
59 
60  bool m_integrate_xi; //!< Integrate over the orientation xi
61  std::unique_ptr<Lattice2D> mP_lattice;
62  unsigned m_N_1, m_N_2; //!< Size of the finite lattice in lattice units
63  mutable double m_qx;
64  mutable double m_qy;
65 };
66 
67 #endif // BORNAGAIN_CORE_AGGREGATE_INTERFERENCEFUNCTIONFINITE2DLATTICE_H
Defines and implements the interface class IInterferenceFunction.
Defines classes of Lattice2D family.
Pure virtual base class of interference functions.
Visitor interface to visit ISample objects.
Definition: INodeVisitor.h:149
Base class for tree-like structures containing parameterized objects.
Definition: INode.h:49
Interference function of a finite 2D lattice.
bool m_integrate_xi
Integrate over the orientation xi.
unsigned m_N_2
Size of the finite lattice in lattice units.
InterferenceFunctionFinite2DLattice(const Lattice2D &lattice, unsigned N_1, unsigned N_2)
Constructor of two-dimensional finite lattice interference function.
InterferenceFunctionFinite2DLattice * clone() const override final
Returns a clone of this ISample object.
double getParticleDensity() const override final
Returns the particle density associated with this 2d lattice.
static InterferenceFunctionFinite2DLattice * createSquare(double lattice_length, double xi, unsigned N_1, unsigned N_2)
Creates square lattice.
static InterferenceFunctionFinite2DLattice * createHexagonal(double lattice_length, double xi, unsigned N_1, unsigned N_2)
Creates hexagonal lattice.
void accept(INodeVisitor *visitor) const override final
Calls the INodeVisitor's visit method.
std::vector< const INode * > getChildren() const override final
Returns a vector of children (const).
double iff_without_dw(const kvector_t q) const override final
Calculates the structure factor without Debye-Waller factor.