libMesh
Classes | Functions | Variables
variant_filter_iterator.h File Reference

Go to the source code of this file.

Classes

struct  Pred< IterType, PredType >
 The actual predicate is held as a template parameter here. More...
 

Functions

template<typename PredType , typename IterType >
 variant_filter_iterator (const IterType &d, const IterType &e, const PredType &p)
 Templated Constructor. More...
 
 variant_filter_iterator ()
 Default Constructor. More...
 
 variant_filter_iterator (const Iterator &rhs)
 Copy Constructor. More...
 
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. More...
 
virtual ~variant_filter_iterator ()
 Destructor. More...
 
ReferenceType operator* () const
 unary op*() forwards on to Iter::op*() More...
 
PointerType operator-> () const
 op->() More...
 
Iterator & operator++ ()
 op++() forwards on to Iter::op++() More...
 
const Iterator operator++ (int)
 postfix op++(), creates a temporary! More...
 
bool equal (const variant_filter_iterator &other) const
 Forwards to the equal() function defined for the IterBase pointer. More...
 
void swap (Iterator &lhs, Iterator &rhs)
 swap, used to implement op= More...
 
Iterator & operator= (const Iterator &rhs)
 Assignment operator. More...
 
void satisfy_predicate ()
 Advances the data pointer until it reaches the end or the predicate is satisfied. More...
 
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
 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. More...
 
IterBase * data
 Ideally this private member data should have protected access. More...
 
IterBase * end
 Also have a polymorphic pointer to the end object, this prevents iterating past the end. More...
 
PredBase * pred
 The predicate object. More...
 

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
Ideally this private member data should have protected access.
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 
)
private

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
Ideally this private member data should have protected access.
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()
Advances the data pointer until it reaches the end or the predicate is satisfied. ...
IterBase * data
Ideally this private member data should have protected access.
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()
Advances the data pointer until it reaches the end or the predicate is satisfied. ...
IterBase * data
Ideally this private member data should have protected access.
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)
swap, used to implement op=
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 
)
private

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
Also have a polymorphic pointer to the end object, this prevents iterating past the end...
IterBase * data
Ideally this private member data should have protected access.
void swap ( Iterator &  lhs,
Iterator &  rhs 
)
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
Also have a polymorphic pointer to the end object, this prevents iterating past the end...
The actual predicate is held as a template parameter here.
void satisfy_predicate()
Advances the data pointer until it reaches the end or the predicate is satisfied. ...
PredBase * pred
The predicate object.
IterBase * data
Ideally this private member data should have protected access.
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
Also have a polymorphic pointer to the end object, this prevents iterating past the end...
PredBase * pred
The predicate object.
IterBase * data
Ideally this private member data should have protected access.
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
Also have a polymorphic pointer to the end object, this prevents iterating past the end...
PredBase * pred
The predicate object.
IterBase * data
Ideally this private member data should have protected access.
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
Also have a polymorphic pointer to the end object, this prevents iterating past the end...
PredBase * pred
The predicate object.
IterBase * data
Ideally this private member data should have protected access.
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
Also have a polymorphic pointer to the end object, this prevents iterating past the end...
PredBase * pred
The predicate object.
IterBase * data
Ideally this private member data should have protected access.

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::DTKEvaluator::evaluate(), libMesh::MeshCommunication::make_p_levels_parallel_consistent(), LinearElasticityWithContact::move_mesh(), 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(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::XdrIO::read_serialized_nodesets(), 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::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 GETPOT_NAMESPACE::GetPot::_DBE_expand(), libMesh::SubdomainPartitioner::_do_partition(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::MeshTools::Modification::all_tri(), libMesh::Parallel::Communicator::allgather(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::MeshCommunication::assign_global_indices(), libMesh::MetisPartitioner::attach_weights(), libMesh::Partitioner::attach_weights(), libMesh::PeriodicBoundaries::boundary(), libMesh::Patch::build_around_element(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::EquationSystems::build_variable_names(), libMesh::MeshBase::cache_elem_dims(), 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::vectormap< dof_id_type, dof_id_type >::count(), libMesh::CheckpointIO::current_n_processors(), libMesh::ElemCutter::cut_2D(), libMesh::ElemCutter::cut_3D(), libMesh::MeshBase::detect_interior_parents(), DMCreateDomainDecomposition_libMesh(), DMCreateFieldDecomposition_libMesh(), DMlibMeshSetUpName_Private(), DMView_libMesh(), libMesh::DTKAdapter::DTKAdapter(), libMesh::mapvector< libMesh::Elem *, dof_id_type >::end(), libMesh::vectormap< dof_id_type, dof_id_type >::find(), libMesh::Elem::find_edge_neighbors(), libMesh::MeshFunction::find_element(), libMesh::MeshFunction::find_elements(), libMesh::Patch::find_face_neighbors(), libMesh::MeshCommunication::find_global_indices(), 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::AbaqusIO::generate_ids(), libMesh::EquationSystems::get_info(), libMesh::DofMap::get_info(), libMesh::DTKAdapter::get_semi_local_nodes(), libMesh::EquationSystems::get_solution(), libMesh::EquationSystems::get_system(), GETPOT_NAMESPACE::GetPot::GetPot(), libMesh::System::hide_output(), libMesh::StatisticsVector< T >::histogram(), libMesh::LaplaceMeshSmoother::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::Elem::is_semilocal(), libMesh::MeshRefinement::make_coarsening_compatible(), 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::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::LaplaceMeshSmoother::print_graph(), libMesh::BoundaryInfo::print_info(), libMesh::BoundaryInfo::print_summary(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::VariationalMeshSmoother::readgr(), libMesh::MeshBase::recalculate_n_partitions(), 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::SFCPartitioner::set_sfc_type(), libMesh::CentroidPartitioner::set_sort_method(), libMesh::Partitioner::single_partition_range(), libMesh::MeshTools::Modification::smooth(), libMesh::vectormap< dof_id_type, dof_id_type >::sort(), libMesh::ReplicatedMesh::stitching_helper(), libMesh::MeshBase::subdomain_ids(), ParallelTest::testRecvIsendSets(), libMesh::BoundaryVolumeSolutionTransfer::transfer_volume_boundary(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::MeshTools::weight(), libMesh::GMVIO::write_ascii_new_impl(), libMesh::GMVIO::write_ascii_old_impl(), libMesh::TecplotIO::write_binary(), libMesh::CheckpointIO::write_connectivity(), libMesh::CheckpointIO::write_nodes(), libMesh::CheckpointIO::write_remote_elem(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), 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().