Zoltan2 Version of the Day
Public Member Functions | Static Public Member Functions
Zoltan2::XpetraCrsMatrixInput< User > Class Template Reference

Provides access for Zoltan2 to Xpetra::CrsMatrix data. More...

#include <Zoltan2_XpetraCrsMatrixInput.hpp>

Inheritance diagram for Zoltan2::XpetraCrsMatrixInput< User >:
Inheritance graph
[legend]
Collaboration diagram for Zoltan2::XpetraCrsMatrixInput< User >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ~XpetraCrsMatrixInput ()
 Destructor.
 XpetraCrsMatrixInput (const RCP< const User > &inmatrix, int coordDim=0, int weightDim=0)
 Constructor.
void setRowCoordinates (int dim, const scalar_t *coordVal, int stride)
 Specify geometric coordinates for matrix rows.
void setRowWeights (int dim, const scalar_t *weightVal, int stride)
 Specify a weight for each row.
void setRowWeightIsNumberOfNonZeros (int dim)
 Specify whether or not row weights for a dimension should be the count of row non zeros.
const RCP< const xmatrix_t > & getMatrix () const
 Access to Xpetra-wrapped user matrix.
string inputAdapterName () const
 Returns a descriptive name that identifies the concrete adapter.
size_t getLocalNumberOfObjects () const
 Returns the number of objects in the input.
int getNumberOfWeightsPerObject () const
 Returns the number of weights per object. Number of weights per object should be zero or greater. If zero, then it is assumed that all objects are equally weighted.
size_t getObjectWeights (int dim, const scalar_t *&wgt, int &stride) const
 Provide pointer to a weight array with stride.
size_t getLocalNumRows () const
 Returns the number rows on this process.
global_size_t getGlobalNumRows () const
size_t getLocalNumColumns () const
 Returns the number columns on this process.
global_size_t getGlobalNumColumns () const
size_t getRowListView (const gid_t *&rowIds, const lno_t *&offsets, const gid_t *&colIds) const
 Sets pointers to this process' matrix entries. If this optional call is defined in the adapter, it can save a memory copy of application data.
int getRowWeightDimension () const
 Returns the dimension (0 or greater) of row weights.
size_t getRowWeights (int dim, const scalar_t *&weights, int &stride) const
 Provide a pointer to the row weights, if any.
bool getRowWeightIsNumberOfNonZeros (int dim) const
 Is the row weight for a dimension the number of row non-zeros?
int getCoordinateDimension () const
 Returns the dimension of the geometry, if any.
size_t getRowCoordinates (int dim, const scalar_t *&coords, int &stride) const
 Provide a pointer to one dimension of row coordinates.
template<typename Adapter >
size_t applyPartitioningSolution (const User &in, User *&out, const PartitioningSolution< Adapter > &solution) const
 Apply the solution to a partitioning problem to an input.
enum InputAdapterType inputAdapterType () const
 Returns the type of adapter.

Static Public Member Functions

static string inputAdapterTypeName (InputAdapterType iaType)
 Returns the name of the input adapter.

Detailed Description

template<typename User>
class Zoltan2::XpetraCrsMatrixInput< User >

Provides access for Zoltan2 to Xpetra::CrsMatrix data.

Todo:

we assume FillComplete has been called. We should support objects that are not FillCompleted.

add RowMatrix

The template parameter is the user's input object:

The scalar_t type, representing use data such as matrix values, is used by Zoltan2 for weights, coordinates, part sizes and quality metrics. Some User types (like Tpetra::CrsMatrix) have an inherent scalar type, and some (like Tpetra::CrsGraph) do not. For such objects, the scalar type is set by Zoltan2 to float. If you wish to change it to double, set the second template parameter to double.

Definition at line 86 of file Zoltan2_XpetraCrsMatrixInput.hpp.


Constructor & Destructor Documentation

template<typename User>
Zoltan2::XpetraCrsMatrixInput< User >::~XpetraCrsMatrixInput ( ) [inline]

Destructor.

Definition at line 102 of file Zoltan2_XpetraCrsMatrixInput.hpp.

template<typename User >
Zoltan2::XpetraCrsMatrixInput< User >::XpetraCrsMatrixInput ( const RCP< const User > &  inmatrix,
int  coordDim = 0,
int  weightDim = 0 
)

Constructor.

Parameters:
inmatrixThe users Epetra, Tpetra, or Xpetra CrsMatrix object
coordDimSome algorithms can use row geometric information if it is available. If coordinates will be supplied in setRowCoordinates() then provide the dimension of the coordinates here.
weightDimIf row weights will be provided in setRowWeights(), the set weightDim to the number of weights per row.

Definition at line 279 of file Zoltan2_XpetraCrsMatrixInput.hpp.


Member Function Documentation

template<typename User >
void Zoltan2::XpetraCrsMatrixInput< User >::setRowCoordinates ( int  dim,
const scalar_t *  coordVal,
int  stride 
)

Specify geometric coordinates for matrix rows.

Parameters:
dimA value between zero and one less that the coordDim argument to the constructor.
coordValA pointer to the coordinates. A stride to be used in reading the values. The dimension dim coordinate for row should be found at coordVal[k*stride].

The order of coordinates should correspond to the order of rows returned by

       theMatrix->getRowMap()->getNodeElementList();

Definition at line 327 of file Zoltan2_XpetraCrsMatrixInput.hpp.

template<typename User >
void Zoltan2::XpetraCrsMatrixInput< User >::setRowWeights ( int  dim,
const scalar_t *  weightVal,
int  stride 
)

Specify a weight for each row.

Parameters:
dimA value between zero and one less that the weightDim argument to the constructor.
weightValA pointer to the weights for this dimension. A stride to be used in reading the values. The dimension dim weight for row should be found at weightVal[k*stride].

The order of weights should correspond to the order of rows returned by

       theMatrix->getRowMap()->getNodeElementList();

Definition at line 343 of file Zoltan2_XpetraCrsMatrixInput.hpp.

template<typename User >
void Zoltan2::XpetraCrsMatrixInput< User >::setRowWeightIsNumberOfNonZeros ( int  dim)

Specify whether or not row weights for a dimension should be the count of row non zeros.

Parameters:
dimIf true, Zoltan2 will automatically us the number of non zeros in an row as the row's weight for dimension dim.

Definition at line 359 of file Zoltan2_XpetraCrsMatrixInput.hpp.

template<typename User>
const RCP<const xmatrix_t>& Zoltan2::XpetraCrsMatrixInput< User >::getMatrix ( ) const [inline]

Access to Xpetra-wrapped user matrix.

Definition at line 159 of file Zoltan2_XpetraCrsMatrixInput.hpp.

template<typename User>
string Zoltan2::XpetraCrsMatrixInput< User >::inputAdapterName ( ) const [inline, virtual]

Returns a descriptive name that identifies the concrete adapter.

Implements Zoltan2::InputAdapter< User >.

Definition at line 168 of file Zoltan2_XpetraCrsMatrixInput.hpp.

template<typename User>
size_t Zoltan2::XpetraCrsMatrixInput< User >::getLocalNumberOfObjects ( ) const [inline, virtual]

Returns the number of objects in the input.

Objects may be coordinates, graph vertices, matrix rows, etc. They are the objects to be partitioned, ordered, or colored.

Implements Zoltan2::InputAdapter< User >.

Definition at line 170 of file Zoltan2_XpetraCrsMatrixInput.hpp.

template<typename User>
int Zoltan2::XpetraCrsMatrixInput< User >::getNumberOfWeightsPerObject ( ) const [inline, virtual]

Returns the number of weights per object. Number of weights per object should be zero or greater. If zero, then it is assumed that all objects are equally weighted.

Implements Zoltan2::InputAdapter< User >.

Definition at line 172 of file Zoltan2_XpetraCrsMatrixInput.hpp.

template<typename User>
size_t Zoltan2::XpetraCrsMatrixInput< User >::getObjectWeights ( int  dim,
const scalar_t *&  wgt,
int &  stride 
) const [inline, virtual]

Provide pointer to a weight array with stride.

Parameters:
dimthe weight dimension, zero or greater
wgton return a pointer to the weights for this dimension
strideon return, the value such that the nth weight should be found at wgt[n*stride] .
Returns:
the length of the wgt array, which should be at least equal to getLocalNumberOfObjects() * stride .

Implements Zoltan2::InputAdapter< User >.

Definition at line 174 of file Zoltan2_XpetraCrsMatrixInput.hpp.

template<typename User>
size_t Zoltan2::XpetraCrsMatrixInput< User >::getLocalNumRows ( ) const [inline, virtual]

Returns the number rows on this process.

Implements Zoltan2::MatrixInput< User >.

Definition at line 183 of file Zoltan2_XpetraCrsMatrixInput.hpp.

template<typename User>
global_size_t Zoltan2::XpetraCrsMatrixInput< User >::getGlobalNumRows ( ) const [inline]

Definition at line 187 of file Zoltan2_XpetraCrsMatrixInput.hpp.

template<typename User>
size_t Zoltan2::XpetraCrsMatrixInput< User >::getLocalNumColumns ( ) const [inline, virtual]

Returns the number columns on this process.

Implements Zoltan2::MatrixInput< User >.

Definition at line 191 of file Zoltan2_XpetraCrsMatrixInput.hpp.

template<typename User>
global_size_t Zoltan2::XpetraCrsMatrixInput< User >::getGlobalNumColumns ( ) const [inline]

Definition at line 195 of file Zoltan2_XpetraCrsMatrixInput.hpp.

template<typename User>
size_t Zoltan2::XpetraCrsMatrixInput< User >::getRowListView ( const gid_t *&  rowIds,
const lno_t *&  offsets,
const gid_t *&  colIds 
) const [inline, virtual]

Sets pointers to this process' matrix entries. If this optional call is defined in the adapter, it can save a memory copy of application data.

Parameters:
rowIdswill on return a pointer to row global Ids
offsetsis an array of size numRows + 1. The column Ids for rowId[i] begin at colIds[offsets[i]]. The last element of offsets is the size of the colIds array.
colIdson return will point to the global column Ids for the non-zeros for each row.
Returns:
The number of ids in the rowIds list.

Implements Zoltan2::MatrixInput< User >.

Definition at line 199 of file Zoltan2_XpetraCrsMatrixInput.hpp.

template<typename User>
int Zoltan2::XpetraCrsMatrixInput< User >::getRowWeightDimension ( ) const [inline, virtual]

Returns the dimension (0 or greater) of row weights.

Row weights may be used when partitioning matrix rows. If no weights are provided, and rowWeightIsNumberOfNonZeros() is false, then it is assumed rows are equally weighted.

Implements Zoltan2::MatrixInput< User >.

Definition at line 211 of file Zoltan2_XpetraCrsMatrixInput.hpp.

template<typename User>
size_t Zoltan2::XpetraCrsMatrixInput< User >::getRowWeights ( int  weightDim,
const scalar_t *&  weights,
int &  stride 
) const [inline, virtual]

Provide a pointer to the row weights, if any.

Parameters:
weightDimranges from zero to one less than getRowWeightDimension().
weightsis the list of weights of the given dimension for the rows returned in getRowListView(). If weights for this dimension are to be uniform for all rows in the global problem, the weights should be a NULL pointer.
strideThe k'th weight is located at weights[stride*k]
Returns:
The number of weights listed, which should be at least the local number of rows times the stride for non-uniform weights, zero otherwise.

