Loading...
Searching...
No Matches
indexset.hh
Go to the documentation of this file.
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
#ifndef DUNE_COMMON_PARALLEL_INDEXSET_HH
#define DUNE_COMMON_PARALLEL_INDEXSET_HH
#include <algorithm>
#include <cstdint> // for uint32_t
#include <iostream>
#include <dune/common/arraylist.hh>
#include <dune/common/exceptions.hh>
#include <dune/common/parallel/localindex.hh>
#include <dune/common/parallel/mpitraits.hh>
namespace Dune
{
// forward declarations
template<class TG, class TL>
class IndexPair;
template<class TG, class TL>
std::ostream& operator<<(std::ostream& os, const IndexPair<TG,TL>& pair);
template<class TG, class TL>
bool operator==(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
template<class TG, class TL>
bool operator!=(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
template<class TG, class TL>
bool operator<(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
template<class TG, class TL>
bool operator>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
template<class TG, class TL>
bool operator<=(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
template<class TG, class TL>
bool operator >=(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
template<class TG, class TL>
bool operator==(const IndexPair<TG,TL>&, const TG&);
template<class TG, class TL>
bool operator!=(const IndexPair<TG,TL>&, const TG&);
template<class TG, class TL>
bool operator<(const IndexPair<TG,TL>&, const TG&);
template<class TG, class TL>
bool operator>(const IndexPair<TG,TL>&, const TG&);
template<class TG, class TL>
bool operator<=(const IndexPair<TG,TL>&, const TG&);
template<class TG, class TL>
bool operator >=(const IndexPair<TG,TL>&, const TG&);
template<typename T>
struct MPITraits;
template<class TG, class TL>
class IndexPair
{
friend std::ostream& operator<< <>(std::ostream&, const IndexPair<TG,TL>&);
friend bool operator==<>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
friend bool operator!=<>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
friend bool operator< <>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
friend bool operator><>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
friend bool operator<=<>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
friend bool operator>=<>(const IndexPair<TG,TL>&, const IndexPair<TG,TL>&);
friend bool operator==<>(const IndexPair<TG,TL>&, const TG &);
friend bool operator!=<>(const IndexPair<TG,TL>&, const TG &);
friend bool operator< <>(const IndexPair<TG,TL>&, const TG &);
friend bool operator> <>(const IndexPair<TG,TL>&, const TG &);
friend bool operator<=<>(const IndexPair<TG,TL>&, const TG &);
friend bool operator>=<>(const IndexPair<TG,TL>&, const TG &);
friend struct MPITraits<IndexPair<TG,TL> >;
public:
typedef TG GlobalIndex;
typedef TL LocalIndex;
IndexPair(const GlobalIndex& global, const LocalIndex& local);
IndexPair();
IndexPair(const GlobalIndex& global);
inline const GlobalIndex& global() const;
inline LocalIndex& local();
inline const LocalIndex& local() const;
inline void setLocal(int index);
private:
GlobalIndex global_;
LocalIndex local_;
};
enum ParallelIndexSetState
{
GROUND,
RESIZE
};
class InvalidIndexSetState : public InvalidStateException {};
// Forward declaration
template<class I> class GlobalLookupIndexSet;
template<typename TG, typename TL, int N=100>
class ParallelIndexSet
{
friend class GlobalLookupIndexSet<ParallelIndexSet<TG,TL,N> >;
public:
typedef TG GlobalIndex;
typedef TL LocalIndex;
typedef Dune::IndexPair<GlobalIndex,LocalIndex> IndexPair;
constexpr static int arraySize = (N>0) ? N : 1;
class iterator :
public ArrayList<IndexPair,N>::iterator
{
typedef typename ArrayList<IndexPair,N>::iterator
Father;
friend class ParallelIndexSet<GlobalIndex,LocalIndex,N>;
public:
iterator(ParallelIndexSet<TG,TL,N>& indexSet, const Father& father)
: Father(father), indexSet_(&indexSet)
{}
private:
inline void markAsDeleted() const
{
#ifndef NDEBUG
if(indexSet_->state_ != RESIZE)
DUNE_THROW(InvalidIndexSetState, "Indices can only be removed "
<<"while in RESIZE state!");
#endif
Father::operator*().local().setState(DELETED);
}
ParallelIndexSet<TG,TL,N>* indexSet_;
};
typedef typename
ArrayList<IndexPair,N>::const_iterator
const_iterator;
ParallelIndexSet();
inline const ParallelIndexSetState& state()
{
return state_;
}
void beginResize();
inline void add(const GlobalIndex& global);
inline void add(const GlobalIndex& global, const LocalIndex& local);
inline void markAsDeleted(const iterator& position);
void endResize();
inline IndexPair&
operator[](const GlobalIndex& global);
inline IndexPair&
at(const GlobalIndex& global);
inline bool
exists (const GlobalIndex& global) const;
inline const IndexPair&
operator[](const GlobalIndex& global) const;
inline const IndexPair&
at(const GlobalIndex& global) const;
inline iterator begin();
inline iterator end();
inline const_iterator begin() const;
inline const_iterator end() const;
inline void renumberLocal();
inline int seqNo() const;
inline size_t size() const;
private:
ArrayList<IndexPair,N> localIndices_;
ArrayList<IndexPair,N> newIndices_;
ParallelIndexSetState state_;
int seqNo_;
bool deletedEntries_;
inline void merge();
};
template<class TG, class TL, int N>
std::ostream& operator<<(std::ostream& os, const ParallelIndexSet<TG,TL,N>& indexSet);
template<class I>
class GlobalLookupIndexSet
{
public:
typedef I ParallelIndexSet;
typedef typename ParallelIndexSet::LocalIndex LocalIndex;
typedef typename ParallelIndexSet::GlobalIndex GlobalIndex;
typedef typename ParallelIndexSet::const_iterator const_iterator;
typedef Dune::IndexPair<typename I::GlobalIndex, typename I::LocalIndex> IndexPair;
GlobalLookupIndexSet(const ParallelIndexSet& indexset, std::size_t size);
GlobalLookupIndexSet(const ParallelIndexSet& indexset);
~GlobalLookupIndexSet();
inline const IndexPair&
operator[](const GlobalIndex& global) const;
inline const IndexPair*
pair(const std::size_t& local) const;
inline const_iterator begin() const;
inline const_iterator end() const;
inline int seqNo() const;
inline size_t size() const;
private:
const ParallelIndexSet& indexSet_;
std::size_t size_;
std::vector<const IndexPair*> indices_;
};
template<typename T>
struct LocalIndexComparator
{
static bool compare([[maybe_unused]] const T& t1, [[maybe_unused]] const T& t2)
{
return false;
}
};
template<class TG, class TL>
struct IndexSetSortFunctor
{
bool operator()(const IndexPair<TG,TL>& i1, const IndexPair<TG,TL>& i2)
{
return i1.global()<i2.global() || (i1.global()==i2.global() &&
LocalIndexComparator<TL>::compare(i1.local(),
i2.local()));
}
};
template<class TG, class TL>
inline std::ostream& operator<<(std::ostream& os, const IndexPair<TG,TL>& pair)
{
os<<"{global="<<pair.global_<<", local="<<pair.local_<<"}";
return os;
}
template<class TG, class TL, int N>
inline std::ostream& operator<<(std::ostream& os, const ParallelIndexSet<TG,TL,N>& indexSet)
{
typedef typename ParallelIndexSet<TG,TL,N>::const_iterator Iterator;
Iterator end = indexSet.end();
os<<"{";
for(Iterator index = indexSet.begin(); index != end; ++index)
os<<*index<<" ";
os<<"}";
return os;
}
template<class TG, class TL>
inline bool operator==(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
{
return a.global_==b.global_;
}
template<class TG, class TL>
inline bool operator!=(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
{
return a.global_!=b.global_;
}
template<class TG, class TL>
inline bool operator<(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
{
return a.global_<b.global_;
}
template<class TG, class TL>
inline bool operator>(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
{
return a.global_>b.global_;
}
template<class TG, class TL>
inline bool operator<=(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
{
return a.global_<=b.global_;
}
template<class TG, class TL>
inline bool operator >=(const IndexPair<TG,TL>& a, const IndexPair<TG,TL>& b)
{
return a.global_>=b.global_;
}
template<class TG, class TL>
inline bool operator==(const IndexPair<TG,TL>& a, const TG& b)
{
return a.global_==b;
}
template<class TG, class TL>
inline bool operator!=(const IndexPair<TG,TL>& a, const TG& b)
{
return a.global_!=b;
}
template<class TG, class TL>
inline bool operator<(const IndexPair<TG,TL>& a, const TG& b)
{
return a.global_<b;
}
template<class TG, class TL>
inline bool operator>(const IndexPair<TG,TL>& a, const TG& b)
{
return a.global_>b;
}
template<class TG, class TL>
inline bool operator<=(const IndexPair<TG,TL>& a, const TG& b)
{
return a.global_<=b;
}
template<class TG, class TL>
inline bool operator >=(const IndexPair<TG,TL>& a, const TG& b)
{
return a.global_>=b;
}
#ifndef DOXYGEN
template<class TG, class TL>
IndexPair<TG,TL>::IndexPair(const TG& global, const TL& local)
: global_(global), local_(local){}
template<class TG, class TL>
IndexPair<TG,TL>::IndexPair(const TG& global)
: global_(global), local_(){}
template<class TG, class TL>
IndexPair<TG,TL>::IndexPair()
: global_(), local_(){}
template<class TG, class TL>
inline const TG& IndexPair<TG,TL>::global() const {
return global_;
}
template<class TG, class TL>
inline TL& IndexPair<TG,TL>::local() {
return local_;
}
template<class TG, class TL>
inline const TL& IndexPair<TG,TL>::local() const {
return local_;
}
template<class TG, class TL>
inline void IndexPair<TG,TL>::setLocal(int local){
local_=local;
}
template<class TG, class TL, int N>
ParallelIndexSet<TG,TL,N>::ParallelIndexSet()
: state_(GROUND), seqNo_(0), deletedEntries_()
{}
template<class TG, class TL, int N>
void ParallelIndexSet<TG,TL,N>::beginResize()
{
// Checks in unproductive code
#ifndef NDEBUG
if(state_!=GROUND)
DUNE_THROW(InvalidIndexSetState,
"IndexSet has to be in GROUND state, when "
<< "beginResize() is called!");
#endif
state_ = RESIZE;
deletedEntries_ = false;
}
template<class TG, class TL, int N>
inline void ParallelIndexSet<TG,TL,N>::add(const GlobalIndex& global)
{
// Checks in unproductive code
#ifndef NDEBUG
if(state_ != RESIZE)
DUNE_THROW(InvalidIndexSetState, "Indices can only be added "
<<"while in RESIZE state!");
#endif
newIndices_.push_back(IndexPair(global));
}
template<class TG, class TL, int N>
inline void ParallelIndexSet<TG,TL,N>::add(const TG& global, const TL& local)
{
// Checks in unproductive code
#ifndef NDEBUG
if(state_ != RESIZE)
DUNE_THROW(InvalidIndexSetState, "Indices can only be added "
<<"while in RESIZE state!");
#endif
newIndices_.push_back(IndexPair(global,local));
}
template<class TG, class TL, int N>
inline void ParallelIndexSet<TG,TL,N>::markAsDeleted(const iterator& global)
{
// Checks in unproductive code
#ifndef NDEBUG
if(state_ != RESIZE)
DUNE_THROW(InvalidIndexSetState, "Indices can only be removed "
<<"while in RESIZE state!");
#endif
deletedEntries_ = true;
global.markAsDeleted();
}
template<class TG, class TL, int N>
void ParallelIndexSet<TG,TL,N>::endResize() {
// Checks in unproductive code
#ifndef NDEBUG
if(state_ != RESIZE)
DUNE_THROW(InvalidIndexSetState, "endResize called while not "
<<"in RESIZE state!");
#endif
std::sort(newIndices_.begin(), newIndices_.end(), IndexSetSortFunctor<TG,TL>());
merge();
seqNo_++;
state_ = GROUND;
}
template<class TG, class TL, int N>
inline void ParallelIndexSet<TG,TL,N>::merge(){
if(localIndices_.size()==0)
{
localIndices_=newIndices_;
newIndices_.clear();
}
else if(newIndices_.size()>0 || deletedEntries_)
{
ArrayList<IndexPair,N> tempPairs;
auto old = localIndices_.begin();
auto added = newIndices_.begin();
const auto endold = localIndices_.end();
const auto endadded = newIndices_.end();
while(old != endold && added!= endadded)
{
if(old->local().state()==DELETED) {
old.eraseToHere();
}
else
{
if(old->global() < added->global() ||
(old->global() == added->global()
&& LocalIndexComparator<TL>::compare(old->local(),added->local())))
{
tempPairs.push_back(*old);
old.eraseToHere();
continue;
}else
{
tempPairs.push_back(*added);
added.eraseToHere();
}
}
}
while(old != endold)
{
if(old->local().state()!=DELETED) {
tempPairs.push_back(*old);
}
old.eraseToHere();
}
while(added!= endadded)
{
tempPairs.push_back(*added);
added.eraseToHere();
}
localIndices_ = tempPairs;
}
}
template<class TG, class TL, int N>
inline const IndexPair<TG,TL>&
ParallelIndexSet<TG,TL,N>::at(const TG& global) const
{
// perform a binary search
int low=0, high=localIndices_.size()-1, probe=-1;
while(low<high)
{
probe = (high + low) / 2;
if(global <= localIndices_[probe].global())
high = probe;
else
low = probe+1;
}
if(probe==-1)
DUNE_THROW(RangeError, "No entries!");
if( localIndices_[low].global() != global)
DUNE_THROW(RangeError, "Could not find entry of "<<global);
else
return localIndices_[low];
}
template<class TG, class TL, int N>
inline const IndexPair<TG,TL>&
ParallelIndexSet<TG,TL,N>::operator[](const TG& global) const
{
// perform a binary search
int low=0, high=localIndices_.size()-1, probe=-1;
while(low<high)
{
probe = (high + low) / 2;
if(global <= localIndices_[probe].global())
high = probe;
else
low = probe+1;
}
return localIndices_[low];
}
template<class TG, class TL, int N>
inline IndexPair<TG,TL>& ParallelIndexSet<TG,TL,N>::at(const TG& global)
{
// perform a binary search
int low=0, high=localIndices_.size()-1, probe=-1;
while(low<high)
{
probe = (high + low) / 2;
if(localIndices_[probe].global() >= global)
high = probe;
else
low = probe+1;
}
if(probe==-1)
DUNE_THROW(RangeError, "No entries!");
if( localIndices_[low].global() != global)
DUNE_THROW(RangeError, "Could not find entry of "<<global);
else
return localIndices_[low];
}
template<class TG, class TL, int N>
inline bool ParallelIndexSet<TG,TL,N>::exists (const TG& global) const
{
// perform a binary search
int low=0, high=localIndices_.size()-1, probe=-1;
while(low<high)
{
probe = (high + low) / 2;
if(localIndices_[probe].global() >= global)
high = probe;
else
low = probe+1;
}
if(probe==-1)
return false;
if( localIndices_[low].global() != global)
return false;
return true;
}
template<class TG, class TL, int N>
inline IndexPair<TG,TL>& ParallelIndexSet<TG,TL,N>::operator[](const TG& global)
{
// perform a binary search
int low=0, high=localIndices_.size()-1, probe=-1;
while(low<high)
{
probe = (high + low) / 2;
if(localIndices_[probe].global() >= global)
high = probe;
else
low = probe+1;
}
return localIndices_[low];
}
template<class TG, class TL, int N>
inline typename ParallelIndexSet<TG,TL,N>::iterator
ParallelIndexSet<TG,TL,N>::begin()
{
return iterator(*this, localIndices_.begin());
}
template<class TG, class TL, int N>
inline typename ParallelIndexSet<TG,TL,N>::iterator
ParallelIndexSet<TG,TL,N>::end()
{
return iterator(*this,localIndices_.end());
}
template<class TG, class TL, int N>
inline typename ParallelIndexSet<TG,TL,N>::const_iterator
ParallelIndexSet<TG,TL,N>::begin() const
{
return localIndices_.begin();
}
template<class TG, class TL, int N>
inline typename ParallelIndexSet<TG,TL,N>::const_iterator
ParallelIndexSet<TG,TL,N>::end() const
{
return localIndices_.end();
}
template<class TG, class TL, int N>
void ParallelIndexSet<TG,TL,N>::renumberLocal(){
#ifndef NDEBUG
if(state_==RESIZE)
DUNE_THROW(InvalidIndexSetState, "IndexSet has to be in "
<<"GROUND state for renumberLocal()");
#endif
const auto end_ = end();
uint32_t index=0;
for(auto pair=begin(); pair!=end_; index++, ++pair)
pair->local()=index;
}
template<class TG, class TL, int N>
inline int ParallelIndexSet<TG,TL,N>::seqNo() const
{
return seqNo_;
}
template<class TG, class TL, int N>
inline size_t ParallelIndexSet<TG,TL,N>::size() const
{
return localIndices_.size();
}
template<class I>
GlobalLookupIndexSet<I>::GlobalLookupIndexSet(const I& indexset,
std::size_t size)
: indexSet_(indexset), size_(size),
indices_(size_, static_cast<const IndexPair*>(0))
{
const_iterator end_ = indexSet_.end();
for(const_iterator pair = indexSet_.begin(); pair!=end_; ++pair) {
assert(pair->local()<size_);
indices_[pair->local()] = &(*pair);
}
}
template<class I>
GlobalLookupIndexSet<I>::GlobalLookupIndexSet(const I& indexset)
: indexSet_(indexset), size_(0)
{
const_iterator end_ = indexSet_.end();
for(const_iterator pair = indexSet_.begin(); pair!=end_; ++pair)
size_=std::max<std::size_t>(size_,pair->local());
indices_.resize(++size_, 0);
for(const_iterator pair = indexSet_.begin(); pair!=end_; ++pair)
indices_[pair->local()] = &(*pair);
}
template<class I>
GlobalLookupIndexSet<I>::~GlobalLookupIndexSet()
{}
template<class I>
inline const IndexPair<typename I::GlobalIndex, typename I::LocalIndex>*
GlobalLookupIndexSet<I>::pair(const std::size_t& local) const
{
return indices_[local];
}
template<class I>
inline const IndexPair<typename I::GlobalIndex, typename I::LocalIndex>&
GlobalLookupIndexSet<I>::operator[](const GlobalIndex& global) const
{
return indexSet_[global];
}
template<class I>
typename I::const_iterator GlobalLookupIndexSet<I>::begin() const
{
return indexSet_.begin();
}
template<class I>
typename I::const_iterator GlobalLookupIndexSet<I>::end() const
{
return indexSet_.end();
}
template<class I>
inline size_t GlobalLookupIndexSet<I>::size() const
{
return size_;
}
template<class I>
inline int GlobalLookupIndexSet<I>::seqNo() const
{
return indexSet_.seqNo();
}
template<typename TG, typename TL, int N, typename TG1, typename TL1, int N1>
bool operator==(const ParallelIndexSet<TG,TL,N>& idxset,
const ParallelIndexSet<TG1,TL1,N1>& idxset1)
{
if(idxset.size()!=idxset1.size())
return false;
typedef typename ParallelIndexSet<TG,TL,N>::const_iterator Iter;
typedef typename ParallelIndexSet<TG1,TL1,N1>::const_iterator Iter1;
Iter iter=idxset.begin();
for(Iter1 iter1=idxset1.begin(); iter1 != idxset1.end(); ++iter, ++iter1) {
if(iter1->global()!=iter->global())
return false;
typedef typename ParallelIndexSet<TG,TL,N>::LocalIndex PI;
const PI& pi=iter->local(), pi1=iter1->local();
if(pi!=pi1)
return false;
}
return true;
}
template<typename TG, typename TL, int N, typename TG1, typename TL1, int N1>
bool operator!=(const ParallelIndexSet<TG,TL,N>& idxset,
const ParallelIndexSet<TG1,TL1,N1>& idxset1)
{
return !(idxset==idxset1);
}
#endif // DOXYGEN
}
#endif // DUNE_COMMON_PARALLEL_INDEXSET_HH
mpitraits.hh
Traits classes for mapping types onto MPI_Datatype.
localindex.hh
Provides classes for use as the local index in ParallelIndexSet.
arraylist.hh
Implements a random-access container that can efficiently change size (similar to std::deque).
exceptions.hh
A few common exception classes.
Dune::ArrayList::begin
iterator begin()
Get an iterator that is positioned at the first element.
Definition arraylist.hh:515
Dune::ArrayList::end
iterator end()
Get a random access iterator positioned after the last element.
Definition arraylist.hh:527
Dune::operator<<
std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
Definition bigunsignedint.hh:301
DUNE_THROW
#define DUNE_THROW(E,...)
Definition exceptions.hh:314
Dune::operator>
constexpr EnableIfInterOperable< T1, T2, bool >::type operator>(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition iteratorfacades.hh:684
Dune::operator<
constexpr EnableIfInterOperable< T1, T2, bool >::type operator<(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition iteratorfacades.hh:638
Dune::operator<=
constexpr EnableIfInterOperable< T1, T2, bool >::type operator<=(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition iteratorfacades.hh:661
Dune::operator>=
constexpr EnableIfInterOperable< T1, T2, bool >::type operator>=(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
Comparison operator.
Definition iteratorfacades.hh:706
Dune::ParallelIndexSet::operator[]
IndexPair & operator[](const GlobalIndex &global)
Find the index pair with a specific global id.
Dune::ParallelIndexSet< TG, TL, N >::arraySize
static constexpr int arraySize
Definition indexset.hh:252
Dune::ParallelIndexSet::beginResize
void beginResize()
Indicate that the index set is to be resized.
Dune::ParallelIndexSetState
ParallelIndexSetState
The states the index set can be in.
Definition indexset.hh:181
Dune::ParallelIndexSet::renumberLocal
void renumberLocal()
Renumbers the local index numbers.
Dune::ParallelIndexSet::exists
bool exists(const GlobalIndex &global) const
Find the index pair with a specific global id.
Dune::ParallelIndexSet::size
size_t size() const
Get the total number (public and nonpublic) indices.
Dune::ParallelIndexSet::const_iterator
ArrayList< IndexPair, N >::const_iterator const_iterator
The constant iterator over the pairs.
Definition indexset.hh:296
Dune::IndexSetSortFunctor::operator()
bool operator()(const IndexPair< TG, TL > &i1, const IndexPair< TG, TL > &i2)
Definition indexset.hh:625
Dune::ParallelIndexSet::add
void add(const GlobalIndex &global)
Add an new index to the set.
Dune::IndexPair::operator>
friend bool operator>(const IndexPair< TG, TL > &, const IndexPair< TG, TL > &)
Definition indexset.hh:674
Dune::GlobalLookupIndexSet::end
const_iterator end() const
Get an iterator over the indices positioned after the last index.
Dune::IndexPair::local
const LocalIndex & local() const
Get the local index.
Dune::ParallelIndexSet::at
const IndexPair & at(const GlobalIndex &global) const
Find the index pair with a specific global id.
Dune::GlobalLookupIndexSet::GlobalLookupIndexSet
GlobalLookupIndexSet(const ParallelIndexSet &indexset)
Constructor.
Dune::IndexPair::operator==
friend bool operator==(const IndexPair< TG, TL > &, const IndexPair< TG, TL > &)
Definition indexset.hh:656
Dune::IndexPair::LocalIndex
TL LocalIndex
the type of the local index.
Definition indexset.hh:120
Dune::GlobalLookupIndexSet::seqNo
int seqNo() const
Get the internal sequence number.
Dune::LocalIndexComparator::compare
static bool compare(const T &t1, const T &t2)
Definition indexset.hh:616
Dune::ParallelIndexSet::begin
iterator begin()
Get an iterator over the indices positioned at the first index.
Dune::GlobalLookupIndexSet::IndexPair
Dune::IndexPair< typename I::GlobalIndex, typename I::LocalIndex > IndexPair
Definition indexset.hh:529
Dune::ParallelIndexSet::end
iterator end()
Get an iterator over the indices positioned after the last index.
Dune::GlobalLookupIndexSet::const_iterator
ParallelIndexSet::const_iterator const_iterator
The iterator over the index pairs.
Definition indexset.hh:527
Dune::GlobalLookupIndexSet::begin
const_iterator begin() const
Get an iterator over the indices positioned at the first index.
Dune::ParallelIndexSet::operator[]
const IndexPair & operator[](const GlobalIndex &global) const
Find the index pair with a specific global id.
Dune::ParallelIndexSet::state
const ParallelIndexSetState & state()
Get the state the index set is in.
Definition indexset.hh:307
Dune::ParallelIndexSet::begin
const_iterator begin() const
Get an iterator over the indices positioned at the first index.
Dune::GlobalLookupIndexSet::operator[]
const IndexPair & operator[](const GlobalIndex &global) const
Find the index pair with a specific global id.
Dune::IndexPair::IndexPair
IndexPair()
Construct a new Pair.
Dune::IndexPair::operator>=
friend bool operator>=(const IndexPair< TG, TL > &, const IndexPair< TG, TL > &)
Definition indexset.hh:686
Dune::IndexPair::operator!=
friend bool operator!=(const IndexPair< TG, TL > &, const IndexPair< TG, TL > &)
Definition indexset.hh:662
Dune::GlobalLookupIndexSet::ParallelIndexSet
I ParallelIndexSet
The type of the index set.
Definition indexset.hh:512
Dune::ParallelIndexSet< TG, TL, N >::LocalIndex
TL LocalIndex
Definition indexset.hh:239
Dune::ParallelIndexSet::markAsDeleted
void markAsDeleted(const iterator &position)
Mark an index as deleted.
Dune::GlobalLookupIndexSet::LocalIndex
ParallelIndexSet::LocalIndex LocalIndex
The type of the local index.
Definition indexset.hh:517
Dune::IndexPair::IndexPair
IndexPair(const GlobalIndex &global, const LocalIndex &local)
Constructs a new Pair.
Dune::IndexPair::setLocal
void setLocal(int index)
Set the local index.
Dune::IndexPair< GlobalIndex, LocalIndex >::global
const GlobalIndex & global() const
Dune::ParallelIndexSet::add
void add(const GlobalIndex &global, const LocalIndex &local)
Add an new index to the set.
Dune::ParallelIndexSet::end
const_iterator end() const
Get an iterator over the indices positioned after the last index.
Dune::ParallelIndexSet::at
IndexPair & at(const GlobalIndex &global)
Find the index pair with a specific global id.
Dune::ParallelIndexSet::ParallelIndexSet
ParallelIndexSet()
Constructor.
Dune::ParallelIndexSet::endResize
void endResize()
Indicate that the resizing finishes.
Dune::GlobalLookupIndexSet::~GlobalLookupIndexSet
~GlobalLookupIndexSet()
Destructor.
Dune::GlobalLookupIndexSet::pair
const IndexPair * pair(const std::size_t &local) const
Get the index pair corresponding to a local index.
Dune::IndexPair< GlobalIndex, LocalIndex >::local
LocalIndex & local()
Dune::GlobalLookupIndexSet::size
size_t size() const
Get the total number (public and nonpublic) indices.
Dune::IndexPair::IndexPair
IndexPair(const GlobalIndex &global)
Constructs a new Pair.
Dune::ParallelIndexSet::GlobalIndex
TG GlobalIndex
the type of the global index. This type has to provide at least a operator< for sorting.
Definition indexset.hh:226
Dune::IndexPair::GlobalIndex
TG GlobalIndex
the type of the global index.
Definition indexset.hh:107
Dune::ParallelIndexSet::seqNo
int seqNo() const
Get the internal sequence number.
Dune::ParallelIndexSet::iterator::iterator
iterator(ParallelIndexSet< TG, TL, N > &indexSet, const Father &father)
Definition indexset.hh:262
Dune::GlobalLookupIndexSet::GlobalLookupIndexSet
GlobalLookupIndexSet(const ParallelIndexSet &indexset, std::size_t size)
Constructor.
Dune::GlobalLookupIndexSet::GlobalIndex
ParallelIndexSet::GlobalIndex GlobalIndex
The type of the global index.
Definition indexset.hh:522
Dune::ParallelIndexSet::IndexPair
Dune::IndexPair< GlobalIndex, LocalIndex > IndexPair
The type of the pair stored.
Definition indexset.hh:244
Dune::RESIZE
@ RESIZE
Indicates that the index set is currently being resized.
Definition indexset.hh:190
Dune::GROUND
@ GROUND
The default mode. Indicates that the index set is ready to be used.
Definition indexset.hh:186
Dune::DELETED
@ DELETED
Definition localindex.hh:28
Dune
Dune namespace
Definition alignedallocator.hh:13
Dune::size
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition integersequence.hh:75
Dune::operator!=
constexpr auto operator!=(const HybridMultiIndex< S... > &lhs, const HybridMultiIndex< T... > &rhs)
Compare two HybridMultiIndexs for inequality.
Definition hybridmultiindex.hh:441
Dune::operator==
constexpr bool operator==(const HybridMultiIndex< S... > &lhs, const HybridMultiIndex< T... > &rhs)
Compare two HybridMultiIndexs for value equality.
Definition hybridmultiindex.hh:404
Dune::ArrayList
A dynamically growing random access list.
Definition arraylist.hh:62
Dune::ArrayList::iterator
ArrayListIterator< MemberType, N, A > iterator
A random access iterator.
Definition arraylist.hh:105
Dune::ArrayList::const_iterator
ConstArrayListIterator< MemberType, N, A > const_iterator
A constant random access iterator.
Definition arraylist.hh:110
Dune::MPITraits
A traits class describing the mapping of types onto MPI_Datatypes.
Definition mpitraits.hh:41
Dune::RangeError
Default exception class for range errors.
Definition exceptions.hh:348
Dune::InvalidStateException
Default exception if a function was called while the object is not in a valid state for that function...
Definition exceptions.hh:375
Dune::RandomAccessIteratorFacade< ArrayListIterator< T, N, A >, A::value_type, A::value_type &, A::difference_type >::operator*
constexpr Reference operator*() const
Definition iteratorfacades.hh:501
Dune::IndexPair
A pair consisting of a global and local index.
Definition indexset.hh:85
Dune::InvalidIndexSetState
Exception indicating that the index set is not in the expected state.
Definition indexset.hh:205
Dune::GlobalLookupIndexSet
Decorates an index set with the possibility to find a global index that is mapped to a specific local...
Definition indexset.hh:507
Dune::ParallelIndexSet
Manager class for the mapping between local indices and globally unique indices.
Definition indexset.hh:218
Dune::ParallelIndexSet::iterator
The iterator over the pairs.
Definition indexset.hh:257
Dune::LocalIndexComparator
Definition indexset.hh:615
Dune::IndexSetSortFunctor
Definition indexset.hh:624