SheafSystem  0.0.0.0
sheaf::record_map< internal_index_type, external_index_type > Class Template Reference

Insert record_map& p into ostream& os. More...

#include <record_map.h>

RECORD_MAP FACET

typedef unordered::unordered_map< internal_index_type, external_index_type >::const_iterator const_iterator
 The type of const iterator for this. More...
 
 record_map ()
 Default constructor. More...
 
 record_map (const record_map &xother)
 Copy constructor. More...
 
record_mapoperator= (const record_map &xother)
 Assignment operator. More...
 
virtual ~record_map ()
 Destructor. More...
 
virtual bool invariant () const
 The class invariant. More...
 
external_index_type external_id (internal_index_type xinternal_id) const
 The external id corresponding to xinternal_id. More...
 
internal_index_type internal_id (external_index_type xexternal_id) const
 The internal id corresponding to xexternal_id. More...
 
void put_ids (internal_index_type xinternal_id, external_index_type xexternal_id)
 Defines the mapping between xinternal_id and xexternal_id. More...
 
bool internal_ids_sequential () const
 True if sequentially assigning internal ids. More...
 
bool external_ids_sequential () const
 True if sequentially assigning external ids. More...
 
external_index_type put_internal_id (internal_index_type xinternal_id)
 Defines a mapping between xinternal_id and a sequentially assigned external id. Returns the external id. More...
 
internal_index_type put_external_id (external_index_type xexternal_id)
 Defines a mapping between xexternal_id and a sequentially assigned internal id. More...
 
bool contains_internal_id (internal_index_type xint_id) const
 True if this map contains an entry for internal index xint_id. More...
 
bool contains_external_id (external_index_type xext_id) const
 True if this map contains an entry for external index xext_id. More...
 
bool operator== (const record_map &xother) const
 True if same external_id and internal_id. More...
 
size_type ct () const
 The number of entries in the map. More...
 
bool is_empty () const
 True if there are no entries in the map. More...
 
void clear ()
 Removes all entries. More...
 
void remove_internal_id (internal_index_type xinternal_id)
 Removes xinternal_id and its external image from the map. More...
 
void remove_external_id (external_index_type xexternal_id)
 Removes xexternal_id and its internal image from the map. More...
 
internal_index_type scratch_internal_id () const
 The value of the internal id scratch register. The scratch register is a convenient place for a client to store an internal id that has the same scope and lifetime as this index map. More...
 
void put_scratch_internal_id (internal_index_type xid)
 Sets the value of the internal id scratch register to xid. More...
 
external_index_type scratch_external_id () const
 The value of the external id scratch register. The scratch register is a convenient place for a client to store an external id that has the same scope and lifetime as this index map. More...
 
void put_scratch_external_id (external_index_type xid)
 Sets the value of the external id scratch register to xid. More...
 
internal_index_type internal_id_ub () const
 The maximum internal id in this map. More...
 
external_index_type external_id_ub () const
 The maximum external id in this map. More...
 
bool ub_is_max () const
 True if internal_id_ub and external_id_ub are in fact maxima; i.e. if there exists an entry (int_id, ext_id) in the map such that int_id == internal_id_ub() and ext_id == external_id_ub();. More...
 
const_iterator begin () const
 The beginning of the range of internal ids contained in this. More...
 
const_iterator end () const
 The end of the range of internal ids contained in this. More...
 
void print () const
 Prints the data members of this on cout. Intended for use debugging. More...
 
void print (std::ostream &xos, const record_map< internal_index_type, external_index_type > &xp) const
 Prints the data members of this on stream xos. Intended for use debugging. More...
 

Detailed Description

template<typename internal_index_type, typename external_index_type>
class sheaf::record_map< internal_index_type, external_index_type >

Insert record_map& p into ostream& os.

