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 @@
#include <Collections/Operator.h>
#include <Collections/CoalescedGeomData.h>
#include <boost/unordered_map.hpp>
namespace Nektar {
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
SET(BasicUtilsHeaders
./BasicUtils/ArrayPolicies.hpp
./BasicUtils/BoostUtil.hpp
./BasicUtils/Concepts.hpp
./BasicUtils/ConsistentObjectAccess.hpp
./BasicUtils/CompressData.h
./BasicUtils/Equation.h
......
......@@ -37,10 +37,8 @@
#define NEKTAR_LIB_UTILITIES_NEK_POINT_HPP
#include <LibUtilities/BasicUtils/ErrorUtil.hpp>
#include <LibUtilities/BasicUtils/Concepts.hpp>
#include <LibUtilities/BasicConst/NektarUnivTypeDefs.hpp>
#include <boost/concept_check.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/tokenizer.hpp>
#include <boost/call_traits.hpp>
......@@ -91,8 +89,6 @@ namespace Nektar
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)
{
m_data[i] = a;
......
......@@ -41,8 +41,6 @@
#include <LibUtilities/LinearAlgebra/MatrixBase.hpp>
#include <LibUtilities/LinearAlgebra/NekVector.hpp>
#include <boost/shared_ptr.hpp>
namespace Nektar
{
template<typename DataType, typename InnerMatrixType>
......
......@@ -35,7 +35,6 @@
////////////////////////////////////////////////////////////////////////////////
#include <SpatialDomains/Geometry2D.h>
#include <SpatialDomains/SegGeom.h>
#include <boost/shared_ptr.hpp>
#include <iomanip>
......
......@@ -729,13 +729,10 @@ void InputGmsh::Process()
int prevId = -1;
int maxTagId = -1;
map<unsigned int, ElmtConfig>::iterator it;
// 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
// to Nektar++ orderings.
std::unordered_map<int, vector<int> > orderingMap;
std::unordered_map<int, vector<int> >::iterator oIt;
if (m_mesh->m_verbose)
{
......@@ -803,7 +800,7 @@ void InputGmsh::Process()
st >> id >> elm_type >> num_tag;
id -= 1; // counter starts at 0
it = elmMap.find(elm_type);
auto it = elmMap.find(elm_type);
if (it == elmMap.end())
{
cerr << "Error: element type " << elm_type
......@@ -835,7 +832,7 @@ void InputGmsh::Process()
}
// Look up reordering.
oIt = orderingMap.find(elm_type);
auto oIt = orderingMap.find(elm_type);
// If it's not created, then create it.
if (oIt == orderingMap.end())
......@@ -872,8 +869,6 @@ void InputGmsh::Process()
// Go through element and remap tags if necessary.
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)
{
......@@ -883,7 +878,7 @@ void InputGmsh::Process()
vector<int> tags = el->GetTagList();
int tag = tags[0];
cIt = compMap.find(tag);
auto cIt = compMap.find(tag);
if (cIt == compMap.end())
{
......@@ -892,7 +887,7 @@ void InputGmsh::Process()
}
// Reset tag for this element.
sIt = cIt->second.find(type);
auto sIt = cIt->second.find(type);
if (sIt == cIt->second.end())
{
maxTagId++;
......@@ -908,9 +903,9 @@ void InputGmsh::Process()
}
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;
break;
......@@ -920,16 +915,16 @@ void InputGmsh::Process()
if (printInfo)
{
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();
cout << "- Tag " << cIt->first << " => " << sIt->second << " ("
auto sIt = cIt.second.begin();
cout << "- Tag " << cIt.first << " => " << sIt->second << " ("
<< LibUtilities::ShapeTypeMap[sIt->first] << ")";
sIt++;
for (; sIt != cIt->second.end(); ++sIt)
for (; sIt != cIt.second.end(); ++sIt)
{
cout << ", " << sIt->second << " ("
<< LibUtilities::ShapeTypeMap[sIt->first] << ")";
......@@ -954,9 +949,8 @@ void InputGmsh::Process()
int InputGmsh::GetNnodes(unsigned int InputGmshEntity)
{
int nNodes;
map<unsigned int, ElmtConfig>::iterator it;
it = elmMap.find(InputGmshEntity);
auto it = elmMap.find(InputGmshEntity);
if (it == elmMap.end())
{
......@@ -1010,9 +1004,7 @@ int InputGmsh::GetNnodes(unsigned int InputGmshEntity)
*/
vector<int> InputGmsh::CreateReordering(unsigned int InputGmshEntity)
{
map<unsigned int, ElmtConfig>::iterator it;
it = elmMap.find(InputGmshEntity);
auto it = elmMap.find(InputGmshEntity);
if (it == elmMap.end())
{
......
......@@ -170,9 +170,7 @@ void InputMCF::ParseFile(string nm)
}
}
map<string,string>::iterator it;
it = information.find("CADFile");
auto it = information.find("CADFile");
ASSERTL0(it != information.end(), "no cadfile defined");
m_cadfile = it->second;
......@@ -263,8 +261,7 @@ void InputMCF::ParseFile(string nm)
m_nacadomain = ss.str();
}
set<string>::iterator sit;
sit = boolparameters.find("SurfaceOptimiser");
auto sit = boolparameters.find("SurfaceOptimiser");
m_surfopti = sit != boolparameters.end();
sit = boolparameters.find("WriteOctree");
m_woct = sit != boolparameters.end();
......@@ -523,14 +520,13 @@ void InputMCF::Process()
vector<string> lines;
boost::split(lines, m_periodic, boost::is_any_of(":"));
for (vector<string>::iterator il = lines.begin(); il != lines.end();
++il)
for (auto &il : lines)
{
module = GetModuleFactory().CreateInstance(
ModuleKey(eProcessModule, "peralign"), m_mesh);
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]);
}
......
......@@ -292,8 +292,7 @@ void InputNek::Process()
for (j = 0; j < tmp.size(); ++j)
{
vector<int> tags;
map<LibUtilities::ShapeType, int>::iterator compIt =
domainComposite.find(elType);
auto compIt = domainComposite.find(elType);
if (compIt == domainComposite.end())
{
tags.push_back(nComposite);
......@@ -311,8 +310,7 @@ void InputNek::Process()
for (k = 0; k < nodeList.size(); ++k)
{
pair<NodeSet::iterator, bool> testIns =
m_mesh->m_vertexSet.insert(nodeList[k]);
auto testIns = m_mesh->m_vertexSet.insert(nodeList[k]);
if (!testIns.second)
{
......@@ -397,8 +395,6 @@ void InputNek::Process()
int nCurvedSides;
int faceId, elId;
map<string, pair<NekCurve, string> >::iterator it;
HOSurfSet::iterator hoIt;
s.clear();
s.str(line);
......@@ -438,7 +434,7 @@ void InputNek::Process()
faceId = t->m_orientationMap[faceId];
}
it = curveTags.find(word);
auto it = curveTags.find(word);
if (it == curveTags.end())
{
cerr << "Unrecognised curve tag " << word << " in curved lines"
......@@ -488,8 +484,7 @@ void InputNek::Process()
for (j = 0; j < tmp.size(); ++j)
{
int id = tmp[(j + offset) % tmp.size()]->m_id;
std::unordered_map<int, Node>::iterator vIt =
m_mesh->m_vertexNormals.find(id);
auto vIt = m_mesh->m_vertexNormals.find(id);
if (vIt == m_mesh->m_vertexNormals.end())
{
......@@ -556,7 +551,7 @@ void InputNek::Process()
HOSurfSharedPtr hs =
std::shared_ptr<HOSurf>(new HOSurf(vertId));
// Find vertex combination in hoData.
hoIt = hoData[word].find(hs);
auto hoIt = hoData[word].find(hs);
if (hoIt == hoData[word].end())
{
......@@ -781,12 +776,10 @@ void InputNek::Process()
// Now attempt to find this boundary condition inside
// m_mesh->condition. This is currently a linear search and should
// probably be made faster!
ConditionMap::iterator it;
bool found = false;
for (it = m_mesh->m_condition.begin(); it != m_mesh->m_condition.end();
++it)
for (auto &it : m_mesh->m_condition)
{
if (c == it->second)
if (c == it.second)
{
found = true;
break;
......@@ -893,9 +886,7 @@ void InputNek::Process()
else
{
// Otherwise find existing composite inside surfaceCompMap.
map<int, vector<pair<int, LibUtilities::ShapeType> > >::iterator
it2;
it2 = surfaceCompMap.find(it->first);
auto it2 = surfaceCompMap.find(it->first);
found = false;
if (it2 == surfaceCompMap.end())
......@@ -958,17 +949,16 @@ void InputNek::Process()
*/
void InputNek::LoadHOSurfaces()
{
map<string, pair<NekCurve, string> >::iterator it;
int nodeId = m_mesh->GetNumEntities();
for (it = curveTags.begin(); it != curveTags.end(); ++it)
for (auto &it : curveTags)
{
ifstream hsf;
string line, fileName = it->second.second;
string line, fileName = it.second.second;
size_t pos;
int N, Nface, dot;
if (it->second.first != eFile)
if (it.second.first != eFile)
{
continue;
}
......@@ -1109,7 +1099,7 @@ void InputNek::LoadHOSurfaces()
abort();
}
hoData[it->first].insert(
hoData[it.first].insert(
HOSurfSharedPtr(new HOSurf(nodeIds, faceMap[i])));
}
......
......@@ -219,8 +219,7 @@ void InputNek5000::Process()
nodeList[k] = std::shared_ptr<Node>(
new Node(
0, vertex[k][0], vertex[k][1], vertex[k][2]));
pair<NodeSet::iterator, bool> testIns =
m_mesh->m_vertexSet.insert(nodeList[k]);
auto testIns = m_mesh->m_vertexSet.insert(nodeList[k]);
if (!testIns.second)
{
......@@ -678,15 +677,13 @@ void InputNek5000::Process()
// Now attempt to find this boundary condition inside
// m_mesh->condition. This is currently a linear search and should
// probably be made faster!
ConditionMap::iterator it;
bool found = false;
for (it = m_mesh->m_condition.begin(); it != m_mesh->m_condition.end();
++it)
for (auto &it : m_mesh->m_condition)
{
if (c == it->second)
if (c == it.second)
{
found = true;
c = it->second;
c = it.second;
break;
}
}
......
......@@ -91,9 +91,7 @@ void InputNekpp::Process()
}
map<int, EdgeSharedPtr> eIdMap;
map<int, EdgeSharedPtr>::iterator itEmap;
map<int, FaceSharedPtr> fIdMap;
map<int, FaceSharedPtr>::iterator itFmap;
// Load up all edges from graph
{
......
......@@ -85,7 +85,6 @@ void InputSem::Process()
}
// Read through input file and populate the section map.
map<string, streampos>::iterator it;
string fileContents, line, word;
stringstream ss, ssFile;
streampos linePos;
......@@ -112,11 +111,11 @@ void InputSem::Process()
// Iterate over all tokens and see if section exists on this
// line.
for (it = sectionMap.begin(); it != sectionMap.end(); ++it)
for (auto &it : sectionMap)
{
if (word == "<" + it->first || word == "<" + it->first + ">")
if (word == "<" + it.first || word == "<" + it.first + ">")
{
sectionMap[it->first] = linePos;
sectionMap[it.first] = linePos;
}
}
}
......
......@@ -222,7 +222,6 @@ void InputStar::ResetNodes(vector<NodeSharedPtr> &Vnodes,
vector<vector<int> > FaceToPrisms(FaceNodes.size());
vector<vector<int> > PrismToFaces(ElementFaces.num_elements());
map<int, int> Prisms;
map<int, int>::iterator PrismIt;
// generate map of prism-faces to prisms and prism to
// triangular-faces as well as ids of each prism.
......@@ -260,11 +259,10 @@ void InputStar::ResetNodes(vector<NodeSharedPtr> &Vnodes,
// For every prism find the list of prismatic elements
// that represent an aligned block of cells. Then renumber
// these blocks consecutativiesly
for (PrismIt = Prisms.begin(); PrismIt != Prisms.end(); ++PrismIt)
for (auto &PrismIt : Prisms)
{
int elmtid = PrismIt->first;
int elmtid = PrismIt.first;
map<int, int> facelist;
map<int, int>::iterator faceIt;
if (PrismDone[elmtid])
{
......@@ -277,9 +275,9 @@ void InputStar::ResetNodes(vector<NodeSharedPtr> &Vnodes,
elmtid, facelist, FaceToPrisms, PrismToFaces, PrismDone);
// loop over faces and number vertices of associated prisms.
for (faceIt = facelist.begin(); faceIt != facelist.end(); faceIt++)
for (auto &faceIt : facelist)
{
int faceid = faceIt->second;
int faceid = faceIt.second;
for (i = 0; i < FaceToPrisms[faceid].size(); ++i)
{
......
......@@ -394,7 +394,7 @@ void InputTec::ReadZone(int &nComposite)
// identify
for (i = 0; i < Nodes.size(); ++i)
{
NodeSet::iterator it = m_mesh->m_vertexSet.find(Nodes[i]);
auto it = m_mesh->m_vertexSet.find(Nodes[i]);
if (it == m_mesh->m_vertexSet.end())
{
......@@ -436,7 +436,6 @@ void InputTec::ResetNodes(vector<NodeSharedPtr> &Vnodes,
vector<vector<int> > FaceToPrisms(FaceNodes.size());
vector<vector<int> > PrismToFaces(ElementFaces.num_elements());
map<int, int> Prisms;
map<int, int>::iterator PrismIt;
// generate map of prism-faces to prisms and prism to
// triangular-faces as well as ids of each prism.
......@@ -474,11 +473,10 @@ void InputTec::ResetNodes(vector<NodeSharedPtr> &Vnodes,
// For every prism find the list of prismatic elements
// that represent an aligned block of cells. Then renumber
// these blocks consecutativiesly
for (PrismIt = Prisms.begin(); PrismIt != Prisms.end(); ++PrismIt)
for (auto &PrismIt : Prisms)
{
int elmtid = PrismIt->first;
int elmtid = PrismIt.first;
map<int, int> facelist;
map<int, int>::iterator faceIt;
if (PrismDone[elmtid])
{
......@@ -491,9 +489,9 @@ void InputTec::ResetNodes(vector<NodeSharedPtr> &Vnodes,
elmtid, facelist, FaceToPrisms, PrismToFaces, PrismDone);
// loop over faces and number vertices of associated prisms.
for (faceIt = facelist.begin(); faceIt != facelist.end(); faceIt++)
for (auto &faceIt : facelist)
{
int faceid = faceIt->second;
int faceid = faceIt.second;
for (i = 0; i < FaceToPrisms[faceid].size(); ++i)
{
......
......@@ -55,14 +55,11 @@ ModuleKey OutputGmsh::className =
OutputGmsh::OutputGmsh(MeshSharedPtr m) : OutputModule(m)
{
map<unsigned int, ElmtConfig> igelmap = InputGmsh::GenElmMap();
map<unsigned int, ElmtConfig>::iterator it;
// Populate #InputGmsh::elmMap and use this to construct an
// inverse mapping from %ElmtConfig to Gmsh ID.
for (it = igelmap.begin(); it != igelmap.end(); ++it)
for (auto &it : InputGmsh::GenElmMap())
{
elmMap[it->second] = it->first;
elmMap[it.second] = it.first;
}
m_config["order"] = ConfigOption(false, "-1", "Enforce a polynomial order");
......@@ -90,7 +87,6 @@ void OutputGmsh::Process()
}
std::unordered_map<int, vector<int> > orderingMap;
std::unordered_map<int, vector<int> >::iterator oIt;
// Open the file stream.
OpenStream();
......@@ -135,19 +131,16 @@ void OutputGmsh::Process()
m_mesh->MakeOrder(order, LibUtilities::ePolyEvenlySpaced);
// Add edge- and face-interior nodes to vertex set.
EdgeSet::iterator eIt;
FaceSet::iterator fIt;
for (eIt = m_mesh->m_edgeSet.begin(); eIt != m_mesh->m_edgeSet.end(); ++eIt)
for (auto &eIt : m_mesh->m_edgeSet)
{
m_mesh->m_vertexSet.insert((*eIt)->m_edgeNodes.begin(),
(*eIt)->m_edgeNodes.end());
m_mesh->m_vertexSet.insert(eIt->m_edgeNodes.begin(),
eIt->m_edgeNodes.end());
}
for (fIt = m_mesh->m_faceSet.begin(); fIt != m_mesh->m_faceSet.end(); ++fIt)
for (auto &fIt : m_mesh->m_faceSet)
{
m_mesh->m_vertexSet.insert((*fIt)->m_faceNodes.begin(),
(*fIt)->m_faceNodes.end());
m_mesh->m_vertexSet.insert(fIt->m_faceNodes.begin(),
fIt->m_faceNodes.end());
}
// Do second pass over elements for volume nodes.
......@@ -162,17 +155,16 @@ void OutputGmsh::Process()
}
// Create ordered set of nodes - not required but looks nicer.
std::set<NodeSharedPtr>::iterator it;
std::set<NodeSharedPtr> tmp(m_mesh->m_vertexSet.begin(),
m_mesh->m_vertexSet.end());
// Write out nodes section.
m_mshFile << "$Nodes" << endl << m_mesh->m_vertexSet.size() << endl;
for (it = tmp.begin(); it != tmp.end(); ++it)
for (auto &it : tmp)
{
m_mshFile << (*it)->m_id+1 << " " << scientific << setprecision(10)
<< (*it)->m_x << " " << (*it)->m_y << " " << (*it)->m_z
m_mshFile << it->m_id+1 << " " << scientific << setprecision(10)
<< it->m_x << " " << it->m_y << " " << it->m_z
<< endl;
}
......@@ -290,7 +282,7 @@ void OutputGmsh::Process()
// Construct inverse of input reordering. First try to find it in
// our cache.
oIt = orderingMap.find(elmtType);
auto oIt = orderingMap.find(elmtType);
// If it's not created, then create it.
if (oIt == orderingMap.end())
......
......@@ -69,19 +69,16 @@ void OutputSTL::Process()
m_mshFile << std::scientific << setprecision(8);
CompositeMap::iterator it;
for (it = m_mesh->m_composite.begin(); it != m_mesh->m_composite.end();
++it)
for (auto &it : m_mesh->m_composite)
{
if (it->second->m_tag != "F")
if (it.second->m_tag != "F")