14#ifndef _ZOLTAN2_GRAPHADAPTER_HPP_
15#define _ZOLTAN2_GRAPHADAPTER_HPP_
58template <
typename User,
typename UserCoord = User>
78 bool haveCoordinateInput_ =
false;
81#ifndef DOXYGEN_SHOULD_SKIP_THIS
88 using userCoord_t = UserCoord;
91 using VtxDegreeHostView = Kokkos::View<bool *, Kokkos::HostSpace>;
92 using device_t =
typename node_t::device_type;
140 const gno_t *&adjIds)
const = 0;
153 typename Base::ConstIdsDeviceView &adjIds)
const {
166 typename Base::ConstIdsHostView &adjIds)
const {
294 coordinateInput_ = coordData;
295 haveCoordinateInput_ =
true;
307 return coordinateInput_;
317 return this->primaryEntityType_;
326 if (typestr ==
"vertex") {
329 }
else if (typestr ==
"edge") {
334 "). Valid values are 'vertex' and 'edge'");
343 return this->adjacencyEntityType_;
352 if (typestr ==
"vertex") {
355 }
else if (typestr ==
"edge") {
360 "). Valid values are 'vertex' and 'edge'");
374 "getIDsView not yet supported for graph edges.");
381 "getIDsDeviceView not yet supported for graph edges.");
388 "getIDsHostView not yet supported for graph edges.");
401 int idx = 0)
const override {
404 "getWeightsView not yet supported for graph edges.");
410 int idx = 0)
const override {
412 "getWeightsHostView not yet supported for graph edges.");
419 "getWeightsHostView not yet supported for graph edges.");
425 int idx = 0)
const override {
427 "getWeightsDeviceView not yet supported for graph edges.");
434 "getWeightsDeviceView not yet supported for graph edges.");
441 "useDegreeAsWeight not yet supported for graph edges.");
#define Z2_THROW_NOT_IMPLEMENTED
Defines the VectorAdapter interface.
typename InputTraits< User >::node_t node_t
typename InputTraits< User >::lno_t lno_t
typename InputTraits< User >::scalar_t scalar_t
typename InputTraits< User >::gno_t gno_t
typename InputTraits< User >::offset_t offset_t
typename node_t::device_type device_t
GraphAdapter defines the interface for graph-based user data.
virtual size_t getLocalNumVertices() const =0
Returns the number of vertices on this process.
virtual void getEdgeWeightsDeviceView(typename Base::WeightsDeviceView &weights) const
Provide a device view of the edge weights, if any.
void setCoordinateInput(VectorAdapter< UserCoord > *coordData) override
Allow user to provide additional data that contains coordinate info associated with the MatrixAdapter...
void getWeightsView(const scalar_t *&wgt, int &stride, int idx=0) const override
virtual void getEdgeWeightsDeviceView(typename Base::WeightsDeviceView1D &weights, int=0) const
Provide a device view of the edge weights, if any.
virtual void getEdgeWeightsView(const scalar_t *&weights, int &stride, int=0) const
Provide a pointer to the edge weights, if any.
void getWeightsHostView(typename Base::WeightsHostView1D &hostWgts, int idx=0) const override
virtual void getVertexWeightsDeviceView(typename Base::WeightsDeviceView1D &weights, int=0) const
Provide a device view of the vertex weights, if any.
virtual bool useDegreeAsVertexWeight(int) const
Indicate whether vertex weight with index idx should be the global degree of the vertex.
void getWeightsDeviceView(typename Base::WeightsDeviceView &deviceWgts) const override
void setPrimaryEntityType(const std::string &typestr)
Sets the primary entity type. Called by algorithm based on parameter value in parameter list from app...
VectorAdapter< UserCoord > * getCoordinateInput() const override
Obtain the coordinate data registered by the user.
void getIDsDeviceView(typename Base::ConstIdsDeviceView &Ids) const override
virtual void getEdgesDeviceView(typename Base::ConstOffsetsDeviceView &offsets, typename Base::ConstIdsDeviceView &adjIds) const
Gets adjacency lists for all vertices in a compressed sparse row (CSR) format.
virtual void getVertexWeightsDeviceView(typename Base::WeightsDeviceView &weights) const
Provide a device view of the vertex weights, if any.
virtual void getVertexWeightsHostView(typename Base::WeightsHostView &weights) const
Provide a host view of the vertex weights, if any.
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...
void getWeightsDeviceView(typename Base::WeightsDeviceView1D &deviceWgts, int idx=0) const override
virtual int getNumWeightsPerEdge() const
Returns the number (0 or greater) of edge weights.
virtual void getEdgesHostView(typename Base::ConstOffsetsHostView &offsets, typename Base::ConstIdsHostView &adjIds) const
Gets adjacency lists for all vertices in a compressed sparse row (CSR) format.
void setAdjacencyEntityType(const std::string &typestr)
Sets the adjacency entity type. Called by algorithm based on parameter value in parameter list from a...
void getWeightsHostView(typename Base::WeightsHostView &hostWgts) const override
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 getVertexIDsDeviceView(typename Base::ConstIdsDeviceView &vertexIds) const
Sets pointers to this process' graph entries.
virtual void getEdgeWeightsHostView(typename Base::WeightsHostView1D &weights, int=0) const
Provide a host view of the edge weights, if any.
virtual void getEdgeWeightsHostView(typename Base::WeightsHostView &weights) const
Provide a host view of the edge weights, if any.
virtual void getVertexIDsHostView(typename Base::ConstIdsHostView &vertexIds) const
Sets pointers to this process' graph entries.
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....
virtual void getVertexWeightsHostView(typename Base::WeightsHostView1D &weights, int=0) const
Provide a host view of the vertex weights, if any.
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.
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.
void getIDsHostView(typename Base::ConstIdsHostView &Ids) const override
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.
static void AssertCondition(bool condition, const std::string &message, const char *file=__FILE__, int line=__LINE__)