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

MeshInput defines the interface for mesh input adapters. More...

#include <Zoltan2_MeshInput.hpp>

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

List of all members.

Public Member Functions

enum InputAdapterType inputAdapterType () const
 Returns the type of adapter.
virtual ~MeshInput ()
 Destructor.
enum virtual entityType size_t getGlobalNumEntityIDs (entityType etype) const =0
 Return the global number of IDs across all processes.
virtual size_t getLocalNumEntityIDs (entityType etype) const =0
 Returns the number of mesh entities on this process.
virtual int getNumWeightsPerEntityID (entityType etype) const =0
 Return the number of weights per entity.
virtual size_t getLocalEntityIDsView (entityType etype, gid_t const *&Ids) const =0
 Provide a pointer to this process' identifiers.
virtual size_t getLocalEntityIDsWeightsView (entityType etype, const scalar_t *&weights, int &stride, int number) const =0
 Provide a pointer to one of the number of this process' optional entity weights.
virtual size_t getEntityIDWeights (gid_t id, scalar_t *wgts) const =0
 Copy the weights for a specific entity into array provided by Zoltan2.
virtual int getEntityCoordinateDimension (entityType etype) const =0
 Return dimension of the entity coordinates, if any.
virtual size_t getLocalEntityCoordinatesView (entityType etype, const scalar_t *&coords, int &stride, int coordDim) const =0
 Provide a pointer to one dimension of entity coordinates.
virtual size_t getEntityCoordinates (gid_t id, scalar_t *coords) const =0
 Copy the coordinates for a specific ID into array provided by Zoltan2.
virtual bool availAdjs (entityType source, entityType target)
 Returns whether a first adjacency combination is available.
virtual size_t getGlobalNumAdjs (entityType source, entityType target) const =0
 Returns the global number of edges across all processes Need to define whether an undirected edge A<->B is counted as one edge or as two edges A->B and B->A. TODO: Do we need this function?
virtual size_t getLocalNumAdjs (entityType source, entityType target) const =0
 Returns the number of first adjacencies on this process.
virtual size_t getEntityNumAdjs (entityType source, entityType target, gid_t id) const =0
 Returns the number of first adjacencies for this entity.
virtual size_t getLocalAdjsView (entityType source, entityType target, const lno_t *&offsets, const gid_t *&adjacencyIds) const =0
 Sets pointers to this process' mesh first adjacencies.
virtual size_t getEntityAdjs (entityType source, entityType target, gid_t id, gid_t *adjacencyIds) const =0
 Copy all the first adjacency IDs for a specific entity into arrays provided by Zoltan2.
virtual bool avail2ndAdjs (entityType sourcetarget, entityType through)
 Returns whether a second adjacency combination is available.
virtual size_t getGlobalNum2ndAdjs (entityType sourcetarget, entityType through) const =0
 Return the global number of entity second adjacencies across all processes TODO: Do we need this function?
virtual size_t getLocalNum2ndAdjs (entityType sourcetarget, entityType through) const =0
 Returns the number of second adjacencies on this process.
virtual lno_t getEntityNum2ndAdjs (entityType sourcetarget, entityType through, gid_t id) const =0
 Return number of second adjacencies to specific entity.
virtual size_t getLocal2ndAdjsView (entityType sourcetarget, entityType through, const lno_t *&offsets, const gid_t *&adjacencyIds) const =0
 Sets pointers to this process' mesh second adjacencies.
virtual size_t getEntity2ndAdjs (entityType sourcetarget, entityType through, gid_t id, gid_t *nborIds) const =0
 Copy the second adjacency IDs for all adjacencies incident to a specific entity into array provided by Zoltan2.
virtual int getNumWeightsPer2ndAdj (entityType sourcetarger, entityType through) const =0
 Returns the number (0 or greater) of weights per second adjacency.
