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

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

#include <Zoltan2_XpetraCrsGraphInput.hpp>

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

List of all members.

Public Member Functions

 ~XpetraCrsGraphInput ()
 Destructor.
 XpetraCrsGraphInput (const RCP< const User > &ingraph)
 Constructor for graph with no weights or coordinates.
 XpetraCrsGraphInput (const RCP< const User > &ingraph, vector< const scalar_t * > &vWeights, vector< int > &vWeightStrides, vector< const scalar_t * > &eWeights, vector< int > &eWeightStrides)
 Constructor for graph with weights but no coordinates.
 XpetraCrsGraphInput (const RCP< const User > &ingraph, vector< const scalar_t * > &vWeights, vector< int > &vWeightStrides, vector< const scalar_t * > &eWeights, vector< int > &eWeightStrides, vector< const scalar_t * > &coords, vector< int > &coordStrides)
 Constructor for graph with weights and vertex coordinates.
void setVertexWeights (int dim, const scalar_t *val, int stride)
 Provide a pointer to one dimension of the vertex weights.
void setEdgeWeights (int dim, const scalar_t *val, int stride)
 Provide a pointer to one dimension of the edge weights.
void setVertexCoordinates (int dim, const scalar_t *val, int stride)
 Provide a pointer to one dimension of the vertex coordinates.
RCP< const xgraph_tgetXpetraGraph () const
 Access to Xpetra-wrapped user's graph.
RCP< const User > getUserGraph () const
 Access to user's graph.
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 getLocalNumberOfVertices () const
 Returns the number vertices on this process.
size_t getLocalNumberOfEdges () const
 Returns the number edges on this process.
int getVertexWeightDimension () const
 Returns the dimension (0 or greater) of vertex weights.
int getEdgeWeightDimension () const
 Returns the dimension (0 or greater) of edge weights.
int getCoordinateDimension () const
 Returns the dimension of the geometry, if any.
size_t getVertexListView (const gid_t *&ids, const lno_t *&offsets, const gid_t *&edgeId) const
 Sets pointers to this process' graph entries.
size_t getVertexWeights (int dim, const scalar_t *&weights, int &stride) const
 Provide a pointer to the vertex weights, if any.
size_t getEdgeWeights (int dim, const scalar_t *&weights, int &stride) const
 Provide a pointer to the edge weights, if any.
size_t getVertexCoordinates (int dim, const scalar_t *&coords, int &stride) const
 Provide a pointer to one dimension of vertex coordinates.
template<typename Adapter >
size_t applyPartitioningSolution (const User &in, User *&out, const PartitioningSolution< Adapter > &solution) const
 Repartition a graph that has the same structure as the graph that instantiated this input adapter.
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::XpetraCrsGraphInput< User >

Provides access for Zoltan2 to Xpetra::CrsGraph data.

Todo:

test for memory alloc failure when we resize a vector

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

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 84 of file Zoltan2_XpetraCrsGraphInput.hpp.


Constructor & Destructor Documentation

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

Destructor.

Definition at line 101 of file Zoltan2_XpetraCrsGraphInput.hpp.

template<typename User >
Zoltan2::XpetraCrsGraphInput< User >::XpetraCrsGraphInput ( const RCP< const User > &  ingraph)

Constructor for graph with no weights or coordinates.

Parameters:
ingraphthe Epetra_CrsGraph, Tpetra::CrsGraph or Xpetra::CrsGraph

Most input adapters do not have RCPs in their interface. This one does because the user is obviously a Trilinos user.

Definition at line 409 of file Zoltan2_XpetraCrsGraphInput.hpp.

template<typename User >
Zoltan2::XpetraCrsGraphInput< User >::XpetraCrsGraphInput ( const RCP< const User > &  ingraph,
vector< const scalar_t * > &  vWeights,
vector< int > &  vWeightStrides,
vector< const scalar_t * > &  eWeights,
vector< int > &  eWeightStrides 
)

Constructor for graph with weights but no coordinates.

Parameters:
ingraphthe Epetra_CrsGraph, Tpetra::CrsGraph or Xpetra::CrsGraph
vWeightsa list of pointers to vertex weights. The number of weights per graph vertex is assumed to be vWeights.size().
vWeightStridesa list of strides for the vWeights. The weight for weight dimension n for vertex k should be found at vWeights[n][vWeightStrides[n] * k]. If vWeightStrides.size() is zero, it is assumed all strides are one.
eWeightsa list of pointers to edge weights. The number of weights per edge is assumed to be eWeights.size().
eWeightStridesa list of strides for the eWeights. The weight for weight dimension n for edge k should be found at eWeights[n][eWeightStrides[n] * k]. If eWeightStrides.size() is zero, it is assumed all strides are one.

The order of the vertex weights should match the order that vertices appear in the input data structure.

       TheGraph->getRowMap()->getNodeElementList()

The order of the edge weights should follow the order that the the vertices and edges appear in the input data structure.

By vertex:

       TheGraph->getRowMap()->getNodeElementList()

Then by vertex neighbor:

       TheGraph->getLocalRowView(vertexNum, neighborList);

Most input adapters do not have RCPs in their interface. This one does because the user is obviously a Trilinos user.

Definition at line 425 of file Zoltan2_XpetraCrsGraphInput.hpp.

template<typename User >
Zoltan2::XpetraCrsGraphInput< User >::XpetraCrsGraphInput ( const RCP< const User > &  ingraph,
vector< const scalar_t * > &  vWeights,
vector< int > &  vWeightStrides,
vector< const scalar_t * > &  eWeights,
vector< int > &  eWeightStrides,
vector< const scalar_t * > &  coords,
vector< int > &  coordStrides 
)

Constructor for graph with weights and vertex coordinates.

Parameters:
ingraphthe Epetra_CrsGraph, Tpetra::CrsGraph or Xpetra::CrsGraph
vWeightsa list of pointers to vertex weights. The number of weights per graph vertex is assumed to be vWeights.size().
vWeightStridesa list of strides for the vWeights. The weight for weight dimension n for vertex k should be found at vWeights[n][vWeightStrides[n] * k]. If vWeightStrides.size() is zero, it is assumed all strides are one.
eWeightsa list of pointers to edge weights. The number of weights per edge is assumed to be eWeights.size().
eWeightStridesa list of strides for the eWeights. The weight for weight dimension n for edge k should be found at eWeights[n][eWeightStrides[n] * k]. If eWeightStrides.size() is zero, it is assumed all strides are one.
coordsa list of pointers to vertex coordinates. The coordinate dimension is assumed to be coords.size().
coordStridesa list of strides for the coords. The coordinate for dimension n for vertex k should be found at coords[n][coordStrides[n] * k]. If coordStrides.size() is zero, it is assumed all strides are one.

The order of the vertex weights and coordinates should coorespond to the order that vertices appear in the input data structure.

       TheGraph->getRowMap()->getNodeElementList()

The order of the edge weights should follow the order that the the vertices and edges appear in the input data structure.

By vertex:

       TheGraph->getRowMap()->getNodeElementList()

Then by vertex neighbor:

       TheGraph->getLocalRowView(vertexNum, neighborList);

Most input adapters do not have RCPs in their interface. This one does because the user is obviously a Trilinos user.

Definition at line 443 of file Zoltan2_XpetraCrsGraphInput.hpp.


Member Function Documentation

template<typename User>
void Zoltan2::XpetraCrsGraphInput< User >::setVertexWeights ( int  dim,
const scalar_t *  val,
int  stride 
)

Provide a pointer to one dimension of the vertex weights.

Parameters:
dimA number from 0 to one less than vertex weight dimension specified in the constructor.
valA pointer to the weights for dimension dim.
strideA stride for the val array. If is k, then val[n * k] is the weight for the n th vertex for dimension .

The order of the vertex weights should match the order that vertices appear in the input data structure.

       TheGraph->getRowMap()->getNodeElementList()
template<typename User>
void Zoltan2::XpetraCrsGraphInput< User >::setEdgeWeights ( int  dim,
const scalar_t *  val,
int  stride 
)

Provide a pointer to one dimension of the edge weights.

Parameters:
dimA number from 0 to one less than edge weight dimension specified in the constructor.
valA pointer to the weights for dimension dim.
strideA stride for the val array. If is k, then val[n * k] is the weight for the n th edge for dimension .

The order of the edge weights should follow the order that the the vertices and edges appear in the input data structure.

By vertex:

       TheGraph->getRowMap()->getNodeElementList()

Then by vertex neighbor:

       TheGraph->getLocalRowView(vertexNum, neighborList);
template<typename User>
void Zoltan2::XpetraCrsGraphInput< User >::setVertexCoordinates ( int  dim,
const scalar_t *  val,
int  stride 
)

Provide a pointer to one dimension of the vertex coordinates.

Parameters:
dimA number from 0 to one less than vertex coordinate dimension specified in the constructor.
valA pointer to the coordinates for dimension dim.
strideA stride for the val array. If is k, then val[n * k] is the coordinate for the n th vertex.

The order of the vertex coordinates should coorespond to the order that vertices appear in the input data structure.

       TheGraph->getRowMap()->getNodeElementList()