Zoltan2 does not copy your data. The data pointed to by weights must remain valid for the lifetime of this InputAdapter.

Implements Zoltan2::MatrixInput< User >.

Definition at line 216 of file Zoltan2_XpetraCrsMatrixInput.hpp.

template<typename User>
bool Zoltan2::XpetraCrsMatrixInput< User >::getRowWeightIsNumberOfNonZeros ( int  dim) const [inline, virtual]

Is the row weight for a dimension the number of row non-zeros?

Parameters:
dima value between zero and getRowWeightDimension() that specifies the weight dimension that will be equal to the number of row non-zeros.

If you wish for Zoltan2 to automatically assign for one of the weight dimensions for each row a weight that is equal to the number of non-zeros in the row, then return true here. Otherwise return false.

Implements Zoltan2::MatrixInput< User >.

Definition at line 228 of file Zoltan2_XpetraCrsMatrixInput.hpp.

template<typename User>
int Zoltan2::XpetraCrsMatrixInput< User >::getCoordinateDimension ( ) const [inline, virtual]

Returns the dimension of the geometry, if any.

Some algorithms can use geometric row or column coordinate information if it is present. Given the problem parameters supplied by the user, it may make sense to use row coordinates or it may make sense to use column coordinates.

Implements Zoltan2::MatrixInput< User >.

Definition at line 230 of file Zoltan2_XpetraCrsMatrixInput.hpp.

template<typename User>
size_t Zoltan2::XpetraCrsMatrixInput< User >::getRowCoordinates ( int  coordDim,
const scalar_t *&  coords,
int &  stride 
) const [inline, virtual]

Provide a pointer to one dimension of row coordinates.

Parameters:
coordDim[input] is a value from 0 to one less than getCoordinateDimension() specifying which dimension is being provided in the coords list.
coords[output] points to a list of coordinate values for the dimension. The order of coords should correspond to the order of rowIds in getRowListView().
stride[output] describes the layout of the coordinate values in the coords list. If stride is one, then the ith coordinate value is coords[i], but if stride is two, then the ith coordinate value is coords[2*i].
Returns:
The length of the coords list. This may be more than getLocalNumberOfVertices() because the stride may be more than one. It may also be zero if column coordinates but not row coordinates are supplied.

Zoltan2 does not copy your data. The data pointed to by coords must remain valid for the lifetime of this InputAdapter.

Implements Zoltan2::MatrixInput< User >.

Definition at line 232 of file Zoltan2_XpetraCrsMatrixInput.hpp.

template<typename User >
template<typename Adapter >
size_t Zoltan2::XpetraCrsMatrixInput< User >::applyPartitioningSolution ( const User &  in,
User *&  out,
const PartitioningSolution< Adapter > &  solution 
) const

Apply the solution to a partitioning problem to an input.

This is not a required part of the MatrixInput interface.

Parameters:
inAn input object with a structure and assignment of of global Ids to processes that matches that of the input data that instantiated this InputAdapter.
outOn return this should point to a newly created object with the specified partitioning.
solutionThe Solution object created by a Problem should be supplied as the third argument. It must have been templated on user data that has the same global ID distribution as this user data.
Returns:
Returns the number of Ids in the new partitioning.

Reimplemented from Zoltan2::MatrixInput< User >.

Definition at line 370 of file Zoltan2_XpetraCrsMatrixInput.hpp.

template<typename User >
enum InputAdapterType Zoltan2::MatrixInput< User >::inputAdapterType ( ) const [inline, virtual, inherited]

Returns the type of adapter.

Implements Zoltan2::InputAdapter< User >.

Definition at line 118 of file Zoltan2_MatrixInput.hpp.

template<typename User >
string Zoltan2::InputAdapter< User >::inputAdapterTypeName ( InputAdapterType  iaType) [static, inherited]

Returns the name of the input adapter.

Definition at line 134 of file Zoltan2_InputAdapter.hpp.


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