libMesh::METIS_CSR_Graph Class Reference

#include <metis_csr_graph.h>

Public Member Functions

void prep_n_nonzeros (const libMesh::dof_id_type row, const libMesh::dof_id_type n_nonzeros)
 
libMesh::dof_id_type n_nonzeros (const libMesh::dof_id_type row) const
 
void prepare_for_use ()
 
int & operator() (const libMesh::dof_id_type row, const libMesh::dof_id_type nonzero)
 
const int & operator() (const libMesh::dof_id_type row, const libMesh::dof_id_type nonzero) const
 

Public Attributes

std::vector< int > offsets
 
std::vector< int > vals
 

Detailed Description

This utility class provides a convenient implementation for building the compressed-row-storage graph required for the METIS/ParMETIS graph partitioning schemes.

Definition at line 40 of file metis_csr_graph.h.

Member Function Documentation

libMesh::dof_id_type libMesh::METIS_CSR_Graph::n_nonzeros ( const libMesh::dof_id_type  row) const
inline

Definition at line 53 of file metis_csr_graph.h.

References offsets.

Referenced by prep_n_nonzeros().

54  {
55  libmesh_assert_less (row+1, offsets.size());
56  return (offsets[row+1] - offsets[row]);
57  }
int& libMesh::METIS_CSR_Graph::operator() ( const libMesh::dof_id_type  row,
const libMesh::dof_id_type  nonzero 
)
inline

Definition at line 72 of file metis_csr_graph.h.

References libMesh::libmesh_assert_greater(), offsets, and vals.

73  {
74  libmesh_assert_greater (vals.size(), offsets[row]+nonzero);
75 
76  return vals[offsets[row]+nonzero];
77  }
const int& libMesh::METIS_CSR_Graph::operator() ( const libMesh::dof_id_type  row,
const libMesh::dof_id_type  nonzero 
) const
inline

Definition at line 81 of file metis_csr_graph.h.

References libMesh::libmesh_assert_greater(), offsets, and vals.

82  {
83  libmesh_assert_greater (vals.size(), offsets[row]+nonzero);
84 
85  return vals[offsets[row]+nonzero];
86  }
void libMesh::METIS_CSR_Graph::prep_n_nonzeros ( const libMesh::dof_id_type  row,
const libMesh::dof_id_type  n_nonzeros 
)
inline

Definition at line 45 of file metis_csr_graph.h.

References n_nonzeros(), and offsets.

Referenced by libMesh::MetisPartitioner::_do_partition().

46  {
47  libmesh_assert_less (row+1, offsets.size());
48  offsets[row+1] = n_nonzeros;
49  }
void libMesh::METIS_CSR_Graph::prepare_for_use ( )
inline

Definition at line 60 of file metis_csr_graph.h.

References libMesh::libmesh_assert(), offsets, and vals.

Referenced by libMesh::MetisPartitioner::_do_partition().

61  {
62  std::partial_sum (offsets.begin(), offsets.end(), offsets.begin());
63  libmesh_assert (!offsets.empty());
64  vals.resize(offsets.back());
65 
66  if (vals.empty())
67  vals.push_back(0);
68  }

Member Data Documentation

std::vector<int> libMesh::METIS_CSR_Graph::offsets
std::vector<int> libMesh::METIS_CSR_Graph::vals

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

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:27 UTC

Hosted By:
SourceForge.net Logo