SheafSystem  0.0.0.0
sheaf::poset_dft Class Referenceabstract

Abstract traverser (internal iterator) for poset which traverses the cover relation graph in depth first order. More...

#include <poset_dft.h>

Inheritance diagram for sheaf::poset_dft:
sheaf::poset_traverser sheaf::any sheaf::poset_orderer sheaf::poset_slicer

Public Member Functions

 poset_dft (const poset_state_handle *xhost)
 Constructor. More...
 
 ~poset_dft ()
 Destructor. More...
 
- Public Member Functions inherited from sheaf::poset_traverser
 poset_traverser (const poset_state_handle *xanchor)
 Constructor. More...
 
 ~poset_traverser ()
 Destructor. More...
 
virtual bool invariant () const
 Class invariant. More...
 
poset_state_handlehost ()
 The poset being traversed (mutable version). More...
 
const poset_state_handlehost () const
 The poset being traversed (const version). More...
 
bool has_same_host (const poset_component *other) const
 True if other is not void and is attached to the same host as this. More...
 
virtual abstract_poset_memberanchor ()
 The member which is the starting point of this traversal (mutable verison). More...
 
virtual const abstract_poset_memberanchor () const
 The member which is the starting point of this traversal (const version). More...
 
bool in_down_set () const
 True if traversing down from anchor(). More...
 
void traverse (const abstract_poset_member *xanchor, bool down, bool reset_markers=true)
 Traverse the down set (down == true) or up set (down == false) of xanchor. If reset_markers, reset all visited markers to false before begining. More...
 
- Public Member Functions inherited from sheaf::any
virtual bool is_ancestor_of (const any *other) const
 True if other conforms to this. More...
 
bool is_same_type (const any *other) const
 True if other is the same type as this. More...
 
virtual anyclone () const
 Virtual constructor, makes a new instance of the same type as this. More...
 
virtual ~any ()
 Destructor. More...
 
bool invariant_check () const
 True if invariant checking is enabled. More...
 
void enable_invariant_check () const
 Enable invariant checking. More...
 
void disable_invariant_check () const
 Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing invariant checking during multi-phase initialization. More...
 
int disable_invariance_check_request_depth () const
 Number of times disable_invariant_check has been called without matching call to enable_invariant_check. More...
 

Protected Member Functions

void private_traverse ()
 Implements the traversal. More...
 
void recursive_dft (abstract_poset_member *xmbr)
 
virtual void previsit_action (abstract_poset_member *xmbr)=0
 
virtual void link_action (abstract_poset_member *xgreater, abstract_poset_member *xlesser)=0
 
virtual void postvisit_action (abstract_poset_member *xmbr)=0
 
- Protected Member Functions inherited from sheaf::poset_traverser
bool has_been_visited (const abstract_poset_member *xmbr) const
 True if xmbr has been previously visited. More...
 
bool has_been_visited (int xindex) const
 True if the member with index xindex has been previously visited. More...
 
scoped_index member_index_ub () const
 The upper bound on the member index. More...
 
bool no_members_visited () const
 True if no members have been visited. More...
 
bool all_members_visited () const
 True if all members have been visited. More...
 
void mark_members_not_visited ()
 Sets the visited markers false for all members. More...
 
void mark_visited (const abstract_poset_member *xmbr)
 Sets the visited marker true for xmbr. More...
 
void mark_visited (int xindex)
 Sets the visited markers true for the emebr with index xindex. More...
 
void mark_not_visited (int xindex)
 Sets the visited markers false for the emebr with index xindex. More...
 
void ensure_visited_ub ()
 Ensures the visited bit vector is large enough. More...
 
- Protected Member Functions inherited from sheaf::any
 any ()
 default constructor More...
 

Protected Attributes

bool _descend
 If true on return from previsit_action, descend into lower cover previsit_action can truncate dft by setting this false. More...
 
std::stack< abstract_poset_member * > _free_mbrs
 Storage for abstract_poset_member objects, so we can reuse them, rather than creating one for each member in the graph. More...
 
- Protected Attributes inherited from sheaf::poset_traverser
poset_state_handle_host
 The poset being traversed. More...
 
zn_to_bool_visited
 The markers for previously visited members. More...
 
abstract_poset_member_anchor
 The member which is the starting point of this traversal. More...
 
bool _in_down_set
 True if traversing down from anchor(). More...
 

Detailed Description

Abstract traverser (internal iterator) for poset which traverses the cover relation graph in depth first order.

Definition at line 44 of file poset_dft.h.

Constructor & Destructor Documentation

◆ poset_dft()

sheaf::poset_dft::poset_dft ( const poset_state_handle xhost)

Constructor.

Precondition
  • precondition_of(poset_traverser)
Postcondition

Definition at line 34 of file poset_dft.cc.

References _descend, sheaf::poset_traverser::invariant(), and ~poset_dft().

Referenced by sheaf::poset_orderer::poset_orderer().

◆ ~poset_dft()

sheaf::poset_dft::~poset_dft ( )

Destructor.

Definition at line 54 of file poset_dft.cc.

References _free_mbrs, and private_traverse().

Referenced by poset_dft().

Member Function Documentation

◆ private_traverse()

void sheaf::poset_dft::private_traverse ( )
protectedvirtual

Implements the traversal.

Precondition
  • _anchor != 0
Postcondition
  • -unexecutable( traversal truncated or all members <= anchor() visited )

Implements sheaf::poset_traverser.

Definition at line 70 of file poset_dft.cc.

References sheaf::poset_traverser::_anchor, sheaf::poset_traverser::anchor(), and recursive_dft().

Referenced by ~poset_dft().

◆ recursive_dft()

void sheaf::poset_dft::recursive_dft ( abstract_poset_member xmbr)
protected
Precondition
  • xmbr != 0
Issue:
Comments on possible optimization:

The current implementation explicitly represents all links, including the links from the minimal jims to the greatest_bootom_jem. In order to avoid the typically large storage requirements, the link between the minimal jims and the bottom could be implied, not actually represented. If xmbr is a jim and has an empty lower cover, there is an implied link to the greatest join equivalent member of the bottom, and vice versa.

Postcondition
  • -unexecutable( traversal truncated or all members <= xmbr visited )

Definition at line 93 of file poset_dft.cc.

References sheaf::poset_traverser::_anchor, _descend, _free_mbrs, sheaf::poset_traverser::_in_down_set, sheaf::abstract_poset_member::attach_to_state(), sheaf::abstract_poset_member::clone(), sheaf::poset_component::detach_from_state(), sheaf::poset_traverser::ensure_visited_ub(), sheaf::poset_state_handle::get_cover_id_space_iterator(), sheaf::poset_traverser::has_been_visited(), sheaf::poset_traverser::host(), sheaf::index_space_iterator::hub_pod(), sheaf::poset_component::index(), sheaf::index_space_iterator::is_done(), sheaf::poset_traverser::mark_visited(), sheaf::index_space_iterator::next(), sheaf::poset_component::put_version(), and sheaf::poset_state_handle::release_cover_id_space_iterator().

Referenced by private_traverse().

Member Data Documentation

◆ _descend

bool sheaf::poset_dft::_descend
protected

If true on return from previsit_action, descend into lower cover previsit_action can truncate dft by setting this false.

Definition at line 70 of file poset_dft.h.

Referenced by poset_dft(), sheaf::poset_orderer::previsit_action(), and recursive_dft().

◆ _free_mbrs

std::stack<abstract_poset_member*> sheaf::poset_dft::_free_mbrs
protected

Storage for abstract_poset_member objects, so we can reuse them, rather than creating one for each member in the graph.

Definition at line 76 of file poset_dft.h.

Referenced by recursive_dft(), and ~poset_dft().


The documentation for this class was generated from the following files: