14 #ifndef _ZOLTAN2_GRAPHADAPTER_HPP_
15 #define _ZOLTAN2_GRAPHADAPTER_HPP_
58 template <
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.");
Zoltan2::BaseAdapter< userTypes_t > base_adapter_t
VectorAdapter< UserCoord > * getCoordinateInput() const override
Obtain the coordinate data registered by the user.
virtual void getEdgeWeightsDeviceView(typename Base::WeightsDeviceView1D &weights, int=0) const
Provide a device view of the edge weights, if any.
virtual void getVertexWeightsView(const scalar_t *&weights, int &stride, int=0) const
Provide a pointer to the vertex weights, if any.
void getWeightsDeviceView(typename Base::WeightsDeviceView1D &deviceWgts, int idx=0) const override
virtual void getVertexWeightsDeviceView(typename Base::WeightsDeviceView &weights) const
Provide a device view of the vertex weights, if any.
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.
typename InputTraits< User >::scalar_t scalar_t
static void AssertCondition(bool condition, const std::string &message, const char *file=__FILE__, int line=__LINE__)
size_t getLocalNumIDs() const override
Returns the number of objects on this process.
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.
map_t::global_ordinal_type gno_t
bool coordinatesAvailable() const
Indicate whether coordinate information has been set for this MatrixAdapter.
virtual void getVertexWeightsHostView(typename Base::WeightsHostView1D &weights, int=0) const
Provide a host view of the vertex weights, if any.
Defines the VectorAdapter interface.
#define Z2_THROW_NOT_IMPLEMENTED
typename node_t::device_type device_t
void getIDsHostView(typename Base::ConstIdsHostView &Ids) const override
virtual void getVertexWeightsHostView(typename Base::WeightsHostView &weights) const
Provide a host view of the vertex weights, if any.
virtual void getVertexIDsDeviceView(typename Base::ConstIdsDeviceView &vertexIds) const
Sets pointers to this process' graph entries.
void getWeightsView(const scalar_t *&wgt, int &stride, int idx=0) const override
Provide pointer to a weight array with stride.
int getNumWeightsPerID() const override
Returns the number of weights per object. Number of weights per object should be zero or greater...
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.
void getWeightsHostView(typename Base::WeightsHostView1D &hostWgts, int idx=0) const override
virtual void getVertexIDsHostView(typename Base::ConstIdsHostView &vertexIds) const
Sets pointers to this process' graph entries.
void setCoordinateInput(VectorAdapter< UserCoord > *coordData) override
Allow user to provide additional data that contains coordinate info associated with the MatrixAdapter...
typename InputTraits< User >::node_t node_t
typename InputTraits< User >::gno_t gno_t
BaseAdapterType
An enum to identify general types of adapters.
void getWeightsHostView(typename Base::WeightsHostView &hostWgts) const override
virtual void getVertexWeightsDeviceView(typename Base::WeightsDeviceView1D &weights, int=0) const
Provide a device view of the vertex weights, if any.
void setPrimaryEntityType(const std::string &typestr)
Sets the primary entity type. Called by algorithm based on parameter value in parameter list from app...
void getIDsView(const gno_t *&Ids) const override
Provide a pointer to this process' identifiers.
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.
typename InputTraits< User >::offset_t offset_t
bool useDegreeAsWeight(int idx) const
virtual void getEdgeWeightsHostView(typename Base::WeightsHostView &weights) const
Provide a host view of the edge weights, if any.
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.
enum GraphEntityType getPrimaryEntityType() const
Returns the entity to be partitioned, ordered, colored, etc. Valid values are GRAPH_VERTEX or GRAPH_E...
virtual size_t getLocalNumVertices() const =0
Returns the number of vertices on this process.
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.
void setAdjacencyEntityType(const std::string &typestr)
Sets the adjacency entity type. Called by algorithm based on parameter value in parameter list from a...
void getIDsDeviceView(typename Base::ConstIdsDeviceView &Ids) const override
virtual void getEdgeWeightsHostView(typename Base::WeightsHostView1D &weights, int=0) const
Provide a host view of the edge weights, if any.
typename InputTraits< User >::lno_t lno_t
virtual void getEdgeWeightsView(const scalar_t *&weights, int &stride, int=0) const
Provide a pointer to the edge weights, if any.
virtual void getEdgeWeightsDeviceView(typename Base::WeightsDeviceView &weights) const
Provide a device view of the edge weights, if any.
enum BaseAdapterType adapterType() const override
Returns the type of adapter.
void getWeightsDeviceView(typename Base::WeightsDeviceView &deviceWgts) const override