Merge pull request #1357 from ye-luo/cleanup-201103L

Cleanup C++11 guards
This commit is contained in:
Paul R. C. Kent 2019-02-04 11:43:00 -05:00 committed by GitHub
commit c35ef41625
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 14 additions and 105 deletions

View File

@ -640,9 +640,7 @@ IF(HDF5_FOUND)
ENDIF(ENABLE_PHDF5)
ENDIF(HDF5_IS_PARALLEL)
ELSE(HDF5_FOUND)
if(NOT QMC_PHI)
MESSAGE(FATAL_ERROR "Require hdf5 1.6.4 or higher. Set HDF5_ROOT")
endif()
MESSAGE(FATAL_ERROR "Require hdf5 1.6.4 or higher. Set HDF5_ROOT")
ENDIF(HDF5_FOUND)
#make sure we can find boost if it's not in /usr

View File

@ -28,13 +28,8 @@ namespace qmcplusplus
template<typename T, unsigned D>
struct VectorSoaContainer
{
#if (__cplusplus >= 201103L)
using Type_t =TinyVector<T,D>;
using Element_t=T;
#else
typedef TinyVector<T,D> Type_t;
typedef T Element_t;
#endif
/////alias to ParticleAttrib<T1,D>
//template <class T1> using PosArray = ParticleAttrib<TinyVector<T1,D> >;
///number of elements
@ -78,7 +73,6 @@ namespace qmcplusplus
return *this;
}
#if (__cplusplus >= 201103L)
///move constructor
VectorSoaContainer(VectorSoaContainer&& in): nLocal(in.nLocal),nGhosts(in.nGhosts)
{
@ -88,7 +82,6 @@ namespace qmcplusplus
in.myData=nullptr;
in.nAllocated=0;
}
#endif
/** constructor with size n without initialization
*/

View File

@ -198,19 +198,11 @@ struct NRCOptimization
qmcplusplus::invert_matrix(S, false);
qmcplusplus::MatrixOperators::product(S, &(y[0]), &(coefs[0]));
Lambda = QuarticMinimum (coefs);
#if (__cplusplus >= 201103L)
if (std::abs(Lambda) > largeQuarticStep || std::isnan(Lambda))
return lineoptimization2();
cost = Func(Lambda);
if (std::isnan(cost) || cost > start_cost)
return lineoptimization2();
#else
if (std::abs(Lambda) > largeQuarticStep || isnan(Lambda))
return lineoptimization2();
cost = Func(Lambda);
if (isnan(cost) || cost > start_cost)
return lineoptimization2();
#endif
}
else
{
@ -321,21 +313,12 @@ struct NRCOptimization
{
qmcplusplus::LinearFit(y,S,coefs);
Lambda = QuarticMinimum (coefs);
#if (__cplusplus >= 201103L)
if (std::abs(Lambda) > largeQuarticStep || std::isnan(Lambda) || (Lambda==0.0))
return lineoptimization2(largeQuarticStep);
zeroCost = Func(Lambda);
// std::cout <<"Start Cost:"<< start_cost<<" Lambda:"<<Lambda<<" FinalCost:"<<cost<< std::endl;
if (std::isnan(zeroCost) || zeroCost > start_cost)
return lineoptimization2(largeQuarticStep);
#else
if (std::abs(Lambda) > largeQuarticStep || isnan(Lambda) || (Lambda==0.0))
return lineoptimization2(largeQuarticStep);
zeroCost = Func(Lambda);
// std::cout <<"Start Cost:"<< start_cost<<" Lambda:"<<Lambda<<" FinalCost:"<<cost<< std::endl;
if (isnan(zeroCost) || zeroCost > start_cost)
return lineoptimization2(largeQuarticStep);
#endif
}
else
{

View File

@ -79,7 +79,7 @@ struct DistanceTableData
* k = copies (walkers) index.
*/
enum {WalkerIndex=0, SourceIndex, VisitorIndex, PairIndex};
#if (__cplusplus >= 201103L)
using IndexType=QMCTraits::IndexType;
using RealType=QMCTraits::RealType;
using PosType=QMCTraits::PosType;
@ -87,15 +87,6 @@ struct DistanceTableData
using TempDistType=TempDisplacement<RealType,DIM>;
using ripair=std::pair<RealType,IndexType>;
using RowContainer=VectorSoaContainer<RealType,DIM>;
#else
typedef QMCTraits::IndexType IndexType;
typedef QMCTraits::RealType RealType;
typedef QMCTraits::PosType PosType;
typedef aligned_vector<IndexType> IndexVectorType;
typedef TempDisplacement<RealType,DIM> TempDistType;
typedef std::pair<RealType,IndexType> ripair;
typedef VectorSoaContainer<RealType,DIM> RowContainer;
#endif
///type of cell
int CellType;

View File

@ -33,10 +33,8 @@ struct SoaDistanceTableAA: public DTD_BConds<T,D,SC>, public DistanceTableData
resize(target.getTotalNum());
}
#if (__cplusplus >= 201103L)
SoaDistanceTableAA()=delete;
SoaDistanceTableAA(const SoaDistanceTableAA&)=delete;
#endif
~SoaDistanceTableAA() {}
size_t compute_size(int N)

View File

@ -54,10 +54,8 @@ struct SoaDistanceTableBA: public DTD_BConds<T,D,SC>, public DistanceTableData
Temp_dr.resize(Nsources);
}
#if (__cplusplus >= 201103L)
SoaDistanceTableBA()=delete;
SoaDistanceTableBA(const SoaDistanceTableBA&)=delete;
#endif
~SoaDistanceTableBA() {}
/** evaluate the full table */

View File

@ -31,16 +31,10 @@ public:
void advanceWalker(Walker_t& thisWalker, bool recompute);
#if (__cplusplus >= 201103L)
DMCUpdateAllWithRejection(const DMCUpdateAllWithRejection& a)=delete;
DMCUpdateAllWithRejection& operator=(const DMCUpdateAllWithRejection&)=delete;
#else
private:
/// Copy Constructor (disabled)
DMCUpdateAllWithRejection(const DMCUpdateAllWithRejection &) = delete;
DMCUpdateAllWithRejection(const DMCUpdateAllWithRejection&) = delete;
/// Copy operator (disabled).
DMCUpdateAllWithRejection & operator=(const DMCUpdateAllWithRejection &) = delete;
#endif
DMCUpdateAllWithRejection& operator=(const DMCUpdateAllWithRejection&) = delete;
};
class DMCUpdateAllWithKill: public QMCUpdateBase
@ -55,16 +49,10 @@ public:
void advanceWalker(Walker_t& thisWalker, bool recompute);
#if (__cplusplus >= 201103L)
DMCUpdateAllWithKill(const DMCUpdateAllWithKill& a)=delete;
DMCUpdateAllWithKill& operator=(const DMCUpdateAllWithKill&)=delete;
#else
private:
/// Copy Constructor (disabled)
DMCUpdateAllWithKill(const DMCUpdateAllWithKill &) = delete;
DMCUpdateAllWithKill(const DMCUpdateAllWithKill&) = delete;
/// Copy operator (disabled).
DMCUpdateAllWithKill & operator=(const DMCUpdateAllWithKill &) = delete;
#endif
DMCUpdateAllWithKill& operator=(const DMCUpdateAllWithKill&) = delete;
};
}

View File

@ -42,15 +42,9 @@ namespace qmcplusplus
template<typename ST, unsigned D>
struct SplineAdoptorBase
{
#if (__cplusplus >= 201103L)
using PointType=TinyVector<ST,D>;
using SingleSplineType=UBspline_3d_d;
using DataType=ST;
#else
typedef TinyVector<ST,D> PointType;
typedef UBspline_3d_d SingleSplineType;
typedef ST DataType;
#endif
///true if the computed values are complex
bool is_complex;
///true, if it has only one k point and Gamma
@ -89,9 +83,7 @@ struct SplineAdoptorBase
MyIndex(0),nunique_orbitals(0),first_spo(0),last_spo(0)
{ }
#if (__cplusplus >= 201103L)
SplineAdoptorBase(const SplineAdoptorBase& rhs)=default;
#endif
inline void init_base(int n)
{

View File

@ -185,18 +185,7 @@ struct PolynomialFunctor3D: public OptimizableFunctorBase
IndepVar[col] = true;
}
while (max_abs < 1.0e-6);
#if ( ( __INTEL_COMPILER == 1700 ) && ( __cplusplus < 201103L ) )
// the swap_rows is sick with Intel compiler 17 update 1, c++11 off
// manually swap the rows
for(int ind_col=0; ind_col<ConstraintMatrix.size2(); ind_col++)
{
real_type temp = ConstraintMatrix(row,ind_col);
ConstraintMatrix(row,ind_col) = ConstraintMatrix(max_loc,ind_col);
ConstraintMatrix(max_loc,ind_col) = temp;
}
#else
ConstraintMatrix.swap_rows(row,max_loc);
#endif
real_type lead_inv = 1.0/ConstraintMatrix(row,col);
for (int c=0; c<NumGamma; c++)
ConstraintMatrix(row,c) *= lead_inv;

View File

@ -51,9 +51,7 @@ struct SoaSphericalTensor
explicit SoaSphericalTensor(const int l_max, bool addsign=false);
#if (__cplusplus >= 201103L)
SoaSphericalTensor(const SoaSphericalTensor& rhs)=default;
#endif
///compute Ylm
void evaluate_bare(T x, T y, T z, T* Ylm) const;

View File

@ -458,8 +458,6 @@ template <class T> struct TimerIDName_t
const std::string name;
};
// C++ 11 type aliasing
#if __cplusplus >= 201103L
template <class T> using TimerNameList_t = std::vector<TimerIDName_t<T>>;
template <class T> void setup_timers(TimerList_t &timers, TimerNameList_t<T> timer_list,
@ -471,7 +469,6 @@ template <class T> void setup_timers(TimerList_t &timers, TimerNameList_t<T> tim
timers[timer_list[i].id] = TimerManager.createTimer(timer_list[i].name, timer_level);
}
}
#endif
struct TimerComparator

