ergo
mat::SizesAndBlocks Class Reference

Describes dimensions of matrix and its blocks on all levels. More...

#include <SizesAndBlocks.h>

Public Member Functions

 SizesAndBlocks ()
 Default constructor. More...
 
 SizesAndBlocks (SizesAndBlocks const &other)
 Copy constructor. More...
 
 SizesAndBlocks (std::vector< int > const &blockSizesInp, int const nScalarsInp)
 Constructor used for explicit calls. More...
 
SizesAndBlocksoperator= (SizesAndBlocks const &other)
 Assignment operator. More...
 
bool operator== (SizesAndBlocks const &other) const
 
SizesAndBlocks getSizesAndBlocksForLowerLevel (int const blockNumber) const
 
bool is_empty () const
 
int const & getNBlocks () const
 
int const & getNScalars () const
 
void getBlockSizeVector (std::vector< int > &blockSizesCopy) const
 
int whichBlock (int const globalIndex) const
 Returns the blocknumber (between 0 and nBlocks-1) that contains elements with the given global index. More...
 
int getOffset () const
 
int getNTotalScalars () const
 
 ~SizesAndBlocks ()
 

Protected Member Functions

 SizesAndBlocks (std::vector< int > const &blockSizesInp, int const nScalarsInp, int const offsetInp, int const nTotalScalarsInp)
 
void setup (std::vector< int > const &blockSizesInp)
 

Protected Attributes

std::vector< int > blockSizes
 This is the number of scalars in each block, (not the number of blocks in each block) for each level starting with the highest level. More...
 
int nBlocks
 This is the number of blocks in the current block. More...
 
int nScalars
 Number of scalars in the current block. More...
 
int offset
 Offset in entire system. More...
 
int nTotalScalars
 Total number of scalars in entire system. More...
 

Detailed Description

Describes dimensions of matrix and its blocks on all levels.

The key ability is to provide the count and size of blocks, and their offset in the entire matrix. It can generate a corresponding object for lower-level blocks.

Constructor & Destructor Documentation

mat::SizesAndBlocks::SizesAndBlocks ( )
inline

Default constructor.

Referenced by getSizesAndBlocksForLowerLevel().

mat::SizesAndBlocks::SizesAndBlocks ( SizesAndBlocks const &  other)

Copy constructor.

mat::SizesAndBlocks::SizesAndBlocks ( std::vector< int > const &  blockSizesInp,
int const  nScalarsInp 
)
inline

Constructor used for explicit calls.

For sizes and blocks at the highest level. nScalarsInp is the number of total scalar rows/columns in this case.

References getSizesAndBlocksForLowerLevel(), operator==(), and setup().

mat::SizesAndBlocks::~SizesAndBlocks ( )
inline
mat::SizesAndBlocks::SizesAndBlocks ( std::vector< int > const &  blockSizesInp,
int const  nScalarsInp,
int const  offsetInp,
int const  nTotalScalarsInp 
)
inlineprotected

References setup().

Member Function Documentation

void mat::SizesAndBlocks::getBlockSizeVector ( std::vector< int > &  blockSizesCopy) const
int mat::SizesAndBlocks::getOffset ( ) const
inline
SizesAndBlocks mat::SizesAndBlocks::getSizesAndBlocksForLowerLevel ( int const  blockNumber) const
bool mat::SizesAndBlocks::is_empty ( ) const
inline
SizesAndBlocks & mat::SizesAndBlocks::operator= ( SizesAndBlocks const &  other)

Assignment operator.

References blockSizes, nBlocks, nScalars, nTotalScalars, and offset.

bool mat::SizesAndBlocks::operator== ( SizesAndBlocks const &  other) const
void mat::SizesAndBlocks::setup ( std::vector< int > const &  blockSizesInp)
protected

References blockSizes, nBlocks, and nScalars.

Referenced by SizesAndBlocks().

int mat::SizesAndBlocks::whichBlock ( int const  globalIndex) const
inline

Returns the blocknumber (between 0 and nBlocks-1) that contains elements with the given global index.

References blockSizes, and offset.

Member Data Documentation

std::vector<int> mat::SizesAndBlocks::blockSizes
protected

This is the number of scalars in each block, (not the number of blocks in each block) for each level starting with the highest level.

It should be 1 at the lowest level. Example: [1000 100 10 1] Length is level() + 1

Referenced by getBlockSizeVector(), getSizesAndBlocksForLowerLevel(), is_empty(), operator=(), operator==(), setup(), and whichBlock().

int mat::SizesAndBlocks::nBlocks
protected

This is the number of blocks in the current block.

== nScalars at lowest level

Referenced by getNBlocks(), operator=(), operator==(), and setup().

int mat::SizesAndBlocks::nScalars
protected

Number of scalars in the current block.

Referenced by getNScalars(), getSizesAndBlocksForLowerLevel(), operator=(), operator==(), and setup().

int mat::SizesAndBlocks::nTotalScalars
protected

Total number of scalars in entire system.

Referenced by getNTotalScalars(), getSizesAndBlocksForLowerLevel(), operator=(), and operator==().

int mat::SizesAndBlocks::offset
protected

Offset in entire system.

Referenced by getOffset(), getSizesAndBlocksForLowerLevel(), operator=(), operator==(), and whichBlock().


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