TTK
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
ttk::FlatJaggedArray Class Reference

Replacement for std::vector<std::vector<SimplexId>> More...

#include <FlatJaggedArray.h>

Classes

struct  Iterator
 
struct  Slice
 

Public Member Functions

void setData (std::vector< SimplexId > &&data, std::vector< SimplexId > &&offsets)
 Set internal data from pre-existing vectors.
 
void clear ()
 Clear the underlying vectors.
 
SimplexId size (SimplexId id) const
 Get the size of a particular sub-vector.
 
SimplexId offset (SimplexId id) const
 Get the offset of a particular sub-vector.
 
Iterator begin () const
 
Iterator end () const
 
Slice operator[] (const size_t id) const
 
SimplexId get (SimplexId id, SimplexId local) const
 Returns the data inside the sub-vectors.
 
const SimplexIdget_ptr (SimplexId id, SimplexId local) const
 Returns a const pointer to the data inside the sub-vectors.
 
const SimplexIdoffset_ptr () const
 Returns a const pointer to the offset member.
 
size_t size () const
 Returns the number of sub-vectors.
 
size_t dataSize () const
 Returns the size of the data_ member.
 
bool empty () const
 If the underlying buffers are empty.
 
size_t footprint () const
 Computes the memory footprint of the array.
 
template<typename T >
void fillFrom (const std::vector< T > &src, int threadNumber=1)
 Fill buffers from a std::vector<std::vector<SimplexId>>
 
void copyTo (std::vector< std::vector< SimplexId > > &dst, int threadNumber=1) const
 Copy buffers to a std::vector<std::vector<SimplexId>>
 
void writeToFile (const std::string &fName) const
 Write content into a file.
 

Static Public Member Functions

static void writeToFile (const std::string &fName, const std::vector< std::vector< SimplexId > > &src)
 Also write std::vector<std::vector<SimplexId>> to disk.
 

Detailed Description

Replacement for std::vector<std::vector<SimplexId>>

Use this when instead of a std::vector<std::vector<SimplexId>> when the data is set once and not modified afterwards.

Definition at line 12 of file FlatJaggedArray.h.

Member Function Documentation

◆ begin()

Iterator ttk::FlatJaggedArray::begin ( ) const
inline

Definition at line 107 of file FlatJaggedArray.h.

◆ clear()

void ttk::FlatJaggedArray::clear ( )
inline

Clear the underlying vectors.

Definition at line 35 of file FlatJaggedArray.h.

◆ copyTo()

void ttk::FlatJaggedArray::copyTo ( std::vector< std::vector< SimplexId > > &  dst,
int  threadNumber = 1 
) const
inline

Copy buffers to a std::vector<std::vector<SimplexId>>

Definition at line 221 of file FlatJaggedArray.h.

◆ dataSize()

size_t ttk::FlatJaggedArray::dataSize ( ) const
inline

Returns the size of the data_ member.

Definition at line 173 of file FlatJaggedArray.h.

◆ empty()

bool ttk::FlatJaggedArray::empty ( ) const
inline

If the underlying buffers are empty.

Definition at line 180 of file FlatJaggedArray.h.

◆ end()

Iterator ttk::FlatJaggedArray::end ( ) const
inline

Definition at line 110 of file FlatJaggedArray.h.

◆ fillFrom()

template<typename T >
void ttk::FlatJaggedArray::fillFrom ( const std::vector< T > &  src,
int  threadNumber = 1 
)
inline

Fill buffers from a std::vector<std::vector<SimplexId>>

Templated to also accept Boost small_vectors.

Definition at line 201 of file FlatJaggedArray.h.

◆ footprint()

size_t ttk::FlatJaggedArray::footprint ( ) const
inline

Computes the memory footprint of the array.

Definition at line 187 of file FlatJaggedArray.h.

◆ get()

SimplexId ttk::FlatJaggedArray::get ( SimplexId  id,
SimplexId  local 
) const
inline

Returns the data inside the sub-vectors.

Definition at line 126 of file FlatJaggedArray.h.

◆ get_ptr()

const SimplexId * ttk::FlatJaggedArray::get_ptr ( SimplexId  id,
SimplexId  local 
) const
inline

Returns a const pointer to the data inside the sub-vectors.

Definition at line 141 of file FlatJaggedArray.h.

◆ offset()

SimplexId ttk::FlatJaggedArray::offset ( SimplexId  id) const
inline

Get the offset of a particular sub-vector.

Definition at line 59 of file FlatJaggedArray.h.

◆ offset_ptr()

const SimplexId * ttk::FlatJaggedArray::offset_ptr ( ) const
inline

Returns a const pointer to the offset member.

Definition at line 156 of file FlatJaggedArray.h.

◆ operator[]()

Slice ttk::FlatJaggedArray::operator[] ( const size_t  id) const
inline

Definition at line 114 of file FlatJaggedArray.h.

◆ setData()

void ttk::FlatJaggedArray::setData ( std::vector< SimplexId > &&  data,
std::vector< SimplexId > &&  offsets 
)
inline

Set internal data from pre-existing vectors.

Definition at line 26 of file FlatJaggedArray.h.

◆ size() [1/2]

size_t ttk::FlatJaggedArray::size ( ) const
inline

Returns the number of sub-vectors.

Definition at line 163 of file FlatJaggedArray.h.

◆ size() [2/2]

SimplexId ttk::FlatJaggedArray::size ( SimplexId  id) const
inline

Get the size of a particular sub-vector.

Definition at line 47 of file FlatJaggedArray.h.

◆ writeToFile() [1/2]

void ttk::FlatJaggedArray::writeToFile ( const std::string &  fName) const
inline

Write content into a file.

Definition at line 245 of file FlatJaggedArray.h.

◆ writeToFile() [2/2]

static void ttk::FlatJaggedArray::writeToFile ( const std::string &  fName,
const std::vector< std::vector< SimplexId > > &  src 
)
inlinestatic

Also write std::vector<std::vector<SimplexId>> to disk.

Definition at line 259 of file FlatJaggedArray.h.


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