Skip to content
Snippets Groups Projects
Commit d561f032 authored by Markus Blatt's avatar Markus Blatt
Browse files

[release,parallel] Allow copying of RemoteIndexListModifier.

Previously, copying a RemoteIndexListModifier resulted in a double
free of a pointer to a list of global indices. There was no need to
use a pointer to this, though. After this patch we store the list directly
by value. Thus the default copy constructor works but makes a rather cheap copy
of a (most often empty) singly linked list and we get rid off the non-default
destructor.
parent bb51b059
No related branches found
No related tags found
No related merge requests found
......@@ -674,13 +674,6 @@ namespace Dune {
: glist_()
{}
/** @brief Constructor */
~RemoteIndexListModifier()
{
if(glist_)
delete glist_;
}
private:
/**
......@@ -1560,13 +1553,13 @@ namespace Dune {
template<class T, class A, bool mode>
RemoteIndexListModifier<T,A,mode>::RemoteIndexListModifier(const ParallelIndexSet& indexSet,
RemoteIndexList& rList)
: rList_(&rList), indexSet_(&indexSet), glist_(new GlobalList()), iter_(rList.beginModify()), end_(rList.end()), first_(true)
: rList_(&rList), indexSet_(&indexSet), iter_(rList.beginModify()), end_(rList.end()), first_(true)
{
if(MODIFYINDEXSET) {
assert(indexSet_);
for(ConstIterator iter=iter_; iter != end_; ++iter)
glist_->push_back(iter->localIndexPair().global());
giter_ = glist_->beginModify();
glist_.push_back(iter->localIndexPair().global());
giter_ = glist_.beginModify();
}
}
......@@ -1589,7 +1582,7 @@ namespace Dune {
typedef typename ParallelIndexSet::const_iterator IndexIterator;
typedef typename GlobalList::const_iterator GlobalIterator;
typedef typename RemoteIndexList::iterator Iterator;
GlobalIterator giter = glist_->begin();
GlobalIterator giter = glist_.begin();
IndexIterator index = indexSet_->begin();
for(Iterator iter=rList_->begin(); iter != end_; ++iter) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment