Skip to content
Snippets Groups Projects
Commit 7c82cbc9 authored by Yurov, Dmitry's avatar Yurov, Dmitry
Browse files

Implementation of the material embracing refractive coefficients

Redmine: #1858
parent a8cc21ab
No related branches found
No related tags found
No related merge requests found
#include "RefractiveCoefMaterial.h"
#include "WavevectorInfo.h"
RefractiveCoefMaterial::RefractiveCoefMaterial(const std::string& name, double delta, double beta,
kvector_t magnetization)
: BaseMaterialImpl(name, magnetization)
, m_delta(delta)
, m_beta(beta)
{}
RefractiveCoefMaterial::~RefractiveCoefMaterial()
{}
RefractiveCoefMaterial* RefractiveCoefMaterial::clone() const
{
return new RefractiveCoefMaterial(*this);
}
complex_t RefractiveCoefMaterial::refractiveIndex(double) const
{
return complex_t(1.0 - m_delta, m_beta);
}
complex_t RefractiveCoefMaterial::refractiveIndex2(double) const
{
complex_t result(1.0 - m_delta, m_beta);
return result * result;
}
complex_t RefractiveCoefMaterial::materialData() const
{
return complex_t(m_delta, m_beta);
}
complex_t RefractiveCoefMaterial::scalarSubtrSLD(const WavevectorInfo& wavevectors) const
{
double wavelength = wavevectors.getWavelength();
double prefactor = M_PI/wavelength/wavelength;
return prefactor * refractiveIndex2(wavelength);
}
void RefractiveCoefMaterial::print(std::ostream& ostr) const
{
ostr << "RefractiveCoefMaterial:" << getName() << "<" << this << ">{ "
<< "delta=" << m_delta << ", beta=" << m_beta
<< ", B=" << magnetization() << "}";
}
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file Core/Material/RefractiveIndexMaterial.h
//! @brief Defines class RefractiveIndexMaterial.
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2015
//! @authors Scientific Computing Group at MLZ Garching
//! @authors C. Durniak, M. Ganeva, G. Pospelov, W. Van Herck, J. Wuttke
//
// ************************************************************************** //
#ifndef REFRACTIVECOEFMATERIAL_H_
#define REFRACTIVECOEFMATERIAL_H_
#include "BaseMaterialImpl.h"
#include "Material.h"
class BA_CORE_API_ RefractiveCoefMaterial : public BaseMaterialImpl
{
public:
//! Constructs a material with _name_ and _refractive_index_.
friend BA_CORE_API_ Material RefractiveIndexMaterial(const std::string&, complex_t, kvector_t);
//! Constructs a material with _name_ and refractive_index parameters
//! \f$\delta\f$ and \f$\beta\f$ for refractive index \f$n = 1 - \delta + i \beta\f$.
friend BA_CORE_API_ Material RefractiveIndexMaterial(const std::string&, double, double,
kvector_t);
virtual ~RefractiveCoefMaterial();
//! Returns pointer to a copy of material
virtual RefractiveCoefMaterial* clone() const override;
virtual complex_t refractiveIndex(double wavelength) const override;
virtual complex_t refractiveIndex2(double wavelength) const override;
//! Returns underlying material data
virtual complex_t materialData() const override;
//! Returns \pi/(wl*wl) - sld, with wl being the wavelength
virtual complex_t scalarSubtrSLD(const WavevectorInfo& wavevectors) const override;
//! Prints object data
virtual void print(std::ostream &ostr) const override;
private:
RefractiveCoefMaterial(const std::string& name, double delta, double beta,
kvector_t magnetization);
double m_delta; //!< \f$\delta\f$ coefficient for refractive index \f$n = 1 - \delta + i \beta\f$
double m_beta; //!< \f$\beta\f$ coefficient for refractive index \f$n = 1 - \delta + i \beta\f$
};
#endif /* REFRACTIVECOEFMATERIAL_H_ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment