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 450 of file variant_filter_iterator.h.

References data.

451  {
452  return data->equal(other.data);
453  }
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 515 of file variant_filter_iterator.h.

517 {
518  return !(x == y);
519 }
ReferenceType operator* ( ) const

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

Definition at line 409 of file variant_filter_iterator.h.

References data.

410  {
411  return **data;
412  }
Iterator& operator++ ( )

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

Definition at line 426 of file variant_filter_iterator.h.

References data, and satisfy_predicate().

427  {
428  ++*data;
429  this->satisfy_predicate();
430  return (*this);
431  }
const Iterator operator++ ( int  )

postfix op++(), creates a temporary!

Definition at line 436 of file variant_filter_iterator.h.

References data, and satisfy_predicate().

437  {
438  Iterator oldValue(*this); // standard is to return old value
439  ++*data;
440  this->satisfy_predicate();
441  return oldValue;
442  }
PointerType operator-> ( ) const

op->()

Definition at line 418 of file variant_filter_iterator.h.

419  {
420  return (&**this);
421  }
Iterator& operator= ( const Iterator &  rhs)

Assignment operator.

Definition at line 473 of file variant_filter_iterator.h.

References swap().

474  {
475  Iterator temp(rhs);
476  swap(temp, *this);
477  return *this;
478  }
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 504 of file variant_filter_iterator.h.

506 {
507  return x.equal(y);
508 }
void satisfy_predicate ( )
private

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

Definition at line 488 of file variant_filter_iterator.h.

References data, and end.

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

489  {
490  while ( !data->equal(end) && !(*pred)(data) )
491  ++(*data);
492  }
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.

Definition at line 342 of file variant_filter_iterator.h.

References satisfy_predicate().

344  :
345  data ( new Iter<IterType>(d) ), // note: uses default IterBase copy constructor
346  end ( new Iter<IterType>(e) ),
347  pred ( new Pred<IterType,PredType>(p) )
348  {
349  this->satisfy_predicate();
350  }
variant_filter_iterator ( )

Default Constructor.

Definition at line 355 of file variant_filter_iterator.h.

355  :
356  data(NULL),
357  end(NULL),
358  pred(NULL) {}
variant_filter_iterator ( const Iterator &  rhs)

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

Definition at line 364 of file variant_filter_iterator.h.

364  :
365  data (rhs.data != NULL ? rhs.data->clone() : NULL),
366  end (rhs.end != NULL ? rhs.end->clone() : NULL),
367  pred (rhs.pred != NULL ? rhs.pred->clone() : NULL) {}
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 383 of file variant_filter_iterator.h.

384  : data (rhs.data != NULL ? rhs.data->const_clone() : NULL),
385  end (rhs.end != NULL ? rhs.end->const_clone() : NULL),
386  pred (rhs.pred != NULL ? rhs.pred->const_clone() : NULL)
387  {
388  // libMesh::out << "Called templated copy constructor for variant_filter_iterator" << std::endl;
389  }
virtual ~variant_filter_iterator ( )
virtual

Destructor

Definition at line 399 of file variant_filter_iterator.h.

References data, end, and pred.

400  {
401  delete data; data = NULL;
402  delete end; end = NULL;
403  delete pred; pred = NULL;
404  }

Variable Documentation

IterBase* end

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

Definition at line 324 of file variant_filter_iterator.h.

