diff --git a/dune/fufem/boundarypatch.hh b/dune/fufem/boundarypatch.hh index 0de6e3e165dbf82b1f40c5c1a213fba45b1b9525..11c466f8df12980141531d024434d6c4d493b953 100644 --- a/dune/fufem/boundarypatch.hh +++ b/dune/fufem/boundarypatch.hh @@ -279,6 +279,13 @@ public: +/** \brief Insertion property for segment insertion indices + * + * You can use a BoundaryPatchInsertionIndexProperty + * with BoundaryPatchBase::insertFacesByProperty() + * to insert all faces contained a set boundary + * segments described by insertion indices. + */ template <class GridView> class BoundaryPatchInsertionIndexProperty { @@ -287,17 +294,23 @@ class BoundaryPatchInsertionIndexProperty public: typedef typename GridView::Intersection Intersection; + /** \brief Create property from GridFactory and container of insertion indices + */ template<class T> BoundaryPatchInsertionIndexProperty(const GridFactory& factory, const T& t) : factory_(factory) { indices_.insert(t.begin(), t.end()); } + /** \brief Create property from GridFactory and a single insertion index + */ BoundaryPatchInsertionIndexProperty(const GridFactory& factory, int i) : factory_(factory) { indices_.insert(i); } + /** \brief Check if intersection is contained in one of the boundary segments + */ bool operator() (const Intersection& i) const { return (factory_.wasInserted(i) and (indices_.find(factory_.insertionIndex(i))!=indices_.end())); @@ -309,23 +322,36 @@ private: +/** \brief Insertion property for segment indices + * + * You can use a BoundaryPatchSegmentIndexProperty + * with BoundaryPatchBase::insertFacesByProperty() + * to insert all faces contained a set boundary + * segments described by boundary segment indices. + */ template <class GridView> class BoundaryPatchSegmentIndexProperty { public: typedef typename GridView::Intersection Intersection; + /** \brief Create property from a container of boundary segment indices + */ template<class T> BoundaryPatchSegmentIndexProperty(const T& t) { indices_.insert(t.begin(), t.end()); } + /** \brief Create property from a single boundary segment indix + */ BoundaryPatchSegmentIndexProperty(int i) { indices_.insert(i); } + /** \brief Check if intersection is contained in one of the boundary segments + */ bool operator() (const Intersection& i) const { return (indices_.find(i.boundarySegmentIndex())!=indices_.end()); @@ -506,11 +532,16 @@ public: this->faces_[mapper_->map(en, fIdx,1)] = true; } + /** \brief Insert boundary faces filtered by an insertion property + * + * \tparam InsertionProperty a class providing bool operator()(Intersection) + * \param property All boundary intersections with property(intersection)==true are inserted + */ template<class InsertionProperty> - void insertFacesByProperty(const GridView& gridView, const InsertionProperty& property) + void insertFacesByProperty(const InsertionProperty& property) { - BoundaryIterator<GridView> bIt(gridView, BoundaryIterator<GridView>::begin); - BoundaryIterator<GridView> bEnd(gridView, BoundaryIterator<GridView>::end); + BoundaryIterator<GridView> bIt(*gridView_, BoundaryIterator<GridView>::begin); + BoundaryIterator<GridView> bEnd(*gridView_, BoundaryIterator<GridView>::end); for(; bIt!=bEnd; ++bIt) { if (property(*bIt))