A packed storage of objects of type <T> using an offset table for access. More...
#include <CompactListList.H>

Public Types | |
| typedef T | value_type |
| The value type the list contains. | |
| typedef T * | pointer |
| The pointer type for non-const access to value_type items. | |
| typedef const T * | const_pointer |
| The pointer type for const access to value_type items. | |
| typedef T & | reference |
| The type used for storing into value_type objects. | |
| typedef const T & | const_reference |
| The type used for reading from constant value_type objects. | |
| typedef label | size_type |
| The type to represent the size of a CompactListList. | |
Public Member Functions | |
| CompactListList () noexcept=default | |
| Default construct. | |
| CompactListList (const CompactListList< T > &list) | |
| Copy construct. | |
| CompactListList (CompactListList< T > &&list) | |
| Move construct. | |
| CompactListList (CompactListList< T > &list, bool reuse) | |
| Copy/move construct as specified. | |
| CompactListList (const label mRows, const label nVals) | |
| Construct from number of rows and number of values. | |
| CompactListList (const label mRows, const label nVals, Foam::zero) | |
| Construct from number of rows, number of values initializing all elements to zero. | |
| CompactListList (const label mRows, const label nVals, const T &) | |
| Construct from number of rows, number of values and uniform value for all elements. | |
| CompactListList (const labelUList &listSizes) | |
| Construct given list of row-sizes. | |
| CompactListList (const labelUList &listSizes, const T &val) | |
| Construct given list of row-sizes and a uniform value. | |
| CompactListList (Istream &is) | |
| Construct from Istream. | |
| autoPtr< CompactListList< T > > | clone () const |
| Clone. | |
| bool | empty () const noexcept |
| True if the number of rows/sublists is zero. | |
| bool | single () const noexcept |
| True if content is a single row/sublist only. Such content could be flattened out into a straight list (for example). | |
| label | length () const noexcept |
| The primary size (the number of rows/sublists). | |
| label | size () const noexcept |
| The primary size (the number of rows/sublists). | |
| label | totalSize () const noexcept |
| The total addressed size, which corresponds to the end (back) offset and also the sum of all localSizes. | |
| const labelList & | offsets () const noexcept |
| Return the offset table (= size()+1). | |
| labelList & | offsets () noexcept |
| Return non-const access to the offset table. | |
| const List< T > & | values () const noexcept |
| Return the packed values. | |
| List< T > & | values () noexcept |
| Return non-const access to the packed values. | |
| const T * | cdata () const noexcept |
| Return const pointer to the first data in values(). | |
| T * | data () noexcept |
| Return pointer to the first data in values(). | |
| const char * | cdata_bytes () const noexcept |
| Return const pointer to underlying values storage, reinterpreted as byte data. | |
| char * | data_bytes () noexcept |
| Return pointer to underlying values storage, reinterpreted as byte data. | |
| std::streamsize | size_bytes () const noexcept |
| Number of contiguous bytes for the values data, no runtime check that the type is actually contiguous. | |
| std::streamsize | byteSize () const |
| Number of contiguous bytes for the values data, runtime FatalError if type is not contiguous. | |
| labelList | sizes () const |
| The local row sizes. Same as localSizes. | |
| const labelUList | localStarts () const |
| The local row starts. | |
| labelList | localSizes () const |
| The local row sizes. | |
| label | localStart (const label i) const |
| Starting offset for given row. | |
| label | localEnd (const label i) const |
| End offset (exclusive) for given row. | |
| label | localSize (const label i) const |
| Size of given row. | |
| List< labelRange > | ranges () const |
| Return start/size ranges for all sub-lists. | |
| labelRange | range (const label i) const |
| Return start/size range for given sub-list. | |
| label | maxSize () const |
| The max row length used. | |
| void | clear () |
| Clear addressing and contents. | |
| void | resize (const label mRows) |
| Reset size of CompactListList. | |
| void | resize (const label mRows, const label nVals) |
| Redimension CompactListList. | |
| void | resize_nocopy (const label mRows, const label nVals) |
| Redimension without preserving existing content. | |
| void | resize (const label mRows, const label nVals, const T &) |
| Redimension CompactListList and fill new elements with value. | |
| void | resize (const labelUList &listSizes) |
| Reset dimensions of CompactListList. | |
| void | resize_nocopy (const labelUList &listSizes) |
| Reset dimensions of CompactListList without preserving existing content. | |
| void | setLocalSize (const label rowi, const label len) |
| Alter local addressing size for given row, does not change content. | |
| void | swap (CompactListList< T > &other) |
| Swap contents. | |
| void | transfer (CompactListList< T > &list) |
| Transfer contents into this and annul the argument. | |
| label | toGlobal (const label rowi, const label i) const |
| From local index on rowi to global (flat) indexing into packed values. | |
| label | toLocal (const label rowi, const label i) const |
| From global to local index on rowi. | |
| label | findRow (const label i) const |
| Find row where global index comes from. Binary search. | |
| label | whichRow (const label i) const |
| Which row does global index come from? Binary search. | |
| template<class SubListType, class OutputIter> | |
| OutputIter | copy_unpack (OutputIter d_iter, const label pos=0, label len=-1) const |
Unpack sub-list copies in the range defined by pos and len with bounding behaviour like List::slice() by copy constructing begin at the destination iterator d_iter. | |
| template<class SubListType, class OutputIter> | |
| OutputIter | copy_unpack (OutputIter d_iter, const labelRange &range) const |
| Unpack sub-list copies in the specified range. | |
| template<class SubListType, class OutputIter> | |
| OutputIter | copy_unpack (OutputIter d_iter, const labelUList &indices) const |
| Unpack sub-list copies for the specified indices. | |
| template<class SubListType = List<T>> | |
| List< SubListType > | unpack () const |
| Return non-compact list of lists. | |
| template<class SubListType = List<T>> | |
| List< SubListType > | unpack (const labelRange &range) const |
| Return non-compact list of lists for the range of sub-lists. | |
| template<class SubListType = List<T>> | |
| List< SubListType > | unpack (const labelUList &indices) const |
| Return non-compact list of lists for specified indices. | |
| void | operator= (const CompactListList< T > &list) |
| Copy assignment. | |
| void | operator= (CompactListList< T > &&list) |
| Move assignment. | |
| void | operator= (const T &val) |
| Assignment of all entries to the given value. | |
| void | operator= (Foam::zero) |
| Assignment of all entries to zero. | |
| const SubList< T > | localList (const label i) const |
| Return const access to sub-list (no subscript checking). | |
| SubList< T > | localList (const label i) |
| Return non-const access to sub-list (no subscript checking). | |
| const SubList< T > | operator[] (const label i) const |
| Return const access to sub-list (no subscript checking). | |
| SubList< T > | operator[] (const label i) |
| Return non-const access to sub-list (no subscript checking). | |
| T & | operator() (const label i, const label j) |
| Return subscript-checked element. | |
| const T & | operator() (const label i, const label j) const |
| Return const subscript-checked element. | |
| Istream & | readList (Istream &is) |
| Read CompactListList as offsets/values pair from Istream, discards current list contents. | |
| Ostream & | writeList (Ostream &os, const label shortLen=0) const |
| Write CompactListList as offsets/values pair. | |
| Ostream & | writeMatrix (Ostream &os, const label shortLen=0) const |
| Write CompactListList as a formatted matrix of values (ASCII). | |
| const List< T > & | m () const noexcept |
| Const access to the packed values. | |
| List< T > & | m () noexcept |
| Non-const access to the packed values. | |
| label | index (const label rowi, const label colj) const |
| Return flat index into packed values. | |
| label | whichColumn (const label rowi, const label i) const |
| Get column within specified row that corresponds to global index. | |
| void | setSize (const label mRows) |
| Redimension - same as resize(). | |
| void | setSize (const label mRows, const label nVals) |
| Redimension - same as resize(). | |
| void | setSize (const label mRows, const label nVals, const T &val) |
| Redimension - same as resize(). | |
| void | setSize (const labelUList &listSizes) |
| Reset sizes - same as resize(). | |
| template<class ListListType> | |
| Foam::CompactListList< T > | pack_impl (const ListListType &lists, const bool checkOverflow) |
| template<class SubListType> | |
| Foam::CompactListList< T > | pack (const UList< SubListType > &lists, const bool checkOverflow) |
| template<class SubListType, class Addr> | |
| Foam::CompactListList< T > | pack (const IndirectListBase< SubListType, Addr > &lists, const bool checkOverflow) |
| template<class SubListType> | |
| Foam::List< SubListType > | unpack () const |
| template<class SubListType> | |
| Foam::List< SubListType > | unpack (const labelRange &range) const |
| template<class SubListType> | |
| Foam::List< SubListType > | unpack (const labelUList &indices) const |
Static Public Member Functions | |
| static const CompactListList< T > & | null () noexcept |
| Return a null CompactListList (reference to a nullObject). | |
| template<class SubListType = List<T>> | |
| static CompactListList< T > | pack (const UList< SubListType > &lists, const bool checkOverflow=false) |
| Construct by packing together the list of lists. | |
| template<class SubListType, class Addr> | |
| static CompactListList< T > | pack (const IndirectListBase< SubListType, Addr > &lists, const bool checkOverflow=false) |
| Construct by packing together an indirect list of lists. | |
Friends | |
| Istream & | operator>> (Istream &is, CompactListList< T > &list) |
| Read CompactListList offsets/values pair from Istream, discarding existing contents. | |
| Ostream & | operator<< (Ostream &os, const CompactListList< T > &list) |
| Write CompactListList as offsets/values pair. | |
A packed storage of objects of type <T> using an offset table for access.
The offset table is the size of the number of rows+1 whose elements are the accumulated sizes of the rows, i.e.
Note that an empty CompactListList should have empty offsets (not size 1).
Definition at line 72 of file CompactListList.H.
| typedef T value_type |
The value type the list contains.
Definition at line 137 of file CompactListList.H.
The pointer type for non-const access to value_type items.
Definition at line 142 of file CompactListList.H.
| typedef const T* const_pointer |
The pointer type for const access to value_type items.
Definition at line 147 of file CompactListList.H.
The type used for storing into value_type objects.
Definition at line 152 of file CompactListList.H.
| typedef const T& const_reference |
The type used for reading from constant value_type objects.
Definition at line 157 of file CompactListList.H.
The type to represent the size of a CompactListList.
Definition at line 162 of file CompactListList.H.
|
defaultnoexcept |
Default construct.
Referenced by CompactListList(), CompactListList(), CompactListList(), operator<<, operator=(), operator=(), operator>>, swap(), transfer(), and writeMatrix().

Copy construct.
Definition at line 44 of file CompactListListI.H.
References CompactListList().

Move construct.
Definition at line 55 of file CompactListListI.H.
References CompactListList().

Copy/move construct as specified.
Definition at line 66 of file CompactListListI.H.
References CompactListList().

|
inline |
Construct from number of rows and number of values.
Definition at line 78 of file CompactListListI.H.
|
inline |
Construct from number of rows, number of values initializing all elements to zero.
Definition at line 92 of file CompactListListI.H.
Construct from number of rows, number of values and uniform value for all elements.
Definition at line 107 of file CompactListListI.H.
References Foam::T().

|
explicit |
Construct given list of row-sizes.
Definition at line 192 of file CompactListList.C.
| CompactListList | ( | const labelUList & | listSizes, |
| const T & | val ) |
Construct given list of row-sizes and a uniform value.
Definition at line 204 of file CompactListList.C.
References Foam::T().

Construct from Istream.
Definition at line 27 of file CompactListListIO.C.
|
inlinestaticnoexcept |
Return a null CompactListList (reference to a nullObject).
Definition at line 170 of file CompactListList.H.
|
static |
Construct by packing together the list of lists.
Referenced by metisLikeDecomp::decompose(), ptscotchDecomp::decompose(), and GAMGAgglomeration::procAgglomerateLduAddressing().

|
static |
Construct by packing together an indirect list of lists.
|
inline |
Clone.
Definition at line 123 of file CompactListListI.H.
References Foam::New().

|
inlinenoexcept |
True if the number of rows/sublists is zero.
Definition at line 167 of file CompactListListI.H.
References Foam::noexcept.
Referenced by Foam::calcCellCellsImpl().

|
inlinenoexcept |
True if content is a single row/sublist only. Such content could be flattened out into a straight list (for example).
Definition at line 177 of file CompactListListI.H.
References Foam::noexcept.
|
inlinenoexcept |
The primary size (the number of rows/sublists).
Definition at line 184 of file CompactListListI.H.
References Foam::noexcept.
Referenced by writeMatrix().

|
inlinenoexcept |
The primary size (the number of rows/sublists).
Definition at line 192 of file CompactListListI.H.
References Foam::noexcept.
Referenced by Foam::calcCellCellsImpl(), copy_unpack(), metisLikeDecomp::decompose(), noDecomp::decompose(), ptscotchDecomp::decompose(), randomDecomp::decompose(), Foam::invertOneToManyCompact(), noRenumber::renumber(), randomRenumber::renumber(), SloanRenumber::renumber(), resize(), Foam::subsetAdjacency(), and Foam::subsetAdjacency().

|
inlinenoexcept |
The total addressed size, which corresponds to the end (back) offset and also the sum of all localSizes.
Definition at line 207 of file CompactListListI.H.
References Foam::noexcept.
Referenced by Foam::calcCellCellsImpl(), and findRow().

Return the offset table (= size()+1).
Definition at line 294 of file CompactListList.H.
Referenced by Foam::calcCellCellsImpl(), metisLikeDecomp::decompose(), metisLikeDecomp::decompose(), metisLikeDecomp::decompose(), ptscotchDecomp::decompose(), ptscotchDecomp::decompose(), ptscotchDecomp::decompose(), Foam::ensightOutput::Detail::getPolysFacePoints(), Foam::invertOneToManyCompact(), decompositionGAMGAgglomeration::localCellCells(), decompositionGAMGAgglomeration::localCellCells(), GAMGAgglomeration::procAgglomerateLduAddressing(), Foam::subsetAdjacency(), and Foam::subsetAdjacency().

Return non-const access to the offset table.
Definition at line 299 of file CompactListList.H.
Return the packed values.
Definition at line 304 of file CompactListList.H.
Referenced by Foam::calcCellCellsImpl(), metisLikeDecomp::decompose(), metisLikeDecomp::decompose(), metisLikeDecomp::decompose(), ptscotchDecomp::decompose(), ptscotchDecomp::decompose(), ptscotchDecomp::decompose(), Foam::ensightOutput::Detail::getPolysFacePoints(), Foam::invertOneToManyCompact(), decompositionGAMGAgglomeration::localCellCells(), decompositionGAMGAgglomeration::localCellCells(), localSizes(), GAMGAgglomeration::procAgglomerateLduAddressing(), ranges(), Foam::subsetAdjacency(), and Foam::subsetAdjacency().

Return non-const access to the packed values.
Definition at line 309 of file CompactListList.H.
Return const pointer to the first data in values().
Definition at line 132 of file CompactListListI.H.
References Foam::noexcept, and Foam::T().

Return pointer to the first data in values().
Definition at line 139 of file CompactListListI.H.
References Foam::noexcept, and Foam::T().

|
inlinenoexcept |
Return const pointer to underlying values storage, reinterpreted as byte data.
Definition at line 146 of file CompactListListI.H.
References Foam::noexcept.
|
inlinenoexcept |
Return pointer to underlying values storage, reinterpreted as byte data.
Definition at line 153 of file CompactListListI.H.
References Foam::noexcept.
|
inlinenoexcept |
Number of contiguous bytes for the values data, no runtime check that the type is actually contiguous.
Definition at line 160 of file CompactListListI.H.
References Foam::noexcept.
Referenced by byteSize().

| std::streamsize byteSize | ( | ) | const |
Number of contiguous bytes for the values data, runtime FatalError if type is not contiguous.
Definition at line 247 of file CompactListList.C.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, Foam::is_contiguous_v, and size_bytes().

|
inline |
The local row sizes. Same as localSizes.
Definition at line 200 of file CompactListListI.H.
References localSizes().

|
inline |
The local row starts.
Definition at line 222 of file CompactListListI.H.
References UList< label >::null().

| Foam::labelList localSizes | ( | ) | const |
The local row sizes.
Definition at line 334 of file CompactListList.C.
References values().
Referenced by GAMGAgglomeration::procAgglomerateLduAddressing(), and sizes().


|
inline |
Starting offset for given row.
Definition at line 233 of file CompactListListI.H.
|
inline |
End offset (exclusive) for given row.
Definition at line 240 of file CompactListListI.H.
|
inline |
Size of given row.
Definition at line 247 of file CompactListListI.H.
| Foam::List< Foam::labelRange > ranges | ( | ) | const |
Return start/size ranges for all sub-lists.
Definition at line 268 of file CompactListList.C.
References values().

| Foam::labelRange range | ( | const label | i | ) | const |
Return start/size range for given sub-list.
Definition at line 260 of file CompactListList.C.
Referenced by copy_unpack().

|
inline |
The max row length used.
Definition at line 214 of file CompactListListI.H.
|
inline |
Clear addressing and contents.
Definition at line 326 of file CompactListListI.H.
|
inline |
Reset size of CompactListList.
Definition at line 334 of file CompactListListI.H.
References size().
Referenced by CompactListList< label >::setSize(), CompactListList< label >::setSize(), CompactListList< label >::setSize(), and CompactListList< label >::setSize().


|
inline |
Redimension CompactListList.
Definition at line 359 of file CompactListListI.H.
|
inline |
Redimension without preserving existing content.
Definition at line 380 of file CompactListListI.H.
Referenced by Foam::calcCellCellsImpl(), decompositionGAMGAgglomeration::localCellCells(), and decompositionGAMGAgglomeration::localCellCells().

Redimension CompactListList and fill new elements with value.
Definition at line 401 of file CompactListListI.H.
References Foam::T().

| void resize | ( | const labelUList & | listSizes | ) |
Reset dimensions of CompactListList.
Definition at line 291 of file CompactListList.C.
| void resize_nocopy | ( | const labelUList & | listSizes | ) |
Reset dimensions of CompactListList without preserving existing content.
Definition at line 303 of file CompactListList.C.
| void setLocalSize | ( | const label | rowi, |
| const label | len ) |
Alter local addressing size for given row, does not change content.
Definition at line 315 of file CompactListList.C.
References delta.
| void swap | ( | CompactListList< T > & | other | ) |
Swap contents.
Definition at line 357 of file CompactListList.C.
References CompactListList().

| void transfer | ( | CompactListList< T > & | list | ) |
Transfer contents into this and annul the argument.
Definition at line 373 of file CompactListList.C.
References CompactListList().

|
inline |
From local index on rowi to global (flat) indexing into packed values.
Definition at line 270 of file CompactListListI.H.
Referenced by CompactListList< label >::index(), operator()(), and operator()().

|
inline |
From global to local index on rowi.
Definition at line 281 of file CompactListListI.H.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, and Foam::nl.
Referenced by CompactListList< label >::whichColumn().


|
inline |
Find row where global index comes from. Binary search.
Definition at line 302 of file CompactListListI.H.
References Foam::findLower(), and totalSize().
Referenced by whichRow().


|
inline |
Which row does global index come from? Binary search.
FatalError if out-of-bounds
Definition at line 309 of file CompactListListI.H.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, findRow(), and Foam::nl.

| OutputIter copy_unpack | ( | OutputIter | d_iter, |
| const label | pos = 0, | ||
| label | len = -1 ) const |
Unpack sub-list copies in the range defined by pos and len with bounding behaviour like List::slice() by copy constructing begin at the destination iterator d_iter.
| [out] | d_iter | The output destination |
| pos | The start of sub-region to copy (no-op if -ve or out-of-range) | |
| len | The length of sub-region to copy (-ve = until the end) |
Definition at line 390 of file CompactListList.C.
References localList(), Foam::pos(), and size().
Referenced by copy_unpack().


| OutputIter copy_unpack | ( | OutputIter | d_iter, |
| const labelRange & | range ) const |
Unpack sub-list copies in the specified range.
| [out] | d_iter | The output destination |
| range | The sub-region to copy |
Definition at line 421 of file CompactListList.C.
References copy_unpack(), and range().

| OutputIter copy_unpack | ( | OutputIter | d_iter, |
| const labelUList & | indices ) const |
Unpack sub-list copies for the specified indices.
| [out] | d_iter | The output destination |
| indices | The sub-regions to copy |
Definition at line 433 of file CompactListList.C.
References localList().

Return non-compact list of lists.
Referenced by multiLevelDecomp::decompose(), and multiLevelDecomp::decompose().

| List< SubListType > unpack | ( | const labelRange & | range | ) | const |
Return non-compact list of lists for the range of sub-lists.
| List< SubListType > unpack | ( | const labelUList & | indices | ) | const |
Return non-compact list of lists for specified indices.
|
inline |
Copy assignment.
Definition at line 425 of file CompactListListI.H.
References CompactListList().

|
inline |
Move assignment.
Definition at line 441 of file CompactListListI.H.
References CompactListList().

Assignment of all entries to the given value.
Definition at line 457 of file CompactListListI.H.
References Foam::T().

|
inline |
Assignment of all entries to zero.
Definition at line 464 of file CompactListListI.H.
|
inline |
Return const access to sub-list (no subscript checking).
Definition at line 255 of file CompactListListI.H.
Referenced by copy_unpack(), copy_unpack(), operator[](), operator[](), and writeMatrix().

|
inline |
Return non-const access to sub-list (no subscript checking).
Definition at line 263 of file CompactListListI.H.
|
inline |
Return const access to sub-list (no subscript checking).
Definition at line 472 of file CompactListListI.H.
References localList().

|
inline |
Return non-const access to sub-list (no subscript checking).
Definition at line 481 of file CompactListListI.H.
References localList().

Return subscript-checked element.
Definition at line 489 of file CompactListListI.H.
References Foam::T(), and toGlobal().

Return const subscript-checked element.
Definition at line 500 of file CompactListListI.H.
References Foam::T(), and toGlobal().

| Foam::Istream & readList | ( | Istream & | is | ) |
Read CompactListList as offsets/values pair from Istream, discards current list contents.
Definition at line 39 of file CompactListListIO.C.
Referenced by operator>>.

| Foam::Ostream & writeList | ( | Ostream & | os, |
| const label | shortLen = 0 ) const |
Write CompactListList as offsets/values pair.
Definition at line 49 of file CompactListListIO.C.
References os().
Referenced by operator<<.


| Foam::Ostream & writeMatrix | ( | Ostream & | os, |
| const label | shortLen = 0 ) const |
Write CompactListList as a formatted matrix of values (ASCII).
Definition at line 62 of file CompactListListIO.C.
References IOstreamOption::ASCII, token::BEGIN_LIST, CompactListList(), token::END_LIST, length(), localList(), Foam::nl, and os().

Const access to the packed values.
Definition at line 668 of file CompactListList.H.
Non-const access to the packed values.
Definition at line 674 of file CompactListList.H.
|
inline |
Return flat index into packed values.
Definition at line 679 of file CompactListList.H.
|
inline |
Get column within specified row that corresponds to global index.
Definition at line 687 of file CompactListList.H.
|
inline |
Redimension - same as resize().
Definition at line 695 of file CompactListList.H.
|
inline |
Redimension - same as resize().
Definition at line 703 of file CompactListList.H.
Redimension - same as resize().
Definition at line 711 of file CompactListList.H.
|
inline |
Reset sizes - same as resize().
Definition at line 719 of file CompactListList.H.
| Foam::CompactListList< T > pack_impl | ( | const ListListType & | lists, |
| const bool | checkOverflow ) |
Definition at line 60 of file CompactListList.C.
| Foam::CompactListList< T > pack | ( | const UList< SubListType > & | lists, |
| const bool | checkOverflow ) |
Definition at line 120 of file CompactListList.C.
| Foam::CompactListList< T > pack | ( | const IndirectListBase< SubListType, Addr > & | lists, |
| const bool | checkOverflow ) |
Definition at line 136 of file CompactListList.C.
Definition at line 457 of file CompactListList.C.
| Foam::List< SubListType > unpack | ( | const labelRange & | range | ) | const |
Definition at line 470 of file CompactListList.C.
| Foam::List< SubListType > unpack | ( | const labelUList & | indices | ) | const |
Definition at line 483 of file CompactListList.C.
|
friend |
Read CompactListList offsets/values pair from Istream, discarding existing contents.
Definition at line 729 of file CompactListList.H.
References CompactListList(), and readList().
|
friend |
Write CompactListList as offsets/values pair.
Definition at line 735 of file CompactListList.H.
References CompactListList(), os(), and writeList().