diff --git a/Core/Algorithms/inc/DWBADiffuseReflection.h b/Core/Algorithms/inc/DWBADiffuseReflection.h index c17e1c8f84a2d4c535f30de914c3cf3e32a2f536..37a8df1632f06f8eb6e33db29ac2aa2a6546dffe 100644 --- a/Core/Algorithms/inc/DWBADiffuseReflection.h +++ b/Core/Algorithms/inc/DWBADiffuseReflection.h @@ -28,7 +28,8 @@ class DWBADiffuseReflection : public ISimulation public: DWBADiffuseReflection(); - void execute(const MultiLayer &sample, const kvector_t &ki, const kvector_t &kf); + void execute(const MultiLayer &sample, + const kvector_t &ki, const kvector_t &kf); void setSample(const MultiLayer &sample) {m_sample = &sample; } @@ -37,6 +38,7 @@ class DWBADiffuseReflection : public ISimulation double getDiffuseCrosscorr() const { return m_diffuse_crosscorr; } void setKvectors(const kvector_t &ki, const kvector_t &kf); + private: void diffuse_autocorr(); diff --git a/Core/Algorithms/inc/DWBASimulation.h b/Core/Algorithms/inc/DWBASimulation.h index 7d4c8d5fba40c14b6a1983f12cd09126f0cdbef5..e3d04f808b423a96b112904522cda8bb62dece24 100644 --- a/Core/Algorithms/inc/DWBASimulation.h +++ b/Core/Algorithms/inc/DWBASimulation.h @@ -22,30 +22,28 @@ #include "ThreadInfo.h" #include "Types.h" -//! Calculates scattering cross sections in DWBA +//! Base class for different simulations, using DWBA. class DWBASimulation : public ISimulation { public: - DWBASimulation() - : m_alpha_i(0), m_thread_info(), mp_simulation(0) {} + 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); + virtual void init(const Simulation& simulation); //! Set thread information for masking - virtual void setThreadInfo(const ThreadInfo &thread_info) { - m_thread_info = thread_info; - } + virtual void setThreadInfo(const ThreadInfo& thread_info) + { m_thread_info = thread_info; } //! 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 @@ -69,7 +67,7 @@ class DWBASimulation : public ISimulation const iterator end() { return m_dwba_intensity.end(); } //! return a read-only iterator that points to the one past last element - const const_iterator end() const { return m_dwba_intensity.end(); } + const const_iterator end() const { return m_dwba_intensity.end(); } protected: OutputData<double> m_dwba_intensity; diff --git a/Core/Algorithms/inc/DiffuseDWBASimulation.h b/Core/Algorithms/inc/DiffuseDWBASimulation.h index 38a79e6ec5664c4bcd686aaa73d4d1ff6515ba76..e6da8b69fd24ec6d6c70c2c0c56f0e5040d7ad27 100644 --- a/Core/Algorithms/inc/DiffuseDWBASimulation.h +++ b/Core/Algorithms/inc/DiffuseDWBASimulation.h @@ -23,14 +23,15 @@ class DiffuseDWBASimulation: public LayerDWBASimulation { public: DiffuseDWBASimulation() - : m_refractive_index(1.0, 0.0), m_surface_density(1.0) {} + : m_refractive_index(1., 0.), m_surface_density(1.) {} virtual ~DiffuseDWBASimulation() {} virtual void run(); size_t getSize() const { return m_np_infos.size(); } void addParticleInfo(DiffuseParticleInfo *p_info); void setRefractiveIndex(complex_t n) { m_refractive_index = n; } - void setSurfaceDensity(double surface_density) { m_surface_density = surface_density; } + void setSurfaceDensity(double surface_density) + { m_surface_density = surface_density; } void rescaleAbundances(double factor); protected: @@ -39,14 +40,15 @@ class DiffuseDWBASimulation: public LayerDWBASimulation SafePointerVector<DiffuseParticleInfo> m_np_infos; struct DiffuseFormFactorTerm { DiffuseFormFactorTerm() - : m_form_factors(), m_probabilities(), m_factor(0.0) {} + : m_form_factors(), m_probabilities(), m_factor(0.) {} ~DiffuseFormFactorTerm(); - std::vector<IFormFactor *> m_form_factors; + std::vector<IFormFactor*> m_form_factors; std::vector<double> m_probabilities; double m_factor; }; - void initDiffuseFormFactorTerms(std::vector<DiffuseFormFactorTerm *>& terms, - size_t nbr_heights, size_t samples_per_particle); + void initDiffuseFormFactorTerms( + std::vector<DiffuseFormFactorTerm *>& terms, + size_t nbr_heights, size_t samples_per_particle); }; #endif /* DIFFUSEDWBASIMULATION_H_ */ diff --git a/Core/Algorithms/inc/ISimulation.h b/Core/Algorithms/inc/ISimulation.h index ace40605c185b66a21974a7dd4504d78b586a68c..2c98f75c9a448a105015b1688c7d08fd099a00d1 100644 --- a/Core/Algorithms/inc/ISimulation.h +++ b/Core/Algorithms/inc/ISimulation.h @@ -3,7 +3,7 @@ // BornAgain: simulate and fit scattering at grazing incidence // //! @file Algorithms/inc/ISimulation.h -//! @brief Defines class ISimulation. +//! @brief Defines interface class ISimulation. //! //! @homepage http://apps.jcns.fz-juelich.de/BornAgain //! @license GNU General Public License v3 or higher (see COPYING) @@ -18,12 +18,18 @@ #include "ICloneable.h" +//! Interface class, encapsulating different simulations. + class ISimulation : public ICloneable { public: - virtual ~ISimulation() { } - ISimulation *clone() const { throw NotImplementedException("ISimulation::clone() -> Error: not implemented exception."); } - virtual void run() { } + virtual ~ISimulation() {} + ISimulation *clone() const + { + throw NotImplementedException("ISimulation::clone() -> " + "Error: not implemented exception."); + } + virtual void run() {} }; #endif // ISIMULATION_H diff --git a/Core/Algorithms/inc/LayerDWBASimulation.h b/Core/Algorithms/inc/LayerDWBASimulation.h index ef6b03073e61c5941162de1b4d18da701ccfe58d..a322279568aa42c788f09cf1315fd9d0c7abaab3 100644 --- a/Core/Algorithms/inc/LayerDWBASimulation.h +++ b/Core/Algorithms/inc/LayerDWBASimulation.h @@ -19,7 +19,7 @@ #include "DWBASimulation.h" #include "IDoubleToComplexFunction.h" -//! ? +//! Base class for LayerDecoratorDWBASimulation, DiffuseDWBASimulation. class LayerDWBASimulation : public DWBASimulation { @@ -27,14 +27,22 @@ class LayerDWBASimulation : public DWBASimulation LayerDWBASimulation(); virtual ~LayerDWBASimulation(); - LayerDWBASimulation *clone() const { throw NotImplementedException("ISimulation::clone() -> Error: not implemented exception."); } + LayerDWBASimulation *clone() const + { + throw NotImplementedException( + "ISimulation::clone() -> Error: not implemented exception."); + } void setKzFunction(const IDoubleToComplexMap &kz_function); - void setReflectionTransmissionFunction(const IDoubleToPairOfComplexMap &rt_map); - void setKzAndRTFunctions(const IDoubleToComplexMap &kz_function, const IDoubleToPairOfComplexMap &rt_map); + void setReflectionTransmissionFunction( + const IDoubleToPairOfComplexMap &rt_map); + void setKzAndRTFunctions(const IDoubleToComplexMap &kz_function, + const IDoubleToPairOfComplexMap &rt_map); protected: - Bin1DCVector getKfBin(double wavelength, const Bin1D &alpha_bin, const Bin1D &phi_bin) const; + Bin1DCVector getKfBin(double wavelength, + const Bin1D &alpha_bin, + const Bin1D &phi_bin) const; IDoubleToComplexMap *mp_kz_function; IDoubleToPairOfComplexMap *mp_RT_function; }; diff --git a/Core/Algorithms/inc/MultiLayerDWBASimulation.h b/Core/Algorithms/inc/MultiLayerDWBASimulation.h index 4c43ec74c1c42c0d495f7f34a193e08d88a697e1..6d11a3ca948c9eb3bc6e5a4a23dfc3051c214fd3 100644 --- a/Core/Algorithms/inc/MultiLayerDWBASimulation.h +++ b/Core/Algorithms/inc/MultiLayerDWBASimulation.h @@ -32,7 +32,11 @@ class MultiLayerDWBASimulation : public DWBASimulation MultiLayerDWBASimulation(const MultiLayer *p_multi_layer); virtual ~MultiLayerDWBASimulation(); - MultiLayerDWBASimulation *clone() const { throw NotImplementedException("MultiLayerDWBASimulation::clone() -> Error: not implemented"); } + MultiLayerDWBASimulation *clone() const + { + throw NotImplementedException( + "MultiLayerDWBASimulation::clone() -> Error: not implemented"); + } virtual void init(const Simulation &simulation); @@ -40,6 +44,7 @@ class MultiLayerDWBASimulation : public DWBASimulation virtual void setThreadInfo(const ThreadInfo &thread_info); virtual void run(); + protected: std::set<double> getAlphaList() const; std::map<size_t, LayerDWBASimulation*> m_layer_dwba_simulation_map; diff --git a/Core/Algorithms/inc/MultiLayerRoughnessDWBASimulation.h b/Core/Algorithms/inc/MultiLayerRoughnessDWBASimulation.h index cc7f812ed2b787e12b045b791a293aa4525c034d..99dfd9fe5c826709b76314cd0c49a14c279f8827 100644 --- a/Core/Algorithms/inc/MultiLayerRoughnessDWBASimulation.h +++ b/Core/Algorithms/inc/MultiLayerRoughnessDWBASimulation.h @@ -30,19 +30,28 @@ class MultiLayerRoughnessDWBASimulation : public DWBASimulation MultiLayerRoughnessDWBASimulation(const MultiLayer *p_multi_layer); virtual ~MultiLayerRoughnessDWBASimulation(); - MultiLayerRoughnessDWBASimulation *clone() const { throw NotImplementedException("MultiLayerRoughnessDWBASimulation::clone() -> Error: not implemented."); } + MultiLayerRoughnessDWBASimulation *clone() const + { + throw NotImplementedException( + "MultiLayerRoughnessDWBASimulation::clone() -> " + "Error: not implemented."); + } virtual void run(); // set T and R functions for given layer - void setReflectionTransmissionFunction(size_t i_layer, const IDoubleToPairOfComplexMap &RT_function); + void setReflectionTransmissionFunction( + size_t i_layer, const IDoubleToPairOfComplexMap &RT_function); // evaluate - virtual double evaluate(const cvector_t &k_i, const cvector_t &k_f, double alpha_i, double alpha_f); + virtual double evaluate(const cvector_t &k_i, const cvector_t &k_f, + double alpha_i, double alpha_f); protected: complex_t get_refractive_term(size_t ilayer) const; - complex_t get_sum4terms(size_t ilayer, const cvector_t &k_i, const cvector_t &k_f, double alpha_i, double alpha_f); + complex_t get_sum4terms(size_t ilayer, + const cvector_t &k_i, const cvector_t &k_f, + double alpha_i, double alpha_f); std::vector<IDoubleToPairOfComplexMap *> mp_RT_function; MultiLayer *mp_multi_layer; diff --git a/Core/Algorithms/inc/OpticalFresnel.h b/Core/Algorithms/inc/OpticalFresnel.h index 89b9ee06cae6304bdb1b426e119947b0d7398f19..1bd49f71053af7c111e32032367ebf8fc059bb6f 100644 --- a/Core/Algorithms/inc/OpticalFresnel.h +++ b/Core/Algorithms/inc/OpticalFresnel.h @@ -26,7 +26,7 @@ class OpticalFresnel : public ISimulation { public: - OpticalFresnel(); + OpticalFresnel() : m_use_roughness(false) {} //! reflection/transmission Fresnel coefficients class FresnelCoeff { diff --git a/Core/Algorithms/src/DWBASimulation.cpp b/Core/Algorithms/src/DWBASimulation.cpp index 7a189340c4ad7435d54be45d8841500ae0ba968f..043f8eadb7d61e254820ca0f78b3dd38eedc535c 100644 --- a/Core/Algorithms/src/DWBASimulation.cpp +++ b/Core/Algorithms/src/DWBASimulation.cpp @@ -45,7 +45,8 @@ DWBASimulation *DWBASimulation::clone() const p_result->m_ki = m_ki; p_result->m_alpha_i = m_alpha_i; p_result->m_thread_info = m_thread_info; - if (mp_simulation) p_result->mp_simulation = mp_simulation->clone(); + if (mp_simulation) + p_result->mp_simulation = mp_simulation->clone(); return p_result; } diff --git a/Core/Algorithms/src/DiffuseDWBASimulation.cpp b/Core/Algorithms/src/DiffuseDWBASimulation.cpp index e0cdfd7b68925296007f267df31e6fb0d98007f1..806fabe168cbedf80587c6752fec849995f6e266 100644 --- a/Core/Algorithms/src/DiffuseDWBASimulation.cpp +++ b/Core/Algorithms/src/DiffuseDWBASimulation.cpp @@ -16,6 +16,8 @@ #include "DiffuseDWBASimulation.h" #include "FormFactorDWBAConstZ.h" +// Run a simulation. + void DiffuseDWBASimulation::run() { std::vector<DiffuseFormFactorTerm*> diffuse_terms; @@ -40,11 +42,11 @@ void DiffuseDWBASimulation::run() } Bin1DCVector k_f_bin = getKfBin(getWaveLength(), alpha_bin, phi_bin); - double total_intensity = 0.0; + double total_intensity = 0; for (size_t i=0; i<diffuse_terms.size(); ++i) { DiffuseFormFactorTerm *p_diffuse_term = diffuse_terms[i]; - complex_t amplitude(0.0, 0.0); - double intensity = 0.0; + complex_t amplitude(0., 0.); + double intensity = 0; for (size_t j=0; j<p_diffuse_term->m_form_factors.size(); ++j) { complex_t amp = p_diffuse_term->m_form_factors[j]->evaluate( @@ -60,7 +62,8 @@ void DiffuseDWBASimulation::run() ++it_intensity; } - for (size_t i=0; i<diffuse_terms.size(); ++i) delete diffuse_terms[i]; + for (size_t i=0; i<diffuse_terms.size(); ++i) + delete diffuse_terms[i]; } void DiffuseDWBASimulation::addParticleInfo(DiffuseParticleInfo *p_info) @@ -70,18 +73,17 @@ void DiffuseDWBASimulation::addParticleInfo(DiffuseParticleInfo *p_info) void DiffuseDWBASimulation::rescaleAbundances(double factor) { - size_t number_of_nps = m_np_infos.size(); - for (size_t np_index=0; np_index<number_of_nps; ++np_index) { + for (size_t np_index=0; np_index<m_np_infos.size(); ++np_index) { m_np_infos[np_index]->scaleAbundance(factor); } } void DiffuseDWBASimulation::initDiffuseFormFactorTerms( - std::vector<DiffuseFormFactorTerm*>& terms, size_t nbr_heights, + std::vector<DiffuseFormFactorTerm*>& terms, + size_t nbr_heights, size_t samples_per_particle) { - size_t number_of_nps = m_np_infos.size(); - for (size_t i=0; i<number_of_nps; ++i) { + for (size_t i=0; i<m_np_infos.size(); ++i) { DiffuseParticleInfo *p_diff_info = m_np_infos[i]; Particle *p_particle = p_diff_info->getParticle()->clone(); double total_particle_density = p_diff_info->getNumberPerMeso(); @@ -94,11 +96,13 @@ void DiffuseDWBASimulation::initDiffuseFormFactorTerms( (double)j*p_diff_info->getHeightRange()/(nbr_heights-1.0); std::vector<IFormFactor*> form_factors; p_diff_info->getParticle()->getSimpleFormFactor()->createDistributedFormFactors( - form_factors, p_diffuse_term->m_probabilities, samples_per_particle); + form_factors, p_diffuse_term->m_probabilities, + samples_per_particle); for (size_t ff_index=0; ff_index<form_factors.size(); ++ff_index) { p_particle->setSimpleFormFactor(form_factors[ff_index]); IFormFactor *ff_particle = p_particle->createFormFactor(); - FormFactorDWBAConstZ *p_dwba_z = new FormFactorDWBAConstZ(ff_particle, depth); + FormFactorDWBAConstZ *p_dwba_z = + new FormFactorDWBAConstZ(ff_particle, depth); p_dwba_z->setReflectionTransmissionFunction(*mp_RT_function); p_diffuse_term->m_form_factors.push_back(p_dwba_z); diff --git a/Core/Algorithms/src/OpticalFresnel.cpp b/Core/Algorithms/src/OpticalFresnel.cpp index be612b42084ac6e33fe7581968d04f22c6357f27..802d0b6fb0cfa8f61f0dc95b9a11521cf63cdf3a 100644 --- a/Core/Algorithms/src/OpticalFresnel.cpp +++ b/Core/Algorithms/src/OpticalFresnel.cpp @@ -18,10 +18,6 @@ #include "OpticalFresnel.h" #include "Numeric.h" -OpticalFresnel::OpticalFresnel() : m_use_roughness(false) -{ -} - void OpticalFresnel::execute(const MultiLayer &sample, const kvector_t &kvec, MultiLayerCoeff_t &coeff) { coeff.clear(); @@ -104,8 +100,11 @@ void OpticalFresnel::calculateFresnelCoefficientsWithRoughness(const MultiLayer coeff[i].r = (coeff[i].kz - coeff[i + 1].kz) / (coeff[i].kz + coeff[i + 1].kz); } else { - coeff[i].r = std::sinh(picoeff * sigma * (coeff[i].kz - coeff[i + 1].kz)) - / std::sinh(picoeff * sigma * (coeff[i].kz + coeff[i + 1].kz)); + coeff[i].r = + std::sinh(picoeff * sigma * + (coeff[i].kz - coeff[i + 1].kz)) / + std::sinh(picoeff * sigma * + (coeff[i].kz + coeff[i + 1].kz)); } diff --git a/Core/Samples/inc/DiffuseParticleInfo.h b/Core/Samples/inc/DiffuseParticleInfo.h index 75caff4280f83b9bdf493a53adb2741cc5b250b5..9d95e236a746a4fd10553c251a880ebcc1ccbcf3 100644 --- a/Core/Samples/inc/DiffuseParticleInfo.h +++ b/Core/Samples/inc/DiffuseParticleInfo.h @@ -31,7 +31,7 @@ class DiffuseParticleInfo: public ParticleInfo //! scale abundance void scaleAbundance(double factor) { m_abundance *= factor; } - //! scale abundance + //! scale number of particles per containing mesocrystal void scaleNumberPerMeso(double factor) { m_number_per_meso *= factor; } //! set number of particles per containing mesocrystal diff --git a/Core/Samples/inc/ParticleInfo.h b/Core/Samples/inc/ParticleInfo.h index f9d0aedd3026d8a5e3b591b15602fe9666a9f98d..38c40c071e79f1e848c9444cbe523af8619cac22 100644 --- a/Core/Samples/inc/ParticleInfo.h +++ b/Core/Samples/inc/ParticleInfo.h @@ -20,7 +20,7 @@ #include "Particle.h" #include "Transform3D.h" -//! Holds additional information about particle (used in ParticleDecoration) +//! Holds additional information about particle (used in ParticleDecoration). class ParticleInfo : public ICompositeSample { @@ -48,7 +48,7 @@ class ParticleInfo : public ICompositeSample } //! Return depth. - double getDepth() const { return m_depth;} + double getDepth() const { return m_depth; } //! Set depth. void setDepth(double depth) { m_depth = depth; } @@ -60,7 +60,6 @@ class ParticleInfo : public ICompositeSample void setAbundance(double abundance) { m_abundance = abundance; } protected: - //! register some class members for later access via parameter pool virtual void init_parameters(); Particle *mp_particle; diff --git a/pub/core/Doxyfile b/pub/core/Doxyfile index fda5fa709f0a48917a1ea961909059c174c663f6..b28d87ef069c1ad16c1c5f372a5b1fb5a1d6e5cc 100644 --- a/pub/core/Doxyfile +++ b/pub/core/Doxyfile @@ -113,7 +113,7 @@ ALWAYS_DETAILED_SEC = NO # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. -INLINE_INHERITED_MEMB = NO +INLINE_INHERITED_MEMB = YES # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set @@ -1649,7 +1649,7 @@ CLASS_GRAPH = YES # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. -COLLABORATION_GRAPH = NO +COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies @@ -1696,7 +1696,7 @@ INCLUDED_BY_GRAPH = YES # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. -CALL_GRAPH = YES # TEMPORARY +CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function @@ -1704,7 +1704,7 @@ CALL_GRAPH = YES # TEMPORARY # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. -CALLER_GRAPH = YES # TEMPORARY +CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will generate a graphical hierarchy of all classes instead of a textual one.