From 85ba6b84a0221d17bab8b525a10744f9b2805466 Mon Sep 17 00:00:00 2001 From: Walter Van Herck <w.van.herck@fz-juelich.de> Date: Thu, 28 Aug 2014 13:43:15 +0200 Subject: [PATCH] Added constructors to Bin1D --- App/src/TestFormFactor.cpp | 4 ++-- App/src/TestInfLongBox.cpp | 2 +- App/src/TestInfLongRipple1.cpp | 2 +- App/src/TestInfLongRipple2.cpp | 2 +- App/src/TestMiscellaneous.cpp | 4 ++-- App/src/TestPolarizedDWBATerms.cpp | 8 ++++---- Core/FormFactors/inc/IFormFactor.h | 2 +- Core/Tools/inc/Bin.h | 2 ++ Core/Tools/src/CustomBinAxis.cpp | 2 +- Core/Tools/src/FixedBinAxis.cpp | 2 +- Core/Tools/src/VariableBinAxis.cpp | 2 +- 11 files changed, 17 insertions(+), 15 deletions(-) diff --git a/App/src/TestFormFactor.cpp b/App/src/TestFormFactor.cpp index 9a3ab368b9b..9f95d1f60ba 100644 --- a/App/src/TestFormFactor.cpp +++ b/App/src/TestFormFactor.cpp @@ -58,8 +58,8 @@ void TestFormFactor::execute() it.getIndex()); double phi_f = M_PI*(*p_y_axis)[index_y]/180.0; Bin1D alpha_f_bin_degrees = p_z_axis->getBin(index_z); - Bin1D alpha_f_bin = { M_PI*alpha_f_bin_degrees.m_lower/180.0, - M_PI*alpha_f_bin_degrees.m_upper/180.0 }; + Bin1D alpha_f_bin(M_PI*alpha_f_bin_degrees.m_lower/180.0, + M_PI*alpha_f_bin_degrees.m_upper/180.0); double alpha_f = alpha_f_bin.getMidPoint(); cvector_t k_f; k_f.setLambdaAlphaPhi(lambda, alpha_f, phi_f); diff --git a/App/src/TestInfLongBox.cpp b/App/src/TestInfLongBox.cpp index 8660f82002b..d29fd3c5b8f 100644 --- a/App/src/TestInfLongBox.cpp +++ b/App/src/TestInfLongBox.cpp @@ -126,7 +126,7 @@ void TestInfLongBox::drawff() cvector_t k_f; k_f.setLambdaAlphaPhi(lambda, M_PI*af/180.0, M_PI*pf/180.0); - Bin1D alpha_f_bin = {M_PI*af0/180.0, M_PI*af/180.0}; + Bin1D alpha_f_bin(M_PI*af0/180.0, M_PI*af/180.0); Bin1DCVector k_f_bin(k_f0, k_f); af0 = af; diff --git a/App/src/TestInfLongRipple1.cpp b/App/src/TestInfLongRipple1.cpp index cbca3ca6849..037136f2a18 100644 --- a/App/src/TestInfLongRipple1.cpp +++ b/App/src/TestInfLongRipple1.cpp @@ -126,7 +126,7 @@ void TestInfLongRipple1::drawff() cvector_t k_f; k_f.setLambdaAlphaPhi(lambda, M_PI*af/180.0, M_PI*pf/180.0); - Bin1D alpha_f_bin = {M_PI*af0/180.0, M_PI*af/180.0}; + Bin1D alpha_f_bin(M_PI*af0/180.0, M_PI*af/180.0); Bin1DCVector k_f_bin(k_f0, k_f); af0 = af; diff --git a/App/src/TestInfLongRipple2.cpp b/App/src/TestInfLongRipple2.cpp index d20b9881b90..448bce6d59f 100644 --- a/App/src/TestInfLongRipple2.cpp +++ b/App/src/TestInfLongRipple2.cpp @@ -127,7 +127,7 @@ void TestInfLongRipple2::drawff() cvector_t k_f; k_f.setLambdaAlphaPhi(lambda, M_PI*af/180.0, M_PI*pf/180.0); - Bin1D alpha_f_bin = {M_PI*af0/180.0, M_PI*af/180.0}; + Bin1D alpha_f_bin(M_PI*af0/180.0, M_PI*af/180.0); Bin1DCVector k_f_bin(k_f0, k_f); af0 = af; diff --git a/App/src/TestMiscellaneous.cpp b/App/src/TestMiscellaneous.cpp index f5aeee6a6b9..760228c2943 100644 --- a/App/src/TestMiscellaneous.cpp +++ b/App/src/TestMiscellaneous.cpp @@ -381,7 +381,7 @@ void TestMiscellaneous::test_FormFactor() cvector_t q(x,y,z); cvector_t q0(0.0,0.0,0.0); Bin1DCVector q0_bin(q0, q0); - Bin1D zero_bin = { 0.0, 0.0 }; + Bin1D zero_bin; double value = std::abs(ff.evaluate(q,q0_bin, zero_bin)); if(iz==50) h2->Fill(x,y,std::abs(ff.evaluate(q,q0_bin, zero_bin))); @@ -494,7 +494,7 @@ void TestMiscellaneous::test_FormFactor1() cvector_t q(x,y,z); cvector_t q0(0.0,0.0,0.0); Bin1DCVector q0_bin(q0, q0); - Bin1D zero_bin = { 0.0, 0.0 }; + Bin1D zero_bin; double value = std::abs(ff.evaluate(q,q0_bin, zero_bin)); //double valuep = std::abs(ff.evaluate(q,q0_bin, zero_bin)); //double valuer = std::abs(ff.evaluate(q,q0_bin, zero_bin)); diff --git a/App/src/TestPolarizedDWBATerms.cpp b/App/src/TestPolarizedDWBATerms.cpp index 768b3317f6e..3b1a01c3699 100644 --- a/App/src/TestPolarizedDWBATerms.cpp +++ b/App/src/TestPolarizedDWBATerms.cpp @@ -60,8 +60,8 @@ TestPolarizedDWBATerms::TestPolarizedDWBATerms() void TestPolarizedDWBATerms::execute() { - Bin1D alpha_f_bin = { m_alpha_f, m_alpha_f }; - Bin1D zero_bin = { 0.0, 0.0 }; + Bin1D alpha_f_bin(m_alpha_f, m_alpha_f); + Bin1D zero_bin; mp_scalar_ff->calculateTerms(m_ki, m_kf_bin, alpha_f_bin); mp_matrix_ff->calculateTerms(m_ki, m_kf_bin, alpha_f_bin, zero_bin); @@ -77,8 +77,8 @@ void TestPolarizedDWBATerms::initWavevectors() { m_ki.setLambdaAlphaPhi(0.21, -m_alpha_i, 0.0); - Bin1D alpha_bin = { m_alpha_f, m_alpha_f }; - Bin1D phi_bin = { 0.0, 0.0 }; + Bin1D alpha_bin( m_alpha_f, m_alpha_f ); + Bin1D phi_bin; m_kf_bin = Bin1DCVector(0.21, alpha_bin, phi_bin); } diff --git a/Core/FormFactors/inc/IFormFactor.h b/Core/FormFactors/inc/IFormFactor.h index 652fa7ec258..cad90e9486e 100644 --- a/Core/FormFactors/inc/IFormFactor.h +++ b/Core/FormFactors/inc/IFormFactor.h @@ -110,7 +110,7 @@ inline double IFormFactor::getVolume() const { cvector_t zero_vector; Bin1DCVector zero_vector_bin(zero_vector, zero_vector); - Bin1D zero_bin = { 0.0, 0.0 }; + Bin1D zero_bin; return std::abs(evaluate(zero_vector, zero_vector_bin, zero_bin)); } diff --git a/Core/Tools/inc/Bin.h b/Core/Tools/inc/Bin.h index a63ef8b6b03..8006b2b37fa 100644 --- a/Core/Tools/inc/Bin.h +++ b/Core/Tools/inc/Bin.h @@ -28,6 +28,8 @@ struct BA_CORE_API_ Bin1D { + Bin1D() {} + Bin1D(double lower, double upper) : m_lower(lower), m_upper(upper) {} double m_lower; //!< lower bound of the bin double m_upper; //!< upper bound of the bin double getMidPoint() const { return (m_lower + m_upper)/2.0; } diff --git a/Core/Tools/src/CustomBinAxis.cpp b/Core/Tools/src/CustomBinAxis.cpp index c6507648b35..30a839c10e5 100644 --- a/Core/Tools/src/CustomBinAxis.cpp +++ b/Core/Tools/src/CustomBinAxis.cpp @@ -43,7 +43,7 @@ Bin1D CustomBinAxis::getBin(size_t index) const if(index >= m_nbins) throw Exceptions::OutOfBoundsException("CustomBinAxis::getBin() -> Error. Wrong index."); - Bin1D result = { m_bin_centers[index], m_bin_centers[index] }; + Bin1D result(m_bin_centers[index], m_bin_centers[index]); return result; } diff --git a/Core/Tools/src/FixedBinAxis.cpp b/Core/Tools/src/FixedBinAxis.cpp index 9f54ad241db..11a0d4a7915 100644 --- a/Core/Tools/src/FixedBinAxis.cpp +++ b/Core/Tools/src/FixedBinAxis.cpp @@ -42,7 +42,7 @@ Bin1D FixedBinAxis::getBin(size_t index) const throw Exceptions::OutOfBoundsException("FixedBinAxis::getBin() -> Error. Wrong index."); double step = (m_end - m_start)/m_nbins; - Bin1D result = { m_start + step*index, m_start + step*(index+1) }; + Bin1D result( m_start + step*index, m_start + step*(index+1) ); return result; } diff --git a/Core/Tools/src/VariableBinAxis.cpp b/Core/Tools/src/VariableBinAxis.cpp index 402cd7038c7..9f8b3023e00 100644 --- a/Core/Tools/src/VariableBinAxis.cpp +++ b/Core/Tools/src/VariableBinAxis.cpp @@ -48,7 +48,7 @@ Bin1D VariableBinAxis::getBin(size_t index) const if(index >= m_nbins) throw Exceptions::OutOfBoundsException("VariableBinAxis::getBin() -> Error. Wrong index."); - Bin1D result = { m_bin_boundaries[index], m_bin_boundaries[index+1] }; + Bin1D result(m_bin_boundaries[index], m_bin_boundaries[index+1]); return result; } -- GitLab