//  ************************************************************************************************
//
//  BornAgain: simulate and fit reflection and scattering
//
//! @file      Sample/Aggregate/FiniteCrystal2D.h
//! @brief     Defines class FiniteCrystal2D.
//!
//! @homepage  http://www.bornagainproject.org
//! @license   GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
//  ************************************************************************************************

#ifndef BORNAGAIN_SAMPLE_AGGREGATE_FINITECRYSTAL2D_H
#define BORNAGAIN_SAMPLE_AGGREGATE_FINITECRYSTAL2D_H

#include "Sample/Aggregate/Crystal2D.h"

//! Interference function of a finite 2D crystal.

class FiniteCrystal2D : public LongRangeOrdered2D, public ICrystal2D {
public:
    FiniteCrystal2D(const IParticle& particle, const Lattice2D& lattice, unsigned N_1,
                    unsigned N_2);
    ~FiniteCrystal2D() override;

    std::string className() const final { return "FiniteCrystal2D"; }

#ifndef SWIG
    FiniteCrystal2D* clone() const override;

    unsigned numberUnitCells1() const { return m_N_1; }
    unsigned numberUnitCells2() const { return m_N_2; }

private:
    double interferenceForXi(double xi, double qx, double qy) const override;

    unsigned m_N_1, m_N_2; //!< Size of the finite lattice in lattice units

#endif // SWIG
};

#endif // BORNAGAIN_SAMPLE_AGGREGATE_FINITECRYSTAL2D_H
