Zoltan2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
Zoltan2::MeshAdapter< User > Class Template Referenceabstract

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]

Public Member Functions

enum BaseAdapterType adapterType () const
 Returns the type of adapter. More...
 
virtual ~MeshAdapter ()
 Destructor. More...
 
 MeshAdapter ()
 
virtual bool areEntityIDsUnique (MeshEntityType etype) const
 Provide a pointer to the entity topology types. More...
 
virtual size_t getLocalNumOf (MeshEntityType etype) const =0
 Returns the global number of mesh entities of MeshEntityType. More...
 
virtual void getIDsViewOf (MeshEntityType etype, gno_t const *&Ids) const =0
 Provide a pointer to this process' identifiers. More...
 
virtual void getTopologyViewOf (MeshEntityType etype, enum EntityTopologyType const *&Types) const
 Provide a pointer to the entity topology types. More...
 
virtual int getNumWeightsPerOf (MeshEntityType etype) const
 Return the number of weights per entity. More...
 
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. More...
 
virtual int getDimension () const
 Return dimension of the entity coordinates, if any. More...
 
virtual void getCoordinatesViewOf (MeshEntityType etype, const scalar_t *&coords, int &stride, int coordDim) const
 Provide a pointer to one dimension of entity coordinates. More...
 
virtual bool availAdjs (MeshEntityType source, MeshEntityType target) const
 Returns whether a first adjacency combination is available. More...
 
virtual size_t getLocalNumAdjs (MeshEntityType source, MeshEntityType target) const
 Returns the number of first adjacencies on this process. More...
 
virtual void getAdjsView (MeshEntityType source, MeshEntityType target, const offset_t *&offsets, const gno_t *&adjacencyIds) const
 Sets pointers to this process' mesh first adjacencies. More...
 
virtual bool avail2ndAdjs (MeshEntityType sourcetarget, MeshEntityType through) const
 Returns whether a second adjacency combination is available. If combination is not available in the MeshAdapter, Zoltan2 will compute them, using A^T A, where A is matrix of first adjacencies. More...
 
virtual size_t getLocalNum2ndAdjs (MeshEntityType sourcetarget, MeshEntityType through) const
 if avail2ndAdjs(), returns the number of second adjacencies on this process. More...
 
virtual void get2ndAdjsView (MeshEntityType sourcetarget, MeshEntityType through, const offset_t *&offsets, const gno_t *&adjacencyIds) const
 if avail2ndAdjs(), set pointers to this process' second adjacencies More...
 
virtual int getNumWeightsPer2ndAdj (MeshEntityType sourcetarget, MeshEntityType through) const
 Returns the number (0 or greater) of weights per second adjacency. Note: second-adjacency weights may be used only if avail2ndAdjs(). More...
 
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. Note: second-adjacency weights may be used only if avail2ndAdjs(). More...
 
enum MeshEntityType getPrimaryEntityType () const
 Returns the entity to be partitioned, ordered, colored, etc. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
size_t getLocalNumIDs () const
 Returns the number of objects on this process. More...
 
void getIDsView (const gno_t *&Ids) const
 Provide a pointer to this process' identifiers. More...
 
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. Default is zero weights per ID. More...
 
void getWeightsView (const scalar_t *&wgt, int &stride, int idx=0) const
 Provide pointer to a weight array with stride. More...
 
void getCoordinatesView (const scalar_t *&coords, int &stride, int coordDim) const
 
bool useDegreeAsWeight (int idx) const
 
- Public Member Functions inherited from Zoltan2::BaseAdapter< User >
virtual ~BaseAdapter ()
 Destructor. More...
 
virtual void getIDsKokkosView (Kokkos::View< gno_t * > &) const
 Provide a pointer to this process' identifiers. More...
 
virtual void getWeightsKokkosView (Kokkos::View< scalar_t * > &, int=0) const
 Provide pointer to a weight View. More...
 
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. More...
 
template<typename Adapter >
void applyPartitioningSolution (const User &in, User *&out, const PartitioningSolution< Adapter > &solution) const
 Apply a PartitioningSolution to an input. More...
 
- Public Member Functions inherited from Zoltan2::BaseAdapterRoot
virtual ~BaseAdapterRoot ()
 

Additional Inherited Members

- Public Types inherited from Zoltan2::BaseAdapter< User >
typedef InputTraits< User >::lno_t lno_t
 
typedef InputTraits< User >::gno_t gno_t
 
typedef InputTraits< User >
::scalar_t 
scalar_t
 
typedef InputTraits< User >::part_t part_t
 
typedef InputTraits< User >
::offset_t 
offset_t
 
- Protected Member Functions inherited from Zoltan2::BaseAdapter< User >
void generateWeightFileOnly (const char *fileprefix, const Teuchos::Comm< int > &comm) const
 

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:

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

Constructor & Destructor Documentation

template<typename User>
virtual Zoltan2::MeshAdapter< User >::~MeshAdapter ( )
inlinevirtual

Destructor.

Definition at line 143 of file Zoltan2_MeshAdapter.hpp.

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

Definition at line 147 of file Zoltan2_MeshAdapter.hpp.

Member Function Documentation

template<typename User>
enum BaseAdapterType Zoltan2::MeshAdapter< User >::adapterType ( ) const
inlinevirtual

Returns the type of adapter.

Implements Zoltan2::BaseAdapter< User >.

Definition at line 139 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
virtual bool Zoltan2::MeshAdapter< User >::areEntityIDsUnique ( MeshEntityType  etype) const
inlinevirtual

Provide a pointer to the entity topology types.

Parameters
Typeswill on return point to the list of entity topology types for this process.

Reimplemented in Zoltan2::PamgenMeshAdapter< User >.

Definition at line 158 of file Zoltan2_MeshAdapter.hpp.

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

Returns the global number of mesh entities of MeshEntityType.

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,
gno_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 void Zoltan2::MeshAdapter< User >::getTopologyViewOf ( MeshEntityType  etype,
enum EntityTopologyType const *&  Types 
) const
inlinevirtual

Provide a pointer to the entity topology types.

Parameters
Typeswill on return point to the list of entity topology types for this process.

Reimplemented in Zoltan2::PamgenMeshAdapter< User >.

Definition at line 184 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
virtual int Zoltan2::MeshAdapter< User >::getNumWeightsPerOf ( MeshEntityType  etype) const
inlinevirtual

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 196 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
inlinevirtual

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

template<typename User>
virtual int Zoltan2::MeshAdapter< User >::getDimension ( ) const
inlinevirtual

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 228 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
inlinevirtual

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

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

Returns whether a first adjacency combination is available.

Reimplemented in Zoltan2::PamgenMeshAdapter< User >.

Definition at line 251 of file Zoltan2_MeshAdapter.hpp.

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

Returns the number of first adjacencies on this process.

Reimplemented in Zoltan2::PamgenMeshAdapter< User >.

Definition at line 258 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
virtual void Zoltan2::MeshAdapter< User >::getAdjsView ( MeshEntityType  source,
MeshEntityType  target,
const offset_t *&  offsets,
const gno_t *&  adjacencyIds 
) const
inlinevirtual

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.

Reimplemented in Zoltan2::PamgenMeshAdapter< User >.

Definition at line 272 of file Zoltan2_MeshAdapter.hpp.

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

Returns whether a second adjacency combination is available. If combination is not available in the MeshAdapter, Zoltan2 will compute them, using A^T A, where A is matrix of first adjacencies.

Reimplemented in Zoltan2::PamgenMeshAdapter< User >.

Definition at line 285 of file Zoltan2_MeshAdapter.hpp.

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

if avail2ndAdjs(), returns the number of second adjacencies on this process.

Reimplemented in Zoltan2::PamgenMeshAdapter< User >.

Definition at line 294 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
virtual void Zoltan2::MeshAdapter< User >::get2ndAdjsView ( MeshEntityType  sourcetarget,
MeshEntityType  through,
const offset_t *&  offsets,
const gno_t *&  adjacencyIds 
) const
inlinevirtual

if avail2ndAdjs(), set pointers to this process' 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.

Reimplemented in Zoltan2::PamgenMeshAdapter< User >.

Definition at line 310 of file Zoltan2_MeshAdapter.hpp.

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

Returns the number (0 or greater) of weights per second adjacency. Note: second-adjacency weights may be used only if avail2ndAdjs().

Definition at line 323 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
inlinevirtual

Provide a pointer to the second adjacency weights, if any. Note: second-adjacency weights may be used only if avail2ndAdjs().

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 336 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 352 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.

Definition at line 361 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 370 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.

Definition at line 380 of file Zoltan2_MeshAdapter.hpp.

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

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.

Reimplemented in Zoltan2::PamgenMeshAdapter< User >.

Definition at line 446 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
size_t Zoltan2::MeshAdapter< User >::getLocalNumIDs ( ) const
inlinevirtual

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::BaseAdapterRoot.

Definition at line 453 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
void Zoltan2::MeshAdapter< User >::getIDsView ( const gno_t *&  ids) const
inlinevirtual

Provide a pointer to this process' identifiers.

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

Reimplemented from Zoltan2::BaseAdapter< User >.

Definition at line 457 of file Zoltan2_MeshAdapter.hpp.

template<typename User>
int Zoltan2::MeshAdapter< User >::getNumWeightsPerID ( ) const
inlinevirtual

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. Default is zero weights per ID.

Reimplemented from Zoltan2::BaseAdapterRoot.

Definition at line 461 of file Zoltan2_MeshAdapter.hpp.

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

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 This function must be implemented in derived adapter if getNumWeightsPerID > 0. This function should not be called if getNumWeightsPerID is zero.

Reimplemented from Zoltan2::BaseAdapter< User >.

Definition at line 465 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 469 of file Zoltan2_MeshAdapter.hpp.

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

Definition at line 475 of file Zoltan2_MeshAdapter.hpp.


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