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

Replaced shared_ptr with scoped_ptr in LayerSpecularInfo (2); provided clone...

Replaced shared_ptr with scoped_ptr in LayerSpecularInfo (2); provided clone methods to prevent shared pointers
parent 4cf2dd9e
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,8 @@ class BA_CORE_API_ ILayerRTCoefficients
public:
virtual ~ILayerRTCoefficients() {}
virtual ILayerRTCoefficients* clone() const=0;
#ifndef GCCXML_SKIP_THIS
//! The following functions return the transmitted and reflected amplitudes
//! for different incoming beam polarizations and eigenmodes
......
......@@ -29,6 +29,8 @@ public:
ISpecularInfoMap() {}
virtual ~ISpecularInfoMap() {}
virtual ISpecularInfoMap* clone() const=0;
//! Retrieves the amplitude coefficients for the given angles
virtual const ILayerRTCoefficients *getCoefficients(
double alhpa_f, double phi_f) const=0;
......
......@@ -31,6 +31,8 @@ public:
MatrixRTCoefficients() : m_kt(0.0) {}
virtual ~MatrixRTCoefficients() {}
virtual MatrixRTCoefficients* clone() const;
//! The following functions return the transmitted and reflected amplitudes
//! for different incoming beam polarizations and eigenmodes
virtual Eigen::Vector2cd T1plus() const;
......
......@@ -34,6 +34,8 @@ public:
double wavelength);
virtual ~MatrixSpecularInfoMap() {}
virtual MatrixSpecularInfoMap* clone() const;
//! Retrieves the amplitude coefficients for the given angles
virtual const MatrixRTCoefficients *getCoefficients(
double alpha_f, double phi_f) const;
......
......@@ -31,6 +31,8 @@ public:
ScalarRTCoefficients();
virtual ~ScalarRTCoefficients() {}
virtual ScalarRTCoefficients* clone() const;
//! The following functions return the transmitted and reflected amplitudes
//! for different incoming beam polarizations and eigenmodes
virtual Eigen::Vector2cd T1plus() const;
......@@ -72,6 +74,11 @@ inline ScalarRTCoefficients::ScalarRTCoefficients()
t_r << complex_t(1.0, 0.0), complex_t(0.0, 0.0);
}
inline ScalarRTCoefficients *ScalarRTCoefficients::clone() const
{
return new ScalarRTCoefficients(*this);
}
inline Eigen::Vector2cd ScalarRTCoefficients::T1plus() const
{
return Eigen::Vector2cd::Zero();
......
......@@ -34,6 +34,8 @@ public:
double wavelength);
virtual ~ScalarSpecularInfoMap() {}
virtual ScalarSpecularInfoMap* clone() const;
//! Retrieves the amplitude coefficients for the given angles
virtual const ScalarRTCoefficients *getCoefficients(
double alpha_f, double phi_f) const;
......
......@@ -22,8 +22,8 @@ LayerSpecularInfo::LayerSpecularInfo()
LayerSpecularInfo* LayerSpecularInfo::clone() const
{
LayerSpecularInfo *p_result = new LayerSpecularInfo;
p_result->mP_out_coeff_map = this->mP_out_coeff_map;
p_result->mP_in_coeffs = this->mP_in_coeffs;
p_result->mP_out_coeff_map.reset(this->mP_out_coeff_map->clone());
p_result->mP_in_coeffs.reset(this->mP_in_coeffs->clone());
return p_result;
}
......
......@@ -15,6 +15,11 @@
#include "MatrixRTCoefficients.h"
MatrixRTCoefficients *MatrixRTCoefficients::clone() const
{
return new MatrixRTCoefficients(*this);
}
void MatrixRTCoefficients::calculateTRMatrices()
{
if (m_b_mag == 0.0) {
......
......@@ -18,17 +18,24 @@
#include <boost/scoped_ptr.hpp>
MatrixSpecularInfoMap::MatrixSpecularInfoMap(const MultiLayer *multilayer, int layer,
double wavelength)
: m_layer(layer), m_wavelength(wavelength)
{
if (multilayer)
mP_inverted_multilayer.reset(multilayer->cloneInvertB());
}
MatrixSpecularInfoMap::MatrixSpecularInfoMap(const MultiLayer *multilayer,
int layer, double wavelength)
: m_layer(layer)
, m_wavelength(wavelength)
MatrixSpecularInfoMap *MatrixSpecularInfoMap::clone() const
{
mP_inverted_multilayer.reset(multilayer->cloneInvertB());
MatrixSpecularInfoMap *result = new MatrixSpecularInfoMap(0, m_layer, m_wavelength);
if (mP_inverted_multilayer.get())
result->mP_inverted_multilayer.reset(mP_inverted_multilayer->clone());
return result;
}
const MatrixRTCoefficients *MatrixSpecularInfoMap::getCoefficients(
double alpha_f, double phi_f) const
const MatrixRTCoefficients *MatrixSpecularInfoMap::getCoefficients(double alpha_f,
double phi_f) const
{
SpecularMagnetic specular_calculator;
SpecularMagnetic::MultiLayerCoeff_t coeffs;
......
......@@ -25,6 +25,11 @@ ScalarSpecularInfoMap::ScalarSpecularInfoMap(const MultiLayer *multilayer,
{
}
ScalarSpecularInfoMap *ScalarSpecularInfoMap::clone() const
{
return new ScalarSpecularInfoMap(mp_multilayer, m_layer, m_wavelength);
}
const ScalarRTCoefficients *ScalarSpecularInfoMap::getCoefficients(
double alpha_f, double phi_f) const
{
......
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