variant_filter_iterator.h File Reference

Go to the source code of this file.

Classes

struct  Pred< IterType, PredType >
 

Functions

template<typename PredType , typename IterType >
 variant_filter_iterator (const IterType &d, const IterType &e, const PredType &p)
 
 variant_filter_iterator ()
 
 variant_filter_iterator (const Iterator &rhs)
 
template<class OtherType , class OtherReferenceType , class OtherPointerType >
 variant_filter_iterator (const variant_filter_iterator< Predicate, OtherType, OtherReferenceType, OtherPointerType > &rhs)
 
virtual ~variant_filter_iterator ()
 
ReferenceType operator* () const
 
PointerType operator-> () const
 
Iterator & operator++ ()
 
const Iterator operator++ (int)
 
bool equal (const variant_filter_iterator &other) const
 
void swap (Iterator &lhs, Iterator &rhs)
 
Iterator & operator= (const Iterator &rhs)
 
void satisfy_predicate ()
 
template<class Predicate , class Type , class ReferenceType , class PointerType >
bool operator== (const variant_filter_iterator< Predicate, Type, ReferenceType, PointerType > &x, const variant_filter_iterator< Predicate, Type, ReferenceType, PointerType > &y)
 
template<class Predicate , class Type , class ReferenceType , class PointerType >
bool operator!= (const variant_filter_iterator< Predicate, Type, ReferenceType, PointerType > &x, const variant_filter_iterator< Predicate, Type, ReferenceType, PointerType > &y)
 

Variables

template<class Predicate , class Type , class ReferenceType = Type &, class PointerType = Type *>
IterType iter_data
 
IterBase * data
 
IterBase * end
 
PredBase * pred
 

Function Documentation

◆ equal()

bool equal ( const variant_filter_iterator other) const

Forwards to the equal() function defined for the IterBase pointer.

Definition at line 470 of file variant_filter_iterator.h.

References data.

471  {
472  return data->equal(other.data);
473  }
IterBase * data

◆ operator!=()

template<class Predicate , class Type , class ReferenceType , class PointerType >
bool operator!= ( const variant_filter_iterator< Predicate, Type, ReferenceType, PointerType > &  x,
const variant_filter_iterator< Predicate, Type, ReferenceType, PointerType > &  y 
)
inlineprivate

Definition at line 534 of file variant_filter_iterator.h.

536 {
537  return !(x == y);
538 }

◆ operator*()

ReferenceType operator* ( ) const

unary op*() forwards on to Iter::op*()

Definition at line 431 of file variant_filter_iterator.h.

References data.

432  {
433  return **data;
434  }
IterBase * data

◆ operator++() [1/2]

Iterator& operator++ ( )

op++() forwards on to Iter::op++()

Definition at line 448 of file variant_filter_iterator.h.

References data, and satisfy_predicate().

449  {
450  ++*data;
451  this->satisfy_predicate();
452  return (*this);
453  }
void satisfy_predicate()
IterBase * data

◆ operator++() [2/2]

const Iterator operator++ ( int  )

postfix op++(), creates a temporary!

Definition at line 458 of file variant_filter_iterator.h.

References data, and satisfy_predicate().

459  {
460  Iterator oldValue(*this); // standard is to return old value
461  ++*data;
462  this->satisfy_predicate();
463  return oldValue;
464  }
void satisfy_predicate()
IterBase * data

◆ operator->()

PointerType operator-> ( ) const

op->()

Definition at line 440 of file variant_filter_iterator.h.

441  {
442  return (&**this);
443  }

◆ operator=()

Iterator& operator= ( const Iterator &  rhs)

Assignment operator.

Definition at line 493 of file variant_filter_iterator.h.

References swap().

494  {
495  Iterator temp(rhs);
496  swap(temp, *this);
497  return *this;
498  }
void swap(Iterator &lhs, Iterator &rhs)

◆ operator==()

template<class Predicate , class Type , class ReferenceType , class PointerType >
bool operator== ( const variant_filter_iterator< Predicate, Type, ReferenceType, PointerType > &  x,
const variant_filter_iterator< Predicate, Type, ReferenceType, PointerType > &  y 
)
inlineprivate

Definition at line 523 of file variant_filter_iterator.h.

525 {
526  return x.equal(y);
527 }

◆ satisfy_predicate()

void satisfy_predicate ( )
private

Advances the data pointer until it reaches the end or the predicate is satisfied.

Definition at line 508 of file variant_filter_iterator.h.

References data, and end.

Referenced by operator++(), and variant_filter_iterator().

509  {
510  while ( !data->equal(end) && !(*pred)(data) )
511  ++(*data);
512  }
IterBase * end
IterBase * data

◆ swap()

void swap ( Iterator &  lhs,
Iterator &  rhs 
)

swap, used to implement op=

Definition at line 478 of file variant_filter_iterator.h.

Referenced by libMesh::DenseMatrix< Number >::_evd_lapack(), libMesh::DenseMatrix< Number >::_lu_back_substitute(), libMesh::DenseMatrix< Number >::_lu_decompose(), libMesh::DenseMatrix< Number >::_multiply_blas(), libMesh::GmshIO::build_element_maps(), libMesh::Elem::compute_key(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_periodic_constraints(), libMesh::Utility::deallocate(), libMesh::SystemSubsetBySubdomain::init(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::BuildProjectionList::operator()(), libMesh::Utility::ReverseBytes::operator()(), operator=(), libMesh::PeriodicBoundary::PeriodicBoundary(), libMesh::DofMap::prepare_send_list(), libMesh::TreeNode< N >::refine(), libMesh::ReplicatedMesh::renumber_nodes_and_elements(), libMesh::EpetraMatrix< T >::swap(), libMesh::DenseMatrix< Number >::swap(), libMesh::EigenSparseVector< T >::swap(), libMesh::DistributedVector< T >::swap(), libMesh::LaspackVector< T >::swap(), libMesh::PetscMatrix< T >::swap(), libMesh::EpetraVector< T >::swap(), libMesh::PetscVector< T >::swap(), libMesh::NumericVector< Number >::swap(), libMesh::DifferentiableSystem::swap_physics(), libMesh::TreeNode< N >::transform_nodes_to_elements(), and libMesh::BuildProjectionList::unique().

479  {
480  // Swap the data pointers
481  std::swap (lhs.data, rhs.data);
482 
483  // Swap the end pointers
484  std::swap (lhs.end, rhs.end);
485 
486  // Also swap the predicate objects.
487  std::swap (lhs.pred, rhs.pred);
488  }
void swap(Iterator &lhs, Iterator &rhs)

◆ variant_filter_iterator() [1/4]

template<typename PredType , typename IterType >
variant_filter_iterator ( const IterType &  d,
const IterType &  e,
const PredType &  p 
)

Templated Constructor. Allows you to construct the iterator and predicate from any types. Also advances the data pointer to the first entry which satisfies the predicate.

Note
The initialization list uses the default IterBase copy constructor.

Definition at line 364 of file variant_filter_iterator.h.

References satisfy_predicate().

366  :
367  data ( new Iter<IterType>(d) ),
368  end ( new Iter<IterType>(e) ),
369  pred ( new Pred<IterType,PredType>(p) )
370  {
371  this->satisfy_predicate();
372  }
IterBase * end
void satisfy_predicate()
PredBase * pred
IterBase * data

◆ variant_filter_iterator() [2/4]

variant_filter_iterator ( )

Default Constructor.

Definition at line 377 of file variant_filter_iterator.h.

377  :
378  data(nullptr),
379  end(nullptr),
380  pred(nullptr) {}
IterBase * end
PredBase * pred
IterBase * data

◆ variant_filter_iterator() [3/4]

variant_filter_iterator ( const Iterator &  rhs)

Copy Constructor. Copy the internal data instead of sharing it.

Definition at line 386 of file variant_filter_iterator.h.

386  :
387  data (rhs.data != nullptr ? rhs.data->clone() : nullptr),
388  end (rhs.end != nullptr ? rhs.end->clone() : nullptr),
389  pred (rhs.pred != nullptr ? rhs.pred->clone() : nullptr) {}
IterBase * end
PredBase * pred
IterBase * data

◆ variant_filter_iterator() [4/4]

template<class OtherType , class OtherReferenceType , class OtherPointerType >
variant_filter_iterator ( const variant_filter_iterator< Predicate, OtherType, OtherReferenceType, OtherPointerType > &  rhs)

Copy construct from another (similar) variant_filter_iterator. The Predicate is the same, but the Type, ReferenceType and PointerType are different. Example: You are iterating over a std::vector<int *> with std::vector<int *>::iterator Then, you have: Type=int * , ReferenceType=int *& , PointerType=int ** On the other hand, when you iterate using std::vector<int *>::const_iterator you have: Type=int * const, ReferenceType=int * const & , PointerType=int * const *

Definition at line 405 of file variant_filter_iterator.h.

406  : data (rhs.data != nullptr ? rhs.data->const_clone() : nullptr),
407  end (rhs.end != nullptr ? rhs.end->const_clone() : nullptr),
408  pred (rhs.pred != nullptr ? rhs.pred->const_clone() : nullptr)
409  {
410  // libMesh::out << "Called templated copy constructor for variant_filter_iterator" << std::endl;
411  }
IterBase * end
PredBase * pred
IterBase * data

◆ ~variant_filter_iterator()

virtual ~variant_filter_iterator ( )
virtual

Destructor

Definition at line 421 of file variant_filter_iterator.h.

References data, end, and pred.

422  {
423  delete data; data = nullptr;
424  delete end; end = nullptr;
425  delete pred; pred = nullptr;
426  }
IterBase * end
PredBase * pred
IterBase * data

Variable Documentation

◆ data

IterBase* data

Ideally this private member data should have protected access. However, if we want a const_iterator to be constructable from an non-const one, templated versions of the same class (not related by inheritance) will need to know about these private members. Thus, they have public access.

Polymorphic pointer to the object. Don't confuse with the data pointer located in the Iter!

Definition at line 337 of file variant_filter_iterator.h.

Referenced by libMesh::__libmesh_nlopt_equality_constraints(), libMesh::__libmesh_nlopt_inequality_constraints(), libMesh::__libmesh_nlopt_objective(), libMesh::SyncNodalPositions::act_on_data(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::Partitioner::assign_partitioning(), libMesh::Parallel::BinSorter< KeyType, IdxType >::binsort(), libMesh::Parallel::Communicator::broadcast(), libMesh::InfFE< Dim, T_radial, T_map >::compute_data(), libMesh::FEInterface::compute_data(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshFunction::discontinuous_value(), equal(), libMesh::DofMap::gather_constraints(), libMesh::SyncNodalPositions::gather_data(), libMesh::Nemesis_IO_Helper::get_elem_cmap(), libMesh::Nemesis_IO_Helper::get_node_cmap(), libMesh::FEInterface::ifem_compute_data(), libMesh::QMonomial::init_2D(), libMesh::QMonomial::init_3D(), libMesh::Parallel::Histogram< KeyType, IdxType >::make_histogram(), libMesh::MeshFunction::operator()(), libMesh::Utility::ReverseBytes::operator()(), operator*(), operator++(), libMesh::ExodusII_IO_Helper::NamesData::push_back_entry(), libMesh::Parallel::push_parallel_vector_data(), libMesh::Nemesis_IO_Helper::put_elem_cmap(), libMesh::PltLoader::read_block_data(), libMesh::PltLoader::read_feblock_data(), libMesh::PltLoader::read_fepoint_data(), libMesh::PltLoader::read_point_data(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::DistributedMesh::renumber_dof_objects(), satisfy_predicate(), libMesh::Parallel::Communicator::scatter(), libMesh::DofMap::scatter_constraints(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Parallel::sync_dofobject_data_by_id(), libMesh::Parallel::sync_dofobject_data_by_xyz(), libMesh::Parallel::sync_element_data_by_parent_id(), libMesh::Parallel::sync_node_data_by_element_id_once(), libMesh::EpetraMatrix< T >::update_sparsity_pattern(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::VTKIO::write_nodal_data(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::GnuPlotIO::write_solution(), and ~variant_filter_iterator().

◆ end

IterBase* end

Also have a polymorphic pointer to the end object, this prevents iterating past the end.

Definition at line 343 of file variant_filter_iterator.h.

Referenced by GETPOT_NAMESPACE::GetPot::_DBE_expand(), libMesh::SubdomainPartitioner::_do_partition(), libMesh::MeshTools::Modification::all_tri(), libMesh::Parallel::Communicator::allgather(), libMesh::MeshCommunication::assign_global_indices(), libMesh::PeriodicBoundaries::boundary(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::EquationSystems::build_variable_names(), libMesh::Parallel::Sort< KeyType, IdxType >::communicate_bins(), libMesh::EquationSystems::compare(), libMesh::CentroidPartitioner::compute_centroids(), libMesh::Nemesis_IO_Helper::compute_communication_map_parameters(), libMesh::Nemesis_IO_Helper::compute_elem_communication_maps(), libMesh::Nemesis_IO_Helper::compute_node_communication_maps(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::vectormap< Key, Tp >::count(), DMlibMeshSetUpName_Private(), DMView_libMesh(), libMesh::mapvector< libMesh::Elem *, dof_id_type >::end(), libMesh::vectormap< Key, Tp >::find(), libMesh::Elem::find_edge_neighbors(), libMesh::MeshCommunication::find_global_indices(), libMesh::Elem::find_interior_neighbors(), libMesh::MeshCommunication::find_local_indices(), libMesh::AbaqusIO::generate_ids(), libMesh::EquationSystems::get_info(), libMesh::EquationSystems::get_system(), libMesh::EquationSystems::get_vars_active_subdomains(), GETPOT_NAMESPACE::GetPot::GetPot(), libMesh::StatisticsVector< ErrorVectorReal >::histogram(), libMesh::LaplaceMeshSmoother::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::Prism6::is_node_on_edge(), libMesh::Pyramid5::is_node_on_edge(), libMesh::Tet4::is_node_on_edge(), libMesh::Hex8::is_node_on_edge(), libMesh::InfHex8::is_node_on_edge(), libMesh::InfPrism6::is_node_on_edge(), libMesh::Tet10::is_node_on_edge(), libMesh::InfPrism12::is_node_on_edge(), libMesh::Hex27::is_node_on_edge(), libMesh::Hex20::is_node_on_edge(), libMesh::Prism18::is_node_on_edge(), libMesh::Pyramid13::is_node_on_edge(), libMesh::Prism15::is_node_on_edge(), libMesh::InfHex16::is_node_on_edge(), libMesh::Pyramid14::is_node_on_edge(), libMesh::InfHex18::is_node_on_edge(), libMesh::Quad4::is_node_on_side(), libMesh::Pyramid5::is_node_on_side(), libMesh::Prism6::is_node_on_side(), libMesh::Quad8::is_node_on_side(), libMesh::Quad9::is_node_on_side(), libMesh::Tri3::is_node_on_side(), libMesh::InfQuad4::is_node_on_side(), libMesh::InfQuad6::is_node_on_side(), libMesh::Hex8::is_node_on_side(), libMesh::Tet4::is_node_on_side(), libMesh::InfHex8::is_node_on_side(), libMesh::Tri6::is_node_on_side(), libMesh::InfPrism6::is_node_on_side(), libMesh::Tet10::is_node_on_side(), libMesh::InfPrism12::is_node_on_side(), libMesh::Hex27::is_node_on_side(), libMesh::Hex20::is_node_on_side(), libMesh::Pyramid13::is_node_on_side(), libMesh::Prism15::is_node_on_side(), libMesh::Prism18::is_node_on_side(), libMesh::InfHex16::is_node_on_side(), libMesh::Pyramid14::is_node_on_side(), libMesh::InfHex18::is_node_on_side(), libMesh::PetscVector< T >::map_global_to_local_index(), libMesh::StatisticsVector< ErrorVectorReal >::maximum(), libMesh::StatisticsVector< ErrorVectorReal >::median(), libMesh::StatisticsVector< ErrorVectorReal >::minimum(), libMesh::EquationSystems::n_active_dofs(), libMesh::CheckpointIO::n_active_levels_in(), libMesh::EquationSystems::n_dofs(), libMesh::MeshTools::n_elem(), libMesh::MeshTools::n_nodes(), libMesh::EquationSystems::n_vars(), libMesh::Quad4::nodes_on_side(), libMesh::Prism6::nodes_on_side(), libMesh::Pyramid5::nodes_on_side(), libMesh::Tri3::nodes_on_side(), libMesh::Quad8::nodes_on_side(), libMesh::Quad9::nodes_on_side(), libMesh::InfQuad4::nodes_on_side(), libMesh::InfQuad6::nodes_on_side(), libMesh::Hex8::nodes_on_side(), libMesh::Tet4::nodes_on_side(), libMesh::Tri6::nodes_on_side(), libMesh::InfHex8::nodes_on_side(), libMesh::InfPrism6::nodes_on_side(), libMesh::Tet10::nodes_on_side(), libMesh::InfPrism12::nodes_on_side(), libMesh::Hex20::nodes_on_side(), libMesh::Hex27::nodes_on_side(), libMesh::Prism18::nodes_on_side(), libMesh::Pyramid13::nodes_on_side(), libMesh::Prism15::nodes_on_side(), libMesh::InfHex16::nodes_on_side(), libMesh::Pyramid14::nodes_on_side(), libMesh::InfHex18::nodes_on_side(), GETPOT_NAMESPACE::GetPot::operator=(), libMesh::vectormap< Key, Tp >::operator[](), libMesh::AbaqusIO::parse_label(), libMesh::ParsedFEMFunction< T >::partial_reparse(), libMesh::ParsedFunction< T >::partial_reparse(), libMesh::LinearPartitioner::partition_range(), libMesh::MetisPartitioner::partition_range(), libMesh::MappedSubdomainPartitioner::partition_range(), libMesh::SFCPartitioner::partition_range(), libMesh::CentroidPartitioner::partition_range(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::LaplaceMeshSmoother::print_graph(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::VariationalMeshSmoother::readgr(), libMesh::DofMap::remove_adjoint_dirichlet_boundary(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::ReplicatedMesh::renumber_nodes_and_elements(), libMesh::DistributedMesh::renumber_nodes_and_elements(), satisfy_predicate(), libMesh::Parallel::Communicator::scatter(), libMesh::DofMap::scatter_constraints(), libMesh::DofObject::set_n_vars_per_group(), libMesh::Partitioner::single_partition_range(), libMesh::vectormap< Key, Tp >::sort(), libMesh::ReplicatedMesh::stitching_helper(), libMesh::System::write_serialized_blocked_dof_objects(), GETPOT_NAMESPACE::GetPot::~GetPot(), and ~variant_filter_iterator().

◆ iter_data

template<class Predicate , class Type , class ReferenceType = Type &, class PointerType = Type *>
IterType iter_data

Original Authors: Corwin Joy * Michael Gradman cjoy@.nosp@m.hous.nosp@m.ton.r.nosp@m.r.co.nosp@m.m * Micha.nosp@m.el.G.nosp@m.radma.nosp@m.n@ca.nosp@m.minus.nosp@m..com Caminus, Suite 1150, Two Allen Center, 1200 Smith Street, Houston, TX 77002 This class is an extension of variant_bidirectional_iterator to a filter_iterator similar to boost's. The filter iterator is modeled after a forward_iterator since to go backward and forward requires the storage of both a "begin" and "end" iterator to avoid stepping off the end or the beginning. To reduce complexity, we only allow traversal in one direction.

Author
John W. Peterson
Date
2004 This is the iterator passed by the user.

Definition at line 50 of file variant_filter_iterator.h.

◆ pred

PredBase* pred

The predicate object. Must have op() capable of operating on IterBase * pointers. Therefore it has to follow the same paradigm as IterBase.

Definition at line 350 of file variant_filter_iterator.h.

Referenced by libMesh::Predicates::abstract_multi_predicate< T >::operator()(), and ~variant_filter_iterator().