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

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.

471  {
472  return data->equal(other.data);
473  }
IterBase * data
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 }
PetscErrorCode Vec x
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
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
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
PointerType operator-> ( ) const

op->()

Definition at line 440 of file variant_filter_iterator.h.

441  {
442  return (&**this);
443  }
Iterator& operator= ( const Iterator &  rhs)

Assignment operator.

Definition at line 493 of file variant_filter_iterator.h.

References swap().

Referenced by libMesh::Parallel::Communicator::get().

494  {
495  Iterator temp(rhs);
496  swap(temp, *this);
497  return *this;
498  }
void swap(Iterator &lhs, Iterator &rhs)
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 }
PetscErrorCode Vec x
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.

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

509  {
510  while ( !data->equal(end) && !(*pred)(data) )
511  ++(*data);
512  }
IterBase * end
IterBase * data
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 ( )

Default Constructor.

Definition at line 377 of file variant_filter_iterator.h.

377  :
const class libmesh_nullptr_t libmesh_nullptr
IterBase * end
PredBase * pred
IterBase * data
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 != libmesh_nullptr ? rhs.data->clone() : libmesh_nullptr),
388  end (rhs.end != libmesh_nullptr ? rhs.end->clone() : libmesh_nullptr),
389  pred (rhs.pred != libmesh_nullptr ? rhs.pred->clone() : libmesh_nullptr) {}
const class libmesh_nullptr_t libmesh_nullptr
IterBase * end
PredBase * pred
IterBase * data
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 != libmesh_nullptr ? rhs.data->const_clone() : libmesh_nullptr),
407  end (rhs.end != libmesh_nullptr ? rhs.end->const_clone() : libmesh_nullptr),
408  pred (rhs.pred != libmesh_nullptr ? rhs.pred->const_clone() : libmesh_nullptr)
409  {
410  // libMesh::out << "Called templated copy constructor for variant_filter_iterator" << std::endl;
411  }
const class libmesh_nullptr_t libmesh_nullptr
IterBase * end
PredBase * pred
IterBase * data
virtual ~variant_filter_iterator ( )
virtual

Destructor

Definition at line 421 of file variant_filter_iterator.h.

References data, end, libmesh_nullptr, and pred.

422  {
423  delete data; data = libmesh_nullptr;
424  delete end; end = libmesh_nullptr;
425  delete pred; pred = libmesh_nullptr;
426  }
const class libmesh_nullptr_t libmesh_nullptr
IterBase * end
PredBase * pred
IterBase * data

