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

Moved counting of public inidices from IndexSet to RemoteIndices as

nonparallel index are not required to have a public flag.

[[Imported from SVN: r1247]]
parent 0a46c001
Branches
Tags
No related merge requests found
......@@ -412,12 +412,6 @@ namespace Dune
*/
inline int seqNo() const;
/**
* @brief Get the number of indices which are public.
* @return The number of indices which are public.
*/
inline int noPublic() const;
/**
* @brief Get the total number (public and nonpublic) indices.
* @return The total number (public and nonpublic) indices.
......@@ -433,8 +427,6 @@ namespace Dune
IndexSetState state_;
/** @brief Number to keep track of the number of resizes. */
int seqNo_;
/** @brief Number of public indices. */
int noPublic_;
/**
* @brief Merges the _localIndices and newIndices arrays and creates a new
* localIndices array.
......@@ -540,7 +532,7 @@ namespace Dune
template<class TG, class TL, int N>
IndexSet<TG,TL,N>::IndexSet()
: state_(GROUND), seqNo_(0), noPublic_(0)
: state_(GROUND), seqNo_(0)
{}
template<class TG, class TL, int N>
......@@ -618,19 +610,11 @@ namespace Dune
state_ = GROUND;
}
template<class TG, class TL, int N>
inline void IndexSet<TG,TL,N>::merge(){
if(localIndices_.size()==0)
{
iterator added=newIndices_.begin();
const const_iterator endadded=newIndices_.end();
while(added!= endadded) {
if(added->local().isPublic())
noPublic_++;
++added;
}
localIndices_=newIndices_;
newIndices_.clear();
}
......@@ -642,8 +626,6 @@ namespace Dune
const const_iterator endold=localIndices_.end();
const const_iterator endadded=newIndices_.end();
noPublic_=0;
while(old != endold && added!= endadded)
{
if(old->local().state()==DELETED) {
......@@ -652,15 +634,11 @@ namespace Dune
else if(old->global() < added->global())
{
tempPairs.push_back(*old);
if(old->local().isPublic())
noPublic_++;
old.eraseToHere();
}
else
{
tempPairs.push_back(*added);
if(added->local().isPublic())
noPublic_++;
added.eraseToHere();
}
}
......@@ -668,8 +646,6 @@ namespace Dune
while(old != endold)
{
if(old->local().state()!=DELETED) {
if(old->local().isPublic())
noPublic_++;
tempPairs.push_back(*old);
}
old.eraseToHere();
......@@ -678,8 +654,6 @@ namespace Dune
while(added!= endadded)
{
tempPairs.push_back(*added);
if(added->local().isPublic())
noPublic_++;
added.eraseToHere();
}
localIndices_ = tempPairs;
......@@ -793,12 +767,6 @@ namespace Dune
return seqNo_;
}
template<class TG, class TL, int N>
inline int IndexSet<TG,TL,N>::noPublic() const
{
return noPublic_;
}
template<class TG, class TL, int N>
inline int IndexSet<TG,TL,N>::size() const
{
......
......@@ -440,6 +440,13 @@ namespace Dune {
template<bool ignorePublic>
inline void buildRemote();
/**
* @brief Count the number of public indices in an index set.
* @param indexSet The index set whose indices we count.
* @return the number of indices marked as public.
*/
inline int noPublic(const IndexSetType& indexSet);
/**
* @brief Pack the indices to send if source_ and dest_ are the same.
*
......@@ -807,6 +814,23 @@ namespace Dune {
assert(i==n);
}
template<class TG, class TA>
inline int RemoteIndices<TG,TA>::noPublic(const IndexSetType& indexSet)
{
typedef typename IndexSetType::const_iterator const_iterator;
int noPublic=0;
const const_iterator end=indexSet.end();
for(const_iterator index=indexSet.begin(); index!=end; ++index)
if(index->local().isPublic())
noPublic++;
return noPublic;
}
template<class TG, class TA>
template<bool ignorePublic>
inline void RemoteIndices<TG,TA>::buildRemote()
......@@ -824,10 +848,10 @@ namespace Dune {
// Do we need to send two index sets?
char sendTwo = (&source_ != &dest_);
sourcePublish = (ignorePublic) ? source_.size() : source_.noPublic();
sourcePublish = (ignorePublic) ? source_.size() : noPublic(source_);
if(sendTwo)
destPublish = (ignorePublic) ? dest_.size() : dest_.noPublic();
destPublish = (ignorePublic) ? dest_.size() : noPublic(dest_);
else
// we only need to send one set of indices
destPublish = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment