libgenua
Basic Geometry, Numerical Algorithms and Interfaces
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
ConnectMap Class Reference

Detailed Description

Container for connectivity data.

ConnectMap stores index-based connectivity data in a format similar to the compressed-row scheme for sparse matrices. Since insert operations are expensive, it is required to use two passes. In the first pass, the number of elements (columns) connected to entry (row) ir are counted. After completion, connected values are set using append() or set(). To minimize memory consumption, call close() when the append operation is completed.

See Also
CsrMatrix

#include <connectmap.h>

Public Types

typedef Indices::const_iterator const_iterator
 iterator over connection array
 

Public Member Functions

 ConnectMap ()
 construct empty map
 
template<class Iterator >
 ConnectMap (Iterator colindBegin, Iterator colindEnd, Iterator rowptrBegin, Iterator rowptrEnd)
 construct map from CSR representation
 
void generatePairs (const Indices &rowMap, const Indices &colMap, uint rowOffset, uint colOffset, PairArray &pairs) const
 generate packed index pairs for this map
 
void generatePairs (uint rowOffset, uint colOffset, PairArray &pairs) const
 generate packed index pairs for this map
 
void assign (uint nrows, size_t npairs, const uint64_t sp[])
 construct from unique, sorted packed pairs
 
void assign (const std::vector< Indices > &m)
 copy from vector-of-vector data structure
 
void assign (uint nr, const Indices &lmap)
 copy data from interleaved linear storage (ir,k,ir,k,...)
 
void assign (uint nr, const SparsityCounter &sc)
 copy data from sparsity counter
 
template<class TripletIterator >
void assign (uint nrows, TripletIterator first, TripletIterator last)
 construct from unique, sorted triplets
 
template<int lg2n>
void assign (uint nr, const BucketMap< lg2n > &bm)
 copy data from bucket map
 
template<class Iterator >
void appendRow (Iterator ifirst, Iterator ilast)
 assemble connectivity by rows : append row
 
void beginCount (uint nr)
 start counting phase with nr rows
 
uint currentCount (uint row) const
 access current row count during the counting phase
 
force_inline void incCount (uint i, uint k=1)
 setup phase - increment value count for row i
 
template<int NDOF>
void ndIncrement (uint i, uint k=1)
 as incCount above, but for multiple DOFs per node
 
void atomicIncCount (uint i, uint k=1)
 setup phase - increment value count for row i
 
void incCount (const ConnectMap &map, int rowOffset=0)
 merge another pattern, optionally with row offset
 
void incCount (const ConnectMap &spty, const Indices &rcmap)
 merge another pattern with row and column renaming
 
template<int M>
void incCountElement (const Indices &rmap, const uint *vi)
 setup phase - increment count for an element
 
void endCount ()
 allocate after counting is completed
 
void allocate (uint nr, uint nc)
 allocate storage for a fixed number nc of connections per entry
 
force_inline void append (uint ir, uint k)
 append value k to row ir, without checking for sufficient space
 
template<int NDOF>
void ndAppend (uint ir, uint k)
 as append above, but for multiple DOFs per node
 
void append (uint ir, uint n, const uint kv[])
 append n values in kv to row ir, without checking for sufficient space
 
void append (const ConnectMap &map, int rowOffset=0, int colOffset=0)
 append another map with row and column offsets
 
void append (const ConnectMap &spty, const Indices &rcmap)
 append another map with row and columen renaming
 
template<int M, Symmetry symFlag>
void appendElement (const Indices &rmap, const Indices &cmap, const uint *vi)
 append element using row and column maps
 
void set (uint ir, uint n, const uint kv[])
 set elements connected to ir
 
void close ()
 finished appending
 
void compactify ()
 compactify only, use only if sorting is guaranteed
 
void compress ()
 sort, compactify and close : expensive!
 
void sort ()
 sort column indices of each row
 
bool equalPattern (uint ri, uint rj) const
 determine whether rows ri and rj have the same pattern
 
uint size () const
 number of rows
 
uint size (uint ir) const
 number of connected values
 
uint nonzero () const
 number of column indices
 
uint maxcolindex () const
 find the largest column index present
 
const uint * first (uint ir) const
 pointer to first index
 
uint index (uint ir, uint k) const
 column value k < size(ir) of row ir
 
