7 #ifndef PORTAGE_SUPPORT_PORTAGE_H_ 8 #define PORTAGE_SUPPORT_PORTAGE_H_ 12 #include "portage-config.h" 15 #ifdef PORTAGE_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> 32 #include "wonton/support/Point.h" 33 #include "wonton/support/Vector.h" 34 #include "wonton/support/Matrix.h" 35 #include "wonton/support/wonton.h" 77 using Wonton::Entity_kind;
78 using Wonton::Entity_type;
79 using Wonton::Element_type;
80 using Wonton::Field_type;
81 using Wonton::Data_layout;
82 using Wonton::Weights_t;
96 inline std::string
to_string(Limiter_type limiter_type) {
97 switch(limiter_type) {
98 case NOLIMITER:
return std::string(
"Limiter_type::NOLIMITER");
99 case BARTH_JESPERSEN:
return std::string(
"Limiter_type::BARTH_JESPERSEN");
100 default:
return std::string(
"INVALID LIMITER TYPE");
104 inline std::string
to_string(Boundary_Limiter_type boundary_limiter_type) {
105 switch(boundary_limiter_type) {
106 case BND_NOLIMITER:
return std::string(
"Boundary_Limiter_type::BND_NOLIMITER");
107 case BND_ZERO_GRADIENT:
return std::string(
"Boundary_Limiter_type::BND_ZERO_GRADIENT");
108 case BND_BARTH_JESPERSEN:
return std::string(
"Boundary_Limiter_type::BND_BARTH_JESPERSEN");
109 default:
return std::string(
"INVALID BOUNDARY LIMITER TYPE");
121 inline std::string
to_string(Partial_fixup_type partial_fixup_type) {
123 {
"Partial_fixup_type::CONSTANT",
124 "Partial_fixup_type::LOCALLY_CONSERVATIVE",
125 "Partial_fixup_type::SHIFTED_CONSERVATIVE"};
127 int itype =
static_cast<int>(partial_fixup_type);
128 return (itype >= 0 && itype < NUM_PARTIAL_FIXUP_TYPE) ? type2string[itype] :
129 "INVALID PARTIAL FIXUP TYPE";
140 inline std::string
to_string(Empty_fixup_type empty_fixup_type) {
142 {
"Empty_fixup_type::LEAVE_EMPTY",
143 "Empty_fixup_type::EXTRAPOLATE",
144 "Empty_fixup_type::FILL"};
146 int itype =
static_cast<int>(empty_fixup_type);
147 return (itype >= 0 && itype < NUM_EMPTY_FIXUP_TYPE) ? type2string[itype] :
148 "INVALID EMPTY FIXUP TYPE";
201 #ifdef PORTAGE_ENABLE_THRUST 204 using vector = thrust::device_vector<T>;
207 using pointer = thrust::device_ptr<T>;
214 template<
typename InputIterator,
typename OutputIterator,
215 typename UnaryFunction>
216 inline OutputIterator
transform(InputIterator first, InputIterator last,
217 OutputIterator result, UnaryFunction op) {
221 template<
typename InputIterator1,
typename InputIterator2,
222 typename OutputIterator,
typename BinaryFunction>
223 inline OutputIterator
transform(InputIterator1 first1, InputIterator1 last1,
224 InputIterator2 first2, OutputIterator result,
229 template<
typename InputIterator,
typename UnaryFunction>
230 inline void for_each(InputIterator first, InputIterator last,
245 return boost::make_counting_iterator<unsigned int>(i);
248 template<
typename InputIterator,
typename OutputIterator,
249 typename UnaryFunction>
250 inline OutputIterator
transform(InputIterator first, InputIterator last,
251 OutputIterator result, UnaryFunction op) {
255 template<
typename InputIterator1,
typename InputIterator2,
256 typename OutputIterator,
typename BinaryFunction>
257 inline OutputIterator
transform(InputIterator1 first1, InputIterator1 last1,
258 InputIterator2 first2, OutputIterator result,
263 template<
typename InputIterator,
typename UnaryFunction>
264 inline void for_each(InputIterator first, InputIterator last,
273 #endif // PORTAGE_SUPPORT_PORTAGE_H_ double min_absolute_distance
Definition: portage.h:165
double relative_conservation_eps
Definition: portage.h:178
constexpr int NUM_LIMITER_TYPE
Definition: portage.h:86
const NumericTolerances_t DEFAULT_NUMERIC_TOLERANCES
Definition: portage.h:186
Boundary_Limiter_type
Boundary limiter type.
Definition: portage.h:91
constexpr Boundary_Limiter_type DEFAULT_BND_LIMITER
Definition: portage.h:94
constexpr int NUM_Boundary_Limiter_type
Definition: portage.h:92
std::vector< T > vector
Definition: portage.h:238
OutputIterator transform(InputIterator first, InputIterator last, OutputIterator result, UnaryFunction op)
Definition: portage.h:250
constexpr Empty_fixup_type DEFAULT_EMPTY_FIXUP_TYPE
Definition: portage.h:138
Intersection and other tolerances to handle tiny values.
Definition: portage.h:152
constexpr int NUM_EMPTY_FIXUP_TYPE
Definition: portage.h:136
T * pointer
Definition: portage.h:241
int max_num_fixup_iter
Definition: portage.h:181
double minimal_intersection_volume
Definition: portage.h:160
constexpr int NUM_PARTIAL_FIXUP_TYPE
Definition: portage.h:116
void for_each(InputIterator first, InputIterator last, UnaryFunction f)
Definition: portage.h:264
Definition: portage.h:114
Partial_fixup_type
Fixup options for partially filled cells.
Definition: portage.h:114
Definition: portage.h:134
double const epsilon
Numerical tolerance.
Definition: weight.h:34
Limiter_type
Limiter type.
Definition: portage.h:85
bool user_tolerances
Definition: portage.h:155
Definition: portage.h:134
double min_absolute_volume
Definition: portage.h:174
Definition: portage.h:114
Definition: coredriver.h:42
constexpr Limiter_type DEFAULT_LIMITER
Definition: portage.h:88
Definition: portage.h:134
Definition: portage.h:114
counting_iterator make_counting_iterator(unsigned int const i)
Definition: portage.h:244
boost::counting_iterator< unsigned int > counting_iterator
Definition: portage.h:243
std::string to_string(Limiter_type limiter_type)
Definition: portage.h:96
OutputIterator transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, OutputIterator result, BinaryFunction op)
Definition: portage.h:257
constexpr Partial_fixup_type DEFAULT_PARTIAL_FIXUP_TYPE
Definition: portage.h:118
Empty_fixup_type
Fixup options for empty cells.
Definition: portage.h:134