Commit 99ed86a0 authored by Dave Moxey's avatar Dave Moxey

Merge remote-tracking branch 'origin/feature/boost-std-cleanup' into feature/boost-std-cleanup

Conflicts:
	utilities/NekMesh/ProcessModules/ProcessSpherigon.cpp
parents 8b074a89 845fa910
...@@ -45,8 +45,6 @@ ...@@ -45,8 +45,6 @@
#include <Collections/Operator.h> #include <Collections/Operator.h>
#include <Collections/CoalescedGeomData.h> #include <Collections/CoalescedGeomData.h>
#include <boost/unordered_map.hpp>
namespace Nektar { namespace Nektar {
namespace Collections { namespace Collections {
......
////////////////////////////////////////////////////////////////////////////////
//
// File: Concepts.hpp
//
// For more information, please see: http://www.nektar.info/
//
// The MIT License
//
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// License for the specific language governing rights and limitations under
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: Defines concepts for the boost concept checking library.
//
////////////////////////////////////////////////////////////////////////////////
#ifndef NEKTAR_LIB_UTILITIES_CONCEPTS_HPP
#define NEKTAR_LIB_UTILITIES_CONCEPTS_HPP
namespace Nektar
{
template<typename DataType>
class AssignableConcept
{
public:
void constraints()
{
DataType* lhs = NULL;
DataType* rhs = NULL;
*lhs = *rhs;
const_constraints(*rhs);
}
void const_constraints(const DataType& rhs)
{
DataType* lhs = NULL;
(*lhs) = rhs;
}
};
}
#endif
...@@ -8,7 +8,6 @@ SET(BasicConstHeaders ...@@ -8,7 +8,6 @@ SET(BasicConstHeaders
SET(BasicUtilsHeaders SET(BasicUtilsHeaders
./BasicUtils/ArrayPolicies.hpp ./BasicUtils/ArrayPolicies.hpp
./BasicUtils/BoostUtil.hpp ./BasicUtils/BoostUtil.hpp
./BasicUtils/Concepts.hpp
./BasicUtils/ConsistentObjectAccess.hpp ./BasicUtils/ConsistentObjectAccess.hpp
./BasicUtils/CompressData.h ./BasicUtils/CompressData.h
./BasicUtils/Equation.h ./BasicUtils/Equation.h
......
...@@ -37,10 +37,8 @@ ...@@ -37,10 +37,8 @@
#define NEKTAR_LIB_UTILITIES_NEK_POINT_HPP #define NEKTAR_LIB_UTILITIES_NEK_POINT_HPP
#include <LibUtilities/BasicUtils/ErrorUtil.hpp> #include <LibUtilities/BasicUtils/ErrorUtil.hpp>
#include <LibUtilities/BasicUtils/Concepts.hpp>
#include <LibUtilities/BasicConst/NektarUnivTypeDefs.hpp> #include <LibUtilities/BasicConst/NektarUnivTypeDefs.hpp>
#include <boost/concept_check.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <boost/tokenizer.hpp> #include <boost/tokenizer.hpp>
#include <boost/call_traits.hpp> #include <boost/call_traits.hpp>
...@@ -91,8 +89,6 @@ namespace Nektar ...@@ -91,8 +89,6 @@ namespace Nektar
explicit NekPoint(typename boost::call_traits<DataType>::const_reference a) explicit NekPoint(typename boost::call_traits<DataType>::const_reference a)
{ {
boost::function_requires< Nektar::AssignableConcept<DataType> >();
for(unsigned int i = 0; i < dim::Value; ++i) for(unsigned int i = 0; i < dim::Value; ++i)
{ {
m_data[i] = a; m_data[i] = a;
......
...@@ -41,8 +41,6 @@ ...@@ -41,8 +41,6 @@
#include <LibUtilities/LinearAlgebra/MatrixBase.hpp> #include <LibUtilities/LinearAlgebra/MatrixBase.hpp>
#include <LibUtilities/LinearAlgebra/NekVector.hpp> #include <LibUtilities/LinearAlgebra/NekVector.hpp>
#include <boost/shared_ptr.hpp>
namespace Nektar namespace Nektar
{ {
template<typename DataType, typename InnerMatrixType> template<typename DataType, typename InnerMatrixType>
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include <SpatialDomains/Geometry2D.h> #include <SpatialDomains/Geometry2D.h>
#include <SpatialDomains/SegGeom.h> #include <SpatialDomains/SegGeom.h>
#include <boost/shared_ptr.hpp>
#include <iomanip> #include <iomanip>
......
...@@ -729,13 +729,10 @@ void InputGmsh::Process() ...@@ -729,13 +729,10 @@ void InputGmsh::Process()
int prevId = -1; int prevId = -1;
int maxTagId = -1; int maxTagId = -1;
map<unsigned int, ElmtConfig>::iterator it;
// This map takes each element ID and maps it to a permutation map // This map takes each element ID and maps it to a permutation map
// that is required to take Gmsh element node orderings and map them // that is required to take Gmsh element node orderings and map them
// to Nektar++ orderings. // to Nektar++ orderings.
std::unordered_map<int, vector<int> > orderingMap; std::unordered_map<int, vector<int> > orderingMap;
std::unordered_map<int, vector<int> >::iterator oIt;
if (m_mesh->m_verbose) if (m_mesh->m_verbose)
{ {
...@@ -803,7 +800,7 @@ void InputGmsh::Process() ...@@ -803,7 +800,7 @@ void InputGmsh::Process()
st >> id >> elm_type >> num_tag; st >> id >> elm_type >> num_tag;
id -= 1; // counter starts at 0 id -= 1; // counter starts at 0
it = elmMap.find(elm_type); auto it = elmMap.find(elm_type);
if (it == elmMap.end()) if (it == elmMap.end())
{ {
cerr << "Error: element type " << elm_type cerr << "Error: element type " << elm_type
...@@ -835,7 +832,7 @@ void InputGmsh::Process() ...@@ -835,7 +832,7 @@ void InputGmsh::Process()
} }
// Look up reordering. // Look up reordering.
oIt = orderingMap.find(elm_type); auto oIt = orderingMap.find(elm_type);
// If it's not created, then create it. // If it's not created, then create it.
if (oIt == orderingMap.end()) if (oIt == orderingMap.end())
...@@ -872,8 +869,6 @@ void InputGmsh::Process() ...@@ -872,8 +869,6 @@ void InputGmsh::Process()
// Go through element and remap tags if necessary. // Go through element and remap tags if necessary.
map<int, map<LibUtilities::ShapeType, int> > compMap; map<int, map<LibUtilities::ShapeType, int> > compMap;
map<int, map<LibUtilities::ShapeType, int> >::iterator cIt;
map<LibUtilities::ShapeType, int>::iterator sIt;
for (int i = 0; i < m_mesh->m_element[m_mesh->m_expDim].size(); ++i) for (int i = 0; i < m_mesh->m_element[m_mesh->m_expDim].size(); ++i)
{ {
...@@ -883,7 +878,7 @@ void InputGmsh::Process() ...@@ -883,7 +878,7 @@ void InputGmsh::Process()
vector<int> tags = el->GetTagList(); vector<int> tags = el->GetTagList();
int tag = tags[0]; int tag = tags[0];
cIt = compMap.find(tag); auto cIt = compMap.find(tag);
if (cIt == compMap.end()) if (cIt == compMap.end())
{ {
...@@ -892,7 +887,7 @@ void InputGmsh::Process() ...@@ -892,7 +887,7 @@ void InputGmsh::Process()
} }
// Reset tag for this element. // Reset tag for this element.
sIt = cIt->second.find(type); auto sIt = cIt->second.find(type);
if (sIt == cIt->second.end()) if (sIt == cIt->second.end())
{ {
maxTagId++; maxTagId++;
...@@ -908,9 +903,9 @@ void InputGmsh::Process() ...@@ -908,9 +903,9 @@ void InputGmsh::Process()
} }
bool printInfo = false; bool printInfo = false;
for (cIt = compMap.begin(); cIt != compMap.end(); ++cIt) for (auto &cIt : compMap)
{ {
if (cIt->second.size() > 1) if (cIt.second.size() > 1)
{ {
printInfo = true; printInfo = true;
break; break;
...@@ -920,16 +915,16 @@ void InputGmsh::Process() ...@@ -920,16 +915,16 @@ void InputGmsh::Process()
if (printInfo) if (printInfo)
{ {
cout << "Multiple elements in composite detected; remapped:" << endl; cout << "Multiple elements in composite detected; remapped:" << endl;
for (cIt = compMap.begin(); cIt != compMap.end(); ++cIt) for (auto &cIt : compMap)
{ {
if (cIt->second.size() > 1) if (cIt.second.size() > 1)
{ {
sIt = cIt->second.begin(); auto sIt = cIt.second.begin();
cout << "- Tag " << cIt->first << " => " << sIt->second << " (" cout << "- Tag " << cIt.first << " => " << sIt->second << " ("
<< LibUtilities::ShapeTypeMap[sIt->first] << ")"; << LibUtilities::ShapeTypeMap[sIt->first] << ")";
sIt++; sIt++;
for (; sIt != cIt->second.end(); ++sIt) for (; sIt != cIt.second.end(); ++sIt)
{ {
cout << ", " << sIt->second << " (" cout << ", " << sIt->second << " ("
<< LibUtilities::ShapeTypeMap[sIt->first] << ")"; << LibUtilities::ShapeTypeMap[sIt->first] << ")";
...@@ -954,9 +949,8 @@ void InputGmsh::Process() ...@@ -954,9 +949,8 @@ void InputGmsh::Process()
int InputGmsh::GetNnodes(unsigned int InputGmshEntity) int InputGmsh::GetNnodes(unsigned int InputGmshEntity)
{ {
int nNodes; int nNodes;
map<unsigned int, ElmtConfig>::iterator it;
it = elmMap.find(InputGmshEntity); auto it = elmMap.find(InputGmshEntity);
if (it == elmMap.end()) if (it == elmMap.end())
{ {
...@@ -1010,9 +1004,7 @@ int InputGmsh::GetNnodes(unsigned int InputGmshEntity) ...@@ -1010,9 +1004,7 @@ int InputGmsh::GetNnodes(unsigned int InputGmshEntity)
*/ */
vector<int> InputGmsh::CreateReordering(unsigned int InputGmshEntity) vector<int> InputGmsh::CreateReordering(unsigned int InputGmshEntity)
{ {
map<unsigned int, ElmtConfig>::iterator it; auto it = elmMap.find(InputGmshEntity);
it = elmMap.find(InputGmshEntity);
if (it == elmMap.end()) if (it == elmMap.end())
{ {
......
...@@ -170,9 +170,7 @@ void InputMCF::ParseFile(string nm) ...@@ -170,9 +170,7 @@ void InputMCF::ParseFile(string nm)
} }
} }
map<string,string>::iterator it; auto it = information.find("CADFile");
it = information.find("CADFile");
ASSERTL0(it != information.end(), "no cadfile defined"); ASSERTL0(it != information.end(), "no cadfile defined");
m_cadfile = it->second; m_cadfile = it->second;
...@@ -263,8 +261,7 @@ void InputMCF::ParseFile(string nm) ...@@ -263,8 +261,7 @@ void InputMCF::ParseFile(string nm)
m_nacadomain = ss.str(); m_nacadomain = ss.str();
} }
set<string>::iterator sit; auto sit = boolparameters.find("SurfaceOptimiser");
sit = boolparameters.find("SurfaceOptimiser");
m_surfopti = sit != boolparameters.end(); m_surfopti = sit != boolparameters.end();
sit = boolparameters.find("WriteOctree"); sit = boolparameters.find("WriteOctree");
m_woct = sit != boolparameters.end(); m_woct = sit != boolparameters.end();
...@@ -523,14 +520,13 @@ void InputMCF::Process() ...@@ -523,14 +520,13 @@ void InputMCF::Process()
vector<string> lines; vector<string> lines;
boost::split(lines, m_periodic, boost::is_any_of(":")); boost::split(lines, m_periodic, boost::is_any_of(":"));
for (vector<string>::iterator il = lines.begin(); il != lines.end(); for (auto &il : lines)
++il)
{ {
module = GetModuleFactory().CreateInstance( module = GetModuleFactory().CreateInstance(
ModuleKey(eProcessModule, "peralign"), m_mesh); ModuleKey(eProcessModule, "peralign"), m_mesh);
vector<string> tmp(2); vector<string> tmp(2);
boost::split(tmp, *il, boost::is_any_of(",")); boost::split(tmp, il, boost::is_any_of(","));
module->RegisterConfig("surf1", tmp[0]); module->RegisterConfig("surf1", tmp[0]);
} }
......
...@@ -292,8 +292,7 @@ void InputNek::Process() ...@@ -292,8 +292,7 @@ void InputNek::Process()
for (j = 0; j < tmp.size(); ++j) for (j = 0; j < tmp.size(); ++j)
{ {
vector<int> tags; vector<int> tags;
map<LibUtilities::ShapeType, int>::iterator compIt = auto compIt = domainComposite.find(elType);
domainComposite.find(elType);
if (compIt == domainComposite.end()) if (compIt == domainComposite.end())
{ {
tags.push_back(nComposite); tags.push_back(nComposite);
...@@ -311,8 +310,7 @@ void InputNek::Process() ...@@ -311,8 +310,7 @@ void InputNek::Process()
for (k = 0; k < nodeList.size(); ++k) for (k = 0; k < nodeList.size(); ++k)
{ {
pair<NodeSet::iterator, bool> testIns = auto testIns = m_mesh->m_vertexSet.insert(nodeList[k]);
m_mesh->m_vertexSet.insert(nodeList[k]);
if (!testIns.second) if (!testIns.second)
{ {
...@@ -397,8 +395,6 @@ void InputNek::Process() ...@@ -397,8 +395,6 @@ void InputNek::Process()
int nCurvedSides; int nCurvedSides;
int faceId, elId; int faceId, elId;
map<string, pair<NekCurve, string> >::iterator it;
HOSurfSet::iterator hoIt;
s.clear(); s.clear();
s.str(line); s.str(line);
...@@ -438,7 +434,7 @@ void InputNek::Process() ...@@ -438,7 +434,7 @@ void InputNek::Process()
faceId = t->m_orientationMap[faceId]; faceId = t->m_orientationMap[faceId];
} }
it = curveTags.find(word); auto it = curveTags.find(word);
if (it == curveTags.end()) if (it == curveTags.end())
{ {
cerr << "Unrecognised curve tag " << word << " in curved lines" cerr << "Unrecognised curve tag " << word << " in curved lines"
...@@ -488,8 +484,7 @@ void InputNek::Process() ...@@ -488,8 +484,7 @@ void InputNek::Process()
for (j = 0; j < tmp.size(); ++j) for (j = 0; j < tmp.size(); ++j)
{ {
int id = tmp[(j + offset) % tmp.size()]->m_id; int id = tmp[(j + offset) % tmp.size()]->m_id;
std::unordered_map<int, Node>::iterator vIt = auto vIt = m_mesh->m_vertexNormals.find(id);
m_mesh->m_vertexNormals.find(id);
if (vIt == m_mesh->m_vertexNormals.end()) if (vIt == m_mesh->m_vertexNormals.end())
{ {
...@@ -556,7 +551,7 @@ void InputNek::Process() ...@@ -556,7 +551,7 @@ void InputNek::Process()
HOSurfSharedPtr hs = HOSurfSharedPtr hs =
std::shared_ptr<HOSurf>(new HOSurf(vertId)); std::shared_ptr<HOSurf>(new HOSurf(vertId));
// Find vertex combination in hoData. // Find vertex combination in hoData.
hoIt = hoData[word].find(hs); auto hoIt = hoData[word].find(hs);
if (hoIt == hoData[word].end()) if (hoIt == hoData[word].end())
{ {
...@@ -781,12 +776,10 @@ void InputNek::Process() ...@@ -781,12 +776,10 @@ void InputNek::Process()
// Now attempt to find this boundary condition inside // Now attempt to find this boundary condition inside
// m_mesh->condition. This is currently a linear search and should // m_mesh->condition. This is currently a linear search and should
// probably be made faster! // probably be made faster!
ConditionMap::iterator it;
bool found = false; bool found = false;
for (it = m_mesh->m_condition.begin(); it != m_mesh->m_condition.end(); for (auto &it : m_mesh->m_condition)
++it)
{ {
if (c == it->second) if (c == it.second)
{ {
found = true; found = true;
break; break;
...@@ -893,9 +886,7 @@ void InputNek::Process() ...@@ -893,9 +886,7 @@ void InputNek::Process()
else else
{ {
// Otherwise find existing composite inside surfaceCompMap. // Otherwise find existing composite inside surfaceCompMap.
map<int, vector<pair<int, LibUtilities::ShapeType> > >::iterator auto it2 = surfaceCompMap.find(it->first);
it2;
it2 = surfaceCompMap.find(it->first);
found = false; found = false;
if (it2 == surfaceCompMap.end()) if (it2 == surfaceCompMap.end())
...@@ -958,17 +949,16 @@ void InputNek::Process() ...@@ -958,17 +949,16 @@ void InputNek::Process()
*/ */
void InputNek::LoadHOSurfaces() void InputNek::LoadHOSurfaces()
{ {
map<string, pair<NekCurve, string> >::iterator it;
int nodeId = m_mesh->GetNumEntities(); int nodeId = m_mesh->GetNumEntities();
for (it = curveTags.begin(); it != curveTags.end(); ++it) for (auto &it : curveTags)
{ {
ifstream hsf; ifstream hsf;
string line, fileName = it->second.second; string line, fileName = it.second.second;
size_t pos; size_t pos;
int N, Nface, dot; int N, Nface, dot;
if (it->second.first != eFile) if (it.second.first != eFile)
{ {
continue; continue;
} }
...@@ -1109,7 +1099,7 @@ void InputNek::LoadHOSurfaces() ...@@ -1109,7 +1099,7 @@ void InputNek::LoadHOSurfaces()
abort(); abort();
} }
hoData[it->first].insert( hoData[it.first].insert(
HOSurfSharedPtr(new HOSurf(nodeIds, faceMap[i]))); HOSurfSharedPtr(new HOSurf(nodeIds, faceMap[i])));
} }
......
...@@ -219,8 +219,7 @@ void InputNek5000::Process() ...@@ -219,8 +219,7 @@ void InputNek5000::Process()
nodeList[k] = std::shared_ptr<Node>( nodeList[k] = std::shared_ptr<Node>(
new Node( new Node(
0, vertex[k][0], vertex[k][1], vertex[k][2])); 0, vertex[k][0], vertex[k][1], vertex[k][2]));
pair<NodeSet::iterator, bool> testIns = auto testIns = m_mesh->m_vertexSet.insert(nodeList[k]);
m_mesh->m_vertexSet.insert(nodeList[k]);
if (!testIns.second) if (!testIns.second)
{ {
...@@ -678,15 +677,13 @@ void InputNek5000::Process() ...@@ -678,15 +677,13 @@ void InputNek5000::Process()
// Now attempt to find this boundary condition inside // Now attempt to find this boundary condition inside
// m_mesh->condition. This is currently a linear search and should // m_mesh->condition. This is currently a linear search and should
// probably be made faster! // probably be made faster!
ConditionMap::iterator it;
bool found = false; bool found = false;
for (it = m_mesh->m_condition.begin(); it != m_mesh->m_condition.end(); for (auto &it : m_mesh->m_condition)
++it)
{ {
if (c == it->second) if (c == it.second)
{ {
found = true; found = true;
c = it->second; c = it.second;
break; break;
} }
} }
......
...@@ -91,9 +91,7 @@ void InputNekpp::Process() ...@@ -91,9 +91,7 @@ void InputNekpp::Process()
} }
map<int, EdgeSharedPtr> eIdMap; map<int, EdgeSharedPtr> eIdMap;
map<int, EdgeSharedPtr>::iterator itEmap;
map<int, FaceSharedPtr> fIdMap; map<int, FaceSharedPtr> fIdMap;
map<int, FaceSharedPtr>::iterator itFmap;
// Load up all edges from graph // Load up all edges from graph
{ {
......
...@@ -85,7 +85,6 @@ void InputSem::Process() ...@@ -85,7 +85,6 @@ void InputSem::Process()
} }
// Read through input file and populate the section map. // Read through input file and populate the section map.
map<string, streampos>::iterator it;
string fileContents, line, word; string fileContents, line, word;
stringstream ss, ssFile; stringstream ss, ssFile;
streampos linePos; streampos linePos;
...@@ -112,11 +111,11 @@ void InputSem::Process() ...@@ -112,11 +111,11 @@ void InputSem::Process()