SheafSystem  0.0.0.0
fiber_bundle::ternary_index_space Class Reference

A bounded domain for ternary_index objects. More...

#include <ternary_index_space.h>

Public Member Functions

bool invariant () const
 Class invariant. More...
 
 ternary_index_space ()
 Creates an instance with bound (0,0,0). More...
 
 ternary_index_space (unary_index xi_size, unary_index xj_size, unary_index xk_size)
 Creates an instance with bound (xi_size, xj_size, xk_size). More...
 
void put_bounds (unary_index xi_size, unary_index xj_size, unary_index xk_size)
 Sets i_size = xi_size, j_size = xj_size, k_size = xk_size and recomputes size. More...
 
 ternary_index_space (unary_index xl)
 Conversion from unary_index; interpreted as cube. More...
 
ternary_index_space operator+ (const ternary_index_space &xother) const
 Sum. More...
 
ternary_index_space operator* (const ternary_index_space &xother) const
 Cartesian product. More...
 
bool contains (const ternary_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 ternary_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 unary_index xk) const
 Converts (xi, xj, xk) to a unary_index using row-major ordering. More...
 
ternary_index from_row_major_offset (const unary_index &xindex) const
 Converts xindex to a ternary_index using row-major ordering. More...
 
unary_index to_col_major_offset (const ternary_index &xindex) const
 Converts xindex to a unary_index using col-major ordering. More...
 
unary_index to_col_major_offset (const unary_index xi, const unary_index xj, const unary_index xk) const
 Converts xindex to a unary_index using col-major ordering. More...
 
ternary_index from_col_major_offset (const unary_index &xindex) const
 Converts xindex to a ternary_index using col-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 k_size
 Upper bound for the third index. More...
 
unary_index size
 Number in the space. More...
 

Detailed Description

A bounded domain for ternary_index objects.

Definition at line 41 of file ternary_index_space.h.

Constructor & Destructor Documentation

◆ ternary_index_space() [1/3]

fiber_bundle::ternary_index_space::ternary_index_space ( )
inline

Creates an instance with bound (0,0,0).

Postcondition
  • i_size == 0
  • j_size == 0
  • k_size == 0

Definition at line 80 of file ternary_index_space.h.

◆ ternary_index_space() [2/3]

fiber_bundle::ternary_index_space::ternary_index_space ( unary_index  xi_size,
unary_index  xj_size,
unary_index  xk_size 
)
inline

Creates an instance with bound (xi_size, xj_size, xk_size).

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

Definition at line 103 of file ternary_index_space.h.

◆ ternary_index_space() [3/3]

fiber_bundle::ternary_index_space::ternary_index_space ( unary_index  xl)
inline

Conversion from unary_index; interpreted as cube.

Postcondition
  • i_size == xl
  • j_size == xl
  • k_size == xl

Definition at line 156 of file ternary_index_space.h.

Member Function Documentation

◆ contains() [1/2]

bool fiber_bundle::ternary_index_space::contains ( const ternary_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) && (0 <= xindex.k) && (xindex.k < k_size))

Definition at line 229 of file ternary_index_space.h.

References fiber_bundle::ternary_index::i, fiber_bundle::ternary_index::j, and fiber_bundle::ternary_index::k.

◆ contains() [2/2]

bool fiber_bundle::ternary_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 255 of file ternary_index_space.h.

◆ from_col_major_offset()

ternary_index fiber_bundle::ternary_index_space::from_col_major_offset ( const unary_index &  xindex) const
inline

Converts xindex to a ternary_index using col-major ordering.

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

Definition at line 381 of file ternary_index_space.h.

◆ from_row_major_offset()

ternary_index fiber_bundle::ternary_index_space::from_row_major_offset ( const unary_index &  xindex) const
inline

Converts xindex to a ternary_index using row-major ordering.

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

Definition at line 315 of file ternary_index_space.h.

◆ invariant()

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

Class invariant.

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

Definition at line 67 of file ternary_index_space.h.

◆ neighbor_list()

sheaf::ragged_array< unary_index > * fiber_bundle::ternary_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 32 of file ternary_index_space.cc.

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

◆ operator*()

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

Cartesian product.

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

Definition at line 204 of file ternary_index_space.h.

References i_size, j_size, and k_size.

◆ operator+()

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

Sum.

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

Definition at line 179 of file ternary_index_space.h.

References i_size, j_size, and k_size.

◆ put_bounds()

void fiber_bundle::ternary_index_space::put_bounds ( unary_index  xi_size,
unary_index  xj_size,
unary_index  xk_size 
)
inline

Sets i_size = xi_size, j_size = xj_size, k_size = xk_size and recomputes size.

Postcondition
  • i_size == xi_size
  • j_size == xj_size
  • k_size == xk_size

Definition at line 130 of file ternary_index_space.h.

◆ to_col_major_offset() [1/2]

unary_index fiber_bundle::ternary_index_space::to_col_major_offset ( const ternary_index xindex) const
inline

Converts xindex to a unary_index using col-major ordering.

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

Definition at line 341 of file ternary_index_space.h.

References fiber_bundle::ternary_index::i, fiber_bundle::ternary_index::j, and fiber_bundle::ternary_index::k.

◆ to_col_major_offset() [2/2]

unary_index fiber_bundle::ternary_index_space::to_col_major_offset ( const unary_index  xi,
const unary_index  xj,
const unary_index  xk 
) const
inline

Converts xindex to a unary_index using col-major ordering.

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

Definition at line 361 of file ternary_index_space.h.

◆ to_row_major_offset() [1/2]

unary_index fiber_bundle::ternary_index_space::to_row_major_offset ( const ternary_index xindex) const
inline

Converts xindex to a unary_index using row-major ordering.

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

Definition at line 275 of file ternary_index_space.h.

References fiber_bundle::ternary_index::i, fiber_bundle::ternary_index::j, and fiber_bundle::ternary_index::k.

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

◆ to_row_major_offset() [2/2]

unary_index fiber_bundle::ternary_index_space::to_row_major_offset ( const unary_index  xi,
const unary_index  xj,
const unary_index  xk 
) const
inline

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

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

Definition at line 295 of file ternary_index_space.h.

Member Data Documentation

◆ i_size

unary_index fiber_bundle::ternary_index_space::i_size

Upper bound for the first index.

Definition at line 47 of file ternary_index_space.h.

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

◆ j_size

unary_index fiber_bundle::ternary_index_space::j_size

Upper bound for the second index.

Definition at line 52 of file ternary_index_space.h.

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

◆ k_size

unary_index fiber_bundle::ternary_index_space::k_size

Upper bound for the third index.

Definition at line 57 of file ternary_index_space.h.

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

◆ size

unary_index fiber_bundle::ternary_index_space::size

Number in the space.

Definition at line 62 of file ternary_index_space.h.

Referenced by fiber_bundle::operator<<().


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