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;
137 haveCoordinateInput_(false) {}
165 const gno_t *&adjIds)
const = 0;
223 coordinateInput_ = coordData;
224 haveCoordinateInput_ =
true;
237 return coordinateInput_;
247 return this->primaryEntityType;
256 if (typestr ==
"vertex") {
260 else if (typestr ==
"edge") {
265 std::ostringstream emsg;
266 emsg << __FILE__ <<
"," << __LINE__
267 <<
" error: Invalid GraphEntityType " << typestr << std::endl;
268 emsg <<
"Valid values are 'vertex' and 'edge'" << std::endl;
269 throw std::runtime_error(emsg.str());
278 return this->adjacencyEntityType;
287 if (typestr ==
"vertex") {
291 else if (typestr ==
"edge") {
296 std::ostringstream emsg;
297 emsg << __FILE__ <<
"," << __LINE__
298 <<
" error: Invalid GraphEntityType " << typestr << std::endl;
299 emsg <<
"Valid values are 'vertex' and 'edge'" << std::endl;
300 throw std::runtime_error(emsg.str());
318 std::ostringstream emsg;
319 emsg << __FILE__ <<
"," << __LINE__
320 <<
" error: getIDsView not yet supported for graph edges." 322 throw std::runtime_error(emsg.str());
339 std::ostringstream emsg;
340 emsg << __FILE__ <<
"," << __LINE__
341 <<
" error: getWeightsView not yet supported for graph edges." 343 throw std::runtime_error(emsg.str());
352 std::ostringstream emsg;
353 emsg << __FILE__ <<
"," << __LINE__
354 <<
" error: useDegreeAsWeight is supported only for vertices" 356 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.
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.
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.
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...
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.