7 #ifndef WONTON_SUPPORT_WONTON_H_ 8 #define WONTON_SUPPORT_WONTON_H_ 12 #include "wonton-config.h" 15 #ifdef WONTON_ENABLE_THRUST 17 #include "thrust/device_vector.h" 18 #include "thrust/iterator/counting_iterator.h" 19 #include "thrust/transform.h" 23 #include <boost/iterator/counting_iterator.hpp> 31 #ifdef WONTON_ENABLE_MPI 35 #ifdef WONTON_ENABLE_KOKKOS 36 #include <Kokkos_Macros.hpp> 101 {
"Entity_kind::ALL_KIND",
102 "Entity_kind::ANY_KIND",
103 "Entity_kind::UNKNOWN_KIND",
109 "Entity_kind::WEDGE",
110 "Entity_kind::CORNER",
111 "Entity_kind::FACET",
112 "Entity_kind::BOUNDARY_FACE",
113 "Entity_kind::PARTICLE"};
115 int itype =
static_cast<int>(entkind)+3;
116 return ((itype >= 0 && itype < NUM_ENTITY_KIND) ? kind2string[itype] :
117 "INVALID Entity_kind");
137 {
"Entity_type::TYPE_UNKNOWN",
138 "Entity_type::DELETED",
139 "Entity_type::PARALLEL_OWNED",
140 "Entity_type::PARALLEL_GHOST",
141 "Entity_type::BOUNDARY_GHOST",
144 int itype =
static_cast<int>(enttype)+1;
145 return ((itype >= 0 && itype < NUM_ENTITY_TYPE) ? type2string[itype] :
146 "INVALID Entity_type");
169 {
"Element_type::UNKNOWN_TOPOLOGY",
171 "Element_type::QUAD",
172 "Element_type::POLYGON",
174 "Element_type::PRISM",
175 "Element_type::PYRAMID",
177 "Element_type::POLYHEDRON"};
179 int itype =
static_cast<int>(elemtype)+1;
180 return ((itype >= 0 && itype < NUM_ELEMENT_TYPE) ? type2string[itype] :
181 "INVALID Element_type");
196 {
"Field_type::UNKNOWN_TYPE_FIELD",
197 "Field_type::MESH_FIELD",
198 "Field_type::MULTIMATERIAL_FIELD"};
200 int itype =
static_cast<int>(field_type)+1;
201 return ((itype >= 0 && itype < NUM_FIELD_TYPE) ? type2string[itype] :
202 "INVALID FIELD TYPE");
214 {
"Data_layout::CELL_CENTRIC",
"Data_layout::MATERIAL_CENTRIC"};
216 int itype =
static_cast<int>(layout)+1;
217 return ((itype >= 0 && itype < NUM_DATA_LAYOUT) ? type2string[itype] :
218 "INVALID DATA LAYOUT");
231 #if !defined(WONTON_INLINE) 232 #ifdef WONTON_ENABLE_KOKKOS 233 #define WONTON_INLINE KOKKOS_INLINE_FUNCTION 235 #define WONTON_INLINE inline 239 #ifdef WONTON_ENABLE_MPI 240 struct MPIExecutor_type : Executor_type {
241 MPIExecutor_type(MPI_Comm comm) : mpicomm(comm) {}
242 MPI_Comm mpicomm = MPI_COMM_WORLD;
248 #ifdef WONTON_ENABLE_THRUST 251 using vector = thrust::device_vector<T>;
254 using pointer = thrust::device_ptr<T>;
261 template<
typename InputIterator,
typename OutputIterator,
262 typename UnaryFunction>
263 inline OutputIterator
transform(InputIterator first, InputIterator last,
264 OutputIterator result, UnaryFunction op) {
268 template<
typename InputIterator1,
typename InputIterator2,
269 typename OutputIterator,
typename BinaryFunction>
270 inline OutputIterator
transform(InputIterator1 first1, InputIterator1 last1,
271 InputIterator2 first2, OutputIterator result,
276 template<
typename InputIterator,
typename UnaryFunction>
277 inline void for_each(InputIterator first, InputIterator last,
292 return boost::make_counting_iterator<int>(i);
295 template<
typename InputIterator,
typename OutputIterator,
296 typename UnaryFunction>
297 inline OutputIterator
transform(InputIterator first, InputIterator last,
298 OutputIterator result, UnaryFunction op) {
302 template<
typename InputIterator1,
typename InputIterator2,
303 typename OutputIterator,
typename BinaryFunction>
304 inline OutputIterator
transform(InputIterator1 first1, InputIterator1 last1,
305 InputIterator2 first2, OutputIterator result,
310 template<
typename InputIterator,
typename UnaryFunction>
311 inline void for_each(InputIterator first, InputIterator last,
320 Weights_t(
int const entityID_in, std::vector<double>
const& weights_in) :
321 entityID(entityID_in), weights(weights_in) {}
323 entityID(source.entityID), weights(source.weights) {}
329 inline double pow2(
double x) {
return x*x; }
333 #ifdef WONTON_ENABLE_MPI 334 template<
typename T> MPI_Datatype to_MPI_Datatype();
335 template<>
inline MPI_Datatype to_MPI_Datatype<GID_t>() {
336 return (
sizeof(GID_t) == 8 ? MPI_LONG_LONG : MPI_INT);
343 #endif // WONTON_SUPPORT_WONTON_H_
constexpr int NUM_FIELD_TYPE
Definition: wonton.h:192
OutputIterator transform(InputIterator first, InputIterator last, OutputIterator result, UnaryFunction op)
Definition: wonton.h:297
Weights_t(Weights_t const &source)
Definition: wonton.h:322
Factorize a number N into D equal (or nearly equal) factors.
Definition: adaptive_refinement_mesh.h:31
std::vector< T > vector
Definition: wonton.h:285
Weights_t()
Definition: wonton.h:319
constexpr int NUM_ENTITY_KIND
Definition: wonton.h:96
Entity_type
The parallel type of a given entity.
Definition: wonton.h:124
T * pointer
Definition: wonton.h:288
Data_layout
Definition: wonton.h:209
boost::counting_iterator< int > counting_iterator
Definition: wonton.h:290
constexpr int NUM_ENTITY_TYPE
Definition: wonton.h:132
std::vector< double > weights
Definition: wonton.h:326
constexpr int NUM_ELEMENT_TYPE
Definition: wonton.h:164
Field_type
Field type - whether it is mesh field or multi-material field.
Definition: wonton.h:187
counting_iterator make_counting_iterator(int const i)
Definition: wonton.h:291
Entity_kind
The type of mesh entity.
Definition: wonton.h:81
Weights_t(int const entityID_in, std::vector< double > const &weights_in)
Definition: wonton.h:320
int64_t GID_t
Definition: wonton.h:76
void for_each(InputIterator first, InputIterator last, UnaryFunction f)
Definition: wonton.h:311
double pow2(double x)
Definition: wonton.h:329
constexpr int NUM_DATA_LAYOUT
Definition: wonton.h:210
Element_type
Element (cell topology) type.
Definition: wonton.h:153
OutputIterator transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, OutputIterator result, BinaryFunction op)
Definition: wonton.h:304
std::string to_string(Entity_kind entkind)
Definition: wonton.h:99
int entityID
Definition: wonton.h:325