Skip to content
Snippets Groups Projects
Commit 912c34ac authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

merge files ProfileRipple*

parent 1cd8e2c6
No related branches found
No related tags found
No related merge requests found
......@@ -15,7 +15,7 @@
#ifndef BORNAGAIN_CORE_HARDPARTICLE_FORMFACTORRIPPLE1_H
#define BORNAGAIN_CORE_HARDPARTICLE_FORMFACTORRIPPLE1_H
#include "Core/HardParticle/ProfileRipple1.h"
#include "Core/HardParticle/IProfileRipple.h"
//! The form factor for a cosine ripple, with box profile in elongation direction.
//! @ingroup legacyGrating
......
......@@ -15,7 +15,7 @@
#ifndef BORNAGAIN_CORE_HARDPARTICLE_FORMFACTORRIPPLE2_H
#define BORNAGAIN_CORE_HARDPARTICLE_FORMFACTORRIPPLE2_H
#include "Core/HardParticle/ProfileRipple2.h"
#include "Core/HardParticle/IProfileRipple.h"
//! The form factor for a cosine ripple, with box profile in elongation direction.
//! @ingroup legacyGrating
......
......@@ -2,7 +2,7 @@
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file Core/HardParticle/ProfileRipple2.cpp
//! @file Core/HardParticle/IProfileRipple.cpp
//! @brief Implements class ProfileRipple2.
//!
//! @homepage http://www.bornagainproject.org
......@@ -12,14 +12,91 @@
//
// ************************************************************************** //
#include "Core/HardParticle/ProfileRipple2.h"
#include "Core/Basics/Exceptions.h"
#include "Core/Basics/MathConstants.h"
#include "Core/HardParticle/IProfileRipple.h"
#include "Core/HardParticle/Ripples.h"
#include "Core/Parametrization/RealParameter.h"
#include "Core/Shapes/RippleSawtooth.h" // from Shapes/
#include "Core/Tools/MathFunctions.h"
#include "Fit/Tools/RealLimits.h"
#include "Core/Shapes/RippleCosine.h"
#include "Core/Shapes/RippleSawtooth.h"
// ************************************************************************** //
// interface IProfileRipple
// ************************************************************************** //
//! @brief Constructor of cosine ripple.
//! @param length: length of the rectangular base in nanometers
//! @param width: width of the rectangular base in nanometers
//! @param height: height of the ripple in nanometers
IProfileRipple::IProfileRipple(double length, double width, double height)
: m_length(length), m_width(width), m_height(height)
{
registerParameter("Length", &m_length).setUnit("nm").setNonnegative();
registerParameter("Width", &m_width).setUnit("nm").setNonnegative();
registerParameter("Height", &m_height).setUnit("nm").setNonnegative();
onChange();
}
double IProfileRipple::radialExtension() const
{
return (m_width + m_length) / 4.0;
}
complex_t IProfileRipple::evaluate_for_q(cvector_t q) const
{
return factor_x(q.x()) * factor_yz(q.y(), q.z());
}
//! Complex form factor.
complex_t IProfileRipple::factor_yz(complex_t qy, complex_t qz) const
{
return ripples::profile_yz_cosine(qy, qz, m_width, m_height);
}
void IProfileRipple::onChange()
{
mP_shape.reset(new RippleCosine(m_length, m_width, m_height));
}
// ************************************************************************** //
// interface ProfileRipple1
// ************************************************************************** //
//! @brief Constructor of cosine ripple.
//! @param length: length of the rectangular base in nanometers
//! @param width: width of the rectangular base in nanometers
//! @param height: height of the ripple in nanometers
ProfileRipple1::ProfileRipple1(double length, double width, double height)
: m_length(length), m_width(width), m_height(height)
{
registerParameter("Length", &m_length).setUnit("nm").setNonnegative();
registerParameter("Width", &m_width).setUnit("nm").setNonnegative();
registerParameter("Height", &m_height).setUnit("nm").setNonnegative();
onChange();
}
double ProfileRipple1::radialExtension() const
{
return (m_width + m_length) / 4.0;
}
complex_t ProfileRipple1::evaluate_for_q(cvector_t q) const
{
return factor_x(q.x()) * factor_yz(q.y(), q.z());
}
//! Complex form factor.
complex_t ProfileRipple1::factor_yz(complex_t qy, complex_t qz) const
{
return ripples::profile_yz_cosine(qy, qz, m_width, m_height);
}
void ProfileRipple1::onChange()
{
mP_shape.reset(new RippleCosine(m_length, m_width, m_height));
}
// ************************************************************************** //
// interface ProfileRipple2
// ************************************************************************** //
//! @brief Constructor of triangular ripple.
//! @param length: length of the rectangular base in nanometers
......@@ -40,6 +117,11 @@ double ProfileRipple2::radialExtension() const
return (m_width + m_length) / 4.0;
}
complex_t ProfileRipple2::evaluate_for_q(cvector_t q) const
{
return factor_x(q.x()) * factor_yz(q.y(), q.z());
}
//! Complex form factor.
complex_t ProfileRipple2::factor_yz(complex_t qy, complex_t qz) const
{
......
......@@ -2,8 +2,8 @@
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file Core/HardParticle/ProfileRipple2.h
//! @brief Defines class ProfileRipple2.
//! @file Core/HardParticle/IProfileRipple.h
//! @brief Defines interface classes IProfileRipple, ProfileRipple1, ProfileRipple2.
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
......@@ -16,7 +16,60 @@
#define BORNAGAIN_CORE_HARDPARTICLE_PROFILERIPPLE2_H
#include "Core/Scattering/IFormFactorBorn.h"
#include "Core/Tools/Integrator.h"
//! Base class for form factors with a cosine ripple profile in the yz plane.
class BA_CORE_API_ IProfileRipple : public IFormFactorBorn
{
public:
IProfileRipple(double length, double width, double height);
double getLength() const { return m_length; }
double getHeight() const { return m_height; }
double getWidth() const { return m_width; }
double radialExtension() const override final;
complex_t evaluate_for_q(cvector_t q) const override final;
protected:
void onChange() override final;
virtual complex_t factor_x(complex_t qx) const = 0;
double m_length;
double m_width;
double m_height;
private:
complex_t factor_yz(complex_t qy, complex_t qz) const;
};
//! Base class for form factors with a cosine ripple profile in the yz plane.
class BA_CORE_API_ ProfileRipple1 : public IFormFactorBorn
{
public:
ProfileRipple1(double length, double width, double height);
double getLength() const { return m_length; }
double getHeight() const { return m_height; }
double getWidth() const { return m_width; }
double radialExtension() const override final;
complex_t evaluate_for_q(cvector_t q) const override final;
protected:
void onChange() override final;
virtual complex_t factor_x(complex_t qx) const = 0;
double m_length;
double m_width;
double m_height;
private:
complex_t factor_yz(complex_t qy, complex_t qz) const;
};
//! Base class for form factors with a triangular ripple profile in the yz plane.
......@@ -32,10 +85,7 @@ public:
double radialExtension() const override final;
complex_t evaluate_for_q(cvector_t q) const override final
{
return factor_x(q.x()) * factor_yz(q.y(), q.z());
}
complex_t evaluate_for_q(cvector_t q) const override final;
protected:
void onChange() override final;
......
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file Core/HardParticle/ProfileRipple1.cpp
//! @brief Implements class ProfileRipple1.
//!
//! @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 "Core/HardParticle/ProfileRipple1.h"
#include "Core/Basics/Exceptions.h"
#include "Core/Parametrization/RealParameter.h"
#include "Core/HardParticle/Ripples.h"
#include "Core/Shapes/RippleCosine.h" // from Shapes/
#include "Core/Tools/MathFunctions.h"
#include "Fit/Tools/RealLimits.h"
//! @brief Constructor of cosine ripple.
//! @param length: length of the rectangular base in nanometers
//! @param width: width of the rectangular base in nanometers
//! @param height: height of the ripple in nanometers
ProfileRipple1::ProfileRipple1(double length, double width, double height)
: m_length(length), m_width(width), m_height(height)
{
registerParameter("Length", &m_length).setUnit("nm").setNonnegative();
registerParameter("Width", &m_width).setUnit("nm").setNonnegative();
registerParameter("Height", &m_height).setUnit("nm").setNonnegative();
onChange();
}
double ProfileRipple1::radialExtension() const
{
return (m_width + m_length) / 4.0;
}
//! Complex form factor.
complex_t ProfileRipple1::factor_yz(complex_t qy, complex_t qz) const
{
return ripples::profile_yz_cosine(qy, qz, m_width, m_height);
}
void ProfileRipple1::onChange()
{
mP_shape.reset(new RippleCosine(m_length, m_width, m_height));
}
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file Core/HardParticle/ProfileRipple1.h
//! @brief Defines class ProfileRipple1.
//!
//! @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 BORNAGAIN_CORE_HARDPARTICLE_PROFILERIPPLE1_H
#define BORNAGAIN_CORE_HARDPARTICLE_PROFILERIPPLE1_H
#include "Core/Scattering/IFormFactorBorn.h"
//! Base class for form factors with a cosine ripple profile in the yz plane.
class BA_CORE_API_ ProfileRipple1 : public IFormFactorBorn
{
public:
ProfileRipple1(double length, double width, double height);
double getLength() const { return m_length; }
double getHeight() const { return m_height; }
double getWidth() const { return m_width; }
double radialExtension() const override final;
complex_t evaluate_for_q(cvector_t q) const override final
{
return factor_x(q.x()) * factor_yz(q.y(), q.z());
}
protected:
void onChange() override final;
virtual complex_t factor_x(complex_t qx) const = 0;
double m_length;
double m_width;
double m_height;
private:
complex_t factor_yz(complex_t qy, complex_t qz) const;
};
#endif // BORNAGAIN_CORE_HARDPARTICLE_PROFILERIPPLE1_H
......@@ -150,7 +150,6 @@
#include "Core/HardParticle/FormFactorTruncatedCube.h"
#include "Core/HardParticle/FormFactorTruncatedSphere.h"
#include "Core/HardParticle/FormFactorTruncatedSpheroid.h"
#include "Core/HardParticle/Ripples.h"
#include "Core/InputOutput/IntensityDataIOFactory.h"
#include "Core/Instrument/AngularSpecScan.h"
#include "Core/Instrument/ChiSquaredModule.h"
......@@ -406,8 +405,7 @@
%include "Core/HardParticle/FormFactorPolyhedron.h"
%include "Core/HardParticle/FormFactorPolyhedron.h"
%include "Core/HardParticle/ProfileBar.h"
%include "Core/HardParticle/ProfileRipple1.h"
%include "Core/HardParticle/ProfileRipple2.h"
%include "Core/HardParticle/IProfileRipple.h"
%include "Core/HardParticle/FormFactorAnisoPyramid.h"
%include "Core/HardParticle/FormFactorBox.h"
......@@ -435,7 +433,6 @@
%include "Core/HardParticle/FormFactorTruncatedCube.h"
%include "Core/HardParticle/FormFactorTruncatedSphere.h"
%include "Core/HardParticle/FormFactorTruncatedSpheroid.h"
%include "Core/HardParticle/Ripples.h"
%include "Core/SoftParticle/FormFactorGauss.h"
%include "Core/SoftParticle/FormFactorSphereGaussianRadius.h"
......
......@@ -15134,6 +15134,51 @@ class ProfileBar(IFormFactorBorn):
# Register ProfileBar in _libBornAgainCore:
_libBornAgainCore.ProfileBar_swigregister(ProfileBar)
 
class IProfileRipple(IFormFactorBorn):
r"""Proxy of C++ IProfileRipple class."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined - class is abstract")
__repr__ = _swig_repr
def getLength(self):
r"""getLength(IProfileRipple self) -> double"""
return _libBornAgainCore.IProfileRipple_getLength(self)
def getHeight(self):
r"""getHeight(IProfileRipple self) -> double"""
return _libBornAgainCore.IProfileRipple_getHeight(self)
def getWidth(self):
r"""getWidth(IProfileRipple self) -> double"""
return _libBornAgainCore.IProfileRipple_getWidth(self)
def radialExtension(self):
r"""
radialExtension(IProfileRipple self) -> double
virtual double IFormFactor::radialExtension() const =0
Returns the (approximate in some cases) radial size of the particle of this form factor's shape. This is used for SSCA calculations
"""
return _libBornAgainCore.IProfileRipple_radialExtension(self)
def evaluate_for_q(self, q):
r"""
evaluate_for_q(IProfileRipple self, cvector_t q) -> complex_t
virtual complex_t IFormFactorBorn::evaluate_for_q(cvector_t q) const =0
Returns scattering amplitude for complex scattering wavevector q=k_i-k_f. This method is public only for convenience of plotting form factors in Python.
"""
return _libBornAgainCore.IProfileRipple_evaluate_for_q(self, q)
__swig_destroy__ = _libBornAgainCore.delete_IProfileRipple
# Register IProfileRipple in _libBornAgainCore:
_libBornAgainCore.IProfileRipple_swigregister(IProfileRipple)
class ProfileRipple1(IFormFactorBorn):
r"""
 
......@@ -17691,38 +17736,6 @@ class FormFactorTruncatedSpheroid(IFormFactorBorn):
# Register FormFactorTruncatedSpheroid in _libBornAgainCore:
_libBornAgainCore.FormFactorTruncatedSpheroid_swigregister(FormFactorTruncatedSpheroid)
 
def factor_x_box(q, l):
r"""
factor_x_box(complex_t q, double l) -> complex_t
complex_t ripples::factor_x_box(complex_t q, double l)
"""
return _libBornAgainCore.factor_x_box(q, l)
def factor_x_Gauss(q, l):
r"""
factor_x_Gauss(complex_t q, double l) -> complex_t
complex_t ripples::factor_x_Gauss(complex_t q, double l)
"""
return _libBornAgainCore.factor_x_Gauss(q, l)
def factor_x_Lorentz(q, l):
r"""
factor_x_Lorentz(complex_t q, double l) -> complex_t
complex_t ripples::factor_x_Lorentz(complex_t q, double l)
"""
return _libBornAgainCore.factor_x_Lorentz(q, l)
def profile_yz_cosine(qy, qz, width, height):
r"""profile_yz_cosine(complex_t qy, complex_t qz, double width, double height) -> complex_t"""
return _libBornAgainCore.profile_yz_cosine(qy, qz, width, height)
def profile_yz_triangular(qy, qz, width, height, asymmetry):
r"""profile_yz_triangular(complex_t qy, complex_t qz, double width, double height, double asymmetry) -> complex_t"""
return _libBornAgainCore.profile_yz_triangular(qy, qz, width, height, asymmetry)
class FormFactorGaussSphere(IFormFactorBorn):
r"""Proxy of C++ FormFactorGaussSphere class."""
 
......
This diff is collapsed.
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