DOLFIN
DOLFIN C++ interface
Classes | Public Member Functions | List of all members
dolfin::CSRGraph< T > Class Template Reference

Compressed Sparse Row graph. More...

#include <CSRGraph.h>

Classes

class  node
 

Public Member Functions

 CSRGraph ()=delete
 Empty CSR Graph.
 
template<typename X >
 CSRGraph (MPI_Comm mpi_comm, const std::vector< X > &graph)
 
 CSRGraph (MPI_Comm mpi_comm, const T *xadj, const T *adjncy, std::size_t n)
 Create a CSR Graph from ParMETIS style adjacency lists.
 
 ~CSRGraph ()
 Destructor.
 
const std::vector< T > & edges () const
 
std::vector< T > & edges ()
 
const node operator[] (std::size_t i) const
 
const std::vector< T > & nodes () const
 
std::vector< T > & nodes ()
 
std::size_t num_edges () const
 Number of local edges in graph.
 
std::size_t num_edges (std::size_t i) const
 Number of edges from node i.
 
std::size_t size () const
 Number of local nodes in graph.
 
size_global () const
 Total (global) number of nodes in parallel graph.
 
const std::vector< T > & node_distribution () const
 Return number of nodes (offset) on each process.
 
std::vector< T > & node_distribution ()
 Return number of nodes (offset) on each process (non-const)
 

Detailed Description

template<typename T>
class dolfin::CSRGraph< T >

Compressed Sparse Row graph.

This class provides a Compressed Sparse Row Graph defined by a vector containing edges for each node and a vector of offsets into the edge vector for each node

In parallel, all nodes must be numbered from zero on process zero continuously through increasing rank processes. Edges must be defined in terms of the global node numbers. The global node offset of each process is given by node_distribution()

The format of the nodes, edges and distribution is identical with the formats for ParMETIS and PT-SCOTCH. See the manuals for these libraries for further information.

Constructor & Destructor Documentation

◆ CSRGraph()

template<typename T>
template<typename X >
dolfin::CSRGraph< T >::CSRGraph ( MPI_Comm  mpi_comm,
const std::vector< X > &  graph 
)
inline

Create a CSR Graph from a collection of edges (X is a container some type, e.g. std::vector<unsigned int> or std::set<std::size_t>

Member Function Documentation

◆ edges() [1/2]

template<typename T>
const std::vector<T>& dolfin::CSRGraph< T >::edges ( ) const
inline

Vector containing all edges for all local nodes ("adjncy" in ParMETIS)

◆ edges() [2/2]

template<typename T>
std::vector<T>& dolfin::CSRGraph< T >::edges ( )
inline

Vector containing all edges for all local nodes (non-const) ("adjncy" in ParMETIS)

◆ nodes() [1/2]

template<typename T>
const std::vector<T>& dolfin::CSRGraph< T >::nodes ( ) const
inline

Vector containing index offsets into edges for all local nodes (plus extra entry marking end) ("xadj" in ParMETIS)

◆ nodes() [2/2]

template<typename T>
std::vector<T>& dolfin::CSRGraph< T >::nodes ( )
inline

Vector containing index offsets into edges for all local nodes (plus extra entry marking end) ("xadj" in ParMETIS)

◆ operator[]()

template<typename T>
const node dolfin::CSRGraph< T >::operator[] ( std::size_t  i) const
inline

Return CSRGraph::node object which provides begin() and end() iterators, also size(), and random-access for the edges of node i.


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