Skip to content
Snippets Groups Projects
Commit 9d01dec7 authored by Van Herck, Walter's avatar Van Herck, Walter
Browse files

Add FormFactorBAPol for polarized SANS

parent 7d04dd6e
No related branches found
No related tags found
No related merge requests found
......@@ -123,6 +123,7 @@ const std::string FormFactorSphereLogNormalRadiusType = "FormFactorSphereLogNorm
const std::string FormFactorSphereUniformRadiusType = "FormFactorSphereUniformRadius";
const std::string FormFactorDWBAType = "FormFactorDWBA";
const std::string FormFactorPolarizedDWBAType = "FormFactorDWBAPol";
const std::string FormFactorPolarizedBAType = "FormFactorBAPol";
const std::string FormFactorCoreShellType = "FormFactorCoreShell";
const std::string FormFactorDecoratorPositionFactorType = "FormFactorDecoratorPositionFactor";
......
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file Core/Multilayer/FormFactorBAPol.cpp
//! @brief Defines class FormFactorBAPol.
//!
//! @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 "FormFactorBAPol.h"
#include "BornAgainNamespace.h"
#include "WavevectorInfo.h"
#include <stdexcept>
FormFactorBAPol::FormFactorBAPol(const IFormFactor& form_factor)
: mP_form_factor(form_factor.clone())
{
setName(BornAgain::FormFactorPolarizedBAType);
}
FormFactorBAPol::~FormFactorBAPol() =default;
FormFactorBAPol* FormFactorBAPol::clone() const
{
return new FormFactorBAPol(*mP_form_factor);
}
complex_t FormFactorBAPol::evaluate(const WavevectorInfo&) const
{
throw std::runtime_error("FormFactorBAPol::evaluate: "
"should never be called for matrix interactions");
}
Eigen::Matrix2cd FormFactorBAPol::evaluatePol(const WavevectorInfo& wavevectors) const
{
Eigen::Matrix2cd ff_BA = mP_form_factor->evaluatePol(wavevectors);
Eigen::Matrix2cd result;
result(0,0) = -ff_BA(1,0);
result(0,1) = ff_BA(0,0);
result(1,0) = -ff_BA(1,1);
result(1,1) = ff_BA(0,1);
return result;
}
double FormFactorBAPol::bottomZ(const IRotation& rotation) const
{
return mP_form_factor->bottomZ(rotation);
}
double FormFactorBAPol::topZ(const IRotation& rotation) const
{
return mP_form_factor->topZ(rotation);
}
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file Core/Multilayer/FormFactorBAPol.h
//! @brief Defines class FormFactorBAPol.
//!
//! @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 FORMFACTORBAPOL_H
#define FORMFACTORBAPOL_H
#include "IFormFactor.h"
#include <memory>
//! Evaluates the matrix BA term in a polarized IFormFactor.
//! @ingroup formfactors_internal
class FormFactorBAPol final : public IFormFactor
{
public:
FormFactorBAPol(const IFormFactor& form_factor);
~FormFactorBAPol() override;
FormFactorBAPol* clone() const override;
void accept(INodeVisitor* visitor) const override { visitor->visit(this); }
void setAmbientMaterial(Material material) override {
mP_form_factor->setAmbientMaterial(std::move(material));
}
//! Throws not-implemented exception
complex_t evaluate(const WavevectorInfo& wavevectors) const override;
//! Calculates and returns a polarized form factor calculation in BA
Eigen::Matrix2cd evaluatePol(const WavevectorInfo& wavevectors) const override;
double volume() const override { return mP_form_factor->volume(); }
double radialExtension() const override { return mP_form_factor->radialExtension(); }
double bottomZ(const IRotation& rotation) const override;
double topZ(const IRotation& rotation) const override;
private:
//! The form factor for BA
std::unique_ptr<IFormFactor> mP_form_factor;
};
#endif // FORMFACTORBAPOL_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment