//  ************************************************************************************************
//
//  BornAgain: simulate and fit reflection and scattering
//
//! @file      Sample/HardParticle/ProfileRipple.h
//! @brief     Defines class interfacees ProfileRipple, CosineRipple, SawtoothRipple.
//!
//! @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_HARDPARTICLE_IPROFILERIPPLE_H
#define BORNAGAIN_SAMPLE_HARDPARTICLE_IPROFILERIPPLE_H

#include "Sample/Particle/HardFormfactor.h"

//! Base class for form factors with a cosine ripple profile in the yz plane.

class ProfileRipple : public HardFormfactor {
public:
    ProfileRipple(double length, double width, double height);

    double length() const { return m_length; }
    double height() const { return m_height; }
    double width() const { return m_width; }

    double radialExtension() const override;

    complex_t formfactorAtBottom(C3 q) const override;
    void validate() const override;

protected:
    double m_length;
    double m_width;
    double m_height;

    virtual complex_t factor_x(complex_t qx) const = 0;
    virtual complex_t factor_yz(complex_t qy, complex_t qz) const = 0;
};

//! Base class for form factors with a rectangular ripple (bar) profile in the yz plane.

class ProfileRectangularRipple : public ProfileRipple {
public:
    ProfileRectangularRipple(double length, double width, double height);

private:
    complex_t factor_yz(complex_t qy, complex_t qz) const override;
};

//! Base class for form factors with a cosine ripple profile in the yz plane.

class CosineRipple : public ProfileRipple {
public:
    CosineRipple(double length, double width, double height);

private:
    complex_t factor_yz(complex_t qy, complex_t qz) const override;
};

//! Base class for form factors with a triangular ripple profile in the yz plane.

class SawtoothRipple : public ProfileRipple {
public:
    SawtoothRipple(double length, double width, double height, double asymmetry);

    double asymmetry() const { return m_asymmetry; }

protected:
    double m_asymmetry;

private:
    complex_t factor_yz(complex_t qy, complex_t qz) const override;
};

#endif // BORNAGAIN_SAMPLE_HARDPARTICLE_IPROFILERIPPLE_H
