Go to the documentation of this file.
51 #ifndef _ZOLTAN2_MESHADAPTER_HPP_
52 #define _ZOLTAN2_MESHADAPTER_HPP_
55 #include "TpetraExt_MatrixMatrix.hpp"
123 template <
typename User>
127 #ifndef DOXYGEN_SHOULD_SKIP_THIS
135 typedef User userCoord_t;
177 gno_t const *&Ids)
const = 0;
241 const scalar_t *&coords,
int &stride,
int coordDim)
const
313 const gno_t *&adjacencyIds)
const
353 return this->primaryEntityType;
362 return this->adjacencyEntityType;
371 return this->secondAdjacencyEntityType;
381 std::string satypestr) {
383 if (ptypestr != atypestr && ptypestr != satypestr) {
384 if (ptypestr ==
"region")
386 else if (ptypestr ==
"face")
388 else if (ptypestr ==
"edge")
390 else if (ptypestr ==
"vertex")
393 std::ostringstream emsg;
394 emsg << __FILE__ <<
"," << __LINE__
395 <<
" error: Invalid MeshEntityType " << ptypestr << std::endl;
396 emsg <<
"Valid values: region face edge vertex" << std::endl;
397 throw std::runtime_error(emsg.str());
400 if (atypestr ==
"region")
402 else if (atypestr ==
"face")
404 else if (atypestr ==
"edge")
406 else if (atypestr ==
"vertex")
409 std::ostringstream emsg;
410 emsg << __FILE__ <<
"," << __LINE__
411 <<
" error: Invalid MeshEntityType " << atypestr << std::endl;
412 emsg <<
"Valid values: region face edge vertex" << std::endl;
413 throw std::runtime_error(emsg.str());
416 if (satypestr ==
"region")
418 else if (satypestr ==
"face")
419 this->secondAdjacencyEntityType =
MESH_FACE;
420 else if (satypestr ==
"edge")
421 this->secondAdjacencyEntityType =
MESH_EDGE;
422 else if (satypestr ==
"vertex")
425 std::ostringstream emsg;
426 emsg << __FILE__ <<
"," << __LINE__
427 <<
" error: Invalid MeshEntityType " << satypestr << std::endl;
428 emsg <<
"Valid values: region face edge vertex" << std::endl;
429 throw std::runtime_error(emsg.str());
433 std::ostringstream emsg;
434 emsg << __FILE__ <<
"," << __LINE__
435 <<
" error: PrimaryEntityType " << ptypestr
436 <<
" matches AdjacencyEntityType " << atypestr
437 <<
" or SecondAdjacencyEntityType " << satypestr << std::endl;
438 throw std::runtime_error(emsg.str());
virtual int getNumWeightsPer2ndAdj(MeshEntityType sourcetarget, MeshEntityType through) const
Returns the number (0 or greater) of weights per second adjacency. Note: second-adjacency weights may...
#define Z2_THROW_NOT_IMPLEMENTED
virtual void get2ndAdjsView(MeshEntityType sourcetarget, MeshEntityType through, const offset_t *&offsets, const gno_t *&adjacencyIds) const
if avail2ndAdjs(), set pointers to this process' second adjacencies
InputTraits< User >::offset_t offset_t
virtual void getTopologyViewOf(MeshEntityType etype, enum EntityTopologyType const *&Types) const
Provide a pointer to the entity topology types.
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 getAdjacencyEntityType() const
Returns the entity that describes adjacencies between the entities to be partitioned,...
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...
Zoltan2::BaseAdapter< userTypes_t > base_adapter_t
virtual size_t getLocalNumOf(MeshEntityType etype) const =0
Returns the global number of mesh entities of MeshEntityType.
virtual bool availAdjs(MeshEntityType source, MeshEntityType target) const
Returns whether a first adjacency combination is available.
MeshEntityType
Enumerate entity types for meshes: Regions, Faces, Edges, or Vertices.
virtual void getIDsViewOf(MeshEntityType etype, gno_t const *&Ids) const =0
Provide a pointer to this process' identifiers.
InputTraits< User >::part_t part_t
enum BaseAdapterType adapterType() const
Returns the type of adapter.
MeshAdapter defines the interface for mesh input.
bool useDegreeAsWeight(int idx) const
void getWeightsView(const scalar_t *&wgt, int &stride, int idx=0) const
void getIDsView(const gno_t *&Ids) const
Provide a pointer to this process' identifiers.
virtual size_t getLocalNumAdjs(MeshEntityType source, MeshEntityType target) const
Returns the number of first adjacencies on this process.
virtual void getCoordinatesViewOf(MeshEntityType etype, const scalar_t *&coords, int &stride, int coordDim) const
Provide a pointer to one dimension of entity coordinates.
virtual bool areEntityIDsUnique(MeshEntityType etype) const
Provide a pointer to the entity topology types.
virtual size_t getLocalNum2ndAdjs(MeshEntityType sourcetarget, MeshEntityType through) const
if avail2ndAdjs(), returns the number of second adjacencies on this process.
InputTraits< User >::lno_t lno_t
InputTraits< User >::gno_t gno_t
virtual int getDimension() const
Return dimension of the entity coordinates, if any.
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.
void getCoordinatesView(const scalar_t *&coords, int &stride, int coordDim) const
enum MeshEntityType getSecondAdjacencyEntityType() const
Returns the entity that describes second adjacencies between the entities to be partitioned,...
virtual int getNumWeightsPerOf(MeshEntityType etype) const
Return the number of weights per entity.
int getNumWeightsPerID() const
Returns the number of weights per object. Number of weights per object should be zero or greater....
BaseAdapterType
An enum to identify general types of adapters.
virtual void getAdjsView(MeshEntityType source, MeshEntityType target, const offset_t *&offsets, const gno_t *&adjacencyIds) const
Sets pointers to this process' mesh first adjacencies.
size_t getLocalNumIDs() const
Returns the number of objects on this process.
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 bool avail2ndAdjs(MeshEntityType sourcetarget, MeshEntityType through) const
Returns whether a second adjacency combination is available. If combination is not available in the M...
InputTraits< User >::scalar_t scalar_t
EntityTopologyType
Enumerate entity topology types for meshes: points,lines,polygons,triangles,quadrilaterals,...
virtual ~MeshAdapter()
Destructor.
enum MeshEntityType getPrimaryEntityType() const
Returns the entity to be partitioned, ordered, colored, etc.