Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/bugfix/9939_Coverity_CurveFitting'
Browse files Browse the repository at this point in the history
  • Loading branch information
mantid-roman committed Jul 25, 2014
2 parents 2cf789d + ec214e6 commit 7936352
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 17 deletions.
1 change: 1 addition & 0 deletions Code/Mantid/Framework/API/src/IFunction.cpp
Expand Up @@ -53,6 +53,7 @@ namespace API
if (m_handler)
{
delete m_handler;
m_handler=NULL;
}
}

Expand Down
Expand Up @@ -58,6 +58,7 @@ namespace Mantid
CalculateGammaBackground::~CalculateGammaBackground()
{
delete m_progress;
m_indices.clear();
}

//--------------------------------------------------------------------------------------------------------
Expand Down
10 changes: 6 additions & 4 deletions Code/Mantid/Framework/CurveFitting/src/IkedaCarpenterPV.cpp
Expand Up @@ -64,10 +64,12 @@ void IkedaCarpenterPV::setHeight(const double h)
double IkedaCarpenterPV::height()const
{
// return the function value at centre()
double h0;
double toCentre = centre();
constFunction(&h0, &toCentre, 1);
return h0;
//using arrays - otherwise coverity warning
double h0[1];
double toCentre[1];
toCentre[0]= centre();
constFunction(h0, toCentre, 1);
return h0[0];
};

double IkedaCarpenterPV::fwhm()const
Expand Down
20 changes: 11 additions & 9 deletions Code/Mantid/Framework/CurveFitting/src/LeBailFit.cpp
Expand Up @@ -856,7 +856,7 @@ namespace CurveFitting
m_dampingFactor = getProperty("Damping");

tempindex = getProperty("NumberMinimizeSteps");
if (tempindex >= 0)
if (tempindex > 0)
m_numMinimizeSteps = static_cast<size_t>(tempindex);
else
{
Expand Down Expand Up @@ -2535,9 +2535,11 @@ namespace CurveFitting

// 2. Set up peak density
vector<double> peakdensity(vecRawX.size(), 1.0);
for (size_t ipk = 0; ipk < m_lebailFunction->getNumberOfPeaks(); ++ipk)
{
throw runtime_error("Need to figure out how to deal with this part!");
throw runtime_error("Need to figure out how to deal with this part!");

// for (size_t ipk = 0; ipk < m_lebailFunction->getNumberOfPeaks(); ++ipk)
// {

/* Below are original code for modifying from
ThermalNeutronBk2BkExpConvPVoigt_sptr thispeak = m_dspPeaks[ipk].second;
double height = thispeak->height();
Expand All @@ -2562,10 +2564,10 @@ namespace CurveFitting
for (int i = ileft; i <= iright; ++i)
{
peakdensity[i] += 1.0;
}
}
*/
}
}*/
// }

/*}
// FIXME : What is bk_prm2???
double bk_prm2 = 1.0;
Expand All @@ -2585,7 +2587,7 @@ namespace CurveFitting
background[i] = 0.0;
}
return;
return;*/
}

//----------------------------------------------------------------------------------------------
Expand Down
10 changes: 6 additions & 4 deletions Code/Mantid/Framework/CurveFitting/src/LeBailFunction.cpp
Expand Up @@ -655,8 +655,9 @@ namespace CurveFitting
void LeBailFunction::setPeakParameters(IPowderDiffPeakFunction_sptr peak, map<string, double > parammap,
double peakheight, bool setpeakheight)
{
UNUSED_ARG(peak); UNUSED_ARG(parammap); UNUSED_ARG(peakheight); UNUSED_ARG(setpeakheight);
throw runtime_error("Requiring update flag: peak value changed and etc.");

/*
// FIXME - The best solution for speeding is to have a set of peak parameter listed in the order
// of peak function's parameters' indexed. Then no need to do search anymore.
Expand Down Expand Up @@ -692,7 +693,7 @@ namespace CurveFitting
if (setpeakheight)
peak->setHeight(peakheight);
return;
return;*/
}

//----------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -1047,8 +1048,9 @@ namespace CurveFitting
*/
void LeBailFunction::setPeakHeights(std::vector<double> inheights)
{
UNUSED_ARG(inheights);
throw runtime_error("It is not implemented properly.");

/*
if (inheights.size() != heights.size())
{
g_log.error() << "Input number of peaks (height) is not same as peaks. " << std::endl;
Expand All @@ -1058,7 +1060,7 @@ namespace CurveFitting
for (size_t ih = 0; ih < inheights.size(); ++ih)
heights[ih] = inheights[ih];
return;
return;*/
}


Expand Down

0 comments on commit 7936352

Please sign in to comment.