From ed5e6022a8df3d42426dc7964f9238b359fe3a52 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (laptop)" <j.wuttke@fz-juelich.de> Date: Tue, 26 Mar 2013 10:22:56 +0100 Subject: [PATCH] Doxygen comments. --- Core/Algorithms/inc/DWBASimulation.h | 23 ++++++++---------- Core/Algorithms/src/DWBASimulation.cpp | 22 +++++------------ Core/FormFactors/inc/FormFactorBox.h | 20 +++++++++------- Core/FormFactors/inc/FormFactorFullSphere.h | 3 +-- Core/FormFactors/inc/FormFactorPrism3.h | 2 +- Core/FormFactors/inc/FormFactorPrism6.h | 2 +- Core/FormFactors/inc/FormFactorSphere.h | 9 +++---- Core/FormFactors/src/FormFactorBox.cpp | 26 ++++++--------------- Core/FormFactors/src/FormFactorSphere.cpp | 14 +++-------- 9 files changed, 45 insertions(+), 76 deletions(-) diff --git a/Core/Algorithms/inc/DWBASimulation.h b/Core/Algorithms/inc/DWBASimulation.h index d7cf51ca694..7d4c8d5fba4 100644 --- a/Core/Algorithms/inc/DWBASimulation.h +++ b/Core/Algorithms/inc/DWBASimulation.h @@ -27,8 +27,10 @@ class DWBASimulation : public ISimulation { public: - DWBASimulation(); - virtual ~DWBASimulation(); + DWBASimulation() + : m_alpha_i(0), m_thread_info(), mp_simulation(0) {} + + virtual ~DWBASimulation() { delete mp_simulation; } //! Initialize the simulation with the parameters from simulation virtual void init(const Simulation &simulation); @@ -39,10 +41,12 @@ class DWBASimulation : public ISimulation } //! return output data containing calculated intensity - const OutputData<double> &getDWBAIntensity() const; + const OutputData<double> &getDWBAIntensity() const + { return m_dwba_intensity; } //! add intensity to current dwba intensity - void addDWBAIntensity(const OutputData<double > &data_to_add); + void addDWBAIntensity(const OutputData<double > &data_to_add) + { m_dwba_intensity += data_to_add; } //! clone DWBA simulation virtual DWBASimulation *clone() const; @@ -52,7 +56,8 @@ class DWBASimulation : public ISimulation // --------------------------------- typedef OutputDataIterator<double, OutputData<double> > iterator; - typedef OutputDataIterator<const double, const OutputData<double> > const_iterator; + typedef OutputDataIterator<const double, const OutputData<double> > + const_iterator; //! return a read/write iterator that points to the first element iterator begin(); @@ -76,12 +81,4 @@ class DWBASimulation : public ISimulation Simulation *mp_simulation; }; -inline const OutputData<double> &DWBASimulation::getDWBAIntensity() const { - return m_dwba_intensity; -} - -inline void DWBASimulation::addDWBAIntensity(const OutputData<double> &data_to_add) { - m_dwba_intensity += data_to_add; -} - #endif /* DWBASIMULATION_H_ */ diff --git a/Core/Algorithms/src/DWBASimulation.cpp b/Core/Algorithms/src/DWBASimulation.cpp index 4c86fb6208d..7a189340c4a 100644 --- a/Core/Algorithms/src/DWBASimulation.cpp +++ b/Core/Algorithms/src/DWBASimulation.cpp @@ -7,7 +7,7 @@ //! //! @homepage http://apps.jcns.fz-juelich.de/BornAgain //! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 213 +//! @copyright Forschungszentrum Jülich GmbH 2013 //! @authors Scientific Computing Group at MLZ Garching //! @authors C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke // @@ -15,17 +15,6 @@ #include "DWBASimulation.h" -DWBASimulation::DWBASimulation() -: m_alpha_i() -, m_thread_info() -, mp_simulation() -{ -} - -DWBASimulation::~DWBASimulation() -{ - delete mp_simulation; -} void DWBASimulation::init(const Simulation& simulation) { @@ -36,7 +25,7 @@ void DWBASimulation::init(const Simulation& simulation) m_dwba_intensity.clear(); Detector detector = simulation.getInstrument().getDetector(); size_t detector_dimension = detector.getDimension(); - for (size_t dim=; dim<detector_dimension; ++dim) { + for (size_t dim=0; dim<detector_dimension; ++dim) { m_dwba_intensity.addAxis(detector.getAxis(dim)); } if (simulation.getOutputData()->getMask()) { @@ -65,11 +54,12 @@ DWBASimulation::iterator DWBASimulation::begin() { if (m_thread_info.n_threads<2) { m_thread_info.n_threads = 1; - m_thread_info.i_thread = ; + m_thread_info.i_thread = 0; } iterator result(m_dwba_intensity.begin()); if (m_thread_info.n_threads>1) { - MaskIndexModulus thread_mask(m_thread_info.n_threads, m_thread_info.i_thread); + MaskIndexModulus thread_mask( + m_thread_info.n_threads, m_thread_info.i_thread); result.addMask(thread_mask); } return result; @@ -81,7 +71,7 @@ DWBASimulation::const_iterator DWBASimulation::begin() const size_t i_thread = m_thread_info.i_thread; if (m_thread_info.n_threads<2) { n_threads = 1; - i_thread = ; + i_thread = 0; } const_iterator result(m_dwba_intensity.begin()); if (n_threads>1) { diff --git a/Core/FormFactors/inc/FormFactorBox.h b/Core/FormFactors/inc/FormFactorBox.h index 33d0f9079ac..29f20522e3d 100644 --- a/Core/FormFactors/inc/FormFactorBox.h +++ b/Core/FormFactors/inc/FormFactorBox.h @@ -24,11 +24,15 @@ class FormFactorBox : public IFormFactorBorn { public: - FormFactorBox( double radius, double width, double height); + FormFactorBox( double radius, double width, double height) + : m_radius(radius), m_width(width), m_height(height) {} + ~FormFactorBox() {} - virtual FormFactorBox *clone() const; - virtual int getNumberOfStochasticParameters() const { return 2; } + FormFactorBox *clone() const + { return new FormFactorBox(m_radius, m_width, m_height ); } + + int getNumberOfStochasticParameters() const { return 2; } //! return radius of Box double getRadius() const { return m_radius; } @@ -36,16 +40,14 @@ class FormFactorBox : public IFormFactorBorn //! return width of Box double getwidth() const { return m_width; } - virtual complex_t evaluate_for_q(const cvector_t &q) const; + complex_t evaluate_for_q(const cvector_t &q) const; - virtual double getVolume() const { - return 4.0*m_height*m_radius*m_width; - } + double getVolume() const { return 4*m_height*m_radius*m_width; } - virtual double getHeight() const { return m_height; } + double getHeight() const { return m_height; } protected: - virtual void init_parameters(); + void init_parameters(); private: double m_radius; diff --git a/Core/FormFactors/inc/FormFactorFullSphere.h b/Core/FormFactors/inc/FormFactorFullSphere.h index 1acd80cf3e5..053ca2894a5 100644 --- a/Core/FormFactors/inc/FormFactorFullSphere.h +++ b/Core/FormFactors/inc/FormFactorFullSphere.h @@ -19,7 +19,7 @@ #include "IFormFactorBorn.h" #include "IStochasticParameter.h" -//! ? +//! Formfactor of a sphere. class FormFactorFullSphere : public IFormFactorBorn { @@ -39,7 +39,6 @@ class FormFactorFullSphere : public IFormFactorBorn virtual complex_t evaluate_for_q(const cvector_t &q) const; protected: - //! initialize pool parameters, i.e. register some of class members for later access via parameter pool virtual void init_parameters(); private: diff --git a/Core/FormFactors/inc/FormFactorPrism3.h b/Core/FormFactors/inc/FormFactorPrism3.h index cf347f91cf0..09b18dfbcb0 100644 --- a/Core/FormFactors/inc/FormFactorPrism3.h +++ b/Core/FormFactors/inc/FormFactorPrism3.h @@ -19,7 +19,7 @@ #include "IFormFactorBorn.h" #include "IStochasticParameter.h" -//! Form factor of a ?? +//! Formfactor of a prism based on a regular triangle. class FormFactorPrism3 : public IFormFactorBorn { diff --git a/Core/FormFactors/inc/FormFactorPrism6.h b/Core/FormFactors/inc/FormFactorPrism6.h index 875bac1b379..a20809632ba 100644 --- a/Core/FormFactors/inc/FormFactorPrism6.h +++ b/Core/FormFactors/inc/FormFactorPrism6.h @@ -17,7 +17,7 @@ #define FORMFACTORPRISM6_H #include "IFormFactorBorn.h" -//! Form factor of a ?? +//! Formfactor of a prism based on a regular hexagonal. class FormFactorPrism6 : public IFormFactorBorn { diff --git a/Core/FormFactors/inc/FormFactorSphere.h b/Core/FormFactors/inc/FormFactorSphere.h index 963c2b72faa..49a596be5d7 100644 --- a/Core/FormFactors/inc/FormFactorSphere.h +++ b/Core/FormFactors/inc/FormFactorSphere.h @@ -20,16 +20,17 @@ #include "IStochasticParameter.h" #include "MemberComplexFunctionIntegrator.h" -//! Form factor of a sphere. +//! Form factor of a sphere cut at given height. class FormFactorSphere : public IFormFactorBorn { public: FormFactorSphere(double radius, double height); - double SphereIntegral(double Z, void* params) const; - ~FormFactorSphere(); - virtual FormFactorSphere *clone() const; + ~FormFactorSphere() { delete m_integrator; } + + virtual FormFactorSphere *clone() const + { return new FormFactorSphere(m_radius, m_height); } virtual int getNumberOfStochasticParameters() const { return 2; } diff --git a/Core/FormFactors/src/FormFactorBox.cpp b/Core/FormFactors/src/FormFactorBox.cpp index 831cfe80225..59ff4afff6a 100644 --- a/Core/FormFactors/src/FormFactorBox.cpp +++ b/Core/FormFactors/src/FormFactorBox.cpp @@ -16,28 +16,16 @@ #include "FormFactorBox.h" #include "MathFunctions.h" -FormFactorBox::FormFactorBox(double radius, double width, double height) -:m_radius(radius) -,m_width(width) -,m_height(height) -{ -} - -FormFactorBox* FormFactorBox::clone() const -{ - return new FormFactorBox(m_radius, m_width, m_height ); -} - complex_t FormFactorBox::evaluate_for_q(const cvector_t& q) const { - complex_t qxR = q.x()*m_radius; - complex_t qyW = q.y()*m_width; - complex_t qzHdiv2 = q.z()*m_height/2.0; + complex_t qxR = m_radius*q.x(); + complex_t qyW = m_width*q.y(); + complex_t qzHdiv2 = m_height/2*q.z(); - complex_t phase_factor = std::exp(complex_t(0.0, 1.0)*qzHdiv2); - return getVolume() *phase_factor* - MathFunctions::Sinc(qxR)* - MathFunctions::Sinc(qyW)* + return getVolume() * + std::exp(complex_t(0.,1.)*qzHdiv2) * + MathFunctions::Sinc(qxR) * + MathFunctions::Sinc(qyW) * MathFunctions::Sinc(qzHdiv2); } diff --git a/Core/FormFactors/src/FormFactorSphere.cpp b/Core/FormFactors/src/FormFactorSphere.cpp index efbd35024b0..b99ecd9f03e 100644 --- a/Core/FormFactors/src/FormFactorSphere.cpp +++ b/Core/FormFactors/src/FormFactorSphere.cpp @@ -35,11 +35,6 @@ FormFactorSphere::FormFactorSphere(double radius, double height) new MemberComplexFunctionIntegrator<FormFactorSphere>(p_mf, this); } -FormFactorSphere::~FormFactorSphere() -{ - delete m_integrator; -} - void FormFactorSphere::init_parameters() { getParameterPool()->clear(); @@ -47,12 +42,7 @@ void FormFactorSphere::init_parameters() getParameterPool()->registerParameter("height", &m_height); } -FormFactorSphere* FormFactorSphere::clone() const -{ - return new FormFactorSphere(m_radius, m_height); -} - -//! Integrand for complex form factor. +//! Integrand for complex formfactor. complex_t FormFactorSphere::Integrand(double Z, void* params) const { @@ -63,6 +53,8 @@ complex_t FormFactorSphere::Integrand(double Z, void* params) const std::exp(complex_t(0.0, 1.0)*m_q.z()*Z); } +//! Complex formfactor. + complex_t FormFactorSphere::evaluate_for_q(const cvector_t &q) const { m_q = q; -- GitLab