template<typename User>
RCP<const xgraph_t> Zoltan2::XpetraCrsGraphInput< User >::getXpetraGraph ( ) const [inline]

Access to Xpetra-wrapped user's graph.

Definition at line 267 of file Zoltan2_XpetraCrsGraphInput.hpp.

template<typename User>
RCP<const User> Zoltan2::XpetraCrsGraphInput< User >::getUserGraph ( ) const [inline]

Access to user's graph.

Definition at line 274 of file Zoltan2_XpetraCrsGraphInput.hpp.

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

Returns a descriptive name that identifies the concrete adapter.

Implements Zoltan2::InputAdapter< User >.

Definition at line 283 of file Zoltan2_XpetraCrsGraphInput.hpp.

template<typename User>
size_t Zoltan2::XpetraCrsGraphInput< 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 285 of file Zoltan2_XpetraCrsGraphInput.hpp.

template<typename User>
int Zoltan2::XpetraCrsGraphInput< 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 287 of file Zoltan2_XpetraCrsGraphInput.hpp.

template<typename User>
size_t Zoltan2::XpetraCrsGraphInput< 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 289 of file Zoltan2_XpetraCrsGraphInput.hpp.

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

Returns the number vertices on this process.

Implements Zoltan2::GraphInput< User >.

Definition at line 298 of file Zoltan2_XpetraCrsGraphInput.hpp.

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

Returns the number edges on this process.

Implements Zoltan2::GraphInput< User >.

Definition at line 302 of file Zoltan2_XpetraCrsGraphInput.hpp.

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

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

Implements Zoltan2::GraphInput< User >.

Definition at line 306 of file Zoltan2_XpetraCrsGraphInput.hpp.

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

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

Implements Zoltan2::GraphInput< User >.

Definition at line 310 of file Zoltan2_XpetraCrsGraphInput.hpp.

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

Returns the dimension of the geometry, if any.

Some algorithms can use geometric vertex coordinate information if it is present.

Implements Zoltan2::GraphInput< User >.

Definition at line 314 of file Zoltan2_XpetraCrsGraphInput.hpp.

template<typename User>
size_t Zoltan2::XpetraCrsGraphInput< User >::getVertexListView ( const gid_t *&  vertexIds,
const lno_t *&  offsets,
const gid_t *&  edgeIds 
) const [inline, virtual]

Sets pointers to this process' graph entries.

Parameters:
vertexIdswill on return a pointer to vertex global Ids
offsetsis an array of size numVertices + 1. The edge Ids for vertexId[i] begin at edgeIds[offsets[i]]. The last element of offsets is the size of the edgeIds array.
edgeIdson return will point to the global edge Ids for for each vertex.
Returns:
The number of ids in the vertexIds list.

Zoltan2 does not copy your data. The data pointed to by vertexIds, offsets and edgeIds must remain valid for the lifetime of this InputAdapter.

Implements Zoltan2::GraphInput< User >.

Definition at line 318 of file Zoltan2_XpetraCrsGraphInput.hpp.

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

Provide a pointer to the vertex weights, if any.

Parameters:
weightDimranges from zero to one less than getVertexWeightDimension().
weightsis the list of weights of the given dimension for the vertices returned in getVertexListView(). If weights for this dimension are to be uniform for all vertices 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 vertices 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::GraphInput< User >.

Definition at line 334 of file Zoltan2_XpetraCrsGraphInput.hpp.

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

Provide a pointer to the edge weights, if any.

Parameters:
weightDimranges from zero to one less than getEdgeWeightDimension().
weightsis the list of weights of the given dimension for the edges returned in getVertexListView().
strideThe k'th weight is located at weights[stride*k]
Returns:
The number of weights listed, which should be the same as the number of edges in getVertexListView().

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

Implements Zoltan2::GraphInput< User >.

Definition at line 345 of file Zoltan2_XpetraCrsGraphInput.hpp.

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

Provide a pointer to one dimension of vertex coordinates.

Parameters:
coordDimis a value from 0 to one less than getCoordinateDimension() specifying which dimension is being provided in the coords list.
coordspoints to a list of coordinate values for the dimension.
stridedescribes 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.

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

Implements Zoltan2::GraphInput< User >.

Definition at line 356 of file Zoltan2_XpetraCrsGraphInput.hpp.

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

Repartition a graph that has the same structure as the graph that instantiated this input adapter.

Reimplemented from Zoltan2::GraphInput< User >.

Definition at line 540 of file Zoltan2_XpetraCrsGraphInput.hpp.

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

Returns the type of adapter.

Implements Zoltan2::InputAdapter< User >.

Definition at line 111 of file Zoltan2_GraphInput.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: