Zoltan2
Public Types | Public Member Functions
Zoltan2::MeshAdapter< User > Class Template Reference

MeshAdapter defines the interface for mesh input. More...

#include <Zoltan2_MeshAdapter.hpp>

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

List of all members.

Public Types

typedef InputTraits< User >::zgid_t zgid_t
typedef InputTraits< User >
::scalar_t 
scalar_t
typedef InputTraits< User >::part_t part_t

Public Member Functions

enum BaseAdapterType adapterType () const
 Returns the type of adapter.
virtual ~MeshAdapter ()
 Destructor.
 MeshAdapter ()
virtual size_t getLocalNumOf (MeshEntityType etype) const =0
 Returns the number of mesh entities on this process.
virtual void getIDsViewOf (MeshEntityType etype, zgid_t const *&Ids) const =0
 Provide a pointer to this process' identifiers.
virtual int getNumWeightsPerOf (MeshEntityType etype) const
 Return the number of weights per entity.
virtual void getWeightsViewOf (MeshEntityType etype, const scalar_t *&weights, int &stride, int idx=0) const
 Provide a pointer to one of the number of this process' optional entity weights.
virtual int getDimension () const
 Return dimension of the entity coordinates, if any.
virtual void getCoordinatesViewOf (MeshEntityType etype, const scalar_t *&coords, int &stride, int coordDim) const
 Provide a pointer to one dimension of entity coordinates.
virtual bool availAdjs (MeshEntityType source, MeshEntityType target) const
 Returns whether a first adjacency combination is available.
virtual size_t getLocalNumAdjs (MeshEntityType source, MeshEntityType target) const
 Returns the number of first adjacencies on this process.
virtual void getAdjsView (MeshEntityType source, MeshEntityType target, const lno_t *&offsets, const zgid_t *&adjacencyIds) const
 Sets pointers to this process' mesh first adjacencies.
virtual bool avail2ndAdjs (MeshEntityType sourcetarget, MeshEntityType through) const
 Returns whether a second adjacency combination is available.
virtual size_t getLocalNum2ndAdjs (MeshEntityType sourcetarget, MeshEntityType through) const
 Returns the number of second adjacencies on this process.
virtual void get2ndAdjsView (MeshEntityType sourcetarget, MeshEntityType through, const lno_t *&offsets, const zgid_t *&adjacencyIds) const
 Sets pointers to this process' mesh second adjacencies.
virtual int getNumWeightsPer2ndAdj (MeshEntityType sourcetarget, MeshEntityType through) const
 Returns the number (0 or greater) of weights per second adjacency.
virtual void get2ndAdjWeightsView (MeshEntityType sourcetarget, MeshEntityType through, const scalar_t *&weights, int &stride, int idx) const
 Provide a pointer to the second adjacency weights, if any.
enum MeshEntityType getPrimaryEntityType () const
 Returns the entity to be partitioned, ordered, colored, etc.
enum MeshEntityType getAdjacencyEntityType () const
 Returns the entity that describes adjacencies between the entities to be partitioned, ordered, colored, etc. That is, a primaryEntityType that contains an adjacencyEntityType are adjacent. KDD: Is Adjacency a poorly chosen name here? Is it overloaded? VJL: Maybe.
enum MeshEntityType getSecondAdjacencyEntityType () const
 Returns the entity that describes second adjacencies between the entities to be partitioned, ordered, colored, etc. That is, two primaryEntityType that share a secondAdjacencyEntityType are adjacent.
void setEntityTypes (std::string ptypestr, std::string atypestr, std::string satypestr)
 Sets the primary, adjacency, and second adjacency entity types. Called by algorithm based on parameter values in parameter list from application. Also sets primaryEntityType, adjacencyEntityType, and secondAdjacencyEntityType to something reasonable: primaryEntityType not adjacencyEntityType or secondAdjacencyEntityType. KDD: Is Adjacency a poorly chosen name here? Is it overloaded? VJL: Maybe.
virtual bool useDegreeAsWeightOf (MeshEntityType etype, int idx) const
 Optional method allowing the idx-th weight of entity type etype to be set as the number of neighbors (the degree) of the entity Default is false; user can change in his MeshAdapter implementation.
size_t getLocalNumIDs () const
 Returns the number of objects on this process.
void getIDsView (const zgid_t *&Ids) const
 Provide a pointer to this process' identifiers.
int getNumWeightsPerID () 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.
void getWeightsView (const scalar_t *&wgt, int &stride, int idx=0) const
 Provide pointer to a weight array with stride.
void getCoordinatesView (const scalar_t *&coords, int &stride, int coordDim) const
bool useDegreeAsWeight (int idx) const
void getPartsView (const part_t *&inputPart) const
 Provide pointer to an array containing the input part assignment for each ID. The input part information may be used for re-partitioning to reduce data movement, or for mapping parts to processes. Adapters may return NULL for this pointer (the default behavior); if NULL is returned, algorithms will assume the rank.
template<typename Adapter >
void applyPartitioningSolution (const User &in, User *&out, const PartitioningSolution< Adapter > &solution) const
 Apply a PartitioningSolution to an input.

Detailed Description

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

MeshAdapter defines the interface for mesh input.

Adapter objects provide access for Zoltan2 to the user's data. Many built-in adapters are already defined for common data structures, such as Tpetra and Epetra objects and C-language pointers to arrays.

Data types:

See IdentifierTraits to understand why the user's global ID type (zgid_t) may differ from that used by Zoltan2 (gno_t).

The Kokkos node type can be safely ignored.

The template parameter User is a user-defined data type which, through a traits mechanism, provides the actual data types with which the Zoltan2 library will be compiled. User may be the actual class or structure used by application to represent a vector, or it may be the helper class BasicUserTypes. See InputTraits for more information.

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 105 of file Zoltan2_MeshAdapter.hpp.


Member Typedef Documentation

template<typename User>
typedef InputTraits<User>::zgid_t Zoltan2::BaseAdapter< User >::zgid_t [inherited]
template<typename User>
typedef InputTraits<User>::scalar_t Zoltan2::BaseAdapter< User >::scalar_t [inherited]
template<typename User>
typedef InputTraits<User>::part_t Zoltan2::BaseAdapter< User >::part_t [inherited]

Constructor & Destructor Documentation

template<typename User>
virtual Zoltan2::MeshAdapter< User >::~MeshAdapter ( ) [inline, virtual]

Destructor.

Definition at line 134 of file Zoltan2_MeshAdapter.hpp.

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

Definition at line 138 of file Zoltan2_MeshAdapter.hpp.


Member Function Documentation

template<typename User>
enum BaseAdapterType Zoltan2::MeshAdapter< User >::adapterType ( ) const [inline, virtual]

Returns the type of adapter.

Implements Zoltan2::BaseAdapter< User >.

Definition at line 130 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
virtual size_t Zoltan2::MeshAdapter< User >::getLocalNumOf ( MeshEntityType  etype) const [pure virtual]

Returns the number of mesh entities on this process.

Implemented in Zoltan2::PamgenMeshAdapter< User >.

template<typename User>
virtual void Zoltan2::MeshAdapter< User >::getIDsViewOf ( MeshEntityType  etype,
zgid_t const *&  Ids 
) const [pure virtual]

Provide a pointer to this process' identifiers.

Parameters:
Idswill on return point to the list of the global Ids for this process.

Implemented in Zoltan2::PamgenMeshAdapter< User >.

template<typename User>
virtual int Zoltan2::MeshAdapter< User >::getNumWeightsPerOf ( MeshEntityType  etype) const [inline, virtual]

Return the number of weights per entity.

Returns:
the count of weights, zero or more per entity. If the number of weights is zero, then we assume that the entities are equally weighted.

Definition at line 163 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
virtual void Zoltan2::MeshAdapter< User >::getWeightsViewOf ( MeshEntityType  etype,
const scalar_t *&  weights,
int &  stride,
int  idx = 0 
) const [inline, virtual]

Provide a pointer to one of the number of this process' optional entity weights.

Parameters:
weightson return will contain a list of the weights for the number specified.
strideon return will indicate the stride of the weights list.

The k'th weight is located at weights[stride*k].

Parameters:
idxis a value ranging from zero to one less than getNumWeightsPerEntityID()

Reimplemented in Zoltan2::PamgenMeshAdapter< User >.

Definition at line 178 of file Zoltan2_MeshAdapter.hpp.

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

Return dimension of the entity coordinates, if any.

Some algorithms can partition mesh entities using geometric coordinate information

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

Reimplemented in Zoltan2::PamgenMeshAdapter< User >.

Definition at line 195 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
virtual void Zoltan2::MeshAdapter< User >::getCoordinatesViewOf ( MeshEntityType  etype,
const scalar_t *&  coords,
int &  stride,
int  coordDim 
) const [inline, virtual]

Provide a pointer to one dimension of entity coordinates.

Parameters:
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].
coordDimis a value from 0 to one less than getEntityCoordinateDimension() specifying which dimension is being provided in the coords list.

Reimplemented in Zoltan2::PamgenMeshAdapter< User >.

Definition at line 207 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
virtual bool Zoltan2::MeshAdapter< User >::availAdjs ( MeshEntityType  source,
MeshEntityType  target 
) const [inline, virtual]

Returns whether a first adjacency combination is available.

Reimplemented in Zoltan2::PamgenMeshAdapter< User >.

Definition at line 218 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
virtual size_t Zoltan2::MeshAdapter< User >::getLocalNumAdjs ( MeshEntityType  source,
MeshEntityType  target 
) const [inline, virtual]

Returns the number of first adjacencies on this process.

Reimplemented in Zoltan2::PamgenMeshAdapter< User >.

Definition at line 225 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
virtual void Zoltan2::MeshAdapter< User >::getAdjsView ( MeshEntityType  source,
MeshEntityType  target,
const lno_t *&  offsets,
const zgid_t *&  adjacencyIds 
) const [inline, virtual]

Sets pointers to this process' mesh first adjacencies.

Parameters:
source
offsetsis an array of size getLocalNumOf() + 1. The first adjacency Ids for Ids[i] (returned in getIDsViewOf()) begin at adjacencyIds[offsets[i]]. The last element of offsets is the size of the adjacencyIds array.
adjacencyIdson return will point to the global first adjacency Ids for each entity.

Definition at line 239 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
virtual bool Zoltan2::MeshAdapter< User >::avail2ndAdjs ( MeshEntityType  sourcetarget,
MeshEntityType  through 
) const [inline, virtual]

Returns whether a second adjacency combination is available.

Reimplemented in Zoltan2::PamgenMeshAdapter< User >.

Definition at line 250 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
virtual size_t Zoltan2::MeshAdapter< User >::getLocalNum2ndAdjs ( MeshEntityType  sourcetarget,
MeshEntityType  through 
) const [inline, virtual]

Returns the number of second adjacencies on this process.

Parameters will specify algorithm options: balance_entity_type==MeshEntityType, adjacency_through==MeshEntityType

Reimplemented in Zoltan2::PamgenMeshAdapter< User >.

Definition at line 259 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
virtual void Zoltan2::MeshAdapter< User >::get2ndAdjsView ( MeshEntityType  sourcetarget,
MeshEntityType  through,
const lno_t *&  offsets,
const zgid_t *&  adjacencyIds 
) const [inline, virtual]

Sets pointers to this process' mesh second adjacencies.

Parameters:
sourcetarget
offsetsis an array of size getLocalNumOf() + 1. The second adjacency Ids for Ids[i] (returned in getIDsViewOf()) begin at adjacencyIds[offsets[i]]. The last element of offsets is the size of the adjacencyIds array.
adjacencyIdson return will point to the global second adjacency Ids for each entity.

Definition at line 274 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
virtual int Zoltan2::MeshAdapter< User >::getNumWeightsPer2ndAdj ( MeshEntityType  sourcetarget,
MeshEntityType  through 
) const [inline, virtual]

Returns the number (0 or greater) of weights per second adjacency.

Definition at line 287 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
virtual void Zoltan2::MeshAdapter< User >::get2ndAdjWeightsView ( MeshEntityType  sourcetarget,
MeshEntityType  through,
const scalar_t *&  weights,
int &  stride,
int  idx 
) const [inline, virtual]

Provide a pointer to the second adjacency weights, if any.

Parameters:
weightsis the list of weights of the given number for the second adjacencies returned in get2ndAdjsView().
strideThe k'th weight is located at weights[stride*k]
idxranges from zero to one less than getNumWeightsPer2ndAdj().

Definition at line 299 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
enum MeshEntityType Zoltan2::MeshAdapter< User >::getPrimaryEntityType ( ) const [inline]

Returns the entity to be partitioned, ordered, colored, etc.

Definition at line 319 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
enum MeshEntityType Zoltan2::MeshAdapter< User >::getAdjacencyEntityType ( ) const [inline]

Returns the entity that describes adjacencies between the entities to be partitioned, ordered, colored, etc. That is, a primaryEntityType that contains an adjacencyEntityType are adjacent. KDD: Is Adjacency a poorly chosen name here? Is it overloaded? VJL: Maybe.

Definition at line 330 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
enum MeshEntityType Zoltan2::MeshAdapter< User >::getSecondAdjacencyEntityType ( ) const [inline]

Returns the entity that describes second adjacencies between the entities to be partitioned, ordered, colored, etc. That is, two primaryEntityType that share a secondAdjacencyEntityType are adjacent.

Definition at line 339 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
void Zoltan2::MeshAdapter< User >::setEntityTypes ( std::string  ptypestr,
std::string  atypestr,
std::string  satypestr 
) [inline]

Sets the primary, adjacency, and second adjacency entity types. Called by algorithm based on parameter values in parameter list from application. Also sets primaryEntityType, adjacencyEntityType, and secondAdjacencyEntityType to something reasonable: primaryEntityType not adjacencyEntityType or secondAdjacencyEntityType. KDD: Is Adjacency a poorly chosen name here? Is it overloaded? VJL: Maybe.

Definition at line 351 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
virtual bool Zoltan2::MeshAdapter< User >::useDegreeAsWeightOf ( MeshEntityType  etype,
int  idx 
) const [inline, virtual]

Optional method allowing the idx-th weight of entity type etype to be set as the number of neighbors (the degree) of the entity Default is false; user can change in his MeshAdapter implementation.

Definition at line 417 of file Zoltan2_MeshAdapter.hpp.

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

Returns the number of objects on this process.

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

Implements Zoltan2::BaseAdapter< User >.

Definition at line 424 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
void Zoltan2::MeshAdapter< User >::getIDsView ( const zgid_t *&  Ids) const [inline, virtual]

Provide a pointer to this process' identifiers.

Parameters:
Idswill on return point to the list of the global Ids for this process.

Implements Zoltan2::BaseAdapter< User >.

Definition at line 428 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
int Zoltan2::MeshAdapter< User >::getNumWeightsPerID ( ) 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::BaseAdapter< User >.

Definition at line 432 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
void Zoltan2::MeshAdapter< User >::getWeightsView ( const scalar_t *&  wgt,
int &  stride,
int  idx = 0 
) const [inline, virtual]

Provide pointer to a weight array with stride.

Parameters:
wgton return a pointer to the weights for this idx
strideon return, the value such that the nth weight should be found at wgt[n*stride] .
idxthe weight index, zero or greater

Implements Zoltan2::BaseAdapter< User >.

Definition at line 436 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
void Zoltan2::MeshAdapter< User >::getCoordinatesView ( const scalar_t *&  coords,
int &  stride,
int  coordDim 
) const [inline]

Definition at line 440 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
bool Zoltan2::MeshAdapter< User >::useDegreeAsWeight ( int  idx) const [inline]

Definition at line 446 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
void Zoltan2::BaseAdapter< User >::getPartsView ( const part_t *&  inputPart) const [inline, inherited]

Provide pointer to an array containing the input part assignment for each ID. The input part information may be used for re-partitioning to reduce data movement, or for mapping parts to processes. Adapters may return NULL for this pointer (the default behavior); if NULL is returned, algorithms will assume the rank.

Parameters:
inputParton return a pointer to input part numbers

Definition at line 148 of file Zoltan2_Adapter.hpp.

template<typename User>
template<typename Adapter >
void Zoltan2::BaseAdapter< User >::applyPartitioningSolution ( const User &  in,
User *&  out,
const PartitioningSolution< Adapter > &  solution 
) const [inline, inherited]

Apply a PartitioningSolution to an input.

This is not a required part of the InputAdapter interface. However if the Caller calls a Problem method to redistribute data, it needs this method to perform the redistribution.

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 Adapter.
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 local Ids in the new partition.

Reimplemented in Zoltan2::XpetraCrsGraphAdapter< User, UserCoord >, Zoltan2::XpetraCrsMatrixAdapter< User, UserCoord >, Zoltan2::XpetraRowMatrixAdapter< User, UserCoord >, and Zoltan2::XpetraMultiVectorAdapter< User >.

Definition at line 174 of file Zoltan2_Adapter.hpp.


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