virtual size_t getLocal2ndAdjWeightsView (entityType sourcetarget, entityType through, const scalar_t *&weights, int &stride, int number) const =0
 Provide a pointer to the second adjacency weights, if any.
virtual size_t getEntity2ndAdjWeights (entityType sourcetarget, entityType through, gid_t id, scalar_t *ewgts)
 Copy the second adjacency weights incident to a specific entity id into array provided by Zoltan2.
template<typename Adapter >
size_t applyPartitioningSolution (const User &in, User *&out, const PartitioningSolution< Adapter > &solution) const
 Apply a partitioning problem solution to an input.
virtual string inputAdapterName () const =0
 Returns a descriptive name that identifies the concrete adapter.
virtual size_t getLocalNumberOfObjects () const =0
 Returns the number of objects in the input.
virtual int getNumberOfWeightsPerObject () const =0
 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.
virtual size_t getObjectWeights (int dim, const scalar_t *&wgt, int &stride) const =0
 Provide pointer to a weight array with stride.

Static Public Member Functions

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

Detailed Description

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

MeshInput defines the interface for mesh input adapters.

InputAdapter 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 (gid_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 96 of file Zoltan2_MeshInput.hpp.


Constructor & Destructor Documentation

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

Destructor.

Definition at line 114 of file Zoltan2_MeshInput.hpp.


Member Function Documentation

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

Returns the type of adapter.

Implements Zoltan2::InputAdapter< User >.

Definition at line 110 of file Zoltan2_MeshInput.hpp.

template<typename User >
enum virtual entityType size_t Zoltan2::MeshInput< User >::getGlobalNumEntityIDs ( entityType  etype) const [pure virtual]

Return the global number of IDs across all processes.

template<typename User >
virtual size_t Zoltan2::MeshInput< User >::getLocalNumEntityIDs ( entityType  etype) const [pure virtual]

Returns the number of mesh entities on this process.

template<typename User >
virtual int Zoltan2::MeshInput< User >::getNumWeightsPerEntityID ( entityType  etype) const [pure 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.
template<typename User >
virtual size_t Zoltan2::MeshInput< User >::getLocalEntityIDsView ( entityType  etype,
gid_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.
Returns:
The number of ids in the Ids list.

Some algorithms can partition a simple list of weighted identifiers with no geometry or topology provided.

template<typename User >
virtual size_t Zoltan2::MeshInput< User >::getLocalEntityIDsWeightsView ( entityType  etype,
const scalar_t *&  weights,
int &  stride,
int  number 
) const [pure 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. If weights for this number are to be uniform for all entities in the global problem, the weights should be a NULL pointer.
strideon return will indicate the stride of the weights list.

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

Parameters:
numberis a value ranging from zero to one less than getNumWeightsPerEntityID()
Returns:
The number of values in the weights list. This may be greater than the number of entities, because the stride may be greater than one.

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

template<typename User >
virtual size_t Zoltan2::MeshInput< User >::getEntityIDWeights ( gid_t  id,
scalar_t *  wgts 
) const [pure virtual]

Copy the weights for a specific entity into array provided by Zoltan2.

Parameters:
idspecific entity. Works only if id is local to this process.
wgtsarray provided by Zoltan2. wgts has size getNumWeightsPerID().
Returns:
not sure what is needed, if anything.
template<typename User >
virtual int Zoltan2::MeshInput< User >::getEntityCoordinateDimension ( entityType  etype) const [pure 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.

template<typename User >
virtual size_t Zoltan2::MeshInput< User >::getLocalEntityCoordinatesView ( entityType  etype,
const scalar_t *&  coords,
int &  stride,
int  coordDim 
) const [pure 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.
Returns:
The length of the coords list. This may be more than getLocalNumEntityIDs() because the stride may be more than one.

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

template<typename User >
virtual size_t Zoltan2::MeshInput< User >::getEntityCoordinates ( gid_t  id,
scalar_t *  coords 
) const [pure virtual]

Copy the coordinates for a specific ID into array provided by Zoltan2.

Parameters:
idspecific ID. Works only if id is local to this process.
coordsarray provided by Zoltan2.
Returns:
not sure what is needed, if anything.
template<typename User >
virtual bool Zoltan2::MeshInput< User >::availAdjs ( entityType  source,
entityType  target 
) [virtual]

Returns whether a first adjacency combination is available.

template<typename User >
virtual size_t Zoltan2::MeshInput< User >::getGlobalNumAdjs ( entityType  source,
entityType  target 
) const [pure virtual]

Returns the global number of edges across all processes Need to define whether an undirected edge A<->B is counted as one edge or as two edges A->B and B->A. TODO: Do we need this function?

template<typename User >
virtual size_t Zoltan2::MeshInput< User >::getLocalNumAdjs ( entityType  source,
entityType  target 
) const [pure virtual]

Returns the number of first adjacencies on this process.

template<typename User >
virtual size_t Zoltan2::MeshInput< User >::getEntityNumAdjs ( entityType  source,
entityType  target,
gid_t  id 
) const [pure virtual]

Returns the number of first adjacencies for this entity.

Parameters:
source
template<typename User >
virtual size_t Zoltan2::MeshInput< User >::getLocalAdjsView ( entityType  source,
entityType  target,
const lno_t *&  offsets,
const gid_t *&  adjacencyIds 
) const [pure virtual]

Sets pointers to this process' mesh first adjacencies.

Parameters:
source
offsetsis an array of size getLocalNumEntityIDs() + 1. The first adjacency Ids for Ids[i] (returned in getLocalEntityIDsView()) 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.
Returns:
The number of ids in the adjacencyIds list.

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

template<typename User >
virtual size_t Zoltan2::MeshInput< User >::getEntityAdjs ( entityType  source,
entityType  target,
gid_t  id,
gid_t *  adjacencyIds 
) const [pure virtual]

Copy all the first adjacency IDs for a specific entity into arrays provided by Zoltan2.

Parameters:
source
idspecific entity. Works only if id is local to this process.
adjacencyIdsarray provided by Zoltan2.
Returns:
not sure what is needed, if anything.
template<typename User >
virtual bool Zoltan2::MeshInput< User >::avail2ndAdjs ( entityType  sourcetarget,
entityType  through 
) [virtual]

Returns whether a second adjacency combination is available.

template<typename User >
virtual size_t Zoltan2::MeshInput< User >::getGlobalNum2ndAdjs ( entityType  sourcetarget,
entityType  through 
) const [pure virtual]

Return the global number of entity second adjacencies across all processes TODO: Do we need this function?

template<typename User >
virtual size_t Zoltan2::MeshInput< User >::getLocalNum2ndAdjs ( entityType  sourcetarget,
entityType  through 
) const [pure virtual]

Returns the number of second adjacencies on this process.

Some algorithms can partition a graph of mesh entities

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

template<typename User >
virtual lno_t Zoltan2::MeshInput< User >::getEntityNum2ndAdjs ( entityType  sourcetarget,
entityType  through,
gid_t  id 
) const [pure virtual]

Return number of second adjacencies to specific entity.

Parameters:
sourcetarget
idspecific entity. Works only if id is local to this process.
Returns:
number of second adjacendies to entity.
template<typename User >
virtual size_t Zoltan2::MeshInput< User >::getLocal2ndAdjsView ( entityType  sourcetarget,
entityType  through,
const lno_t *&  offsets,
const gid_t *&  adjacencyIds 
) const [pure virtual]

Sets pointers to this process' mesh second adjacencies.

Parameters:
sourcetarget
offsetsis an array of size getLocalNumEntityIDs() + 1. The second adjacency Ids for Ids[i] (returned in getLocalEntityIDsView()) 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.
Returns:
The number of ids in the adjacencyIds list.

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

template<typename User >
virtual size_t Zoltan2::MeshInput< User >::getEntity2ndAdjs ( entityType  sourcetarget,
entityType  through,
gid_t  id,
gid_t *  nborIds 
) const [pure virtual]

Copy the second adjacency IDs for all adjacencies incident to a specific entity into array provided by Zoltan2.

Parameters:
sourcetarget
idspecific entity. Works only if id is local to this process.
nborIdsarray provided by Zoltan2.
Returns:
not sure what is needed, if anything.
template<typename User >
virtual int Zoltan2::MeshInput< User >::getNumWeightsPer2ndAdj ( entityType  sourcetarger,
entityType  through 
) const [pure virtual]

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

template<typename User >
virtual size_t Zoltan2::MeshInput< User >::getLocal2ndAdjWeightsView ( entityType  sourcetarget,
entityType  through,
const scalar_t *&  weights,
int &  stride,
int  number 
) const [pure 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 getLocal2ndAdjsView().
strideThe k'th weight is located at weights[stride*k]
numberranges from zero to one less than getNumWeightsPer2ndAdj().
Returns:
The number of weights listed, which should be the same as the number of adjacencies in getLocal2ndAdjsView().

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

template<typename User >
virtual size_t Zoltan2::MeshInput< User >::getEntity2ndAdjWeights ( entityType  sourcetarget,
entityType  through,
gid_t  id,
scalar_t *  ewgts 
) [virtual]

Copy the second adjacency weights incident to a specific entity id into array provided by Zoltan2.

Parameters:
sourcetarget
idspecific entity id. Works only if id is local to this process.
ewgtsarray provided by Zoltan2.
Returns:
not sure what is needed, if anything.
template<typename User >
template<typename Adapter >
size_t Zoltan2::MeshInput< User >::applyPartitioningSolution ( const User &  in,
User *&  out,
const PartitioningSolution< Adapter > &  solution 
) const [inline]

Apply a partitioning problem solution to an input.

This is not a required part of the MeshInput 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 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 local Ids in the new partitioning.

Definition at line 407 of file Zoltan2_MeshInput.hpp.

template<typename User >
virtual string Zoltan2::InputAdapter< User >::inputAdapterName ( ) const [pure virtual, inherited]
template<typename User >
virtual size_t Zoltan2::InputAdapter< User >::getLocalNumberOfObjects ( ) const [pure virtual, inherited]

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.

Implemented in Zoltan2::BasicCoordinateInput< User >, Zoltan2::BasicIdentifierInput< User >, Zoltan2::BasicVectorInput< User >, Zoltan2::XpetraCrsGraphInput< User >, Zoltan2::XpetraCrsMatrixInput< User >, Zoltan2::XpetraMultiVectorInput< User >, Zoltan2::XpetraRowMatrixInput< User >, and Zoltan2::XpetraVectorInput< User >.

template<typename User >
virtual int Zoltan2::InputAdapter< User >::getNumberOfWeightsPerObject ( ) const [pure virtual, inherited]

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.

Implemented in Zoltan2::BasicCoordinateInput< User >, Zoltan2::BasicIdentifierInput< User >, Zoltan2::BasicVectorInput< User >, Zoltan2::XpetraCrsGraphInput< User >, Zoltan2::XpetraCrsMatrixInput< User >, Zoltan2::XpetraMultiVectorInput< User >, Zoltan2::XpetraRowMatrixInput< User >, and Zoltan2::XpetraVectorInput< User >.

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

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 .

Implemented in Zoltan2::BasicCoordinateInput< User >, Zoltan2::BasicIdentifierInput< User >, Zoltan2::BasicVectorInput< User >, Zoltan2::XpetraCrsGraphInput< User >, Zoltan2::XpetraCrsMatrixInput< User >, Zoltan2::XpetraMultiVectorInput< User >, Zoltan2::XpetraRowMatrixInput< User >, and Zoltan2::XpetraVectorInput< User >.

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: