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

#ifndef BORNAGAIN_SAMPLE_MULTILAYER_ROUGHNESSUTIL_H
#define BORNAGAIN_SAMPLE_MULTILAYER_ROUGHNESSUTIL_H

#include <cstddef>
#include <memory>
#include <vector>

class Layer;
class Roughness;

namespace RoughnessUtil {

//! Returns roughness spectrum for a given layer index
double spectrum(const std::vector<std::unique_ptr<Layer>>& flat, double spatial_f, size_t i_layer);

//! Returns roughness root-mean-squared for a given layer index
double rms(const std::vector<std::unique_ptr<Layer>>& flat, std::size_t i_layer);

//! Returns the adjacent-interface cross-spectrum used by current roughness models.
double crossSpectrumWithInterfaceBelow(const Roughness& roughness, double thickness,
                                       double spectrum_up, double spectrum_low, double spatial_f);

} // namespace RoughnessUtil

#endif // BORNAGAIN_SAMPLE_MULTILAYER_ROUGHNESSUTIL_H
