$extrastylesheet
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

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.

Referenced by libMesh::UnstructuredMesh::copy_nodes_and_elements().

  {
    return data->equal(other.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 
) [inline, private]

Definition at line 515 of file variant_filter_iterator.h.

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

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

Definition at line 409 of file variant_filter_iterator.h.

References data.

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

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

Definition at line 426 of file variant_filter_iterator.h.

References data, and satisfy_predicate().

  {
    ++*data;
    this->satisfy_predicate();
    return (*this);
  }
const Iterator operator++ ( int  )

postfix op++(), creates a temporary!

Definition at line 436 of file variant_filter_iterator.h.

References data, and satisfy_predicate().

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

op->()

Definition at line 418 of file variant_filter_iterator.h.

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

Assignment operator.

Definition at line 473 of file variant_filter_iterator.h.

References swap().

  {
    Iterator temp(rhs);
    swap(temp, *this);
    return *this;
  }
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 
) [inline, private]

Definition at line 504 of file variant_filter_iterator.h.

{
  return x.equal(y);
}
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().

  {
    while ( !data->equal(end) && !(*pred)(data) )
      ++(*data);
  }
void swap ( Iterator &  lhs,
Iterator &  rhs 
)

swap, used to implement op=

Definition at line 458 of file variant_filter_iterator.h.

Referenced by libMesh::DenseMatrix< T >::_lu_decompose(), operator=(), and libMesh::PetscMatrix< T >::swap().

  {
    // Swap the data pointers
    std::swap (lhs.data, rhs.data);

    // Swap the end pointers
    std::swap (lhs.end, rhs.end);

    // Also swap the predicate objects.
    std::swap (lhs.pred, rhs.pred);
  }
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().

                                              :
    data ( new Iter<IterType>(d) ), // note: uses default IterBase copy constructor
    end  ( new Iter<IterType>(e) ),
    pred ( new Pred<IterType,PredType>(p) )
  {
    this->satisfy_predicate();
  }

Default Constructor.

Definition at line 355 of file variant_filter_iterator.h.

                             :
    data(NULL),
    end(NULL),
    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.

                                                :
    data (rhs.data != NULL ? rhs.data->clone() : NULL),
    end  (rhs.end  != NULL ? rhs.end->clone()  : NULL),
    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.

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

Destructor

Definition at line 399 of file variant_filter_iterator.h.

References data, end, and pred.

  {
    delete data; data = NULL;
    delete end;  end  = NULL;
    delete pred; pred = NULL;
  }

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::AbaqusIO::assign_sideset_ids(), 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::MeshBase::cache_elem_dims(), 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::ElemCutter::cut_2D(), libMesh::ElemCutter::cut_3D(), libMesh::TetGenMeshInterface::delete_2D_hull_elements(), libMesh::MeshTools::Modification::distort(), DMCreateDomainDecomposition_libMesh(), DMCreateFieldDecomposition_libMesh(), DMlibMeshSetSystem_libMesh(), DMlibMeshSetUpName_Private(), libMesh::TecplotIO::elem_dimension(), libMesh::MeshTools::elem_types(), libMesh::UNVIO::elements_out(), libMesh::mapvector< Elem *, dof_id_type >::end(), libMesh::LocationMap< T >::fill(), libMesh::TetGenMeshInterface::fill_pointlist(), libMesh::MeshTools::find_boundary_nodes(), libMesh::Elem::find_edge_neighbors(), libMesh::MeshFunction::find_element(), 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::MeshBase::get_info(), libMesh::DofMap::get_info(), libMesh::EquationSystems::get_solution(), libMesh::EquationSystems::get_system(), GETPOT_NAMESPACE::GetPot::GetPot(), libMesh::UNVIO::groups_in(), libMesh::StatisticsVector< T >::histogram(), libMesh::LocationMap< T >::init(), libMesh::LaplaceMeshSmoother::init(), libMesh::PointLocatorList::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::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::BoundaryInfo::operator=(), GETPOT_NAMESPACE::GetPot::operator=(), libMesh::vectormap< dof_id_type, dof_id_type >::operator[](), libMesh::AbaqusIO::parse_label(), libMesh::ParsedFEMFunction< Output >::ParsedFEMFunction(), libMesh::ParsedFunction< Output, OutputGradient >::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::MeshTools::Modification::redistribute(), 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::SparsityPattern::sort_row(), 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::UCDIO::write_interior_elems(), libMesh::GmshIO::write_mesh(), libMesh::LegacyXdrIO::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(), 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().

IterType iter_data

Original Authors: Corwin Joy * Michael Gradman cjoy@houston.rr.com * Michael.Gradman@caminus.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().