diff --git a/dune/istl/matrixmarket.hh b/dune/istl/matrixmarket.hh index 233f0257dda3089d808a34c781e9cb9ba76a1415..b8bbff5045ab2df218d1845a1835bd0f9af67306 100644 --- a/dune/istl/matrixmarket.hh +++ b/dune/istl/matrixmarket.hh @@ -9,11 +9,11 @@ #include <sstream> #include <limits> #include <ios> +#include <tuple> #include "matrixutils.hh" #include "bcrsmatrix.hh" #include "owneroverlapcopy.hh" #include <dune/common/fmatrix.hh> -#include <dune/common/tuples.hh> #include <dune/common/unused.hh> namespace Dune @@ -499,7 +499,7 @@ namespace Dune } template<std::size_t brows, std::size_t bcols> - Dune::tuple<std::size_t, std::size_t, std::size_t> + std::tuple<std::size_t, std::size_t, std::size_t> calculateNNZ(std::size_t rows, std::size_t cols, std::size_t entries, const MMHeader& header) { std::size_t blockrows=rows/brows; @@ -520,7 +520,7 @@ namespace Dune default : throw Dune::NotImplemented(); } - return Dune::make_tuple(blockrows, blockcols, blockentries); + return std::make_tuple(blockrows, blockcols, blockentries); } /* @@ -815,7 +815,7 @@ namespace Dune std::size_t nnz, blockrows, blockcols; - Dune::tie(blockrows, blockcols, nnz) = calculateNNZ<brows, bcols>(rows, cols, entries, header); + std::tie(blockrows, blockcols, nnz) = calculateNNZ<brows, bcols>(rows, cols, entries, header); istr.ignore(std::numeric_limits<std::streamsize>::max(),'\n'); diff --git a/dune/istl/matrixmatrix.hh b/dune/istl/matrixmatrix.hh index 7689fdbf340f72cc91288e2d2c377b2cf1c94802..3a3374280151204136f28d4e9516a383aa9c4fc0 100644 --- a/dune/istl/matrixmatrix.hh +++ b/dune/istl/matrixmatrix.hh @@ -2,9 +2,11 @@ // vi: set et ts=4 sw=2 sts=2: #ifndef DUNE_ISTL_MATRIXMATRIX_HH #define DUNE_ISTL_MATRIXMATRIX_HH + +#include <tuple> + #include <dune/istl/bcrsmatrix.hh> #include <dune/common/fmatrix.hh> -#include <dune/common/tuples.hh> #include <dune/common/timer.hh> namespace Dune { @@ -435,10 +437,10 @@ namespace Dune struct SizeSelector<0> { template<class M1, class M2> - static tuple<typename M1::size_type, typename M2::size_type> + static std::tuple<typename M1::size_type, typename M2::size_type> size(const M1& m1, const M2& m2) { - return make_tuple(m1.N(), m2.M()); + return std::make_tuple(m1.N(), m2.M()); } }; @@ -446,10 +448,10 @@ namespace Dune struct SizeSelector<1> { template<class M1, class M2> - static tuple<typename M1::size_type, typename M2::size_type> + static std::tuple<typename M1::size_type, typename M2::size_type> size(const M1& m1, const M2& m2) { - return make_tuple(m1.M(), m2.M()); + return std::make_tuple(m1.M(), m2.M()); } }; @@ -458,10 +460,10 @@ namespace Dune struct SizeSelector<2> { template<class M1, class M2> - static tuple<typename M1::size_type, typename M2::size_type> + static std::tuple<typename M1::size_type, typename M2::size_type> size(const M1& m1, const M2& m2) { - return make_tuple(m1.N(), m2.N()); + return std::make_tuple(m1.N(), m2.N()); } }; @@ -471,7 +473,7 @@ namespace Dune { // First step is to count the number of nonzeros typename BCRSMatrix<FieldMatrix<T,n1,m1>,A>::size_type rows, cols; - tie(rows,cols)=SizeSelector<transpose>::size(mat1, mat2); + std::tie(rows,cols)=SizeSelector<transpose>::size(mat1, mat2); MatrixInitializer<transpose,T,A,n1,m1> patternInit(res, rows); Timer timer; NonzeroPatternTraverser<transpose>::traverse(mat1,mat2,patternInit); diff --git a/dune/istl/owneroverlapcopy.hh b/dune/istl/owneroverlapcopy.hh index fcd2344b0b1c212674db856746e0a92617258379..d7b7fc33e18a044ee3f9c9367bea065470223b33 100644 --- a/dune/istl/owneroverlapcopy.hh +++ b/dune/istl/owneroverlapcopy.hh @@ -9,6 +9,7 @@ #include <list> #include <map> #include <set> +#include <tuple> #include "cmath" @@ -17,8 +18,6 @@ #include <mpi.h> #endif - -#include <dune/common/tuples.hh> #include <dune/common/enumset.hh> #if HAVE_MPI @@ -88,14 +87,14 @@ namespace Dune { * The triple consists of the global index and the local * index and an attribute */ - typedef tuple<GlobalIdType,LocalIdType,int> IndexTripel; + typedef std::tuple<GlobalIdType,LocalIdType,int> IndexTripel; /** * @brief A triple describing a remote index. * * The triple consists of a process number and the global index and * the attribute of the index at the remote process. */ - typedef tuple<int,GlobalIdType,int> RemoteIndexTripel; + typedef std::tuple<int,GlobalIdType,int> RemoteIndexTripel; /** * @brief Add a new index triple to the set of local indices. @@ -104,9 +103,9 @@ namespace Dune { */ void addLocalIndex (const IndexTripel& x) { - if (get<2>(x)!=OwnerOverlapCopyAttributeSet::owner && - get<2>(x)!=OwnerOverlapCopyAttributeSet::overlap && - get<2>(x)!=OwnerOverlapCopyAttributeSet::copy) + if (std::get<2>(x)!=OwnerOverlapCopyAttributeSet::owner && + std::get<2>(x)!=OwnerOverlapCopyAttributeSet::overlap && + std::get<2>(x)!=OwnerOverlapCopyAttributeSet::copy) DUNE_THROW(ISTLError,"OwnerOverlapCopyCommunication: global index not in index set"); localindices.insert(x); } @@ -118,9 +117,9 @@ namespace Dune { */ void addRemoteIndex (const RemoteIndexTripel& x) { - if (get<2>(x)!=OwnerOverlapCopyAttributeSet::owner && - get<2>(x)!=OwnerOverlapCopyAttributeSet::overlap && - get<2>(x)!=OwnerOverlapCopyAttributeSet::copy) + if (std::get<2>(x)!=OwnerOverlapCopyAttributeSet::owner && + std::get<2>(x)!=OwnerOverlapCopyAttributeSet::overlap && + std::get<2>(x)!=OwnerOverlapCopyAttributeSet::copy) DUNE_THROW(ISTLError,"OwnerOverlapCopyCommunication: global index not in index set"); remoteindices.insert(x); } @@ -598,13 +597,13 @@ namespace Dune { pis.beginResize(); for (localindex_iterator i=indexinfo.localIndices().begin(); i!=indexinfo.localIndices().end(); ++i) { - if (get<2>(*i)==OwnerOverlapCopyAttributeSet::owner) - pis.add(get<0>(*i),LI(get<1>(*i),OwnerOverlapCopyAttributeSet::owner,true)); - if (get<2>(*i)==OwnerOverlapCopyAttributeSet::overlap) - pis.add(get<0>(*i),LI(get<1>(*i),OwnerOverlapCopyAttributeSet::overlap,true)); - if (get<2>(*i)==OwnerOverlapCopyAttributeSet::copy) - pis.add(get<0>(*i),LI(get<1>(*i),OwnerOverlapCopyAttributeSet::copy,true)); - // std::cout << cc.rank() << ": adding index " << get<0>(*i) << " " << get<1>(*i) << " " << get<2>(*i) << std::endl; + if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::owner) + pis.add(std::get<0>(*i),LI(std::get<1>(*i),OwnerOverlapCopyAttributeSet::owner,true)); + if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::overlap) + pis.add(std::get<0>(*i),LI(std::get<1>(*i),OwnerOverlapCopyAttributeSet::overlap,true)); + if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::copy) + pis.add(std::get<0>(*i),LI(std::get<1>(*i),OwnerOverlapCopyAttributeSet::copy,true)); + // std::cout << cc.rank() << ": adding index " << std::get<0>(*i) << " " << std::get<1>(*i) << " " << std::get<2>(*i) << std::endl; } pis.endResize(); @@ -614,32 +613,32 @@ namespace Dune { if (indexinfo.remoteIndices().size()>0) { remoteindex_iterator i=indexinfo.remoteIndices().begin(); - int p = get<0>(*i); + int p = std::get<0>(*i); RILM modifier = ri.template getModifier<false,true>(p); typename PIS::const_iterator pi=pis.begin(); for ( ; i!=indexinfo.remoteIndices().end(); ++i) { // handle processor change - if (p!=get<0>(*i)) + if (p!=std::get<0>(*i)) { - p = get<0>(*i); + p = std::get<0>(*i); modifier = ri.template getModifier<false,true>(p); pi=pis.begin(); } // position to correct entry in parallel index set - while (pi->global()!=get<1>(*i) && pi!=pis.end()) + while (pi->global()!=std::get<1>(*i) && pi!=pis.end()) ++pi; if (pi==pis.end()) DUNE_THROW(ISTLError,"OwnerOverlapCopyCommunication: global index not in index set"); // insert entry - // std::cout << cc.rank() << ": adding remote index " << get<0>(*i) << " " << get<1>(*i) << " " << get<2>(*i) << std::endl; - if (get<2>(*i)==OwnerOverlapCopyAttributeSet::owner) + // std::cout << cc.rank() << ": adding remote index " << std::get<0>(*i) << " " << std::get<1>(*i) << " " << std::get<2>(*i) << std::endl; + if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::owner) modifier.insert(RX(OwnerOverlapCopyAttributeSet::owner,&(*pi))); - if (get<2>(*i)==OwnerOverlapCopyAttributeSet::overlap) + if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::overlap) modifier.insert(RX(OwnerOverlapCopyAttributeSet::overlap,&(*pi))); - if (get<2>(*i)==OwnerOverlapCopyAttributeSet::copy) + if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::copy) modifier.insert(RX(OwnerOverlapCopyAttributeSet::copy,&(*pi))); } }else{ diff --git a/dune/istl/paamg/aggregates.hh b/dune/istl/paamg/aggregates.hh index c0b6d10e683df96f521952f63f11add2d790f251..850355e5b49e76fdd180018a4810d63cbe960fde 100644 --- a/dune/istl/paamg/aggregates.hh +++ b/dune/istl/paamg/aggregates.hh @@ -10,7 +10,6 @@ #include "combinedfunctor.hh" #include <dune/common/timer.hh> -#include <dune/common/tuples.hh> #include <dune/common/stdstreams.hh> #include <dune/common/poolallocator.hh> #include <dune/common/sllist.hh> @@ -23,6 +22,7 @@ #include <complex> #include <limits> #include <ostream> +#include <tuple> namespace Dune { @@ -617,8 +617,8 @@ namespace Dune * the number of skipped aggregates built. */ template<class M, class G, class C> - tuple<int,int,int,int> buildAggregates(const M& matrix, G& graph, const C& criterion, - bool finestLevel); + std::tuple<int,int,int,int> buildAggregates(const M& matrix, G& graph, const C& criterion, + bool finestLevel); /** * @brief Breadth first search within an aggregate @@ -944,9 +944,9 @@ namespace Dune * the number of skipped aggregates built. */ template<class M, class C> - tuple<int,int,int,int> build(const M& m, G& graph, - AggregatesMap<Vertex>& aggregates, const C& c, - bool finestLevel); + std::tuple<int,int,int,int> build(const M& m, G& graph, + AggregatesMap<Vertex>& aggregates, const C& c, + bool finestLevel); private: /** * @brief The allocator we use for our lists and the @@ -1996,7 +1996,7 @@ namespace Dune { DependencyCounter unused, aggregated; typedef AggregateVisitor<DependencyCounter> Counter; - typedef tuple<Counter,Counter> CounterTuple; + typedef std::tuple<Counter,Counter> CounterTuple; CombinedFunctor<CounterTuple> visitors(CounterTuple(Counter(aggregates, AggregatesMap<Vertex>::UNAGGREGATED, unused), Counter(aggregates, aggregate, aggregated))); visitNeighbours(*graph_, vertex, visitors); return std::make_pair(unused.value(), aggregated.value()); @@ -2369,8 +2369,8 @@ namespace Dune template<typename V> template<typename M, typename G, typename C> - tuple<int,int,int,int> AggregatesMap<V>::buildAggregates(const M& matrix, G& graph, const C& criterion, - bool finestLevel) + std::tuple<int,int,int,int> AggregatesMap<V>::buildAggregates(const M& matrix, G& graph, const C& criterion, + bool finestLevel) { Aggregator<G> aggregator; return aggregator.build(matrix, graph, *this, criterion, finestLevel); @@ -2378,8 +2378,8 @@ namespace Dune template<class G> template<class M, class C> - tuple<int,int,int,int> Aggregator<G>::build(const M& m, G& graph, AggregatesMap<Vertex>& aggregates, const C& c, - bool finestLevel) + std::tuple<int,int,int,int> Aggregator<G>::build(const M& m, G& graph, AggregatesMap<Vertex>& aggregates, const C& c, + bool finestLevel) { // Stack for fast vertex access Stack stack_(graph, *this, aggregates); @@ -2519,8 +2519,8 @@ namespace Dune <<" avg="<<avg/(conAggregates+isoAggregates)<<std::endl; delete aggregate_; - return make_tuple(conAggregates+isoAggregates,isoAggregates, - oneAggregates,skippedAggregates); + return std::make_tuple(conAggregates+isoAggregates,isoAggregates, + oneAggregates,skippedAggregates); } diff --git a/dune/istl/paamg/combinedfunctor.hh b/dune/istl/paamg/combinedfunctor.hh index ae911b78b41e62c7a801a66c0c736214bd5c1f74..79afdcdf0defeab0d8db1382734f036122ca29d4 100644 --- a/dune/istl/paamg/combinedfunctor.hh +++ b/dune/istl/paamg/combinedfunctor.hh @@ -3,7 +3,10 @@ #ifndef DUNE_AMG_COMBINEDFUNCTOR_HH #define DUNE_AMG_COMBINEDFUNCTOR_HH -#include <dune/common/tuples.hh> +#include <tuple> + +#include <dune/common/unused.hh> + namespace Dune { namespace Amg @@ -15,7 +18,7 @@ namespace Dune template<class TT, class T> static void apply(TT tuple, const T& t) { - get<i-1>(tuple) (t); + std::get<i-1>(tuple) (t); ApplyHelper<i-1>::apply(tuple, t); } }; @@ -42,7 +45,7 @@ namespace Dune template<class T1> void operator()(const T1& t) { - ApplyHelper<tuple_size<T>::value>::apply(*this, t); + ApplyHelper<std::tuple_size<T>::value>::apply(*this, t); } }; diff --git a/dune/istl/paamg/graphcreator.hh b/dune/istl/paamg/graphcreator.hh index 9a76c35b0b8b5903212a3a621cb08a2e4cb98cec..7dd7f37803f5886a4c19fbb1b7ab6d63f982febb 100644 --- a/dune/istl/paamg/graphcreator.hh +++ b/dune/istl/paamg/graphcreator.hh @@ -3,12 +3,13 @@ #ifndef DUNE_AMG_GRAPHCREATOR_HH #define DUNE_AMG_GRAPHCREATOR_HH +#include <tuple> + #include "graph.hh" #include "dependency.hh" #include "pinfo.hh" #include <dune/istl/operators.hh> #include <dune/istl/bcrsmatrix.hh> -#include <dune/common/tuples.hh> #include <dune/common/unused.hh> namespace Dune @@ -32,7 +33,7 @@ namespace Dune IdentityMap, IdentityMap> PropertiesGraph; - typedef Dune::tuple<MatrixGraph*,PropertiesGraph*> GraphTuple; + typedef std::tuple<MatrixGraph*,PropertiesGraph*> GraphTuple; template<class OF, class T> static GraphTuple create(const M& matrix, T& excluded, @@ -48,7 +49,7 @@ namespace Dune static void free(GraphTuple& graphs) { - delete get<1>(graphs); + delete std::get<1>(graphs); } }; @@ -67,7 +68,7 @@ namespace Dune typename SubGraph::EdgeIndexMap> PropertiesGraph; - typedef Dune::tuple<MatrixGraph*,PropertiesGraph*,SubGraph*> GraphTuple; + typedef std::tuple<MatrixGraph*,PropertiesGraph*,SubGraph*> GraphTuple; template<class OF, class T, class PI> static GraphTuple create(const M& matrix, T& excluded, @@ -88,8 +89,8 @@ namespace Dune static void free(GraphTuple& graphs) { - delete get<2>(graphs); - delete get<1>(graphs); + delete std::get<2>(graphs); + delete std::get<1>(graphs); } }; @@ -107,7 +108,7 @@ namespace Dune typename SubGraph::EdgeIndexMap> PropertiesGraph; - typedef Dune::tuple<MatrixGraph*,PropertiesGraph*,SubGraph*> GraphTuple; + typedef std::tuple<MatrixGraph*,PropertiesGraph*,SubGraph*> GraphTuple; template<class OF, class T, class PI> static GraphTuple create(const M& matrix, T& excluded, @@ -128,8 +129,8 @@ namespace Dune static void free(GraphTuple& graphs) { - delete get<2>(graphs); - delete get<1>(graphs); + delete std::get<2>(graphs); + delete std::get<1>(graphs); } }; diff --git a/dune/istl/paamg/hierarchy.hh b/dune/istl/paamg/hierarchy.hh index 3399c6a8f34232bd8233d1ac315d0ca325ff0f50..cd6f37734584951ec8f72abef12db0d31394d973 100644 --- a/dune/istl/paamg/hierarchy.hh +++ b/dune/istl/paamg/hierarchy.hh @@ -7,6 +7,7 @@ #include <memory> #include <limits> #include <algorithm> +#include <tuple> #include "aggregates.hh" #include "graph.hh" #include "galerkin.hh" @@ -15,7 +16,6 @@ #include <dune/common/stdstreams.hh> #include <dune/common/unused.hh> #include <dune/common/timer.hh> -#include <dune/common/tuples.hh> #include <dune/common/bigunsignedint.hh> #include <dune/istl/bvector.hh> #include <dune/common/parallel/indexset.hh> @@ -777,7 +777,7 @@ namespace Dune GraphTuple graphs = GraphCreator::create(*matrix, excluded, *info, OverlapFlags()); - AggregatesMap* aggregatesMap=new AggregatesMap(get<1>(graphs)->maxVertex()+1); + AggregatesMap* aggregatesMap=new AggregatesMap(std::get<1>(graphs)->maxVertex()+1); aggregatesMaps_.push_back(aggregatesMap); @@ -785,8 +785,8 @@ namespace Dune watch.reset(); int noAggregates, isoAggregates, oneAggregates, skippedAggregates; - tie(noAggregates, isoAggregates, oneAggregates, skippedAggregates) = - aggregatesMap->buildAggregates(matrix->getmat(), *(get<1>(graphs)), criterion, level==0); + std::tie(noAggregates, isoAggregates, oneAggregates, skippedAggregates) = + aggregatesMap->buildAggregates(matrix->getmat(), *(std::get<1>(graphs)), criterion, level==0); if(rank==0 && criterion.debugLevel()>2) std::cout<<" Have built "<<noAggregates<<" aggregates totally ("<<isoAggregates<<" isolated aggregates, "<< @@ -882,12 +882,12 @@ namespace Dune ++infoLevel; // parallel information on coarse level typename PropertyMapTypeSelector<VertexVisitedTag,PropertiesGraph>::Type visitedMap = - get(VertexVisitedTag(), *(get<1>(graphs))); + get(VertexVisitedTag(), *(std::get<1>(graphs))); watch.reset(); int aggregates = IndicesCoarsener<ParallelInformation,OverlapFlags> ::coarsen(*info, - *(get<1>(graphs)), + *(std::get<1>(graphs)), visitedMap, *aggregatesMap, *infoLevel, @@ -925,7 +925,7 @@ namespace Dune typename MatrixOperator::matrix_type* coarseMatrix; - coarseMatrix = productBuilder.build(*(get<0>(graphs)), visitedMap2, + coarseMatrix = productBuilder.build(*(std::get<0>(graphs)), visitedMap2, *info, *aggregatesMap, aggregates, @@ -934,7 +934,7 @@ namespace Dune watch.reset(); info->freeGlobalLookup(); - delete get<0>(graphs); + delete std::get<0>(graphs); productBuilder.calculate(matrix->getmat(), *aggregatesMap, *coarseMatrix, *infoLevel, OverlapFlags()); if(criterion.debugLevel()>2) { diff --git a/dune/istl/paamg/test/galerkintest.cc b/dune/istl/paamg/test/galerkintest.cc index 2b2fa8fba417babd57cd30aaa7c8737547644be2..6bb22e94f5192997e79c3b0308e1332e664bddb7 100644 --- a/dune/istl/paamg/test/galerkintest.cc +++ b/dune/istl/paamg/test/galerkintest.cc @@ -3,6 +3,7 @@ #include <config.h> #include <iostream> +#include <tuple> #include <dune/common/enumset.hh> #include <dune/common/propertymap.hh> #include <dune/common/parallel/communicator.hh> @@ -71,7 +72,7 @@ void testCoarsenIndices(int N) int noAggregates, isoAggregates, oneAggregates, skipped; - Dune::tie(noAggregates, isoAggregates, oneAggregates,skipped) = aggregatesMap.buildAggregates(mat, pg, Criterion(), false); + std::tie(noAggregates, isoAggregates, oneAggregates,skipped) = aggregatesMap.buildAggregates(mat, pg, Criterion(), false); Dune::Amg::printAggregates2d(aggregatesMap, n, N, std::cout); diff --git a/dune/istl/paamg/twolevelmethod.hh b/dune/istl/paamg/twolevelmethod.hh index 43fd65832681286bbd5a265d4185eabdb182c49c..250194dde810ea7aeabdca539e9fccc836022482 100644 --- a/dune/istl/paamg/twolevelmethod.hh +++ b/dune/istl/paamg/twolevelmethod.hh @@ -3,6 +3,8 @@ #ifndef DUNE_ISTL_TWOLEVELMETHOD_HH #define DUNE_ISTL_TWOLEVELMETHOD_HH +#include <tuple> + #include<dune/istl/operators.hh> #include"amg.hh" #include"galerkin.hh" @@ -164,7 +166,7 @@ public: int noAggregates, isoAggregates, oneAggregates, skippedAggregates; - tie(noAggregates, isoAggregates, oneAggregates, skippedAggregates) = + std::tie(noAggregates, isoAggregates, oneAggregates, skippedAggregates) = aggregatesMap_->buildAggregates(fineOperator.getmat(), pg, criterion_, true); std::cout<<"no aggregates="<<noAggregates<<" iso="<<isoAggregates<<" one="<<oneAggregates<<" skipped="<<skippedAggregates<<std::endl; // misuse coarsener to renumber aggregates