51 #ifndef _ZOLTAN2_GRAPHADAPTER_HPP_ 52 #define _ZOLTAN2_GRAPHADAPTER_HPP_ 98 template <
typename User,
typename UserCoord=User>
112 bool haveCoordinateInput_;
117 #ifndef DOXYGEN_SHOULD_SKIP_THIS 123 typedef UserCoord userCoord_t;
136 haveCoordinateInput_(false) {}
164 const gno_t *&adjIds)
const = 0;
222 coordinateInput_ = coordData;
223 haveCoordinateInput_ =
true;
236 return coordinateInput_;
246 return this->primaryEntityType;
255 if (typestr ==
"vertex") {
259 else if (typestr ==
"edge") {
264 std::ostringstream emsg;
265 emsg << __FILE__ <<
"," << __LINE__
266 <<
" error: Invalid GraphEntityType " << typestr << std::endl;
267 emsg <<
"Valid values are 'vertex' and 'edge'" << std::endl;
268 throw std::runtime_error(emsg.str());
277 return this->adjacencyEntityType;
286 if (typestr ==
"vertex") {
290 else if (typestr ==
"edge") {
295 std::ostringstream emsg;
296 emsg << __FILE__ <<
"," << __LINE__
297 <<
" error: Invalid GraphEntityType " << typestr << std::endl;
298 emsg <<
"Valid values are 'vertex' and 'edge'" << std::endl;
299 throw std::runtime_error(emsg.str());
317 std::ostringstream emsg;
318 emsg << __FILE__ <<
"," << __LINE__
319 <<
" error: getIDsView not yet supported for graph edges." 321 throw std::runtime_error(emsg.str());
338 std::ostringstream emsg;
339 emsg << __FILE__ <<
"," << __LINE__
340 <<
" error: getWeightsView not yet supported for graph edges." 342 throw std::runtime_error(emsg.str());
351 std::ostringstream emsg;
352 emsg << __FILE__ <<
"," << __LINE__
353 <<
" error: useDegreeAsWeight is supported only for vertices" 355 throw std::runtime_error(emsg.str());
InputTraits< User >::scalar_t scalar_t
enum BaseAdapterType adapterType() const
Returns the type of adapter.
int getNumWeightsPerID() const
Returns the number of weights per object. Number of weights per object should be zero or greater...
virtual void getEdgeWeightsView(const scalar_t *&weights, int &stride, int idx=0) const
Provide a pointer to the edge weights, if any.
virtual void getEdgesView(const lno_t *&offsets, const gno_t *&adjIds) const =0
Gets adjacency lists for all vertices in a compressed sparse row (CSR) format.
InputTraits< User >::gno_t gno_t
virtual size_t getLocalNumEdges() const =0
Returns the number of edges on this process.
GraphAdapter defines the interface for graph-based user data.
virtual int getNumWeightsPerEdge() const
Returns the number (0 or greater) of edge weights.
GraphEntityType
Enumerated entity type for graphs: Vertices or Edges.
virtual void getVertexWeightsView(const scalar_t *&weights, int &stride, int idx=0) const
Provide a pointer to the vertex weights, if any.
bool coordinatesAvailable() const
Indicate whether coordinate information has been set for this MatrixAdapter.
Defines the VectorAdapter interface.
void getWeightsView(const scalar_t *&wgt, int &stride, int idx=0) const
Provide pointer to a weight array with stride.
size_t getLocalNumIDs() const
Returns the number of objects on this process.
void getIDsView(const gno_t *&Ids) const
Provide a pointer to this process' identifiers.
VectorAdapter< UserCoord > * getCoordinateInput() const
Obtain the coordinate data registered by the user.
BaseAdapterType
An enum to identify general types of adapters.
void setPrimaryEntityType(std::string typestr)
Sets the primary entity type. Called by algorithm based on parameter value in parameter list from app...
virtual void getVertexIDsView(const gno_t *&vertexIds) const =0
Sets pointers to this process' graph entries.
virtual int getNumWeightsPerVertex() const
Returns the number (0 or greater) of weights per vertex.
void setAdjacencyEntityType(std::string typestr)
Sets the adjacency entity type. Called by algorithm based on parameter value in parameter list from a...
#define Z2_THROW_NOT_IMPLEMENTED_IN_ADAPTER
BaseAdapter defines methods required by all Adapters.
bool useDegreeAsWeight(int idx) const
virtual bool useDegreeAsVertexWeight(int idx) const
Indicate whether vertex weight with index idx should be the global degree of the vertex.
enum GraphEntityType getAdjacencyEntityType() const
Returns the entity that describes adjacencies between the entities to be partitioned, ordered, colored, etc. Valid values are GRAPH_VERTEX or GRAPH_EDGE.
void setCoordinateInput(VectorAdapter< UserCoord > *coordData)
Allow user to provide additional data that contains coordinate info associated with the MatrixAdapter...
enum GraphEntityType getPrimaryEntityType() const
Returns the entity to be partitioned, ordered, colored, etc. Valid values are GRAPH_VERTEX or GRAPH_E...
virtual ~GraphAdapter()
Destructor.
virtual size_t getLocalNumVertices() const =0
Returns the number of vertices on this process.