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

Implementation of material factory functions

Redmine: #1858
parent 7f716131
No related branches found
No related tags found
No related merge requests found
#include "MaterialFactoryFuncs.h"
#include "RefractiveCoefMaterial.h"
#include "WavelengthIndependentMaterial.h"
Material RefractiveIndexMaterial(const std::string& name, complex_t refractive_index,
kvector_t magnetization)
{
const double delta = 1.0 - refractive_index.real();
const double beta = refractive_index.imag();
std::unique_ptr<RefractiveCoefMaterial> mat_impl(
new RefractiveCoefMaterial(name, delta, beta, magnetization));
return Material(std::move(mat_impl));
}
Material RefractiveIndexMaterial(const std::string& name, double delta, double beta,
kvector_t magnetization)
{
std::unique_ptr<RefractiveCoefMaterial> mat_impl(
new RefractiveCoefMaterial(name, delta, beta, magnetization));
return Material(std::move(mat_impl));
}
Material MaterialBySLD(const std::string& name, double sld, double abs_term,
kvector_t magnetization)
{
std::unique_ptr<WavelengthIndependentMaterial> mat_impl(
new WavelengthIndependentMaterial(name, sld, abs_term, magnetization));
return Material(std::move(mat_impl));
}
constexpr double basic_wavelength = 0.1798197; // nm, wavelength of 2200 m/s neutrons
Material MaterialByAbsCX(const std::string& name, double sld, double abs_cx,
kvector_t magnetization)
{
std::unique_ptr<WavelengthIndependentMaterial> mat_impl(
new WavelengthIndependentMaterial(name, sld, abs_cx / basic_wavelength, magnetization));
return Material(std::move(mat_impl));
}
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file Core/Material/MaterialFactoryFuncs.h
//! @brief Defines factory functions for creating different flavors of materials.
//!
//! @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 MATERIALFACTORYFUNCS_H_
#define MATERIALFACTORYFUNCS_H_
#include "Material.h"
//! Constructs a material with _name_ and _refractive_index_.
BA_CORE_API_ Material RefractiveIndexMaterial(const std::string& name, complex_t refractive_index,
kvector_t magnetization = 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$.
BA_CORE_API_ Material RefractiveIndexMaterial(const std::string& name, double delta, double beta,
kvector_t magnetization = kvector_t());
//! Constructs a wavelength-independent material with given sld and absorptive term
//! Absorptive term is wavelength-independent (normalized to a wavelength)
//! and can be considered as inverse of imaginary part of complex scattering length density:
//! \f$ SLD = (N b_{coh}, N \sigma_{abs}(\lambda_0) / \lambda_0) \f$
//! Here \f$ N \f$ - material number density,
//! \f$ b_{coh} \f$ - bound coherent scattering length
//! \f$ \sigma_{abs}(\lambda_0) \f$ - absorption cross-section at \f$ \lambda_0 \f$ wavelength
//! @param sld: scattering length density, \f$ nm^{-2} \f$
//! @param abs_term: wavelength-independent absorptive term, \f$ nm^{-2} \f$
BA_CORE_API_ Material MaterialBySLD(const std::string& name, double sld, double abs_term,
kvector_t magnetization = kvector_t());
//! Constructs a wavelength-independent material with given sld and absorptive term
//! As opposed to MaterialBySLD, absorptive term is the product of number density and
//! absorptive cross-section \f$ \sigma_0 \f$ at \f$ \lambda = 1.798197\f$ Angstroms.
//! The latter corresponds to 2200 m/s neutrons.
//! @param sld: scattering length density, \f$ nm^{-2} \f$
//! @param abs_cx: absorptive term at \f$ \lambda = 1.798197\f$ Angstroms, \f$ nm^{-1} \f$
BA_CORE_API_ Material MaterialByAbsCX(const std::string& name, double sld, double abs_cx,
kvector_t magnetization = kvector_t());
#endif /* MATERIALFACTORYFUNCS_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