View File

@ -88,9 +88,7 @@ extern RandomGenerator_t Random;
#include "Utilities/BoostRandom.h"
namespace qmcplusplus
{
#if (__cplusplus>=201103L)
template<class T> using RandomGenerator=BoostRandom<T>;
#endif
typedef BoostRandom<OHMMS_PRECISION_FULL> RandomGenerator_t;
extern RandomGenerator_t Random;
}

View File

@ -391,7 +391,6 @@ TEST_CASE("test max exceeded message")
}
#endif
#if __cplusplus >=201103l
// Define a list of timers indexed by an enum
// First, define an enum with the timers
enum TestTimer
@ -423,6 +422,5 @@ TEST_CASE("test setup timers","[utilities]")
REQUIRE(Timers[MyTimer1]->get_num_calls() == 1);
#endif
}
#endif
}

View File

@ -188,9 +188,9 @@
/* Use SOA version of AA distance table */
#cmakedefine ENABLE_SOA @ENABLE_SOA@
#if (__cplusplus >= 201103L)
#if defined(__cplusplus)
#if defined(__INTEL_COMPILER)
#if defined(__KNC__) || defined(__AVX512F__)
#if defined(__AVX512F__)
#define QMC_CLINE 64
#define QMC_ALIGNAS alignas(64)
#define ASSUME_ALIGNED(x) __assume_aligned(x,64)
@ -210,13 +210,13 @@
#define ASSUME_ALIGNED(x) (x) = (__typeof__(x)) __builtin_assume_aligned(x,32)
#endif
#else
#define QMC_CLINE 32
#define QMC_ALIGNAS
#define ASSUME_ALIGNED(x)
#define QMC_CLINE 32
#define QMC_ALIGNAS alignas(32)
#define ASSUME_ALIGNED(x)
#endif
#else //capture both C or non-c++11
#if defined(__KNC__) || defined(__AVX512F__)
#else //capture C
#if defined(__AVX512F__)
#define QMC_CLINE 64
#else
#define QMC_CLINE 32

View File

@ -14,7 +14,6 @@
#define QMCPLUSPLUS_COULOMB_TYPE_HPP
#include <config.h>
//model to implement the mixed precision
#if (__cplusplus >= 201103L)
#define DECLARE_COULOMB_TYPES \
using pRealType=OHMMS_PRECISION; \
@ -23,15 +22,4 @@
using mComplexType=std::complex<OHMMS_PRECISION_FULL>; \
using PosType=TinyVector<pRealType,OHMMS_DIM>;
#else
#define DECLARE_COULOMB_TYPES \
typedef OHMMS_PRECISION pRealType; \
typedef OHMMS_PRECISION_FULL mRealType; \
typedef std::complex<pRealType> pComplexType; \
typedef std::complex<OHMMS_PRECISION_FULL> mComplexType; \
typedef TinyVector<pRealType,OHMMS_DIM> PosType;
#endif
#endif

View File

@ -23,7 +23,7 @@
namespace qmcplusplus
{
///enumeration for main computing devices
enum {SMP=0, CUDA=1, PHI=2};
enum {SMP=0, CUDA=1};
/** class to definte global variables to keep track a run
*/