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 on the the equal function defined for the IterBase pointer. Possibly also compare the end pointers, but this is usually not important and would require an additional dynamic cast.

Definition at line 460 of file variant_filter_iterator.h.

461  {
462  return data->equal(other.data);
463  }
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 525 of file variant_filter_iterator.h.

527 {
528  return !(x == y);
529 }
PetscErrorCode Vec x
ReferenceType operator* ( ) const

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

Definition at line 419 of file variant_filter_iterator.h.

References data.

420  {
421  return **data;
422  }
IterBase * data
Iterator& operator++ ( )

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

Definition at line 436 of file variant_filter_iterator.h.

References data, and satisfy_predicate().

437  {
438  ++*data;
439  this->satisfy_predicate();
440  return (*this);
441  }
void satisfy_predicate()
IterBase * data
const Iterator operator++ ( int  )

postfix op++(), creates a temporary!

Definition at line 446 of file variant_filter_iterator.h.

References data, and satisfy_predicate().

447  {
448  Iterator oldValue(*this); // standard is to return old value
449  ++*data;
450  this->satisfy_predicate();
451  return oldValue;
452  }
void satisfy_predicate()
IterBase * data
PointerType operator-> ( ) const

op->()

Definition at line 428 of file variant_filter_iterator.h.

429  {
430  return (&**this);
431  }
Iterator& operator= ( const Iterator &  rhs)

Assignment operator.

Definition at line 483 of file variant_filter_iterator.h.

References swap().

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

484  {
485  Iterator temp(rhs);
486  swap(temp, *this);
487  return *this;
488  }
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 514 of file variant_filter_iterator.h.

516 {
517  return x.equal(y);
518 }
PetscErrorCode Vec x
void satisfy_predicate ( )
private

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

Definition at line 498 of file variant_filter_iterator.h.

References data.

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

499  {
500  while ( !data->equal(end) && !(*pred)(data) )
501  ++(*data);
502  }
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.

Definition at line 352 of file variant_filter_iterator.h.

References satisfy_predicate().

354  :
355  data ( new Iter<IterType>(d) ), // note: uses default IterBase copy constructor
356  end ( new Iter<IterType>(e) ),
357  pred ( new Pred<IterType,PredType>(p) )
358  {
359  this->satisfy_predicate();
360  }
IterBase * end
void satisfy_predicate()
PredBase * pred
IterBase * data
variant_filter_iterator ( )

Default Constructor.

Definition at line 365 of file variant_filter_iterator.h.

365  :
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 374 of file variant_filter_iterator.h.

374  :
375  data (rhs.data != libmesh_nullptr ? rhs.data->clone() : libmesh_nullptr),
376  end (rhs.end != libmesh_nullptr ? rhs.end->clone() : libmesh_nullptr),
377  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 393 of file variant_filter_iterator.h.

394  : data (rhs.data != libmesh_nullptr ? rhs.data->const_clone() : libmesh_nullptr),
395  end (rhs.end != libmesh_nullptr ? rhs.end->const_clone() : libmesh_nullptr),
396  pred (rhs.pred != libmesh_nullptr ? rhs.pred->const_clone() : libmesh_nullptr)
397  {
398  // libMesh::out << "Called templated copy constructor for variant_filter_iterator" << std::endl;
399  }
const class libmesh_nullptr_t libmesh_nullptr
IterBase * end
PredBase * pred
IterBase * data
virtual ~variant_filter_iterator ( )
virtual

Destructor

Definition at line 409 of file variant_filter_iterator.h.

References data, end, libmesh_nullptr, and pred.

410  {
411  delete data; data = libmesh_nullptr;
412  delete end; end = libmesh_nullptr;
413  delete pred; pred = libmesh_nullptr;
414  }
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 328 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 334 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::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::CheckpointIO::build_elem_list(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::CheckpointIO::build_node_list(), 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::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::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_on_processor(), 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::ParsedFunction< Output, OutputGradient >::partial_reparse(), libMesh::ParsedFEMFunction< Output >::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::Parallel::Communicator::receive(), 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::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::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 341 of file variant_filter_iterator.h.

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