A bidirectional map between an internal index space and an external index space. The map is injective (one-to-one), but neither total (not every internal index has an external index associated with it) nor surjective (not every external index has an internal index associated with it.

Definition at line 46 of file record_map.h.

Member Typedef Documentation

◆ const_iterator

template<typename internal_index_type, typename external_index_type>
typedef unordered::unordered_map<internal_index_type, external_index_type>::const_iterator sheaf::record_map< internal_index_type, external_index_type >::const_iterator

The type of const iterator for this.

Definition at line 224 of file record_map.h.

Constructor & Destructor Documentation

◆ record_map() [1/2]

template<typename internal_index_type , typename external_index_type >
sheaf::record_map< internal_index_type, external_index_type >::record_map ( )

Default constructor.

Postcondition
  • !internal_ids_sequential()
  • !external_ids_sequential()
  • !index_traits< internal_index_type >::is_valid(scratch_internal_id())
  • !index_traits< external_index_type >::is_valid(scratch_external_id())
  • !ub_is_max()

Definition at line 55 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::record_map().

◆ record_map() [2/2]

template<typename internal_index_type , typename external_index_type >
sheaf::record_map< internal_index_type, external_index_type >::record_map ( const record_map< internal_index_type, external_index_type > &  xother)

Copy constructor.

Postcondition
  • -unexecutable( (*this) == xother )

Definition at line 90 of file record_map.impl.h.

◆ ~record_map()

template<typename internal_index_type , typename external_index_type >
sheaf::record_map< internal_index_type, external_index_type >::~record_map ( )
virtual

Destructor.

Definition at line 147 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::operator=().

Member Function Documentation

◆ begin()

template<typename internal_index_type , typename external_index_type >
record_map< internal_index_type, external_index_type >::const_iterator sheaf::record_map< internal_index_type, external_index_type >::begin ( ) const

The beginning of the range of internal ids contained in this.

Definition at line 716 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::ub_is_max().

◆ clear()

template<typename internal_index_type , typename external_index_type >
void sheaf::record_map< internal_index_type, external_index_type >::clear ( )

Removes all entries.

Postcondition
  • !internal_ids_sequential()
  • !external_ids_sequential()
  • !index_traits< internal_index_type >::is_valid(scratch_internal_id())
  • !index_traits< external_index_type >::is_valid(scratch_external_id())
  • !ub_is_max()

Definition at line 470 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::is_empty().

◆ contains_external_id()

template<typename internal_index_type , typename external_index_type>
bool sheaf::record_map< internal_index_type, external_index_type >::contains_external_id ( external_index_type  xext_id) const

True if this map contains an entry for external index xext_id.

Postcondition

Definition at line 389 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::contains_internal_id().

◆ contains_internal_id()

template<typename internal_index_type, typename external_index_type >
bool sheaf::record_map< internal_index_type, external_index_type >::contains_internal_id ( internal_index_type  xint_id) const

True if this map contains an entry for internal index xint_id.

Postcondition

Definition at line 364 of file record_map.impl.h.

Referenced by sheaf::dof_tuple_record_set::get_internal_record(), and sheaf::record_map< pod_index_type, pod_index_type >::put_external_id().

◆ ct()

template<typename internal_index_type , typename external_index_type >
size_type sheaf::record_map< internal_index_type, external_index_type >::ct ( ) const

The number of entries in the map.

Definition at line 454 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::operator==().

◆ end()

template<typename internal_index_type , typename external_index_type >
record_map< internal_index_type, external_index_type >::const_iterator sheaf::record_map< internal_index_type, external_index_type >::end ( ) const

The end of the range of internal ids contained in this.

Definition at line 724 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::begin().

◆ external_id()

template<typename internal_index_type, typename external_index_type >
external_index_type sheaf::record_map< internal_index_type, external_index_type >::external_id ( internal_index_type  xinternal_id) const

◆ external_id_ub()

template<typename internal_index_type , typename external_index_type >
external_index_type sheaf::record_map< internal_index_type, external_index_type >::external_id_ub ( ) const

The maximum external id in this map.

Postcondition
  • -unexecutable( "for all external ids i: i <= result" )
  • -unexecutable( "if remove_external_id has not been called result = maximum external id" )

Definition at line 669 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::internal_id_ub().

◆ external_ids_sequential()

template<typename internal_index_type , typename external_index_type >
bool sheaf::record_map< internal_index_type, external_index_type >::external_ids_sequential ( ) const

True if sequentially assigning external ids.

Definition at line 291 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::internal_ids_sequential().

◆ internal_id()

template<typename internal_index_type , typename external_index_type>
internal_index_type sheaf::record_map< internal_index_type, external_index_type >::internal_id ( external_index_type  xexternal_id) const

The internal id corresponding to xexternal_id.

Postcondition

Definition at line 211 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::external_id(), and sheaf::dof_tuple_record_set::get_internal_record().

◆ internal_id_ub()

template<typename internal_index_type , typename external_index_type >
internal_index_type sheaf::record_map< internal_index_type, external_index_type >::internal_id_ub ( ) const

The maximum internal id in this map.

Postcondition
  • -unexecutable( "for all internal ids i: i <= result" )
  • -unexecutable( "if remove_internal_id has not been called result = maximum internal id" )

Definition at line 648 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::put_scratch_external_id().

◆ internal_ids_sequential()

template<typename internal_index_type , typename external_index_type >
bool sheaf::record_map< internal_index_type, external_index_type >::internal_ids_sequential ( ) const

True if sequentially assigning internal ids.

Definition at line 283 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::put_ids().

◆ invariant()

template<typename internal_index_type , typename external_index_type >
bool sheaf::record_map< internal_index_type, external_index_type >::invariant ( ) const
virtual

The class invariant.

Invariant
  • _to_internal.size() == _to_external.size()
  • _internal_ids_sequential ? !_external_ids_sequential : true
  • _external_ids_sequential ? !_internal_ids_sequential : true
  • -unexecutable( "for all internal ids i: i <= internal_id_ub()" )
  • -unexecutable( "ub_is_max() ? there exists entry (int_id, ext_id) such that int_id= internal_id_ub()" )
  • -unexecutable( "for all external ids i: i <= external_id_ub()" )
  • -unexecutable( "ub_is_max() ? there exists entry (int_id, ext_id) such that ext_id= external_id_ub()" )

Definition at line 161 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::~record_map().

◆ is_empty()

template<typename internal_index_type , typename external_index_type >
bool sheaf::record_map< internal_index_type, external_index_type >::is_empty ( ) const

True if there are no entries in the map.

Definition at line 462 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::ct().

◆ operator=()

template<typename internal_index_type , typename external_index_type >
record_map< internal_index_type, external_index_type > & sheaf::record_map< internal_index_type, external_index_type >::operator= ( const record_map< internal_index_type, external_index_type > &  xother)

Assignment operator.

Postcondition
  • (*this) == xother

Definition at line 111 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::record_map().

◆ operator==()

template<typename internal_index_type , typename external_index_type >
bool sheaf::record_map< internal_index_type, external_index_type >::operator== ( const record_map< internal_index_type, external_index_type > &  xother) const

True if same external_id and internal_id.

Hack:
On AIX, xlC uses unordered_map rather than unordered_map. unordered_map contains no operator==. Rather than define operator== for unordered_map, we comment out the following two lines which test unordered_maps for equality. These are only used in the post condition of record_map's copy contructor, which has now been rendered "unexecutable."
Postcondition

Definition at line 414 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::contains_external_id().

◆ print() [1/2]

template<typename internal_index_type , typename external_index_type >
void sheaf::record_map< internal_index_type, external_index_type >::print ( ) const
inline

Prints the data members of this on cout. Intended for use debugging.

Definition at line 732 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::end(), and sheaf::record_map< pod_index_type, pod_index_type >::print().

◆ print() [2/2]

template<typename internal_index_type, typename external_index_type>
void sheaf::record_map< internal_index_type, external_index_type >::print ( std::ostream &  xos,
const record_map< internal_index_type, external_index_type > &  xp 
) const

Prints the data members of this on stream xos. Intended for use debugging.

Definition at line 748 of file record_map.impl.h.

◆ put_external_id()

template<typename internal_index_type , typename external_index_type>
internal_index_type sheaf::record_map< internal_index_type, external_index_type >::put_external_id ( external_index_type  xexternal_id)

Defines a mapping between xexternal_id and a sequentially assigned internal id.

Precondition
  • !contains_external_id(xexternal_id)
Postcondition
  • index_traits<internal_index_type>::pod(result) == (ct() - 1)
  • internal_id(xexternal_id) == result

Definition at line 331 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::put_internal_id().

◆ put_ids()

template<typename internal_index_type, typename external_index_type>
void sheaf::record_map< internal_index_type, external_index_type >::put_ids ( internal_index_type  xinternal_id,
external_index_type  xexternal_id 
)

Defines the mapping between xinternal_id and xexternal_id.

Precondition
  • !is_empty() ? !internal_ids_sequential() && !external_ids_sequential() : true
  • !contains_internal_id(xinternal_id)
  • !contains_external_id(xexternal_id)
Postcondition
  • external_id(xinternal_id) == xexternal_id
  • internal_id(xexternal_id) == xinternal_id

Definition at line 233 of file record_map.impl.h.

Referenced by sheaf::dof_tuple_record_set::get_internal_record(), and sheaf::record_map< pod_index_type, pod_index_type >::internal_id().

◆ put_internal_id()

template<typename internal_index_type, typename external_index_type >
external_index_type sheaf::record_map< internal_index_type, external_index_type >::put_internal_id ( internal_index_type  xinternal_id)

Defines a mapping between xinternal_id and a sequentially assigned external id. Returns the external id.

Precondition
  • !contains_internal_id(xinternal_id)
Postcondition
  • index_traits<external_index_type>::pod(result) == (ct() - 1)
  • external_id(xinternal_id) == result

Definition at line 299 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::external_ids_sequential().

◆ put_scratch_external_id()

template<typename internal_index_type , typename external_index_type>
void sheaf::record_map< internal_index_type, external_index_type >::put_scratch_external_id ( external_index_type  xid)

Sets the value of the external id scratch register to xid.

Postcondition

Definition at line 628 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::scratch_external_id().

◆ put_scratch_internal_id()

template<typename internal_index_type, typename external_index_type >
void sheaf::record_map< internal_index_type, external_index_type >::put_scratch_internal_id ( internal_index_type  xid)

Sets the value of the internal id scratch register to xid.

Postcondition

Definition at line 592 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::scratch_internal_id().

◆ remove_external_id()

template<typename internal_index_type , typename external_index_type>
void sheaf::record_map< internal_index_type, external_index_type >::remove_external_id ( external_index_type  xexternal_id)

Removes xexternal_id and its internal image from the map.

Postcondition
  • !contains_external_id(xexternal_id)
  • !ub_is_max()

Definition at line 546 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::remove_internal_id().

◆ remove_internal_id()

template<typename internal_index_type, typename external_index_type >
void sheaf::record_map< internal_index_type, external_index_type >::remove_internal_id ( internal_index_type  xinternal_id)

Removes xinternal_id and its external image from the map.

Issue:
the following condition, and the postcondition !ub_is_max below, are stronger than really necessary, since xinternal_id may not have actually been removed. But it is not clear how to define the precise postcondition and this one properly informs the client that removing entries compromises ub_is_max.
Postcondition
  • !contains_internal_id(xinternal_id)
  • !ub_is_max()

Definition at line 510 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::clear(), and sheaf::dof_tuple_record_set::get_internal_record().

◆ scratch_external_id()

template<typename internal_index_type , typename external_index_type >
external_index_type sheaf::record_map< internal_index_type, external_index_type >::scratch_external_id ( ) const

The value of the external id scratch register. The scratch register is a convenient place for a client to store an external id that has the same scope and lifetime as this index map.

Definition at line 612 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::put_scratch_internal_id().

◆ scratch_internal_id()

template<typename internal_index_type , typename external_index_type >
internal_index_type sheaf::record_map< internal_index_type, external_index_type >::scratch_internal_id ( ) const

The value of the internal id scratch register. The scratch register is a convenient place for a client to store an internal id that has the same scope and lifetime as this index map.

Definition at line 575 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::remove_external_id().

◆ ub_is_max()

template<typename internal_index_type , typename external_index_type >
bool sheaf::record_map< internal_index_type, external_index_type >::ub_is_max ( ) const

True if internal_id_ub and external_id_ub are in fact maxima; i.e. if there exists an entry (int_id, ext_id) in the map such that int_id == internal_id_ub() and ext_id == external_id_ub();.

Postcondition
  • -unexecutable( "result == (upper bounds are in fact maxima)" )

Definition at line 690 of file record_map.impl.h.

Referenced by sheaf::record_map< pod_index_type, pod_index_type >::external_id_ub().


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