Skip to content
Snippets Groups Projects
Unverified Commit 3700b36f authored by Dr. Felix Tobias Schindler's avatar Dr. Felix Tobias Schindler Committed by René Fritze
Browse files

[walker] no need to wrap appended walkers specially

parent 988c02c9
No related branches found
No related tags found
No related merge requests found
......@@ -302,59 +302,6 @@ public:
ApplyOn::LambdaFilteredIntersections<GL>(intersection_filter));
}
/**
* \}
* \name These methods can be used to append another Walker.
* \{
*/
/**
* \note The other_walker will be applied on the intersection of the given element_filter (intersection_filter) and
* the filters of its ElementFunctors (IntersectionFunctors).
* \sa WalkerWrapper
*/
ThisType& append(Walker<GL>& other_walker,
const ElementFilter<GL>& element_filter = ApplyOn::AllElements<GL>(),
const IntersectionFilter<GL>& intersection_filter = ApplyOn::AllIntersections<GL>())
{
if (&other_walker == this)
DUNE_THROW(Common::Exceptions::you_are_using_this_wrong, "Do not append a Walker to itself!");
emplace_all(element_and_intersection_functor_wrappers_, other_walker, element_filter, intersection_filter);
return *this;
}
/**
* \note The other_walker will be applied on the intersection of the given element_filter (intersection_filter) and
* the filters of its ElementFunctors (IntersectionFunctors).
* \sa WalkerWrapper
*/
ThisType& append(Walker<GL>& other_walker,
const IntersectionFilter<GL>& intersection_filter,
const ElementFilter<GL>& element_filter = new ApplyOn::AllElements<GL>())
{
if (&other_walker == this)
DUNE_THROW(Common::Exceptions::you_are_using_this_wrong, "Do not append a Walker to itself!");
emplace_all(element_and_intersection_functor_wrappers_, other_walker, element_filter, intersection_filter);
return *this;
}
/**
* \note The other_walker will be applied on the intersection of the given element_filter (intersection_filter) and
* the filters of its ElementFunctors (IntersectionFunctors).
* \sa WalkerWrapper
*/
ThisType&
append(Walker<GL>& other_walker, ViewElementFunction element_filter, ViewIntersectionFunction intersection_filter)
{
if (&other_walker == this)
DUNE_THROW(Common::Exceptions::you_are_using_this_wrong, "Do not append a Walker to itself!");
emplace_all(element_and_intersection_functor_wrappers_,
other_walker,
ApplyOn::LambdaFilteredElements<GL>(element_filter),
ApplyOn::LambdaFilteredIntersections<GL>(intersection_filter));
return *this;
}
/**
* \}
* \name These methods are required by ElementAndIntersectionFunctor.
......@@ -575,8 +522,6 @@ private:
} // .. walk elements
} // ... walk_range(...)
friend class internal::WalkerWrapper<GridViewType>;
GridViewType grid_view_;
bool user_decided_agains_clearing_of_functors_;
Common::PerThreadValue<std::list<std::shared_ptr<internal::ElementFunctorWrapper<GridViewType>>>>
......
......@@ -189,67 +189,6 @@ private:
}; // class ElementAndIntersectionFunctorWrapper
/**
* \brief To be used within the \sa Walker as internal storage type.
* \note Most likely you do not want to use this class directly, but instead append() a Walker to a Walker.
*/
template <class GL>
class WalkerWrapper : public ElementAndIntersectionFunctorWrapper<GL>
{
using BaseType = ElementAndIntersectionFunctorWrapper<GL>;
using ThisType = WalkerWrapper<GL>;
public:
using typename BaseType::ElementFilterType;
using typename BaseType::IntersectionFilterType;
/**
* \attention Takes ownership of element_filtr_ptr, do not delete manually!
* \attention Takes ownership of intersection_filtr_ptr, do not delete manually!
*/
WalkerWrapper(Walker<GL>& walkr,
const ElementFilterType*&& element_filtr_ptr,
const IntersectionFilterType*&& intersection_filtr_ptr)
: BaseType(walkr,
new ApplyOn::LambdaFilteredElements<GL>([&](const auto& grid_layer, const auto& element) {
if (restriction_element_filter_.access().contains(grid_layer, element)) {
for (const auto& wrapper : walkr.element_functor_wrappers_) {
if (wrapper->filter().contains(grid_layer, element))
return true;
}
for (const auto& wrapper : walkr.element_and_intersection_functor_wrappers_) {
if (wrapper->element_filter().contains(grid_layer, element))
return true;
}
return false;
} else
return false;
}),
new ApplyOn::LambdaFilteredIntersections<GL>([&](const auto& grid_layer, const auto& intersection) {
if (restriction_intersection_filter_.access().contains(grid_layer, intersection)) {
for (const auto& wrapper : walkr.intersection_functor_wrappers_) {
if (wrapper->filter().contains(grid_layer, intersection))
return true;
}
for (const auto& wrapper : walkr.element_and_intersection_functor_wrappers_) {
if (wrapper->intersection_filter().contains(grid_layer, intersection))
return true;
}
return false;
} else
return false;
}))
, restriction_element_filter_(std::move(element_filtr_ptr))
, restriction_intersection_filter_(std::move(intersection_filtr_ptr))
{
}
private:
const Common::ConstStorageProvider<ElementFilterType> restriction_element_filter_;
const Common::ConstStorageProvider<IntersectionFilterType> restriction_intersection_filter_;
}; // class WalkerWrapper
} // namespace internal
} // namespace Grid
} // namespace XT
......
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