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;
173 gno_t const *&Ids)
const = 0;
237 const scalar_t *&coords,
int &stride,
int coordDim)
const
309 const gno_t *&adjacencyIds)
const
349 return this->primaryEntityType;
358 return this->adjacencyEntityType;
367 return this->secondAdjacencyEntityType;
377 std::string satypestr) {
379 if (ptypestr != atypestr && ptypestr != satypestr) {
380 if (ptypestr ==
"region")
382 else if (ptypestr ==
"face")
384 else if (ptypestr ==
"edge")
386 else if (ptypestr ==
"vertex")
389 std::ostringstream emsg;
390 emsg << __FILE__ <<
"," << __LINE__
391 <<
" error: Invalid MeshEntityType " << ptypestr << std::endl;
392 emsg <<
"Valid values: region face edge vertex" << std::endl;
393 throw std::runtime_error(emsg.str());
396 if (atypestr ==
"region")
398 else if (atypestr ==
"face")
400 else if (atypestr ==
"edge")
402 else if (atypestr ==
"vertex")
405 std::ostringstream emsg;
406 emsg << __FILE__ <<
"," << __LINE__
407 <<
" error: Invalid MeshEntityType " << atypestr << std::endl;
408 emsg <<
"Valid values: region face edge vertex" << std::endl;
409 throw std::runtime_error(emsg.str());
412 if (satypestr ==
"region")
414 else if (satypestr ==
"face")
415 this->secondAdjacencyEntityType =
MESH_FACE;
416 else if (satypestr ==
"edge")
417 this->secondAdjacencyEntityType =
MESH_EDGE;
418 else if (satypestr ==
"vertex")
421 std::ostringstream emsg;
422 emsg << __FILE__ <<
"," << __LINE__
423 <<
" error: Invalid MeshEntityType " << satypestr << std::endl;
424 emsg <<
"Valid values: region face edge vertex" << std::endl;
425 throw std::runtime_error(emsg.str());
429 std::ostringstream emsg;
430 emsg << __FILE__ <<
"," << __LINE__
431 <<
" error: PrimaryEntityType " << ptypestr
432 <<
" matches AdjacencyEntityType " << atypestr
433 <<
" or SecondAdjacencyEntityType " << satypestr << std::endl;
434 throw std::runtime_error(emsg.str());
458 typename node_t::device_type> &ids)
const override
460 Kokkos::View<gno_t *, typename node_t::device_type>
462 auto host_kokkos_ids = Kokkos::create_mirror_view(kokkos_ids);
467 host_kokkos_ids(n) = gnos[n];
469 Kokkos::deep_copy(kokkos_ids, host_kokkos_ids);
482 int coordDim)
const override
489 Kokkos::View<scalar_t **, Kokkos::LayoutLeft, typename node_t::device_type> & elements)
const override
492 Kokkos::View<scalar_t **, Kokkos::LayoutLeft, typename node_t::device_type>
494 auto host_temp_values = Kokkos::create_mirror_view(kokkos_coordinates);
500 host_temp_values(n, dim) = coords[n*stride];
503 Kokkos::deep_copy(kokkos_coordinates, host_temp_values);
504 elements = kokkos_coordinates;
virtual void getAdjsView(MeshEntityType source, MeshEntityType target, const offset_t *&offsets, const gno_t *&adjacencyIds) const
Sets pointers to this process' mesh first adjacencies.
Zoltan2::BaseAdapter< userTypes_t > base_adapter_t
virtual bool areEntityIDsUnique(MeshEntityType etype) const
Provide a pointer to the entity topology types.
int getNumWeightsPerID() const override
Returns the number of weights per object. Number of weights per object should be zero or greater...
void getIDsView(const gno_t *&Ids) const override
Provide a pointer to this process' identifiers.
virtual bool availAdjs(MeshEntityType source, MeshEntityType target) const
Returns whether a first adjacency combination is available.
typename InputTraits< User >::scalar_t scalar_t
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...
MeshAdapter defines the interface for mesh input.
virtual size_t getLocalNumOf(MeshEntityType etype) const =0
Returns the global number of mesh entities of MeshEntityType.
map_t::global_ordinal_type gno_t
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.
#define Z2_THROW_NOT_IMPLEMENTED
enum BaseAdapterType adapterType() const override
Returns the type of adapter.
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
virtual int getDimension() const
Return dimension of the entity coordinates, if any.
typename InputTraits< User >::part_t part_t
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...
void getCoordinatesKokkosView(Kokkos::View< scalar_t **, Kokkos::LayoutLeft, typename node_t::device_type > &elements) const override
virtual size_t getLocalNum2ndAdjs(MeshEntityType sourcetarget, MeshEntityType through) const
if avail2ndAdjs(), returns the number of second adjacencies on this process.
typename InputTraits< User >::node_t node_t
virtual void getIDsViewOf(MeshEntityType etype, gno_t const *&Ids) const =0
Provide a pointer to this process' identifiers.
size_t getLocalNumIDs() const override
Returns the number of objects 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.
typename InputTraits< User >::gno_t gno_t
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.
void getWeightsView(const scalar_t *&wgt, int &stride, int idx=0) const override
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...
EntityTopologyType
Enumerate entity topology types for meshes: points,lines,polygons,triangles,quadrilaterals, polyhedrons, tetrahedrons, hexhedrons, prisms, or pyramids.
typename InputTraits< User >::offset_t offset_t
void getCoordinatesView(const scalar_t *&coords, int &stride, int coordDim) const override
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.
typename BaseAdapter< User >::scalar_t scalar_t
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.
typename InputTraits< User >::lno_t lno_t
void getIDsKokkosView(Kokkos::View< const gno_t *, typename node_t::device_type > &ids) const override
Zoltan2::BasicUserTypes< zscalar_t, zlno_t, zgno_t > user_t