16 #ifndef dealii_filtered_iterator_h 17 # define dealii_filtered_iterator_h 20 # 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/base/std_cxx14/memory.h> 26 # include <deal.II/grid/tria_iterator_base.h> 31 DEAL_II_NAMESPACE_OPEN
65 template <
class Iterator>
85 template <
class Iterator>
105 template <
class Iterator>
132 template <
class Iterator>
167 template <
class Iterator>
197 template <
class Iterator>
217 template <
class Iterator>
255 template <
class Iterator>
302 template <
class Iterator>
331 template <
class Iterator>
528 template <
typename BaseIterator>
541 template <
typename Predicate>
561 template <
typename Predicate>
697 <<
"The element " << arg1
698 <<
" with which you want to compare or which you want to" 699 <<
" assign from is invalid since it does not satisfy the predicate.");
731 virtual std::unique_ptr<PredicateBase>
744 template <
typename Predicate>
757 operator()(
const BaseIterator &bi)
const override;
763 virtual std::unique_ptr<PredicateBase>
764 clone()
const override;
791 template <
typename BaseIterator,
typename Predicate>
804 namespace FilteredIteratorImplementation
810 template <
typename BaseIterator,
typename TypeList>
811 struct NestFilteredIterators;
813 template <
typename BaseIterator,
typename Predicate>
814 struct NestFilteredIterators<BaseIterator,
std::tuple<Predicate>>
819 template <
typename BaseIterator,
typename Predicate,
typename... Targs>
820 struct NestFilteredIterators<BaseIterator,
std::tuple<Predicate, Targs...>>
823 typename NestFilteredIterators<BaseIterator,
824 std::tuple<Targs...>>::type>;
864 template <
typename BaseIterator,
typename Predicate>
913 template <
typename BaseIterator,
typename Predicate,
typename... Targs>
915 typename internal::FilteredIteratorImplementation::
916 NestFilteredIterators<BaseIterator, std::tuple<Predicate, Targs...>>::type>
930 template <
typename BaseIterator>
931 template <
typename Predicate>
938 template <
typename BaseIterator>
939 template <
typename Predicate>
941 const BaseIterator &bi)
951 template <
typename BaseIterator>
958 BaseIterator(*static_cast<const BaseIterator *>(&fi))
959 , predicate(fi.predicate->clone())
964 template <
typename BaseIterator>
973 const BaseIterator &bi = fi;
974 return operator=(bi);
979 template <
typename BaseIterator>
984 ExcInvalidElement(bi));
985 BaseIterator::operator=(bi);
991 template <
typename BaseIterator>
995 BaseIterator::operator=(bi);
997 BaseIterator::operator++();
1004 template <
typename BaseIterator>
1008 BaseIterator::operator=(bi);
1010 BaseIterator::operator--();
1017 template <
typename BaseIterator>
1021 return (static_cast<const BaseIterator &>(*
this) ==
1022 static_cast<const BaseIterator &>(fi));
1027 template <
typename BaseIterator>
1031 return (static_cast<const BaseIterator &>(*
this) !=
1032 static_cast<const BaseIterator &>(fi));
1037 template <
typename BaseIterator>
1041 return (static_cast<const BaseIterator &>(*
this) <
1042 static_cast<const BaseIterator &>(fi));
1047 template <
typename BaseIterator>
1051 return (static_cast<const BaseIterator &>(*
this) == bi);
1056 template <
typename BaseIterator>
1060 return (static_cast<const BaseIterator &>(*
this) != bi);
1065 template <
typename BaseIterator>
1069 return (static_cast<const BaseIterator &>(*
this) < bi);
1073 template <
typename BaseIterator>
1079 BaseIterator::operator++();
1086 template <
typename BaseIterator>
1094 BaseIterator::operator++();
1101 template <
typename BaseIterator>
1107 BaseIterator::operator--();
1114 template <
typename BaseIterator>
1122 BaseIterator::operator--();
1129 template <
typename BaseIterator>
1130 template <
typename Predicate>
1133 : predicate(predicate)
1138 template <
typename BaseIterator>
1139 template <
typename Predicate>
1149 template <
typename BaseIterator>
1150 template <
typename Predicate>
1151 std::unique_ptr<typename FilteredIterator<BaseIterator>::PredicateBase>
1154 return std_cxx14::make_unique<PredicateTemplate>(
predicate);
1163 template <
class Iterator>
1165 Active::operator()(
const Iterator &i)
const 1167 return (i->active());
1173 template <
class Iterator>
1175 UserFlagSet::operator()(
const Iterator &i)
const 1177 return (i->user_flag_set());
1183 template <
class Iterator>
1185 UserFlagNotSet::operator()(
const Iterator &i)
const 1187 return (!i->user_flag_set());
1192 inline LevelEqualTo::LevelEqualTo(
const unsigned int level)
1198 template <
class Iterator>
1202 return (static_cast<unsigned int>(i->level()) ==
level);
1210 : subdomain_id(subdomain_id)
1215 template <
class Iterator>
1226 template <
class Iterator>
1230 return (i->is_locally_owned());
1236 template <
class Iterator>
1240 return (i->is_locally_owned_on_level());
1248 const bool only_locally_owned)
1249 : material_ids{material_id}
1250 , only_locally_owned(only_locally_owned)
1256 const std::set<types::material_id> &material_ids,
1257 const bool only_locally_owned)
1258 : material_ids(material_ids)
1259 , only_locally_owned(only_locally_owned)
1264 template <
class Iterator>
1270 i->is_locally_owned()) :
1278 const unsigned int active_fe_index,
1279 const bool only_locally_owned)
1280 : active_fe_indices{active_fe_index}
1281 , only_locally_owned(only_locally_owned)
1287 const std::set<unsigned int> &active_fe_indices,
1288 const bool only_locally_owned)
1289 : active_fe_indices(active_fe_indices)
1290 , only_locally_owned(only_locally_owned)
1295 template <
class Iterator>
1302 i->is_locally_owned()) :
1311 template <
class Iterator>
1315 return (i->at_boundary());
1320 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
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
unsigned int subdomain_id
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
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
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)
typename BaseIterator::AccessorType AccessorType
bool operator()(const Iterator &i) const
IteratorOverIterators end() const