65 typedef typename ParallelIndexSet::LocalIndex
LocalIndex;
88 template<
typename Graph,
typename VM>
89 static typename Graph::VertexDescriptor
95 typename Graph::VertexDescriptor noAggregates);
98 template<
typename G,
typename I>
101 typedef typename G::VertexDescriptor Vertex;
103 typedef I GlobalLookupIndexSet;
105 typedef typename GlobalLookupIndexSet::IndexPair IndexPair;
107 typedef typename IndexPair::GlobalIndex
GlobalIndex;
112 globalIndex_(
std::numeric_limits<GlobalIndex>::max())
119 const IndexPair* pair= lookup_.pair(edge.target());
127 Vertex
operator()([[maybe_unused]]
const GlobalIndex& global)
129 Vertex current = this->
number_;
141 isPublic_ = isPublic_ || b;
146 globalIndex_ = std::numeric_limits<GlobalIndex>::max();
167 globalIndex_ = global;
173 const GlobalLookupIndexSet& lookup_;
177 template<
typename Graph,
typename VM,
typename I>
183 ParallelAggregateRenumberer<Graph,I>& renumberer);
185 template<
typename Graph,
typename I>
186 static void buildCoarseRemoteIndices(
const RemoteIndices& fineRemote,
190 ParallelAggregateRenumberer<Graph,I>& renumberer);
197 template<
typename G,
typename L,
typename E>
215 template<
typename Graph,
typename VM>
216 static typename Graph::VertexDescriptor
222 typename Graph::VertexDescriptor noAggregates);
226 template<
typename T,
typename E>
227 template<
typename Graph,
typename VM>
228 inline typename Graph::VertexDescriptor
234 [[maybe_unused]]
typename Graph::VertexDescriptor noAggregates)
236 ParallelAggregateRenumberer<Graph,typename ParallelInformation::GlobalLookupIndexSet> renumberer(aggregates, fineInfo.globalLookup());
237 buildCoarseIndexSet(fineInfo, fineGraph, visitedMap, aggregates,
238 coarseInfo.indexSet(), renumberer);
239 buildCoarseRemoteIndices(fineInfo.remoteIndices(), aggregates, coarseInfo.indexSet(),
240 coarseInfo.remoteIndices(), renumberer);
245 template<
typename T,
typename E>
246 template<
typename Graph,
typename VM,
typename I>
251 ParallelIndexSet& coarseIndices,
252 ParallelAggregateRenumberer<Graph,I>& renumberer)
256 typedef typename Graph::ConstVertexIterator Iterator;
257 typedef typename ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet;
259 Iterator end = fineGraph.end();
260 const GlobalLookupIndexSet& lookup = pinfo.globalLookup();
262 coarseIndices.beginResize();
267 for(Iterator index = fineGraph.begin(); index != end; ++index) {
273 if(!
get(visitedMap, *index)) {
275 typedef typename GlobalLookupIndexSet::IndexPair IndexPair;
276 const IndexPair* pair= lookup.pair(*index);
283 assert(!ExcludedAttributes::contains(pair->local().attribute()));
284 renumberer.attribute(pair->local().attribute());
285 renumberer.isPublic(pair->local().isPublic());
286 renumberer.globalIndex(pair->global());
290 aggregates.template breadthFirstSearch<false>(*index, aggregates[*index],
291 fineGraph, renumberer, visitedMap);
293 if(renumberer.globalIndex()!=std::numeric_limits<GlobalIndex>::max()) {
296 coarseIndices.add(renumberer.globalIndex(),
297 LocalIndex(renumberer, renumberer.attribute(),
298 renumberer.isPublic()));
301 aggregates[*index] = renumberer;
306 coarseIndices.endResize();
308 assert(
static_cast<std::size_t
>(renumberer) >= coarseIndices.size());
311 for(Iterator vertex=fineGraph.begin(); vertex != end; ++vertex)
312 put(visitedMap, *vertex,
false);
315 template<
typename T,
typename E>
316 template<
typename Graph,
typename I>
317 void ParallelIndicesCoarsener<T,E>::buildCoarseRemoteIndices(
const RemoteIndices& fineRemote,
318 const AggregatesMap<typename Graph::VertexDescriptor>& aggregates,
319 ParallelIndexSet& coarseIndices,
320 RemoteIndices& coarseRemote,
321 ParallelAggregateRenumberer<Graph,I>& renumberer)
323 std::vector<char> attributes(
static_cast<std::size_t
>(renumberer));
325 GlobalLookupIndexSet<ParallelIndexSet> coarseLookup(coarseIndices,
static_cast<std::size_t
>(renumberer));
327 typedef typename RemoteIndices::const_iterator Iterator;
328 Iterator end = fineRemote.end();
330 for(Iterator neighbour = fineRemote.begin();
331 neighbour != end; ++neighbour) {
332 int process = neighbour->first;
334 assert(neighbour->second.first==neighbour->second.second);
337 typedef typename std::vector<char>::iterator CIterator;
339 for(CIterator iter=attributes.begin(); iter!= attributes.end(); ++iter)
340 *iter = std::numeric_limits<char>::max();
342 auto riEnd = neighbour->second.second->end();
344 for(
auto index = neighbour->second.second->begin();
345 index != riEnd; ++index) {
346 if(!E::contains(index->localIndexPair().local().attribute()) &&
347 aggregates[index->localIndexPair().local()] !=
350 assert(aggregates[index->localIndexPair().local()]<attributes.size());
351 if (attributes[aggregates[index->localIndexPair().local()]] != 3)
352 attributes[aggregates[index->localIndexPair().local()]] = index->attribute();
357 typedef RemoteIndexListModifier<ParallelIndexSet,typename RemoteIndices::Allocator,false> Modifier;
358 typedef typename RemoteIndices::RemoteIndex RemoteIndex;
359 typedef typename ParallelIndexSet::const_iterator IndexIterator;
361 Modifier coarseList = coarseRemote.template getModifier<false,true>(process);
363 IndexIterator iend = coarseIndices.end();
364 for(IndexIterator index = coarseIndices.begin(); index != iend; ++index)
365 if(attributes[index->local()] != std::numeric_limits<char>::max()) {
367 coarseList.insert(RemoteIndex(Attribute(attributes[index->local()]), &(*index)));
373 assert(coarseRemote.neighbours()==fineRemote.neighbours());
377 IndicesSyncer<ParallelIndexSet> syncer(coarseIndices, coarseRemote);
378 syncer.sync(renumberer);
385 template<
typename Graph,
typename VM>
386 typename Graph::VertexDescriptor
389 [[maybe_unused]] Graph& fineGraph,
390 [[maybe_unused]] VM& visitedMap,
393 [[maybe_unused]]
typename Graph::VertexDescriptor noAggregates)
static Graph::VertexDescriptor coarsen(ParallelInformation &fineInfo, Graph &fineGraph, VM &visitedMap, AggregatesMap< typename Graph::VertexDescriptor > &aggregates, ParallelInformation &coarseInfo, typename Graph::VertexDescriptor noAggregates)
Build the coarse index set after the aggregatio.
Definition indicescoarsener.hh:229
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293