16 #ifndef dealii_filtered_iterator_h 17 #define dealii_filtered_iterator_h 20 #include <deal.II/base/std_cxx14/memory.h> 21 #include <deal.II/base/config.h> 22 #include <deal.II/base/exceptions.h> 23 #include <deal.II/base/iterator_range.h> 24 #include <deal.II/grid/tria_iterator_base.h> 29 DEAL_II_NAMESPACE_OPEN
63 template <
class Iterator>
82 template <
class Iterator>
101 template <
class Iterator>
127 template <
class Iterator>
161 template <
class Iterator>
190 template <
class Iterator>
209 template <
class Iterator>
246 template <
class Iterator>
292 template <
class Iterator>
320 template <
class Iterator>
511 template <
typename BaseIterator>
524 template <
typename Predicate>
544 template <
typename Predicate>
546 const BaseIterator &bi);
642 bool operator < (
const BaseIterator &fi)
const;
673 <<
"The element " << arg1
674 <<
" with which you want to compare or which you want to" 675 <<
" assign from is invalid since it does not satisfy the predicate.");
701 virtual bool operator () (
const BaseIterator &bi)
const = 0;
707 virtual std::unique_ptr<PredicateBase>
clone ()
const = 0;
719 template <
typename Predicate>
731 virtual bool operator () (
const BaseIterator &bi)
const override;
737 virtual std::unique_ptr<PredicateBase>
clone ()
const override;
765 template <
typename BaseIterator,
typename Predicate>
779 namespace FilteredIteratorImplementation
785 template <
typename BaseIterator,
typename TypeList>
786 struct NestFilteredIterators;
788 template <
typename BaseIterator,
typename Predicate>
789 struct NestFilteredIterators<BaseIterator,
std::tuple<Predicate> >
791 typedef ::FilteredIterator<BaseIterator> type;
794 template <
typename BaseIterator,
typename Predicate,
typename... Targs>
795 struct NestFilteredIterators<BaseIterator,
std::tuple<Predicate, Targs...> >
797 typedef ::FilteredIterator<
typename NestFilteredIterators<BaseIterator,
798 std::tuple<Targs...> >::type> type;
836 template <
typename BaseIterator,
typename Predicate>
884 template <
typename BaseIterator,
typename Predicate,
typename... Targs>
885 IteratorRange<
typename internal::FilteredIteratorImplementation::
886 NestFilteredIterators<BaseIterator,std::tuple<Predicate, Targs...> >::type>
900 template <
typename BaseIterator>
901 template <
typename Predicate>
911 template <
typename BaseIterator>
912 template <
typename Predicate>
916 const BaseIterator &bi)
928 template <
typename BaseIterator>
937 BaseIterator (*(BaseIterator *)(&fi)),
938 predicate (fi.predicate->clone ())
943 template <
typename BaseIterator>
953 template <
typename BaseIterator>
964 const BaseIterator &bi = fi;
965 return operator = (bi);
970 template <
typename BaseIterator>
977 ExcInvalidElement(bi));
978 BaseIterator::operator = (bi);
984 template <
typename BaseIterator>
990 BaseIterator::operator = (bi);
992 ( ! (*predicate)(*
this)))
993 BaseIterator::operator++ ();
1000 template <
typename BaseIterator>
1006 BaseIterator::operator = (bi);
1008 ( ! (*predicate)(*
this)))
1009 BaseIterator::operator-- ();
1016 template <
typename BaseIterator>
1022 return (static_cast<const BaseIterator &>(*
this)
1024 static_cast<const BaseIterator &>(fi));
1029 template <
typename BaseIterator>
1035 return (static_cast<const BaseIterator &>(*
this)
1037 static_cast<const BaseIterator &>(fi));
1042 template <
typename BaseIterator>
1048 return (static_cast<const BaseIterator &>(*
this)
1050 static_cast<const BaseIterator &>(fi));
1056 template <
typename BaseIterator>
1062 return (static_cast<const BaseIterator &>(*
this) == bi);
1067 template <
typename BaseIterator>
1073 return (static_cast<const BaseIterator &>(*
this) != bi);
1078 template <
typename BaseIterator>
1084 return (static_cast<const BaseIterator &>(*
this) < bi);
1088 template <
typename BaseIterator>
1096 BaseIterator::operator++ ();
1098 !(*predicate) (*
this));
1104 template <
typename BaseIterator>
1114 BaseIterator::operator++ ();
1116 !(*predicate) (*
this));
1123 template <
typename BaseIterator>
1131 BaseIterator::operator-- ();
1133 !(*predicate) (*
this));
1139 template <
typename BaseIterator>
1149 BaseIterator::operator-- ();
1151 !(*predicate) (*
this));
1157 template <
typename BaseIterator>
1158 template <
typename Predicate>
1163 predicate (predicate)
1168 template <
typename BaseIterator>
1169 template <
typename Predicate>
1179 template <
typename BaseIterator>
1180 template <
typename Predicate>
1181 std::unique_ptr<typename FilteredIterator<BaseIterator>::PredicateBase>
1185 return std_cxx14::make_unique<PredicateTemplate> (
predicate);
1195 template <
class Iterator>
1198 Active::operator () (
const Iterator &i)
const 1200 return (i->active());
1206 template <
class Iterator>
1209 UserFlagSet::operator () (
const Iterator &i)
const 1211 return (i->user_flag_set());
1217 template <
class Iterator>
1220 UserFlagNotSet::operator () (
const Iterator &i)
const 1222 return (! i->user_flag_set());
1228 LevelEqualTo::LevelEqualTo (
const unsigned int level)
1235 template <
class Iterator>
1240 return (static_cast<unsigned int>(i->level()) ==
level);
1249 subdomain_id (subdomain_id)
1254 template <
class Iterator>
1266 template <
class Iterator>
1271 return (i->is_locally_owned());
1277 template <
class Iterator>
1282 return (i->is_locally_owned_on_level());
1290 const bool only_locally_owned)
1292 material_ids {material_id},
1293 only_locally_owned (only_locally_owned)
1300 const bool only_locally_owned)
1302 material_ids (material_ids),
1303 only_locally_owned (only_locally_owned)
1308 template <
class Iterator>
1323 const bool only_locally_owned)
1325 active_fe_indices {active_fe_index},
1326 only_locally_owned (only_locally_owned)
1333 const bool only_locally_owned)
1335 active_fe_indices (active_fe_indices),
1336 only_locally_owned (only_locally_owned)
1341 template <
class Iterator>
1355 template <
class Iterator>
1360 return (i->at_boundary());
1365 DEAL_II_NAMESPACE_CLOSE
bool operator()(const Iterator &i) const
FilteredIterator & operator++()
IteratorOverIterators begin()
const types::subdomain_id subdomain_id
FilteredIterator(Predicate p)
bool operator()(const Iterator &i) const
bool operator==(const FilteredIterator &fi) const
bool operator()(const Iterator &i) const
bool operator()(const Iterator &i) const
const bool only_locally_owned
IteratorOverIterators end()
IteratorRange< FilteredIterator< BaseIterator > > filter_iterators(IteratorRange< BaseIterator > i, const Predicate &p)
virtual std::unique_ptr< PredicateBase > clone() const =0
FilteredIterator & operator--()
const std::set< types::material_id > material_ids
bool operator()(const Iterator &i) const
FilteredIterator & operator=(const FilteredIterator &fi)
#define DeclException1(Exception1, type1, outsequence)
#define Assert(cond, exc)
bool operator()(const Iterator &i) const
bool operator()(const Iterator &i) const
virtual bool operator()(const BaseIterator &bi) const override
std::unique_ptr< const PredicateBase > predicate
bool operator!=(const FilteredIterator &fi) const
virtual ~PredicateBase()=default
virtual bool operator()(const BaseIterator &bi) const =0
unsigned int subdomain_id
MaterialIdEqualTo(const types::material_id material_id, const bool only_locally_owned=false)
bool operator()(const Iterator &i) const
const Predicate predicate
LevelEqualTo(const unsigned int level)
const std::set< unsigned int > active_fe_indices
BaseIterator::AccessorType AccessorType
FilteredIterator & set_to_next_positive(const BaseIterator &bi)
SubdomainEqualTo(const types::subdomain_id subdomain_id)
static ::ExceptionBase & ExcInvalidElement(BaseIterator arg1)
const bool only_locally_owned
bool operator()(const Iterator &i) const
PredicateTemplate(const Predicate &predicate)
ActiveFEIndexEqualTo(const unsigned int active_fe_index, const bool only_locally_owned=false)
Iterator points to a valid object.
FilteredIterator & set_to_previous_positive(const BaseIterator &bi)
bool operator<(const FilteredIterator &fi) const
virtual std::unique_ptr< PredicateBase > clone() const override
FilteredIterator< BaseIterator > make_filtered_iterator(const BaseIterator &i, const Predicate &p)
bool operator()(const Iterator &i) const