#include <SizesAndBlocks.h>
Public Member Functions | |
SizesAndBlocks () | |
Default constructor. | |
SizesAndBlocks (SizesAndBlocks const &other) | |
Copy constructor. | |
SizesAndBlocks (std::vector< int > const &blockSizesInp, int const nScalarsInp) | |
Constructor used for explicit calls. | |
SizesAndBlocks & | operator= (SizesAndBlocks const &other) |
Assignment operator. | |
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. | |
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. | |
int | nBlocks |
This is the number of blocks in the current block. | |
int | nScalars |
Number of scalars in the current block. | |
int | offset |
Offset in entire system. | |
int | nTotalScalars |
Total number of scalars in entire system. |
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.
mat::SizesAndBlocks::SizesAndBlocks | ( | ) | [inline] |
Default constructor.
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.
mat::SizesAndBlocks::~SizesAndBlocks | ( | ) | [inline] |
mat::SizesAndBlocks::SizesAndBlocks | ( | std::vector< int > const & | blockSizesInp, | |
int const | nScalarsInp, | |||
int const | offsetInp, | |||
int const | nTotalScalarsInp | |||
) | [inline, protected] |
void mat::SizesAndBlocks::getBlockSizeVector | ( | std::vector< int > & | blockSizesCopy | ) | const |
int const& mat::SizesAndBlocks::getNBlocks | ( | ) | const [inline] |
int const& mat::SizesAndBlocks::getNScalars | ( | ) | const [inline] |
int mat::SizesAndBlocks::getNTotalScalars | ( | ) | const [inline] |
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.
bool mat::SizesAndBlocks::operator== | ( | SizesAndBlocks const & | other | ) | const |
void mat::SizesAndBlocks::setup | ( | std::vector< int > const & | blockSizesInp | ) | [protected] |
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.
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
int mat::SizesAndBlocks::nBlocks [protected] |
This is the number of blocks in the current block.
== nScalars at lowest level
int mat::SizesAndBlocks::nScalars [protected] |
Number of scalars in the current block.
int mat::SizesAndBlocks::nTotalScalars [protected] |
Total number of scalars in entire system.
int mat::SizesAndBlocks::offset [protected] |
Offset in entire system.