diff --git a/App/inc/TestFresnelCoeff.h b/App/inc/TestFresnelCoeff.h index f3f2d753a23b1248f92fc39848584b8e50bcaba9..0d279c2370a438a31c41f00cf5165b77df52f84b 100644 --- a/App/inc/TestFresnelCoeff.h +++ b/App/inc/TestFresnelCoeff.h @@ -31,12 +31,12 @@ public: void execute(); private: - //! calculate fresnel coefficients .vs. alpha_i for several standard samples + //! calculate Fresnel coefficients .vs. alpha_i for several standard samples void test_standard_samples(); //! draw results of the test void draw_standard_samples(); - //! calculate fresnel coefficients .vs. alpha_i for set of roughnesses + //! calculate Fresnel coefficients .vs. alpha_i for set of roughnesses void test_roughness_set(); //! draw result of the test void draw_roughness_set(); diff --git a/App/inc/TestPerformance.h b/App/inc/TestPerformance.h index 81a4db6b3a123364686ef47b14061dc3ee688d6f..13a287571db8176fefdcefb7fb8fa71747f316cf 100644 --- a/App/inc/TestPerformance.h +++ b/App/inc/TestPerformance.h @@ -64,7 +64,7 @@ private: //! @class PerfTest_FresnelCoeff -//! measurement of the performance in fresnel coefficients calculation +//! measurement of the performance in Fresnel coefficients calculation class PerfTest_FresnelCoeff : public IFunctionalTest { public: diff --git a/App/inc/TestRoughness.h b/App/inc/TestRoughness.h index a3e852c8a0783f28d7cf3f761f312b7d644d1511..ecc43d3469b20a621502aa02bfbee9ebc7114a14 100644 --- a/App/inc/TestRoughness.h +++ b/App/inc/TestRoughness.h @@ -23,7 +23,7 @@ //! Draw profile of rough surface for different sets of roughness parameters. //! Two models are used for profile calculation: -//! 1) matrix method 2) fast fourier transform using moving average +//! 1) matrix method 2) fast Fourier transform using moving average //! class TestRoughness : public IFunctionalTest { @@ -39,7 +39,7 @@ class TestRoughness : public IFunctionalTest //! Calculate correlated z-coordinates of surface using matrix method. void GetProfileXZ_MatrixMethod(); - //! Calculate correlated z-coordinates of surface using fast fourier transform method. + //! Calculate correlated z-coordinates of surface using fast Fourier transform method. void GetProfileXZ_FFTMethod(); //! Some tests of FFT. diff --git a/App/src/FunctionalTestFactory.cpp b/App/src/FunctionalTestFactory.cpp index c8f6c9b6a6969c4682c0673b40f2f6139bfc1da6..9a8de636920b52e41026a5bcb017412368d4678d 100644 --- a/App/src/FunctionalTestFactory.cpp +++ b/App/src/FunctionalTestFactory.cpp @@ -62,9 +62,9 @@ FunctionalTestFactory::FunctionalTestFactory() : m_benchmark(0) IFactoryCreateFunction<TestRoughness, IFunctionalTest>, "functional test: roughness parameters"); registerItem( - "fresnel", + "Fresnel", IFactoryCreateFunction<TestFresnelCoeff, IFunctionalTest>, - "functional test: fresnel coefficients calculations"); + "functional test: Fresnel coefficients calculations"); registerItem( "formfactor", IFactoryCreateFunction<TestFormFactor, IFunctionalTest>, @@ -182,7 +182,7 @@ FunctionalTestFactory::FunctionalTestFactory() : m_benchmark(0) IFactoryCreateFunction<TestFittingBenchmark, IFunctionalTest>, "functional test: test of minimizers with hard-to-minimize test functions"); registerItem( - "fourier", + "Fourier", IFactoryCreateFunction<TestFourier, IFunctionalTest>, "functional test: test of Fourier transformation of OutputData maps"); registerItem( diff --git a/App/src/SampleFactory.cpp b/App/src/SampleFactory.cpp index 290ff672f58d158e21598ab788079be149b17c10..599898a4e4d55f222409736dfb047bfc11030417 100644 --- a/App/src/SampleFactory.cpp +++ b/App/src/SampleFactory.cpp @@ -25,7 +25,7 @@ SampleFactory::SampleFactory() { setOwnObjects(true); //factory will take care about samples - // samples used for fresnel coefficients validation + // samples used for Fresnel coefficients validation registerItem("AirOnSubstrate", StandardSamples::AirOnSubstrate); registerItem("SubstrateOnSubstrate", StandardSamples::SubstrateOnSubstrate); registerItem("SimpleMultilayer", StandardSamples::SimpleMultilayer); diff --git a/App/src/TestFourier.cpp b/App/src/TestFourier.cpp index f6f288f28a85f26a2472a297b07a811f65431372..f67580caae79cb0ad20913fb2bbeb9e5739a0749 100644 --- a/App/src/TestFourier.cpp +++ b/App/src/TestFourier.cpp @@ -52,12 +52,12 @@ void TestFourier::execute() mp_intensity_output = simulation.getOutputDataClone(); OutputData<complex_t> fft_map; - OutputDataFunctions::fourierTransform(*mp_intensity_output, &fft_map); + OutputDataFunctions::FourierTransform(*mp_intensity_output, &fft_map); OutputData<double> *p_real_fft_map = OutputDataFunctions::getModulusPart(fft_map); - OutputDataFunctions::fourierTransformR(fft_map, mp_intensity_output); + OutputDataFunctions::FourierTransformR(fft_map, mp_intensity_output); IsGISAXSTools::drawOutputData(*p_real_fft_map, "c1_four", "Fourier transform", "CONT4 Z", "Fourier transform"); - OutputDataIOFactory::writeOutputData(*p_real_fft_map, Utils::FileSystem::GetHomePath()+"./Examples/MesoCrystals/fourier.ima"); + OutputDataIOFactory::writeOutputData(*p_real_fft_map, Utils::FileSystem::GetHomePath()+"./Examples/MesoCrystals/Fourier.ima"); } diff --git a/App/src/TestFresnelCoeff.cpp b/App/src/TestFresnelCoeff.cpp index 8a97f498cdf076d3c03bc1e9af68cb357653bbe0..fc5858dcbf91bdee2e728611e9293a45ac509fed 100644 --- a/App/src/TestFresnelCoeff.cpp +++ b/App/src/TestFresnelCoeff.cpp @@ -48,21 +48,21 @@ TestFresnelCoeff::TestFresnelCoeff() } /* ************************************************************************* */ -//! test fresnel coefficients +//! test Fresnel coefficients /* ************************************************************************* */ void TestFresnelCoeff::execute() { std::cout << "TestFresnelCoeff::execute() -> Info." << std::endl; - // calculate fresnel coefficients for several standard multi-layer samples + // calculate Fresnel coefficients for several standard multi-layer samples test_standard_samples(); - // calculate fresnel coefficients for multi-layer with different roughnesses + // calculate Fresnel coefficients for multi-layer with different roughnesses test_roughness_set(); } /* ************************************************************************* */ -//! calculate fresnel coefficients .vs. alpha_i for several standard samples +//! calculate Fresnel coefficients .vs. alpha_i for several standard samples /* ************************************************************************* */ void TestFresnelCoeff::test_standard_samples() { @@ -87,8 +87,8 @@ void TestFresnelCoeff::test_standard_samples() kvec.setLambdaAlphaPhi(1.54*Units::angstrom, -alpha_i, 0.0); OpticalFresnel::MultiLayerCoeff_t coeffs; - OpticalFresnel fresnelCalculator; - fresnelCalculator.execute(*mp_sample, kvec, coeffs); + OpticalFresnel FresnelCalculator; + FresnelCalculator.execute(*mp_sample, kvec, coeffs); *it = coeffs; ++it; @@ -155,7 +155,7 @@ void TestFresnelCoeff::draw_standard_samples() // create name of canvas different for each new call of this method std::ostringstream os; os << (ncall++) << std::endl; - std::string cname = std::string("c1_test_fresnel_sample")+os.str(); + std::string cname = std::string("c1_test_Fresnel_sample")+os.str(); TCanvas *c1 = new TCanvas(cname.c_str(),"Fresnel Coefficients in Multilayer",1024,768); DrawHelper::SetMagnifier(c1); @@ -225,7 +225,7 @@ void TestFresnelCoeff::draw_standard_samples() } /* ************************************************************************* */ -//! calculate fresnel coefficients .vs. alpha_i for set of roughnesses +//! calculate Fresnel coefficients .vs. alpha_i for set of roughnesses /* ************************************************************************* */ void TestFresnelCoeff::test_roughness_set() { @@ -255,8 +255,8 @@ void TestFresnelCoeff::test_roughness_set() kvector_t kvec; kvec.setLambdaAlphaPhi(1.54*Units::angstrom, -alpha_i, 0.0); OpticalFresnel::MultiLayerCoeff_t coeffs; - OpticalFresnel fresnelCalculator; - fresnelCalculator.execute(*mp_sample, kvec, coeffs); + OpticalFresnel FresnelCalculator; + FresnelCalculator.execute(*mp_sample, kvec, coeffs); *it = coeffs; ++it; } @@ -312,7 +312,7 @@ void TestFresnelCoeff::draw_roughness_set() // create name of canvas different for each new call of this method std::ostringstream os; os << (ncall++) << std::endl; - std::string cname = std::string("c1_test_fresnel_roughness")+os.str(); + std::string cname = std::string("c1_test_Fresnel_roughness")+os.str(); TCanvas *c1 = new TCanvas(cname.c_str(),"Fresnel Coefficients in Multilayer",1024,768); DrawHelper::SetMagnifier(c1); diff --git a/App/src/TestMesoCrystal1.cpp b/App/src/TestMesoCrystal1.cpp index db18527a5547b78c1cd75b053cce3bc4a5b4c4a0..5a6ec6301e3d7182bd235d5e10bada5cae958f8b 100644 --- a/App/src/TestMesoCrystal1.cpp +++ b/App/src/TestMesoCrystal1.cpp @@ -203,7 +203,7 @@ ISample* TestMesoCrystal1::SampleBuilder::buildSample() const double alpha_step = 5.0*Units::degree/n_alpha_rotation_steps; double alpha_start = - (n_alpha_rotation_steps/2.0)*alpha_step; - double phi_step = 2.0*M_PI/3.0/n_max_phi_rotation_steps; + double phi_step = 2*M_PI/3.0/n_max_phi_rotation_steps; double phi_start = 0.0; for (size_t i=0; i<n_max_phi_rotation_steps; ++i) { for (size_t j=0; j<n_alpha_rotation_steps; ++j) { diff --git a/App/src/TestMesoCrystal2.cpp b/App/src/TestMesoCrystal2.cpp index 7c5935d765a7e00774c62e38bae1b87ad8027ca7..d341959f89ef9a00ff96e325d67d8c74dd60a06d 100644 --- a/App/src/TestMesoCrystal2.cpp +++ b/App/src/TestMesoCrystal2.cpp @@ -576,7 +576,7 @@ ISample* TestMesoCrystal2::SampleBuilder::buildSample() const double alpha_step = 5.0*Units::degree/n_alpha_rotation_steps; double alpha_start = - (n_alpha_rotation_steps/2.0)*alpha_step; - double phi_step = 2.0*M_PI/3.0/n_max_phi_rotation_steps; + double phi_step = 2*M_PI/3.0/n_max_phi_rotation_steps; double phi_start = 0.0; for (size_t i=0; i<n_max_phi_rotation_steps; ++i) { for (size_t j=0; j<n_alpha_rotation_steps; ++j) { diff --git a/App/src/TestMiscellaneous.cpp b/App/src/TestMiscellaneous.cpp index 4f10731b7dee23bc229460a42d18e7b7f89fa110..dcd9edcf85338ff4cb65bc256f66f97793681365 100644 --- a/App/src/TestMiscellaneous.cpp +++ b/App/src/TestMiscellaneous.cpp @@ -333,17 +333,17 @@ void TestMiscellaneous::test_DoubleToComplexInterpolatingFunction() OutputData<double > *data_alpha = new OutputData<double >; data_alpha->addAxis("alpha_f", 200, 0.0*Units::degree, 2.0*Units::degree); - OpticalFresnel fresnelCalculator; + OpticalFresnel FresnelCalculator; const IAxis *p_alpha_axis = data_alpha->getAxis("alpha_f"); - std::map<double, OpticalFresnel::MultiLayerCoeff_t> fresnel_coeff_map; + std::map<double, OpticalFresnel::MultiLayerCoeff_t> Fresnel_coeff_map; for (size_t i=0; i<p_alpha_axis->getSize(); ++i) { double angle = (*p_alpha_axis)[i]; kvector_t kvec; kvec.setLambdaAlphaPhi(1.4*Units::angstrom, angle, 0.0); OpticalFresnel::MultiLayerCoeff_t coeffs; - fresnelCalculator.execute(*sample, kvec, coeffs); - fresnel_coeff_map[angle] = coeffs; + FresnelCalculator.execute(*sample, kvec, coeffs); + Fresnel_coeff_map[angle] = coeffs; } std::vector<DoubleToComplexInterpolatingFunction *> m_TT; @@ -354,8 +354,8 @@ void TestMiscellaneous::test_DoubleToComplexInterpolatingFunction() for(size_t i_layer=0; i_layer<sample->getNumberOfLayers(); ++i_layer) { std::map<double, complex_t> T_map; std::map<double, complex_t> R_map; - for (std::map<double, OpticalFresnel::MultiLayerCoeff_t>::const_iterator it=fresnel_coeff_map.begin(); - it!=fresnel_coeff_map.end(); ++it) { + for (std::map<double, OpticalFresnel::MultiLayerCoeff_t>::const_iterator it=Fresnel_coeff_map.begin(); + it!=Fresnel_coeff_map.end(); ++it) { double angle = (*it).first; complex_t T = (*it).second[i_layer].T; complex_t R = (*it).second[i_layer].R; @@ -382,7 +382,7 @@ void TestMiscellaneous::test_DoubleToComplexInterpolatingFunction() kvector_t kvec; kvec.setLambdaAlphaPhi(1.4*Units::angstrom, angle, 0.0); OpticalFresnel::MultiLayerCoeff_t coeffs; - fresnelCalculator.execute(*sample, kvec, coeffs); + FresnelCalculator.execute(*sample, kvec, coeffs); complex_t R = m_RR[i_layer_sel]->evaluate(angle); std::cout << i_point << " " << angle << " true R:" << coeffs[i_layer_sel].R << " interp:" << R << " " << std::abs(R - coeffs[i_layer_sel].R) << std::endl; // complex_t r = coeffs[i_layer_sel].R; diff --git a/App/src/TestPerformance.cpp b/App/src/TestPerformance.cpp index b437882828a2600aa0b158a1bf2dd53a4022805a..657818c89f7fae3b01ab5366088132ff4ccf8eb0 100644 --- a/App/src/TestPerformance.cpp +++ b/App/src/TestPerformance.cpp @@ -174,9 +174,9 @@ void PerfTest_FresnelCoeff::execute() kvector_t kvec; kvec.setLambdaAlphaPhi(1.54*Units::angstrom, -alpha_i, 0.0); OpticalFresnel::MultiLayerCoeff_t coeffs; - OpticalFresnel fresnelCalculator; + OpticalFresnel FresnelCalculator; MultiLayer *ml = dynamic_cast<MultiLayer *>(m_sample); - fresnelCalculator.execute(*ml, kvec, coeffs); + FresnelCalculator.execute(*ml, kvec, coeffs); } //! Start PerfTest_Pyramid. diff --git a/App/src/TestRoughness.cpp b/App/src/TestRoughness.cpp index 9bb497c90d621b49afbdb0f679c11c1cbd5c9b70..e88e9d8aed2e1f0c226a9b4b913a73537b15c719 100644 --- a/App/src/TestRoughness.cpp +++ b/App/src/TestRoughness.cpp @@ -200,7 +200,7 @@ void TestRoughness::GetProfileXZ_MatrixMethod() /* ************************************************************************* */ // Fast Fourier Transform method to obtain correlated sequence of random numbers. -// fftw3 library is used for fourier analysis. +// fftw3 library is used for Fourier analysis. // // Algorithm is described in: // The FFT Moving Average (FFT-MA) Generator: @@ -225,7 +225,7 @@ void TestRoughness::GetProfileXZ_FFTMethod() cov[npx-1-i] = cov[i]; } - // making fourier transform of covariance and z values + // making Fourier transform of covariance and z values std::vector<complex_t > ft_cov = MathFunctions::FastFourierTransform(cov, MathFunctions::ForwardFFT); std::vector<complex_t> ft_z = MathFunctions::FastFourierTransform(m_vzuncorr, MathFunctions::ForwardFFT); diff --git a/Core/Algorithms/inc/ConvolutionDetectorResolution.h b/Core/Algorithms/inc/ConvolutionDetectorResolution.h index 9425cdd9ecf68b1f4b6ef92bde0ff9f8cd0d40f9..e5184a6d6812f119024b6e28b3ebc6b79b4375de 100644 --- a/Core/Algorithms/inc/ConvolutionDetectorResolution.h +++ b/Core/Algorithms/inc/ConvolutionDetectorResolution.h @@ -26,7 +26,7 @@ class ConvolutionDetectorResolution : public IDetectorResolution { -public: + public: typedef double (*cumulative_DF_1d)(double); //! Constructor taking a 1 dimensional resolution function as argument ConvolutionDetectorResolution(cumulative_DF_1d res_function_1d); @@ -35,22 +35,24 @@ public: //! Destructor virtual ~ConvolutionDetectorResolution(); - //! Apply the encapsulated resolution function to the given intensity map by using a convolution - virtual void applyDetectorResolution(OutputData<double> *p_intensity_map) const; + //! Convolve given intensities with the encapsulated resolution. + virtual void applyDetectorResolution( + OutputData<double> *p_intensity_map) const; //! add parameters from local pool to external pool and call recursion over direct children - virtual std::string addParametersToExternalPool(std::string path, ParameterPool *external_pool, int copy_number=-1) const; + virtual std::string addParametersToExternalPool( + std::string path, ParameterPool *external_pool, + int copy_number=-1) const; //! clone object virtual ConvolutionDetectorResolution *clone() const; -protected: + protected: ConvolutionDetectorResolution(const ConvolutionDetectorResolution &other); - //! initialize pool parameters, i.e. register some of class members for later access via parameter pool virtual void init_parameters(); -private: + private: // //! hiding copy constructor and disabling assignment operator // ConvolutionDetectorResolution &operator=(const ConvolutionDetectorResolution &); diff --git a/Core/Algorithms/inc/IResolutionFunction2D.h b/Core/Algorithms/inc/IResolutionFunction2D.h index a097e72fcdc779a5a48d28e5bed20fbd430e9a50..4354359d3813a7987315aa573dd01779aa659a65 100644 --- a/Core/Algorithms/inc/IResolutionFunction2D.h +++ b/Core/Algorithms/inc/IResolutionFunction2D.h @@ -3,7 +3,7 @@ // BornAgain: simulate and fit scattering at grazing incidence // //! @file Algorithms/inc/IResolutionFunction2D.h -//! @brief Defines class IResolutionFunction2D. +//! @brief Defines interface class IResolutionFunction2D. //! //! @homepage http://apps.jcns.fz-juelich.de/BornAgain //! @license GNU General Public License v3 or higher (see COPYING) @@ -18,6 +18,8 @@ #include "IParameterized.h" +//! Interface providing two-dimensional resolution function. + class IResolutionFunction2D : public IParameterized { public: diff --git a/Core/Algorithms/src/ChiSquaredFrequency.cpp b/Core/Algorithms/src/ChiSquaredFrequency.cpp index 48826f5481b7ea60ed36a0e0922f87518edd7bc3..40fc29c4d119dd83b10816e3c50c504d36795b64 100644 --- a/Core/Algorithms/src/ChiSquaredFrequency.cpp +++ b/Core/Algorithms/src/ChiSquaredFrequency.cpp @@ -72,8 +72,8 @@ void ChiSquaredFrequency::initWeights() delete mp_simulation_ft; mp_real_ft = new OutputData<complex_t>(); mp_simulation_ft = new OutputData<complex_t>(); - OutputDataFunctions::fourierTransform(*mp_real_data, mp_real_ft); - OutputDataFunctions::fourierTransform(*mp_simulation_data, mp_simulation_ft); + OutputDataFunctions::FourierTransform(*mp_real_data, mp_real_ft); + OutputDataFunctions::FourierTransform(*mp_simulation_data, mp_simulation_ft); delete mp_weights; mp_weights = new OutputData<double>(); size_t rank = mp_simulation_ft->getRank(); diff --git a/Core/Algorithms/src/FTDistributions.cpp b/Core/Algorithms/src/FTDistributions.cpp index 68e11d33b3434b5ac42eb2b506f72beb56940d29..b8983049f87332c7bb324733fff81a0a5fdba231 100644 --- a/Core/Algorithms/src/FTDistributions.cpp +++ b/Core/Algorithms/src/FTDistributions.cpp @@ -38,7 +38,7 @@ double FTDistribution2DCauchy::evaluate(double qx, double qy) const void FTDistribution2DCauchy::transformToStarBasis(double qX, double qY, double alpha, double a, double b, double& qa, double& qb) const { - double prefactor = 1.0/(2.0*M_PI); // divide by sin(m_delta) for unnormalized X*,Y* basis + double prefactor = 1.0/(2*M_PI); // divide by sin(m_delta) for unnormalized X*,Y* basis qa = a*prefactor*( std::sin(m_gamma+m_delta)*qX - std::sin(m_gamma)*qY ); qb = b*prefactor*( -std::sin(alpha-m_gamma-m_delta)*qX + std::sin(alpha-m_gamma)*qY ); } diff --git a/Core/Algorithms/src/MultiLayerDWBASimulation.cpp b/Core/Algorithms/src/MultiLayerDWBASimulation.cpp index c018042c77bee0e419733848cf49660992881cd2..ade207fa8031c07b3e1c75f3af07eac67b2ff1be 100644 --- a/Core/Algorithms/src/MultiLayerDWBASimulation.cpp +++ b/Core/Algorithms/src/MultiLayerDWBASimulation.cpp @@ -79,19 +79,19 @@ void MultiLayerDWBASimulation::run() { msglog(MSG::DEBUG) << "MultiLayerDWBASimulation::run() -> Running thread " << m_thread_info.i_thread; - OpticalFresnel fresnelCalculator; + OpticalFresnel FresnelCalculator; kvector_t m_ki_real(m_ki.x().real(), m_ki.y().real(), m_ki.z().real()); m_dwba_intensity.setAllTo(0.0); - double lambda = 2.0*M_PI/m_ki_real.mag(); + double lambda = 2*M_PI/m_ki_real.mag(); // collect all alpha angles and calculate Fresnel coefficients typedef std::pair<double, OpticalFresnel::MultiLayerCoeff_t> - doublefresnel_t; - std::vector<doublefresnel_t> doublefresnel_buffer; + doubleFresnel_t; + std::vector<doubleFresnel_t> doubleFresnel_buffer; std::set<double> alpha_set = getAlphaList(); - doublefresnel_buffer.reserve(alpha_set.size()); + doubleFresnel_buffer.reserve(alpha_set.size()); double angle; kvector_t kvec; @@ -100,8 +100,8 @@ void MultiLayerDWBASimulation::run() alpha_set.begin(); it != alpha_set.end(); ++it) { angle = *it; kvec.setLambdaAlphaPhi(lambda, -angle, 0.0); - fresnelCalculator.execute(*mp_multi_layer, kvec, coeffs); - doublefresnel_buffer.push_back( doublefresnel_t(angle,coeffs) ); + FresnelCalculator.execute(*mp_multi_layer, kvec, coeffs); + doubleFresnel_buffer.push_back( doubleFresnel_t(angle,coeffs) ); } // run through layers and construct T,R functions @@ -110,9 +110,9 @@ void MultiLayerDWBASimulation::run() DoubleToPairOfComplexMap RT_map; DoubleToComplexMap Kz_map; - for(std::vector<doublefresnel_t >::const_iterator it= - doublefresnel_buffer.begin(); - it!=doublefresnel_buffer.end(); ++it) { + for(std::vector<doubleFresnel_t >::const_iterator it= + doubleFresnel_buffer.begin(); + it!=doubleFresnel_buffer.end(); ++it) { double angle = (*it).first; const OpticalFresnel::FresnelCoeff &coeff = (*it).second[i_layer]; RT_map[angle] = complexpair_t(coeff.R, coeff.T); diff --git a/Core/Algorithms/src/MultiLayerRoughnessDWBASimulation.cpp b/Core/Algorithms/src/MultiLayerRoughnessDWBASimulation.cpp index 0772701086aeb10268cf6db709b574a3c56c0974..fc8b2260889b16c3c62678c8b7f0584884be7ee5 100644 --- a/Core/Algorithms/src/MultiLayerRoughnessDWBASimulation.cpp +++ b/Core/Algorithms/src/MultiLayerRoughnessDWBASimulation.cpp @@ -44,7 +44,7 @@ void MultiLayerRoughnessDWBASimulation::run() const std::string s_alpha_f("alpha_f"); kvector_t m_ki_real(m_ki.x().real(), m_ki.y().real(), m_ki.z().real()); - double lambda = 2.0*M_PI/m_ki_real.mag(); + double lambda = 2*M_PI/m_ki_real.mag(); DWBASimulation::iterator it_intensity = begin(); while ( it_intensity != m_dwba_intensity.end() ) diff --git a/Core/Algorithms/src/StrategyBuilder.cpp b/Core/Algorithms/src/StrategyBuilder.cpp index d5246646660ed3fc5e6165c0a9bf3d050648c2aa..6533bf34c93692ca4d7454c4231276a2d059ee97 100644 --- a/Core/Algorithms/src/StrategyBuilder.cpp +++ b/Core/Algorithms/src/StrategyBuilder.cpp @@ -125,7 +125,7 @@ double LayerDecoratorStrategyBuilder::getWavelength() { cvector_t ki = mp_simulation->getInstrument().getBeam().getCentralK(); kvector_t ki_real(ki.x().real(), ki.y().real(), ki.z().real()); - return 2.0*M_PI/ki_real.mag(); + return 2*M_PI/ki_real.mag(); } FormFactorInfo *LayerDecoratorStrategyBuilder::createFormFactorInfo( diff --git a/Core/Core.pro b/Core/Core.pro index 136d134c3490931e4aac0242f1200fc4bb3a8408..86bf44193d9d5518d9693f78e0b8efffb18126c8 100644 --- a/Core/Core.pro +++ b/Core/Core.pro @@ -6,7 +6,7 @@ TEMPLATE = lib CONFIG += plugin # to remove versions from file name QT -= core gui QMAKE_EXTENSION_SHLIB = so # making standard *.so extension -CONFIG += BORNAGAIN_PYTHON +# CONFIG += BORNAGAIN_PYTHON # ----------------------------------------------------------------------------- # source and headers diff --git a/Core/FormFactors/src/FormFactorCone.cpp b/Core/FormFactors/src/FormFactorCone.cpp index 1d28e2c9ea6df2ac00f46e43acfab4215f49e52a..8ef3297ebbaf32411e86ee2a5f4ea0fe72314ffb 100644 --- a/Core/FormFactors/src/FormFactorCone.cpp +++ b/Core/FormFactors/src/FormFactorCone.cpp @@ -72,7 +72,7 @@ double FormFactorCone::ConeIntegralReal(double Z, void* params) const MathFunctions::Bessel_J1(std::abs(qrRz))/qrRz : 0.5; double exp_real = std::exp(complex_t(0.0, 1.0)*qz*Z).real(); - return 2.0 * M_PI *Rz*Rz * J1_qrRz_div_qrRz * exp_real; + return 2*M_PI *Rz*Rz * J1_qrRz_div_qrRz * exp_real; } //! Imaginary part of the integral. @@ -102,7 +102,7 @@ double FormFactorCone::ConeIntegralImaginary(double Z, void* params) const MathFunctions::Bessel_J1(std::abs(qrRz))/qrRz : 0.5; double exp_imag = std::exp(complex_t(0.0, 1.0)*qz*Z).imag(); - return 2.0 * M_PI *Rz*Rz * J1_qrRz_div_qrRz * exp_imag; + return 2*M_PI *Rz*Rz * J1_qrRz_div_qrRz * exp_imag; } //! Complex integral computed as sum of real and imaginary part. diff --git a/Core/FormFactors/src/FormFactorSphere.cpp b/Core/FormFactors/src/FormFactorSphere.cpp index 86d1b824015e3a04cc0087b12cfed187f093a0b0..efbd35024b02a783f9c4d480119968da39930836 100644 --- a/Core/FormFactors/src/FormFactorSphere.cpp +++ b/Core/FormFactors/src/FormFactorSphere.cpp @@ -68,5 +68,5 @@ complex_t FormFactorSphere::evaluate_for_q(const cvector_t &q) const m_q = q; complex_t iqzR = complex_t(0.0, 1.0)*m_q.z()*(m_height-m_radius); complex_t integral = m_integrator->integrate(m_radius-m_height, m_radius); - return 2.0*M_PI*integral*std::exp(iqzR); + return 2*M_PI*integral*std::exp(iqzR); } diff --git a/Core/Geometry/inc/BasicVector3D.h b/Core/Geometry/inc/BasicVector3D.h index ad52e9cc4bb5677d8518a9ca0a42bdcc08790985..934877b8b1ec54996530089513f64209c9e30e04 100644 --- a/Core/Geometry/inc/BasicVector3D.h +++ b/Core/Geometry/inc/BasicVector3D.h @@ -176,6 +176,19 @@ template<class T> class BasicVector3D { //! Return angle with respect to another vector. T angle(const BasicVector3D<T>& v) const; + // --------- + // Rotations + // --------- + + //! Rotates around x-axis. + BasicVector3D<T>& rotateX(T a); + //! Rotates around y-axis. + BasicVector3D<T>& rotateY(T a); + //! Rotates around z-axis. + BasicVector3D<T>& rotateZ(T a); + //! Rotates around the axis specified by another vector. + BasicVector3D<T>& rotate(T a, const BasicVector3D<T>& v); + // --------------- // Related vectors // --------------- @@ -212,7 +225,7 @@ template<class T> class BasicVector3D { inline void setLambdaAlphaPhi( const T&_lambda, const T&_alpha, const T&_phi) { - T k = 2.*M_PI/_lambda; + T k = 2*M_PI/_lambda; v_[0] = k*std::cos(_alpha) * std::cos(_phi); v_[1] = k*std::cos(_alpha) * std::sin(_phi); v_[2] = k*std::sin(_alpha); diff --git a/Core/Geometry/src/BasicVector3D.cpp b/Core/Geometry/src/BasicVector3D.cpp index dfae364b052a0e85e108ea56cfc2f338a3f9a194..647b6deb669c12f3bb835c2bbde96f6843baa824 100644 --- a/Core/Geometry/src/BasicVector3D.cpp +++ b/Core/Geometry/src/BasicVector3D.cpp @@ -175,9 +175,71 @@ double BasicVector3D<double>::angle(const BasicVector3D<double>& v) const return std::acos(cosa); } -// ========================================================================= +// ---------------------------------------------------------------------------- +// Rotations +// ---------------------------------------------------------------------------- + +template<> +BasicVector3D<double>& BasicVector3D<double>::rotateX (double a) +{ + double sina = std::sin(a), cosa = std::cos(a), dy = y(), dz = z(); + setY(dy*cosa-dz*sina); + setZ(dz*cosa+dy*sina); + return *this; +} + +template<> +BasicVector3D<double>& BasicVector3D<double>::rotateY (double a) +{ + double sina = std::sin(a), cosa = std::cos(a), dz = z(), dx = x(); + setZ(dz*cosa-dx*sina); + setX(dx*cosa+dz*sina); + return *this; +} + +template<> +BasicVector3D<double>& BasicVector3D<double>::rotateZ (double a) +{ + double sina = std::sin(a), cosa = std::cos(a), dx = x(), dy = y(); + setX(dx*cosa-dy*sina); + setY(dy*cosa+dx*sina); + return *this; +} + +template<> +BasicVector3D<double>& BasicVector3D<double>::rotate ( + double a, const BasicVector3D<double>& v) +{ + if (a == 0) return *this; + double cx = v.x(), cy = v.y(), cz = v.z(); + double ll = std::sqrt(cx*cx + cy*cy + cz*cz); + if (ll == 0) { + std::cerr << "BasicVector<double>::rotate() : zero axis" << std::endl; + return *this; + } + double cosa = std::cos(a), sina = std::sin(a); + cx /= ll; cy /= ll; cz /= ll; + + double xx = cosa + (1-cosa)*cx*cx; + double xy = (1-cosa)*cx*cy - sina*cz; + double xz = (1-cosa)*cx*cz + sina*cy; + + double yx = (1-cosa)*cy*cx + sina*cz; + double yy = cosa + (1-cosa)*cy*cy; + double yz = (1-cosa)*cy*cz - sina*cx; + + double zx = (1-cosa)*cz*cx - sina*cy; + double zy = (1-cosa)*cz*cy + sina*cx; + double zz = cosa + (1-cosa)*cz*cz; + + cx = x(); cy = y(); cz = z(); + setXYZ(xx*cx+xy*cy+xz*cz, yx*cx+yy*cy+yz*cz, zx*cx+zy*cy+zz*cz); + return *this; +} + +// ============================================================================= // Non-member functions for BasicVector3D<double> -// ========================================================================= +// ============================================================================= // ----------------------------------------------------------------------------- // Transforms diff --git a/Core/Geometry/src/Transform3D.cpp b/Core/Geometry/src/Transform3D.cpp index 5b2e12c57508edee4d41f8900041024eacfe8ddf..cd290af5bb7625d9a7c806975483751f778358ca 100644 --- a/Core/Geometry/src/Transform3D.cpp +++ b/Core/Geometry/src/Transform3D.cpp @@ -82,7 +82,8 @@ Transform3D Transform3D::inverse() const double detxz = yx_*zy_-yy_*zx_; double det = xx_*detxx - xy_*detxy + xz_*detxz; if (det == 0) { - std::cerr << "Transform3D::inverse error: zero determinant" << std::endl; + std::cerr << "Transform3D::inverse error: zero determinant" << + std::endl; return Transform3D(); } det = 1./det; detxx *= det; detxy *= det; detxz *= det; diff --git a/Core/Samples/inc/ICompositeSample.h b/Core/Samples/inc/ICompositeSample.h index b4925e3651c32ac00367b00875ab86922736d370..09414839834f6cb4d5654e6515cbc6dce7aaf401 100644 --- a/Core/Samples/inc/ICompositeSample.h +++ b/Core/Samples/inc/ICompositeSample.h @@ -21,11 +21,11 @@ class ICompositeIterator; -//! Compose ISample objects into tree structure +//! Interface to equip ISample with a tree structure. class ICompositeSample : public ISample { -public: + public: //! definition of container for registered children typedef std::list<ISample *> samples_t; typedef samples_t::iterator iterator_t; @@ -58,7 +58,7 @@ public: //! create general iterator to walk through the tree of registered composite children ICompositeIterator createIterator(); -private: + private: // ICompositeSample &operator=(const ICompositeSample &other); //! check index of child diff --git a/Core/Samples/inc/IDecoration.h b/Core/Samples/inc/IDecoration.h index 2853051389d2c26170d08d513a633d4fe4c4b08d..9ccdc41212b8f985f506a617cfb09495f3c077cc 100644 --- a/Core/Samples/inc/IDecoration.h +++ b/Core/Samples/inc/IDecoration.h @@ -3,7 +3,7 @@ // BornAgain: simulate and fit scattering at grazing incidence // //! @file Samples/inc/IDecoration.h -//! @brief Defines class IDecoration. +//! @brief Defines interface class IDecoration. //! //! @homepage http://apps.jcns.fz-juelich.de/BornAgain //! @license GNU General Public License v3 or higher (see COPYING) @@ -24,7 +24,7 @@ class IInterferenceFunctionStrategy; class IInterferenceFunction; -//! ? +//! Interface to equip a sample component with various properties. class IDecoration : public ICompositeSample { diff --git a/Core/Samples/inc/MultiLayer.h b/Core/Samples/inc/MultiLayer.h index 9d415de58a62b3b470d7345a36b6de7b183952e0..82ac60468c8ee56ce8fccd8ac579e517ab59a03e 100644 --- a/Core/Samples/inc/MultiLayer.h +++ b/Core/Samples/inc/MultiLayer.h @@ -87,7 +87,7 @@ public: ///! correlation function of roughnesses between the interfaces //double getCrossCorrFun(const kvector_t &k, int j, int k) const; - //! fourier transform of the correlation function of roughnesses between the interfaces + //! Fourier transform of the correlation function of roughnesses between the interfaces double getCrossCorrSpectralFun(const kvector_t &kvec, size_t j, size_t k) const; //! change thickness of layer diff --git a/Core/Samples/src/InterferenceFunction2DLattice.cpp b/Core/Samples/src/InterferenceFunction2DLattice.cpp index 73907cb4563f477f0dae9a435afecd6bc8a1007b..f25d6c46f08ec0ce61264061cf49cca889d506d1 100644 --- a/Core/Samples/src/InterferenceFunction2DLattice.cpp +++ b/Core/Samples/src/InterferenceFunction2DLattice.cpp @@ -86,8 +86,8 @@ void InterferenceFunction2DLattice::calculateReciprocalVectorFraction(double qx, double b = m_lattice_params.m_length_2; double xi = m_lattice_params.m_xi; double xialpha = xi + m_lattice_params.m_angle; - int qa_int = (int)( a*(qx*std::cos(xi)+qy*std::sin(xi))/(2.0*M_PI) ); - int qb_int = (int)( b*(qx*std::cos(xialpha)+qy*std::sin(xialpha))/(2.0*M_PI) ); + int qa_int = (int)( a*(qx*std::cos(xi)+qy*std::sin(xi))/(2*M_PI) ); + int qb_int = (int)( b*(qx*std::cos(xialpha)+qy*std::sin(xialpha))/(2*M_PI) ); qx_frac = qx - qa_int*m_asx - qb_int*m_bsx; qy_frac = qy - qa_int*m_asy - qb_int*m_bsy; } @@ -103,8 +103,8 @@ void InterferenceFunction2DLattice::initialize_rec_vectors() throw DivisionByZeroException("InterferenceFunction2DLattice::initialize_rec_vectors() -> Error! Zero parameters m_lattice_params.m_length1 or m_lattice_params.m_length_2"); } double sinalpha = std::sin(m_lattice_params.m_angle); - double ainv = 2.0*M_PI/m_lattice_params.m_length_1/sinalpha; - double binv = 2.0*M_PI/m_lattice_params.m_length_2/sinalpha; + double ainv = 2*M_PI/m_lattice_params.m_length_1/sinalpha; + double binv = 2*M_PI/m_lattice_params.m_length_2/sinalpha; double xi = m_lattice_params.m_xi; double xialpha = xi + m_lattice_params.m_angle; m_asx = ainv*std::sin(xialpha); @@ -117,7 +117,7 @@ void InterferenceFunction2DLattice::initialize_calc_factors() { // constant prefactor //TODO: for non cauchy distributions: check if this still applies - m_prefactor = 2.0*M_PI*m_lattice_params.m_corr_length_1*m_lattice_params.m_corr_length_2; + m_prefactor = 2*M_PI*m_lattice_params.m_corr_length_1*m_lattice_params.m_corr_length_2; double denominator = m_lattice_params.m_length_1*m_lattice_params.m_length_2*std::sin(m_lattice_params.m_angle); assert(denominator); m_prefactor /= denominator; diff --git a/Core/Samples/src/InterferenceFunction2DParaCrystal.cpp b/Core/Samples/src/InterferenceFunction2DParaCrystal.cpp index 828582d5ccddbb741763852c6ca17b4a1888d044..5c17906eb60289c51d78d1a7c5a5d1a8301fc53d 100644 --- a/Core/Samples/src/InterferenceFunction2DParaCrystal.cpp +++ b/Core/Samples/src/InterferenceFunction2DParaCrystal.cpp @@ -101,7 +101,7 @@ InterferenceFunction2DParaCrystal* InterferenceFunction2DParaCrystal::createSqua InterferenceFunction2DParaCrystal* InterferenceFunction2DParaCrystal::createHexagonal( double peak_distance, double corr_length, double domain_size_1, double domain_size_2) { - InterferenceFunction2DParaCrystal *p_new = new InterferenceFunction2DParaCrystal(peak_distance, peak_distance, 2.0*M_PI/3.0, 0.0, corr_length); + InterferenceFunction2DParaCrystal *p_new = new InterferenceFunction2DParaCrystal(peak_distance, peak_distance, 2*M_PI/3.0, 0.0, corr_length); p_new->setDomainSizes(domain_size_1, domain_size_2); p_new->setIntegrationOverXi(true); return p_new; diff --git a/Core/Tools/inc/Convolve.h b/Core/Tools/inc/Convolve.h index 32d7846309744a84507831e12ff34d19fc3ef7d0..0f70ebb26fcc8e92c863d4d9b6e3de6b9ac00a4c 100644 --- a/Core/Tools/inc/Convolve.h +++ b/Core/Tools/inc/Convolve.h @@ -64,7 +64,7 @@ public: void setMode(Mode mode) { m_mode = mode; } private: - //! compute circual convolution of source and kernel using fast fourier transformation + //! compute circual convolution of source and kernel using fast Fourier transformation void fftw_circular_convolution(const double2d_t &source, const double2d_t &kernel); //! find closest number X>n that can be factorised according to fftw3 favorite factorisation @@ -97,7 +97,7 @@ private: double *out_src; //! adjusted input 'kernel' array double *in_kernel; - //! result of fourier transformation of kernel + //! result of Fourier transformation of kernel double *out_kernel; //! result of production of FFT(source) and FFT(kernel) double *dst_fft; diff --git a/Core/Tools/inc/OutputDataFunctions.h b/Core/Tools/inc/OutputDataFunctions.h index 2f60fe7b44426bf93f73cb1850a65361a3b05eb8..04d297291a4c9157b7a2fb0b4006f0c784959742 100644 --- a/Core/Tools/inc/OutputDataFunctions.h +++ b/Core/Tools/inc/OutputDataFunctions.h @@ -30,10 +30,10 @@ namespace OutputDataFunctions OutputData<double> *doubleBinSize(const OutputData<double> &source); //! unnormalized Fourier transformation for real data - void fourierTransform(const OutputData<double> &source, OutputData<complex_t> *p_destination); + void FourierTransform(const OutputData<double> &source, OutputData<complex_t> *p_destination); //! unnormalized reverse Fourier transformation for real data - void fourierTransformR(const OutputData<complex_t> &source, OutputData<double> *p_destination); + void FourierTransformR(const OutputData<complex_t> &source, OutputData<double> *p_destination); OutputData<double> *getRealPart(const OutputData<complex_t> &source); OutputData<double> *getImagPart(const OutputData<complex_t> &source); diff --git a/Core/Tools/src/Convolve.cpp b/Core/Tools/src/Convolve.cpp index ebaf206d8f0f13bf434c51a9e12e0648726eba54..d4f172e1c22349fb8f747e2da09b967ca84468fa 100644 --- a/Core/Tools/src/Convolve.cpp +++ b/Core/Tools/src/Convolve.cpp @@ -141,7 +141,7 @@ void MathFunctions::Convolve::fftconvolve(const double1d_t &source, const double /* ************************************************************************* */ -// initialise input and output arrays for fast fourier transformation +// initialise input and output arrays for fast Fourier transformation /* ************************************************************************* */ void MathFunctions::Convolve::init(int h_src, int w_src, int h_kernel, int w_kernel) { @@ -263,7 +263,7 @@ void MathFunctions::Convolve::init(int h_src, int w_src, int h_kernel, int w_ker /* ************************************************************************* */ -// initialise input and output arrays for fast fourier transformation +// initialise input and output arrays for fast Fourier transformation /* ************************************************************************* */ void MathFunctions::Convolve::fftw_circular_convolution(const double2d_t &src, const double2d_t &kernel) { diff --git a/Core/Tools/src/MathFunctions.cpp b/Core/Tools/src/MathFunctions.cpp index fff734698658aaf1ca5a631c2b7cbd9e198e9ec9..68a252275e0e94249cddfbc98a2af6968c6eb7f2 100644 --- a/Core/Tools/src/MathFunctions.cpp +++ b/Core/Tools/src/MathFunctions.cpp @@ -35,7 +35,7 @@ double MathFunctions::IntegratedGaussian(double value, double average, double st double MathFunctions::StandardNormal(double value) { - return std::exp(- value*value / 2.0) / std::sqrt(2.0*M_PI); + return std::exp(- value*value / 2.0) / std::sqrt(2*M_PI); } double MathFunctions::GenerateStandardNormalRandom() // using Box-Muller transform @@ -46,7 +46,7 @@ double MathFunctions::GenerateStandardNormalRandom() // using Box-Muller transf } //! @brief simple (and unoptimized) wrapper function -//! for the discrete fast fourier transformation library (fftw3) +//! for the discrete fast Fourier transformation library (fftw3) std::vector<complex_t > MathFunctions::FastFourierTransform(const std::vector<complex_t > &data, MathFunctions::TransformCase ftCase) { @@ -94,7 +94,7 @@ std::vector<complex_t > MathFunctions::FastFourierTransform(const std::vector<co } //! @brief simple (and unoptimized) wrapper function -//! for the discrete fast fourier transformation library (fftw3); +//! for the discrete fast Fourier transformation library (fftw3); //! transforms real to complex std::vector<complex_t > MathFunctions::FastFourierTransform(const std::vector<double > &data, MathFunctions::TransformCase ftCase) diff --git a/Core/Tools/src/OutputDataFunctions.cpp b/Core/Tools/src/OutputDataFunctions.cpp index cda93166a96b890e6290eed3014b1e679c188443..3a1618201028b99b60b477f5b59fbb0b35b5ca48 100644 --- a/Core/Tools/src/OutputDataFunctions.cpp +++ b/Core/Tools/src/OutputDataFunctions.cpp @@ -61,7 +61,7 @@ OutputData<double>* OutputDataFunctions::doubleBinSize( //! Fourier transformation of output data -void OutputDataFunctions::fourierTransform( +void OutputDataFunctions::FourierTransform( const OutputData<double>& source, OutputData<complex_t> *p_destination) { // initialize dimensions @@ -105,7 +105,7 @@ void OutputDataFunctions::fourierTransform( //! Fourier back transform ?? -void OutputDataFunctions::fourierTransformR( +void OutputDataFunctions::FourierTransformR( const OutputData<complex_t>& source, OutputData<double> *p_destination) { // initialize dimensions diff --git a/Fit/Fit.pro b/Fit/Fit.pro index ddb6211be830282d0ed799b4d4811bc3dd0c49b7..7f5537db9b0ae50c79415408aeece436ca5dc5f0 100644 --- a/Fit/Fit.pro +++ b/Fit/Fit.pro @@ -6,7 +6,7 @@ TEMPLATE = lib CONFIG += plugin # to remove versions from file name QT -= core gui QMAKE_EXTENSION_SHLIB = so # making standard *.so extension -CONFIG += BORNAGAIN_PYTHON +# CONFIG += BORNAGAIN_PYTHON CONFIG += BORNAGAIN_ROOT # ----------------------------------------------------------------------------- diff --git a/Tests/UnitTests/TestCore/ChiSquaredModuleTest.h b/Tests/UnitTests/TestCore/ChiSquaredModuleTest.h index abd1c23c4ea0b2bfc19cf646d5a2a7ae96465005..b0557028fa2f96b42662d9996101caeb6b12f521 100644 --- a/Tests/UnitTests/TestCore/ChiSquaredModuleTest.h +++ b/Tests/UnitTests/TestCore/ChiSquaredModuleTest.h @@ -4,7 +4,6 @@ #include "ChiSquaredModule.h" #include "IFittingDataSelector.h" #include "ISquaredFunction.h" -#include "ExperimentConstants.h" #include "gtest/gtest.h" @@ -38,7 +37,6 @@ ChiSquaredModuleTest::ChiSquaredModuleTest() ChiSquaredModuleTest::~ChiSquaredModuleTest() { - } @@ -115,11 +113,8 @@ TEST_F(ChiSquaredModuleTest, IsGISAXSLikeModule) // m_chi_isgisaxs.setOutputDataNormalizer( OutputDataNormalizerScaleAndShift() ); // EXPECT_FLOAT_EQ( double(0.005), m_chi_isgisaxs.calculateChiSquared()); - - } - #endif // CHISQUAREDMODULETEST_H