SheafSystem  0.0.0.0
fiber_bundle::binary_index_space Class Reference

A bounded domain for binary_index objects. More...

#include <binary_index_space.h>

Public Member Functions

bool invariant () const
 Class invariant. More...
 
 binary_index_space ()
 Creates an instance with bound (0,0). More...
 
 binary_index_space (unary_index xi_size, unary_index xj_size)
 Creates an instance with bounds (xi_size, xj_size). More...
 
void put_bounds (unary_index xi_size=0, unary_index xj_size=0)
 Sets i_size = xi_size and j_size = xj_size and recomputes size. More...
 
 binary_index_space (unary_index xl)
 Conversion from unary_index; interpreted as square. More...
 
binary_index_space operator+ (const binary_index_space &xother) const
 Sum. More...
 
binary_index_space operator* (const binary_index_space &xother) const
 Cartesian product. More...
 
bool contains (const binary_index &xindex) const
 True if xindex is in this space. More...
 
bool contains (const unary_index &xindex) const
 True if xindex is in this space. More...
 
unary_index to_row_major_offset (const binary_index &xindex) const
 Converts xindex to a unary_index using row-major ordering. More...
 
unary_index to_row_major_offset (const unary_index xi, const unary_index xj) const
 Converts (xi, xj) to a unary_index using row-major ordering. More...
 
binary_index from_row_major_offset (const unary_index &xindex) const
 Converts xindex to a binary_index using row-major ordering. More...
 
ragged_array< unary_index > * neighbor_list () const
 Create a ragged array containing the row major offsets of the neighbors of each index in the index space. More...
 

Public Attributes

unary_index i_size
 Upper bound for the first index. More...
 
unary_index j_size
 Upper bound for the second index. More...
 
unary_index size
 Number in the space. More...
 

Detailed Description

A bounded domain for binary_index objects.

Definition at line 41 of file binary_index_space.h.

Constructor & Destructor Documentation

◆ binary_index_space() [1/3]

fiber_bundle::binary_index_space::binary_index_space ( )
inline

Creates an instance with bound (0,0).

Postcondition
  • i_size == 0
  • j_size == 0

Definition at line 74 of file binary_index_space.h.

◆ binary_index_space() [2/3]

fiber_bundle::binary_index_space::binary_index_space ( unary_index  xi_size,
unary_index  xj_size 
)
inline

Creates an instance with bounds (xi_size, xj_size).

Precondition
  • xi_size >= 0
  • xj_size >= 0
Postcondition
  • i_size == xi_size
  • j_size == xj_size

Definition at line 96 of file binary_index_space.h.

◆ binary_index_space() [3/3]

fiber_bundle::binary_index_space::binary_index_space ( unary_index  xl)
inline

Conversion from unary_index; interpreted as square.

Postcondition
  • i_size == xl
  • j_size == xl

Definition at line 145 of file binary_index_space.h.

Member Function Documentation

◆ contains() [1/2]

bool fiber_bundle::binary_index_space::contains ( const binary_index xindex) const
inline

True if xindex is in this space.

Postcondition
  • result == ((0 <= xindex.i) && (xindex.i < i_size) && (0 <= xindex.j) && (xindex.j < j_size))

Definition at line 211 of file binary_index_space.h.

References fiber_bundle::binary_index::i, and fiber_bundle::binary_index::j.

◆ contains() [2/2]

bool fiber_bundle::binary_index_space::contains ( const unary_index &  xindex) const
inline

True if xindex is in this space.

Postcondition
  • result == ((0 <= xindex) && (xindex < size))

Definition at line 235 of file binary_index_space.h.

◆ from_row_major_offset()

binary_index fiber_bundle::binary_index_space::from_row_major_offset ( const unary_index &  xindex) const
inline

Converts xindex to a binary_index using row-major ordering.

Postcondition
  • to_row_major_offset(result) == xindex

Definition at line 295 of file binary_index_space.h.

◆ invariant()

bool fiber_bundle::binary_index_space::invariant ( ) const
inline

Class invariant.

Invariant
  • i_size >= 0
  • j_size >= 0
  • size == i_size*j_size

Definition at line 62 of file binary_index_space.h.

◆ neighbor_list()

sheaf::ragged_array< unary_index > * fiber_bundle::binary_index_space::neighbor_list ( ) const

Create a ragged array containing the row major offsets of the neighbors of each index in the index space.

Postcondition
  • result != 0
  • result->row_ct() == size

Definition at line 33 of file binary_index_space.cc.

References fiber_bundle::binary_index::i, fiber_bundle::binary_index::j, sheaf::ragged_array< T >::new_back_row(), fiber_bundle::operator<<(), sheaf::ragged_array< T >::push_back(), and sheaf::ragged_array< T >::row_ct().

◆ operator*()

binary_index_space fiber_bundle::binary_index_space::operator* ( const binary_index_space xother) const
inline

Cartesian product.

Postcondition
  • result.i_size == i_size*xother.i_size
  • result.j_size == j_size*xother.j_size

Definition at line 189 of file binary_index_space.h.

References i_size, and j_size.

◆ operator+()

binary_index_space fiber_bundle::binary_index_space::operator+ ( const binary_index_space xother) const
inline

Sum.

Postcondition
  • result.i_size == i_size+xother.i_size
  • result.j_size == j_size+xother.j_size

Definition at line 167 of file binary_index_space.h.

References i_size, and j_size.

◆ put_bounds()

void fiber_bundle::binary_index_space::put_bounds ( unary_index  xi_size = 0,
unary_index  xj_size = 0 
)
inline

Sets i_size = xi_size and j_size = xj_size and recomputes size.

Postcondition
  • i_size == xi_size
  • j_size == xj_size

Definition at line 121 of file binary_index_space.h.

◆ to_row_major_offset() [1/2]

unary_index fiber_bundle::binary_index_space::to_row_major_offset ( const binary_index xindex) const
inline

Converts xindex to a unary_index using row-major ordering.

Postcondition
  • result == (j_size*xindex.i+ xindex.j)

Definition at line 255 of file binary_index_space.h.

References fiber_bundle::binary_index::i, and fiber_bundle::binary_index::j.

Referenced by fiber_bundle::point_block_crg_interval::get_private_data().

◆ to_row_major_offset() [2/2]

unary_index fiber_bundle::binary_index_space::to_row_major_offset ( const unary_index  xi,
const unary_index  xj 
) const
inline

Converts (xi, xj) to a unary_index using row-major ordering.

Postcondition
  • result == (xi*j_size + xj)

Definition at line 275 of file binary_index_space.h.

Member Data Documentation

◆ i_size

unary_index fiber_bundle::binary_index_space::i_size

Upper bound for the first index.

Definition at line 47 of file binary_index_space.h.

Referenced by operator*(), operator+(), and fiber_bundle::operator<<().

◆ j_size

unary_index fiber_bundle::binary_index_space::j_size

Upper bound for the second index.

Definition at line 52 of file binary_index_space.h.

Referenced by operator*(), operator+(), and fiber_bundle::operator<<().

◆ size

unary_index fiber_bundle::binary_index_space::size

Number in the space.

Definition at line 57 of file binary_index_space.h.

Referenced by fiber_bundle::operator<<().


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