Skip to content

Commit

Permalink
Merge pull request #65 from mantidproject/feature/10507_fix_clang_war…
Browse files Browse the repository at this point in the history
…nings_alt

Feature/10507 fix clang warnings
  • Loading branch information
peterfpeterson committed Nov 14, 2014
2 parents b55d91b + 7804864 commit 53b6221
Show file tree
Hide file tree
Showing 69 changed files with 131 additions and 309 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,6 @@ class MANTID_API_DLL IPowderDiffPeakFunction : public virtual API::ParamFunction

size_t LATTICEINDEX;
size_t HEIGHTINDEX;

private:
/// Peak intensity
double m_intensity;

};

typedef boost::shared_ptr<IPowderDiffPeakFunction> IPowderDiffPeakFunction_sptr;
Expand Down
11 changes: 10 additions & 1 deletion Code/Mantid/Framework/API/test/WorkspaceFactoryTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,16 @@ class WorkspaceFactoryTest : public CxxTest::TestSuite
WorkspaceFactory::Instance().subscribe<WorkspaceTester>("work");
MatrixWorkspace_sptr space;
TS_ASSERT_THROWS_NOTHING( space = WorkspaceFactory::Instance().create("work",1,1,1) );
TS_ASSERT_THROWS_NOTHING( dynamic_cast<WorkspaceTester*>(space.get()) );
// AppleClang gives warning if the result is unused.
#if __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-value"
#endif
TS_ASSERT_THROWS_NOTHING(dynamic_cast<WorkspaceTester*>(space.get()) );
#if __clang__
#pragma clang diagnostic pop
#endif

}

/** Make a parent, have the child be created with the same sizes */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ class DLLExport CreateCalFileByNames : public API::Algorithm
std::string groups;
/// Calibration map used if the *.cal file exist. All entries in the *.cal file are registered with the udet number as the key and the <Number,Offset,Select,Group> as the tuple value.
instrcalmap instrcalib;
/// Number of groups
int group_no;
};

} // namespace Algorithms
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ class DLLExport CreateDummyCalFile : public API::Algorithm
std::string groups;
/// Calibration map used if the *.cal file exist. All entries in the *.cal file are registered with the udet number as the key and the <Number,Offset,Select,Group> as the tuple value.
instrcalmap instrcalib;
/// Number of groups
int group_no;
};

} // namespace Algorithms
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,6 @@ namespace Algorithms

/// Input workspace type
bool m_inputIsMask;

/// Minimum X range
double m_XMin;

/// Maximum X range
double m_XMax;

};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ class DLLExport NormaliseByCurrent : public API::Algorithm
void exec();
// Extract the charge value from the logs.
double extractCharge(boost::shared_ptr<Mantid::API::MatrixWorkspace> inputWs) const;
/// Progress reporting
API::Progress* m_progress;

};

} // namespace Algorithm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,6 @@ class DLLExport SmoothNeighbours : public API::Algorithm
static const std::string RECTANGULAR_GROUP;
/// Input workspace name
static const std::string INPUT_WORKSPACE;

/// Pixels in the detector
int XPixels;
/// Pixels in the detector
int YPixels;

/// Number to sum
int AdjX;
/// Number to sum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@ class DLLExport SumNeighbours : public API::Algorithm
// Overridden Algorithm methods
void init();
void exec();

/// Pixels in the detector
int XPixels;
/// Pixels in the detector
int YPixels;

/// Number to sum
int SumX;
/// Number to sum
Expand Down
9 changes: 3 additions & 6 deletions Code/Mantid/Framework/Algorithms/src/CheckWorkspacesMatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,9 @@ bool CheckWorkspacesMatch::compareEventWorkspaces(DataObjects::EventWorkspace_co
size_t numUnequalBothEvents = 0;

std::vector<int> vec_mismatchedwsindex;
bool condition = m_ParallelComparison && ews1->threadSafe() && ews2->threadSafe() ;
PARALLEL_FOR_IF(condition)
PARALLEL_FOR_IF(m_ParallelComparison && ews1->threadSafe() && ews2->threadSafe())
for (int i=0; i<static_cast<int>(ews1->getNumberHistograms()); ++i)
for (int i=0; i<static_cast<int>(ews1->getNumberHistograms()); i++)
{
{
PARALLEL_START_INTERUPT_REGION
prog->report("EventLists");
if (!mismatchedEvent || checkallspectra) // This guard will avoid checking unnecessarily
Expand Down Expand Up @@ -527,8 +525,7 @@ bool CheckWorkspacesMatch::checkData(API::MatrixWorkspace_const_sptr ws1, API::M
bool resultBool = true;

// Now check the data itself
bool condition = m_ParallelComparison && ws1->threadSafe() && ws2->threadSafe() ;
PARALLEL_FOR_IF(condition)
PARALLEL_FOR_IF(m_ParallelComparison && ws1->threadSafe() && ws2->threadSafe())
for ( long i = 0; i < static_cast<long>(numHists); ++i )
{
PARALLEL_START_INTERUPT_REGION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace Mantid
using API::FileProperty;
using Geometry::Instrument_const_sptr;

CreateCalFileByNames::CreateCalFileByNames():API::Algorithm(),group_no(0)
CreateCalFileByNames::CreateCalFileByNames():API::Algorithm()
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace Mantid
using namespace Geometry;
using namespace DataObjects;

CreateDummyCalFile::CreateDummyCalFile():API::Algorithm(),group_no(0)
CreateDummyCalFile::CreateDummyCalFile():API::Algorithm()
{
}

Expand Down
41 changes: 0 additions & 41 deletions Code/Mantid/Framework/Algorithms/src/GeneratePeaks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,47 +28,6 @@ namespace Mantid
{
namespace Algorithms
{
namespace
{ // anonymous name space
/**
* Determine if the table contains raw parameters.
*/
bool isRawTable(const std::vector<std::string> & colNames)
{
if (colNames.size() != 6)
return true;
if (colNames[0].compare("centre") != 0)
return true;
if (colNames[1].compare("width") != 0)
return true;
if (colNames[2].compare("height") != 0)
return true;
if (colNames[3].compare("backgroundintercept") != 0)
return true;
if (colNames[4].compare("backgroundslope") != 0)
return true;
if (colNames[5].compare("A2") != 0)
return true;
return false;
}

/**
* Determine how many parameters are in the peak function.
*/
std::size_t getBkgOffset(const std::vector<std::string> & colNames, const bool isRaw)
{
if (!isRaw)
return 3;

for (std::size_t i = 0; i < colNames.size(); i++)
{
if (colNames[i].substr(0,3).compare("f1.") == 0)
return i;
}
return colNames.size(); // shouldn't get here
}
}

DECLARE_ALGORITHM(GeneratePeaks)

//----------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1678,8 +1678,7 @@ namespace Mantid
workspaceIndex= wi_to_detid_map.find(DetID)->second;
else
{
g_log.error("No workspaceIndex for detID="+DetID);
throw std::runtime_error("No workspaceIndex for detID="+DetID);
throw std::runtime_error("No workspaceIndex for detID="+boost::lexical_cast<std::string>(DetID));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ namespace Mantid
Kernel::V3D m_beamDir; // Directional vector for beam
double m_srcR2; // beam penumbra radius (m)
double m_halfSampleHeight, m_halfSampleWidth, m_halfSampleThick; // (m)
double m_maxWidthSampleFrame; // Maximum width in sample frame (m)
Geometry::Object const *m_sampleShape; // sample shape
SampleComptonProperties *m_sampleProps; // description of sample properties
double m_detHeight, m_detWidth, m_detThick; // (m)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class DLLExport DampingMinimizer : public API::IFuncMinimizer
{
public:
/// Constructor
DampingMinimizer();
DampingMinimizer(double relTol = 0.0001);
/// Name of the minimizer.
std::string name() const {return "DampingMinimizer";}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@ namespace CurveFitting

/// Background origin position
double m_bkpos;

/// Lower x boundary.
double m_StartX;

/// Upper x boundary
double m_EndX;
};

typedef boost::shared_ptr<FullprofPolynomial> FullprofPolynomial_sptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@ namespace CurveFitting

/// Polynomial order
int m_n;

/// Lower x boundary.
double m_StartX;

/// Upper x boundary
double m_EndX;
};

typedef boost::shared_ptr<Polynomial> Polynomial_sptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace Mantid
{
public:
/// Constructor
UserFunction1D():m_x_set(false),m_parameters(new double[100]),m_buffSize(100),m_nPars(0) {};
UserFunction1D():m_x_set(false),m_parameters(new double[100]),m_nPars(0) {};
/// Destructor
virtual ~UserFunction1D() {};
/// Algorithm's name for identification overriding a virtual method
Expand Down Expand Up @@ -99,8 +99,6 @@ namespace Mantid
bool m_x_set;
/// Pointer to muParser variables' buffer
boost::shared_array<double> m_parameters;
/// Size of the variables' buffer
const int m_buffSize;
/// Number of actual parameters
int m_nPars;
/// Temporary data storage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace Mantid
m_randgen(NULL),
m_acrossIdx(0), m_upIdx(1), m_beamIdx(3), m_beamDir(), m_srcR2(0.0),
m_halfSampleHeight(0.0), m_halfSampleWidth(0.0), m_halfSampleThick(0.0),
m_maxWidthSampleFrame(0.0), m_sampleShape(NULL), m_sampleProps(NULL),
m_sampleShape(NULL), m_sampleProps(NULL),
m_detHeight(-1.0), m_detWidth(-1.0), m_detThick(-1.0),
m_tmin(-1.0), m_tmax(-1.0), m_delt(-1.0), m_foilRes(-1.0),
m_nscatters(0), m_nruns(0), m_nevents(0),
Expand Down
8 changes: 3 additions & 5 deletions Code/Mantid/Framework/CurveFitting/src/DampingMinimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ DECLARE_FUNCMINIMIZER(DampingMinimizer,Damping)


/// Constructor
DampingMinimizer::DampingMinimizer():
IFuncMinimizer(),
m_relTol(1e-6)
DampingMinimizer::DampingMinimizer(double relTol):
IFuncMinimizer(), m_relTol(relTol)
{
declareProperty("Damping",0.0,"The damping parameter.");
}
Expand Down Expand Up @@ -114,8 +113,7 @@ bool DampingMinimizer::iterate(size_t)
GSLVector p(n);
m_leastSquares->getParameters(p);
double dx_norm = gsl_blas_dnrm2(dx.gsl());
//double p_norm = gsl_blas_dnrm2(p.gsl());
if (dx_norm < 0.0001)
if (dx_norm < m_relTol)
{
return false;
}
Expand Down
7 changes: 1 addition & 6 deletions Code/Mantid/Framework/CurveFitting/src/Fit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,7 @@ namespace CurveFitting
// Register the class into the algorithm factory
DECLARE_ALGORITHM(Fit)

using API::IDomainCreator;

namespace
{
bool isStringEmpty(const std::string& str){return str.empty();}
}
using API::IDomainCreator;

/**
* Examine "Function" and "InputWorkspace" properties to decide which domain creator to use.
Expand Down
3 changes: 1 addition & 2 deletions Code/Mantid/Framework/CurveFitting/src/FitMW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace
{
public:
/// Constructor
SimpleJacobian(size_t nData,size_t nParams):m_nData(nData),m_nParams(nParams),m_data(nData*nParams){}
SimpleJacobian(size_t nData,size_t nParams):m_nParams(nParams),m_data(nData*nParams){}
/// Setter
virtual void set(size_t iY, size_t iP, double value)
{
Expand All @@ -47,7 +47,6 @@ namespace
return m_data[iY * m_nParams + iP];
}
private:
size_t m_nData; ///< size of the data / first dimension
size_t m_nParams; ///< number of parameters / second dimension
std::vector<double> m_data; ///< data storage
};
Expand Down
2 changes: 0 additions & 2 deletions Code/Mantid/Framework/CurveFitting/src/LeBailFit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ const int CALDATAINDEX(1);
const int DATADIFFINDEX(2);
const int CALPUREPEAKINDEX(3);
const int CALBKGDINDEX(4); // Output workspace background at ws index 4
const int INPUTCALDATAINDEX(5);
const int INPUTBKGDINDEX(6); // Input background
const int INPUTPUREPEAKINDEX(7); // Output workspace: pure peak (data with background removed)
const int SMOOTHEDBKGDINDEX(8); // Smoothed background

const double NEG_DBL_MAX(-1.*DBL_MAX);
const double NOBOUNDARYLIMIT(1.0E10);
const double EPSILON(1.0E-10);

Expand Down
1 change: 0 additions & 1 deletion Code/Mantid/Framework/CurveFitting/src/LeBailFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ namespace CurveFitting
{
namespace
{
const int PEAKRADIUS = 8;
const double PEAKRANGECONSTANT = 5.0;

const string CHEBYSHEV_BACKGROUND("Chebyshev");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ bool SimplexMinimizer::iterate(size_t)
return false;
}
double size = gsl_multimin_fminimizer_size(m_gslSolver);
status = gsl_multimin_test_size(size, 1e-6);
status = gsl_multimin_test_size(size,m_epsabs);
if (status != GSL_CONTINUE)
{
m_errorString = gsl_strerror(status);
Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/CurveFitting/test/UserFunctionTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ class UserFunctionTest : public CxxTest::TestSuite

class UserTestJacobian: public Jacobian
{
int m_nData,m_nParams;
int m_nParams;
std::vector<double> m_buffer;
public:
UserTestJacobian(int nData,int nParams)
:m_nData(nData),m_nParams(nParams)
: m_nParams(nParams)
{
m_buffer.resize(nData*nParams);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ namespace Mantid

/// Read in the time bin boundaries
int64_t m_lengthIn;
/// boolean for list spectra options
bool m_bmspeclist;
/// time channels vector
std::vector<boost::shared_ptr<MantidVec> > m_timeChannelsVec;
/// total number of specs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ namespace Mantid

/// Read in the time bin boundaries
int64_t m_lengthIn;
/// boolean for list spectra options
bool m_bmspeclist;
/// TimeSeriesProperty<int> containing data periods.
boost::shared_ptr<Kernel::Property> m_perioids;

Expand Down

0 comments on commit 53b6221

Please sign in to comment.