Skip to content

Commit

Permalink
refs #3868. Various code analysis fixes.
Browse files Browse the repository at this point in the history
Removed (or commented out) unused variables.
Made use of boost isnan() instead of !=
  • Loading branch information
stuartcampbell committed Dec 30, 2011
1 parent 2821317 commit c37fda4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,7 @@ namespace Algorithms
spec2index_map * spec2indexmap = workspace->getSpectrumToWorkspaceIndexMap();

// 2. Check validity
bool userL1 = true;
if (l1 <= 0){
userL1 = false;
} else {
if (l1 > 0){
g_log.information() << "L1 = " << l1 << " # Detector = " << std::endl;
}

Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/Algorithms/src/PDFFT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void PDFFT::exec() {
double qmax = getProperty("Qmax");
double qmin = getProperty("Qmin");
std::string typeSofQ = getProperty("InputSofQType");
std::string typeGofR = getProperty("PDFType");
//std::string typeGofR = getProperty("PDFType");

// b) Process input, including defaults
double deltar;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ If no value is provided for either NaNValue, InfinityValue or BigValueThreshold
//----------------------------------------------------------------------
#include "MantidAlgorithms/ReplaceSpecialValues.h"
#include "MantidKernel/Exception.h"
#include "boost/math/special_functions/fpclassify.hpp"
#include <limits>
#include <cmath>

Expand Down Expand Up @@ -99,7 +100,7 @@ void ReplaceSpecialValues::performUnaryOperation(const double XIn, const double

bool ReplaceSpecialValues::checkIfNan(const double& value) const
{
return (value != value);
return (boost::math::isnan(value));
}

bool ReplaceSpecialValues::checkIfInfinite(const double& value) const
Expand Down
4 changes: 3 additions & 1 deletion Code/Mantid/Framework/Algorithms/src/TOFSANSResolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include "MantidKernel/ArrayProperty.h"
#include "MantidKernel/VectorHelper.h"

#include "boost/math/special_functions/fpclassify.hpp"

namespace Mantid
{
namespace Algorithms
Expand Down Expand Up @@ -164,7 +166,7 @@ void TOFSANSResolution::exec()

for (itev = el.getWeightedEvents().begin(); itev != itev_end; ++itev)
{
if ( itev->m_weight != itev->m_weight ) continue;
if ( boost::math::isnan(itev->m_weight) ) continue;
if (std::abs(itev->m_weight) == std::numeric_limits<double>::infinity()) continue;
if ( !isEmpty(min_wl) && itev->m_tof < min_wl ) continue;
if ( !isEmpty(max_wl) && itev->m_tof > max_wl ) continue;
Expand Down

0 comments on commit c37fda4

Please sign in to comment.