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
124 typedef UserCoord userCoord_t;
138 haveCoordinateInput_(false) {}
166 const gno_t *&adjIds)
const = 0;
224 coordinateInput_ = coordData;
225 haveCoordinateInput_ =
true;
238 return coordinateInput_;
248 return this->primaryEntityType;
257 if (typestr ==
"vertex") {
261 else if (typestr ==
"edge") {
266 std::ostringstream emsg;
267 emsg << __FILE__ <<
"," << __LINE__
268 <<
" error: Invalid GraphEntityType " << typestr << std::endl;
269 emsg <<
"Valid values are 'vertex' and 'edge'" << std::endl;
270 throw std::runtime_error(emsg.str());
279 return this->adjacencyEntityType;
288 if (typestr ==
"vertex") {
292 else if (typestr ==
"edge") {
297 std::ostringstream emsg;
298 emsg << __FILE__ <<
"," << __LINE__
299 <<
" error: Invalid GraphEntityType " << typestr << std::endl;
300 emsg <<
"Valid values are 'vertex' and 'edge'" << std::endl;
301 throw std::runtime_error(emsg.str());
319 std::ostringstream emsg;
320 emsg << __FILE__ <<
"," << __LINE__
321 <<
" error: getIDsView not yet supported for graph edges."
323 throw std::runtime_error(emsg.str());
340 std::ostringstream emsg;
341 emsg << __FILE__ <<
"," << __LINE__
342 <<
" error: getWeightsView not yet supported for graph edges."
344 throw std::runtime_error(emsg.str());
353 std::ostringstream emsg;
354 emsg << __FILE__ <<
"," << __LINE__
355 <<
" error: useDegreeAsWeight is supported only for vertices"
357 throw std::runtime_error(emsg.str());
InputTraits< User >::scalar_t scalar_t
Zoltan2::BaseAdapter< userTypes_t > base_adapter_t
enum BaseAdapterType adapterType() const
Returns the type of adapter.
virtual void getVertexWeightsView(const scalar_t *&weights, int &stride, int=0) const
Provide a pointer to the vertex weights, if any.
int getNumWeightsPerID() const
Returns the number of weights per object. Number of weights per object should be zero or greater...
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.
virtual bool useDegreeAsVertexWeight(int) const
Indicate whether vertex weight with index idx should be the global degree of the vertex.
GraphEntityType
Enumerated entity type for graphs: Vertices or Edges.
bool coordinatesAvailable() const
Indicate whether coordinate information has been set for this MatrixAdapter.
InputTraits< User >::lno_t lno_t
Defines the VectorAdapter interface.
#define Z2_THROW_NOT_IMPLEMENTED
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.
virtual void getEdgesView(const offset_t *&offsets, const gno_t *&adjIds) const =0
Gets adjacency lists for all vertices in a compressed sparse row (CSR) format.
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...
bool useDegreeAsWeight(int idx) const
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.
InputTraits< User >::offset_t offset_t
virtual void getEdgeWeightsView(const scalar_t *&weights, int &stride, int=0) const
Provide a pointer to the edge weights, if any.
Zoltan2::BasicUserTypes< zscalar_t, zlno_t, zgno_t > user_t