16 #ifndef dealii__filtered_iterator_h 17 #define dealii__filtered_iterator_h 20 #include <deal.II/base/config.h> 21 #include <deal.II/base/exceptions.h> 22 #include <deal.II/base/iterator_range.h> 23 #include <deal.II/grid/tria_iterator_base.h> 26 #ifdef DEAL_II_WITH_CXX11 30 DEAL_II_NAMESPACE_OPEN
64 template <
class Iterator>
83 template <
class Iterator>
102 template <
class Iterator>
128 template <
class Iterator>
162 template <
class Iterator>
191 template <
class Iterator>
210 template <
class Iterator>
247 template <
class Iterator>
293 template <
class Iterator>
321 template <
class Iterator>
512 template <
typename BaseIterator>
525 template <
typename Predicate>
545 template <
typename Predicate>
547 const BaseIterator &bi);
643 bool operator < (
const BaseIterator &fi)
const;
674 <<
"The element " << arg1
675 <<
" with which you want to compare or which you want to" 676 <<
" assign from is invalid since it does not satisfy the predicate.");
702 virtual bool operator () (
const BaseIterator &bi)
const = 0;
720 template <
typename Predicate>
732 virtual bool operator () (
const BaseIterator &bi)
const;
766 template <
typename BaseIterator,
typename Predicate>
778 #ifdef DEAL_II_WITH_CXX11 787 template <
typename BaseIterator,
typename TypeList>
788 struct NestFilteredIterators;
790 template <
typename BaseIterator,
typename Predicate>
791 struct NestFilteredIterators<BaseIterator,
std::tuple<Predicate> >
793 typedef ::FilteredIterator<BaseIterator> type;
796 template <
typename BaseIterator,
typename Predicate,
typename... Targs>
797 struct NestFilteredIterators<BaseIterator,
std::tuple<Predicate, Targs...> >
799 typedef ::FilteredIterator<
typename NestFilteredIterators<BaseIterator,
800 std::tuple<Targs...> >::type> type;
838 template <
typename BaseIterator,
typename Predicate>
886 template <
typename BaseIterator,
typename Predicate,
typename... Targs>
888 NestFilteredIterators<BaseIterator,std::tuple<Predicate, Targs...> >::type>
903 template <
typename BaseIterator>
904 template <
typename Predicate>
914 template <
typename BaseIterator>
915 template <
typename Predicate>
919 const BaseIterator &bi)
931 template <
typename BaseIterator>
940 BaseIterator (*(BaseIterator *)(&fi)),
941 predicate (fi.predicate->clone ())
946 template <
typename BaseIterator>
957 template <
typename BaseIterator>
968 const BaseIterator &bi = fi;
969 return operator = (bi);
974 template <
typename BaseIterator>
981 ExcInvalidElement(bi));
982 BaseIterator::operator = (bi);
988 template <
typename BaseIterator>
994 BaseIterator::operator = (bi);
996 ( ! (*predicate)(*
this)))
997 BaseIterator::operator++ ();
1004 template <
typename BaseIterator>
1010 BaseIterator::operator = (bi);
1012 ( ! (*predicate)(*
this)))
1013 BaseIterator::operator-- ();
1020 template <
typename BaseIterator>
1026 return (static_cast<const BaseIterator &>(*
this)
1028 static_cast<const BaseIterator &>(fi));
1033 template <
typename BaseIterator>
1039 return (static_cast<const BaseIterator &>(*
this)
1041 static_cast<const BaseIterator &>(fi));
1046 template <
typename BaseIterator>
1052 return (static_cast<const BaseIterator &>(*
this)
1054 static_cast<const BaseIterator &>(fi));
1060 template <
typename BaseIterator>
1066 return (static_cast<const BaseIterator &>(*
this) == bi);
1071 template <
typename BaseIterator>
1077 return (static_cast<const BaseIterator &>(*
this) != bi);
1082 template <
typename BaseIterator>
1088 return (static_cast<const BaseIterator &>(*
this) < bi);
1092 template <
typename BaseIterator>
1100 BaseIterator::operator++ ();
1102 !(*predicate) (*
this));
1108 template <
typename BaseIterator>
1118 BaseIterator::operator++ ();
1120 !(*predicate) (*
this));
1127 template <
typename BaseIterator>
1135 BaseIterator::operator-- ();
1137 !(*predicate) (*
this));
1143 template <
typename BaseIterator>
1153 BaseIterator::operator-- ();
1155 !(*predicate) (*
this));
1161 template <
typename BaseIterator>
1162 template <
typename Predicate>
1167 predicate (predicate)
1172 template <
typename BaseIterator>
1173 template <
typename Predicate>
1183 template <
typename BaseIterator>
1184 template <
typename Predicate>
1199 template <
class Iterator>
1202 Active::operator () (
const Iterator &i)
const 1204 return (i->active());
1210 template <
class Iterator>
1213 UserFlagSet::operator () (
const Iterator &i)
const 1215 return (i->user_flag_set());
1221 template <
class Iterator>
1224 UserFlagNotSet::operator () (
const Iterator &i)
const 1226 return (! i->user_flag_set());
1232 LevelEqualTo::LevelEqualTo (
const unsigned int level)
1239 template <
class Iterator>
1244 return (static_cast<unsigned int>(i->level()) ==
level);
1253 subdomain_id (subdomain_id)
1258 template <
class Iterator>
1270 template <
class Iterator>
1275 return (i->is_locally_owned());
1281 template <
class Iterator>
1286 return (i->is_locally_owned_on_level());
1294 const bool only_locally_owned)
1301 material_ids (&material_id, &material_id+1),
1302 only_locally_owned (only_locally_owned)
1309 const bool only_locally_owned)
1311 material_ids (material_ids),
1312 only_locally_owned (only_locally_owned)
1317 template <
class Iterator>
1332 const bool only_locally_owned)
1339 active_fe_indices (&active_fe_index, &active_fe_index+1),
1340 only_locally_owned (only_locally_owned)
1347 const bool only_locally_owned)
1349 active_fe_indices (active_fe_indices),
1350 only_locally_owned (only_locally_owned)
1355 template <
class Iterator>
1369 template <
class Iterator>
1374 return (i->at_boundary());
1379 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
unsigned char material_id
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)
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)
virtual PredicateBase * clone() const
#define Assert(cond, exc)
bool operator()(const Iterator &i) const
bool operator()(const Iterator &i) const
bool operator!=(const FilteredIterator &fi) const
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)
virtual PredicateBase * clone() const =0
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)
virtual bool operator()(const BaseIterator &bi) const
Iterator points to a valid object.
const PredicateBase * predicate
FilteredIterator & set_to_previous_positive(const BaseIterator &bi)
bool operator<(const FilteredIterator &fi) const
IteratorRange< typename internal::FilteredIterator::NestFilteredIterators< BaseIterator, std::tuple< Predicate, Targs... > >::type > filter_iterators(IteratorRange< BaseIterator > i, const Predicate &p, const Targs... args)
FilteredIterator< BaseIterator > make_filtered_iterator(const BaseIterator &i, const Predicate &p)
bool operator()(const Iterator &i) const