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

Provide iterators

Added new construction for SeqOverlappingSchwarz for AMG.

[[Imported from SVN: r985]]
parent b42dd898
No related branches found
No related tags found
No related merge requests found
......@@ -547,6 +547,29 @@ namespace Dune
*/
const AggregateDescriptor& operator[](const VertexDescriptor& v) const;
typedef const AggregateDescriptor* const_iterator;
const_iterator begin() const
{
return aggregates_;
}
const_iterator end() const
{
return aggregates_+noVertices();
}
typedef AggregateDescriptor* iterator;
iterator begin()
{
return aggregates_;
}
iterator end()
{
return aggregates_+noVertices();
}
private:
/** @brief Prevent copying. */
AggregatesMap(const AggregatesMap<V>& map)
......
......@@ -282,7 +282,6 @@ namespace Dune
};
/**
* @brief Policy for the construction of the ParSSOR smoother
*/
......@@ -384,7 +383,8 @@ namespace Dune
};
#ifdef HAVE_SUPERLU
} // end namespace Amg
// forward dseclarations
// forward declarations
template<class M, class X, class MO, class A>
class SeqOverlappingSchwarz;
......@@ -422,8 +422,8 @@ namespace Dune
enum Overlap {vertex, aggregate, none};
Overlap overlap;
SeqOverlappingSchwarzSmootherArgs()
: overlap(none)
SeqOverlappingSchwarzSmootherArgs(Overlap overlap_=vertex)
: overlap(overlap)
{}
};
......@@ -440,9 +440,9 @@ namespace Dune
typedef DefaultConstructionArgs<SeqOverlappingSchwarz<M,X,TM,TA> > Father;
public:
typedef Dune::Amg::AggregatesMap<typename MatrixGraph<M>::VertexDescriptor> AggregatesMap;
typedef typename MatrixGraph<M>::VertexDescriptor VertexDescriptor;
typedef Dune::Amg::AggregatesMap<VertexDescriptor> AggregatesMap;
typedef typename AggregatesMap::AggregateDescriptor AggregateDescriptor;
typedef typename AggregatesMap::VertexDescriptor VertexDescriptor;
typedef typename SeqOverlappingSchwarz<M,X,TM,TA>::subdomain_vector Vector;
typedef typename Vector::value_type Subdomain;
......@@ -479,6 +479,43 @@ namespace Dune
void setMatrix(const M& matrix)
{
Father::setMatrix(matrix);
/* Create aggregates map where each aggregate is just one vertex. */
AggregatesMap amap(matrix.N());
VertexDescriptor v=0;
for(typename AggregatesMap::iterator iter=amap.begin();
iter!=amap.end(); ++iter)
*iter=v++;
std::vector<bool> visited(amap.noVertices(), false);
typedef IteratorPropertyMap<std::vector<bool>::iterator,IdentityMap> VisitedMapType;
VisitedMapType visitedMap(visited.begin());
MatrixGraph<const M> graph(matrix);
typedef SeqOverlappingSchwarzSmootherArgs<typename M::field_type> SmootherArgs;
switch(Father::getArgs().overlap) {
case SmootherArgs::vertex :
{
VertexAdder visitor(subdomains, amap);
createSubdomains(matrix, graph, amap, visitor, visitedMap);
}
break;
case SmootherArgs::aggregate :
{
DUNE_THROW(NotImplemented, "Aggregate overlap is not supported yet");
/*
AggregateAdder<VisitedMapType> visitor(subdomains, amap, graph, visitedMap);
createSubdomains(matrix, graph, amap, visitor, visitedMap);
*/
}
break;
case SmootherArgs::none :
NoneAdder visitor;
createSubdomains(matrix, graph, amap, visitor, visitedMap);
}
}
const Vector& getSubDomains()
......@@ -656,6 +693,7 @@ namespace Dune
delete schwarz;
}
};
#endif
} // namespace Amg
} // namespace Dune
......
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