Referenced by libMesh::MeshRefinement::_coarsen_elements(), GETPOT_NAMESPACE::GetPot::_DBE_expand(), libMesh::MetisPartitioner::_do_partition(), libMesh::MeshRefinement::_refine_elements(), libMesh::MeshTools::Modification::all_tri(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::MeshCommunication::assign_global_indices(), libMesh::ParallelMesh::assign_unique_ids(), 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::MeshTools::build_nodes_to_elem_map(), libMesh::EquationSystems::build_solution_vector(), libMesh::EquationSystems::build_variable_names(), libMesh::VTKIO::cells_to_vtk(), libMesh::TetGenMeshInterface::check_hull_integrity(), libMesh::SerialMesh::clear(), libMesh::ParallelMesh::clear(), libMesh::EquationSystems::compare(), libMesh::DofMap::compute_sparsity(), libMesh::UnstructuredMesh::contract(), libMesh::GMVIO::copy_nodal_solution(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::vectormap< dof_id_type, dof_id_type >::count(), libMesh::TetGenMeshInterface::delete_2D_hull_elements(), libMesh::MeshTools::Modification::distort(), DMCreateDomainDecomposition_libMesh(), DMCreateFieldDecomposition_libMesh(), DMLibMeshSetSystem(), DMLibMeshSetUpName_Private(), DMView_libMesh(), libMesh::MeshTools::elem_types(), libMesh::UNVIO::element_out(), libMesh::mapvector< libMesh::Elem *, dof_id_type >::end(), libMesh::LocationMap< T >::fill(), libMesh::TetGenMeshInterface::fill_pointlist(), libMesh::MeshTools::find_boundary_nodes(), libMesh::Elem::find_edge_neighbors(), libMesh::Patch::find_face_neighbors(), libMesh::MeshCommunication::find_global_indices(), libMesh::MeshTools::find_hanging_nodes_and_parents(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::Patch::find_point_neighbors(), libMesh::Elem::find_point_neighbors(), libMesh::ParallelMesh::fix_broken_node_and_element_numbering(), libMesh::MeshTools::Modification::flatten(), libMesh::EquationSystems::get_info(), libMesh::DofMap::get_info(), libMesh::EquationSystems::get_solution(), libMesh::EquationSystems::get_system(), GETPOT_NAMESPACE::GetPot::GetPot(), libMesh::MeshFunction::gradient(), libMesh::MeshFunction::hessian(), libMesh::StatisticsVector< T >::histogram(), libMesh::LocationMap< T >::init(), libMesh::LaplaceMeshSmoother::init(), libMesh::PointLocatorList::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize_discontinuous(), 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::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::node_out(), libMesh::MeshFunction::operator()(), libMesh::BoundaryInfo::operator=(), GETPOT_NAMESPACE::GetPot::operator=(), libMesh::vectormap< dof_id_type, dof_id_type >::operator[](), libMesh::AbaqusIO::parse_label(), libMesh::ParsedFunction< Output >::ParsedFunction(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::TetGenMeshInterface::pointset_convexhull(), libMesh::LaplaceMeshSmoother::print_graph(), libMesh::BoundaryInfo::print_info(), libMesh::BoundaryInfo::print_summary(), libMesh::System::read_legacy_data(), libMesh::GmshIO::read_mesh(), libMesh::XdrIO::read_serialized_bcs(), 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::DofMap::remove_adjoint_dirichlet_boundary(), libMesh::DofMap::remove_dirichlet_boundary(), libMesh::ParallelMesh::renumber_dof_objects(), libMesh::SerialMesh::renumber_nodes_and_elements(), libMesh::ParallelMesh::renumber_nodes_and_elements(), satisfy_predicate(), libMesh::DofMap::scatter_constraints(), libMesh::DofObject::set_n_vars_per_group(), libMesh::Partitioner::set_parent_processor_ids(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::MeshTools::Modification::smooth(), libMesh::vectormap< dof_id_type, dof_id_type >::sort(), libMesh::SerialMesh::stitching_helper(), libMesh::MeshBase::subdomain_ids(), libMesh::Tree< N >::Tree(), libMesh::TriangleInterface::triangulate(), libMesh::TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), 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::ExodusII_IO_Helper::write_elements_discontinuous(), libMesh::UCDIO::write_interior_elems(), libMesh::GmshIO::write_mesh(), libMesh::LegacyXdrIO::write_mesh(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates_discontinuous(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::UCDIO::write_nodes(), libMesh::CheckpointIO::write_nodes(), libMesh::GmshIO::write_post(), libMesh::XdrIO::write_serialized_bcs(), 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, 2004. This is the iterator passed by the user.

Definition at line 49 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 331 of file variant_filter_iterator.h.

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


Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:08 UTC

Hosted By:
SourceForge.net Logo