Commit 623a8b06 authored by Dave Moxey's avatar Dave Moxey

Merge branch 'feature/boost-std-cleanup' into 'master'

Propagate C++11 throughout Nektar++

See merge request !795
parents 1d1e6195 c907cf33
......@@ -177,10 +177,6 @@ IF (${CMAKE_COMPILER_IS_GNUCXX})
MARK_AS_ADVANCED(NEKTAR_ENABLE_PROFILE)
ENDIF (${CMAKE_COMPILER_IS_GNUCXX})
OPTION(NEKTAR_USE_EXPRESSION_TEMPLATES
"Use Expression templates." OFF)
MARK_AS_ADVANCED(NEKTAR_USE_EXPRESSION_TEMPLATES)
# BLAS Support
CMAKE_DEPENDENT_OPTION(NEKTAR_USE_SYSTEM_BLAS_LAPACK
"Use the system provided blas and lapack libraries" ON
......@@ -282,10 +278,6 @@ IF( NEKTAR_USE_TINYXML_STL )
ADD_DEFINITIONS( -DTIXML_USE_STL)
ENDIF( NEKTAR_USE_TINYXML_STL )
IF( NEKTAR_USE_EXPRESSION_TEMPLATES )
ADD_DEFINITIONS(-DNEKTAR_USE_EXPRESSION_TEMPLATES -DNEKTAR_USING_CMAKE)
ENDIF( NEKTAR_USE_EXPRESSION_TEMPLATES )
IF( NEKTAR_USE_MEMORY_POOLS )
ADD_DEFINITIONS(-DNEKTAR_MEMORY_POOL_ENABLED)
ELSE( NEKTAR_USE_MEMORY_POOLS )
......
......@@ -9,8 +9,7 @@
#If the user has not set BOOST_ROOT, look in a couple common places first.
MESSAGE(STATUS "Searching for Boost:")
SET(MIN_VER "1.56.0")
SET(NEEDED_BOOST_LIBS thread iostreams date_time filesystem system
program_options regex)
SET(NEEDED_BOOST_LIBS thread iostreams filesystem system program_options regex)
SET(Boost_DEBUG 0)
SET(Boost_NO_BOOST_CMAKE ON)
IF( BOOST_ROOT )
......
......@@ -72,7 +72,7 @@ class CoalescedGeomData
std::map<GeomData,Array<TwoD, NekDouble> > m_twoDGeomData;
};
typedef boost::shared_ptr<CoalescedGeomData> CoalescedGeomDataSharedPtr;
typedef std::shared_ptr<CoalescedGeomData> CoalescedGeomDataSharedPtr;
static CoalescedGeomDataSharedPtr GeomDataNull;
......
......@@ -48,8 +48,6 @@ Collection::Collection(
vector<StdRegions::StdExpansionSharedPtr> pCollExp,
OperatorImpMap &impTypes)
{
OperatorImpMap::iterator it;
// Initialise geometry data.
m_geomData = MemoryManager<CoalescedGeomData>::AllocateSharedPtr();
......@@ -59,7 +57,8 @@ Collection::Collection(
OperatorType opType = (OperatorType)i;
ImplementationType impType;
if ((it = impTypes.find(opType)) != impTypes.end())
auto it = impTypes.find(opType);
if (it != impTypes.end())
{
impType = it->second;
OperatorKey opKey(pCollExp[0]->DetShapeType(), opType, impType,
......
......@@ -38,18 +38,16 @@
#include <vector>
#include <LibUtilities/BasicUtils/HashUtils.hpp>
#include <StdRegions/StdExpansion.h>
#include <SpatialDomains/Geometry.h>
#include <Collections/CollectionsDeclspec.h>
#include <Collections/Operator.h>
#include <Collections/CoalescedGeomData.h>
#include <boost/unordered_map.hpp>
namespace Nektar {
namespace Collections {
/**
* @brief Collection
*/
......@@ -88,15 +86,15 @@ class Collection
inline bool HasOperator(const OperatorType &op);
protected:
StdRegions::StdExpansionSharedPtr m_stdExp;
std::vector<SpatialDomains::GeometrySharedPtr> m_geom;
boost::unordered_map<OperatorType, OperatorSharedPtr> m_ops;
CoalescedGeomDataSharedPtr m_geomData;
StdRegions::StdExpansionSharedPtr m_stdExp;
std::vector<SpatialDomains::GeometrySharedPtr> m_geom;
std::unordered_map<OperatorType, OperatorSharedPtr, EnumHash> m_ops;
CoalescedGeomDataSharedPtr m_geomData;
};
typedef std::vector<Collection> CollectionVector;
typedef boost::shared_ptr<CollectionVector> CollectionVectorSharedPtr;
typedef std::shared_ptr<CollectionVector> CollectionVectorSharedPtr;
/**
......
......@@ -51,9 +51,7 @@ CollectionOptimisation::CollectionOptimisation(
ImplementationType defaultType)
{
int i;
map<ElmtOrder, ImplementationType> defaults;
map<ElmtOrder, ImplementationType> defaultsPhysDeriv;
map<ElmtOrder, ImplementationType>::iterator it;
map<ElmtOrder, ImplementationType> defaults, defaultsPhysDeriv;
bool verbose = (pSession.get()) &&
(pSession->DefinesCmdLineArgument("verbose")) &&
(pSession->GetComm()->GetRank() == 0);
......@@ -64,7 +62,6 @@ CollectionOptimisation::CollectionOptimisation(
m_defaultType = defaultType == eNoImpType ? eIterPerExp : defaultType;
map<string, LibUtilities::ShapeType> elTypes;
map<string, LibUtilities::ShapeType>::iterator it2;
elTypes["S"] = LibUtilities::eSegment;
elTypes["T"] = LibUtilities::eTriangle;
elTypes["Q"] = LibUtilities::eQuadrilateral;
......@@ -74,29 +71,29 @@ CollectionOptimisation::CollectionOptimisation(
elTypes["H"] = LibUtilities::eHexahedron;
// Set defaults for all element types.
for (it2 = elTypes.begin(); it2 != elTypes.end(); ++it2)
for (auto &it2 : elTypes)
{
defaults [ElmtOrder(it2->second, -1)] = m_defaultType;
defaultsPhysDeriv [ElmtOrder(it2->second, -1)] = m_defaultType;
defaults [ElmtOrder(it2.second, -1)] = m_defaultType;
defaultsPhysDeriv [ElmtOrder(it2.second, -1)] = m_defaultType;
}
if (defaultType == eNoImpType)
{
for (it2 = elTypes.begin(); it2 != elTypes.end(); ++it2)
for (auto &it2 : elTypes)
{
// For 1<=N<=5 use StdMat otherwise IterPerExp or given default type
for (int i = 1; i < 5; ++i)
{
defaults[ElmtOrder(it2->second, i)] = eStdMat;
defaults[ElmtOrder(it2.second, i)] = eStdMat;
}
// For 1<=N<=3 use SumFac otherwise NoCollection. Note that
// default is not currently overwritten by given default
// type
defaultsPhysDeriv [ElmtOrder(it2->second, -1)] = eNoCollection;
defaultsPhysDeriv [ElmtOrder(it2.second, -1)] = eNoCollection;
for (int i = 1; i < 3; ++i)
{
defaultsPhysDeriv[ElmtOrder(it2->second, i)] = eSumFac;
defaultsPhysDeriv[ElmtOrder(it2.second, i)] = eSumFac;
}
}
}
......@@ -164,9 +161,9 @@ CollectionOptimisation::CollectionOptimisation(
defaults.clear();
// Override default types
for (it2 = elTypes.begin(); it2 != elTypes.end(); ++it2)
for (auto &it2 : elTypes)
{
defaults[ElmtOrder(it2->second, -1)] = m_defaultType;
defaults[ElmtOrder(it2.second, -1)] = m_defaultType;
}
for (i = 0; i < SIZE_OperatorType; ++i)
......@@ -210,7 +207,7 @@ CollectionOptimisation::CollectionOptimisation(
ASSERTL0(attr, "Missing TYPE in ELEMENT tag.");
string elType(attr);
it2 = elTypes.find(elType);
auto it2 = elTypes.find(elType);
ASSERTL0(it2 != elTypes.end(),
"Unknown element type "+elType+" in ELEMENT "
"tag");
......@@ -260,21 +257,17 @@ CollectionOptimisation::CollectionOptimisation(
if (m_setByXml)
{
map<OperatorType, map<ElmtOrder,
ImplementationType> >::iterator mIt;
map<ElmtOrder, ImplementationType>::iterator eIt;
for (mIt = m_global.begin(); mIt != m_global.end(); mIt++)
for (auto &mIt : m_global)
{
cout << "Operator " << OperatorTypeMap[mIt->first]
<< ":" << endl;
cout << "Operator " << OperatorTypeMap[mIt.first]
<< ":" << endl;
for (eIt = mIt->second.begin();
eIt != mIt->second.end(); eIt++)
for (auto &eIt : mIt.second)
{
cout << "- "
<< LibUtilities::ShapeTypeMap[eIt->first.first]
<< " order " << eIt->first.second << " -> "
<< ImplementationTypeMap[eIt->second] << endl;
<< LibUtilities::ShapeTypeMap[eIt.first.first]
<< " order " << eIt.first.second << " -> "
<< ImplementationTypeMap[eIt.second] << endl;
}
}
}
......@@ -286,24 +279,21 @@ CollectionOptimisation::CollectionOptimisation(
OperatorImpMap CollectionOptimisation::GetOperatorImpMap(
StdRegions::StdExpansionSharedPtr pExp)
{
map<OperatorType, map<ElmtOrder, ImplementationType> >::iterator it;
map<ElmtOrder, ImplementationType>::iterator it2;
OperatorImpMap ret;
ElmtOrder searchKey(pExp->DetShapeType(),
pExp->GetBasisNumModes(0));
ElmtOrder defSearch(pExp->DetShapeType(), -1);
for (it = m_global.begin(); it != m_global.end(); ++it)
for (auto &it : m_global)
{
ImplementationType impType;
it2 = it->second.find(searchKey);
auto it2 = it.second.find(searchKey);
if (it2 == it->second.end())
if (it2 == it.second.end())
{
it2 = it->second.find(defSearch);
if (it2 == it->second.end())
it2 = it.second.find(defSearch);
if (it2 == it.second.end())
{
// Shouldn't be able to reach here.
impType = eNoCollection;
......@@ -318,7 +308,7 @@ OperatorImpMap CollectionOptimisation::GetOperatorImpMap(
impType = it2->second;
}
ret[it->first] = impType;
ret[it.first] = impType;
}
return ret;
......
......@@ -44,36 +44,36 @@ namespace Collections {
*/
bool operator< (OperatorKey const &p1, OperatorKey const &p2)
{
if (boost::get<0>(p1) < boost::get<0>(p2))
if (std::get<0>(p1) < std::get<0>(p2))
{
return true;
}
if (boost::get<0>(p1) > boost::get<0>(p2))
if (std::get<0>(p1) > std::get<0>(p2))
{
return false;
}
if (boost::get<1>(p1) < boost::get<1>(p2))
if (std::get<1>(p1) < std::get<1>(p2))
{
return true;
}
if (boost::get<1>(p1) > boost::get<1>(p2))
if (std::get<1>(p1) > std::get<1>(p2))
{
return false;
}
if (boost::get<2>(p1) < boost::get<2>(p2))
if (std::get<2>(p1) < std::get<2>(p2))
{
return true;
}
if (boost::get<2>(p1) > boost::get<2>(p2))
if (std::get<2>(p1) > std::get<2>(p2))
{
return false;
}
if (boost::get<3>(p1) < boost::get<3>(p2))
if (std::get<3>(p1) < std::get<3>(p2))
{
return true;
}
if (boost::get<3>(p1) > boost::get<3>(p2))
if (std::get<3>(p1) > std::get<3>(p2))
{
return false;
}
......@@ -87,10 +87,10 @@ bool operator< (OperatorKey const &p1, OperatorKey const &p2)
*/
std::ostream &operator<<(std::ostream &os, OperatorKey const &p)
{
os << LibUtilities::ShapeTypeMap[boost::get<0>(p)] << ", "
<< OperatorTypeMap [boost::get<1>(p)] << ", "
<< ImplementationTypeMap [boost::get<2>(p)] << ", "
<< (boost::get<3>(p) ? "Nodal" : "Modal");
os << LibUtilities::ShapeTypeMap[std::get<0>(p)] << ", "
<< OperatorTypeMap [std::get<1>(p)] << ", "
<< ImplementationTypeMap [std::get<2>(p)] << ", "
<< (std::get<3>(p) ? "Nodal" : "Modal");
return os;
}
......
......@@ -47,7 +47,7 @@
friend class MemoryManager<cname>; \
static OperatorSharedPtr create( \
std::vector<StdRegions::StdExpansionSharedPtr> pCollExp,\
boost::shared_ptr<CoalescedGeomData> GeomData) \
std::shared_ptr<CoalescedGeomData> GeomData) \
{ \
return MemoryManager<cname> \
::AllocateSharedPtr(pCollExp, GeomData); \
......@@ -59,7 +59,7 @@ namespace Collections
{
class CoalescedGeomData;
typedef boost::shared_ptr<CoalescedGeomData> CoalescedGeomDataSharedPtr;
typedef std::shared_ptr<CoalescedGeomData> CoalescedGeomDataSharedPtr;
enum OperatorType
{
......@@ -111,7 +111,7 @@ class Operator
/// Constructor
Operator(
std::vector<StdRegions::StdExpansionSharedPtr> pCollExp,
boost::shared_ptr<CoalescedGeomData> GeomData)
std::shared_ptr<CoalescedGeomData> GeomData)
: m_stdExp(pCollExp[0]->GetStdExp()),
m_numElmt(pCollExp.size()),
m_wspSize(0)
......@@ -149,10 +149,10 @@ class Operator
};
/// Shared pointer to an Operator object
typedef boost::shared_ptr<Operator> OperatorSharedPtr;
typedef std::shared_ptr<Operator> OperatorSharedPtr;
/// Key for describing an Operator