From b0c3c4421ab893715c8214d68359b67781f601b9 Mon Sep 17 00:00:00 2001 From: Walter Van Herck <w.van.herck@fz-juelich.de> Date: Tue, 12 Jun 2012 17:42:59 +0200 Subject: [PATCH] Added interfaces for nano particle decorators --- App/src/TestDiffuseReflection.cpp | 2 +- Core/Core.pro | 9 +++-- ...dParticleDecorator.h => IDispersalState.h} | 29 +++++++------- Core/inc/IFormFactor.h | 15 ++++++- Core/inc/Layer.h | 2 +- Core/inc/NanoParticle.h | 6 ++- Core/inc/NanoParticleDecorator.h | 39 +++++++++++++++++++ Core/src/DispersedParticleDecorator.cpp | 6 --- Core/src/NanoParticleDecorator.cpp | 9 +++++ 9 files changed, 87 insertions(+), 30 deletions(-) rename Core/inc/{DispersedParticleDecorator.h => IDispersalState.h} (61%) create mode 100644 Core/inc/NanoParticleDecorator.h delete mode 100644 Core/src/DispersedParticleDecorator.cpp create mode 100644 Core/src/NanoParticleDecorator.cpp diff --git a/App/src/TestDiffuseReflection.cpp b/App/src/TestDiffuseReflection.cpp index 785e472af8f..2ce477f3009 100644 --- a/App/src/TestDiffuseReflection.cpp +++ b/App/src/TestDiffuseReflection.cpp @@ -136,7 +136,7 @@ void TestDiffuseReflection::draw() { double alpha_i = m_data_spec->getCurrentValueOfAxis<double>("alpha_i"); double r = m_data_spec->next(); - gr->SetPoint(m_data_spec->getCoordinate("alpha_i"), Units::rad2deg(alpha_i), r); + gr->SetPoint(m_data_spec->getCurrentIndexOfAxis("alpha_i"), Units::rad2deg(alpha_i), r); } // off specular plot diff --git a/Core/Core.pro b/Core/Core.pro index 4c9ea44d51c..03b86742e70 100644 --- a/Core/Core.pro +++ b/Core/Core.pro @@ -28,7 +28,6 @@ SOURCES += \ src/MaterialManager.cpp \ src/StochasticGaussian.cpp \ src/MathFunctions.cpp \ - src/DispersedParticleDecorator.cpp \ src/FormFactorCylinder.cpp \ src/Types.cpp \ src/DoubleToComplexInterpolatingFunction.cpp \ @@ -36,7 +35,8 @@ SOURCES += \ src/ISingleton.cpp \ src/IFunctionalTest.cpp \ src/IFactory.cpp \ - src/DWBADiffuseReflection.cpp + src/DWBADiffuseReflection.cpp \ + src/NanoParticleDecorator.cpp HEADERS += \ inc/ISample.h \ @@ -60,7 +60,6 @@ HEADERS += \ inc/IStochasticParameter.h \ inc/StochasticGaussian.h \ inc/MathFunctions.h \ - inc/DispersedParticleDecorator.h \ inc/IFormFactor.h \ inc/FormFactorCylinder.h \ inc/StochasticDiracDelta.h \ @@ -72,7 +71,9 @@ HEADERS += \ inc/IFunctionalTest.h \ inc/IFactory.h \ inc/Numeric.h \ - inc/DWBADiffuseReflection.h + inc/DWBADiffuseReflection.h \ + inc/NanoParticleDecorator.h \ + inc/IDispersalState.h INCLUDEPATH += /opt/local/include ./inc DEPENDPATH += ./inc diff --git a/Core/inc/DispersedParticleDecorator.h b/Core/inc/IDispersalState.h similarity index 61% rename from Core/inc/DispersedParticleDecorator.h rename to Core/inc/IDispersalState.h index 35d3e1f642e..1314655c5c0 100644 --- a/Core/inc/DispersedParticleDecorator.h +++ b/Core/inc/IDispersalState.h @@ -1,5 +1,5 @@ -#ifndef DISPERSEDPARTICLEDECORATOR_H -#define DISPERSEDPARTICLEDECORATOR_H +#ifndef IDISPERSALSTATE_H_ +#define IDISPERSALSTATE_H_ // ******************************************************************** // * The BornAgain project * // * Simulation of neutron and x-ray scattering at grazing incidence * @@ -9,25 +9,22 @@ // * eget quam orci. Quisque porta varius dui, quis posuere nibh * // * mollis quis. Mauris commodo rhoncus porttitor. * // ******************************************************************** -//! @file DispersedParticleDecorator.h -//! @brief Defenition of DispersedParticleDecorator +//! @file IDispersalState.h +//! @brief Definition of IDispersalState //! @author Scientific Computing Group at FRM II -//! @date 01.05.2012 +//! @date 12.06.2012 -#include "ISample.h" - - -class DispersedParticleDecorator : public ISample +//- ------------------------------------------------------------------- +//! @class IDispersalState +//! @brief Definition of IDispersalState interface +//- ------------------------------------------------------------------- +class IDispersalState { public: - DispersedParticleDecorator(ISample* p_sub_sample); - virtual ~DispersedParticleDecorator() {} + virtual ~IDispersalState() {} - ISample* getSubSample() const { return mp_sub_sample; } +}; -private: - ISample* mp_sub_sample; -}; -#endif // DISPERSEDPARTICLEDECORATOR_H +#endif /* IDISPERSALSTATE_H_ */ diff --git a/Core/inc/IFormFactor.h b/Core/inc/IFormFactor.h index 7c5e22447a0..65da567e660 100644 --- a/Core/inc/IFormFactor.h +++ b/Core/inc/IFormFactor.h @@ -10,19 +10,30 @@ // * mollis quis. Mauris commodo rhoncus porttitor. * // ******************************************************************** //! @file IFormFactor.h -//! @brief Definition of IFormFactor +//! @brief Definition of IFormFactor and IBornFormFactor //! @author Scientific Computing Group at FRM II //! @date 01.04.2012 #include "Types.h" +//- ------------------------------------------------------------------- +//! @class IFormFactor +//! @brief Definition of IFormfactor interface +//- ------------------------------------------------------------------- class IFormFactor { public: virtual ~IFormFactor() {} + /// calculate scattering amplitude + /// + /// calculate scattering amplitude + /// @param k_i incoming wavevector + /// @param k_f outgoing wavevector virtual complex_t evaluate(kvector_t k_i, kvector_t k_f) const=0; + + /// return number of variable/stochastic parameters virtual int getNumberOfStochasticParameters() { return 0; } }; @@ -36,6 +47,8 @@ public: return evaluate_for_q(k_i - k_f); } protected: + /// evaluate scattering amplitude + /// @param q wavevector transfer \f$q\equiv k_i-k_f\f$ virtual complex_t evaluate_for_q(kvector_t q) const=0; }; diff --git a/Core/inc/Layer.h b/Core/inc/Layer.h index 04fb387173a..2b711e15e9d 100644 --- a/Core/inc/Layer.h +++ b/Core/inc/Layer.h @@ -32,7 +32,7 @@ public: Layer &operator=(const Layer &other); virtual ~Layer(); - //! make layer's clone + /// make layer's clone virtual Layer *clone() const; /// set layer thickness in _angstrom_ diff --git a/Core/inc/NanoParticle.h b/Core/inc/NanoParticle.h index 989d275cf22..78028cfffc1 100644 --- a/Core/inc/NanoParticle.h +++ b/Core/inc/NanoParticle.h @@ -18,6 +18,10 @@ #include "IFormFactor.h" +//- ------------------------------------------------------------------- +//! @class NanoParticle +//! @brief Definition of a nanoparticle with a form factor +//- ------------------------------------------------------------------- class NanoParticle : public ISample { public: @@ -25,7 +29,7 @@ public: virtual ~NanoParticle(); private: - IFormFactor* mp_form_factor; + IFormFactor* mp_form_factor; ///< pointer to the form factor }; #endif // NANOPARTICLE_H diff --git a/Core/inc/NanoParticleDecorator.h b/Core/inc/NanoParticleDecorator.h new file mode 100644 index 00000000000..fe6184197b6 --- /dev/null +++ b/Core/inc/NanoParticleDecorator.h @@ -0,0 +1,39 @@ +#ifndef NANOPARTICLEDECORATOR_H +#define NANOPARTICLEDECORATOR_H +// ******************************************************************** +// * The BornAgain project * +// * Simulation of neutron and x-ray scattering at grazing incidence * +// * * +// * LICENSE AND DISCLAIMER * +// * Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris * +// * eget quam orci. Quisque porta varius dui, quis posuere nibh * +// * mollis quis. Mauris commodo rhoncus porttitor. * +// ******************************************************************** +//! @file NanoParticleDecorator.h +//! @brief Definition of NanoParticleDecorator +//! @author Scientific Computing Group at FRM II +//! @date 23.05.2012 + +#include "NanoParticle.h" + +//- ------------------------------------------------------------------- +//! @class NanoParticleDecorator +//! @brief Definition of decorator class that adds nano particles to ISample objects +//- ------------------------------------------------------------------- +class NanoParticleDecorator : public ISample +{ +public: + NanoParticleDecorator(ISample *p_sub_sample); + virtual ~NanoParticleDecorator() {} + + /// Return decorated sample + ISample* getSubSample() const { return mp_sub_sample; } + +private: + std::vector<NanoParticle *> m_particles; ///< Vector of the types of nano particles + ISample* mp_sub_sample; ///< Decorated ISample object + +}; + + +#endif // NANOPARTICLEDECORATOR_H diff --git a/Core/src/DispersedParticleDecorator.cpp b/Core/src/DispersedParticleDecorator.cpp deleted file mode 100644 index 97739649777..00000000000 --- a/Core/src/DispersedParticleDecorator.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "DispersedParticleDecorator.h" - -DispersedParticleDecorator::DispersedParticleDecorator(ISample *p_sub_sample) - : mp_sub_sample(p_sub_sample) -{ -} diff --git a/Core/src/NanoParticleDecorator.cpp b/Core/src/NanoParticleDecorator.cpp new file mode 100644 index 00000000000..f5a63804bc7 --- /dev/null +++ b/Core/src/NanoParticleDecorator.cpp @@ -0,0 +1,9 @@ +#include "NanoParticleDecorator.h" + +/* ************************************************************************* */ +NanoParticleDecorator::NanoParticleDecorator(ISample *p_sub_sample) +: mp_sub_sample(p_sub_sample) +{ +} + +/* ************************************************************************* */ -- GitLab