Skip to content
Snippets Groups Projects
Commit 971ca014 authored by Van Herck, Walter's avatar Van Herck, Walter
Browse files

Merge branch 'memleaks' into develop

parents 645b5de6 da1831cf
No related branches found
No related tags found
No related merge requests found
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "FormFactorDWBAPol.h" #include "FormFactorDWBAPol.h"
#include <vector> #include <vector>
#include <boost/scoped_ptr.hpp>
//! @class IInterferenceFunctionStrategy //! @class IInterferenceFunctionStrategy
...@@ -58,7 +59,7 @@ protected: ...@@ -58,7 +59,7 @@ protected:
SafePointerVector<FormFactorInfo> m_ff_infos; //!< form factor info SafePointerVector<FormFactorInfo> m_ff_infos; //!< form factor info
SafePointerVector<IInterferenceFunction> m_ifs; //!< interference functions SafePointerVector<IInterferenceFunction> m_ifs; //!< interference functions
SimulationParameters m_sim_params; //!< simulation parameters SimulationParameters m_sim_params; //!< simulation parameters
LayerSpecularInfo *mp_specular_info; //!< R and T coefficients for DWBA boost::scoped_ptr<LayerSpecularInfo> mP_specular_info; //!< R and T coefficients for DWBA
private: private:
struct IntegrationParamsAlpha { struct IntegrationParamsAlpha {
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
IInterferenceFunctionStrategy::IInterferenceFunctionStrategy( IInterferenceFunctionStrategy::IInterferenceFunctionStrategy(
SimulationParameters sim_params) SimulationParameters sim_params)
: m_sim_params(sim_params) : m_sim_params(sim_params)
, mp_specular_info(0)
{ {
} }
...@@ -38,9 +37,8 @@ void IInterferenceFunctionStrategy::init( ...@@ -38,9 +37,8 @@ void IInterferenceFunctionStrategy::init(
void IInterferenceFunctionStrategy::setSpecularInfo( void IInterferenceFunctionStrategy::setSpecularInfo(
const LayerSpecularInfo &specular_info) const LayerSpecularInfo &specular_info)
{ {
if (mp_specular_info != &specular_info) { if (mP_specular_info.get() != &specular_info) {
delete mp_specular_info; mP_specular_info.reset(specular_info.clone());
mp_specular_info = specular_info.clone();
} }
} }
...@@ -76,9 +74,9 @@ void IInterferenceFunctionStrategy::calculateFormFactorList( ...@@ -76,9 +74,9 @@ void IInterferenceFunctionStrategy::calculateFormFactorList(
{ {
clearFormFactorLists(); clearFormFactorLists();
const ILayerRTCoefficients *p_in_coeffs = const ILayerRTCoefficients *p_in_coeffs =
mp_specular_info->getInCoefficients(); mP_specular_info->getInCoefficients();
boost::scoped_ptr<const ILayerRTCoefficients> P_out_coeffs( boost::scoped_ptr<const ILayerRTCoefficients> P_out_coeffs(
mp_specular_info->getOutCoefficients( mP_specular_info->getOutCoefficients(
alpha_f_bin.getMidPoint(), 0.0) ); alpha_f_bin.getMidPoint(), 0.0) );
SafePointerVector<FormFactorInfo>::const_iterator it = SafePointerVector<FormFactorInfo>::const_iterator it =
m_ff_infos.begin(); m_ff_infos.begin();
...@@ -96,9 +94,9 @@ void IInterferenceFunctionStrategy::calculateFormFactorLists( ...@@ -96,9 +94,9 @@ void IInterferenceFunctionStrategy::calculateFormFactorLists(
{ {
clearFormFactorLists(); clearFormFactorLists();
const ILayerRTCoefficients *p_in_coeffs = const ILayerRTCoefficients *p_in_coeffs =
mp_specular_info->getInCoefficients(); mP_specular_info->getInCoefficients();
boost::scoped_ptr<const ILayerRTCoefficients> P_out_coeffs( boost::scoped_ptr<const ILayerRTCoefficients> P_out_coeffs(
mp_specular_info->getOutCoefficients( mP_specular_info->getOutCoefficients(
alpha_f_bin.getMidPoint(), phi_f_bin.getMidPoint()) ); alpha_f_bin.getMidPoint(), phi_f_bin.getMidPoint()) );
SafePointerVector<FormFactorInfo>::const_iterator it = SafePointerVector<FormFactorInfo>::const_iterator it =
m_ff_infos.begin(); m_ff_infos.begin();
...@@ -203,7 +201,7 @@ double IInterferenceFunctionStrategy::evaluate_for_fixed_angles(double *fraction ...@@ -203,7 +201,7 @@ double IInterferenceFunctionStrategy::evaluate_for_fixed_angles(double *fraction
+ par1*(pars->phi_bin.m_upper - pars->phi_bin.m_lower); + par1*(pars->phi_bin.m_upper - pars->phi_bin.m_lower);
k_f.setLambdaAlphaPhi(pars->wavelength, alpha, phi); k_f.setLambdaAlphaPhi(pars->wavelength, alpha, phi);
boost::scoped_ptr<const ILayerRTCoefficients> out_coeff( boost::scoped_ptr<const ILayerRTCoefficients> out_coeff(
mp_specular_info->getOutCoefficients(alpha, phi)); mP_specular_info->getOutCoefficients(alpha, phi));
k_f.setZ(out_coeff->getScalarKz()); k_f.setZ(out_coeff->getScalarKz());
Bin1DCVector k_f_bin(k_f, k_f); Bin1DCVector k_f_bin(k_f, k_f);
...@@ -228,7 +226,7 @@ double IInterferenceFunctionStrategy::evaluate_for_fixed_angles_pol( ...@@ -228,7 +226,7 @@ double IInterferenceFunctionStrategy::evaluate_for_fixed_angles_pol(
+ par1*(pars->phi_bin.m_upper - pars->phi_bin.m_lower); + par1*(pars->phi_bin.m_upper - pars->phi_bin.m_lower);
k_f.setLambdaAlphaPhi(pars->wavelength, alpha, phi); k_f.setLambdaAlphaPhi(pars->wavelength, alpha, phi);
boost::scoped_ptr<const ILayerRTCoefficients> out_coeff( boost::scoped_ptr<const ILayerRTCoefficients> out_coeff(
mp_specular_info->getOutCoefficients(alpha, phi)); mP_specular_info->getOutCoefficients(alpha, phi));
k_f.setZ(out_coeff->getScalarKz()); k_f.setZ(out_coeff->getScalarKz());
Bin1DCVector k_f_bin(k_f, k_f); Bin1DCVector k_f_bin(k_f, k_f);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment