50#ifndef Foam_CompactListList_H
51#define Foam_CompactListList_H
61template<
class T>
class CompactListList;
63template<
class T> Istream&
operator>>(Istream&, CompactListList<T>&);
64template<
class T> Ostream&
operator<<(Ostream&,
const CompactListList<T>&);
86 static void reportOverflowAndExit
93 template<
class ListListType>
96 const ListListType& lists,
97 const bool checkOverflow =
false
101 void enforceSizeSanity();
104 label maxNonLocalSize(
const label rowi)
const;
136 template<
class SubListType = List<T>>
140 const bool checkOverflow =
false
144 template<
class SubListType,
class Addr>
148 const bool checkOverflow =
false
173 const label mRows, const label nVals, const
Foam::
zero
260 inline label
localEnd(const label i) const;
263 inline label
localSize(const label i) const;
282 inline
void resize(const label mRows);
285 inline
void resize(const label mRows, const label nVals);
288 inline
void resize_nocopy(const label mRows, const label nVals);
291 inline
void resize(const label mRows, const label nVals, const
T&);
301 inline
void setSize(const label mRows);
304 inline
void setSize(const label mRows, const label nVals);
307 inline
void setSize(const label mRows, const label nVals, const
T&);
323 inline label
toGlobal(const label rowi, const label i) const;
326 inline label
toLocal(const label rowi, const label i) const;
330 inline label
findRow(const label i) const;
334 inline label
whichRow(const label i) const;
340 template<class SubListType =
List<
T>>
344 template<class SubListType =
List<
T>>
381 inline
T&
operator()(const label i, const label j);
384 inline const
T&
operator()(const label i, const label j) const;
424 label
index(
const label rowi,
const label colj)
const
430 label
whichColumn(
const label rowi,
const label i)
const
A packed storage unstructured matrix of objects of type <T> using an offset table for access.
label size_type
The type to represent the size of a CompactListList.
List< SubListType > unpack() const
Return non-compact list of lists.
const List< T > & m() const noexcept
Const access to the packed matrix of values.
label maxSize() const
The max row length used.
void resize_nocopy(const label mRows, const label nVals)
Redimension without preserving existing content.
char * data_bytes() noexcept
T value_type
The value type the list contains.
label localSize(const label i) const
Size of given row.
List< T > & m() noexcept
Non-const access to the packed matrix of values.
bool empty() const noexcept
True if the number of rows/sublists is zero.
const T * cdata() const noexcept
Return const pointer to the first data in values()
const T * const_pointer
The pointer type for const access to value_type items.
label whichRow(const label i) const
Which row does global index come from? Binary search.
List< labelRange > ranges() const
Return start/size ranges for all sub-lists.
label findRow(const label i) const
Find row where global index comes from. Binary search.
T * pointer
The pointer type for non-const access to value_type items.
static CompactListList< T > pack(const IndirectListBase< SubListType, Addr > &lists, const bool checkOverflow=false)
Construct by packing together an indirect list of lists.
const labelUList localStarts() const
The local row starts.
static CompactListList< T > pack(const UList< SubListType > &lists, const bool checkOverflow=false)
Construct by packing together the list of lists.
List< T > & values() noexcept
Return non-const access to the packed matrix of values.
void transfer(CompactListList< T > &list)
Transfer contents into this and annul the argument.
friend Ostream & operator(Ostream &, const CompactListList< T > &)
Write CompactListList as offsets/values pair.
static const CompactListList< T > & null()
Return a CompactListList reference to a nullObject.
label localStart(const label i) const
Starting offset for given row.
label size() const noexcept
The primary size (the number of rows/sublists)
T & reference
The type used for storing into value_type objects.
label totalSize() const
The total addressed size.
std::streamsize byteSize() const
labelList sizes() const
The local row sizes. Same as localSizes.
void setLocalSize(const label rowi, const label len)
Alter local addressing size for given row, does not change content.
void resize(const label mRows)
Reset size of CompactListList.
const char * cdata_bytes() const noexcept
label index(const label rowi, const label colj) const
Return flat index into packed values.
labelList localSizes() const
The local row sizes.
label localEnd(const label i) const
End offset (exclusive) for given row.
Ostream & writeList(Ostream &os, const label shortLen=0) const
Write CompactListList as offsets/values pair.
void clear()
Clear addressing and contents.
Istream & readList(Istream &is)
void swap(CompactListList< T > &other)
Swap contents.
std::streamsize size_bytes() const noexcept
label whichColumn(const label rowi, const label i) const
Get column within specified row that corresponds to global index.
label toLocal(const label rowi, const label i) const
From global to local index on rowi.
const labelList & offsets() const noexcept
Return the offset table (= size()+1)
UList< T > localList(const label i)
Return non-const access to sub-list (no subscript checking)
CompactListList() noexcept=default
Default construct.
void setSize(const label mRows)
Redimension - same as resize()
const T & const_reference
The type used for reading from constant value_type objects.
autoPtr< CompactListList< T > > clone() const
Clone.
label toGlobal(const label rowi, const label i) const
Base for lists with indirect addressing, templated on the list contents type and the addressing type....
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Database for solution data, solver performance and other reduced data.
A range or interval of labels defined by a start and a size.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
OBJstream os(runTime.globalPath()/outputName)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Istream & operator>>(Istream &, directionInfo &)
Number of items before requiring line-breaks in the list output.