Epetra_CrsGraph Class Reference

Epetra_CrsGraph: A class for constructing and using sparse compressed row graphs. More...

#include <Epetra_CrsGraph.h>

Inheritance diagram for Epetra_CrsGraph:

[legend]
Collaboration diagram for Epetra_CrsGraph:
[legend]
List of all members.

Public Member Functions

Epetra_CrsGraphoperator= (const Epetra_CrsGraph &Source)
 Assignment operator.
Constructors/Destructor.
 Epetra_CrsGraph (Epetra_DataAccess CV, const Epetra_BlockMap &RowMap, int *NumIndicesPerRow)
 Epetra_CrsGraph constuctor with variable number of indices per row.
 Epetra_CrsGraph (Epetra_DataAccess CV, const Epetra_BlockMap &RowMap, int NumIndicesPerRow)
 Epetra_CrsGraph constuctor with fixed number of indices per row.
 Epetra_CrsGraph (Epetra_DataAccess CV, const Epetra_BlockMap &RowMap, const Epetra_BlockMap &ColMap, int *NumIndicesPerRow)
 Epetra_CrsGraph constuctor with variable number of indices per row.
 Epetra_CrsGraph (Epetra_DataAccess CV, const Epetra_BlockMap &RowMap, const Epetra_BlockMap &ColMap, int NumIndicesPerRow)
 Epetra_CrsGraph constuctor with fixed number of indices per row.
 Epetra_CrsGraph (const Epetra_CrsGraph &Graph)
 Copy constructor.
virtual ~Epetra_CrsGraph ()
 Epetra_CrsGraph Destructor.
Insertion/Removal methods.
int InsertGlobalIndices (int GlobalRow, int NumIndices, int *Indices)
 Enter a list of elements in a specified global row of the matrix.
int RemoveGlobalIndices (int GlobalRow, int NumIndices, int *Indices)
 Remove a list of elements from a specified global row of the matrix.
int RemoveGlobalIndices (int Row)
 Remove all indices from a specified global row of the matrix.
int InsertMyIndices (int LocalRow, int NumIndices, int *Indices)
 Enter a list of elements in a specified local row of the matrix.
int RemoveMyIndices (int LocalRow, int NumIndices, int *Indices)
 Remove a list of elements from a specified local row of the matrix.
int RemoveMyIndices (int Row)
 Remove all indices from a specified local row of the matrix.
Transformation methods
int FillComplete ()
 Tranform matrix representation to local index space. Perform other operations to allow optimal matrix operations.
int FillComplete (const Epetra_BlockMap &DomainMap, const Epetra_BlockMap &RangeMap)
 Tranform to local index space using specified Domain/Range maps. Perform other operations to allow optimal matrix operations.
int OptimizeStorage ()
 Eliminates memory that is used for construction. Make consecutive row index sections contiguous.
int SortIndices ()
 Sort column indices, row-by-row, in ascending order.
int RemoveRedundantIndices ()
 Removes any redundant column indices in the rows of the graph.
Extraction methods.
int ExtractGlobalRowCopy (int GlobalRow, int LenOfIndices, int &NumIndices, int *Indices) const
 Extract a list of elements in a specified global row of the matrix. Put into storage allocated by calling routine.
int ExtractMyRowCopy (int LocalRow, int LenOfIndices, int &NumIndices, int *Indices) const
 Extract a list of elements in a specified local row of the matrix. Put into storage allocated by calling routine.
int ExtractGlobalRowView (int GlobalRow, int &NumIndices, int *&Indices) const
 Get a view of the elements in a specified global row of the matrix.
int ExtractMyRowView (int LocalRow, int &NumIndices, int *&Indices) const
 Get a view of the elements in a specified local row of the matrix.
Graph Properties Query Methods.
bool Filled () const
 If FillComplete() has been called, this query returns true, otherwise it returns false.
bool Sorted () const
 If SortIndices() has been called, this query returns true, otherwise it returns false.
bool StorageOptimized () const
 If OptimizeStorage() has been called, this query returns true, otherwise it returns false.
bool IndicesAreGlobal () const
 If column indices are in global range, this query returns true, otherwise it returns false.
bool IndicesAreLocal () const
 If column indices are in local range, this query returns true, otherwise it returns false.
bool LowerTriangular () const
 If graph is lower triangular in local index space, this query returns true, otherwise it returns false.
bool UpperTriangular () const
 If graph is upper triangular in local index space, this query returns true, otherwise it returns false.
bool NoDiagonal () const
 If graph has no diagonal entries in global index space, this query returns true, otherwise it returns false.
bool MyGlobalRow (int GID) const
 Returns true of GID is owned by the calling processor, otherwise it returns false.
bool HaveColMap () const
 Returns true if we have a well-defined ColMap, and returns false otherwise.
Atribute access functions
int NumMyRows () const
 Returns the number of matrix rows on this processor.
int NumGlobalRows () const
 Returns the number of matrix rows in global matrix.
int NumMyCols () const
 Returns the number of matrix columns on this processor.
int NumGlobalCols () const
 Returns the number of matrix columns in global matrix.
int NumGlobalNonzeros () const
 Returns the number of indices in the global graph.
int NumGlobalDiagonals () const
 Returns the number of diagonal entries in the global graph, based on global row/column index comparisons.
int NumMyDiagonals () const
 Returns the number of diagonal entries in the local graph, based on global row/column index comparisons.
int NumMyBlockRows () const
 Returns the number of block matrix rows on this processor.
int NumGlobalBlockRows () const
 Returns the number of Block matrix rows in global matrix.
int NumMyBlockCols () const
 Returns the number of Block matrix columns on this processor.
int NumGlobalBlockCols () const
 Returns the number of Block matrix columns in global matrix.
int NumMyBlockDiagonals () const
 Returns the number of Block diagonal entries in the local graph, based on global row/column index comparisons.
int NumGlobalBlockDiagonals () const
 Returns the number of Block diagonal entries in the global graph, based on global row/column index comparisons.
int NumGlobalEntries () const
 Returns the number of entries in the global graph.
int NumMyEntries () const
 Returns the number of entries on this processor.
int MaxRowDim () const
 Returns the max row dimension of block entries on the processor.
int GlobalMaxRowDim () const
 Returns the max row dimension of block entries across all processors.
int MaxColDim () const
 Returns the max column dimension of block entries on the processor.
int GlobalMaxColDim () const
 Returns the max column dimension of block entries across all processors.
int NumMyNonzeros () const
 Returns the number of indices in the local graph.
int NumGlobalIndices (int Row) const
 Returns the current number of nonzero entries in specified global row on this processor.
int NumAllocatedGlobalIndices (int Row) const
 Returns the allocated number of nonzero entries in specified global row on this processor.
int MaxNumIndices () const
 Returns the maximum number of nonzero entries across all rows on this processor.
int GlobalMaxNumIndices () const
 Returns the maximun number of nonzero entries across all rows across all processors.
int MaxNumNonzeros () const
 Returns the maximum number of nonzero points across all rows on this processor.
int GlobalMaxNumNonzeros () const
 Returns the maximun number of nonzero points across all rows across all processors.
int NumMyIndices (int Row) const
 Returns the current number of nonzero entries in specified local row on this processor.
int NumAllocatedMyIndices (int Row) const
 Returns the allocated number of nonzero entries in specified local row on this processor.
int IndexBase () const
 Returns the index base for row and column indices for this graph.
const Epetra_BlockMapRowMap () const
 Returns the RowMap associated with this matrix.
int ReplaceRowMap (const Epetra_BlockMap &newmap)
const Epetra_BlockMapColMap () const
 Returns the Column Map associated with this matrix.
const Epetra_BlockMapDomainMap () const
 Returns the DomainMap associated with this matrix.
const Epetra_BlockMapRangeMap () const
 Returns the RangeMap associated with this matrix.
const Epetra_ImportImporter () const
 Returns the Importer associated with this matrix.
const Epetra_ExportExporter () const
 Returns the Exporter associated with this matrix.
const Epetra_CommComm () const
 Returns a pointer to the Epetra_Comm communicator associated with this matrix.
Local/Global ID methods
int LRID (int GRID) const
 Returns the local row index for given global row index, returns -1 if no local row for this global row.
int GRID (int LRID) const
 Returns the global row index for give local row index, returns IndexBase-1 if we don't have this local row.
int LCID (int GCID) const
 Returns the local column index for given global column index, returns -1 if no local column for this global column.
int GCID (int LCID) const
 Returns the global column index for give local column index, returns IndexBase-1 if we don't have this local column.
bool MyGRID (int GRID) const
 Returns true if the GRID passed in belongs to the calling processor in this map, otherwise returns false.
bool MyLRID (int LRID) const
 Returns true if the LRID passed in belongs to the calling processor in this map, otherwise returns false.
bool MyGCID (int GCID) const
 Returns true if the GCID passed in belongs to the calling processor in this map, otherwise returns false.
bool MyLCID (int LCID) const
 Returns true if the LRID passed in belongs to the calling processor in this map, otherwise returns false.
Inlined Operator Methods.
int *& operator[] (int Loc)
 Inlined bracket operator for fast access to data. (Const and Non-const versions).
int *const & operator[] (int Loc) const
I/O Methods.
virtual void Print (ostream &os) const
 Print method.
void PrintGraphData (ostream &os) const
void PrintGraphData (ostream &os, int level) const
Deprecated methods: These methods still work, but will be removed in a future version.
const Epetra_BlockMapImportMap () const
 Use ColMap() instead.
int TransformToLocal ()
 Use FillComplete() instead.
int TransformToLocal (const Epetra_BlockMap *DomainMap, const Epetra_BlockMap *RangeMap)
 Use FillComplete(const Epetra_BlockMap& DomainMap, const Epetra_BlockMap& RangeMap) instead.
Expert Users and Developers Only
int ReferenceCount () const
 Returns the reference count of CrsGraphData.
const Epetra_CrsGraphDataDataPtr () const
 Returns a pointer to the CrsGraphData instance this CrsGraph uses.

Protected Member Functions

int * NumIndicesPerRow () const
int * NumAllocatedIndicesPerRow () const
int ** Indices () const
int * Indices (int LocalRow)
bool IndicesAreContiguous () const
bool NoRedundancies () const
bool GlobalConstantsComputed () const
bool FindGlobalIndexLoc (int LocalRow, int Index, int Start, int &Loc) const
bool FindGlobalIndexLoc (int NumIndices, const int *Indices, int Index, int Start, int &Loc) const
bool FindMyIndexLoc (int LocalRow, int Index, int Start, int &Loc) const
bool FindMyIndexLoc (int NumIndices, const int *Indices, int Index, int Start, int &Loc) const
int InsertIndices (int Row, int NumIndices, int *Indices)
int MakeIndicesLocal (const Epetra_BlockMap &DomainMap, const Epetra_BlockMap &RangeMap)
void SetIndicesAreLocal (bool Flag)
void SetIndicesAreGlobal (bool Flag)
void SetSorted (bool Flag)

Friends

class Epetra_CrsMatrix
class Epetra_VbrMatrix
class Epetra_FECrsMatrix
class Epetra_FEVbrMatrix
class Epetra_OffsetIndex

Detailed Description

Epetra_CrsGraph: A class for constructing and using sparse compressed row graphs.

The Epetra_CrsGraph enable the piecewise construction and use of sparse matrix graphs (the integer structure without values) where entries are intended for row access.

Epetra_CrsGraph is a base class for all row-based matrix classes.

Constructing Epetra_CrsGraph objects

Constructing Epetra_CrsGraph objects is a multi-step process. The basic steps are as follows:

  1. Create Epetra_CrsGraph instance, including storage, via constructor.
  2. Enter row and column entry information via calls to the InsertIndices function.
  3. Complete construction via FillComplete call.
  4. (Optional) Optimize the graph storage via a call to OptimizeStorage.

Note that, even after a matrix is constructed, it is possible to add or remove entries. However, FillComplete must be called again before the graph is used for subsequent operations.


Constructor & Destructor Documentation

Epetra_CrsGraph::Epetra_CrsGraph Epetra_DataAccess  CV,
const Epetra_BlockMap RowMap,
int *  NumIndicesPerRow
 

Epetra_CrsGraph constuctor with variable number of indices per row.

Creates a Epetra_CrsGraph object and allocates storage.

Parameters:
In CV - A Epetra_DataAccess enumerated type set to Copy or View.
In RowMap - An Epetra_BlockMap (or Epetra_Map or Epetra_LocalMap) listing the rows that this processor will contribute to.
In NumIndicesPerRow - An integer array of length NumMyRows such that NumIndicesPerRow[i] indicates the (approximate) number of entries in the ith row.

Epetra_CrsGraph::Epetra_CrsGraph Epetra_DataAccess  CV,
const Epetra_BlockMap RowMap,
int  NumIndicesPerRow
 

Epetra_CrsGraph constuctor with fixed number of indices per row.

Creates a Epetra_CrsGraph object and allocates storage.

Parameters:
In CV - A Epetra_DataAccess enumerated type set to Copy or View.
In RowMap - An Epetra_BlockMap (or Epetra_Map or Epetra_LocalMap) listing the rows that this processor will contribute to.
In NumIndicesPerRow - An integer that indicates the (approximate) number of entries in the each row. Note that it is possible to use 0 for this value and let fill occur during the insertion phase.

Epetra_CrsGraph::Epetra_CrsGraph Epetra_DataAccess  CV,
const Epetra_BlockMap RowMap,
const Epetra_BlockMap ColMap,
int *  NumIndicesPerRow
 

Epetra_CrsGraph constuctor with variable number of indices per row.

Creates a Epetra_CrsGraph object and allocates storage.

Parameters:
In CV - A Epetra_DataAccess enumerated type set to Copy or View.
In RowMap - An Epetra_BlockMap (or Epetra_Map or Epetra_LocalMap) listing the rows that this processor will contribute to.
In ColMap - An Epetra_BlockMap (or Epetra_Map or Epetra_LocalMap) listing the columns that this processor will contribute to.
In NumIndicesPerRow - An integer array of length NumMyRows such that NumIndicesPerRow[i] indicates the (approximate) number of entries in the ith row.

Epetra_CrsGraph::Epetra_CrsGraph Epetra_DataAccess  CV,
const Epetra_BlockMap RowMap,
const Epetra_BlockMap ColMap,
int  NumIndicesPerRow
 

Epetra_CrsGraph constuctor with fixed number of indices per row.

Creates a Epetra_CrsGraph object and allocates storage.

Parameters:
In CV - A Epetra_DataAccess enumerated type set to Copy or View.
In RowMap - An Epetra_BlockMap (or Epetra_Map or Epetra_LocalMap) listing the rows that this processor will contribute to.
In ColMap - An Epetra_BlockMap (or Epetra_Map or Epetra_LocalMap) listing the columns that this processor will contribute to.
In NumIndicesPerRow - An integer that indicates the (approximate) number of entries in the each row. Note that it is possible to use 0 for this value and let fill occur during the insertion phase.

Epetra_CrsGraph::Epetra_CrsGraph const Epetra_CrsGraph Graph  ) 
 

Copy constructor.

This will create a Level 1 deep copy. This Graph will share ownership of the CrsGraphData object with the right hand side Graph.


Member Function Documentation

const Epetra_CrsGraphData* Epetra_CrsGraph::DataPtr  )  const [inline]
 

Returns a pointer to the CrsGraphData instance this CrsGraph uses.

(Intended for developer use only for testing purposes.)

int Epetra_CrsGraph::ExtractGlobalRowCopy int  GlobalRow,
int  LenOfIndices,
int &  NumIndices,
int *  Indices
const
 

Extract a list of elements in a specified global row of the matrix. Put into storage allocated by calling routine.

Parameters:
In Row - Global row number to get indices.
In LenOfIndices - Length of Indices array.
Out NumIndices - Number of Indices.
Out Indices - Global column indices corresponding to values.
Returns:
Integer error code, set to 0 if successful.

int Epetra_CrsGraph::ExtractGlobalRowView int  GlobalRow,
int &  NumIndices,
int *&  Indices
const
 

Get a view of the elements in a specified global row of the matrix.

This function requires that the graph not be completed (FillComplete() was not called).

Parameters:
In Row - Local row number to get indices.
Out NumIndices - Number of Indices.
Out Indices - Column indices corresponding to values.
Returns:
Integer error code, set to 0 if successful. Returns -1 if invalid row. Returns -2 if graph is completed.

int Epetra_CrsGraph::ExtractMyRowCopy int  LocalRow,
int  LenOfIndices,
int &  NumIndices,
int *  Indices
const
 

Extract a list of elements in a specified local row of the matrix. Put into storage allocated by calling routine.

Parameters:
In Row - Local row number to get indices.
In LenOfIndices - Length of Indices array.
Out NumIndices - Number of Indices.
Out Indices - Local column indices corresponding to values.
Returns:
Integer error code, set to 0 if successful.

int Epetra_CrsGraph::ExtractMyRowView int  LocalRow,
int &  NumIndices,
int *&  Indices
const
 

Get a view of the elements in a specified local row of the matrix.

This function requires that the graph be completed FillComplete() was called).

Parameters:
In Row - Local row number to get indices.
Out NumIndices - Number of Indices.
Out Indices - Column indices corresponding to values.
Returns:
Integer error code, set to 0 if successful. Returns -1 if invalid row. Returns -2 if graph is not completed.

int Epetra_CrsGraph::FillComplete const Epetra_BlockMap DomainMap,
const Epetra_BlockMap RangeMap
 

Tranform to local index space using specified Domain/Range maps. Perform other operations to allow optimal matrix operations.

Returns:
Integer error code, set to 0 if successful. Returns 1 if data is shared.

int Epetra_CrsGraph::FillComplete  ) 
 

Tranform matrix representation to local index space. Perform other operations to allow optimal matrix operations.

Returns:
Integer error code, set to 0 if successful. Returns 1 if data is shared.

int Epetra_CrsGraph::GlobalMaxNumNonzeros  )  const [inline]
 

Returns the maximun number of nonzero points across all rows across all processors.

This function returns the max over all processor of MaxNumNonzeros().

bool Epetra_CrsGraph::HaveColMap  )  const [inline]
 

Returns true if we have a well-defined ColMap, and returns false otherwise.

We have a well-defined ColMap if a) a ColMap was passed in at construction, or b) the MakeColMap function has been called. (Calling either of the FillComplete functions will result in MakeColMap being called.)

int Epetra_CrsGraph::InsertGlobalIndices int  GlobalRow,
int  NumIndices,
int *  Indices
 

Enter a list of elements in a specified global row of the matrix.

Parameters:
In Row - Global row number of indices.
In NumIndices - Number of Indices.
In Indices - Global column indices to insert.
Returns:
Integer error code, set to 0 if successful. Returns 1 if data is shared.

int Epetra_CrsGraph::InsertMyIndices int  LocalRow,
int  NumIndices,
int *  Indices
 

Enter a list of elements in a specified local row of the matrix.

Parameters:
In Row - Local row number of indices.
In NumIndices - Number of Indices.
In Indices - Local column indices to insert.
Returns:
Integer error code, set to 0 if successful. Returns 1 if data is shared.

int Epetra_CrsGraph::MaxNumNonzeros  )  const [inline]
 

Returns the maximum number of nonzero points across all rows on this processor.

For each entry in the graph, let i = the GRID of the entry and j = the CGID of the entry. Then the entry size is the product of the rowmap elementsize of i and the colmap elementsize of i. Let ki = sum of all entry sizes for the entries in the ith row. For example, if the ith block row had 5 block entries and the element size of each entry was 4-by-4, ki would be 80. Then this function return the max over all ki for all row on this processor.

Epetra_CrsGraph& Epetra_CrsGraph::operator= const Epetra_CrsGraph Source  ) 
 

Assignment operator.

This will do a Level 1 deep copy. It will share ownership of the CrsGraphData with the right hand side Graph.

int* & Epetra_CrsGraph::operator[] int  Loc  )  [inline]
 

Inlined bracket operator for fast access to data. (Const and Non-const versions).

No error checking and dangerous for optimization purposes.

Parameters:
Loc (In) - Local row.
Returns:
reference to pointer to locally indexed Loc row in matrix.

int Epetra_CrsGraph::OptimizeStorage  ) 
 

Eliminates memory that is used for construction. Make consecutive row index sections contiguous.

Returns:
Integer error code, set to 0 if successful. Returns 1 if data is shared.

int Epetra_CrsGraph::ReferenceCount  )  const [inline]
 

Returns the reference count of CrsGraphData.

(Intended for testing purposes.)

int Epetra_CrsGraph::RemoveGlobalIndices int  Row  ) 
 

Remove all indices from a specified global row of the matrix.

Parameters:
In Row - Global row number of indices.
Returns:
Integer error code, set to 0 if successful. Returns 1 if data is shared.

int Epetra_CrsGraph::RemoveGlobalIndices int  GlobalRow,
int  NumIndices,
int *  Indices
 

Remove a list of elements from a specified global row of the matrix.

Parameters:
In Row - Global row number of indices.
In NumIndices - Number of Indices.
In Indices - Global column indices to remove.
Returns:
Integer error code, set to 0 if successful. Returns 1 if data is shared.

int Epetra_CrsGraph::RemoveMyIndices int  Row  ) 
 

Remove all indices from a specified local row of the matrix.

Parameters:
In Row - Local row number of indices.
Returns:
Integer error code, set to 0 if successful. Returns 1 if data is shared.

int Epetra_CrsGraph::RemoveMyIndices int  LocalRow,
int  NumIndices,
int *  Indices
 

Remove a list of elements from a specified local row of the matrix.

Parameters:
In Row - Local row number of indices.
In NumIndices - Number of Indices.
In Indices - Local column indices to remove.
Returns:
Integer error code, set to 0 if successful. Returns 1 if data is shared.

int Epetra_CrsGraph::RemoveRedundantIndices  ) 
 

Removes any redundant column indices in the rows of the graph.

Returns:
Integer error code, set to 0 if successful. Returns 1 if data is shared.

int Epetra_CrsGraph::ReplaceRowMap const Epetra_BlockMap newmap  ) 
 

Replaces the current RowMap with the user-specified map object, but only if currentmap->PointSameAs(newmap) is true. This is a collective function. Returns 0 if map is replaced, -1 if not.

int Epetra_CrsGraph::SortIndices  ) 
 

Sort column indices, row-by-row, in ascending order.

Returns:
Integer error code, set to 0 if successful. Returns 1 if data is shared.


The documentation for this class was generated from the following file:
Generated on Thu Sep 18 12:43:15 2008 for Epetra by doxygen 1.3.9.1