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

Now works well with Peter's owneroverlapcopycommunication when publishing

the aggregate numbers.

Needed to invent a marker for for isolated nodes in the communication.
Simply using AggregatesMap::ISOLATED is a bug as there might be a global
index (if sizeof(globalindex)>4) that is the same. We now use -1.

[[Imported from SVN: r496]]
parent e6dc562d
No related branches found
No related tags found
No related merge requests found
......@@ -33,12 +33,26 @@ namespace Dune
inline const GlobalIndex& operator[](std::size_t index) const
{
const Vertex& aggregate = aggregates_[index];
if(aggregate >= AggregatesMap<Vertex>::ISOLATED) {
assert(aggregate != AggregatesMap<Vertex>::UNAGGREGATED);
return isolatedMarker;
}else{
const Dune::IndexPair<GlobalIndex,LocalIndex >* pair = indexset_.pair(aggregate);
assert(pair!=0);
return pair->global();
}
}
inline GlobalIndex& get(std::size_t index)
{
const Vertex& aggregate = aggregates_[index];
assert(index < AggregatesMap<Vertex>::ISOLATED);
const Dune::IndexPair<GlobalIndex,LocalIndex >* pair = indexset_.pair(aggregate);
assert(pair!=0);
return pair->global();
return const_cast<GlobalIndex&>(pair->global());
}
class Proxy
{
public:
......@@ -48,7 +62,12 @@ namespace Dune
Proxy& operator=(const GlobalIndex& global)
{
*aggregate_ = indexset_->operator[](global).local();
if(global==isolatedMarker)
*aggregate_ = AggregatesMap<Vertex>::ISOLATED;
else{
//assert(global < AggregatesMap<Vertex>::ISOLATED);
*aggregate_ = indexset_->operator[](global).local();
}
return *this;
}
private:
......@@ -70,8 +89,12 @@ namespace Dune
private:
AggregatesMap<Vertex>& aggregates_;
const GlobalLookupIndexSet<ParallelIndexSet>& indexset_;
static const GlobalIndex isolatedMarker;
};
template<typename T, typename TI>
const typename TI::GlobalIndex GlobalAggregatesMap<T,TI>::isolatedMarker = -1;
template<typename T, typename TI>
struct AggregatesGatherScatter
{
......@@ -85,7 +108,12 @@ namespace Dune
static void scatter(GlobalAggregatesMap<T,TI>& ga, GlobalIndex global, size_t i)
{
ga.put(global, i);
if(global < AggregatesMap<T>::ISOLATED)
ga.put(global, i);
else{
assert(global != AggregatesMap<T>::UNAGGREGATED);
ga.get(i)=global;
}
}
};
......@@ -103,11 +131,10 @@ namespace Dune
static void publish(AggregatesMap<Vertex>& aggregates,
ParallelInformation& pinfo,
std::size_t size)
const GlobalLookupIndexSet<IndexSet>& globalLookup)
{
typedef Dune::Amg::GlobalAggregatesMap<Vertex,IndexSet> GlobalMap;
pinfo.buildGlobalLookup(size);
GlobalMap gmap(aggregates, pinfo.globalLookup());
GlobalMap gmap(aggregates, globalLookup);
pinfo.template buildInterface<OverlapFlags>();
pinfo.template buildCommunicator<GlobalMap>(gmap, gmap);
pinfo.template communicateForward<AggregatesGatherScatter<Vertex,IndexSet> >(gmap, gmap);
......@@ -131,15 +158,15 @@ namespace Dune
typedef T Vertex;
typedef O OverlapFlags;
typedef OwnerOverlapCopyCommunication<T1,T2> ParallelInformation;
typedef typename ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet;
typedef typename ParallelInformation::ParallelIndexSet IndexSet;
static void publish(AggregatesMap<Vertex>& aggregates,
ParallelInformation& pinfo,
std::size_t size)
const GlobalLookupIndexSet& globalLookup)
{
typedef Dune::Amg::GlobalAggregatesMap<Vertex,IndexSet> GlobalMap;
pinfo.buildGlobalLookup(size);
GlobalMap gmap(aggregates, pinfo.globalLookup());
GlobalMap gmap(aggregates, globalLookup);
pinfo.copyOwnerToAll(gmap,gmap);
}
......@@ -150,10 +177,11 @@ namespace Dune
{
typedef T Vertex;
typedef SequentialInformation ParallelInformation;
typedef typename ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet;
static void publish(AggregatesMap<Vertex>& aggregates,
ParallelInformation& pinfo,
std::size_t size)
const GlobalLookupIndexSet& globalLookup)
{}
};
......
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