Zoltan2 Version of the Day

BasicVectorInput represents a vector (plus optional weights) supplied by the user as pointers to strided arrays. More...
#include <Zoltan2_BasicVectorInput.hpp>
Public Member Functions  
BasicVectorInput (lno_t numIds, const gid_t *ids, const scalar_t *elements, int elementStride=1)  
Constructor for one vector with no weights.  
BasicVectorInput (lno_t numIds, const gid_t *ids, const scalar_t *elements, int elementStride, vector< const scalar_t * > &weights, vector< int > &weightStrides)  
Constructor for one vector.  
BasicVectorInput (lno_t numIds, const gid_t *ids, vector< const scalar_t * > &elements, vector< int > &elementStrides, vector< const scalar_t * > &weights, vector< int > &weightStrides)  
Constructor for a set of vectors.  
~BasicVectorInput ()  
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.  
int  getNumberOfVectors () const 
Return the number of vectors (typically one).  
int  getNumberOfWeights () const 
Return the number of weights per vector element. Number of weights per element should be zero or greater. If zero, it is assumed each vector is equally weighted.  
size_t  getLocalLength () const 
Return the length of the portion of the vector on this process.  
size_t  getGlobalLength () const 
size_t  getVector (const gid_t *&ids, const scalar_t *&element, int &stride) const 
Provide a pointer to the vertex elements. If the VectorInput represents more than one vector, vector zero is implied.  
size_t  getVector (int i, const gid_t *&ids, const scalar_t *&element, int &stride) const 
Provide a pointer to the elements of the specified vector.  
size_t  getVectorWeights (int dimension, const scalar_t *&weights, int &stride) const 
Provide a pointer to the weights corresponding to the elements returned in getVector().  
enum InputAdapterType  inputAdapterType () const 
Returns the type of adapter.  
template<typename Adapter >  
size_t  applyPartitioningSolution (User &in, User *&out, const PartitioningSolution< Adapter > &solution) const 
Apply a PartitioningSolution to an input.  
Static Public Member Functions  
static string  inputAdapterTypeName (InputAdapterType iaType) 
Returns the name of the input adapter. 
BasicVectorInput represents a vector (plus optional weights) supplied by the user as pointers to strided arrays.
Input adapters provide access for Zoltan2 to the user's data. The methods in the interface must be defined by users. Many builtin adapters are already defined for common data structures, such as Tpetra and Epetra objects and Clanguage pointers to arrays.
Data types:
scalar_t
is the data type for weights and vector element values. lno_t
is the integral data type used by Zoltan2 for local indices and local counts. gno_t
is the integral data type used by Zoltan2 to represent global indices and global counts. gid_t
is the data type used by the application for global Ids. If the application's global Id data type is a Teuchos Ordinal, then gid_t
and gno_t
are the same. Otherwise, the application global Ids will be mapped to Teuchos Ordinals for use by Zoltan2 internally. (Teuchos Ordinals are those data types for which traits are defined in Trilinos/packages/teuchos/src/Teuchos_OrdinalTraits.hpp.) node_t
is a sub class of KokkosClassic::StandardNodeMemoryModel, which is used to optimize performance on manycore and multicore architectures. If you don't use Kokkos, you can ignore this data type.The template parameter (User
) is a C++ class type which provides the actual data types with which the Zoltan2 library will be compiled, through a Traits mechanism. User
may be the actual class used by application to represent a vector, or it may be the empty helper class BasicUserTypes
with which a Zoltan2 user can easily supply the data types for the library.
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
.
BasicVectorInput may be a single vector or a set of corresponding vectors which have with the same global identifiers and the same distribution across processes.
Global identifiers should be optional. If the user gives us gids in the input adapter, we will include them in the solution.
Is there any reason to specify coordinates for vector elements?
Definition at line 103 of file Zoltan2_BasicVectorInput.hpp.
Zoltan2::BasicVectorInput< User >::BasicVectorInput  (  lno_t  numIds, 
const gid_t *  ids,  
const scalar_t *  elements,  
int  elementStride = 1 

)  [inline] 
Constructor for one vector with no weights.
numIds  the local length of the vector 
ids  pointer to the global ids of the local vector elements 
elements  pointer to the elements corresponding to the ids 
elementStride  the k'th element is at elements[k*elementStride] and elements is of lenth at least numIds * elementStride . 
The values pointed to the arguments must remain valid for the lifetime of this InputAdapter.
Definition at line 131 of file Zoltan2_BasicVectorInput.hpp.
Zoltan2::BasicVectorInput< User >::BasicVectorInput  (  lno_t  numIds, 
const gid_t *  ids,  
const scalar_t *  elements,  
int  elementStride,  
vector< const scalar_t * > &  weights,  
vector< int > &  weightStrides  
)  [inline] 
Constructor for one vector.
numIds  the local length of the vector 
ids  pointer to the global ids of the local vector elements 
elements  pointer to the elements corresponding to the ids 
elementStrides  the k'th element is at elements[k*elementStride] and elements is of lenth numIds * elementStride 
weights  a list of pointers to arrays of weights. The number of weights per element is assumed to be weights.size() . 
weightStrides  a list of strides for the weights . The weight for weight dimension n for ids [k] should be found at weights[n][weightStrides[n] * k] . If weightStrides.size() is zero, it is assumed all strides are one 
The values pointed to the arguments must remain valid for the lifetime of this InputAdapter.
Definition at line 167 of file Zoltan2_BasicVectorInput.hpp.
Zoltan2::BasicVectorInput< User >::BasicVectorInput  (  lno_t  numIds, 
const gid_t *  ids,  
vector< const scalar_t * > &  elements,  
vector< int > &  elementStrides,  
vector< const scalar_t * > &  weights,  
vector< int > &  weightStrides  
)  [inline] 
Constructor for a set of vectors.
numIds  the local length of the vectors 
ids  a pointer to the global ids of the local vector elements 
elements  a list of pointers to the vector elements corresponding to the numIds ids. The number of vectors assumed to be elements.size() . 
elementStrides  The strides for the elements list. The vector element for vector n for ids [k] should be found at elements[n][elementStrides[n] * k] . If elementStrides.size() is zero, it is assumed all strides are one. 
weights  a list of pointers to arrays of weights. The number of weights per vector element is assumed to be weights.size() . 
weightStrides  a list of strides for the weights . The weight for weight dimension n for ids [k] should be found at weights[n][weightStrides[n] * k] . If weightStrides.size() is zero, it is assumed all strides are one. 
The values pointed to the arguments must remain valid for the lifetime of this InputAdapter.
Definition at line 208 of file Zoltan2_BasicVectorInput.hpp.
Zoltan2::BasicVectorInput< User >::~BasicVectorInput  (  )  [inline] 
Destructor
Definition at line 221 of file Zoltan2_BasicVectorInput.hpp.
string Zoltan2::BasicVectorInput< User >::inputAdapterName  (  )  const [inline, virtual] 
Returns a descriptive name that identifies the concrete adapter.
Implements Zoltan2::InputAdapter< User >.
Definition at line 227 of file Zoltan2_BasicVectorInput.hpp.
size_t Zoltan2::BasicVectorInput< 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 229 of file Zoltan2_BasicVectorInput.hpp.
int Zoltan2::BasicVectorInput< 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 231 of file Zoltan2_BasicVectorInput.hpp.
size_t Zoltan2::BasicVectorInput< User >::getObjectWeights  (  int  dim, 
const scalar_t *&  wgt,  
int &  stride  
)  const [inline, virtual] 
Provide pointer to a weight array with stride.
dim  the weight dimension, zero or greater 
wgt  on return a pointer to the weights for this dimension 
stride  on return, the value such that the nth weight should be found at wgt[n*stride] . 
wgt
array, which should be at least equal to getLocalNumberOfObjects() * stride
. Implements Zoltan2::InputAdapter< User >.
Definition at line 233 of file Zoltan2_BasicVectorInput.hpp.
int Zoltan2::BasicVectorInput< User >::getNumberOfVectors  (  )  const [inline, virtual] 
Return the number of vectors (typically one).
Implements Zoltan2::VectorInput< User >.
Definition at line 242 of file Zoltan2_BasicVectorInput.hpp.
int Zoltan2::BasicVectorInput< User >::getNumberOfWeights  (  )  const [inline, virtual] 
Return the number of weights per vector element. Number of weights per element should be zero or greater. If zero, it is assumed each vector is equally weighted.
Implements Zoltan2::VectorInput< User >.
Definition at line 244 of file Zoltan2_BasicVectorInput.hpp.
size_t Zoltan2::BasicVectorInput< User >::getLocalLength  (  )  const [inline, virtual] 
Return the length of the portion of the vector on this process.
Implements Zoltan2::VectorInput< User >.
Definition at line 246 of file Zoltan2_BasicVectorInput.hpp.
size_t Zoltan2::BasicVectorInput< User >::getGlobalLength  (  )  const [inline] 
Definition at line 248 of file Zoltan2_BasicVectorInput.hpp.
size_t Zoltan2::BasicVectorInput< User >::getVector  (  const gid_t *&  ids, 
const scalar_t *&  elements,  
int &  stride  
)  const [inline, virtual] 
Provide a pointer to the vertex elements. If the VectorInput represents more than one vector, vector zero is implied.
ids  will on return point to the list of global Ids for each element on this process. 
elements  will on return point to the vector values corresponding to the global Ids. 
stride  the k'th element is located at elements[stride*k] 
Implements Zoltan2::VectorInput< User >.
Definition at line 250 of file Zoltan2_BasicVectorInput.hpp.
size_t Zoltan2::BasicVectorInput< User >::getVector  (  int  i, 
const gid_t *&  ids,  
const scalar_t *&  elements,  
int &  stride  
)  const [virtual] 
Provide a pointer to the elements of the specified vector.
i  ranges from zero to one less than getNumberOfVector(), and represents the vector for which data is being requested. 
ids  will on return point to the list of global Ids for each element on this process. 
elements  will on return point to the vector values corresponding to the global Ids. 
stride  the k'th element is located at elements[stride*k] 
Implements Zoltan2::VectorInput< User >.
Definition at line 292 of file Zoltan2_BasicVectorInput.hpp.
size_t Zoltan2::BasicVectorInput< User >::getVectorWeights  (  int  dimension, 
const scalar_t *&  weights,  
int &  stride  
)  const [virtual] 
Provide a pointer to the weights corresponding to the elements returned in getVector().
dimension  ranges from zero to one less than getNumberOfWeights() 
weights  is the list of weights of the given dimension for the elements listed in getVector. If weights for this dimension are to be uniform for all vectors in the global problem, the weights should be a NULL pointer. 
stride  The k'th weight is located at weights[stride*k] 
Implements Zoltan2::VectorInput< User >.
Definition at line 308 of file Zoltan2_BasicVectorInput.hpp.
enum InputAdapterType Zoltan2::VectorInput< User >::inputAdapterType  (  )  const [inline, virtual, inherited] 
Returns the type of adapter.
Implements Zoltan2::InputAdapter< User >.
Definition at line 125 of file Zoltan2_VectorInput.hpp.
size_t Zoltan2::VectorInput< User >::applyPartitioningSolution  (  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 VectorInput interface. However if the Caller calls a Problem method to redistribute data, it needs this method to perform the redistribution.
in  An input object with a structure and assignment of of global Ids to processes that matches that of the input data that instantiated this InputAdapter. 
out  On return this should point to a newly created object with the specified partitioning. 
solution  The 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. 
Definition at line 209 of file Zoltan2_VectorInput.hpp.
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.