50 #ifndef _ZOLTAN2_MATRIXADAPTER_HPP_
51 #define _ZOLTAN2_MATRIXADAPTER_HPP_
105 template <
typename User,
typename UserCoord=User>
110 bool haveCoordinateInput_;
114 #ifndef DOXYGEN_SHOULD_SKIP_THIS
122 typedef UserCoord userCoord_t;
131 haveCoordinateInput_(false) {}
178 virtual void getCRSView(ArrayRCP<const offset_t> &offsets, ArrayRCP<const gno_t> &colIds)
const
181 offsets = ArrayRCP<const offset_t>();
182 colIds = ArrayRCP<const gno_t>();
201 ArrayRCP<const gno_t> &colIds,
202 ArrayRCP<const scalar_t> &values)
const
205 offsets = ArrayRCP<const offset_t>();
206 colIds = ArrayRCP<const gno_t>();
207 values = ArrayRCP<const scalar_t>();
267 ArrayRCP<const gno_t> &rowIds)
const
270 offsets = ArrayRCP<const offset_t>();
271 rowIds = ArrayRCP<const gno_t>();
290 ArrayRCP<const gno_t> &rowIds,
291 ArrayRCP<const scalar_t> &values)
const
294 offsets = ArrayRCP<const offset_t>();
295 rowIds = ArrayRCP<const gno_t>();
296 values = ArrayRCP<const scalar_t>();
325 #ifdef FUTURE_FEATURE
330 virtual bool symmetricStorage()
const {
return false;}
343 coordinateInput_ = coordData;
344 haveCoordinateInput_ =
true;
357 return coordinateInput_;
368 return this->primaryEntityType_;
378 if (typestr ==
"row") {
381 else if (typestr ==
"column") {
384 else if (typestr ==
"nonzero") {
388 std::ostringstream emsg;
389 emsg << __FILE__ <<
"," << __LINE__
390 <<
" error: Invalid MatrixEntityType " << typestr << std::endl;
391 emsg <<
"Valid values are 'row', 'column' and 'nonzero'." << std::endl;
392 throw std::runtime_error(emsg.str());
423 std::ostringstream emsg;
424 emsg << __FILE__ <<
"," << __LINE__
425 <<
" error: getIDsView not yet supported for matrix nonzeros."
427 throw std::runtime_error(emsg.str());
461 std::ostringstream emsg;
462 emsg << __FILE__ <<
"," << __LINE__
463 <<
" error: getWeightsView not yet supported for matrix nonzeros."
465 throw std::runtime_error(emsg.str());
477 std::ostringstream emsg;
478 emsg << __FILE__ <<
"," << __LINE__
479 <<
" error: useDegreeAsWeight is currently supported only for rows"
481 throw std::runtime_error(emsg.str());
Zoltan2::BasicUserTypes< zscalar_t, zlno_t, zgno_t > user_t
#define Z2_THROW_NOT_IMPLEMENTED
Defines the VectorAdapter interface.
InputTraits< User >::node_t node_t
InputTraits< User >::offset_t offset_t
InputTraits< User >::part_t part_t
InputTraits< User >::scalar_t scalar_t
InputTraits< User >::lno_t lno_t
InputTraits< User >::gno_t gno_t
MatrixAdapter defines the adapter interface for matrices.
bool useDegreeAsWeight(int idx) const
void setPrimaryEntityType(std::string typestr)
Sets the primary entity type. Called by algorithm based on parameter value in parameter list from app...
virtual int getNumWeightsPerColumn() const
Returns the number of weights per column (0 or greater). Column weights may be used when partitioning...
enum BaseAdapterType adapterType() const
Returns the type of adapter.
virtual size_t getLocalNumEntries() const =0
Returns the number of nonzeros on this process.
void getWeightsView(const scalar_t *&wgt, int &stride, int idx=0) const
virtual bool useNumNonzerosAsRowWeight(int idx) const
Indicate whether row weight with index idx should be the global number of nonzeros in the row.
void setCoordinateInput(VectorAdapter< UserCoord > *coordData)
Allow user to provide additional data that contains coordinate info associated with the MatrixAdapter...
virtual ~MatrixAdapter()
Destructor.
virtual void getColumnWeightsView(const scalar_t *&weights, int &stride, int idx=0) const
Provide a pointer to the column weights, if any.
int getNumWeightsPerID() const
Returns the number of weights per object. Number of weights per object should be zero or greater....
virtual void getColumnIDsView(const gno_t *&colIds) const
Sets pointer to this process' columns' global IDs.
virtual void getCCSView(ArrayRCP< const offset_t > &offsets, ArrayRCP< const gno_t > &rowIds) const
Sets pointers to this process' matrix entries using compressed sparse column (CCS) format....
virtual int getNumWeightsPerRow() const
Returns the number of weights per row (0 or greater). Row weights may be used when partitioning matri...
virtual bool useNumNonzerosAsColumnWeight(int idx) const
Indicate whether column weight with index idx should be the global number of nonzeros in the column.
virtual size_t getLocalNumColumns() const =0
Returns the number of columns on this process.
VectorAdapter< UserCoord > * getCoordinateInput() const
Obtain the coordinate data registered by the user.
virtual void getRowWeightsView(const scalar_t *&weights, int &stride, int idx=0) const
Provide a pointer to the row weights, if any.
bool coordinatesAvailable() const
Indicate whether coordinate information has been set for this MatrixAdapter.
virtual bool CCSViewAvailable() const
Indicates whether the MatrixAdapter implements a view of the matrix in compressed sparse column (CCS)...
virtual void getCRSView(ArrayRCP< const offset_t > &offsets, ArrayRCP< const gno_t > &colIds, ArrayRCP< const scalar_t > &values) const
Sets pointers to this process' matrix entries and their values using compressed sparse row (CRS) form...
void getIDsView(const gno_t *&Ids) const
Provide a pointer to this process' identifiers.
virtual void getCCSView(ArrayRCP< const offset_t > &offsets, ArrayRCP< const gno_t > &rowIds, ArrayRCP< const scalar_t > &values) const
Sets pointers to this process' matrix entries and their values using compressed sparse column (CCS) f...
virtual void getRowIDsView(const gno_t *&rowIds) const
Sets pointer to this process' rows' global IDs.
size_t getLocalNumIDs() const
Returns the number of objects on this process.
virtual bool CRSViewAvailable() const
Indicates whether the MatrixAdapter implements a view of the matrix in compressed sparse row (CRS) fo...
enum MatrixEntityType getPrimaryEntityType() const
Returns the entity to be partitioned, ordered, colored, etc. Valid values are MATRIX_ROW,...
virtual size_t getLocalNumRows() const =0
Returns the number of rows on this process.
virtual void getCRSView(ArrayRCP< const offset_t > &offsets, ArrayRCP< const gno_t > &colIds) const
Sets pointers to this process' matrix entries using compressed sparse row (CRS) format....
VectorAdapter defines the interface for vector input.
Zoltan2::BaseAdapter< userTypes_t > base_adapter_t
Created by mbenlioglu on Aug 31, 2020.
BaseAdapterType
An enum to identify general types of adapters.
@ MatrixAdapterType
matrix data