15#ifndef _ZOLTAN2_MESHADAPTER_HPP_
16#define _ZOLTAN2_MESHADAPTER_HPP_
19#include "TpetraExt_MatrixMatrix.hpp"
87template <
typename User>
91#ifndef DOXYGEN_SHOULD_SKIP_THIS
99 typedef User userCoord_t;
137 gno_t const *&Ids)
const = 0;
201 const scalar_t *&coords,
int &stride,
int coordDim)
const
273 const gno_t *&adjacencyIds)
const
313 return this->primaryEntityType;
322 return this->adjacencyEntityType;
331 return this->secondAdjacencyEntityType;
341 std::string satypestr) {
343 if (ptypestr != atypestr && ptypestr != satypestr) {
344 if (ptypestr ==
"region")
346 else if (ptypestr ==
"face")
348 else if (ptypestr ==
"edge")
350 else if (ptypestr ==
"vertex")
353 std::ostringstream emsg;
354 emsg << __FILE__ <<
"," << __LINE__
355 <<
" error: Invalid MeshEntityType " << ptypestr << std::endl;
356 emsg <<
"Valid values: region face edge vertex" << std::endl;
357 throw std::runtime_error(emsg.str());
360 if (atypestr ==
"region")
362 else if (atypestr ==
"face")
364 else if (atypestr ==
"edge")
366 else if (atypestr ==
"vertex")
369 std::ostringstream emsg;
370 emsg << __FILE__ <<
"," << __LINE__
371 <<
" error: Invalid MeshEntityType " << atypestr << std::endl;
372 emsg <<
"Valid values: region face edge vertex" << std::endl;
373 throw std::runtime_error(emsg.str());
376 if (satypestr ==
"region")
378 else if (satypestr ==
"face")
379 this->secondAdjacencyEntityType =
MESH_FACE;
380 else if (satypestr ==
"edge")
381 this->secondAdjacencyEntityType =
MESH_EDGE;
382 else if (satypestr ==
"vertex")
385 std::ostringstream emsg;
386 emsg << __FILE__ <<
"," << __LINE__
387 <<
" error: Invalid MeshEntityType " << satypestr << std::endl;
388 emsg <<
"Valid values: region face edge vertex" << std::endl;
389 throw std::runtime_error(emsg.str());
393 std::ostringstream emsg;
394 emsg << __FILE__ <<
"," << __LINE__
395 <<
" error: PrimaryEntityType " << ptypestr
396 <<
" matches AdjacencyEntityType " << atypestr
397 <<
" or SecondAdjacencyEntityType " << satypestr << std::endl;
398 throw std::runtime_error(emsg.str());
422 typename node_t::device_type> &ids)
const override
424 Kokkos::View<gno_t *, typename node_t::device_type>
426 auto host_kokkos_ids = Kokkos::create_mirror_view(kokkos_ids);
431 host_kokkos_ids(n) = gnos[n];
433 Kokkos::deep_copy(kokkos_ids, host_kokkos_ids);
446 int coordDim)
const override
453 Kokkos::View<scalar_t **, Kokkos::LayoutLeft, typename node_t::device_type> & elements)
const override
456 Kokkos::View<scalar_t **, Kokkos::LayoutLeft, typename node_t::device_type>
458 auto host_temp_values = Kokkos::create_mirror_view(kokkos_coordinates);
464 host_temp_values(n, dim) = coords[n*stride];
467 Kokkos::deep_copy(kokkos_coordinates, host_temp_values);
468 elements = kokkos_coordinates;
Zoltan2::BasicUserTypes< zscalar_t, zlno_t, zgno_t > user_t
#define Z2_THROW_NOT_IMPLEMENTED
typename BaseAdapter< User >::scalar_t scalar_t
typename InputTraits< User >::node_t node_t
typename InputTraits< User >::lno_t lno_t
typename InputTraits< User >::gno_t gno_t
typename InputTraits< User >::offset_t offset_t
typename InputTraits< User >::part_t part_t
MeshAdapter defines the interface for mesh input.
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 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 int getNumWeightsPer2ndAdj(MeshEntityType sourcetarget, MeshEntityType through) const
Returns the number (0 or greater) of weights per second adjacency. Note: second-adjacency weights may...
void getCoordinatesKokkosView(Kokkos::View< scalar_t **, Kokkos::LayoutLeft, typename node_t::device_type > &elements) const override
size_t getLocalNumIDs() const override
Returns the number of objects on this process.
virtual bool availAdjs(MeshEntityType source, MeshEntityType target) const
Returns whether a first adjacency combination is available.
virtual int getNumWeightsPerOf(MeshEntityType etype) const
Return the number of weights per entity.
void getIDsKokkosView(Kokkos::View< const gno_t *, typename node_t::device_type > &ids) const override
virtual size_t getLocalNum2ndAdjs(MeshEntityType sourcetarget, MeshEntityType through) const
if avail2ndAdjs(), returns the number of second adjacencies on this process.
void getIDsView(const gno_t *&Ids) const override
Provide a pointer to this process' identifiers.
void getCoordinatesView(const scalar_t *&coords, int &stride, int coordDim) const override
virtual void getTopologyViewOf(MeshEntityType etype, enum EntityTopologyType const *&Types) const
Provide a pointer to the entity topology types.
enum MeshEntityType getAdjacencyEntityType() const
Returns the entity that describes adjacencies between the entities to be partitioned,...
enum BaseAdapterType adapterType() const override
Returns the type of adapter.
virtual int getDimension() const
Return dimension of the entity coordinates, if any.
virtual size_t getLocalNumOf(MeshEntityType etype) const =0
Returns the global number of mesh entities of MeshEntityType.
virtual size_t getLocalNumAdjs(MeshEntityType source, MeshEntityType target) const
Returns the number of first adjacencies on this process.
virtual void getIDsViewOf(MeshEntityType etype, gno_t const *&Ids) const =0
Provide a pointer to this process' identifiers.
virtual bool areEntityIDsUnique(MeshEntityType etype) const
Provide a pointer to the entity topology types.
virtual void getCoordinatesViewOf(MeshEntityType etype, const scalar_t *&coords, int &stride, int coordDim) const
Provide a pointer to one dimension of entity 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.
enum MeshEntityType getSecondAdjacencyEntityType() const
Returns the entity that describes second adjacencies between the entities to be partitioned,...
void getWeightsView(const scalar_t *&wgt, int &stride, int idx=0) const override
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 ...
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 getPrimaryEntityType() const
Returns the entity to be partitioned, ordered, colored, etc.
int getNumWeightsPerID() const override
Returns the number of weights per object. Number of weights per object should be zero or greater....
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...
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
bool useDegreeAsWeight(int idx) const
Created by mbenlioglu on Aug 31, 2020.
EntityTopologyType
Enumerate entity topology types for meshes: points,lines,polygons,triangles,quadrilaterals,...
BaseAdapterType
An enum to identify general types of adapters.
@ MeshAdapterType
mesh data
MeshEntityType
Enumerate entity types for meshes: Regions, Faces, Edges, or Vertices.