1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
// ************************************************************************************************
//
// BornAgain: simulate and fit reflection and scattering
//
//! @file Sample/Interface/Roughness.cpp
//! @brief Implements class Roughness.
//!
//! @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)
//
// ************************************************************************************************
#include "Sample/Interface/Roughness.h"
#include "Base/Util/Assert.h"
//! Constructor of layer roughness.
//! @param autoCorrModel: autocorrelation function and spectrum
//! @param transient: shape of the interfacial transition region
Roughness::Roughness(const AutocorrelationModel* autocorrelation, const TransientModel* transient,
const CrosscorrelationModel* crosscorrelation)
: m_autocorrelation(autocorrelation ? autocorrelation->clone() : nullptr)
, m_transient(transient ? transient->clone() : nullptr)
, m_crosscorrelation_model(crosscorrelation ? crosscorrelation->clone() : nullptr)
{
ASSERT(m_autocorrelation);
ASSERT(m_transient);
if (dynamic_cast<LinearGrowthModel*>(m_autocorrelation.get()) && m_crosscorrelation_model.get())
throw std::runtime_error("Linear growth model already has the crosscorrelation model");
}
Roughness* Roughness::clone() const
{
return new Roughness(m_autocorrelation.get(), m_transient.get(),
m_crosscorrelation_model.get());
}
std::vector<const INode*> Roughness::nodeChildren() const
{
return std::vector<const INode*>()
<< m_autocorrelation << m_transient << m_crosscorrelation_model;
}
bool Roughness::showInScriptOrGui() const
{
if (auto autocorr = dynamic_cast<const SelfAffineFractalModel*>(m_autocorrelation.get()))
if (autocorr->sigma() == 0)
return false;
return true;
}
|