uint colindex (uint offs) const
 column index of value offs
 
uint offset (uint ir) const
 row pointer offset
 
const_iterator begin (uint ir) const
 iterator access
 
const_iterator end (uint ir) const
 iterator access
 
uint lindex (uint i, uint j) const
 if sorted, find linear index of (i,j) or return NotFound
 
uint uptrilix (uint i, uint j) const
 utility : find linear index of symmetric matrix (upper triangle)
 
uint lotrilix (uint i, uint j) const
 utility : find linear index of symmetric matrix (lower triangle)
 
bool search (uint i, uint j) const
 determine if row i has neighbor j (sorted only)
 
uint sharedColumns (uint i, uint j) const
 return the number of column indices shared between rows i and j
 
void rowBlockPermutation (uint blockSize, Indices &perm) const
 compute a row permutation to improve blocking
 
bool metisPermutation (Indices &perm, Indices &iperm) const
 permute using METIS, when available
 
void rowpermute (const Indices &rep)
 apply a replacement table to rows
 
void colpermute (const Indices &rep)
 apply a column permutation
 
void permute (const Indices &perm)
 apply full permutation to both rows and columns
 
void merge (const ConnectMap &a, const ConnectMap &b)
 make this the merge of a and b
 
void catColumns (const ConnectMap &a, const ConnectMap &b, uint acol)
 make this the column-wise (horizontal) concatenation of a and b
 
void catRows (const ConnectMap &a, const ConnectMap &b)
 make this the row-wise (vertical) concatenation of a and b
 
void transpose (uint ncol, ConnectMap &mt) const
 construct the transpose of *this in mt
 
void transpose (uint ncol)
 make this the transpose of itself
 
void dropLowerTriangle (Indices &upperlix)
 Drop entries below the main diagonal. More...
 
void upperTriangle (ConnectMap &uptri) const
 compute pattern for the upper triangular part
 
void upperTriangle ()
 compute pattern for the upper triangular part
 
void lowerTriangle (ConnectMap &lotri) const
 compute pattern for the lower triangular part
 
void lowerTriangle ()
 compute pattern for the lower triangular part
 
uint coloring (Indices &clr) const
 straightforward multicoloring
 
void clear ()
 release all storage
 
void swap (ConnectMap &a)
 swap contents with other map
 
bool checkPattern (uint nr, uint nc) const
 diagnose out-of-bounds problems
 
float megabytes () const
 compute memory requirements
 
const uint * colIndex () const
 return column index pointer
 
const uint * rowPointer () const
 return pointer to row offsets in colIndex
 
void scotchify (ConnectMap &map) const
 remove loops (diagonals), make symmetric
 
template<typename Iterator >
void tocsr (Iterator colix, Iterator rowstart) const
 Copy into CSR data structure. More...
 
XmlElement toXml (bool shared=false) const
 create xml representation
 
void fromXml (const XmlElement &xe)
 generate from xml representation
 
FFANodePtr toFFA () const
 create 1-based FFA format node (copies)
 
bool fromFFA (const FFANodePtr &root)
 fetch data from FFA format file node
 

Static Public Member Functions

static uint64_t packpair (uint32_t r, uint32_t c)
 helper for packed construction
 
static void unpackpair (uint64_t p, uint32_t &r, uint32_t &c)
 helper for packed construction
 
static size_t dropInvalidPairs (Symmetry sym, size_t n, uint64_t sp[])
 helper function for removal of invalid pairs
 
static void fillIn (const ConnectMap &amap, const ConnectMap &tmap, std::vector< uint64_t > &f)
 determine one-level factorrization fill-in
 

Static Private Member Functions

template<Symmetry flag>
static force_inline bool inrange (uint row, uint col)
 test if index is permissible
 

Private Attributes

Indices icol
 connectivity data (column indices)
 
Indices irow
 indexes of icol indicating where the rows begin
 

Member Function Documentation

void ConnectMap::dropLowerTriangle ( Indices &  upperlix)

Drop entries below the main diagonal.

Parameters
utlixis set to the linear indices of the upper triangular values
template<typename Iterator >
void ConnectMap::tocsr ( Iterator  colix,
Iterator  rowstart 
) const
inline

Copy into CSR data structure.

colindex must point into storage for at least nonzero() entries, and rowstart must have space for size()+1 values or be an back insertion iterator.


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