51 #ifndef _ZOLTAN2_MESHADAPTER_HPP_ 52 #define _ZOLTAN2_MESHADAPTER_HPP_ 55 #include "Tpetra_DefaultPlatform.hpp" 56 #include "TpetraExt_MatrixMatrix.hpp" 124 template <
typename User>
128 #ifndef DOXYGEN_SHOULD_SKIP_THIS 135 typedef User userCoord_t;
136 typedef int nonzero_t;
137 typedef Tpetra::CrsMatrix<nonzero_t,lno_t,gno_t,node_t> sparse_matrix_type;
138 typedef Tpetra::Map<lno_t, gno_t, node_t> map_type;
179 gno_t
const *&Ids)
const = 0;
214 const scalar_t *&weights,
int &stride,
int idx = 0)
const 243 const scalar_t *&coords,
int &stride,
int coordDim)
const 275 const lno_t *&offsets,
const gno_t *& adjacencyIds)
const 314 const lno_t *&offsets,
315 const gno_t *&adjacencyIds)
const 340 const scalar_t *&weights,
355 return this->primaryEntityType;
364 return this->adjacencyEntityType;
373 return this->secondAdjacencyEntityType;
383 std::string satypestr) {
385 if (ptypestr != atypestr && ptypestr != satypestr) {
386 if (ptypestr ==
"region")
388 else if (ptypestr ==
"face")
390 else if (ptypestr ==
"edge")
392 else if (ptypestr ==
"vertex")
395 std::ostringstream emsg;
396 emsg << __FILE__ <<
"," << __LINE__
397 <<
" error: Invalid MeshEntityType " << ptypestr << std::endl;
398 emsg <<
"Valid values: region face edge vertex" << std::endl;
399 throw std::runtime_error(emsg.str());
402 if (atypestr ==
"region")
404 else if (atypestr ==
"face")
406 else if (atypestr ==
"edge")
408 else if (atypestr ==
"vertex")
411 std::ostringstream emsg;
412 emsg << __FILE__ <<
"," << __LINE__
413 <<
" error: Invalid MeshEntityType " << atypestr << std::endl;
414 emsg <<
"Valid values: region face edge vertex" << std::endl;
415 throw std::runtime_error(emsg.str());
418 if (satypestr ==
"region")
420 else if (satypestr ==
"face")
421 this->secondAdjacencyEntityType =
MESH_FACE;
422 else if (satypestr ==
"edge")
423 this->secondAdjacencyEntityType =
MESH_EDGE;
424 else if (satypestr ==
"vertex")
427 std::ostringstream emsg;
428 emsg << __FILE__ <<
"," << __LINE__
429 <<
" error: Invalid MeshEntityType " << satypestr << std::endl;
430 emsg <<
"Valid values: region face edge vertex" << std::endl;
431 throw std::runtime_error(emsg.str());
435 std::ostringstream emsg;
436 emsg << __FILE__ <<
"," << __LINE__
437 <<
" error: PrimaryEntityType " << ptypestr
438 <<
" matches AdjacencyEntityType " << atypestr
439 <<
" or SecondAdjacencyEntityType " << satypestr << std::endl;
440 throw std::runtime_error(emsg.str());
InputTraits< User >::scalar_t scalar_t
virtual bool areEntityIDsUnique(MeshEntityType etype) const
Provide a pointer to the entity topology types.
virtual bool availAdjs(MeshEntityType source, MeshEntityType target) const
Returns whether a first adjacency combination is available.
void setEntityTypes(std::string ptypestr, std::string atypestr, std::string satypestr)
Sets the primary, adjacency, and second adjacency entity types. Called by algorithm based on paramete...
InputTraits< User >::gno_t gno_t
int getNumWeightsPerID() const
Returns the number of weights per object. Number of weights per object should be zero or greater...
MeshAdapter defines the interface for mesh input.
virtual size_t getLocalNumOf(MeshEntityType etype) const =0
Returns the global number of mesh entities of MeshEntityType.
virtual ~MeshAdapter()
Destructor.
virtual void getWeightsViewOf(MeshEntityType etype, const scalar_t *&weights, int &stride, int idx=0) const
Provide a pointer to one of the number of this process' optional entity weights.
virtual bool avail2ndAdjs(MeshEntityType sourcetarget, MeshEntityType through) const
Returns whether a second adjacency combination is available. If combination is not available in the M...
enum MeshEntityType getAdjacencyEntityType() const
Returns the entity that describes adjacencies between the entities to be partitioned, ordered, colored, etc. That is, a primaryEntityType that contains an adjacencyEntityType are adjacent.
virtual int getDimension() const
Return dimension of the entity coordinates, if any.
void getCoordinatesView(const scalar_t *&coords, int &stride, int coordDim) const
virtual void get2ndAdjWeightsView(MeshEntityType sourcetarget, MeshEntityType through, const scalar_t *&weights, int &stride, int idx) const
Provide a pointer to the second adjacency weights, if any. Note: second-adjacency weights may be used...
virtual size_t getLocalNum2ndAdjs(MeshEntityType sourcetarget, MeshEntityType through) const
if avail2ndAdjs(), returns the number of second adjacencies on this process.
virtual void getIDsViewOf(MeshEntityType etype, gno_t const *&Ids) const =0
Provide a pointer to this process' identifiers.
virtual void getCoordinatesViewOf(MeshEntityType etype, const scalar_t *&coords, int &stride, int coordDim) const
Provide a pointer to one dimension of entity coordinates.
enum MeshEntityType getSecondAdjacencyEntityType() const
Returns the entity that describes second adjacencies between the entities to be partitioned, ordered, colored, etc. That is, two primaryEntityType that share a secondAdjacencyEntityType are adjacent.
BaseAdapterType
An enum to identify general types of adapters.
virtual size_t getLocalNumAdjs(MeshEntityType source, MeshEntityType target) const
Returns the number of first adjacencies on this process.
virtual void get2ndAdjsView(MeshEntityType sourcetarget, MeshEntityType through, const lno_t *&offsets, const gno_t *&adjacencyIds) const
if avail2ndAdjs(), set pointers to this process' second adjacencies
void getWeightsView(const scalar_t *&wgt, int &stride, int idx=0) const
Provide pointer to a weight array with stride.
virtual int getNumWeightsPer2ndAdj(MeshEntityType sourcetarget, MeshEntityType through) const
Returns the number (0 or greater) of weights per second adjacency. Note: second-adjacency weights may...
virtual void getAdjsView(MeshEntityType source, MeshEntityType target, const lno_t *&offsets, const gno_t *&adjacencyIds) const
Sets pointers to this process' mesh first adjacencies.
InputTraits< User >::part_t part_t
EntityTopologyType
Enumerate entity topology types for meshes: points,lines,polygons,triangles,quadrilaterals, polyhedrons, tetrahedrons, hexhedrons, prisms, or pyramids.
#define Z2_THROW_NOT_IMPLEMENTED_IN_ADAPTER
BaseAdapter defines methods required by all Adapters.
MeshEntityType
Enumerate entity types for meshes: Regions, Faces, Edges, or Vertices.
bool useDegreeAsWeight(int idx) const
virtual int getNumWeightsPerOf(MeshEntityType etype) const
Return the number of weights per entity.
virtual void getTopologyViewOf(MeshEntityType etype, enum EntityTopologyType const *&Types) const
Provide a pointer to the entity topology types.
size_t getLocalNumIDs() const
Returns the number of objects on this process.
virtual bool useDegreeAsWeightOf(MeshEntityType etype, int idx) const
Optional method allowing the idx-th weight of entity type etype to be set as the number of neighbors ...
enum MeshEntityType getPrimaryEntityType() const
Returns the entity to be partitioned, ordered, colored, etc.
enum BaseAdapterType adapterType() const
Returns the type of adapter.
void getIDsView(const gno_t *&Ids) const
Provide a pointer to this process' identifiers.