51#ifndef _ZOLTAN2_GRAPHADAPTER_HPP_
52#define _ZOLTAN2_GRAPHADAPTER_HPP_
98template <
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());
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 >::scalar_t scalar_t
InputTraits< User >::lno_t lno_t
InputTraits< User >::gno_t gno_t
GraphAdapter defines the interface for graph-based user data.
virtual ~GraphAdapter()
Destructor.
virtual size_t getLocalNumVertices() const =0
Returns the number of vertices on this process.
void setCoordinateInput(VectorAdapter< UserCoord > *coordData) override
Allow user to provide additional data that contains coordinate info associated with the MatrixAdapter...
void setAdjacencyEntityType(std::string typestr)
Sets the adjacency entity type. Called by algorithm based on parameter value in parameter list from a...
void getWeightsView(const scalar_t *&wgt, int &stride, int idx=0) const override
virtual void getEdgeWeightsView(const scalar_t *&weights, int &stride, int=0) const
Provide a pointer to the edge weights, if any.
virtual bool useDegreeAsVertexWeight(int) const
Indicate whether vertex weight with index idx should be the global degree of the vertex.
VectorAdapter< UserCoord > * getCoordinateInput() const override
Obtain the coordinate data registered by the user.
size_t getLocalNumIDs() const override
Returns the number of objects on this process.
enum GraphEntityType getPrimaryEntityType() const
Returns the entity to be partitioned, ordered, colored, etc. Valid values are GRAPH_VERTEX or GRAPH_E...
virtual int getNumWeightsPerEdge() const
Returns the number (0 or greater) of edge weights.
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.
virtual void getVertexIDsView(const gno_t *&vertexIds) const =0
Sets pointers to this process' graph entries.
virtual void getVertexWeightsView(const scalar_t *&weights, int &stride, int=0) const
Provide a pointer to the vertex weights, if any.
int getNumWeightsPerID() const override
Returns the number of weights per object. Number of weights per object should be zero or greater....
bool coordinatesAvailable() const
Indicate whether coordinate information has been set for this MatrixAdapter.
enum GraphEntityType getAdjacencyEntityType() const
Returns the entity that describes adjacencies between the entities to be partitioned,...
void getIDsView(const gno_t *&Ids) const override
Provide a pointer to this process' identifiers.
void setPrimaryEntityType(std::string typestr)
Sets the primary entity type. Called by algorithm based on parameter value in parameter list from app...
bool useDegreeAsWeight(int idx) const
virtual int getNumWeightsPerVertex() const
Returns the number (0 or greater) of weights per vertex.
enum BaseAdapterType adapterType() const override
Returns the type of adapter.
virtual size_t getLocalNumEdges() const =0
Returns the number of edges on this process.
VectorAdapter defines the interface for vector input.
Created by mbenlioglu on Aug 31, 2020.
BaseAdapterType
An enum to identify general types of adapters.
@ GraphAdapterType
graph data
GraphEntityType
Enumerated entity type for graphs: Vertices or Edges.