Variable Documentation

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::Parallel::Communicator::broadcast(), libMesh::MeshFunction::discontinuous_value(), libMesh::QMonomial::init_2D(), libMesh::QMonomial::init_3D(), libMesh::MeshCommunication::make_p_levels_parallel_consistent(), libMesh::MeshFunction::operator()(), libMesh::Utility::ReverseBytes::operator()(), operator*(), operator++(), libMesh::PltLoader::read_block_data(), libMesh::PltLoader::read_feblock_data(), libMesh::PltLoader::read_fepoint_data(), libMesh::PltLoader::read_point_data(), satisfy_predicate(), libMesh::Parallel::Communicator::send_mode(), libMesh::Parallel::Communicator::set_union(), 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(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::VTKIO::write_nodal_data(), libMesh::GnuPlotIO::write_solution(), libMesh::FEInterface::~FEInterface(), libMesh::InfFE< Dim, T_radial, T_map >::~InfFE(), and ~variant_filter_iterator().

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 libMesh::MeshRefinement::_coarsen_elements(), GETPOT_NAMESPACE::GetPot::_DBE_expand(), libMesh::SubdomainPartitioner::_do_partition(), libMesh::MeshRefinement::_refine_elements(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::MeshTools::Modification::all_tri(), libMesh::Parallel::Communicator::allgather(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::MeshCommunication::assign_global_indices(), libMesh::AbaqusIO::assign_sideset_ids(), libMesh::MetisPartitioner::attach_weights(), libMesh::Partitioner::attach_weights(), libMesh::PeriodicBoundaries::boundary(), libMesh::Patch::build_around_element(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::MeshTools::build_nodes_to_elem_map(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::MeshTools::Generation::build_sphere(), libMesh::EquationSystems::build_variable_names(), libMesh::MeshBase::cache_elem_dims(), libMesh::VTKIO::cells_to_vtk(), libMesh::TetGenMeshInterface::check_hull_integrity(), libMesh::ReplicatedMesh::clear(), libMesh::DistributedMesh::clear(), libMesh::LinearPartitioner::clone(), 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_element_maps(), libMesh::Nemesis_IO_Helper::compute_node_communication_maps(), libMesh::Nemesis_IO_Helper::compute_node_maps(), libMesh::DofMap::compute_sparsity(), libMesh::UnstructuredMesh::contract(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::GMVIO::copy_nodal_solution(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::vectormap< dof_id_type, dof_id_type >::count(), libMesh::CheckpointIO::current_n_processors(), libMesh::ElemCutter::cut_2D(), libMesh::ElemCutter::cut_3D(), libMesh::TetGenMeshInterface::delete_2D_hull_elements(), libMesh::MeshBase::detect_interior_parents(), libMesh::MeshTools::Modification::distort(), DMCreateDomainDecomposition_libMesh(), DMCreateFieldDecomposition_libMesh(), DMlibMeshSetSystem_libMesh(), DMlibMeshSetUpName_Private(), DMView_libMesh(), libMesh::TecplotIO::elem_dimension(), libMesh::MeshTools::elem_types(), libMesh::UNVIO::elements_out(), libMesh::mapvector< libMesh::Elem *, dof_id_type >::end(), libMesh::TopologyMap::fill(), libMesh::LocationMap< T >::fill(), libMesh::TetGenMeshInterface::fill_pointlist(), libMesh::vectormap< dof_id_type, dof_id_type >::find(), libMesh::MeshTools::find_boundary_nodes(), libMesh::Elem::find_edge_neighbors(), libMesh::MeshFunction::find_element(), libMesh::MeshFunction::find_elements(), libMesh::Patch::find_face_neighbors(), libMesh::MeshCommunication::find_global_indices(), libMesh::MeshTools::find_hanging_nodes_and_parents(), libMesh::Elem::find_interior_neighbors(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::Patch::find_point_neighbors(), libMesh::Elem::find_point_neighbors(), libMesh::DistributedMesh::fix_broken_node_and_element_numbering(), libMesh::MeshTools::Modification::flatten(), libMesh::AbaqusIO::generate_ids(), libMesh::EquationSystems::get_info(), libMesh::DofMap::get_info(), libMesh::EquationSystems::get_solution(), libMesh::EquationSystems::get_system(), GETPOT_NAMESPACE::GetPot::GetPot(), libMesh::UNVIO::groups_in(), libMesh::System::hide_output(), libMesh::StatisticsVector< T >::histogram(), libMesh::LocationMap< T >::init(), libMesh::LaplaceMeshSmoother::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::Elem::is_semilocal(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::PetscVector< T >::map_global_to_local_index(), libMesh::StatisticsVector< T >::maximum(), libMesh::StatisticsVector< T >::median(), libMesh::StatisticsVector< T >::minimum(), libMesh::EquationSystems::n_active_dofs(), libMesh::CheckpointIO::n_active_levels_in(), libMesh::MeshBase::n_active_sub_elem(), libMesh::EquationSystems::n_dofs(), libMesh::MeshTools::n_non_subactive_elem_of_type_at_level(), libMesh::MeshBase::n_sub_elem(), libMesh::EquationSystems::n_vars(), libMesh::UNVIO::nodes_out(), libMesh::SparsityPattern::Build::operator()(), libMesh::BoundaryInfo::operator=(), GETPOT_NAMESPACE::GetPot::operator=(), libMesh::vectormap< dof_id_type, dof_id_type >::operator[](), libMesh::AbaqusIO::parse_label(), libMesh::ParsedFEMFunction< Output >::partial_reparse(), libMesh::ParsedFunction< Output, OutputGradient >::partial_reparse(), libMesh::LinearPartitioner::partition_range(), libMesh::MetisPartitioner::partition_range(), libMesh::SFCPartitioner::partition_range(), libMesh::MappedSubdomainPartitioner::partition_range(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::TetGenMeshInterface::pointset_convexhull(), libMesh::LaplaceMeshSmoother::print_graph(), libMesh::BoundaryInfo::print_info(), libMesh::BoundaryInfo::print_summary(), libMesh::Nemesis_IO::read(), libMesh::System::read_legacy_data(), libMesh::GmshIO::read_mesh(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::VariationalMeshSmoother::readgr(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::MeshTools::Modification::redistribute(), libMesh::BoundaryInfo::regenerate_id_sets(), libMesh::DofMap::remove_adjoint_dirichlet_boundary(), libMesh::DofMap::remove_dirichlet_boundary(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::ReplicatedMesh::renumber_nodes_and_elements(), libMesh::DistributedMesh::renumber_nodes_and_elements(), libMesh::Parallel::Communicator::scatter(), libMesh::DofMap::scatter_constraints(), libMesh::MeshCommunication::send_coarse_ghosts(), libMesh::DofObject::set_n_vars_per_group(), libMesh::Partitioner::set_parent_processor_ids(), libMesh::SFCPartitioner::set_sfc_type(), libMesh::CentroidPartitioner::set_sort_method(), libMesh::Partitioner::single_partition_range(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::MeshTools::Modification::smooth(), libMesh::vectormap< dof_id_type, dof_id_type >::sort(), libMesh::ReplicatedMesh::stitching_helper(), libMesh::MeshBase::subdomain_ids(), libMesh::Tree< N >::Tree(), libMesh::TriangleInterface::triangulate(), libMesh::TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::MeshTools::weight(), libMesh::FroIO::write(), libMesh::TetGenIO::write(), libMesh::MEDITIO::write_ascii(), libMesh::TecplotIO::write_ascii(), libMesh::GMVIO::write_ascii_new_impl(), libMesh::GMVIO::write_ascii_old_impl(), libMesh::TecplotIO::write_binary(), libMesh::GMVIO::write_binary(), libMesh::CheckpointIO::write_connectivity(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::UCDIO::write_interior_elems(), libMesh::GmshIO::write_mesh(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::UCDIO::write_nodes(), libMesh::CheckpointIO::write_nodes(), libMesh::GmshIO::write_post(), libMesh::CheckpointIO::write_remote_elem(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::VariationalMeshSmoother::writegr(), libMesh::DirichletBoundaries::~DirichletBoundaries(), GETPOT_NAMESPACE::GetPot::~GetPot(), libMesh::PeriodicBoundaries::~PeriodicBoundaries(), and ~variant_filter_iterator().

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.

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().