15#ifndef dealii_filtered_iterator_h
16#define dealii_filtered_iterator_h
30#ifdef DEAL_II_HAVE_CXX20
68 template <
class Iterator>
88 template <
class Iterator>
108 template <
class Iterator>
135 template <
class Iterator>
170 template <
class Iterator>
200 template <
class Iterator>
220 template <
class Iterator>
257 template <
class Iterator>
303 template <
class Iterator>
331 template <
class Iterator>
363 template <
class Iterator>
401 template <
class Iterator>
631template <
typename BaseIterator>
646 template <
typename Predicate>
669 template <
typename Predicate>
806 <<
"The element " << arg1
807 <<
" with which you want to compare or which you want to"
808 <<
" assign from is invalid since it does not satisfy the predicate.");
840 virtual std::unique_ptr<PredicateBase>
853 template <
typename Predicate>
872 virtual std::unique_ptr<PredicateBase>
873 clone()
const override;
902template <
typename BaseIterator,
typename Predicate>
916 namespace FilteredIteratorImplementation
922 template <
typename BaseIterator,
typename TypeList>
925 template <
typename BaseIterator,
typename Predicate>
931 template <
typename BaseIterator,
typename Predicate,
typename... Targs>
936 std::tuple<Targs...>>::type>;
995template <
typename BaseIterator,
typename Predicate>
1066template <
typename BaseIterator,
typename Predicate,
typename... Targs>
1069 typename internal::FilteredIteratorImplementation::
1070 NestFilteredIterators<
BaseIterator, std::tuple<Predicate, Targs...>>::
1073 const Targs... args)
1142template <
typename BaseIterator,
typename Predicate>
1155template <
typename BaseIterator>
1156template <
typename Predicate>
1164template <
typename BaseIterator>
1165template <
typename Predicate>
1173 set_to_next_positive(bi);
1178template <
typename BaseIterator>
1186 , predicate(fi.predicate->clone())
1191template <
typename BaseIterator>
1201 return operator=(bi);
1206template <
typename BaseIterator>
1211 ExcInvalidElement(bi));
1212 BaseIterator::operator=(bi);
1218template <
typename BaseIterator>
1222 BaseIterator::operator=(bi);
1224 BaseIterator::operator++();
1231template <
typename BaseIterator>
1235 BaseIterator::operator=(bi);
1237 BaseIterator::operator--();
1244template <
typename BaseIterator>
1254template <
typename BaseIterator>
1264template <
typename BaseIterator>
1274template <
typename BaseIterator>
1278 return (
static_cast<const BaseIterator &
>(*
this) == bi);
1283template <
typename BaseIterator>
1287 return (
static_cast<const BaseIterator &
>(*
this) != bi);
1292template <
typename BaseIterator>
1296 return (
static_cast<const BaseIterator &
>(*
this) < bi);
1300template <
typename BaseIterator>
1306 BaseIterator::operator++();
1313template <
typename BaseIterator>
1321 BaseIterator::operator++();
1328template <
typename BaseIterator>
1334 BaseIterator::operator--();
1341template <
typename BaseIterator>
1349 BaseIterator::operator--();
1356template <
typename BaseIterator>
1357template <
typename Predicate>
1359 Predicate>::PredicateTemplate(
const Predicate &predicate)
1360 : predicate(predicate)
1365template <
typename BaseIterator>
1366template <
typename Predicate>
1376template <
typename BaseIterator>
1377template <
typename Predicate>
1378std::unique_ptr<typename FilteredIterator<BaseIterator>::PredicateBase>
1381 return std::make_unique<PredicateTemplate>(
predicate);
1390 template <
class Iterator>
1392 Active::operator()(
const Iterator &i)
const
1394 return i->is_active();
1400 template <
class Iterator>
1402 UserFlagSet::operator()(
const Iterator &i)
const
1404 return (i->user_flag_set());
1410 template <
class Iterator>
1412 UserFlagNotSet::operator()(
const Iterator &i)
const
1414 return (!i->user_flag_set());
1419 inline LevelEqualTo::LevelEqualTo(
const unsigned int level)
1425 template <
class Iterator>
1429 return (
static_cast<unsigned int>(i->level()) ==
level);
1437 : subdomain_id(subdomain_id)
1442 template <
class Iterator>
1453 template <
class Iterator>
1457 return (i->is_locally_owned());
1463 template <
class Iterator>
1467 return (i->is_locally_owned_on_level());
1475 const bool only_locally_owned)
1476 : material_ids{material_id}
1477 , only_locally_owned(only_locally_owned)
1483 const std::set<types::material_id> &material_ids,
1484 const bool only_locally_owned)
1485 : material_ids(material_ids)
1486 , only_locally_owned(only_locally_owned)
1491 template <
class Iterator>
1497 i->is_locally_owned()) :
1505 const unsigned int active_fe_index,
1506 const bool only_locally_owned)
1507 : active_fe_indices{active_fe_index}
1508 , only_locally_owned(only_locally_owned)
1514 const std::set<unsigned int> &active_fe_indices,
1515 const bool only_locally_owned)
1516 : active_fe_indices(active_fe_indices)
1517 , only_locally_owned(only_locally_owned)
1522 template <
class Iterator>
1527 (i->is_locally_owned() &&
1538 template <
class Iterator>
1542 return (i->at_boundary());
1550 : boundary_ids{boundary_id}
1556 const std::set<types::boundary_id> &boundary_ids)
1557 : boundary_ids(boundary_ids)
1562 template <
class Iterator>
1574 : manifold_ids{manifold_id}
1580 const std::set<types::manifold_id> &manifold_ids)
1581 : manifold_ids(manifold_ids)
1586 template <
class Iterator>
virtual ~PredicateBase()=default
virtual bool operator()(const BaseIterator &bi) const =0
virtual std::unique_ptr< PredicateBase > clone() const =0
virtual bool operator()(const BaseIterator &bi) const override
PredicateTemplate(const Predicate &predicate)
const Predicate predicate
virtual std::unique_ptr< PredicateBase > clone() const override
FilteredIterator & set_to_next_positive(const BaseIterator &bi)
FilteredIterator & set_to_previous_positive(const BaseIterator &bi)
FilteredIterator & operator--()
typename BaseIterator::AccessorType AccessorType
bool operator==(const FilteredIterator &fi) const
bool operator!=(const FilteredIterator &fi) const
FilteredIterator(Predicate p)
bool operator<(const FilteredIterator &fi) const
FilteredIterator & operator=(const FilteredIterator &fi)
std::unique_ptr< const PredicateBase > predicate
FilteredIterator & operator++()
const bool only_locally_owned
bool operator()(const Iterator &i) const
const std::set< unsigned int > active_fe_indices
ActiveFEIndexEqualTo(const unsigned int active_fe_index, const bool only_locally_owned=false)
bool operator()(const Iterator &i) const
bool operator()(const Iterator &i) const
bool operator()(const Iterator &i) const
const std::set< types::boundary_id > boundary_ids
BoundaryIdEqualTo(const types::boundary_id boundary_id)
bool operator()(const Iterator &i) const
LevelEqualTo(const unsigned int level)
bool operator()(const Iterator &i) const
bool operator()(const Iterator &i) const
bool operator()(const Iterator &i) const
ManifoldIdEqualTo(const types::manifold_id manifold_id)
const std::set< types::manifold_id > manifold_ids
const bool only_locally_owned
bool operator()(const Iterator &i) const
MaterialIdEqualTo(const types::material_id material_id, const bool only_locally_owned=false)
const std::set< types::material_id > material_ids
SubdomainEqualTo(const types::subdomain_id subdomain_id)
bool operator()(const Iterator &i) const
const types::subdomain_id subdomain_id
bool operator()(const Iterator &i) const
bool operator()(const Iterator &i) const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_CXX20_REQUIRES(condition)
#define DEAL_II_NAMESPACE_CLOSE
FilteredIterator< BaseIterator > make_filtered_iterator(const BaseIterator &i, const Predicate &p)
IteratorRange< typename internal::FilteredIteratorImplementation::NestFilteredIterators< BaseIterator, std::tuple< Predicate, Targs... > >::type > filter_iterators(IteratorRange< BaseIterator > i, const Predicate &p, const Targs... args)
IteratorRange< FilteredIterator< BaseIterator > > filter_iterators(IteratorRange< BaseIterator > i, const Predicate &p)
IteratorRange< FilteredIterator< BaseIterator > > operator|(IteratorRange< BaseIterator > i, const Predicate &p)
static ::ExceptionBase & ExcInvalidElement(BaseIterator arg1)
#define Assert(cond, exc)
#define DeclException1(Exception1, type1, outsequence)
@ valid
Iterator points to a valid object.