diff --git a/dune/istl/overlappingschwarz.hh b/dune/istl/overlappingschwarz.hh index 823b78bfc77654a07eade14acbb4d403a65aac9e..0821b85ec1c23b3aa88cf9f3f6069e4cdcf57dd1 100644 --- a/dune/istl/overlappingschwarz.hh +++ b/dune/istl/overlappingschwarz.hh @@ -4,11 +4,11 @@ #define DUNE_ISTL_OVERLAPPINGSCHWARZ_HH #include <cassert> #include <algorithm> +#include <forward_list> #include <functional> #include <vector> #include <set> #include <dune/common/dynmatrix.hh> -#include <dune/common/sllist.hh> #include <dune/common/unused.hh> #include "preconditioners.hh" #include "superlu.hh" @@ -784,7 +784,7 @@ namespace Dune typedef std::vector<subdomain_type, typename TA::template rebind<subdomain_type>::other> subdomain_vector; /** @brief The type for the row to subdomain mapping. */ - typedef SLList<size_type, typename TA::template rebind<size_type>::other> subdomain_list; + typedef std::forward_list<size_type, typename TA::template rebind<size_type>::other> subdomain_list; /** @brief The vector type containing the row index to subdomain mapping. */ typedef std::vector<subdomain_list, typename TA::template rebind<subdomain_list>::other > rowtodomain_vector; @@ -1078,7 +1078,7 @@ namespace Dune for(DomainIterator domain=sd.begin(); domain != sd.end(); ++domain, ++domainId) { typedef typename subdomain_type::const_iterator iterator; for(iterator row=domain->begin(); row != domain->end(); ++row) - rowToDomain[*row].push_back(domainId); + rowToDomain[*row].push_front(domainId); } maxlength = SeqOverlappingSchwarzAssembler<slu> diff --git a/dune/istl/paamg/aggregates.hh b/dune/istl/paamg/aggregates.hh index a2a17659b2361c1fba6350bc472dc3f38c76e849..7acf87fed89a89b5b46163a4faf8c8247ee34ae9 100644 --- a/dune/istl/paamg/aggregates.hh +++ b/dune/istl/paamg/aggregates.hh @@ -13,7 +13,6 @@ #include <dune/common/timer.hh> #include <dune/common/stdstreams.hh> #include <dune/common/poolallocator.hh> -#include <dune/common/sllist.hh> #include <dune/common/unused.hh> #include <dune/common/ftraits.hh> @@ -21,6 +20,7 @@ #include <set> #include <algorithm> #include <complex> +#include <forward_list> #include <limits> #include <ostream> #include <tuple> @@ -585,7 +585,7 @@ namespace Dune * @brief The type of a single linked list of vertex * descriptors. */ - typedef SLList<VertexDescriptor,Allocator> VertexList; + typedef std::forward_list<VertexDescriptor,Allocator> VertexList; /** * @brief A Dummy visitor that does nothing for each visited edge. @@ -960,7 +960,7 @@ namespace Dune /** * @brief The single linked list we use. */ - typedef SLList<Vertex,Allocator> VertexList; + typedef std::forward_list<Vertex,Allocator> VertexList; /** * @brief The set of vertices we use. @@ -1236,7 +1236,7 @@ namespace Dune * @param aggregates The mapping of the vertices onto the aggregates. * @return True if there is a connection to the aggregate. */ - bool connected(const Vertex& vertex, const SLList<AggregateDescriptor>& aggregateList, + bool connected(const Vertex& vertex, const std::forward_list<AggregateDescriptor>& aggregateList, const AggregatesMap<Vertex>& aggregates) const; /** @@ -1376,7 +1376,7 @@ namespace Dune */ void nonisoNeighbourAggregate(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates, - SLList<Vertex>& neighbours) const; + std::forward_list<Vertex>& neighbours) const; /** * @brief Grows the aggregate from a seed. @@ -1742,12 +1742,12 @@ namespace Dune typedef typename L::const_iterator ListIterator; int visitedSpheres = 0; - visited.push_back(start); + visited.push_front(start); put(visitedMap, start, true); ListIterator current = visited.begin(); ListIterator end = visited.end(); - std::size_t i=0, size=visited.size(); + std::size_t i=0, size=std::distance(visited.begin(), visited.end()); // visit the neighbours of all vertices of the // current sphere. @@ -1763,7 +1763,7 @@ namespace Dune if(aggregates_[edge.target()]==aggregate) { if(!get(visitedMap, edge.target())) { put(visitedMap, edge.target(), true); - visited.push_back(edge.target()); + visited.push_front(edge.target()); aggregateVisitor(edge); } }else @@ -1771,7 +1771,7 @@ namespace Dune } } end = visited.end(); - size = visited.size(); + size = std::distance(visited.begin(), visited.end()); if(current != end) visitedSpheres++; } @@ -2149,7 +2149,7 @@ namespace Dune inline void Aggregator<G>::nonisoNeighbourAggregate(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates, - SLList<Vertex>& neighbours) const + std::forward_list<Vertex>& neighbours) const { typedef typename MatrixGraph::ConstEdgeIterator Iterator; Iterator end=graph_->beginEdges(vertex); @@ -2158,7 +2158,7 @@ namespace Dune for(Iterator edge=graph_->beginEdges(vertex); edge!=end; ++edge) { if(aggregates[edge.target()]!=AggregatesMap<Vertex>::UNAGGREGATED && graph_->getVertexProperties(edge.target()).isolated()) - neighbours.push_back(aggregates[edge.target()]); + neighbours.push_front(aggregates[edge.target()]); } } @@ -2213,10 +2213,10 @@ namespace Dune } template<class G> inline bool Aggregator<G>::connected(const Vertex& vertex, - const SLList<AggregateDescriptor>& aggregateList, + const std::forward_list<AggregateDescriptor>& aggregateList, const AggregatesMap<Vertex>& aggregates) const { - typedef typename SLList<AggregateDescriptor>::const_iterator Iter; + typedef typename std::forward_list<AggregateDescriptor>::const_iterator Iter; for(Iter i=aggregateList.begin(); i!=aggregateList.end(); ++i) if(connected(vertex, *i, aggregates)) return true; @@ -2227,7 +2227,7 @@ namespace Dune template<class C> void Aggregator<G>::growIsolatedAggregate(const Vertex& seed, const AggregatesMap<Vertex>& aggregates, const C& c) { - SLList<Vertex> connectedAggregates; + std::forward_list<Vertex> connectedAggregates; nonisoNeighbourAggregate(seed, aggregates,connectedAggregates); while(aggregate_->size()< c.minAggregateSize() && aggregate_->connectSize() < c.maxConnectivity()) { @@ -2242,7 +2242,7 @@ namespace Dune if(distance(*vertex, aggregates)>c.maxDistance()) continue; // distance of proposes aggregate too big - if(connectedAggregates.size()>0) { + if(std::distance(connectedAggregates.begin(), connectedAggregates.end()) > 0) { // there is already a neighbour cluster // front node must be connected to same neighbour cluster diff --git a/dune/istl/test/overlappingschwarztest.cc b/dune/istl/test/overlappingschwarztest.cc index f406d91e7511c78546e467bc346cf12e88bdb8a8..f6b7d0844743afebd52d0db206536304026efaa4 100644 --- a/dune/istl/test/overlappingschwarztest.cc +++ b/dune/istl/test/overlappingschwarztest.cc @@ -9,7 +9,6 @@ #include <dune/common/fvector.hh> #include "laplacian.hh" #include <dune/common/timer.hh> -#include <dune/common/sllist.hh> #include <dune/istl/overlappingschwarz.hh> #include <dune/istl/solvers.hh> #include<dune/istl/superlu.hh> @@ -72,7 +71,7 @@ int main(int argc, char** argv) int mainDomain=ydomain*domainsPerDim+xdomain; int id=j*N+i; domains[mainDomain].insert(id); - rowToDomain[id].push_back(mainDomain); + rowToDomain[id].push_front(mainDomain); // check left domain int domain = (i-overlap)/domainSize; @@ -80,7 +79,7 @@ int main(int argc, char** argv) if(domain>=0 && domain<domainsPerDim && neighbourDomain!=mainDomain) { domains[neighbourDomain].insert(id); - rowToDomain[id].push_back(neighbourDomain); + rowToDomain[id].push_front(neighbourDomain); } //check right domain @@ -89,7 +88,7 @@ int main(int argc, char** argv) if(domain>=0 && domain<domainsPerDim && neighbourDomain!=mainDomain) { domains[neighbourDomain].insert(id); - rowToDomain[id].push_back(neighbourDomain); + rowToDomain[id].push_front(neighbourDomain); } // check lower domain @@ -98,7 +97,7 @@ int main(int argc, char** argv) if(domain>=0 && domain<domainsPerDim && neighbourDomain!=mainDomain) { domains[neighbourDomain].insert(id); - rowToDomain[id].push_back(neighbourDomain); + rowToDomain[id].push_front(neighbourDomain); } //check upper domain @@ -107,7 +106,7 @@ int main(int argc, char** argv) if(domain>=0 && domain<domainsPerDim && neighbourDomain!=mainDomain) { domains[neighbourDomain].insert(id); - rowToDomain[id].push_back(domain*domainsPerDim+xdomain); + rowToDomain[id].push_front(domain*domainsPerDim+xdomain); } }