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

◆ SizesAndBlocks() [1/4]

mat::SizesAndBlocks::SizesAndBlocks ( )
inline

Default constructor.

Referenced by getSizesAndBlocksForLowerLevel().

◆ SizesAndBlocks() [2/4]

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

Copy constructor.

◆ SizesAndBlocks() [3/4]

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 setup().

◆ ~SizesAndBlocks()

mat::SizesAndBlocks::~SizesAndBlocks ( )
inline

◆ SizesAndBlocks() [4/4]

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

References setup().

Member Function Documentation

◆ getBlockSizeVector()

void mat::SizesAndBlocks::getBlockSizeVector ( std::vector< int > &  blockSizesCopy) const

◆ getNBlocks()

◆ getNScalars()

◆ getNTotalScalars()

◆ getOffset()

◆ getSizesAndBlocksForLowerLevel()

SizesAndBlocks mat::SizesAndBlocks::getSizesAndBlocksForLowerLevel ( int const  blockNumber) const

◆ is_empty()

bool mat::SizesAndBlocks::is_empty ( ) const
inline

◆ operator=()

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

Assignment operator.

References nBlocks.

◆ operator==()

bool mat::SizesAndBlocks::operator== ( SizesAndBlocks const &  other) const

◆ setup()

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

References blockSizes, nBlocks, and nScalars.

Referenced by SizesAndBlocks().

◆ whichBlock()

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

Member Data Documentation

◆ blockSizes

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==(), setup(), and whichBlock().

◆ nBlocks

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().

◆ nScalars

int mat::SizesAndBlocks::nScalars
protected

Number of scalars in the current block.

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

◆ nTotalScalars

int mat::SizesAndBlocks::nTotalScalars
protected

Total number of scalars in entire system.

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

◆ offset

int mat::SizesAndBlocks::offset
protected

Offset in entire system.

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


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