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 121 typedef UserCoord userCoord_t;
129 haveCoordinateInput_(false) {}
177 const gno_t *&colIds)
const 200 const gno_t *& colIds,
201 const scalar_t *&values)
const 266 const gno_t *&rowIds)
const 289 const gno_t *&rowIds,
290 const scalar_t *&values)
const 324 #ifdef FUTURE_FEATURE 329 virtual bool symmetricStorage()
const {
return false;}
342 coordinateInput_ = coordData;
343 haveCoordinateInput_ =
true;
356 return coordinateInput_;
367 return this->primaryEntityType_;
377 if (typestr ==
"row") {
380 else if (typestr ==
"column") {
383 else if (typestr ==
"nonzero") {
387 std::ostringstream emsg;
388 emsg << __FILE__ <<
"," << __LINE__
389 <<
" error: Invalid MatrixEntityType " << typestr << std::endl;
390 emsg <<
"Valid values are 'row', 'column' and 'nonzero'." << std::endl;
391 throw std::runtime_error(emsg.str());
422 std::ostringstream emsg;
423 emsg << __FILE__ <<
"," << __LINE__
424 <<
" error: getIDsView not yet supported for matrix nonzeros." 426 throw std::runtime_error(emsg.str());
460 std::ostringstream emsg;
461 emsg << __FILE__ <<
"," << __LINE__
462 <<
" error: getWeightsView not yet supported for matrix nonzeros." 464 throw std::runtime_error(emsg.str());
476 std::ostringstream emsg;
477 emsg << __FILE__ <<
"," << __LINE__
478 <<
" error: useDegreeAsWeight is currently supported only for rows" 480 throw std::runtime_error(emsg.str());
InputTraits< User >::scalar_t scalar_t
void getWeightsView(const scalar_t *&wgt, int &stride, int idx=0) const
Provide pointer to a weight array with stride.
virtual ~MatrixAdapter()
Destructor.
enum BaseAdapterType adapterType() const
Returns the type of adapter.
virtual void getCCSView(const lno_t *&offsets, const gno_t *&rowIds, const scalar_t *&values) const
Sets pointers to this process' matrix entries and their values using compressed sparse column (CCS) f...
void setPrimaryEntityType(std::string typestr)
Sets the primary entity type. Called by algorithm based on parameter value in parameter list from app...
MatrixAdapter defines the adapter interface for matrices.
InputTraits< User >::gno_t gno_t
virtual bool useNumNonzerosAsColumnWeight(int idx) const
Indicate whether column weight with index idx should be the global number of nonzeros in the column...
bool coordinatesAvailable() const
Indicate whether coordinate information has been set for this MatrixAdapter.
virtual int getNumWeightsPerColumn() const
Returns the number of weights per column (0 or greater). Column weights may be used when partitioning...
Defines the VectorAdapter interface.
enum MatrixEntityType getPrimaryEntityType() const
Returns the entity to be partitioned, ordered, colored, etc. Valid values are MATRIX_ROW, MATRIX_COLUMN, MATRIX_NONZERO.
virtual void getRowWeightsView(const scalar_t *&weights, int &stride, int idx=0) const
Provide a pointer to the row weights, if any.
void setCoordinateInput(VectorAdapter< UserCoord > *coordData)
Allow user to provide additional data that contains coordinate info associated with the MatrixAdapter...
virtual size_t getLocalNumColumns() const =0
Returns the number of columns on this process.
int getNumWeightsPerID() const
Returns the number of weights per object. Number of weights per object should be zero or greater...
virtual void getCRSView(const lno_t *&offsets, const gno_t *&colIds) const
Sets pointers to this process' matrix entries using compressed sparse row (CRS) format. All matrix adapters must implement either getCRSView or getCCSView, but implementation of both is not required.
void getIDsView(const gno_t *&Ids) const
Provide a pointer to this process' identifiers.
virtual bool useNumNonzerosAsRowWeight(int idx) const
Indicate whether row weight with index idx should be the global number of nonzeros in the row...
virtual void getCRSView(const lno_t *&offsets, const gno_t *&colIds, const scalar_t *&values) const
Sets pointers to this process' matrix entries and their values using compressed sparse row (CRS) form...
virtual bool CCSViewAvailable() const
Indicates whether the MatrixAdapter implements a view of the matrix in compressed sparse column (CCS)...
BaseAdapterType
An enum to identify general types of adapters.
virtual int getNumWeightsPerRow() const
Returns the number of weights per row (0 or greater). Row weights may be used when partitioning matri...
InputTraits< User >::part_t part_t
VectorAdapter< UserCoord > * getCoordinateInput() const
Obtain the coordinate data registered by the user.
virtual void getColumnWeightsView(const scalar_t *&weights, int &stride, int idx=0) const
Provide a pointer to the column weights, if any.
virtual void getCCSView(const lno_t *&offsets, const gno_t *&rowIds) const
Sets pointers to this process' matrix entries using compressed sparse column (CCS) format...
#define Z2_THROW_NOT_IMPLEMENTED_IN_ADAPTER
BaseAdapter defines methods required by all Adapters.
size_t getLocalNumIDs() const
Returns the number of objects on this process.
bool useDegreeAsWeight(int idx) const
virtual void getRowIDsView(const gno_t *&rowIds) const
Sets pointer to this process' rows' global IDs.
virtual bool CRSViewAvailable() const
Indicates whether the MatrixAdapter implements a view of the matrix in compressed sparse row (CRS) fo...
virtual size_t getLocalNumRows() const =0
Returns the number of rows on this process.
virtual size_t getLocalNumEntries() const =0
Returns the number of nonzeros on this process.
virtual void getColumnIDsView(const gno_t *&colIds) const
Sets pointer to this process' columns' global IDs.