diff --git a/.gitattributes b/.gitattributes index 79ac99f3f..2174096fc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -14,4 +14,4 @@ data/* filter=lfs diff=lfs merge=lfs -text *.rst whitespace=tab-in-indent conflict-marker-size=79 *.txt whitespace=tab-in-indent -diy/** -format.clang-format -whitespace +vtkm/thirdparty/diy/vtkmdiy/** -format.clang-format -whitespace diff --git a/CMake/VTKmCheckCopyright.cmake b/CMake/VTKmCheckCopyright.cmake index cddeb3f73..d201a570c 100644 --- a/CMake/VTKmCheckCopyright.cmake +++ b/CMake/VTKmCheckCopyright.cmake @@ -39,9 +39,7 @@ set(FILES_TO_CHECK set(EXCEPTIONS LICENSE.txt README.txt - diy/include/diy - diy/LEGAL.txt - diy/LICENSE.txt + vtkm/thirdparty/diy/vtkmdiy ) if (NOT VTKm_SOURCE_DIR) diff --git a/CMake/VTKmCheckSourceInBuild.cmake b/CMake/VTKmCheckSourceInBuild.cmake index f727ef6ab..f0f7af500 100644 --- a/CMake/VTKmCheckSourceInBuild.cmake +++ b/CMake/VTKmCheckSourceInBuild.cmake @@ -39,11 +39,21 @@ set(FILES_TO_CHECK set(EXCEPTIONS ) +set(DIRECTORY_EXCEPTIONS + ${VTKm_SOURCE_DIR}/vtkm/thirdparty/diy/vtkmdiy + ) + if (NOT VTKm_SOURCE_DIR) message(SEND_ERROR "VTKm_SOURCE_DIR not defined.") endif (NOT VTKm_SOURCE_DIR) function(check_directory directory parent_CMakeLists_contents) + foreach(exception IN LISTS DIRECTORY_EXCEPTIONS) + if(directory MATCHES "^${exception}$") + return() + endif() + endforeach(exception) + message("Checking directory ${directory}...") get_filename_component(directory_name "${directory}" NAME) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e894fb5c..ce76e86ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -206,8 +206,8 @@ if(VTKm_ENABLE_MPI) if (NOT MPI_C_FOUND) find_package(MPI ${VTKm_FIND_PACKAGE_QUIETLY}) endif() - add_subdirectory(diy) endif() + add_subdirectory(vtkm) #----------------------------------------------------------------------------- diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index db108069e..23286b660 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -20,4 +20,7 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION ".*warning: ignoring loop annotation.*" -) + ".*diy.include.diy.*WShadow.*" # exclude `diy` shadow warnings. + ".*diy.include.diy.*note: shadowed.*" # exclude `diy` shadow warnings. + ".*diy.include.diy.storage.hpp.*Wunused-result.*" # this is a TODO in DIY. +) diff --git a/benchmarking/BenchmarkCopySpeeds.cxx b/benchmarking/BenchmarkCopySpeeds.cxx index 2c76e6e17..15a422259 100644 --- a/benchmarking/BenchmarkCopySpeeds.cxx +++ b/benchmarking/BenchmarkCopySpeeds.cxx @@ -80,8 +80,8 @@ struct MeasureCopySpeed VTKM_CONT std::string Description() const { - vtkm::UInt64 actualSize = - static_cast(this->Source.GetNumberOfValues() * sizeof(ValueType)); + vtkm::UInt64 actualSize = sizeof(ValueType); + actualSize *= static_cast(this->Source.GetNumberOfValues()); std::ostringstream out; out << "Copying " << HumanSize(this->NumBytes) << " (actual=" << HumanSize(actualSize) << ") of " << vtkm::testing::TypeName::Name() << "\n"; diff --git a/benchmarking/BenchmarkDeviceAdapter.cxx b/benchmarking/BenchmarkDeviceAdapter.cxx index 2617805a4..0b81786ba 100644 --- a/benchmarking/BenchmarkDeviceAdapter.cxx +++ b/benchmarking/BenchmarkDeviceAdapter.cxx @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -108,7 +109,7 @@ struct BenchDevAlgoConfig /// @note FixBytes and FixSizes are not mutually exclusive. If both are /// specified, both will run. bool TestArraySizeValues{ false }; - vtkm::Id ArraySizeValues{ 1 << 21 }; + vtkm::UInt64 ArraySizeValues{ 1 << 21 }; /// If true, operations like "Unique" will test with a wider range of unique /// values (5%, 10%, 15%, 20%, 25%, 30%, 35%, 40%, 45%, 50%, 75%, 100% @@ -126,7 +127,7 @@ struct BenchDevAlgoConfig { return this->DoByteSizes ? static_cast(this->ArraySizeBytes / static_cast(sizeof(T))) - : this->ArraySizeValues; + : static_cast(this->ArraySizeValues); } }; @@ -291,8 +292,8 @@ private: { vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; - description << "Copy " << arraySize << " values (" << HumanSize(arraySize * sizeof(Value)) - << ")"; + description << "Copy " << arraySize << " values (" + << HumanSize(static_cast(arraySize) * sizeof(Value)) << ")"; return description.str(); } }; @@ -337,8 +338,8 @@ private: vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; description << "CopyIf on " << arraySize << " values (" - << HumanSize(arraySize * sizeof(Value)) << ") with " << PERCENT_VALID - << "% valid values"; + << HumanSize(static_cast(arraySize) * sizeof(Value)) << ") with " + << PERCENT_VALID << "% valid values"; return description.str(); } }; @@ -393,8 +394,8 @@ private: vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; description << "LowerBounds on " << arraySize << " input values (" - << "(" << HumanSize(arraySize * sizeof(Value)) << ") (" << PERCENT_VALUES - << "% configuration)"; + << "(" << HumanSize(static_cast(arraySize) * sizeof(Value)) << ") (" + << PERCENT_VALUES << "% configuration)"; return description.str(); } }; @@ -451,7 +452,7 @@ private: vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; description << "Reduce on " << arraySize << " values (" - << HumanSize(arraySize * sizeof(Value)) << ")"; + << HumanSize(static_cast(arraySize) * sizeof(Value)) << ")"; return description.str(); } }; @@ -496,8 +497,8 @@ private: vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; description << "ReduceByKey on " << arraySize << " values (" - << HumanSize(arraySize * sizeof(Value)) << ") with " << N_KEYS << " (" - << PERCENT_KEYS << "%) distinct vtkm::Id keys"; + << HumanSize(static_cast(arraySize) * sizeof(Value)) << ") with " + << N_KEYS << " (" << PERCENT_KEYS << "%) distinct vtkm::Id keys"; return description.str(); } }; @@ -543,7 +544,7 @@ private: vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; description << "ScanInclusive on " << arraySize << " values (" - << HumanSize(arraySize * sizeof(Value)) << ")"; + << HumanSize(static_cast(arraySize) * sizeof(Value)) << ")"; return description.str(); } }; @@ -579,7 +580,7 @@ private: vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; description << "ScanExclusive on " << arraySize << " values (" - << HumanSize(arraySize * sizeof(Value)) << ")"; + << HumanSize(static_cast(arraySize) * sizeof(Value)) << ")"; return description.str(); } }; @@ -621,7 +622,7 @@ private: vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; description << "Sort on " << arraySize << " random values (" - << HumanSize(arraySize * sizeof(Value)) << ")"; + << HumanSize(static_cast(arraySize) * sizeof(Value)) << ")"; return description.str(); } }; @@ -674,8 +675,8 @@ private: vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; description << "SortByKey on " << arraySize << " random values (" - << HumanSize(arraySize * sizeof(Value)) << ") with " << N_KEYS << " (" - << PERCENT_KEYS << "%) different vtkm::Id keys"; + << HumanSize(static_cast(arraySize) * sizeof(Value)) << ") with " + << N_KEYS << " (" << PERCENT_KEYS << "%) different vtkm::Id keys"; return description.str(); } }; @@ -731,7 +732,7 @@ private: vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; description << "StableSortIndices::Sort on " << arraySize << " random values (" - << HumanSize(arraySize * sizeof(Value)) << ")"; + << HumanSize(static_cast(arraySize) * sizeof(Value)) << ")"; return description.str(); } }; @@ -775,8 +776,8 @@ private: vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; description << "StableSortIndices::Unique on " << arraySize << " values (" - << HumanSize(arraySize * sizeof(Value)) << ") with " << this->N_VALID << " (" - << PERCENT_VALID << "%) valid values"; + << HumanSize(static_cast(arraySize) * sizeof(Value)) << ") with " + << this->N_VALID << " (" << PERCENT_VALID << "%) valid values"; return description.str(); } }; @@ -831,8 +832,8 @@ private: vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; description << "Unique on " << arraySize << " values (" - << HumanSize(arraySize * sizeof(Value)) << ") with " << N_VALID << " (" - << PERCENT_VALID << "%) valid values"; + << HumanSize(static_cast(arraySize) * sizeof(Value)) << ") with " + << N_VALID << " (" << PERCENT_VALID << "%) valid values"; return description.str(); } }; @@ -887,8 +888,8 @@ private: vtkm::Id arraySize = Config.ComputeSize(); std::stringstream description; description << "UpperBounds on " << arraySize << " input and " << N_VALS << " (" - << PERCENT_VALS - << "%) values (input array size: " << HumanSize(arraySize * sizeof(Value)) << ")"; + << PERCENT_VALS << "%) values (input array size: " + << HumanSize(static_cast(arraySize) * sizeof(Value)) << ")"; return description.str(); } }; @@ -1196,7 +1197,9 @@ int main(int argc, char* argv[]) for (int i = 1; i < argc; ++i) { std::string arg = argv[i]; - std::transform(arg.begin(), arg.end(), arg.begin(), ::tolower); + std::transform(arg.begin(), arg.end(), arg.begin(), [](char c) { + return static_cast(std::tolower(static_cast(c))); + }); if (arg == "copy") { config.BenchmarkFlags |= vtkm::benchmarking::COPY; @@ -1253,7 +1256,9 @@ int main(int argc, char* argv[]) { ++i; arg = argv[i]; - std::transform(arg.begin(), arg.end(), arg.begin(), ::tolower); + std::transform(arg.begin(), arg.end(), arg.begin(), [](char c) { + return static_cast(std::tolower(static_cast(c))); + }); if (arg == "base") { config.ExtendedTypeList = false; @@ -1272,7 +1277,9 @@ int main(int argc, char* argv[]) { ++i; arg = argv[i]; - std::transform(arg.begin(), arg.end(), arg.begin(), ::tolower); + std::transform(arg.begin(), arg.end(), arg.begin(), [](char c) { + return static_cast(std::tolower(static_cast(c))); + }); if (arg == "off") { config.TestArraySizeBytes = false; @@ -1288,7 +1295,9 @@ int main(int argc, char* argv[]) { ++i; arg = argv[i]; - std::transform(arg.begin(), arg.end(), arg.begin(), ::tolower); + std::transform(arg.begin(), arg.end(), arg.begin(), [](char c) { + return static_cast(std::tolower(static_cast(c))); + }); if (arg == "off") { config.TestArraySizeValues = false; diff --git a/benchmarking/BenchmarkFieldAlgorithms.cxx b/benchmarking/BenchmarkFieldAlgorithms.cxx index 6415a74b7..9483a003b 100644 --- a/benchmarking/BenchmarkFieldAlgorithms.cxx +++ b/benchmarking/BenchmarkFieldAlgorithms.cxx @@ -35,6 +35,7 @@ #include "Benchmarker.h" #include +#include #include #include @@ -922,7 +923,9 @@ int main(int argc, char* argv[]) for (int i = 1; i < argc; ++i) { std::string arg = argv[i]; - std::transform(arg.begin(), arg.end(), arg.begin(), ::tolower); + std::transform(arg.begin(), arg.end(), arg.begin(), [](char c) { + return static_cast(std::tolower(static_cast(c))); + }); if (arg == "blackscholes") { benchmarks |= vtkm::benchmarking::BLACK_SCHOLES; diff --git a/benchmarking/BenchmarkRayTracing.cxx b/benchmarking/BenchmarkRayTracing.cxx index 8d1e30a91..712be3131 100644 --- a/benchmarking/BenchmarkRayTracing.cxx +++ b/benchmarking/BenchmarkRayTracing.cxx @@ -107,7 +107,6 @@ VTKM_MAKE_BENCHMARK(RayTracing, BenchRayTracing); int main(int, char* []) { - using TestTypes = vtkm::ListTagBase; VTKM_RUN_BENCHMARK(RayTracing, vtkm::ListTagBase()); return 0; } diff --git a/benchmarking/BenchmarkTopologyAlgorithms.cxx b/benchmarking/BenchmarkTopologyAlgorithms.cxx index 33b28a741..cd9b81325 100644 --- a/benchmarking/BenchmarkTopologyAlgorithms.cxx +++ b/benchmarking/BenchmarkTopologyAlgorithms.cxx @@ -32,6 +32,7 @@ #include "Benchmarker.h" #include +#include #include #include @@ -470,7 +471,9 @@ int main(int argc, char* argv[]) for (int i = 1; i < argc; ++i) { std::string arg = argv[i]; - std::transform(arg.begin(), arg.end(), arg.begin(), ::tolower); + std::transform(arg.begin(), arg.end(), arg.begin(), [](char c) { + return static_cast(std::tolower(static_cast(c))); + }); if (arg == "celltopoint") { benchmarks |= vtkm::benchmarking::CELL_TO_POINT; diff --git a/diy/include/diy/fmt/format.cc b/diy/include/diy/fmt/format.cc deleted file mode 100644 index ae5d11034..000000000 --- a/diy/include/diy/fmt/format.cc +++ /dev/null @@ -1,935 +0,0 @@ -/* - Formatting library for C++ - - Copyright (c) 2012 - 2016, Victor Zverovich - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "format.h" - -#include - -#include -#include -#include -#include -#include -#include // for std::ptrdiff_t - -#if defined(_WIN32) && defined(__MINGW32__) -# include -#endif - -#if FMT_USE_WINDOWS_H -# if defined(NOMINMAX) || defined(FMT_WIN_MINMAX) -# include -# else -# define NOMINMAX -# include -# undef NOMINMAX -# endif -#endif - -using fmt::internal::Arg; - -#if FMT_EXCEPTIONS -# define FMT_TRY try -# define FMT_CATCH(x) catch (x) -#else -# define FMT_TRY if (true) -# define FMT_CATCH(x) if (false) -#endif - -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable: 4127) // conditional expression is constant -# pragma warning(disable: 4702) // unreachable code -// Disable deprecation warning for strerror. The latter is not called but -// MSVC fails to detect it. -# pragma warning(disable: 4996) -#endif - -// Dummy implementations of strerror_r and strerror_s called if corresponding -// system functions are not available. -static inline fmt::internal::Null<> strerror_r(int, char *, ...) { - return fmt::internal::Null<>(); -} -static inline fmt::internal::Null<> strerror_s(char *, std::size_t, ...) { - return fmt::internal::Null<>(); -} - -namespace fmt { -namespace { - -#ifndef _MSC_VER -# define FMT_SNPRINTF snprintf -#else // _MSC_VER -inline int fmt_snprintf(char *buffer, size_t size, const char *format, ...) { - va_list args; - va_start(args, format); - int result = vsnprintf_s(buffer, size, _TRUNCATE, format, args); - va_end(args); - return result; -} -# define FMT_SNPRINTF fmt_snprintf -#endif // _MSC_VER - -#if defined(_WIN32) && defined(__MINGW32__) && !defined(__NO_ISOCEXT) -# define FMT_SWPRINTF snwprintf -#else -# define FMT_SWPRINTF swprintf -#endif // defined(_WIN32) && defined(__MINGW32__) && !defined(__NO_ISOCEXT) - -// Checks if a value fits in int - used to avoid warnings about comparing -// signed and unsigned integers. -template -struct IntChecker { - template - static bool fits_in_int(T value) { - unsigned max = INT_MAX; - return value <= max; - } - static bool fits_in_int(bool) { return true; } -}; - -template <> -struct IntChecker { - template - static bool fits_in_int(T value) { - return value >= INT_MIN && value <= INT_MAX; - } - static bool fits_in_int(int) { return true; } -}; - -const char RESET_COLOR[] = "\x1b[0m"; - -typedef void (*FormatFunc)(Writer &, int, StringRef); - -// Portable thread-safe version of strerror. -// Sets buffer to point to a string describing the error code. -// This can be either a pointer to a string stored in buffer, -// or a pointer to some static immutable string. -// Returns one of the following values: -// 0 - success -// ERANGE - buffer is not large enough to store the error message -// other - failure -// Buffer should be at least of size 1. -int safe_strerror( - int error_code, char *&buffer, std::size_t buffer_size) FMT_NOEXCEPT { - FMT_ASSERT(buffer != 0 && buffer_size != 0, "invalid buffer"); - - class StrError { - private: - int error_code_; - char *&buffer_; - std::size_t buffer_size_; - - // A noop assignment operator to avoid bogus warnings. - void operator=(const StrError &) {} - - // Handle the result of XSI-compliant version of strerror_r. - int handle(int result) { - // glibc versions before 2.13 return result in errno. - return result == -1 ? errno : result; - } - - // Handle the result of GNU-specific version of strerror_r. - int handle(char *message) { - // If the buffer is full then the message is probably truncated. - if (message == buffer_ && strlen(buffer_) == buffer_size_ - 1) - return ERANGE; - buffer_ = message; - return 0; - } - - // Handle the case when strerror_r is not available. - int handle(internal::Null<>) { - return fallback(strerror_s(buffer_, buffer_size_, error_code_)); - } - - // Fallback to strerror_s when strerror_r is not available. - int fallback(int result) { - // If the buffer is full then the message is probably truncated. - return result == 0 && strlen(buffer_) == buffer_size_ - 1 ? - ERANGE : result; - } - - // Fallback to strerror if strerror_r and strerror_s are not available. - int fallback(internal::Null<>) { - errno = 0; - buffer_ = strerror(error_code_); - return errno; - } - - public: - StrError(int err_code, char *&buf, std::size_t buf_size) - : error_code_(err_code), buffer_(buf), buffer_size_(buf_size) {} - - int run() { - strerror_r(0, 0, ""); // Suppress a warning about unused strerror_r. - return handle(strerror_r(error_code_, buffer_, buffer_size_)); - } - }; - return StrError(error_code, buffer, buffer_size).run(); -} - -void format_error_code(Writer &out, int error_code, - StringRef message) FMT_NOEXCEPT { - // Report error code making sure that the output fits into - // INLINE_BUFFER_SIZE to avoid dynamic memory allocation and potential - // bad_alloc. - out.clear(); - static const char SEP[] = ": "; - static const char ERROR_STR[] = "error "; - // Subtract 2 to account for terminating null characters in SEP and ERROR_STR. - std::size_t error_code_size = sizeof(SEP) + sizeof(ERROR_STR) - 2; - typedef internal::IntTraits::MainType MainType; - MainType abs_value = static_cast(error_code); - if (internal::is_negative(error_code)) { - abs_value = 0 - abs_value; - ++error_code_size; - } - error_code_size += internal::count_digits(abs_value); - if (message.size() <= internal::INLINE_BUFFER_SIZE - error_code_size) - out << message << SEP; - out << ERROR_STR << error_code; - assert(out.size() <= internal::INLINE_BUFFER_SIZE); -} - -void report_error(FormatFunc func, int error_code, - StringRef message) FMT_NOEXCEPT { - MemoryWriter full_message; - func(full_message, error_code, message); - // Use Writer::data instead of Writer::c_str to avoid potential memory - // allocation. - std::fwrite(full_message.data(), full_message.size(), 1, stderr); - std::fputc('\n', stderr); -} - -// IsZeroInt::visit(arg) returns true iff arg is a zero integer. -class IsZeroInt : public ArgVisitor { - public: - template - bool visit_any_int(T value) { return value == 0; } -}; - -// Checks if an argument is a valid printf width specifier and sets -// left alignment if it is negative. -class WidthHandler : public ArgVisitor { - private: - FormatSpec &spec_; - - FMT_DISALLOW_COPY_AND_ASSIGN(WidthHandler); - - public: - explicit WidthHandler(FormatSpec &spec) : spec_(spec) {} - - void report_unhandled_arg() { - FMT_THROW(FormatError("width is not integer")); - } - - template - unsigned visit_any_int(T value) { - typedef typename internal::IntTraits::MainType UnsignedType; - UnsignedType width = static_cast(value); - if (internal::is_negative(value)) { - spec_.align_ = ALIGN_LEFT; - width = 0 - width; - } - if (width > INT_MAX) - FMT_THROW(FormatError("number is too big")); - return static_cast(width); - } -}; - -class PrecisionHandler : public ArgVisitor { - public: - void report_unhandled_arg() { - FMT_THROW(FormatError("precision is not integer")); - } - - template - int visit_any_int(T value) { - if (!IntChecker::is_signed>::fits_in_int(value)) - FMT_THROW(FormatError("number is too big")); - return static_cast(value); - } -}; - -template -struct is_same { - enum { value = 0 }; -}; - -template -struct is_same { - enum { value = 1 }; -}; - -// An argument visitor that converts an integer argument to T for printf, -// if T is an integral type. If T is void, the argument is converted to -// corresponding signed or unsigned type depending on the type specifier: -// 'd' and 'i' - signed, other - unsigned) -template -class ArgConverter : public ArgVisitor, void> { - private: - internal::Arg &arg_; - wchar_t type_; - - FMT_DISALLOW_COPY_AND_ASSIGN(ArgConverter); - - public: - ArgConverter(internal::Arg &arg, wchar_t type) - : arg_(arg), type_(type) {} - - void visit_bool(bool value) { - if (type_ != 's') - visit_any_int(value); - } - - template - void visit_any_int(U value) { - bool is_signed = type_ == 'd' || type_ == 'i'; - using internal::Arg; - typedef typename internal::Conditional< - is_same::value, U, T>::type TargetType; - if (sizeof(TargetType) <= sizeof(int)) { - // Extra casts are used to silence warnings. - if (is_signed) { - arg_.type = Arg::INT; - arg_.int_value = static_cast(static_cast(value)); - } else { - arg_.type = Arg::UINT; - typedef typename internal::MakeUnsigned::Type Unsigned; - arg_.uint_value = static_cast(static_cast(value)); - } - } else { - if (is_signed) { - arg_.type = Arg::LONG_LONG; - // glibc's printf doesn't sign extend arguments of smaller types: - // std::printf("%lld", -42); // prints "4294967254" - // but we don't have to do the same because it's a UB. - arg_.long_long_value = static_cast(value); - } else { - arg_.type = Arg::ULONG_LONG; - arg_.ulong_long_value = - static_cast::Type>(value); - } - } - } -}; - -// Converts an integer argument to char for printf. -class CharConverter : public ArgVisitor { - private: - internal::Arg &arg_; - - FMT_DISALLOW_COPY_AND_ASSIGN(CharConverter); - - public: - explicit CharConverter(internal::Arg &arg) : arg_(arg) {} - - template - void visit_any_int(T value) { - arg_.type = internal::Arg::CHAR; - arg_.int_value = static_cast(value); - } -}; -} // namespace - -namespace internal { - -template -class PrintfArgFormatter : - public ArgFormatterBase, Char> { - - void write_null_pointer() { - this->spec().type_ = 0; - this->write("(nil)"); - } - - typedef ArgFormatterBase, Char> Base; - - public: - PrintfArgFormatter(BasicWriter &w, FormatSpec &s) - : ArgFormatterBase, Char>(w, s) {} - - void visit_bool(bool value) { - FormatSpec &fmt_spec = this->spec(); - if (fmt_spec.type_ != 's') - return this->visit_any_int(value); - fmt_spec.type_ = 0; - this->write(value); - } - - void visit_char(int value) { - const FormatSpec &fmt_spec = this->spec(); - BasicWriter &w = this->writer(); - if (fmt_spec.type_ && fmt_spec.type_ != 'c') - w.write_int(value, fmt_spec); - typedef typename BasicWriter::CharPtr CharPtr; - CharPtr out = CharPtr(); - if (fmt_spec.width_ > 1) { - Char fill = ' '; - out = w.grow_buffer(fmt_spec.width_); - if (fmt_spec.align_ != ALIGN_LEFT) { - std::fill_n(out, fmt_spec.width_ - 1, fill); - out += fmt_spec.width_ - 1; - } else { - std::fill_n(out + 1, fmt_spec.width_ - 1, fill); - } - } else { - out = w.grow_buffer(1); - } - *out = static_cast(value); - } - - void visit_cstring(const char *value) { - if (value) - Base::visit_cstring(value); - else if (this->spec().type_ == 'p') - write_null_pointer(); - else - this->write("(null)"); - } - - void visit_pointer(const void *value) { - if (value) - return Base::visit_pointer(value); - this->spec().type_ = 0; - write_null_pointer(); - } - - void visit_custom(Arg::CustomValue c) { - BasicFormatter formatter(ArgList(), this->writer()); - const Char format_str[] = {'}', 0}; - const Char *format = format_str; - c.format(&formatter, c.value, &format); - } -}; -} // namespace internal -} // namespace fmt - -FMT_FUNC void fmt::SystemError::init( - int err_code, CStringRef format_str, ArgList args) { - error_code_ = err_code; - MemoryWriter w; - internal::format_system_error(w, err_code, format(format_str, args)); - std::runtime_error &base = *this; - base = std::runtime_error(w.str()); -} - -template -int fmt::internal::CharTraits::format_float( - char *buffer, std::size_t size, const char *format, - unsigned width, int precision, T value) { - if (width == 0) { - return precision < 0 ? - FMT_SNPRINTF(buffer, size, format, value) : - FMT_SNPRINTF(buffer, size, format, precision, value); - } - return precision < 0 ? - FMT_SNPRINTF(buffer, size, format, width, value) : - FMT_SNPRINTF(buffer, size, format, width, precision, value); -} - -template -int fmt::internal::CharTraits::format_float( - wchar_t *buffer, std::size_t size, const wchar_t *format, - unsigned width, int precision, T value) { - if (width == 0) { - return precision < 0 ? - FMT_SWPRINTF(buffer, size, format, value) : - FMT_SWPRINTF(buffer, size, format, precision, value); - } - return precision < 0 ? - FMT_SWPRINTF(buffer, size, format, width, value) : - FMT_SWPRINTF(buffer, size, format, width, precision, value); -} - -template -const char fmt::internal::BasicData::DIGITS[] = - "0001020304050607080910111213141516171819" - "2021222324252627282930313233343536373839" - "4041424344454647484950515253545556575859" - "6061626364656667686970717273747576777879" - "8081828384858687888990919293949596979899"; - -#define FMT_POWERS_OF_10(factor) \ - factor * 10, \ - factor * 100, \ - factor * 1000, \ - factor * 10000, \ - factor * 100000, \ - factor * 1000000, \ - factor * 10000000, \ - factor * 100000000, \ - factor * 1000000000 - -template -const uint32_t fmt::internal::BasicData::POWERS_OF_10_32[] = { - 0, FMT_POWERS_OF_10(1) -}; - -template -const uint64_t fmt::internal::BasicData::POWERS_OF_10_64[] = { - 0, - FMT_POWERS_OF_10(1), - FMT_POWERS_OF_10(fmt::ULongLong(1000000000)), - // Multiply several constants instead of using a single long long constant - // to avoid warnings about C++98 not supporting long long. - fmt::ULongLong(1000000000) * fmt::ULongLong(1000000000) * 10 -}; - -FMT_FUNC void fmt::internal::report_unknown_type(char code, const char *type) { - (void)type; - if (std::isprint(static_cast(code))) { - FMT_THROW(fmt::FormatError( - fmt::format("unknown format code '{}' for {}", code, type))); - } - FMT_THROW(fmt::FormatError( - fmt::format("unknown format code '\\x{:02x}' for {}", - static_cast(code), type))); -} - -#if FMT_USE_WINDOWS_H - -FMT_FUNC fmt::internal::UTF8ToUTF16::UTF8ToUTF16(fmt::StringRef s) { - static const char ERROR_MSG[] = "cannot convert string from UTF-8 to UTF-16"; - if (s.size() > INT_MAX) - FMT_THROW(WindowsError(ERROR_INVALID_PARAMETER, ERROR_MSG)); - int s_size = static_cast(s.size()); - int length = MultiByteToWideChar( - CP_UTF8, MB_ERR_INVALID_CHARS, s.data(), s_size, 0, 0); - if (length == 0) - FMT_THROW(WindowsError(GetLastError(), ERROR_MSG)); - buffer_.resize(length + 1); - length = MultiByteToWideChar( - CP_UTF8, MB_ERR_INVALID_CHARS, s.data(), s_size, &buffer_[0], length); - if (length == 0) - FMT_THROW(WindowsError(GetLastError(), ERROR_MSG)); - buffer_[length] = 0; -} - -FMT_FUNC fmt::internal::UTF16ToUTF8::UTF16ToUTF8(fmt::WStringRef s) { - if (int error_code = convert(s)) { - FMT_THROW(WindowsError(error_code, - "cannot convert string from UTF-16 to UTF-8")); - } -} - -FMT_FUNC int fmt::internal::UTF16ToUTF8::convert(fmt::WStringRef s) { - if (s.size() > INT_MAX) - return ERROR_INVALID_PARAMETER; - int s_size = static_cast(s.size()); - int length = WideCharToMultiByte(CP_UTF8, 0, s.data(), s_size, 0, 0, 0, 0); - if (length == 0) - return GetLastError(); - buffer_.resize(length + 1); - length = WideCharToMultiByte( - CP_UTF8, 0, s.data(), s_size, &buffer_[0], length, 0, 0); - if (length == 0) - return GetLastError(); - buffer_[length] = 0; - return 0; -} - -FMT_FUNC void fmt::WindowsError::init( - int err_code, CStringRef format_str, ArgList args) { - error_code_ = err_code; - MemoryWriter w; - internal::format_windows_error(w, err_code, format(format_str, args)); - std::runtime_error &base = *this; - base = std::runtime_error(w.str()); -} - -FMT_FUNC void fmt::internal::format_windows_error( - fmt::Writer &out, int error_code, - fmt::StringRef message) FMT_NOEXCEPT { - FMT_TRY { - MemoryBuffer buffer; - buffer.resize(INLINE_BUFFER_SIZE); - for (;;) { - wchar_t *system_message = &buffer[0]; - int result = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - 0, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - system_message, static_cast(buffer.size()), 0); - if (result != 0) { - UTF16ToUTF8 utf8_message; - if (utf8_message.convert(system_message) == ERROR_SUCCESS) { - out << message << ": " << utf8_message; - return; - } - break; - } - if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) - break; // Can't get error message, report error code instead. - buffer.resize(buffer.size() * 2); - } - } FMT_CATCH(...) {} - fmt::format_error_code(out, error_code, message); // 'fmt::' is for bcc32. -} - -#endif // FMT_USE_WINDOWS_H - -FMT_FUNC void fmt::internal::format_system_error( - fmt::Writer &out, int error_code, - fmt::StringRef message) FMT_NOEXCEPT { - FMT_TRY { - MemoryBuffer buffer; - buffer.resize(INLINE_BUFFER_SIZE); - for (;;) { - char *system_message = &buffer[0]; - int result = safe_strerror(error_code, system_message, buffer.size()); - if (result == 0) { - out << message << ": " << system_message; - return; - } - if (result != ERANGE) - break; // Can't get error message, report error code instead. - buffer.resize(buffer.size() * 2); - } - } FMT_CATCH(...) {} - fmt::format_error_code(out, error_code, message); // 'fmt::' is for bcc32. -} - -template -void fmt::internal::ArgMap::init(const ArgList &args) { - if (!map_.empty()) - return; - typedef internal::NamedArg NamedArg; - const NamedArg *named_arg = 0; - bool use_values = - args.type(ArgList::MAX_PACKED_ARGS - 1) == internal::Arg::NONE; - if (use_values) { - for (unsigned i = 0;/*nothing*/; ++i) { - internal::Arg::Type arg_type = args.type(i); - switch (arg_type) { - case internal::Arg::NONE: - return; - case internal::Arg::NAMED_ARG: - named_arg = static_cast(args.values_[i].pointer); - map_.push_back(Pair(named_arg->name, *named_arg)); - break; - default: - /*nothing*/; - } - } - return; - } - for (unsigned i = 0; i != ArgList::MAX_PACKED_ARGS; ++i) { - internal::Arg::Type arg_type = args.type(i); - if (arg_type == internal::Arg::NAMED_ARG) { - named_arg = static_cast(args.args_[i].pointer); - map_.push_back(Pair(named_arg->name, *named_arg)); - } - } - for (unsigned i = ArgList::MAX_PACKED_ARGS;/*nothing*/; ++i) { - switch (args.args_[i].type) { - case internal::Arg::NONE: - return; - case internal::Arg::NAMED_ARG: - named_arg = static_cast(args.args_[i].pointer); - map_.push_back(Pair(named_arg->name, *named_arg)); - break; - default: - /*nothing*/; - } - } -} - -template -void fmt::internal::FixedBuffer::grow(std::size_t) { - FMT_THROW(std::runtime_error("buffer overflow")); -} - -FMT_FUNC Arg fmt::internal::FormatterBase::do_get_arg( - unsigned arg_index, const char *&error) { - Arg arg = args_[arg_index]; - switch (arg.type) { - case Arg::NONE: - error = "argument index out of range"; - break; - case Arg::NAMED_ARG: - arg = *static_cast(arg.pointer); - break; - default: - /*nothing*/; - } - return arg; -} - -template -void fmt::internal::PrintfFormatter::parse_flags( - FormatSpec &spec, const Char *&s) { - for (;;) { - switch (*s++) { - case '-': - spec.align_ = ALIGN_LEFT; - break; - case '+': - spec.flags_ |= SIGN_FLAG | PLUS_FLAG; - break; - case '0': - spec.fill_ = '0'; - break; - case ' ': - spec.flags_ |= SIGN_FLAG; - break; - case '#': - spec.flags_ |= HASH_FLAG; - break; - default: - --s; - return; - } - } -} - -template -Arg fmt::internal::PrintfFormatter::get_arg( - const Char *s, unsigned arg_index) { - (void)s; - const char *error = 0; - Arg arg = arg_index == UINT_MAX ? - next_arg(error) : FormatterBase::get_arg(arg_index - 1, error); - if (error) - FMT_THROW(FormatError(!*s ? "invalid format string" : error)); - return arg; -} - -template -unsigned fmt::internal::PrintfFormatter::parse_header( - const Char *&s, FormatSpec &spec) { - unsigned arg_index = UINT_MAX; - Char c = *s; - if (c >= '0' && c <= '9') { - // Parse an argument index (if followed by '$') or a width possibly - // preceded with '0' flag(s). - unsigned value = parse_nonnegative_int(s); - if (*s == '$') { // value is an argument index - ++s; - arg_index = value; - } else { - if (c == '0') - spec.fill_ = '0'; - if (value != 0) { - // Nonzero value means that we parsed width and don't need to - // parse it or flags again, so return now. - spec.width_ = value; - return arg_index; - } - } - } - parse_flags(spec, s); - // Parse width. - if (*s >= '0' && *s <= '9') { - spec.width_ = parse_nonnegative_int(s); - } else if (*s == '*') { - ++s; - spec.width_ = WidthHandler(spec).visit(get_arg(s)); - } - return arg_index; -} - -template -void fmt::internal::PrintfFormatter::format( - BasicWriter &writer, BasicCStringRef format_str) { - const Char *start = format_str.c_str(); - const Char *s = start; - while (*s) { - Char c = *s++; - if (c != '%') continue; - if (*s == c) { - write(writer, start, s); - start = ++s; - continue; - } - write(writer, start, s - 1); - - FormatSpec spec; - spec.align_ = ALIGN_RIGHT; - - // Parse argument index, flags and width. - unsigned arg_index = parse_header(s, spec); - - // Parse precision. - if (*s == '.') { - ++s; - if ('0' <= *s && *s <= '9') { - spec.precision_ = static_cast(parse_nonnegative_int(s)); - } else if (*s == '*') { - ++s; - spec.precision_ = PrecisionHandler().visit(get_arg(s)); - } - } - - Arg arg = get_arg(s, arg_index); - if (spec.flag(HASH_FLAG) && IsZeroInt().visit(arg)) - spec.flags_ &= ~to_unsigned(HASH_FLAG); - if (spec.fill_ == '0') { - if (arg.type <= Arg::LAST_NUMERIC_TYPE) - spec.align_ = ALIGN_NUMERIC; - else - spec.fill_ = ' '; // Ignore '0' flag for non-numeric types. - } - - // Parse length and convert the argument to the required type. - switch (*s++) { - case 'h': - if (*s == 'h') - ArgConverter(arg, *++s).visit(arg); - else - ArgConverter(arg, *s).visit(arg); - break; - case 'l': - if (*s == 'l') - ArgConverter(arg, *++s).visit(arg); - else - ArgConverter(arg, *s).visit(arg); - break; - case 'j': - ArgConverter(arg, *s).visit(arg); - break; - case 'z': - ArgConverter(arg, *s).visit(arg); - break; - case 't': - ArgConverter(arg, *s).visit(arg); - break; - case 'L': - // printf produces garbage when 'L' is omitted for long double, no - // need to do the same. - break; - default: - --s; - ArgConverter(arg, *s).visit(arg); - } - - // Parse type. - if (!*s) - FMT_THROW(FormatError("invalid format string")); - spec.type_ = static_cast(*s++); - if (arg.type <= Arg::LAST_INTEGER_TYPE) { - // Normalize type. - switch (spec.type_) { - case 'i': case 'u': - spec.type_ = 'd'; - break; - case 'c': - // TODO: handle wchar_t - CharConverter(arg).visit(arg); - break; - } - } - - start = s; - - // Format argument. - internal::PrintfArgFormatter(writer, spec).visit(arg); - } - write(writer, start, s); -} - -FMT_FUNC void fmt::report_system_error( - int error_code, fmt::StringRef message) FMT_NOEXCEPT { - // 'fmt::' is for bcc32. - fmt::report_error(internal::format_system_error, error_code, message); -} - -#if FMT_USE_WINDOWS_H -FMT_FUNC void fmt::report_windows_error( - int error_code, fmt::StringRef message) FMT_NOEXCEPT { - // 'fmt::' is for bcc32. - fmt::report_error(internal::format_windows_error, error_code, message); -} -#endif - -FMT_FUNC void fmt::print(std::FILE *f, CStringRef format_str, ArgList args) { - MemoryWriter w; - w.write(format_str, args); - std::fwrite(w.data(), 1, w.size(), f); -} - -FMT_FUNC void fmt::print(CStringRef format_str, ArgList args) { - print(stdout, format_str, args); -} - -FMT_FUNC void fmt::print_colored(Color c, CStringRef format, ArgList args) { - char escape[] = "\x1b[30m"; - escape[3] = static_cast('0' + c); - std::fputs(escape, stdout); - print(format, args); - std::fputs(RESET_COLOR, stdout); -} - -FMT_FUNC int fmt::fprintf(std::FILE *f, CStringRef format, ArgList args) { - MemoryWriter w; - printf(w, format, args); - std::size_t size = w.size(); - return std::fwrite(w.data(), 1, size, f) < size ? -1 : static_cast(size); -} - -#ifndef FMT_HEADER_ONLY - -template struct fmt::internal::BasicData; - -// Explicit instantiations for char. - -template void fmt::internal::FixedBuffer::grow(std::size_t); - -template void fmt::internal::ArgMap::init(const fmt::ArgList &args); - -template void fmt::internal::PrintfFormatter::format( - BasicWriter &writer, CStringRef format); - -template int fmt::internal::CharTraits::format_float( - char *buffer, std::size_t size, const char *format, - unsigned width, int precision, double value); - -template int fmt::internal::CharTraits::format_float( - char *buffer, std::size_t size, const char *format, - unsigned width, int precision, long double value); - -// Explicit instantiations for wchar_t. - -template void fmt::internal::FixedBuffer::grow(std::size_t); - -template void fmt::internal::ArgMap::init(const fmt::ArgList &args); - -template void fmt::internal::PrintfFormatter::format( - BasicWriter &writer, WCStringRef format); - -template int fmt::internal::CharTraits::format_float( - wchar_t *buffer, std::size_t size, const wchar_t *format, - unsigned width, int precision, double value); - -template int fmt::internal::CharTraits::format_float( - wchar_t *buffer, std::size_t size, const wchar_t *format, - unsigned width, int precision, long double value); - -#endif // FMT_HEADER_ONLY - -#ifdef _MSC_VER -# pragma warning(pop) -#endif diff --git a/diy/include/diy/fmt/ostream.cc b/diy/include/diy/fmt/ostream.cc deleted file mode 100644 index 0ba303478..000000000 --- a/diy/include/diy/fmt/ostream.cc +++ /dev/null @@ -1,61 +0,0 @@ -/* - Formatting library for C++ - std::ostream support - - Copyright (c) 2012 - 2016, Victor Zverovich - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "ostream.h" - -namespace fmt { - -namespace { -// Write the content of w to os. -void write(std::ostream &os, Writer &w) { - const char *data = w.data(); - typedef internal::MakeUnsigned::Type UnsignedStreamSize; - UnsignedStreamSize size = w.size(); - UnsignedStreamSize max_size = - internal::to_unsigned((std::numeric_limits::max)()); - do { - UnsignedStreamSize n = size <= max_size ? size : max_size; - os.write(data, static_cast(n)); - data += n; - size -= n; - } while (size != 0); -} -} - -FMT_FUNC void print(std::ostream &os, CStringRef format_str, ArgList args) { - MemoryWriter w; - w.write(format_str, args); - write(os, w); -} - -FMT_FUNC int fprintf(std::ostream &os, CStringRef format, ArgList args) { - MemoryWriter w; - printf(w, format, args); - write(os, w); - return static_cast(w.size()); -} -} // namespace fmt diff --git a/diy/include/diy/fmt/ostream.h b/diy/include/diy/fmt/ostream.h deleted file mode 100644 index 812278dd3..000000000 --- a/diy/include/diy/fmt/ostream.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - Formatting library for C++ - std::ostream support - - Copyright (c) 2012 - 2016, Victor Zverovich - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef FMT_OSTREAM_H_ -#define FMT_OSTREAM_H_ - -#include "format.h" -#include - -namespace fmt { - -namespace internal { - -template -class FormatBuf : public std::basic_streambuf { - private: - typedef typename std::basic_streambuf::int_type int_type; - typedef typename std::basic_streambuf::traits_type traits_type; - - Buffer &buffer_; - Char *start_; - - public: - FormatBuf(Buffer &buffer) : buffer_(buffer), start_(&buffer[0]) { - this->setp(start_, start_ + buffer_.capacity()); - } - - int_type overflow(int_type ch = traits_type::eof()) { - if (!traits_type::eq_int_type(ch, traits_type::eof())) { - size_t buf_size = size(); - buffer_.resize(buf_size); - buffer_.reserve(buf_size * 2); - - start_ = &buffer_[0]; - start_[buf_size] = traits_type::to_char_type(ch); - this->setp(start_+ buf_size + 1, start_ + buf_size * 2); - } - return ch; - } - - size_t size() const { - return to_unsigned(this->pptr() - start_); - } -}; - -Yes &convert(std::ostream &); - -struct DummyStream : std::ostream { - DummyStream(); // Suppress a bogus warning in MSVC. - // Hide all operator<< overloads from std::ostream. - void operator<<(Null<>); -}; - -No &operator<<(std::ostream &, int); - -template -struct ConvertToIntImpl { - // Convert to int only if T doesn't have an overloaded operator<<. - enum { - value = sizeof(convert(get() << get())) == sizeof(No) - }; -}; -} // namespace internal - -// Formats a value. -template -void format(BasicFormatter &f, - const Char *&format_str, const T &value) { - internal::MemoryBuffer buffer; - - internal::FormatBuf format_buf(buffer); - std::basic_ostream output(&format_buf); - output << value; - - BasicStringRef str(&buffer[0], format_buf.size()); - typedef internal::MakeArg< BasicFormatter > MakeArg; - format_str = f.format(format_str, MakeArg(str)); -} - -/** - \rst - Prints formatted data to the stream *os*. - - **Example**:: - - print(cerr, "Don't {}!", "panic"); - \endrst - */ -FMT_API void print(std::ostream &os, CStringRef format_str, ArgList args); -FMT_VARIADIC(void, print, std::ostream &, CStringRef) - -/** - \rst - Prints formatted data to the stream *os*. - - **Example**:: - - fprintf(cerr, "Don't %s!", "panic"); - \endrst - */ -FMT_API int fprintf(std::ostream &os, CStringRef format_str, ArgList args); -FMT_VARIADIC(int, fprintf, std::ostream &, CStringRef) -} // namespace fmt - -#ifdef FMT_HEADER_ONLY -# include "ostream.cc" -#endif - -#endif // FMT_OSTREAM_H_ diff --git a/examples/clipping/Clipping.cxx b/examples/clipping/Clipping.cxx index 73f3d4080..7c4a4f665 100644 --- a/examples/clipping/Clipping.cxx +++ b/examples/clipping/Clipping.cxx @@ -104,14 +104,11 @@ int main(int argc, char* argv[]) output.AddCellSet(outputCellSet); + auto inCoords = input.GetCoordinateSystem(0).GetData(); timer.Reset(); - vtkm::cont::DynamicArrayHandle coords; - { - FieldMapper coordMapper(coords, clip, false); - input.GetCoordinateSystem(0).GetData().CastAndCall(coordMapper); - } + auto outCoords = clip.ProcessCellField(inCoords, DeviceAdapter()); vtkm::Float64 processCoordinatesTime = timer.GetElapsedTime(); - output.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", coords)); + output.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", outCoords)); timer.Reset(); for (vtkm::Id i = 0; i < input.GetNumberOfFields(); ++i) diff --git a/examples/game_of_life/CMakeLists.txt b/examples/game_of_life/CMakeLists.txt index bf5533fe8..d9dd0e5aa 100644 --- a/examples/game_of_life/CMakeLists.txt +++ b/examples/game_of_life/CMakeLists.txt @@ -29,7 +29,6 @@ vtkm_find_gl(OPTIONAL GL GLUT GLEW) if(TARGET OpenGL::GL AND TARGET GLUT::GLUT AND TARGET GLEW::GLEW) - if(TARGET vtkm::cuda) add_executable(GameOfLife GameOfLife.cu LoadShaders.h) else() diff --git a/examples/streamline/StreamLineUniformGrid.cxx b/examples/streamline/StreamLineUniformGrid.cxx index 6daf869f7..0d9e084ad 100644 --- a/examples/streamline/StreamLineUniformGrid.cxx +++ b/examples/streamline/StreamLineUniformGrid.cxx @@ -23,6 +23,7 @@ #endif #include +#include #include #include #include @@ -68,30 +69,6 @@ Quaternion qrot; int lastx, lasty; int mouse_state = 1; -// -// Functor to retrieve vertex locations from the CoordinateSystem -// Actually need a static cast to ArrayHandle from DynamicArrayHandleCoordinateSystem -// but haven't been able to figure out what that is -// -struct GetVertexArray -{ - template - VTKM_CONT void operator()(ArrayHandleType array) const - { - this->GetVertexPortal(array.GetPortalConstControl()); - } - -private: - template - VTKM_CONT void GetVertexPortal(const PortalType& portal) const - { - for (vtkm::Id index = 0; index < portal.GetNumberOfValues(); index++) - { - vertexArray.GetPortalControl().Set(index, portal.Get(index)); - } - } -}; - // // Initialize the OpenGL state // @@ -145,16 +122,10 @@ void displayCall() // Get the cell set, coordinate system and coordinate data vtkm::cont::CellSetExplicit<> cellSet; outDataSet.GetCellSet(0).CopyTo(cellSet); - const vtkm::cont::DynamicArrayHandleCoordinateSystem& coordArray = - outDataSet.GetCoordinateSystem().GetData(); + auto coordArray = outDataSet.GetCoordinateSystem().GetData(); vtkm::Id numberOfCells = cellSet.GetNumberOfCells(); - vtkm::Id numberOfPoints = coordArray.GetNumberOfValues(); - - // Need the actual vertex points from a static cast of the dynamic array but can't get it right - // So use cast and call on a functor that stores that dynamic array into static array we created - vertexArray.Allocate(numberOfPoints); - vtkm::cont::CastAndCall(coordArray, GetVertexArray()); + vtkm::cont::ArrayCopy(coordArray, vertexArray); // Each cell is a polyline glColor3f(1.0f, 0.0f, 0.0f); diff --git a/examples/tetrahedra/TetrahedralizeExplicitGrid.cxx b/examples/tetrahedra/TetrahedralizeExplicitGrid.cxx index 93ddce3ef..ac69556ba 100644 --- a/examples/tetrahedra/TetrahedralizeExplicitGrid.cxx +++ b/examples/tetrahedra/TetrahedralizeExplicitGrid.cxx @@ -52,9 +52,6 @@ namespace // Takes input uniform grid and outputs unstructured grid of tets static vtkm::cont::DataSet outDataSet; -// Point location of vertices from a CastAndCall but needs a static cast eventually -static vtkm::cont::ArrayHandle> vertexArray; - // OpenGL display variables Quaternion qrot; int lastx, lasty; @@ -123,30 +120,6 @@ vtkm::cont::DataSet MakeTetrahedralizeExplicitDataSet() return builder.Create(); } -// -// Functor to retrieve vertex locations from the CoordinateSystem -// Actually need a static cast to ArrayHandle from DynamicArrayHandleCoordinateSystem -// but haven't been able to figure out what that is -// -struct GetVertexArray -{ - template - VTKM_CONT void operator()(ArrayHandleType array) const - { - this->GetVertexPortal(array.GetPortalConstControl()); - } - -private: - template - VTKM_CONT void GetVertexPortal(const PortalType& portal) const - { - for (vtkm::Id index = 0; index < portal.GetNumberOfValues(); index++) - { - vertexArray.GetPortalControl().Set(index, portal.Get(index)); - } - } -}; - // // Initialize the OpenGL state // @@ -201,10 +174,7 @@ void displayCall() outDataSet.GetCellSet(0).CopyTo(cellSet); vtkm::Id numberOfCells = cellSet.GetNumberOfCells(); - // Need the actual vertex points from a static cast of the dynamic array but can't get it right - // So use cast and call on a functor that stores that dynamic array into static array we created - vertexArray.Allocate(cellSet.GetNumberOfPoints()); - vtkm::cont::CastAndCall(outDataSet.GetCoordinateSystem(), GetVertexArray()); + auto vertexArray = outDataSet.GetCoordinateSystem().GetData(); // Draw the five tetrahedra belonging to each hexadron vtkm::Float32 color[5][3] = { { 1.0f, 0.0f, 0.0f }, @@ -223,10 +193,10 @@ void displayCall() cellSet.GetIndices(tetra, tetIndices); // Get the vertex points for this tetrahedron - vtkm::Vec pt0 = vertexArray.GetPortalConstControl().Get(tetIndices[0]); - vtkm::Vec pt1 = vertexArray.GetPortalConstControl().Get(tetIndices[1]); - vtkm::Vec pt2 = vertexArray.GetPortalConstControl().Get(tetIndices[2]); - vtkm::Vec pt3 = vertexArray.GetPortalConstControl().Get(tetIndices[3]); + auto pt0 = vertexArray.GetPortalConstControl().Get(tetIndices[0]); + auto pt1 = vertexArray.GetPortalConstControl().Get(tetIndices[1]); + auto pt2 = vertexArray.GetPortalConstControl().Get(tetIndices[2]); + auto pt3 = vertexArray.GetPortalConstControl().Get(tetIndices[3]); // Draw the tetrahedron filled with alternating colors glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); @@ -323,7 +293,6 @@ int main(int argc, char* argv[]) glutMainLoop(); outDataSet.Clear(); - vertexArray.ReleaseResources(); return 0; } diff --git a/examples/tetrahedra/TetrahedralizeUniformGrid.cxx b/examples/tetrahedra/TetrahedralizeUniformGrid.cxx index 30c0318df..6e34764e2 100644 --- a/examples/tetrahedra/TetrahedralizeUniformGrid.cxx +++ b/examples/tetrahedra/TetrahedralizeUniformGrid.cxx @@ -52,9 +52,6 @@ static vtkm::Id cellsToDisplay = 64; // Takes input uniform grid and outputs unstructured grid of tets static vtkm::cont::DataSet tetDataSet; -// Point location of vertices from a CastAndCall but needs a static cast eventually -static vtkm::cont::ArrayHandle> vertexArray; - // OpenGL display variables static Quaternion qrot; static int lastx, lasty; @@ -87,30 +84,6 @@ vtkm::cont::DataSet MakeTetrahedralizeTestDataSet(vtkm::Id3 dim) return dataSet; } -// -// Functor to retrieve vertex locations from the CoordinateSystem -// Actually need a static cast to ArrayHandle from DynamicArrayHandleCoordinateSystem -// but haven't been able to figure out what that is -// -struct GetVertexArray -{ - template - VTKM_CONT void operator()(ArrayHandleType array) const - { - this->GetVertexPortal(array.GetPortalConstControl()); - } - -private: - template - VTKM_CONT void GetVertexPortal(const PortalType& portal) const - { - for (vtkm::Id index = 0; index < portal.GetNumberOfValues(); index++) - { - vertexArray.GetPortalControl().Set(index, portal.Get(index)); - } - } -}; - // // Initialize the OpenGL state // @@ -165,10 +138,7 @@ void displayCall() vtkm::cont::CellSetSingleType<> cellSet; tetDataSet.GetCellSet(0).CopyTo(cellSet); - // Need the actual vertex points from a static cast of the dynamic array but can't get it right - // So use cast and call on a functor that stores that dynamic array into static array we created - vertexArray.Allocate(cellSet.GetNumberOfPoints()); - vtkm::cont::CastAndCall(tetDataSet.GetCoordinateSystem(), GetVertexArray()); + auto vertexArray = tetDataSet.GetCoordinateSystem().GetData(); // Draw the five tetrahedra belonging to each hexadron vtkm::Id tetra = 0; @@ -190,10 +160,10 @@ void displayCall() cellSet.GetIndices(tetra, tetIndices); // Get the vertex points for this tetrahedron - vtkm::Vec pt0 = vertexArray.GetPortalConstControl().Get(tetIndices[0]); - vtkm::Vec pt1 = vertexArray.GetPortalConstControl().Get(tetIndices[1]); - vtkm::Vec pt2 = vertexArray.GetPortalConstControl().Get(tetIndices[2]); - vtkm::Vec pt3 = vertexArray.GetPortalConstControl().Get(tetIndices[3]); + auto pt0 = vertexArray.GetPortalConstControl().Get(tetIndices[0]); + auto pt1 = vertexArray.GetPortalConstControl().Get(tetIndices[1]); + auto pt2 = vertexArray.GetPortalConstControl().Get(tetIndices[2]); + auto pt3 = vertexArray.GetPortalConstControl().Get(tetIndices[3]); // Draw the tetrahedron filled with alternating colors glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); @@ -305,7 +275,6 @@ int main(int argc, char* argv[]) glutMainLoop(); tetDataSet.Clear(); - vertexArray.ReleaseResources(); return 0; } diff --git a/examples/tetrahedra/TriangulateExplicitGrid.cxx b/examples/tetrahedra/TriangulateExplicitGrid.cxx index 629551430..13b9b9f4d 100644 --- a/examples/tetrahedra/TriangulateExplicitGrid.cxx +++ b/examples/tetrahedra/TriangulateExplicitGrid.cxx @@ -50,9 +50,6 @@ namespace static vtkm::cont::DataSet outDataSet; static vtkm::Id numberOfInPoints; -// Point location of vertices from a CastAndCall but needs a static cast eventually -static vtkm::cont::ArrayHandle> vertexArray; - } // anonymous namespace // @@ -125,30 +122,6 @@ vtkm::cont::DataSet MakeTriangulateExplicitDataSet() return builder.Create(); } -// -// Functor to retrieve vertex locations from the CoordinateSystem -// Actually need a static cast to ArrayHandle from DynamicArrayHandleCoordinateSystem -// but haven't been able to figure out what that is -// -struct GetVertexArray -{ - template - VTKM_CONT void operator()(ArrayHandleType array) const - { - this->GetVertexPortal(array.GetPortalConstControl()); - } - -private: - template - VTKM_CONT void GetVertexPortal(const PortalType& portal) const - { - for (vtkm::Id index = 0; index < portal.GetNumberOfValues(); index++) - { - vertexArray.GetPortalControl().Set(index, portal.Get(index)); - } - } -}; - // // Initialize the OpenGL state // @@ -173,10 +146,7 @@ void displayCall() outDataSet.GetCellSet(0).CopyTo(cellSet); vtkm::Id numberOfCells = cellSet.GetNumberOfCells(); - // Need the actual vertex points from a static cast of the dynamic array but can't get it right - // So use cast and call on a functor that stores that dynamic array into static array we created - vertexArray.Allocate(numberOfInPoints); - vtkm::cont::CastAndCall(outDataSet.GetCoordinateSystem(), GetVertexArray()); + auto vertexArray = outDataSet.GetCoordinateSystem().GetData(); // Draw the two triangles belonging to each quad vtkm::Float32 color[4][3] = { @@ -239,7 +209,6 @@ int main(int argc, char* argv[]) glutMainLoop(); outDataSet.Clear(); - vertexArray.ReleaseResources(); return 0; } diff --git a/examples/tetrahedra/TriangulateUniformGrid.cxx b/examples/tetrahedra/TriangulateUniformGrid.cxx index 4b6f51c9f..883770468 100644 --- a/examples/tetrahedra/TriangulateUniformGrid.cxx +++ b/examples/tetrahedra/TriangulateUniformGrid.cxx @@ -50,9 +50,6 @@ static vtkm::Id cellsToDisplay = 16; // Takes input uniform grid and outputs unstructured grid of triangles static vtkm::cont::DataSet triDataSet; -// Point location of vertices from a CastAndCall but needs a static cast eventually -static vtkm::cont::ArrayHandle> vertexArray; - // // Construct an input data set with uniform grid of indicated dimensions, origin and spacing // @@ -78,30 +75,6 @@ vtkm::cont::DataSet MakeTriangulateTestDataSet(vtkm::Id2 dim) return dataSet; } -// -// Functor to retrieve vertex locations from the CoordinateSystem -// Actually need a static cast to ArrayHandle from DynamicArrayHandleCoordinateSystem -// but haven't been able to figure out what that is -// -struct GetVertexArray -{ - template - VTKM_CONT void operator()(ArrayHandleType array) const - { - this->GetVertexPortal(array.GetPortalConstControl()); - } - -private: - template - VTKM_CONT void GetVertexPortal(const PortalType& portal) const - { - for (vtkm::Id index = 0; index < portal.GetNumberOfValues(); index++) - { - vertexArray.GetPortalControl().Set(index, portal.Get(index)); - } - } -}; - // // Initialize the OpenGL state // @@ -125,10 +98,7 @@ void displayCall() vtkm::cont::CellSetSingleType<> cellSet; triDataSet.GetCellSet(0).CopyTo(cellSet); - // Need the actual vertex points from a static cast of the dynamic array but can't get it right - // So use cast and call on a functor that stores that dynamic array into static array we created - vertexArray.Allocate(cellSet.GetNumberOfPoints()); - vtkm::cont::CastAndCall(triDataSet.GetCoordinateSystem(), GetVertexArray()); + auto vertexArray = triDataSet.GetCoordinateSystem().GetData(); // Draw the two triangles belonging to each quad vtkm::Id triangle = 0; @@ -207,7 +177,6 @@ int main(int argc, char* argv[]) glutMainLoop(); triDataSet.Clear(); - vertexArray.ReleaseResources(); return 0; } diff --git a/vtkm/Bounds.h b/vtkm/Bounds.h index dc57816cb..9e8546e68 100644 --- a/vtkm/Bounds.h +++ b/vtkm/Bounds.h @@ -45,6 +45,9 @@ struct Bounds VTKM_EXEC_CONT Bounds() {} + VTKM_EXEC_CONT + Bounds(const Bounds&) = default; + VTKM_EXEC_CONT Bounds(const vtkm::Range& xRange, const vtkm::Range& yRange, const vtkm::Range& zRange) : X(xRange) @@ -89,13 +92,7 @@ struct Bounds } VTKM_EXEC_CONT - const vtkm::Bounds& operator=(const vtkm::Bounds& src) - { - this->X = src.X; - this->Y = src.Y; - this->Z = src.Z; - return *this; - } + vtkm::Bounds& operator=(const vtkm::Bounds& src) = default; /// \b Determine if the bounds are valid (i.e. has at least one valid point). /// diff --git a/vtkm/CMakeLists.txt b/vtkm/CMakeLists.txt index 7c19ccc1a..d77d83687 100644 --- a/vtkm/CMakeLists.txt +++ b/vtkm/CMakeLists.txt @@ -67,6 +67,11 @@ vtkm_declare_headers(${headers}) #----------------------------------------------------------------------------- #first add all the components vtkm that are shared between control and exec +if(VTKm_ENABLE_MPI) + # This `if` is temporary and will be removed once `diy` supports building + # without MPI. + add_subdirectory(thirdparty/diy) +endif() add_subdirectory(testing) add_subdirectory(internal) diff --git a/vtkm/Math.h b/vtkm/Math.h index f35c9628b..1163a7ae0 100644 --- a/vtkm/Math.h +++ b/vtkm/Math.h @@ -48,6 +48,7 @@ #define VTKM_CUDA_MATH_FUNCTION_32(func) func##f #define VTKM_CUDA_MATH_FUNCTION_64(func) func +// clang-format off namespace vtkm { @@ -88,41 +89,22 @@ static inline VTKM_EXEC_CONT vtkm::Float64 Pi_4() namespace detail { - template -struct FloatingPointReturnCondition - : std::enable_if< - std::is_same::ComponentType, vtkm::Float32>::value || - std::is_same::ComponentType, const vtkm::Float32>::value> -{ -}; - -template struct FloatingPointReturnType { - using Type = vtkm::Float64; -}; - -template -struct FloatingPointReturnType::type> -{ - using Type = vtkm::Float32; + using ctype = typename vtkm::VecTraits::ComponentType; + using representable_as_float_type = std::integral_constant::value)>; + using Type = typename std::conditional::type; }; } // namespace detail /// Compute the sine of \p x. /// -template -static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Sin(T x) -{ -#ifdef VTKM_CUDA - return VTKM_CUDA_MATH_FUNCTION_64(sin)(static_cast(x)); -#else - return std::sin(static_cast(x)); -#endif -} -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Sin(vtkm::Float32 x) + +inline VTKM_EXEC_CONT vtkm::Float32 Sin(vtkm::Float32 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_32(sin)(x); @@ -130,8 +112,8 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Sin(v return std::sin(x); #endif } -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Sin(vtkm::Float64 x) + +inline VTKM_EXEC_CONT vtkm::Float64 Sin(vtkm::Float64 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_64(sin)(x); @@ -139,6 +121,12 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Sin(v return std::sin(x); #endif } +template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Sin(const T& x) +{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::Sin(static_cast(x)); +} template static inline VTKM_EXEC_CONT vtkm::Vec::Type, N> Sin( const vtkm::Vec& x) @@ -174,17 +162,8 @@ static inline VTKM_EXEC_CONT vtkm::Vec -static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Cos(T x) -{ -#ifdef VTKM_CUDA - return VTKM_CUDA_MATH_FUNCTION_64(cos)(static_cast(x)); -#else - return std::cos(static_cast(x)); -#endif -} -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Cos(vtkm::Float32 x) + +inline VTKM_EXEC_CONT vtkm::Float32 Cos(vtkm::Float32 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_32(cos)(x); @@ -192,8 +171,8 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Cos(v return std::cos(x); #endif } -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Cos(vtkm::Float64 x) + +inline VTKM_EXEC_CONT vtkm::Float64 Cos(vtkm::Float64 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_64(cos)(x); @@ -201,6 +180,12 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Cos(v return std::cos(x); #endif } +template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Cos(const T& x) +{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::Cos(static_cast(x)); +} template static inline VTKM_EXEC_CONT vtkm::Vec::Type, N> Cos( const vtkm::Vec& x) @@ -236,17 +221,8 @@ static inline VTKM_EXEC_CONT vtkm::Vec -static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Tan(T x) -{ -#ifdef VTKM_CUDA - return VTKM_CUDA_MATH_FUNCTION_64(tan)(static_cast(x)); -#else - return std::tan(static_cast(x)); -#endif -} -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Tan(vtkm::Float32 x) + +inline VTKM_EXEC_CONT vtkm::Float32 Tan(vtkm::Float32 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_32(tan)(x); @@ -254,8 +230,8 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Tan(v return std::tan(x); #endif } -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Tan(vtkm::Float64 x) + +inline VTKM_EXEC_CONT vtkm::Float64 Tan(vtkm::Float64 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_64(tan)(x); @@ -263,6 +239,12 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Tan(v return std::tan(x); #endif } +template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Tan(const T& x) +{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::Tan(static_cast(x)); +} template static inline VTKM_EXEC_CONT vtkm::Vec::Type, N> Tan( const vtkm::Vec& x) @@ -298,17 +280,8 @@ static inline VTKM_EXEC_CONT vtkm::Vec -static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type ASin(T x) -{ -#ifdef VTKM_CUDA - return VTKM_CUDA_MATH_FUNCTION_64(asin)(static_cast(x)); -#else - return std::asin(static_cast(x)); -#endif -} -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ASin(vtkm::Float32 x) + +inline VTKM_EXEC_CONT vtkm::Float32 ASin(vtkm::Float32 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_32(asin)(x); @@ -316,8 +289,8 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ASin( return std::asin(x); #endif } -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ASin(vtkm::Float64 x) + +inline VTKM_EXEC_CONT vtkm::Float64 ASin(vtkm::Float64 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_64(asin)(x); @@ -325,6 +298,12 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ASin( return std::asin(x); #endif } +template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type ASin(const T& x) +{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::ASin(static_cast(x)); +} template static inline VTKM_EXEC_CONT vtkm::Vec::Type, N> ASin( const vtkm::Vec& x) @@ -360,17 +339,8 @@ static inline VTKM_EXEC_CONT vtkm::Vec -static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type ACos(T x) -{ -#ifdef VTKM_CUDA - return VTKM_CUDA_MATH_FUNCTION_64(acos)(static_cast(x)); -#else - return std::acos(static_cast(x)); -#endif -} -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ACos(vtkm::Float32 x) + +inline VTKM_EXEC_CONT vtkm::Float32 ACos(vtkm::Float32 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_32(acos)(x); @@ -378,8 +348,8 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ACos( return std::acos(x); #endif } -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ACos(vtkm::Float64 x) + +inline VTKM_EXEC_CONT vtkm::Float64 ACos(vtkm::Float64 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_64(acos)(x); @@ -387,6 +357,12 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ACos( return std::acos(x); #endif } +template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type ACos(const T& x) +{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::ACos(static_cast(x)); +} template static inline VTKM_EXEC_CONT vtkm::Vec::Type, N> ACos( const vtkm::Vec& x) @@ -422,17 +398,8 @@ static inline VTKM_EXEC_CONT vtkm::Vec -static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type ATan(T x) -{ -#ifdef VTKM_CUDA - return VTKM_CUDA_MATH_FUNCTION_64(atan)(static_cast(x)); -#else - return std::atan(static_cast(x)); -#endif -} -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ATan(vtkm::Float32 x) + +inline VTKM_EXEC_CONT vtkm::Float32 ATan(vtkm::Float32 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_32(atan)(x); @@ -440,8 +407,8 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ATan( return std::atan(x); #endif } -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ATan(vtkm::Float64 x) + +inline VTKM_EXEC_CONT vtkm::Float64 ATan(vtkm::Float64 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_64(atan)(x); @@ -449,6 +416,12 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ATan( return std::atan(x); #endif } +template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type ATan(const T& x) +{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::ATan(static_cast(x)); +} template static inline VTKM_EXEC_CONT vtkm::Vec::Type, N> ATan( const vtkm::Vec& x) @@ -504,17 +477,8 @@ static inline VTKM_EXEC_CONT vtkm::Float64 ATan2(vtkm::Float64 x, vtkm::Float64 /// Compute the hyperbolic sine of \p x. /// -template -static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type SinH(T x) -{ -#ifdef VTKM_CUDA - return VTKM_CUDA_MATH_FUNCTION_64(sinh)(static_cast(x)); -#else - return std::sinh(static_cast(x)); -#endif -} -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type SinH(vtkm::Float32 x) + +inline VTKM_EXEC_CONT vtkm::Float32 SinH(vtkm::Float32 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_32(sinh)(x); @@ -522,8 +486,8 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type SinH( return std::sinh(x); #endif } -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type SinH(vtkm::Float64 x) + +inline VTKM_EXEC_CONT vtkm::Float64 SinH(vtkm::Float64 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_64(sinh)(x); @@ -531,6 +495,12 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type SinH( return std::sinh(x); #endif } +template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type SinH(const T& x) +{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::SinH(static_cast(x)); +} template static inline VTKM_EXEC_CONT vtkm::Vec::Type, N> SinH( const vtkm::Vec& x) @@ -566,17 +536,8 @@ static inline VTKM_EXEC_CONT vtkm::Vec -static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type CosH(T x) -{ -#ifdef VTKM_CUDA - return VTKM_CUDA_MATH_FUNCTION_64(cosh)(static_cast(x)); -#else - return std::cosh(static_cast(x)); -#endif -} -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type CosH(vtkm::Float32 x) + +inline VTKM_EXEC_CONT vtkm::Float32 CosH(vtkm::Float32 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_32(cosh)(x); @@ -584,8 +545,8 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type CosH( return std::cosh(x); #endif } -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type CosH(vtkm::Float64 x) + +inline VTKM_EXEC_CONT vtkm::Float64 CosH(vtkm::Float64 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_64(cosh)(x); @@ -593,6 +554,12 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type CosH( return std::cosh(x); #endif } +template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type CosH(const T& x) +{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::CosH(static_cast(x)); +} template static inline VTKM_EXEC_CONT vtkm::Vec::Type, N> CosH( const vtkm::Vec& x) @@ -628,17 +595,8 @@ static inline VTKM_EXEC_CONT vtkm::Vec -static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type TanH(T x) -{ -#ifdef VTKM_CUDA - return VTKM_CUDA_MATH_FUNCTION_64(tanh)(static_cast(x)); -#else - return std::tanh(static_cast(x)); -#endif -} -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type TanH(vtkm::Float32 x) + +inline VTKM_EXEC_CONT vtkm::Float32 TanH(vtkm::Float32 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_32(tanh)(x); @@ -646,8 +604,8 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type TanH( return std::tanh(x); #endif } -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type TanH(vtkm::Float64 x) + +inline VTKM_EXEC_CONT vtkm::Float64 TanH(vtkm::Float64 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_64(tanh)(x); @@ -655,6 +613,12 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type TanH( return std::tanh(x); #endif } +template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type TanH(const T& x) +{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::TanH(static_cast(x)); +} template static inline VTKM_EXEC_CONT vtkm::Vec::Type, N> TanH( const vtkm::Vec& x) @@ -690,17 +654,8 @@ static inline VTKM_EXEC_CONT vtkm::Vec -static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type ASinH(T x) -{ -#ifdef VTKM_CUDA - return VTKM_CUDA_MATH_FUNCTION_64(asinh)(static_cast(x)); -#else - return std::asinh(static_cast(x)); -#endif -} -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ASinH(vtkm::Float32 x) + +inline VTKM_EXEC_CONT vtkm::Float32 ASinH(vtkm::Float32 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_32(asinh)(x); @@ -708,8 +663,8 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ASinH return std::asinh(x); #endif } -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ASinH(vtkm::Float64 x) + +inline VTKM_EXEC_CONT vtkm::Float64 ASinH(vtkm::Float64 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_64(asinh)(x); @@ -717,6 +672,12 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ASinH return std::asinh(x); #endif } +template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type ASinH(const T& x) +{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::ASinH(static_cast(x)); +} template static inline VTKM_EXEC_CONT vtkm::Vec::Type, N> ASinH( const vtkm::Vec& x) @@ -752,17 +713,8 @@ static inline VTKM_EXEC_CONT vtkm::Vec -static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type ACosH(T x) -{ -#ifdef VTKM_CUDA - return VTKM_CUDA_MATH_FUNCTION_64(acosh)(static_cast(x)); -#else - return std::acosh(static_cast(x)); -#endif -} -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ACosH(vtkm::Float32 x) + +inline VTKM_EXEC_CONT vtkm::Float32 ACosH(vtkm::Float32 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_32(acosh)(x); @@ -770,8 +722,8 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ACosH return std::acosh(x); #endif } -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ACosH(vtkm::Float64 x) + +inline VTKM_EXEC_CONT vtkm::Float64 ACosH(vtkm::Float64 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_64(acosh)(x); @@ -779,6 +731,12 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ACosH return std::acosh(x); #endif } +template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type ACosH(const T& x) +{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::ACosH(static_cast(x)); +} template static inline VTKM_EXEC_CONT vtkm::Vec::Type, N> ACosH( const vtkm::Vec& x) @@ -814,17 +772,8 @@ static inline VTKM_EXEC_CONT vtkm::Vec -static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type ATanH(T x) -{ -#ifdef VTKM_CUDA - return VTKM_CUDA_MATH_FUNCTION_64(atanh)(static_cast(x)); -#else - return std::atanh(static_cast(x)); -#endif -} -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ATanH(vtkm::Float32 x) + +inline VTKM_EXEC_CONT vtkm::Float32 ATanH(vtkm::Float32 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_32(atanh)(x); @@ -832,8 +781,8 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ATanH return std::atanh(x); #endif } -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ATanH(vtkm::Float64 x) + +inline VTKM_EXEC_CONT vtkm::Float64 ATanH(vtkm::Float64 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_64(atanh)(x); @@ -841,6 +790,12 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ATanH return std::atanh(x); #endif } +template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type ATanH(const T& x) +{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::ATanH(static_cast(x)); +} template static inline VTKM_EXEC_CONT vtkm::Vec::Type, N> ATanH( const vtkm::Vec& x) @@ -896,17 +851,8 @@ static inline VTKM_EXEC_CONT vtkm::Float64 Pow(vtkm::Float64 x, vtkm::Float64 y) /// Compute the square root of \p x. /// -template -static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Sqrt(T x) -{ -#ifdef VTKM_CUDA - return VTKM_CUDA_MATH_FUNCTION_64(sqrt)(static_cast(x)); -#else - return std::sqrt(static_cast(x)); -#endif -} -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Sqrt(vtkm::Float32 x) + +inline VTKM_EXEC_CONT vtkm::Float32 Sqrt(vtkm::Float32 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_32(sqrt)(x); @@ -914,8 +860,8 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Sqrt( return std::sqrt(x); #endif } -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Sqrt(vtkm::Float64 x) + +inline VTKM_EXEC_CONT vtkm::Float64 Sqrt(vtkm::Float64 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_64(sqrt)(x); @@ -923,6 +869,12 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Sqrt( return std::sqrt(x); #endif } +template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Sqrt(const T& x) +{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::Sqrt(static_cast(x)); +} template static inline VTKM_EXEC_CONT vtkm::Vec::Type, N> Sqrt( const vtkm::Vec& x) @@ -1026,17 +978,8 @@ static inline VTKM_EXEC_CONT vtkm::Vec -static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Cbrt(T x) -{ -#ifdef VTKM_CUDA - return VTKM_CUDA_MATH_FUNCTION_64(cbrt)(static_cast(x)); -#else - return std::cbrt(static_cast(x)); -#endif -} -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Cbrt(vtkm::Float32 x) + +inline VTKM_EXEC_CONT vtkm::Float32 Cbrt(vtkm::Float32 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_32(cbrt)(x); @@ -1044,8 +987,8 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Cbrt( return std::cbrt(x); #endif } -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Cbrt(vtkm::Float64 x) + +inline VTKM_EXEC_CONT vtkm::Float64 Cbrt(vtkm::Float64 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_64(cbrt)(x); @@ -1053,6 +996,12 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Cbrt( return std::cbrt(x); #endif } +template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Cbrt(const T& x) +{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::Cbrt(static_cast(x)); +} template static inline VTKM_EXEC_CONT vtkm::Vec::Type, N> Cbrt( const vtkm::Vec& x) @@ -1156,17 +1105,8 @@ static inline VTKM_EXEC_CONT vtkm::Vec -static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Exp(T x) -{ -#ifdef VTKM_CUDA - return VTKM_CUDA_MATH_FUNCTION_64(exp)(static_cast(x)); -#else - return std::exp(static_cast(x)); -#endif -} -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Exp(vtkm::Float32 x) + +inline VTKM_EXEC_CONT vtkm::Float32 Exp(vtkm::Float32 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_32(exp)(x); @@ -1174,8 +1114,8 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Exp(v return std::exp(x); #endif } -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Exp(vtkm::Float64 x) + +inline VTKM_EXEC_CONT vtkm::Float64 Exp(vtkm::Float64 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_64(exp)(x); @@ -1183,6 +1123,12 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Exp(v return std::exp(x); #endif } +template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Exp(const T& x) +{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::Exp(static_cast(x)); +} template static inline VTKM_EXEC_CONT vtkm::Vec::Type, N> Exp( const vtkm::Vec& x) @@ -1218,17 +1164,8 @@ static inline VTKM_EXEC_CONT vtkm::Vec -static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Exp2(T x) -{ -#ifdef VTKM_CUDA - return VTKM_CUDA_MATH_FUNCTION_64(exp2)(static_cast(x)); -#else - return std::exp2(static_cast(x)); -#endif -} -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Exp2(vtkm::Float32 x) + +inline VTKM_EXEC_CONT vtkm::Float32 Exp2(vtkm::Float32 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_32(exp2)(x); @@ -1236,8 +1173,8 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Exp2( return std::exp2(x); #endif } -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Exp2(vtkm::Float64 x) + +inline VTKM_EXEC_CONT vtkm::Float64 Exp2(vtkm::Float64 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_64(exp2)(x); @@ -1245,6 +1182,12 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Exp2( return std::exp2(x); #endif } +template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Exp2(const T& x) +{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::Exp2(static_cast(x)); +} template static inline VTKM_EXEC_CONT vtkm::Vec::Type, N> Exp2( const vtkm::Vec& x) @@ -1281,17 +1224,8 @@ static inline VTKM_EXEC_CONT vtkm::Vec -static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type ExpM1(T x) -{ -#ifdef VTKM_CUDA - return VTKM_CUDA_MATH_FUNCTION_64(expm1)(static_cast(x)); -#else - return std::expm1(static_cast(x)); -#endif -} -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ExpM1(vtkm::Float32 x) + +inline VTKM_EXEC_CONT vtkm::Float32 ExpM1(vtkm::Float32 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_32(expm1)(x); @@ -1299,8 +1233,8 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ExpM1 return std::expm1(x); #endif } -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ExpM1(vtkm::Float64 x) + +inline VTKM_EXEC_CONT vtkm::Float64 ExpM1(vtkm::Float64 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_64(expm1)(x); @@ -1308,6 +1242,12 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type ExpM1 return std::expm1(x); #endif } +template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type ExpM1(const T& x) +{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::ExpM1(static_cast(x)); +} template static inline VTKM_EXEC_CONT vtkm::Vec::Type, N> ExpM1( const vtkm::Vec& x) @@ -1408,17 +1348,8 @@ static inline VTKM_EXEC_CONT vtkm::Vec -static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Log(T x) -{ -#ifdef VTKM_CUDA - return VTKM_CUDA_MATH_FUNCTION_64(log)(static_cast(x)); -#else - return std::log(static_cast(x)); -#endif -} -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Log(vtkm::Float32 x) + +inline VTKM_EXEC_CONT vtkm::Float32 Log(vtkm::Float32 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_32(log)(x); @@ -1426,8 +1357,8 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Log(v return std::log(x); #endif } -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Log(vtkm::Float64 x) + +inline VTKM_EXEC_CONT vtkm::Float64 Log(vtkm::Float64 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_64(log)(x); @@ -1435,6 +1366,12 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Log(v return std::log(x); #endif } +template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Log(const T& x) +{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::Log(static_cast(x)); +} template static inline VTKM_EXEC_CONT vtkm::Vec::Type, N> Log( const vtkm::Vec& x) @@ -1470,17 +1407,8 @@ static inline VTKM_EXEC_CONT vtkm::Vec -static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Log2(T x) -{ -#ifdef VTKM_CUDA - return VTKM_CUDA_MATH_FUNCTION_64(log2)(static_cast(x)); -#else - return std::log2(static_cast(x)); -#endif -} -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Log2(vtkm::Float32 x) + +inline VTKM_EXEC_CONT vtkm::Float32 Log2(vtkm::Float32 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_32(log2)(x); @@ -1488,8 +1416,8 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Log2( return std::log2(x); #endif } -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Log2(vtkm::Float64 x) + +inline VTKM_EXEC_CONT vtkm::Float64 Log2(vtkm::Float64 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_64(log2)(x); @@ -1497,6 +1425,12 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Log2( return std::log2(x); #endif } +template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Log2(const T& x) +{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::Log2(static_cast(x)); +} template static inline VTKM_EXEC_CONT vtkm::Vec::Type, N> Log2( const vtkm::Vec& x) @@ -1532,17 +1466,8 @@ static inline VTKM_EXEC_CONT vtkm::Vec -static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Log10(T x) -{ -#ifdef VTKM_CUDA - return VTKM_CUDA_MATH_FUNCTION_64(log10)(static_cast(x)); -#else - return std::log10(static_cast(x)); -#endif -} -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Log10(vtkm::Float32 x) + +inline VTKM_EXEC_CONT vtkm::Float32 Log10(vtkm::Float32 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_32(log10)(x); @@ -1550,8 +1475,8 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Log10 return std::log10(x); #endif } -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Log10(vtkm::Float64 x) + +inline VTKM_EXEC_CONT vtkm::Float64 Log10(vtkm::Float64 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_64(log10)(x); @@ -1559,6 +1484,12 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Log10 return std::log10(x); #endif } +template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Log10(const T& x) +{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::Log10(static_cast(x)); +} template static inline VTKM_EXEC_CONT vtkm::Vec::Type, N> Log10( const vtkm::Vec& x) @@ -1594,17 +1525,8 @@ static inline VTKM_EXEC_CONT vtkm::Vec -static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Log1P(T x) -{ -#ifdef VTKM_CUDA - return VTKM_CUDA_MATH_FUNCTION_64(log1p)(static_cast(x)); -#else - return std::log1p(static_cast(x)); -#endif -} -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Log1P(vtkm::Float32 x) + +inline VTKM_EXEC_CONT vtkm::Float32 Log1P(vtkm::Float32 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_32(log1p)(x); @@ -1612,8 +1534,8 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Log1P return std::log1p(x); #endif } -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Log1P(vtkm::Float64 x) + +inline VTKM_EXEC_CONT vtkm::Float64 Log1P(vtkm::Float64 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_64(log1p)(x); @@ -1621,6 +1543,12 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Log1P return std::log1p(x); #endif } +template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Log1P(const T& x) +{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::Log1P(static_cast(x)); +} template static inline VTKM_EXEC_CONT vtkm::Vec::Type, N> Log1P( const vtkm::Vec& x) @@ -2098,17 +2026,8 @@ static inline VTKM_EXEC_CONT bool IsFinite(T x) //----------------------------------------------------------------------------- /// Round \p x to the smallest integer value not less than x. /// -template -static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Ceil(T x) -{ -#ifdef VTKM_CUDA - return VTKM_CUDA_MATH_FUNCTION_64(ceil)(static_cast(x)); -#else - return std::ceil(static_cast(x)); -#endif -} -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Ceil(vtkm::Float32 x) + +inline VTKM_EXEC_CONT vtkm::Float32 Ceil(vtkm::Float32 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_32(ceil)(x); @@ -2116,8 +2035,8 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Ceil( return std::ceil(x); #endif } -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Ceil(vtkm::Float64 x) + +inline VTKM_EXEC_CONT vtkm::Float64 Ceil(vtkm::Float64 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_64(ceil)(x); @@ -2125,6 +2044,12 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Ceil( return std::ceil(x); #endif } +template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Ceil(const T& x) +{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::Ceil(static_cast(x)); +} template static inline VTKM_EXEC_CONT vtkm::Vec::Type, N> Ceil( const vtkm::Vec& x) @@ -2160,17 +2085,8 @@ static inline VTKM_EXEC_CONT vtkm::Vec -static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Floor(T x) -{ -#ifdef VTKM_CUDA - return VTKM_CUDA_MATH_FUNCTION_64(floor)(static_cast(x)); -#else - return std::floor(static_cast(x)); -#endif -} -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Floor(vtkm::Float32 x) + +inline VTKM_EXEC_CONT vtkm::Float32 Floor(vtkm::Float32 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_32(floor)(x); @@ -2178,8 +2094,8 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Floor return std::floor(x); #endif } -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Floor(vtkm::Float64 x) + +inline VTKM_EXEC_CONT vtkm::Float64 Floor(vtkm::Float64 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_64(floor)(x); @@ -2187,6 +2103,12 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Floor return std::floor(x); #endif } +template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Floor(const T& x) +{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::Floor(static_cast(x)); +} template static inline VTKM_EXEC_CONT vtkm::Vec::Type, N> Floor( const vtkm::Vec& x) @@ -2222,17 +2144,8 @@ static inline VTKM_EXEC_CONT vtkm::Vec -static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Round(T x) -{ -#ifdef VTKM_CUDA - return VTKM_CUDA_MATH_FUNCTION_64(round)(static_cast(x)); -#else - return std::round(static_cast(x)); -#endif -} -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Round(vtkm::Float32 x) + +inline VTKM_EXEC_CONT vtkm::Float32 Round(vtkm::Float32 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_32(round)(x); @@ -2240,8 +2153,8 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Round return std::round(x); #endif } -template <> -inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Round(vtkm::Float64 x) + +inline VTKM_EXEC_CONT vtkm::Float64 Round(vtkm::Float64 x) { #ifdef VTKM_CUDA return VTKM_CUDA_MATH_FUNCTION_64(round)(x); @@ -2249,6 +2162,12 @@ inline VTKM_EXEC_CONT detail::FloatingPointReturnType::Type Round return std::round(x); #endif } +template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type Round(const T& x) +{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::Round(static_cast(x)); +} template static inline VTKM_EXEC_CONT vtkm::Vec::Type, N> Round( const vtkm::Vec& x) @@ -2347,7 +2266,12 @@ static inline VTKM_EXEC_CONT vtkm::Float32 RemainderQuotient(vtkm::Float32 numer QType& quotient) { int iQuotient; - vtkm::Float32 result = std::remquo(numerator, denominator, &iQuotient); +#ifdef VTKM_CUDA + const vtkm::Float64 result = + VTKM_CUDA_MATH_FUNCTION_32(remquo)(numerator, denominator, &iQuotient); +#else + const vtkm::Float32 result = std::remquo(numerator, denominator, &iQuotient); +#endif quotient = iQuotient; return result; } @@ -2357,7 +2281,12 @@ static inline VTKM_EXEC_CONT vtkm::Float64 RemainderQuotient(vtkm::Float64 numer QType& quotient) { int iQuotient; - vtkm::Float64 result = std::remquo(numerator, denominator, &iQuotient); +#ifdef VTKM_CUDA + const vtkm::Float64 result = + VTKM_CUDA_MATH_FUNCTION_64(remquo)(numerator, denominator, &iQuotient); +#else + const vtkm::Float64 result = std::remquo(numerator, denominator, &iQuotient); +#endif quotient = iQuotient; return result; } @@ -2508,5 +2437,6 @@ static inline VTKM_EXEC_CONT vtkm::Vec CopySign(const vtkm::Vec& x, } } // namespace vtkm +// clang-format on #endif //vtk_m_Math_h diff --git a/vtkm/Math.h.in b/vtkm/Math.h.in index 5df80e4d8..245b53580 100644 --- a/vtkm/Math.h.in +++ b/vtkm/Math.h.in @@ -108,28 +108,30 @@ static inline VTKM_EXEC_CONT vtkm::Vec::Type' if returntype == None else returntype, - 'VTKM_CUDA_MATH_FUNCTION_64(' + sysname + ')(static_cast(x))', - 'std::' + sysname + '(static_cast(x))', - 'template ', - 'static inline') + \ - unary_function(vtkmname, - 'vtkm::Float32', - 'detail::FloatingPointReturnType::Type' if returntype == None else returntype, - 'VTKM_CUDA_MATH_FUNCTION_32(' + sysname + ')(x)', - 'std::' + sysname + '(x)', - 'template <>', - 'inline') + \ - unary_function(vtkmname, - 'vtkm::Float64', - 'detail::FloatingPointReturnType::Type' if returntype == None else returntype, - 'VTKM_CUDA_MATH_FUNCTION_64(' + sysname + ')(x)', - 'std::' + sysname + '(x)', - 'template <>', - 'inline') +def unary_math_function_no_vec(vtkmname, sysname): + general_type = '''template +static inline VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type {0}(const T& x) +{{ + using RT = typename detail::FloatingPointReturnType::Type; + return vtkm::{0}(static_cast(x)); +}} +'''.format(vtkmname) + specialization_types = unary_function(vtkmname, + 'vtkm::Float32', + 'vtkm::Float32', + 'VTKM_CUDA_MATH_FUNCTION_32(' + sysname + ')(x)', + 'std::' + sysname + '(x)', + '', + 'inline') + specialization_types += unary_function(vtkmname, + 'vtkm::Float64', + 'vtkm::Float64', + 'VTKM_CUDA_MATH_FUNCTION_64(' + sysname + ')(x)', + 'std::' + sysname + '(x)', + '', + 'inline') + return specialization_types + general_type + def unary_math_function(vtkmname, sysname): return unary_math_function_no_vec(vtkmname, sysname) + \ @@ -195,6 +197,7 @@ $extend(unary_template_function_no_vec)\ $extend(binary_math_function)\ $extend(binary_template_function)\ \ +// clang-format off namespace vtkm { @@ -235,25 +238,15 @@ static inline VTKM_EXEC_CONT vtkm::Float64 Pi_4() namespace detail { - template -struct FloatingPointReturnCondition - : std::enable_if< - std::is_same::ComponentType, vtkm::Float32>::value || - std::is_same::ComponentType, const vtkm::Float32>::value> -{ -}; - -template struct FloatingPointReturnType { - using Type = vtkm::Float64; -}; - -template -struct FloatingPointReturnType::type> -{ - using Type = vtkm::Float32; + using ctype = typename vtkm::VecTraits::ComponentType; + using representable_as_float_type = std::integral_constant::value)>; + using Type = typename std::conditional::type; }; } // namespace detail @@ -928,7 +921,12 @@ static inline VTKM_EXEC_CONT vtkm::Float32 RemainderQuotient(vtkm::Float32 numer QType& quotient) { int iQuotient; - vtkm::Float32 result = std::remquo(numerator, denominator, &iQuotient); +#ifdef VTKM_CUDA + const vtkm::Float64 result = + VTKM_CUDA_MATH_FUNCTION_32(remquo)(numerator, denominator, &iQuotient); +#else + const vtkm::Float32 result = std::remquo(numerator, denominator, &iQuotient); +#endif quotient = iQuotient; return result; } @@ -938,7 +936,12 @@ static inline VTKM_EXEC_CONT vtkm::Float64 RemainderQuotient(vtkm::Float64 numer QType& quotient) { int iQuotient; - vtkm::Float64 result = std::remquo(numerator, denominator, &iQuotient); +#ifdef VTKM_CUDA + const vtkm::Float64 result = + VTKM_CUDA_MATH_FUNCTION_64(remquo)(numerator, denominator, &iQuotient); +#else + const vtkm::Float64 result = std::remquo(numerator, denominator, &iQuotient); +#endif quotient = iQuotient; return result; } @@ -1061,5 +1064,6 @@ static inline VTKM_EXEC_CONT vtkm::Vec CopySign(const vtkm::Vec& x, } } // namespace vtkm +// clang-format on #endif //vtk_m_Math_h diff --git a/vtkm/Range.h b/vtkm/Range.h index c2d1f60a1..07c22dd0a 100644 --- a/vtkm/Range.h +++ b/vtkm/Range.h @@ -49,6 +49,9 @@ struct Range { } + VTKM_EXEC_CONT + Range(const Range&) = default; + template VTKM_EXEC_CONT Range(const T1& min, const T2& max) : Min(static_cast(min)) @@ -57,12 +60,7 @@ struct Range } VTKM_EXEC_CONT - const vtkm::Range& operator=(const vtkm::Range& src) - { - this->Min = src.Min; - this->Max = src.Max; - return *this; - } + vtkm::Range& operator=(const vtkm::Range& src) = default; /// \b Determine if the range is valid (i.e. has at least one valid point). /// diff --git a/vtkm/StaticAssert.h b/vtkm/StaticAssert.h index 8db26025e..7d03b7d31 100644 --- a/vtkm/StaticAssert.h +++ b/vtkm/StaticAssert.h @@ -27,4 +27,20 @@ static_assert((condition), "Failed static assert: " #condition) #define VTKM_STATIC_ASSERT_MSG(condition, message) static_assert((condition), message) +namespace vtkm +{ + +template +struct ReadTheSourceCodeHereForHelpOnThisError; + +template <> +struct ReadTheSourceCodeHereForHelpOnThisError : std::true_type +{ +}; + +} // namespace vtkm + +#define VTKM_READ_THE_SOURCE_CODE_FOR_HELP(noError) \ + VTKM_STATIC_ASSERT(vtkm::ReadTheSourceCodeHereForHelpOnThisError::value) + #endif //vtk_m_StaticAssert_h diff --git a/vtkm/Types.h b/vtkm/Types.h index bff79cbbd..684659df8 100644 --- a/vtkm/Types.h +++ b/vtkm/Types.h @@ -515,22 +515,6 @@ public: VTKM_EXEC_CONT bool operator!=(const DerivedClass& other) const { return !(this->operator==(other)); } - VTKM_EXEC_CONT - ComponentType Dot(const VecBaseCommon& other) const - { - // Why the static_cast here and below? Because * on small integers (char, - // short) promotes the result to a 32-bit int. After helpfully promoting - // the width of the result, some compilers then warn you about casting it - // back to the type you were expecting in the first place. The static_cast - // suppresses this warning. - ComponentType result = static_cast(this->Component(0) * other.Component(0)); - for (vtkm::IdComponent i = 1; i < this->NumComponents(); ++i) - { - result = static_cast(result + this->Component(i) * other.Component(i)); - } - return result; - } - #if (!(defined(VTKM_CUDA) && (__CUDACC_VER_MAJOR__ < 8))) #if (defined(VTKM_GCC) || defined(VTKM_CLANG)) #pragma GCC diagnostic push @@ -1239,46 +1223,85 @@ VTKM_EXEC_CONT static inline vtkm::VecCConst make_VecC(const T* array, vtkm:: return vtkm::VecCConst(array, size); } -// A pre-declaration of vtkm::Pair so that classes templated on them can refer -// to it. The actual implementation is in vtkm/Pair.h. -template -struct Pair; - -template -static inline VTKM_EXEC_CONT T dot(const vtkm::Vec& a, const vtkm::Vec& b) +namespace detail { - T result = T(a[0] * b[0]); - for (vtkm::IdComponent i = 1; i < Size; ++i) +template +struct DotType +{ + //results when < 32bit can be float if somehow we are using float16/float8, otherwise is + // int32 or uint32 depending on if it signed or not. + using float_type = vtkm::Float32; + using integer_type = + typename std::conditional::value, vtkm::Int32, vtkm::UInt32>::type; + using promote_type = + typename std::conditional::value, integer_type, float_type>::type; + using type = + typename std::conditional<(sizeof(T) < sizeof(vtkm::Float32)), promote_type, T>::type; +}; + +template +static inline VTKM_EXEC_CONT typename DotType::type vec_dot(const T& a, + const T& b) +{ + using U = typename DotType::type; + U result = a[0] * b[0]; + for (vtkm::IdComponent i = 1; i < a.GetNumberOfComponents(); ++i) { - result = T(result + a[i] * b[i]); + result = result + a[i] * b[i]; } return result; } - -template -static inline VTKM_EXEC_CONT T dot(const vtkm::Vec& a, const vtkm::Vec& b) +template +static inline VTKM_EXEC_CONT typename DotType::type vec_dot(const vtkm::Vec& a, + const vtkm::Vec& b) { - return T((a[0] * b[0]) + (a[1] * b[1])); + using U = typename DotType::type; + U result = a[0] * b[0]; + for (vtkm::IdComponent i = 1; i < Size; ++i) + { + result = result + a[i] * b[i]; + } + return result; +} } template -static inline VTKM_EXEC_CONT T dot(const vtkm::Vec& a, const vtkm::Vec& b) +static inline VTKM_EXEC_CONT auto dot(const T& a, const T& b) -> decltype(detail::vec_dot(a, b)) { - return T((a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2])); + return detail::vec_dot(a, b); } - template -static inline VTKM_EXEC_CONT T dot(const vtkm::Vec& a, const vtkm::Vec& b) +static inline VTKM_EXEC_CONT typename detail::DotType::type dot(const vtkm::Vec& a, + const vtkm::Vec& b) { - return T((a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3])); + return (a[0] * b[0]) + (a[1] * b[1]); } - -template -static inline VTKM_EXEC_CONT T dot(const vtkm::detail::VecBaseCommon& a, - const vtkm::detail::VecBaseCommon& b) +template +static inline VTKM_EXEC_CONT typename detail::DotType::type dot(const vtkm::Vec& a, + const vtkm::Vec& b) { - return a.Dot(b); + return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]); } +template +static inline VTKM_EXEC_CONT typename detail::DotType::type dot(const vtkm::Vec& a, + const vtkm::Vec& b) +{ + return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]); +} +// Integer types of a width less than an integer get implicitly casted to +// an integer when doing a multiplication. +#define VTK_M_SCALAR_DOT(stype) \ + static inline VTKM_EXEC_CONT detail::DotType::type dot(stype a, stype b) { return a * b; } +VTK_M_SCALAR_DOT(vtkm::Int8) +VTK_M_SCALAR_DOT(vtkm::UInt8) +VTK_M_SCALAR_DOT(vtkm::Int16) +VTK_M_SCALAR_DOT(vtkm::UInt16) +VTK_M_SCALAR_DOT(vtkm::Int32) +VTK_M_SCALAR_DOT(vtkm::UInt32) +VTK_M_SCALAR_DOT(vtkm::Int64) +VTK_M_SCALAR_DOT(vtkm::UInt64) +VTK_M_SCALAR_DOT(vtkm::Float32) +VTK_M_SCALAR_DOT(vtkm::Float64) template VTKM_EXEC_CONT T ReduceSum(const vtkm::Vec& a) @@ -1338,22 +1361,10 @@ VTKM_EXEC_CONT T ReduceProduct(const vtkm::Vec& a) return a[0] * a[1] * a[2] * a[3]; } -// Integer types of a width less than an integer get implicitly casted to -// an integer when doing a multiplication. -#define VTK_M_INTEGER_PROMOTION_SCALAR_DOT(type) \ - static inline VTKM_EXEC_CONT type dot(type a, type b) { return static_cast(a * b); } -VTK_M_INTEGER_PROMOTION_SCALAR_DOT(vtkm::Int8) -VTK_M_INTEGER_PROMOTION_SCALAR_DOT(vtkm::UInt8) -VTK_M_INTEGER_PROMOTION_SCALAR_DOT(vtkm::Int16) -VTK_M_INTEGER_PROMOTION_SCALAR_DOT(vtkm::UInt16) -#define VTK_M_SCALAR_DOT(type) \ - static inline VTKM_EXEC_CONT type dot(type a, type b) { return a * b; } -VTK_M_SCALAR_DOT(vtkm::Int32) -VTK_M_SCALAR_DOT(vtkm::UInt32) -VTK_M_SCALAR_DOT(vtkm::Int64) -VTK_M_SCALAR_DOT(vtkm::UInt64) -VTK_M_SCALAR_DOT(vtkm::Float32) -VTK_M_SCALAR_DOT(vtkm::Float64) +// A pre-declaration of vtkm::Pair so that classes templated on them can refer +// to it. The actual implementation is in vtkm/Pair.h. +template +struct Pair; } // End of namespace vtkm diff --git a/vtkm/VectorAnalysis.h b/vtkm/VectorAnalysis.h index 6f602aa7d..43a8921a9 100644 --- a/vtkm/VectorAnalysis.h +++ b/vtkm/VectorAnalysis.h @@ -71,9 +71,10 @@ VTKM_EXEC_CONT vtkm::Vec Lerp(const vtkm::Vec& value /// when possible. /// template -VTKM_EXEC_CONT typename vtkm::VecTraits::ComponentType MagnitudeSquared(const T& x) +VTKM_EXEC_CONT typename detail::FloatingPointReturnType::Type MagnitudeSquared(const T& x) { - return vtkm::dot(x, x); + using U = typename detail::FloatingPointReturnType::Type; + return static_cast(vtkm::dot(x, x)); } // ---------------------------------------------------------------------------- diff --git a/vtkm/cont/ArrayHandleConcatenate.h b/vtkm/cont/ArrayHandleConcatenate.h index ed2489b1e..16ad249dc 100644 --- a/vtkm/cont/ArrayHandleConcatenate.h +++ b/vtkm/cont/ArrayHandleConcatenate.h @@ -19,8 +19,8 @@ // this software. // //============================================================================= -#ifndef vtk_m_ArrayHandleConcatenate_h -#define vtk_m_ArrayHandleConcatenate_h +#ifndef vtk_m_cont_ArrayHandleConcatenate_h +#define vtk_m_cont_ArrayHandleConcatenate_h #include @@ -323,4 +323,4 @@ VTKM_CONT ArrayHandleConcatenate make_ArrayH } } // namespace vtkm::cont -#endif //vtk_m_ArrayHandleConcatenate_h +#endif //vtk_m_cont_ArrayHandleConcatenate_h diff --git a/vtkm/cont/ArrayHandlePermutation.h b/vtkm/cont/ArrayHandlePermutation.h index 7332d35f1..a78209917 100644 --- a/vtkm/cont/ArrayHandlePermutation.h +++ b/vtkm/cont/ArrayHandlePermutation.h @@ -19,8 +19,8 @@ // this software. // //============================================================================= -#ifndef vtk_m_ArrayHandlePermutation_h -#define vtk_m_ArrayHandlePermutation_h +#ifndef vtk_m_cont_ArrayHandlePermutation_h +#define vtk_m_cont_ArrayHandlePermutation_h #include #include @@ -372,4 +372,4 @@ make_ArrayHandlePermutation(IndexArrayHandleType indexArray, ValueArrayHandleTyp } } // namespace vtkm::cont -#endif //vtk_m_ArrayHandlePermutation_h +#endif //vtk_m_cont_ArrayHandlePermutation_h diff --git a/vtkm/cont/ArrayHandleVirtualCoordinates.h b/vtkm/cont/ArrayHandleVirtualCoordinates.h new file mode 100644 index 000000000..c33ef7980 --- /dev/null +++ b/vtkm/cont/ArrayHandleVirtualCoordinates.h @@ -0,0 +1,579 @@ +//============================================================================ +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2014 UT-Battelle, LLC. +// Copyright 2014 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +//============================================================================ +#ifndef vtk_m_cont_ArrayHandleVirtualCoordinates_h +#define vtk_m_cont_ArrayHandleVirtualCoordinates_h + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +namespace vtkm +{ +namespace cont +{ + +namespace internal +{ + +//============================================================================= +class VTKM_ALWAYS_EXPORT CoordinatesPortalBase : public VirtualObjectBase +{ +public: + VTKM_EXEC_CONT virtual vtkm::Vec Get(vtkm::Id i) const = 0; + VTKM_EXEC_CONT virtual void Set(vtkm::Id i, + const vtkm::Vec& val) const = 0; +}; + +template +class VTKM_ALWAYS_EXPORT CoordinatesPortalImpl : public CoordinatesPortalBase +{ +public: + VTKM_CONT CoordinatesPortalImpl() = default; + VTKM_CONT explicit CoordinatesPortalImpl(const PortalType& portal) + : Portal(portal) + { + } + + VTKM_CONT void SetPortal(const PortalType& portal) { this->Portal = portal; } + + VTKM_EXEC_CONT vtkm::Vec Get(vtkm::Id i) const override + { + auto val = this->Portal.Get(i); + return { static_cast(val[0]), + static_cast(val[1]), + static_cast(val[2]) }; + } + + VTKM_EXEC_CONT void Set(vtkm::Id i, const vtkm::Vec& val) const override + { + using VecType = typename PortalType::ValueType; + using ComponentType = typename vtkm::VecTraits::ComponentType; + + this->Portal.Set(i, + { static_cast(val[0]), + static_cast(val[1]), + static_cast(val[2]) }); + } + +private: + PortalType Portal; +}; + +template +class VTKM_ALWAYS_EXPORT CoordinatesPortalImpl : public CoordinatesPortalBase +{ +public: + VTKM_CONT CoordinatesPortalImpl() = default; + VTKM_CONT explicit CoordinatesPortalImpl(const PortalType&) {} + VTKM_CONT void SetPortal(const PortalType&) {} + VTKM_EXEC_CONT vtkm::Vec Get(vtkm::Id) const override { return {}; } + VTKM_EXEC_CONT void Set(vtkm::Id, const vtkm::Vec&) const override {} +}; + +template +class VTKM_ALWAYS_EXPORT CoordinatesPortal + : public CoordinatesPortalImpl +{ +public: + VTKM_CONT CoordinatesPortal() = default; + VTKM_CONT explicit CoordinatesPortal(const PortalType& portal) + : CoordinatesPortalImpl(portal) + { + } +}; + +template +class VTKM_ALWAYS_EXPORT CoordinatesPortalConst : public CoordinatesPortalBase +{ +public: + VTKM_CONT CoordinatesPortalConst() = default; + VTKM_CONT explicit CoordinatesPortalConst(const PortalType& portal) + : Portal(portal) + { + } + + VTKM_CONT void SetPortal(const PortalType& portal) { this->Portal = portal; } + + VTKM_EXEC_CONT vtkm::Vec Get(vtkm::Id i) const override + { + auto val = this->Portal.Get(i); + return { static_cast(val[0]), + static_cast(val[1]), + static_cast(val[2]) }; + } + + VTKM_EXEC_CONT void Set(vtkm::Id, const vtkm::Vec&) const override {} + +private: + PortalType Portal; +}; + +class VTKM_ALWAYS_EXPORT ArrayPortalVirtualCoordinates +{ +public: + using ValueType = vtkm::Vec; + + VTKM_EXEC_CONT ArrayPortalVirtualCoordinates() + : NumberOfValues(0) + , VirtualPortal(nullptr) + { + } + + VTKM_EXEC_CONT ArrayPortalVirtualCoordinates(vtkm::Id numberOfValues, + const CoordinatesPortalBase* virtualPortal) + : NumberOfValues(numberOfValues) + , VirtualPortal(virtualPortal) + { + } + + VTKM_EXEC_CONT vtkm::Id GetNumberOfValues() const { return this->NumberOfValues; } + + VTKM_EXEC_CONT ValueType Get(vtkm::Id i) const { return this->VirtualPortal->Get(i); } + + VTKM_EXEC_CONT void Set(vtkm::Id i, const ValueType& val) const + { + this->VirtualPortal->Set(i, val); + } + +private: + vtkm::Id NumberOfValues; + const CoordinatesPortalBase* VirtualPortal; +}; + +//============================================================================= +class VTKM_ALWAYS_EXPORT CoordinatesArrayHandleBase +{ +public: + using Portal = ArrayPortalVirtualCoordinates; + using PortalConst = ArrayPortalVirtualCoordinates; + + virtual ~CoordinatesArrayHandleBase() = default; + + VTKM_CONT virtual vtkm::Id GetNumberOfValues() const = 0; + + VTKM_CONT virtual Portal GetPortalControl() = 0; + VTKM_CONT virtual PortalConst GetPortalConstControl() = 0; + VTKM_CONT virtual void Allocate(vtkm::Id numberOfValues) = 0; + VTKM_CONT virtual void Shrink(vtkm::Id numberOfValues) = 0; + VTKM_CONT virtual void ReleaseResources() = 0; + + VTKM_CONT virtual PortalConst PrepareForInput(vtkm::cont::DeviceAdapterId deviceId) = 0; + VTKM_CONT virtual Portal PrepareForOutput(vtkm::Id numberOfValues, + vtkm::cont::DeviceAdapterId deviceId) = 0; + VTKM_CONT virtual Portal PrepareForInPlace(vtkm::cont::DeviceAdapterId deviceId) = 0; +}; + +template +class VTKM_ALWAYS_EXPORT CoordinatesArrayHandleArrayWrapper : public CoordinatesArrayHandleBase +{ +public: + VTKM_CONT explicit CoordinatesArrayHandleArrayWrapper(const ArrayHandleType& array) + : Array(array) + { + } + + VTKM_CONT const ArrayHandleType& GetArray() const { return this->Array; } + +protected: + ArrayHandleType Array; +}; + +template +class VTKM_ALWAYS_EXPORT CoordinatesArrayHandle + : public CoordinatesArrayHandleArrayWrapper +{ +public: + static_assert(std::is_same::value, "error"); + + using Portal = CoordinatesArrayHandleBase::Portal; + using PortalConst = CoordinatesArrayHandleBase::PortalConst; + + VTKM_CONT explicit CoordinatesArrayHandle(const ArrayHandleType& array) + : CoordinatesArrayHandleArrayWrapper(array) + { + } + + VTKM_CONT vtkm::Id GetNumberOfValues() const override { return this->Array.GetNumberOfValues(); } + + VTKM_CONT Portal GetPortalControl() override + { + this->ControlPortal.SetPortal(this->Array.GetPortalControl()); + return Portal(this->GetNumberOfValues(), &this->ControlPortal); + } + + VTKM_CONT PortalConst GetPortalConstControl() override + { + this->ControlConstPortal.SetPortal(this->Array.GetPortalConstControl()); + return PortalConst(this->GetNumberOfValues(), &this->ControlConstPortal); + } + + VTKM_CONT void Allocate(vtkm::Id numberOfValues) override + { + this->Array.Allocate(numberOfValues); + } + + VTKM_CONT void Shrink(vtkm::Id numberOfValues) override { this->Array.Shrink(numberOfValues); } + + VTKM_CONT void ReleaseResources() override { this->Array.ReleaseResources(); } + + VTKM_CONT PortalConst PrepareForInput(vtkm::cont::DeviceAdapterId deviceId) override + { + PortalConst portal; + vtkm::cont::internal::FindDeviceAdapterTagAndCall( + deviceId, DeviceList(), PrepareForInputFunctor(), this, portal); + return portal; + } + + VTKM_CONT Portal PrepareForOutput(vtkm::Id numberOfValues, + vtkm::cont::DeviceAdapterId deviceId) override + { + Portal portal; + vtkm::cont::internal::FindDeviceAdapterTagAndCall( + deviceId, DeviceList(), PrepareForOutputFunctor(), this, numberOfValues, portal); + return portal; + } + + VTKM_CONT Portal PrepareForInPlace(vtkm::cont::DeviceAdapterId deviceId) override + { + Portal portal; + vtkm::cont::internal::FindDeviceAdapterTagAndCall( + deviceId, DeviceList(), PrepareForInPlaceFunctor(), this, portal); + return portal; + } + +private: + struct PrepareForInputFunctor + { + template + VTKM_CONT void operator()(DeviceAdapter, + CoordinatesArrayHandle* instance, + PortalConst& ret) const + { + auto portal = instance->Array.PrepareForInput(DeviceAdapter()); + instance->DevicePortalHandle.Reset(new CoordinatesPortalConst(portal), + true, + vtkm::ListTagBase()); + ret = PortalConst(portal.GetNumberOfValues(), + instance->DevicePortalHandle.PrepareForExecution(DeviceAdapter())); + } + }; + + struct PrepareForOutputFunctor + { + template + VTKM_CONT void operator()(DeviceAdapter, + CoordinatesArrayHandle* instance, + vtkm::Id numberOfValues, + Portal& ret) const + { + auto portal = instance->Array.PrepareForOutput(numberOfValues, DeviceAdapter()); + instance->DevicePortalHandle.Reset( + new CoordinatesPortal(portal), true, vtkm::ListTagBase()); + ret = + Portal(numberOfValues, instance->DevicePortalHandle.PrepareForExecution(DeviceAdapter())); + } + }; + + struct PrepareForInPlaceFunctor + { + template + VTKM_CONT void operator()(DeviceAdapter, CoordinatesArrayHandle* instance, Portal& ret) const + { + auto portal = instance->Array.PrepareForInPlace(DeviceAdapter()); + instance->DevicePortalHandle.Reset( + new CoordinatesPortal(portal), true, vtkm::ListTagBase()); + ret = Portal(instance->Array.GetNumberOfValues(), + instance->DevicePortalHandle.PrepareForExecution(DeviceAdapter())); + } + }; + + CoordinatesPortal ControlPortal; + CoordinatesPortalConst ControlConstPortal; + vtkm::cont::VirtualObjectHandle DevicePortalHandle; +}; + +//============================================================================= +struct VTKM_ALWAYS_EXPORT StorageTagVirtualCoordinates +{ +}; + +template <> +class Storage, StorageTagVirtualCoordinates> +{ +public: + using ValueType = vtkm::Vec; + using PortalType = CoordinatesArrayHandleBase::Portal; + using PortalConstType = CoordinatesArrayHandleBase::PortalConst; + + VTKM_CONT Storage() = default; + + template + VTKM_CONT explicit Storage(const ArrayHandleType& array, DeviceList) + : Array(new CoordinatesArrayHandle(array)) + { + } + + VTKM_CONT PortalType GetPortal() { return this->Array->GetPortalControl(); } + + VTKM_CONT PortalConstType GetPortalConst() const { return this->Array->GetPortalConstControl(); } + + VTKM_CONT vtkm::Id GetNumberOfValues() const { return this->Array->GetNumberOfValues(); } + + VTKM_CONT void Allocate(vtkm::Id numberOfValues) { this->Array->Allocate(numberOfValues); } + + VTKM_CONT void Shrink(vtkm::Id numberOfValues) { this->Array->Shrink(numberOfValues); } + + VTKM_CONT void ReleaseResources() { this->Array->ReleaseResources(); } + + VTKM_CONT CoordinatesArrayHandleBase* GetVirtualArray() const { return this->Array.get(); } + +private: + std::shared_ptr Array; +}; + +//============================================================================= +template +class ArrayTransfer, StorageTagVirtualCoordinates, DeviceAdapter> +{ +public: + using ValueType = vtkm::Vec; + using StorageType = vtkm::cont::internal::Storage; + + using PortalControl = typename StorageType::PortalType; + using PortalConstControl = typename StorageType::PortalConstType; + using PortalExecution = CoordinatesArrayHandleBase::Portal; + using PortalConstExecution = CoordinatesArrayHandleBase::PortalConst; + + VTKM_CONT + ArrayTransfer(StorageType* storage) + : Array(storage->GetVirtualArray()) + { + } + + VTKM_CONT + vtkm::Id GetNumberOfValues() const { return this->Array->GetNumberOfValues(); } + + VTKM_CONT + PortalConstExecution PrepareForInput(bool) + { + return this->Array->PrepareForInput(vtkm::cont::DeviceAdapterTraits::GetId()); + } + + VTKM_CONT + PortalExecution PrepareForInPlace(bool) + { + return this->Array->PrepareForInPlace(vtkm::cont::DeviceAdapterTraits::GetId()); + } + + VTKM_CONT + PortalExecution PrepareForOutput(vtkm::Id numberOfValues) + { + return this->Array->PrepareForOutput(numberOfValues, + vtkm::cont::DeviceAdapterTraits::GetId()); + } + + VTKM_CONT + void RetrieveOutputData(StorageType*) const + { + // Implementation of this method should be unnecessary. + } + + VTKM_CONT + void Shrink(vtkm::Id numberOfValues) { this->Array->Shrink(numberOfValues); } + + VTKM_CONT + void ReleaseResources() { this->Array->ReleaseResources(); } + +private: + CoordinatesArrayHandleBase* Array; +}; + +} // internal + +//============================================================================= +class VTKM_ALWAYS_EXPORT ArrayHandleVirtualCoordinates + : public ArrayHandle, internal::StorageTagVirtualCoordinates> +{ +public: + VTKM_ARRAY_HANDLE_SUBCLASS_NT( + ArrayHandleVirtualCoordinates, + (ArrayHandle, internal::StorageTagVirtualCoordinates>)); + + template + explicit ArrayHandleVirtualCoordinates( + const vtkm::cont::ArrayHandle, StorageTag>& array, + DeviceList devices = DeviceList()) + : Superclass(typename Superclass::StorageType(array, devices)) + { + } + + template + explicit ArrayHandleVirtualCoordinates( + const vtkm::cont::ArrayHandle, StorageTag>& array, + DeviceList devices = DeviceList()) + : Superclass(typename Superclass::StorageType(array, devices)) + { + } + + template + bool IsSameType() const + { + return this->GetArrayHandleWrapper() != nullptr; + } + + template + bool IsSameType(const ArrayHandleType&) const + { + return this->GetArrayHandleWrapper() != nullptr; + } + + template + const ArrayHandleType Cast() const + { + auto wrapper = this->GetArrayHandleWrapper(); + if (!wrapper) + { + throw vtkm::cont::ErrorBadType("dynamic cast failed"); + } + return ArrayHandleType(wrapper->GetArray()); + } + +private: + template + struct WrapperType + { + VTKM_IS_ARRAY_HANDLE(ArrayHandleType); + + using ValueType = typename ArrayHandleType::ValueType; + using StorageTag = typename ArrayHandleType::StorageTag; + using BaseArrayHandleType = vtkm::cont::ArrayHandle; + using Type = internal::CoordinatesArrayHandleArrayWrapper; + }; + + template + VTKM_CONT const typename WrapperType::Type* GetArrayHandleWrapper() const + { + auto va = this->GetStorage().GetVirtualArray(); + return dynamic_cast::Type*>(va); + } +}; + +template +void CastAndCall(const vtkm::cont::ArrayHandleVirtualCoordinates& coords, + Functor&& f, + Args&&... args) +{ + if (coords.IsSameType()) + { + f(coords.Cast(), std::forward(args)...); + } + else + { + f(coords, std::forward(args)...); + } +} + +template +void CastAndCall(const typename vtkm::cont::ArrayHandleVirtualCoordinates::Superclass& coords, + Functor&& f, + Args&&... args) +{ + CastAndCall(static_cast(coords), + std::forward(f), + std::forward(args)...); +} +} +} // vtkm::cont + +#ifdef VTKM_CUDA + +// Cuda seems to have a bug where it expects the template class VirtualObjectTransfer +// to be instantiated in a consitent order among all the translation units of an +// executable. Failing to do so results in random crashes and incorrect results. +// We workaroud this issue by explicitly instantiating VirtualObjectTransfer for +// all the portal types here. + +#include + +#include +#include +#include +#include +#include + +namespace vtkm +{ +namespace cont +{ +namespace internal +{ + +template +struct CudaPortalTypes +{ + using PortalConst = typename ArrayHandleType::template ExecutionTypes< + vtkm::cont::DeviceAdapterTagCuda>::PortalConst; + using Portal = + typename ArrayHandleType::template ExecutionTypes::Portal; +}; + +using CudaPortalsBasicF32 = CudaPortalTypes>>; +using CudaPortalsBasicF64 = CudaPortalTypes>>; +using CudaPortalsUniformPointCoordinates = + CudaPortalTypes; +using CudaPortalsRectilinearCoords = CudaPortalTypes< + vtkm::cont::ArrayHandleCartesianProduct, + vtkm::cont::ArrayHandle, + vtkm::cont::ArrayHandle>>; +} +} +} // vtkm::cont::internal + +VTKM_EXPLICITLY_INSTANTIATE_TRANSFER(vtkm::cont::internal::CoordinatesPortalConst< + vtkm::cont::internal::CudaPortalsBasicF32::PortalConst>); +VTKM_EXPLICITLY_INSTANTIATE_TRANSFER( + vtkm::cont::internal::CoordinatesPortal); +VTKM_EXPLICITLY_INSTANTIATE_TRANSFER(vtkm::cont::internal::CoordinatesPortalConst< + vtkm::cont::internal::CudaPortalsBasicF64::PortalConst>); +VTKM_EXPLICITLY_INSTANTIATE_TRANSFER( + vtkm::cont::internal::CoordinatesPortal); +VTKM_EXPLICITLY_INSTANTIATE_TRANSFER( + vtkm::cont::internal::CoordinatesPortalConst< + vtkm::cont::internal::CudaPortalsUniformPointCoordinates::PortalConst>); +VTKM_EXPLICITLY_INSTANTIATE_TRANSFER( + vtkm::cont::internal::CoordinatesPortal< + vtkm::cont::internal::CudaPortalsUniformPointCoordinates::Portal>); +VTKM_EXPLICITLY_INSTANTIATE_TRANSFER( + vtkm::cont::internal::CoordinatesPortalConst< + vtkm::cont::internal::CudaPortalsRectilinearCoords::PortalConst>); +VTKM_EXPLICITLY_INSTANTIATE_TRANSFER(vtkm::cont::internal::CoordinatesPortal< + vtkm::cont::internal::CudaPortalsRectilinearCoords::Portal>); + +#endif // VTKM_CUDA + +#endif // vtk_m_cont_ArrayHandleVirtualCoordinates_h diff --git a/vtkm/cont/ArrayRangeCompute.cxx b/vtkm/cont/ArrayRangeCompute.cxx index 1785b92be..f60c24f75 100644 --- a/vtkm/cont/ArrayRangeCompute.cxx +++ b/vtkm/cont/ArrayRangeCompute.cxx @@ -71,6 +71,10 @@ VTKM_ARRAY_RANGE_COMPUTE_IMPL_VEC(vtkm::UInt8, 4, vtkm::cont::StorageTagBasic); VTKM_ARRAY_RANGE_COMPUTE_IMPL_VEC(vtkm::Float32, 4, vtkm::cont::StorageTagBasic); VTKM_ARRAY_RANGE_COMPUTE_IMPL_VEC(vtkm::Float64, 4, vtkm::cont::StorageTagBasic); +VTKM_ARRAY_RANGE_COMPUTE_IMPL_VEC(vtkm::FloatDefault, + 3, + vtkm::cont::ArrayHandleVirtualCoordinates::StorageTag); + #undef VTKM_ARRAY_RANGE_COMPUTE_IMPL_T #undef VTKM_ARRAY_RANGE_COMPUTE_IMPL_VEC diff --git a/vtkm/cont/ArrayRangeCompute.h b/vtkm/cont/ArrayRangeCompute.h index d746ca7e9..c293b0a0f 100644 --- a/vtkm/cont/ArrayRangeCompute.h +++ b/vtkm/cont/ArrayRangeCompute.h @@ -26,6 +26,7 @@ #include #include #include +#include #include namespace vtkm @@ -97,6 +98,10 @@ VTKM_ARRAY_RANGE_COMPUTE_EXPORT_VEC(vtkm::FloatDefault, 3, vtkm::cont::ArrayHandleUniformPointCoordinates::StorageTag); +VTKM_ARRAY_RANGE_COMPUTE_EXPORT_VEC(vtkm::FloatDefault, + 3, + vtkm::cont::ArrayHandleVirtualCoordinates::StorageTag); + #undef VTKM_ARRAY_RANGE_COMPUTE_EXPORT_T #undef VTKM_ARRAY_RANGE_COMPUTE_EXPORT_VEC diff --git a/vtkm/cont/AssignerMultiBlock.cxx b/vtkm/cont/AssignerMultiBlock.cxx new file mode 100644 index 000000000..ecb34ce8f --- /dev/null +++ b/vtkm/cont/AssignerMultiBlock.cxx @@ -0,0 +1,80 @@ +//============================================================================ +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +// Copyright 2015 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2015 UT-Battelle, LLC. +// Copyright 2015 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +//============================================================================ +#include + +#if defined(VTKM_ENABLE_MPI) + +// clang-format off +#include +#include VTKM_DIY(diy/mpi.hpp) +// clang-format on + +#include // std::lower_bound +#include // std::iota + +namespace vtkm +{ +namespace cont +{ + +VTKM_CONT +AssignerMultiBlock::AssignerMultiBlock(const vtkm::cont::MultiBlock& mb) + : diy::Assigner(vtkm::cont::EnvironmentTracker::GetCommunicator().size(), 1) + , IScanBlockCounts() +{ + auto comm = vtkm::cont::EnvironmentTracker::GetCommunicator(); + const auto nblocks = mb.GetNumberOfBlocks(); + + vtkm::Id iscan; + diy::mpi::scan(comm, nblocks, iscan, std::plus()); + diy::mpi::all_gather(comm, iscan, this->IScanBlockCounts); + + this->set_nblocks(static_cast(this->IScanBlockCounts.back())); +} + +VTKM_CONT +void AssignerMultiBlock::local_gids(int rank, std::vector& gids) const +{ + if (rank == 0) + { + assert(this->IScanBlockCounts.size() > 0); + gids.resize(this->IScanBlockCounts[rank]); + std::iota(gids.begin(), gids.end(), 0); + } + else if (rank > 0 && rank < static_cast(this->IScanBlockCounts.size())) + { + gids.resize(this->IScanBlockCounts[rank] - this->IScanBlockCounts[rank - 1]); + std::iota(gids.begin(), gids.end(), this->IScanBlockCounts[rank - 1]); + } +} + +VTKM_CONT +int AssignerMultiBlock::rank(int gid) const +{ + return static_cast( + std::lower_bound(this->IScanBlockCounts.begin(), this->IScanBlockCounts.end(), gid + 1) - + this->IScanBlockCounts.begin()); +} + + +} // vtkm::cont +} // vtkm + +#endif // defined(VTKM_ENABLE_MPI) diff --git a/vtkm/cont/AssignerMultiBlock.h b/vtkm/cont/AssignerMultiBlock.h new file mode 100644 index 000000000..bbd32a513 --- /dev/null +++ b/vtkm/cont/AssignerMultiBlock.h @@ -0,0 +1,74 @@ +//============================================================================ +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +// Copyright 2015 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2015 UT-Battelle, LLC. +// Copyright 2015 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +//============================================================================ +#ifndef vtk_m_cont_AssignerMultiBlock_h +#define vtk_m_cont_AssignerMultiBlock_h + +#include + +#if defined(VTKM_ENABLE_MPI) +#include + +// clang-format off +#include +#include VTKM_DIY(diy/assigner.hpp) +// clang-format on + +namespace vtkm +{ +namespace cont +{ + +/// \brief Assigner for `MultiBlock` blocks. +/// +/// `AssignerMultiBlock` is a `diy::Assigner` implementation that uses +/// `MultiBlock`'s block distribution to build global-id/rank associations +/// needed for several `diy` operations. +/// It uses a contiguous assignment strategy to map blocks to global ids i.e. +/// blocks on rank 0 come first, then rank 1, etc. Any rank may have 0 blocks. +/// +/// AssignerMultiBlock uses collectives in the constructor hence it is +/// essential it gets created on all ranks irrespective of whether the rank has +/// any blocks. +/// +class VTKM_CONT_EXPORT AssignerMultiBlock : public diy::Assigner +{ +public: + /// Initialize the assigner using a multiblock dataset. + /// This may initialize collective operations to populate the assigner with + /// information about blocks on all ranks. + VTKM_CONT + AssignerMultiBlock(const vtkm::cont::MultiBlock& mb); + + ///@{ + /// diy::Assigner API implementation. + VTKM_CONT + void local_gids(int rank, std::vector& gids) const override; + + VTKM_CONT + int rank(int gid) const override; + //@} +private: + std::vector IScanBlockCounts; +}; +} +} + +#endif // defined(VTKM_ENABLE_MPI) +#endif diff --git a/vtkm/cont/CMakeLists.txt b/vtkm/cont/CMakeLists.txt index 866f76ba6..4c178d449 100644 --- a/vtkm/cont/CMakeLists.txt +++ b/vtkm/cont/CMakeLists.txt @@ -39,12 +39,15 @@ set(headers ArrayHandleSwizzle.h ArrayHandleTransform.h ArrayHandleUniformPointCoordinates.h + ArrayHandleVirtualCoordinates.h ArrayHandleZip.h ArrayPortal.h ArrayPortalToIterators.h ArrayHandleConcatenate.h ArrayRangeCompute.h ArrayRangeCompute.hxx + AssignerMultiBlock.h + CellLocator.h CellLocatorTwoLevelUniformGrid.h CellSet.h CellSetExplicit.h @@ -58,6 +61,7 @@ set(headers DataSetBuilderRectilinear.h DataSetBuilderUniform.h DataSetFieldAdd.h + DecomposerMultiBlock.h DeviceAdapter.h DeviceAdapterAlgorithm.h DeviceAdapterListTag.h @@ -66,6 +70,7 @@ set(headers EnvironmentTracker.h Error.h ErrorBadAllocation.h + ErrorBadDevice.h ErrorBadType.h ErrorBadValue.h ErrorExecution.h @@ -94,16 +99,14 @@ set(template_sources set(sources ArrayHandle.cxx + AssignerMultiBlock.cxx CellSet.cxx CellSetExplicit.cxx CellSetStructured.cxx - CoordinateSystem.cxx - DataSet.cxx DynamicArrayHandle.cxx EnvironmentTracker.cxx Field.cxx internal/SimplePolymorphicContainer.cxx - MultiBlock.cxx internal/ArrayManagerExecutionShareWithControl.cxx StorageBasic.cxx ) @@ -113,6 +116,9 @@ set(sources set(device_sources ArrayRangeCompute.cxx CellSetExplicit.cxx + CoordinateSystem.cxx + DataSet.cxx + MultiBlock.cxx RuntimeDeviceTracker.cxx TryExecute.cxx ) diff --git a/vtkm/cont/CellLocator.h b/vtkm/cont/CellLocator.h new file mode 100644 index 000000000..6be442faa --- /dev/null +++ b/vtkm/cont/CellLocator.h @@ -0,0 +1,158 @@ +//============================================================================ +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +// Copyright 2017 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2017 UT-Battelle, LLC. +// Copyright 2017 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +//============================================================================ +#ifndef vtk_m_cont_CellLocator_h +#define vtk_m_cont_CellLocator_h + +#include +#include + +namespace vtkm +{ +namespace cont +{ + +class CellLocator +{ +private: + using StructuredCellSetList = vtkm::ListTagBase, + vtkm::cont::CellSetStructured<2>, + vtkm::cont::CellSetStructured<3>>; + + VTKM_CONT static bool IsUniformGrid(const vtkm::cont::DynamicCellSet& cellset, + const vtkm::cont::CoordinateSystem& coordinates) + { + return coordinates.GetData().IsSameType() && + (cellset.IsType>() || + cellset.IsType>() || + cellset.IsType>()); + } + +public: + void SetCellSet(const vtkm::cont::DynamicCellSet& cellset) { this->CellSet = cellset; } + const vtkm::cont::DynamicCellSet& GetCellSet() const { return this->CellSet; } + + void SetCoordinates(const vtkm::cont::CoordinateSystem& coords) { this->Coordinates = coords; } + const vtkm::cont::CoordinateSystem& GetCoordinates() const { return this->Coordinates; } + + /// Builds the cell locator lookup structure + /// + template + void Build(DeviceAdapter device, CellSetList cellSetTypes = CellSetList()) + { + if (IsUniformGrid(this->CellSet, this->Coordinates)) + { + // nothing to build for uniform grid + } + else + { + this->Locator.SetCellSet(this->CellSet); + this->Locator.SetCoordinates(this->Coordinates); + this->Locator.Build(device, cellSetTypes); + } + } + + class FindCellWorklet : public vtkm::worklet::WorkletMapField + { + private: + template + using ConnectivityType = vtkm::exec::ConnectivityStructured; + + public: + typedef void ControlSignature(FieldIn points, + WholeCellSetIn<> cellSet, + WholeArrayIn coordinates, + FieldOut cellIds, + FieldOut parametricCoordinates); + typedef void ExecutionSignature(_1, _2, _3, _4, _5); + + template + VTKM_EXEC void operator()(const vtkm::Vec& point, + const ConnectivityType& cellset, + const CoordsPortalType& coordinates, + vtkm::Id& cellId, + vtkm::Vec& pc) const + { + auto coords = coordinates.GetPortal(); + static_assert( + std::is_same::value, + "expecting ArrayHandleUniformPointCoordinates for coordinates"); + + auto cellId3 = static_cast((point - coords.GetOrigin()) / coords.GetSpacing()); + auto cellDim = coords.GetDimensions() - vtkm::Id3(1); + if (cellId3[0] < 0 || cellId3[0] >= cellDim[0] || cellId3[1] < 0 || + cellId3[1] >= cellDim[1] || cellId3[2] < 0 || cellId3[2] >= cellDim[2]) + { + cellId = -1; + } + else + { + cellId = cellId3[0] + cellDim[0] * (cellId3[1] + cellDim[1] * cellId3[2]); + auto cellPoints = + vtkm::VecAxisAlignedPointCoordinates(coords.Get(cellId3), coords.GetSpacing()); + bool success; + pc = vtkm::exec::WorldCoordinatesToParametricCoordinates( + cellPoints, point, cellset.GetCellShape(cellId), success, *this); + VTKM_ASSERT(success); + } + } + }; + + /// Finds the containing cells for the given array of points. Returns the cell ids + /// in the `cellIds` arrays. If a cell could not be found due to the point being + /// outside all the cells or due to numerical errors, the cell id is set to -1. + /// Parametric coordinates of the point inside the cell is returned in the + /// `parametricCoords` array. + /// + template + void FindCells( + const vtkm::cont::ArrayHandle, PointStorageType>& points, + vtkm::cont::ArrayHandle& cellIds, + vtkm::cont::ArrayHandle>& parametricCoords, + DeviceAdapter device, + CellSetList cellSetTypes = CellSetList()) const + { + if (IsUniformGrid(this->CellSet, this->Coordinates)) + { + auto coordinates = + this->Coordinates.GetData().Cast(); + auto cellset = this->CellSet.ResetCellSetList(StructuredCellSetList()); + vtkm::worklet::DispatcherMapField().Invoke( + points, cellset, coordinates, cellIds, parametricCoords); + } + else + { + this->Locator.FindCells(points, cellIds, parametricCoords, device, cellSetTypes); + } + } + +private: + vtkm::cont::DynamicCellSet CellSet; + vtkm::cont::CoordinateSystem Coordinates; + vtkm::cont::CellLocatorTwoLevelUniformGrid Locator; +}; +} +} // vtkm::cont + +#endif // vtk_m_cont_CellLocator_h diff --git a/vtkm/cont/CellLocatorTwoLevelUniformGrid.h b/vtkm/cont/CellLocatorTwoLevelUniformGrid.h index 286d538e4..760142821 100644 --- a/vtkm/cont/CellLocatorTwoLevelUniformGrid.h +++ b/vtkm/cont/CellLocatorTwoLevelUniformGrid.h @@ -107,6 +107,7 @@ private: DimVec3 Min; DimVec3 Max; + VTKM_EXEC bool Empty() const { return (this->Max[0] < this->Min[0]) || (this->Max[1] < this->Min[1]) || @@ -495,24 +496,17 @@ public: /// Builds the cell locator lookup structure /// - template - void Build(DeviceAdapter, - CellSetList cellSetTypes = CellSetList(), - CoordsTypeList coordsValueTypes = CoordsTypeList(), - CoordsStorageList coordsStorageType = CoordsStorageList()) + template + void Build(DeviceAdapter, CellSetList cellSetTypes = CellSetList()) { using Algorithm = vtkm::cont::DeviceAdapterAlgorithm; auto cellset = this->CellSet.ResetCellSetList(cellSetTypes); - auto points = - this->Coordinates.GetData().ResetTypeAndStorageLists(coordsValueTypes, coordsStorageType); + const auto& coords = this->Coordinates; TwoLevelUniformGrid ls; // 1: Compute the top level grid - auto bounds = this->Coordinates.GetBounds(coordsValueTypes, coordsStorageType); + auto bounds = this->Coordinates.GetBounds(); FloatVec3 bmin(static_cast(bounds.X.Min), static_cast(bounds.Y.Min), static_cast(bounds.Z.Min)); @@ -532,7 +526,7 @@ public: vtkm::cont::ArrayHandle binCounts; CountBinsL1 countL1(ls.TopLevel); vtkm::worklet::DispatcherMapTopology(countL1).Invoke( - cellset, points, binCounts); + cellset, coords, binCounts); // 3: Total number of unique (cell, bin) pairs (for pre-allocating arrays) vtkm::Id numPairsL1 = Algorithm::ScanExclusive(binCounts, binCounts); @@ -542,7 +536,7 @@ public: binIds.Allocate(numPairsL1); FindBinsL1 findL1(ls.TopLevel); vtkm::worklet::DispatcherMapTopology(findL1).Invoke( - cellset, points, binCounts, binIds); + cellset, coords, binCounts, binIds); binCounts.ReleaseResources(); // 5: From above, find the number of cells that intersect each top level bin @@ -576,7 +570,7 @@ public: // 8: For each cell, find the number of l2 bins they intersect CountBinsL2 countL2(ls.TopLevel); vtkm::worklet::DispatcherMapTopology(countL2).Invoke( - cellset, points, ls.LeafDimensions, binCounts); + cellset, coords, ls.LeafDimensions, binCounts); // 9: Total number of unique (cell, bin) pairs (for pre-allocating arrays) vtkm::Id numPairsL2 = Algorithm::ScanExclusive(binCounts, binCounts); @@ -586,7 +580,7 @@ public: ls.CellIds.Allocate(numPairsL2); FindBinsL2 findL2(ls.TopLevel); vtkm::worklet::DispatcherMapTopology(findL2).Invoke( - cellset, points, ls.LeafDimensions, ls.LeafStartIndex, binCounts, binIds, ls.CellIds); + cellset, coords, ls.LeafDimensions, ls.LeafStartIndex, binCounts, binIds, ls.CellIds); binCounts.ReleaseResources(); // 11: From above, find the cells that each l2 bin intersects @@ -709,22 +703,18 @@ public: template + typename CellSetList = VTKM_DEFAULT_CELL_SET_LIST_TAG> void FindCells( const vtkm::cont::ArrayHandle, PointStorageType>& points, vtkm::cont::ArrayHandle& cellIds, vtkm::cont::ArrayHandle& parametricCoords, DeviceAdapter device, - CellSetList cellSetTypes = CellSetList(), - CoordsTypeList coordsValueTypes = CoordsTypeList(), - CoordsStorageList coordsStorageType = CoordsStorageList()) const + CellSetList cellSetTypes = CellSetList()) const { vtkm::worklet::DispatcherMapField().Invoke( points, this->CellSet.ResetCellSetList(cellSetTypes), - this->Coordinates.GetData().ResetTypeAndStorageLists(coordsValueTypes, coordsStorageType), + this->Coordinates, this->PrepareForDevice(device), cellIds, parametricCoords); diff --git a/vtkm/cont/CoordinateSystem.cxx b/vtkm/cont/CoordinateSystem.cxx index c7e293d82..987973b82 100644 --- a/vtkm/cont/CoordinateSystem.cxx +++ b/vtkm/cont/CoordinateSystem.cxx @@ -25,6 +25,10 @@ namespace vtkm namespace cont { +using CoordinatesTypeList = vtkm::ListTagBase; +using CoordinatesStorageList = + vtkm::ListTagBase; + VTKM_CONT void CoordinateSystem::PrintSummary(std::ostream& out) const { @@ -35,23 +39,21 @@ void CoordinateSystem::PrintSummary(std::ostream& out) const VTKM_CONT void CoordinateSystem::GetRange(vtkm::Range* range) const { - this->Superclass::GetRange(range, - VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG(), - VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG()); + this->Superclass::GetRange(range, CoordinatesTypeList(), CoordinatesStorageList()); } VTKM_CONT const vtkm::cont::ArrayHandle& CoordinateSystem::GetRange() const { - return this->Superclass::GetRange(VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG(), - VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG()); + return this->Superclass::GetRange(CoordinatesTypeList(), CoordinatesStorageList()); } VTKM_CONT vtkm::Bounds CoordinateSystem::GetBounds() const { - return this->GetBounds(VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG(), - VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG()); + vtkm::Range ranges[3]; + this->GetRange(ranges); + return vtkm::Bounds(ranges[0], ranges[1], ranges[2]); } } } // namespace vtkm::cont diff --git a/vtkm/cont/CoordinateSystem.h b/vtkm/cont/CoordinateSystem.h index 6bfa49745..01a8ab117 100644 --- a/vtkm/cont/CoordinateSystem.h +++ b/vtkm/cont/CoordinateSystem.h @@ -22,20 +22,11 @@ #include -#include -#include +#include #include +#include #include -#ifndef VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG -#define VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG ::vtkm::TypeListTagFieldVec3 -#endif - -#ifndef VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG -#define VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG \ - ::vtkm::cont::StorageListTagCoordinateSystemDefault -#endif - namespace vtkm { namespace cont @@ -44,49 +35,49 @@ namespace cont namespace detail { -using ArrayHandleCompositeVectorFloat32_3Default = - vtkm::cont::ArrayHandleCompositeVectorType, - vtkm::cont::ArrayHandle, - vtkm::cont::ArrayHandle>::type; +struct MakeArrayHandleVirtualCoordinatesFunctor +{ + VTKM_CONT explicit MakeArrayHandleVirtualCoordinatesFunctor( + vtkm::cont::ArrayHandleVirtualCoordinates& out) + : Out(&out) + { + } -using ArrayHandleCompositeVectorFloat64_3Default = - vtkm::cont::ArrayHandleCompositeVectorType, - vtkm::cont::ArrayHandle, - vtkm::cont::ArrayHandle>::type; + template + VTKM_CONT void operator()( + const vtkm::cont::ArrayHandle, StorageTag>& array) const + { + *this->Out = vtkm::cont::ArrayHandleVirtualCoordinates(array); + } + + template + VTKM_CONT void operator()( + const vtkm::cont::ArrayHandle, StorageTag>& array) const + { + *this->Out = vtkm::cont::ArrayHandleVirtualCoordinates(array); + } + + template + VTKM_CONT void operator()(const vtkm::cont::ArrayHandle&) const + { + throw vtkm::cont::ErrorBadType("CoordinateSystem's value type should be a 3 component Vec " + "of either vtkm::Float32 or vtkm::Float64"); + } + + vtkm::cont::ArrayHandleVirtualCoordinates* Out; +}; + +template +VTKM_CONT vtkm::cont::ArrayHandleVirtualCoordinates MakeArrayHandleVirtualCoordinates( + const vtkm::cont::DynamicArrayHandleBase& array) +{ + vtkm::cont::ArrayHandleVirtualCoordinates out; + array.CastAndCall(MakeArrayHandleVirtualCoordinatesFunctor(out)); + return out; +} } // namespace detail -/// \brief Default storage list for CoordinateSystem arrays. -/// -/// \c VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG is set to this value -/// by default (unless it is defined before including VTK-m headers. -/// -struct StorageListTagCoordinateSystemDefault - : vtkm::ListTagBase, - vtkm::cont::ArrayHandle, - vtkm::cont::ArrayHandle>::StorageTag> -{ -}; -} -} - -namespace vtkm -{ - -template struct ListCrossProduct<::vtkm::TypeListTagFieldVec3, - ::vtkm::cont::StorageListTagCoordinateSystemDefault>; - -namespace cont -{ -using DynamicArrayHandleCoordinateSystem = - vtkm::cont::DynamicArrayHandleBase; - class VTKM_CONT_EXPORT CoordinateSystem : public vtkm::cont::Field { using Superclass = vtkm::cont::Field; @@ -98,15 +89,22 @@ public: { } - VTKM_CONT - CoordinateSystem(std::string name, const vtkm::cont::DynamicArrayHandle& data) + VTKM_CONT CoordinateSystem(std::string name, + const vtkm::cont::ArrayHandleVirtualCoordinates::Superclass& data) : Superclass(name, ASSOC_POINTS, data) { } + template + VTKM_CONT CoordinateSystem(std::string name, + const vtkm::cont::DynamicArrayHandleBase& data) + : Superclass(name, ASSOC_POINTS, detail::MakeArrayHandleVirtualCoordinates(data)) + { + } + template VTKM_CONT CoordinateSystem(std::string name, const ArrayHandle& data) - : Superclass(name, ASSOC_POINTS, data) + : Superclass(name, ASSOC_POINTS, vtkm::cont::ArrayHandleVirtualCoordinates(data)) { } @@ -120,7 +118,7 @@ public: vtkm::Vec spacing = vtkm::Vec(1.0f, 1.0f, 1.0f)) : Superclass(name, ASSOC_POINTS, - vtkm::cont::DynamicArrayHandle( + vtkm::cont::ArrayHandleVirtualCoordinates( vtkm::cont::ArrayHandleUniformPointCoordinates(dimensions, origin, spacing))) { } @@ -129,93 +127,45 @@ public: CoordinateSystem& operator=(const vtkm::cont::CoordinateSystem& src) = default; VTKM_CONT - vtkm::cont::DynamicArrayHandleCoordinateSystem GetData() const + vtkm::cont::ArrayHandleVirtualCoordinates GetData() const { - return vtkm::cont::DynamicArrayHandleCoordinateSystem(this->Superclass::GetData()); + return this->Superclass::GetData().Cast(); + } + + VTKM_CONT void SetData(const vtkm::cont::ArrayHandleVirtualCoordinates::Superclass& newdata) + { + this->Superclass::SetData(newdata); + } + + template + VTKM_CONT void SetData(const vtkm::cont::ArrayHandle& newdata) + { + this->Superclass::SetData(vtkm::cont::ArrayHandleVirtualCoordinates(newdata)); } VTKM_CONT - vtkm::cont::DynamicArrayHandleCoordinateSystem GetData() + template + void SetData(const vtkm::cont::DynamicArrayHandleBase& newdata) { - return vtkm::cont::DynamicArrayHandleCoordinateSystem(this->Superclass::GetData()); + this->Superclass::SetData(detail::MakeArrayHandleVirtualCoordinates(newdata)); } VTKM_CONT void GetRange(vtkm::Range* range) const; - template - VTKM_CONT void GetRange(vtkm::Range* range, TypeList) const - { - VTKM_IS_LIST_TAG(TypeList); - - this->Superclass::GetRange( - range, TypeList(), VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG()); - } - - template - VTKM_CONT void GetRange(vtkm::Range* range, TypeList, StorageList) const - { - VTKM_IS_LIST_TAG(TypeList); - VTKM_IS_LIST_TAG(StorageList); - - this->Superclass::GetRange(range, TypeList(), StorageList()); - } - VTKM_CONT const vtkm::cont::ArrayHandle& GetRange() const; - template - VTKM_CONT const vtkm::cont::ArrayHandle& GetRange(TypeList) const - { - VTKM_IS_LIST_TAG(TypeList); - - return this->Superclass::GetRange(TypeList(), - VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG()); - } - - template - VTKM_CONT const vtkm::cont::ArrayHandle& GetRange(TypeList, StorageList) const - { - VTKM_IS_LIST_TAG(TypeList); - VTKM_IS_LIST_TAG(StorageList); - - return this->Superclass::GetRange(TypeList(), StorageList()); - } - VTKM_CONT vtkm::Bounds GetBounds() const; - template - VTKM_CONT vtkm::Bounds GetBounds(TypeList) const - { - VTKM_IS_LIST_TAG(TypeList); - - return this->GetBounds(TypeList(), VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG()); - } - - template - VTKM_CONT vtkm::Bounds GetBounds(TypeList, StorageList) const - { - VTKM_IS_LIST_TAG(TypeList); - VTKM_IS_LIST_TAG(StorageList); - - vtkm::cont::ArrayHandle ranges = this->GetRange(TypeList(), StorageList()); - - VTKM_ASSERT(ranges.GetNumberOfValues() == 3); - - vtkm::cont::ArrayHandle::PortalConstControl rangePortal = - ranges.GetPortalConstControl(); - - return vtkm::Bounds(rangePortal.Get(0), rangePortal.Get(1), rangePortal.Get(2)); - } - virtual void PrintSummary(std::ostream& out) const; }; template void CastAndCall(const vtkm::cont::CoordinateSystem& coords, Functor&& f, Args&&... args) { - coords.GetData().CastAndCall(std::forward(f), std::forward(args)...); + CastAndCall(coords.GetData(), std::forward(f), std::forward(args)...); } template diff --git a/vtkm/cont/DataSetFieldAdd.h b/vtkm/cont/DataSetFieldAdd.h index 779b8f06d..1332117b5 100644 --- a/vtkm/cont/DataSetFieldAdd.h +++ b/vtkm/cont/DataSetFieldAdd.h @@ -17,7 +17,6 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - #ifndef vtk_m_cont_DataSetFieldAdd_h #define vtk_m_cont_DataSetFieldAdd_h diff --git a/vtkm/cont/DecomposerMultiBlock.h b/vtkm/cont/DecomposerMultiBlock.h new file mode 100644 index 000000000..342968d83 --- /dev/null +++ b/vtkm/cont/DecomposerMultiBlock.h @@ -0,0 +1,57 @@ +//============================================================================ +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +// Copyright 2015 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2015 UT-Battelle, LLC. +// Copyright 2015 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +//============================================================================ +#ifndef vtk_m_cont_DecomposerMultiBlock_h +#define vtk_m_cont_DecomposerMultiBlock_h + +#include +#if defined(VTKM_ENABLE_MPI) +#include + +namespace vtkm +{ +namespace cont +{ + +/// \brief DIY Decomposer that uses `MultiBlock` existing decomposition. +/// +/// To create partners for various reduce operations, DIY requires a decomposer. +/// This class provides an implementation that can use the multiblock's +/// decomposition. +/// +class VTKM_CONT_EXPORT DecomposerMultiBlock +{ +public: + VTKM_CONT DecomposerMultiBlock(const diy::Assigner& assigner) + : divisions{ assigner.nblocks() } + { + } + + using DivisionVector = std::vector; + + /// this public member is needed to satisfy decomposer concept for + /// partners in DIY. + DivisionVector divisions; +}; +} +} + +#endif // defined(VTKM_ENABLE_MPI) + +#endif diff --git a/vtkm/cont/DeviceAdapterAlgorithm.h b/vtkm/cont/DeviceAdapterAlgorithm.h index ccb042055..588f6f598 100644 --- a/vtkm/cont/DeviceAdapterAlgorithm.h +++ b/vtkm/cont/DeviceAdapterAlgorithm.h @@ -17,8 +17,8 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ -#ifndef vtk_m_cont_internal_DeviceAdapterAlgorithm_h -#define vtk_m_cont_internal_DeviceAdapterAlgorithm_h +#ifndef vtk_m_cont_DeviceAdapterAlgorithm_h +#define vtk_m_cont_DeviceAdapterAlgorithm_h #include diff --git a/vtkm/cont/DeviceAdapterListTag.h b/vtkm/cont/DeviceAdapterListTag.h index d38bb09ca..a41d57c24 100644 --- a/vtkm/cont/DeviceAdapterListTag.h +++ b/vtkm/cont/DeviceAdapterListTag.h @@ -40,47 +40,6 @@ struct DeviceAdapterListTagCommon : vtkm::ListTagBase { }; - -namespace detail -{ - -template -class ExecuteIfValidDeviceTag -{ -private: - template - using EnableIfValid = std::enable_if::Valid>; - - template - using EnableIfInvalid = std::enable_if::Valid>; - -public: - explicit ExecuteIfValidDeviceTag(const FunctorType& functor) - : Functor(functor) - { - } - - template - typename EnableIfValid::type operator()(DeviceAdapter) const - { - this->Functor(DeviceAdapter()); - } - - template - typename EnableIfInvalid::type operator()(DeviceAdapter) const - { - } - -private: - FunctorType Functor; -}; -} // detail - -template -VTKM_CONT void ForEachValidDevice(DeviceList devices, const Functor& functor) -{ - vtkm::ListForEach(detail::ExecuteIfValidDeviceTag(functor), devices); -} } } // namespace vtkm::cont diff --git a/vtkm/cont/EnvironmentTracker.cxx b/vtkm/cont/EnvironmentTracker.cxx index 942ea4255..9767d90bc 100644 --- a/vtkm/cont/EnvironmentTracker.cxx +++ b/vtkm/cont/EnvironmentTracker.cxx @@ -20,7 +20,12 @@ #include #if defined(VTKM_ENABLE_MPI) -#include + +// clang-format off +#include +#include VTKM_DIY(diy/mpi.hpp) +// clang-format on + #else namespace diy { diff --git a/vtkm/cont/EnvironmentTracker.h b/vtkm/cont/EnvironmentTracker.h index a046f8c77..d26785abc 100644 --- a/vtkm/cont/EnvironmentTracker.h +++ b/vtkm/cont/EnvironmentTracker.h @@ -25,6 +25,11 @@ #include #include +#if defined(VTKM_ENABLE_MPI) +// needed for diy mangling. +#include +#endif + namespace diy { namespace mpi diff --git a/vtkm/cont/ErrorBadDevice.h b/vtkm/cont/ErrorBadDevice.h new file mode 100644 index 000000000..a3128c75e --- /dev/null +++ b/vtkm/cont/ErrorBadDevice.h @@ -0,0 +1,48 @@ +//============================================================================ +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2014 UT-Battelle, LLC. +// Copyright 2014 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +//============================================================================ +#ifndef vtk_m_cont_ErrorBadDevice_h +#define vtk_m_cont_ErrorBadDevice_h + +#include + +namespace vtkm +{ +namespace cont +{ + +VTKM_SILENCE_WEAK_VTABLE_WARNING_START + +/// This class is thrown when VTK-m performs an operation that is not supported +/// on the current device. +/// +class VTKM_ALWAYS_EXPORT ErrorBadDevice : public Error +{ +public: + ErrorBadDevice(const std::string& message) + : Error(message) + { + } +}; + +VTKM_SILENCE_WEAK_VTABLE_WARNING_END +} +} // namespace vtkm::cont + +#endif // vtk_m_cont_ErrorBadDevice_h diff --git a/vtkm/cont/Field.h b/vtkm/cont/Field.h index a19a3a729..ee659c295 100644 --- a/vtkm/cont/Field.h +++ b/vtkm/cont/Field.h @@ -249,8 +249,8 @@ public: vtkm::cont::DynamicArrayHandle& GetData(); - template - VTKM_CONT void SetData(const vtkm::cont::ArrayHandle& newdata) + template + VTKM_CONT void SetData(const vtkm::cont::ArrayHandle& newdata) { this->Data = newdata; this->ModifiedFlag = true; diff --git a/vtkm/cont/MultiBlock.cxx b/vtkm/cont/MultiBlock.cxx index 9d71bfb50..4323b9bba 100644 --- a/vtkm/cont/MultiBlock.cxx +++ b/vtkm/cont/MultiBlock.cxx @@ -21,7 +21,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -30,7 +32,14 @@ #include #if defined(VTKM_ENABLE_MPI) -#include +// clang-format off +#include +#include VTKM_DIY(diy/decomposition.hpp) +#include VTKM_DIY(diy/master.hpp) +#include VTKM_DIY(diy/partners/all-reduce.hpp) +#include VTKM_DIY(diy/partners/swap.hpp) +#include VTKM_DIY(diy/reduce.hpp) +// clang-format on namespace vtkm { @@ -48,111 +57,21 @@ VTKM_CONT std::vector CopyArrayPortalToVector( std::copy(iterators.GetBegin(), iterators.GetEnd(), result.begin()); return result; } + +template +const vtkm::cont::DataSet& GetBlock(const vtkm::cont::MultiBlock& mb, const T&); + +template <> +const vtkm::cont::DataSet& GetBlock(const vtkm::cont::MultiBlock& mb, + const diy::Master::ProxyWithLink& cp) +{ + const int lid = cp.master()->lid(cp.gid()); + return mb.GetBlock(lid); } } } - -namespace std -{ - -namespace detail -{ - -template -struct MPIPlus -{ - MPIPlus() - { - this->OpPtr = std::shared_ptr(new MPI_Op(MPI_NO_OP), [](MPI_Op* ptr) { - MPI_Op_free(ptr); - delete ptr; - }); - - MPI_Op_create( - [](void* a, void* b, int* len, MPI_Datatype*) { - T* ba = reinterpret_cast(a); - T* bb = reinterpret_cast(b); - for (int cc = 0; cc < (*len) / ElementSize; ++cc) - { - bb[cc] = ba[cc] + bb[cc]; - } - }, - 1, - this->OpPtr.get()); - } - ~MPIPlus() {} - operator MPI_Op() const { return *this->OpPtr.get(); } -private: - std::shared_ptr OpPtr; -}; - -} // std::detail - -template <> -struct plus -{ - MPI_Op get_mpi_op() const { return this->Op; } - vtkm::Bounds operator()(const vtkm::Bounds& lhs, const vtkm::Bounds& rhs) const - { - return lhs + rhs; - } - -private: - std::detail::MPIPlus Op; -}; - -template <> -struct plus -{ - MPI_Op get_mpi_op() const { return this->Op; } - vtkm::Range operator()(const vtkm::Range& lhs, const vtkm::Range& rhs) const { return lhs + rhs; } - -private: - std::detail::MPIPlus Op; -}; } -namespace diy -{ -namespace mpi -{ -namespace detail -{ -template <> -struct mpi_datatype -{ - static MPI_Datatype datatype() { return get_mpi_datatype(); } - static const void* address(const vtkm::Bounds& x) { return &x; } - static void* address(vtkm::Bounds& x) { return &x; } - static int count(const vtkm::Bounds&) { return 6; } -}; - -template <> -struct mpi_op> -{ - static MPI_Op get(const std::plus& op) { return op.get_mpi_op(); } -}; - -template <> -struct mpi_datatype -{ - static MPI_Datatype datatype() { return get_mpi_datatype(); } - static const void* address(const vtkm::Range& x) { return &x; } - static void* address(vtkm::Range& x) { return &x; } - static int count(const vtkm::Range&) { return 2; } -}; - -template <> -struct mpi_op> -{ - static MPI_Op get(const std::plus& op) { return op.get_mpi_op(); } -}; - -} // diy::mpi::detail -} // diy::mpi -} // diy - - #endif namespace vtkm @@ -286,51 +205,60 @@ void MultiBlock::ReplaceBlock(vtkm::Id index, vtkm::cont::DataSet& ds) } } -VTKM_CONT -vtkm::Bounds MultiBlock::GetBounds(vtkm::Id coordinate_system_index) const +VTKM_CONT vtkm::Bounds MultiBlock::GetBounds(vtkm::Id coordinate_system_index) const { - return this->GetBounds(coordinate_system_index, - VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG(), - VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG()); -} - -template -VTKM_CONT vtkm::Bounds MultiBlock::GetBounds(vtkm::Id coordinate_system_index, TypeList) const -{ - VTKM_IS_LIST_TAG(TypeList); - return this->GetBounds( - coordinate_system_index, TypeList(), VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG()); -} -template -VTKM_CONT vtkm::Bounds MultiBlock::GetBounds(vtkm::Id coordinate_system_index, - TypeList, - StorageList) const -{ - VTKM_IS_LIST_TAG(TypeList); - VTKM_IS_LIST_TAG(StorageList); - #if defined(VTKM_ENABLE_MPI) auto world = vtkm::cont::EnvironmentTracker::GetCommunicator(); - //const auto global_num_blocks = this->GetGlobalNumberOfBlocks(); + diy::Master master(world, + 1, + -1, + []() -> void* { return new vtkm::Bounds(); }, + [](void* ptr) { delete static_cast(ptr); }); - const auto num_blocks = this->GetNumberOfBlocks(); + vtkm::cont::AssignerMultiBlock assigner(*this); - diy::Master master(world, 1, -1); - for (vtkm::Id cc = 0; cc < num_blocks; ++cc) - { - int gid = cc * world.size() + world.rank(); - master.add(gid, const_cast(&this->Blocks[cc]), new diy::Link()); - } + // populate master with blocks from `this`. + diy::decompose(world.rank(), assigner, master); - master.foreach ([&](const vtkm::cont::DataSet* block, const diy::Master::ProxyWithLink& cp) { - auto coords = block->GetCoordinateSystem(coordinate_system_index); - const vtkm::Bounds bounds = coords.GetBounds(TypeList(), StorageList()); - cp.all_reduce(bounds, std::plus()); + auto self = (*this); + master.foreach ([&](vtkm::Bounds* data, const diy::Master::ProxyWithLink& cp) { + const vtkm::cont::DataSet& block = vtkm::cont::detail::GetBlock(self, cp); + try + { + vtkm::cont::CoordinateSystem coords = block.GetCoordinateSystem(coordinate_system_index); + *data = coords.GetBounds(); + } + catch (const vtkm::cont::Error&) + { + } }); - master.process_collectives(); - auto bounds = master.proxy(0).get(); - return bounds; + vtkm::cont::DecomposerMultiBlock decomposer(assigner); + diy::RegularSwapPartners partners(decomposer, /*k=*/2); + + auto callback = + [](vtkm::Bounds* data, const diy::ReduceProxy& srp, const diy::RegularSwapPartners&) { + // 1. dequeue. + std::vector incoming; + srp.incoming(incoming); + vtkm::Bounds message; + for (const int gid : incoming) + { + srp.dequeue(gid, message); + data->Include(message); + } + // 2. enqueue + for (int cc = 0; cc < srp.out_link().size(); ++cc) + { + srp.enqueue(srp.out_link().target(cc), *data); + } + }; + diy::reduce(master, assigner, partners, callback); + if (master.size()) + { + return (*master.block(0)); + } + return vtkm::Bounds(); #else const vtkm::Id index = coordinate_system_index; @@ -339,44 +267,16 @@ VTKM_CONT vtkm::Bounds MultiBlock::GetBounds(vtkm::Id coordinate_system_index, vtkm::Bounds bounds; for (size_t i = 0; i < num_blocks; ++i) { - vtkm::Bounds block_bounds = this->GetBlockBounds(i, index, TypeList(), StorageList()); + vtkm::Bounds block_bounds = this->GetBlockBounds(i, index); bounds.Include(block_bounds); } return bounds; #endif } -VTKM_CONT -vtkm::Bounds MultiBlock::GetBlockBounds(const std::size_t& block_index, - vtkm::Id coordinate_system_index) const -{ - return this->GetBlockBounds(block_index, - coordinate_system_index, - VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG(), - VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG()); -} - -template VTKM_CONT vtkm::Bounds MultiBlock::GetBlockBounds(const std::size_t& block_index, - vtkm::Id coordinate_system_index, - TypeList) const + vtkm::Id coordinate_system_index) const { - VTKM_IS_LIST_TAG(TypeList); - return this->GetBlockBounds(block_index, - coordinate_system_index, - TypeList(), - VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG()); -} - -template -VTKM_CONT vtkm::Bounds MultiBlock::GetBlockBounds(const std::size_t& block_index, - vtkm::Id coordinate_system_index, - TypeList, - StorageList) const -{ - VTKM_IS_LIST_TAG(TypeList); - VTKM_IS_LIST_TAG(StorageList); - const vtkm::Id index = coordinate_system_index; vtkm::cont::CoordinateSystem coords; try @@ -391,117 +291,77 @@ VTKM_CONT vtkm::Bounds MultiBlock::GetBlockBounds(const std::size_t& block_index << "block " << block_index << ". vtkm error message: " << error.GetMessage(); throw ErrorExecution(msg.str()); } - return coords.GetBounds(TypeList(), StorageList()); + return coords.GetBounds(); } -VTKM_CONT -vtkm::cont::ArrayHandle MultiBlock::GetGlobalRange(const int& index) const +VTKM_CONT vtkm::cont::ArrayHandle MultiBlock::GetGlobalRange(const int& index) const { - return this->GetGlobalRange(index, VTKM_DEFAULT_TYPE_LIST_TAG(), VTKM_DEFAULT_STORAGE_LIST_TAG()); -} - -template -VTKM_CONT vtkm::cont::ArrayHandle MultiBlock::GetGlobalRange(const int& index, - TypeList) const -{ - VTKM_IS_LIST_TAG(TypeList); - return this->GetGlobalRange(index, TypeList(), VTKM_DEFAULT_STORAGE_LIST_TAG()); -} - -template -VTKM_CONT vtkm::cont::ArrayHandle MultiBlock::GetGlobalRange(const int& index, - TypeList, - StorageList) const -{ - VTKM_IS_LIST_TAG(TypeList); - VTKM_IS_LIST_TAG(StorageList); - assert(this->Blocks.size() > 0); vtkm::cont::Field field = this->Blocks.at(0).GetField(index); std::string field_name = field.GetName(); - return this->GetGlobalRange(field_name, TypeList(), StorageList()); + return this->GetGlobalRange(field_name); } -VTKM_CONT -vtkm::cont::ArrayHandle MultiBlock::GetGlobalRange(const std::string& field_name) const -{ - return this->GetGlobalRange( - field_name, VTKM_DEFAULT_TYPE_LIST_TAG(), VTKM_DEFAULT_STORAGE_LIST_TAG()); -} - -template VTKM_CONT vtkm::cont::ArrayHandle MultiBlock::GetGlobalRange( - const std::string& field_name, - TypeList) const -{ - VTKM_IS_LIST_TAG(TypeList); - return this->GetGlobalRange(field_name, TypeList(), VTKM_DEFAULT_STORAGE_LIST_TAG()); -} - -template -VTKM_CONT vtkm::cont::ArrayHandle -MultiBlock::GetGlobalRange(const std::string& field_name, TypeList, StorageList) const + const std::string& field_name) const { #if defined(VTKM_ENABLE_MPI) - auto world = vtkm::cont::EnvironmentTracker::GetCommunicator(); - const auto num_blocks = this->GetNumberOfBlocks(); + using BlockMetaData = std::vector; - diy::Master master(world); - for (vtkm::Id cc = 0; cc < num_blocks; ++cc) - { - int gid = cc * world.size() + world.rank(); - master.add(gid, const_cast(&this->Blocks[cc]), new diy::Link()); - } + auto comm = vtkm::cont::EnvironmentTracker::GetCommunicator(); + diy::Master master(comm, + 1, + -1, + []() -> void* { return new BlockMetaData(); }, + [](void* ptr) { delete static_cast(ptr); }); - // collect info about number of components in the field. - master.foreach ([&](const vtkm::cont::DataSet* dataset, const diy::Master::ProxyWithLink& cp) { - if (dataset->HasField(field_name)) + vtkm::cont::AssignerMultiBlock assigner(*this); + + diy::decompose(comm.rank(), assigner, master); + + auto self = (*this); + master.foreach ([&](BlockMetaData* data, const diy::Master::ProxyWithLink& cp) { + const vtkm::cont::DataSet& block = vtkm::cont::detail::GetBlock(self, cp); + if (block.HasField(field_name)) { - auto field = dataset->GetField(field_name); - const vtkm::cont::ArrayHandle range = field.GetRange(TypeList(), StorageList()); - vtkm::Id components = range.GetPortalConstControl().GetNumberOfValues(); - cp.all_reduce(components, diy::mpi::maximum()); + auto field = block.GetField(field_name); + const vtkm::cont::ArrayHandle range = field.GetRange(); + *data = vtkm::cont::detail::CopyArrayPortalToVector(range.GetPortalConstControl()); } }); - master.process_collectives(); - const vtkm::Id components = master.size() ? master.proxy(0).read() : 0; + vtkm::cont::DecomposerMultiBlock decomposer(assigner); + diy::RegularSwapPartners partners(decomposer, /*k=*/2); + auto callback = + [](BlockMetaData* data, const diy::ReduceProxy& srp, const diy::RegularSwapPartners&) { + std::vector incoming; + srp.incoming(incoming); - // clear all collectives. - master.foreach ([&](const vtkm::cont::DataSet*, const diy::Master::ProxyWithLink& cp) { - cp.collectives()->clear(); - }); - - master.foreach ([&](const vtkm::cont::DataSet* dataset, const diy::Master::ProxyWithLink& cp) { - if (dataset->HasField(field_name)) - { - auto field = dataset->GetField(field_name); - const vtkm::cont::ArrayHandle range = field.GetRange(TypeList(), StorageList()); - const auto v_range = - vtkm::cont::detail::CopyArrayPortalToVector(range.GetPortalConstControl()); - for (const vtkm::Range& r : v_range) + // 1. dequeue + BlockMetaData message; + for (const int gid : incoming) { - cp.all_reduce(r, std::plus()); + srp.dequeue(gid, message); + data->resize(std::max(data->size(), message.size())); + for (size_t cc = 0; cc < data->size(); ++cc) + { + (*data)[cc].Include(message[cc]); + } } - // if current block has less that the max number of components, just add invalid ranges for the rest. - for (vtkm::Id cc = static_cast(v_range.size()); cc < components; ++cc) + // 2. enqueue + for (int cc = 0; cc < srp.out_link().size(); ++cc) { - cp.all_reduce(vtkm::Range(), std::plus()); + srp.enqueue(srp.out_link().target(cc), *data); } - } - }); - master.process_collectives(); - std::vector ranges(components); - // FIXME: is master.size() == 0 i.e. there are no blocks on the current rank, - // this method won't return valid range. - if (master.size() > 0) - { - for (vtkm::Id cc = 0; cc < components; ++cc) - { - ranges[cc] = master.proxy(0).get(); - } - } + }; + diy::reduce(master, assigner, partners, callback); + + BlockMetaData ranges; + if (master.size()) + { + ranges = *(master.block(0)); + } vtkm::cont::ArrayHandle tmprange = vtkm::cont::make_ArrayHandle(ranges); vtkm::cont::ArrayHandle range; vtkm::cont::ArrayCopy(vtkm::cont::make_ArrayHandle(ranges), range); @@ -522,7 +382,7 @@ MultiBlock::GetGlobalRange(const std::string& field_name, TypeList, StorageList) } const vtkm::cont::Field& field = this->Blocks[i].GetField(field_name); - vtkm::cont::ArrayHandle sub_range = field.GetRange(TypeList(), StorageList()); + vtkm::cont::ArrayHandle sub_range = field.GetRange(); vtkm::cont::ArrayHandle::PortalConstControl sub_range_control = sub_range.GetPortalConstControl(); @@ -546,7 +406,6 @@ MultiBlock::GetGlobalRange(const std::string& field_name, TypeList, StorageList) throw ErrorExecution(msg.str()); } - for (vtkm::Id c = 0; c < components; ++c) { vtkm::Range s_range = sub_range_control.Get(c); diff --git a/vtkm/cont/MultiBlock.h b/vtkm/cont/MultiBlock.h index dad32672c..3261cb3ec 100644 --- a/vtkm/cont/MultiBlock.h +++ b/vtkm/cont/MultiBlock.h @@ -92,27 +92,11 @@ public: VTKM_CONT vtkm::Bounds GetBounds(vtkm::Id coordinate_system_index = 0) const; - template - VTKM_CONT vtkm::Bounds GetBounds(vtkm::Id coordinate_system_index, TypeList) const; - - template - VTKM_CONT vtkm::Bounds GetBounds(vtkm::Id coordinate_system_index, TypeList, StorageList) const; /// get the bounds of a coordinate system within a given DataSet VTKM_CONT vtkm::Bounds GetBlockBounds(const std::size_t& block_index, vtkm::Id coordinate_system_index = 0) const; - template - VTKM_CONT vtkm::Bounds GetBlockBounds(const std::size_t& block_index, - vtkm::Id coordinate_system_index, - TypeList) const; - - template - VTKM_CONT vtkm::Bounds GetBlockBounds(const std::size_t& block_index, - vtkm::Id coordinate_system_index, - TypeList, - StorageList) const; - //@{ /// Get the unified range of the same field within all contained DataSet. /// These methods are not thread-safe and may involve global communication @@ -120,25 +104,8 @@ public: VTKM_CONT vtkm::cont::ArrayHandle GetGlobalRange(const std::string& field_name) const; - template - VTKM_CONT vtkm::cont::ArrayHandle GetGlobalRange(const std::string& field_name, - TypeList) const; - - template - VTKM_CONT vtkm::cont::ArrayHandle GetGlobalRange(const std::string& field_name, - TypeList, - StorageList) const; - VTKM_CONT vtkm::cont::ArrayHandle GetGlobalRange(const int& index) const; - - template - VTKM_CONT vtkm::cont::ArrayHandle GetGlobalRange(const int& index, TypeList) const; - - template - VTKM_CONT vtkm::cont::ArrayHandle GetGlobalRange(const int& index, - TypeList, - StorageList) const; //@} VTKM_CONT diff --git a/vtkm/cont/PointLocatorUniformGrid.h b/vtkm/cont/PointLocatorUniformGrid.h index ea5c4f613..4af29b451 100644 --- a/vtkm/cont/PointLocatorUniformGrid.h +++ b/vtkm/cont/PointLocatorUniformGrid.h @@ -17,7 +17,6 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ - #ifndef vtk_m_cont_PointLocatorUniformGrid_h #define vtk_m_cont_PointLocatorUniformGrid_h diff --git a/vtkm/cont/RuntimeDeviceTracker.h b/vtkm/cont/RuntimeDeviceTracker.h index ebdfe5e72..bd873076c 100644 --- a/vtkm/cont/RuntimeDeviceTracker.h +++ b/vtkm/cont/RuntimeDeviceTracker.h @@ -22,6 +22,7 @@ #include #include +#include #include namespace vtkm @@ -85,6 +86,23 @@ public: this->SetDeviceState(deviceId, name, false); } + //@{ + /// Report a ErrorBadDevice failure and flag the device as unusable. + template + VTKM_CONT void ReportBadDeviceFailure(DeviceAdapterTag, const vtkm::cont::ErrorBadDevice&) + { + using Traits = vtkm::cont::DeviceAdapterTraits; + this->SetDeviceState(Traits::GetId(), Traits::GetName(), false); + } + + VTKM_CONT void ReportBadDeviceFailure(vtkm::Int8 deviceId, + const std::string& name, + const vtkm::cont::ErrorBadDevice&) + { + this->SetDeviceState(deviceId, name, false); + } + //@} + /// Reset the tracker for the given device. This will discard any updates /// caused by reported failures /// diff --git a/vtkm/cont/TryExecute.cxx b/vtkm/cont/TryExecute.cxx index a2b1fe66c..9cc0f8786 100644 --- a/vtkm/cont/TryExecute.cxx +++ b/vtkm/cont/TryExecute.cxx @@ -46,6 +46,11 @@ void HandleTryExecuteException(vtkm::Int8 deviceId, //than we fallback to another device tracker.ReportAllocationFailure(deviceId, name, e); } + catch (vtkm::cont::ErrorBadDevice& e) + { + std::cerr << "caught ErrorBadDevice: " << e.GetMessage() << std::endl; + tracker.ReportBadDeviceFailure(deviceId, name, e); + } catch (vtkm::cont::ErrorBadType& e) { //should bad type errors should stop the execution, instead of diff --git a/vtkm/cont/VirtualObjectHandle.h b/vtkm/cont/VirtualObjectHandle.h index c372d3095..97fad110d 100644 --- a/vtkm/cont/VirtualObjectHandle.h +++ b/vtkm/cont/VirtualObjectHandle.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -101,9 +102,10 @@ public: this->Internals->VirtualObject = derived; this->Internals->Owner = acquireOwnership; - vtkm::cont::ForEachValidDevice( - devices, - CreateTransferInterface(this->Internals->Transfers.data(), derived)); + vtkm::cont::internal::ForEachValidDevice(devices, + CreateTransferInterface(), + this->Internals->Transfers.data(), + derived); } } @@ -202,18 +204,12 @@ private: }; template - class CreateTransferInterface + struct CreateTransferInterface { - public: - CreateTransferInterface(std::unique_ptr* transfers, - const VirtualDerivedType* virtualObject) - : Transfers(transfers) - , VirtualObject(virtualObject) - { - } - template - void operator()(DeviceAdapter) const + VTKM_CONT void operator()(DeviceAdapter, + std::unique_ptr* transfers, + const VirtualDerivedType* virtualObject) const { using DeviceInfo = vtkm::cont::DeviceAdapterTraits; @@ -225,12 +221,8 @@ private: throw vtkm::cont::ErrorBadType(msg); } using TransferImpl = TransferInterfaceImpl; - this->Transfers[DeviceInfo::GetId()].reset(new TransferImpl(this->VirtualObject)); + transfers[DeviceInfo::GetId()].reset(new TransferImpl(virtualObject)); } - - private: - std::unique_ptr* Transfers; - const VirtualDerivedType* VirtualObject; }; struct InternalStruct diff --git a/vtkm/cont/cuda/testing/CMakeLists.txt b/vtkm/cont/cuda/testing/CMakeLists.txt index 4ceeb0a28..b88d322d2 100644 --- a/vtkm/cont/cuda/testing/CMakeLists.txt +++ b/vtkm/cont/cuda/testing/CMakeLists.txt @@ -20,6 +20,7 @@ set(unit_tests UnitTestCudaArrayHandleFancy.cu + UnitTestCudaArrayHandleVirtualCoordinates.cu UnitTestCudaCellLocatorTwoLevelUniformGrid.cu UnitTestCudaComputeRange.cu UnitTestCudaDataSetExplicit.cu diff --git a/vtkm/cont/cuda/testing/UnitTestCudaArrayHandleVirtualCoordinates.cu b/vtkm/cont/cuda/testing/UnitTestCudaArrayHandleVirtualCoordinates.cu new file mode 100644 index 000000000..9e950b953 --- /dev/null +++ b/vtkm/cont/cuda/testing/UnitTestCudaArrayHandleVirtualCoordinates.cu @@ -0,0 +1,27 @@ +//============================================================================ +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2014 UT-Battelle, LLC. +// Copyright 2014 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +//============================================================================ +#include +#include + +int UnitTestCudaArrayHandleVirtualCoordinates(int, char* []) +{ + return vtkm::cont::testing::TestingArrayHandleVirtualCoordinates< + vtkm::cont::DeviceAdapterTagCuda>::Run(); +} diff --git a/vtkm/cont/internal/CMakeLists.txt b/vtkm/cont/internal/CMakeLists.txt index 96942b85f..2faf93a7e 100644 --- a/vtkm/cont/internal/CMakeLists.txt +++ b/vtkm/cont/internal/CMakeLists.txt @@ -32,6 +32,7 @@ set(headers DeviceAdapterAlgorithmGeneral.h DeviceAdapterDefaultSelection.h DeviceAdapterError.h + DeviceAdapterListHelpers.h DeviceAdapterTag.h DynamicTransform.h FunctorsGeneral.h diff --git a/vtkm/cont/internal/DeviceAdapterListHelpers.h b/vtkm/cont/internal/DeviceAdapterListHelpers.h new file mode 100644 index 000000000..8897338fb --- /dev/null +++ b/vtkm/cont/internal/DeviceAdapterListHelpers.h @@ -0,0 +1,138 @@ +//============================================================================ +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +// Copyright 2016 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2016 UT-Battelle, LLC. +// Copyright 2016 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +//============================================================================ +#ifndef vtk_m_cont_internal_DeviceAdapterListHelpers_h +#define vtk_m_cont_internal_DeviceAdapterListHelpers_h + +#include +#include +#include + +namespace vtkm +{ +namespace cont +{ +namespace internal +{ + +//============================================================================ +template +class ExecuteIfValidDeviceTag +{ +private: + template + using EnableIfValid = std::enable_if::Valid>; + + template + using EnableIfInvalid = std::enable_if::Valid>; + +public: + explicit ExecuteIfValidDeviceTag(const FunctorType& functor) + : Functor(functor) + { + } + + template + typename EnableIfValid::type operator()( + DeviceAdapter device, + const vtkm::cont::RuntimeDeviceTracker& tracker, + Args&&... args) const + { + if (tracker.CanRunOn(device)) + { + this->Functor(device, std::forward(args)...); + } + } + + // do not generate code for invalid devices + template + typename EnableIfInvalid::type operator()(DeviceAdapter, + const vtkm::cont::RuntimeDeviceTracker&, + Args&&...) const + { + } + +private: + FunctorType Functor; +}; + +/// Execute the given functor on each valid device in \c DeviceList. +/// +template +VTKM_CONT void ForEachValidDevice(DeviceList devices, const Functor& functor, Args&&... args) +{ + auto tracker = vtkm::cont::GetGlobalRuntimeDeviceTracker(); + + ExecuteIfValidDeviceTag wrapped(functor); + vtkm::ListForEach(wrapped, devices, tracker, std::forward(args)...); +} + +//============================================================================ +template +class ExecuteIfSameDeviceId +{ +public: + ExecuteIfSameDeviceId(FunctorType functor) + : Functor(functor) + { + } + + template + void operator()(DeviceAdapter device, + vtkm::cont::DeviceAdapterId deviceId, + bool& status, + Args&&... args) const + { + if (vtkm::cont::DeviceAdapterTraits::GetId() == deviceId) + { + VTKM_ASSERT(status == false); + this->Functor(device, std::forward(args)...); + status = true; + } + } + +private: + FunctorType Functor; +}; + +/// Finds the \c DeviceAdapterTag in \c DeviceList with id equal to deviceId +/// and executes the functor with the tag. Throws \c ErrorBadDevice if a valid +/// \c DeviceAdapterTag is not found. +/// +template +VTKM_CONT void FindDeviceAdapterTagAndCall(vtkm::cont::DeviceAdapterId deviceId, + DeviceList devices, + const Functor& functor, + Args&&... args) +{ + bool status = false; + ExecuteIfSameDeviceId wrapped(functor); + ForEachValidDevice(devices, wrapped, deviceId, status, std::forward(args)...); + if (!status) + { + std::string msg = + "Device with id " + std::to_string(deviceId) + " is either not in the list or is invalid"; + throw vtkm::cont::ErrorBadDevice(msg); + } +} +} +} +} // vtkm::cont::internal + +#endif // vtk_m_cont_internal_DeviceAdapterListHelpers_h diff --git a/vtkm/cont/serial/internal/DeviceAdapterAlgorithmSerial.h b/vtkm/cont/serial/internal/DeviceAdapterAlgorithmSerial.h index cd110a105..1354d25e0 100644 --- a/vtkm/cont/serial/internal/DeviceAdapterAlgorithmSerial.h +++ b/vtkm/cont/serial/internal/DeviceAdapterAlgorithmSerial.h @@ -68,6 +68,7 @@ private: } } + VTKM_SUPPRESS_EXEC_WARNINGS template VTKM_EXEC static void DoCopy(InIter src, InIter srcEnd, OutIter dst, std::true_type) { diff --git a/vtkm/cont/serial/testing/CMakeLists.txt b/vtkm/cont/serial/testing/CMakeLists.txt index cbe17808f..ad9fbfd68 100644 --- a/vtkm/cont/serial/testing/CMakeLists.txt +++ b/vtkm/cont/serial/testing/CMakeLists.txt @@ -21,6 +21,7 @@ set(unit_tests UnitTestSerialArrayHandle.cxx UnitTestSerialArrayHandleFancy.cxx + UnitTestSerialArrayHandleVirtualCoordinates.cxx UnitTestSerialCellLocatorTwoLevelUniformGrid.cxx UnitTestSerialComputeRange.cxx UnitTestSerialDataSetExplicit.cxx diff --git a/vtkm/cont/serial/testing/UnitTestSerialArrayHandleVirtualCoordinates.cxx b/vtkm/cont/serial/testing/UnitTestSerialArrayHandleVirtualCoordinates.cxx new file mode 100644 index 000000000..64d845d97 --- /dev/null +++ b/vtkm/cont/serial/testing/UnitTestSerialArrayHandleVirtualCoordinates.cxx @@ -0,0 +1,27 @@ +//============================================================================ +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2014 UT-Battelle, LLC. +// Copyright 2014 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +//============================================================================ +#include +#include + +int UnitTestSerialArrayHandleVirtualCoordinates(int, char* []) +{ + return vtkm::cont::testing::TestingArrayHandleVirtualCoordinates< + vtkm::cont::DeviceAdapterTagSerial>::Run(); +} diff --git a/vtkm/cont/tbb/internal/FunctorsTBB.h b/vtkm/cont/tbb/internal/FunctorsTBB.h index 10bb2f2b1..03dade15f 100644 --- a/vtkm/cont/tbb/internal/FunctorsTBB.h +++ b/vtkm/cont/tbb/internal/FunctorsTBB.h @@ -98,7 +98,6 @@ struct CopyBody vtkm::Id InputOffset; vtkm::Id OutputOffset; - VTKM_EXEC_CONT CopyBody(const InputPortalType& inPortal, const OutputPortalType& outPortal, vtkm::Id inOffset, @@ -127,12 +126,14 @@ struct CopyBody } } + VTKM_SUPPRESS_EXEC_WARNINGS template VTKM_EXEC void DoCopy(InIter src, InIter srcEnd, OutIter dst, std::true_type) const { std::copy(src, srcEnd, dst); } + VTKM_SUPPRESS_EXEC_WARNINGS VTKM_EXEC void operator()(const ::tbb::blocked_range& range) const { diff --git a/vtkm/cont/tbb/testing/CMakeLists.txt b/vtkm/cont/tbb/testing/CMakeLists.txt index 12cbfc426..246acfc35 100644 --- a/vtkm/cont/tbb/testing/CMakeLists.txt +++ b/vtkm/cont/tbb/testing/CMakeLists.txt @@ -21,6 +21,7 @@ set(unit_tests UnitTestTBBArrayHandle.cxx UnitTestTBBArrayHandleFancy.cxx + UnitTestTBBArrayHandleVirtualCoordinates.cxx UnitTestTBBCellLocatorTwoLevelUniformGrid.cxx UnitTestTBBComputeRange.cxx UnitTestTBBDataSetExplicit.cxx diff --git a/vtkm/cont/tbb/testing/UnitTestTBBArrayHandleVirtualCoordinates.cxx b/vtkm/cont/tbb/testing/UnitTestTBBArrayHandleVirtualCoordinates.cxx new file mode 100644 index 000000000..7fa602c5e --- /dev/null +++ b/vtkm/cont/tbb/testing/UnitTestTBBArrayHandleVirtualCoordinates.cxx @@ -0,0 +1,27 @@ +//============================================================================ +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2014 UT-Battelle, LLC. +// Copyright 2014 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +//============================================================================ +#include +#include + +int UnitTestTBBArrayHandleVirtualCoordinates(int, char* []) +{ + return vtkm::cont::testing::TestingArrayHandleVirtualCoordinates< + vtkm::cont::DeviceAdapterTagTBB>::Run(); +} diff --git a/vtkm/cont/testing/CMakeLists.txt b/vtkm/cont/testing/CMakeLists.txt index 22968cb2c..1a3850b2a 100644 --- a/vtkm/cont/testing/CMakeLists.txt +++ b/vtkm/cont/testing/CMakeLists.txt @@ -23,6 +23,7 @@ set(headers MakeTestDataSet.h Testing.h TestingArrayHandles.h + TestingArrayHandleVirtualCoordinates.h TestingCellLocatorTwoLevelUniformGrid.h TestingComputeRange.h TestingDeviceAdapter.h @@ -53,6 +54,7 @@ set(unit_tests UnitTestArrayHandleUniformPointCoordinates.cxx UnitTestArrayHandleConcatenate.cxx UnitTestArrayPortalToIterators.cxx + UnitTestCellLocator.cxx UnitTestCellSetExplicit.cxx UnitTestCellSetPermutation.cxx UnitTestContTesting.cxx diff --git a/vtkm/cont/testing/TestingArrayHandleVirtualCoordinates.h b/vtkm/cont/testing/TestingArrayHandleVirtualCoordinates.h new file mode 100644 index 000000000..87293f9a3 --- /dev/null +++ b/vtkm/cont/testing/TestingArrayHandleVirtualCoordinates.h @@ -0,0 +1,117 @@ +//============================================================================ +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2014 UT-Battelle, LLC. +// Copyright 2014 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +//============================================================================ +#ifndef vtk_m_cont_testing_TestingArrayHandleVirtualCoordinates_h +#define vtk_m_cont_testing_TestingArrayHandleVirtualCoordinates_h + +#include +#include +#include +#include +#include +#include + +namespace vtkm +{ +namespace cont +{ +namespace testing +{ + +namespace +{ + +struct CopyWorklet : public vtkm::worklet::WorkletMapField +{ + typedef void ControlSignature(FieldIn in, FieldOut out); + typedef _2 ExecutionSignature(_1); + + template + VTKM_EXEC T operator()(const T& in) const + { + return in; + } +}; + +} // anonymous namespace + +template +class TestingArrayHandleVirtualCoordinates +{ +private: + using ArrayHandleRectilinearCoords = + vtkm::cont::ArrayHandleCartesianProduct, + vtkm::cont::ArrayHandle, + vtkm::cont::ArrayHandle>; + + template + static void TestVirtualAccess(const vtkm::cont::ArrayHandle& in, + vtkm::cont::ArrayHandle& out) + { + vtkm::worklet::DispatcherMapField().Invoke( + vtkm::cont::ArrayHandleVirtualCoordinates(in), + vtkm::cont::ArrayHandleVirtualCoordinates(out)); + + VTKM_TEST_ASSERT(test_equal_portals(in.GetPortalConstControl(), out.GetPortalConstControl()), + "Input and output portals don't match"); + } + + static void TestAll() + { + using PointType = vtkm::Vec; + static const vtkm::Id length = 64; + + vtkm::cont::ArrayHandle out; + + std::cout << "Testing basic ArrayHandle as input\n"; + vtkm::cont::ArrayHandle a1; + a1.Allocate(length); + for (vtkm::Id i = 0; i < length; ++i) + { + a1.GetPortalControl().Set(i, TestValue(i, PointType())); + } + TestVirtualAccess(a1, out); + + std::cout << "Testing ArrayHandleUniformPointCoordinates as input\n"; + TestVirtualAccess(vtkm::cont::ArrayHandleUniformPointCoordinates(vtkm::Id3(4, 4, 4)), out); + + std::cout << "Testing ArrayHandleCartesianProduct as input\n"; + vtkm::cont::ArrayHandle c1, c2, c3; + c1.Allocate(length); + c2.Allocate(length); + c3.Allocate(length); + for (vtkm::Id i = 0; i < length; ++i) + { + auto p = a1.GetPortalConstControl().Get(i); + c1.GetPortalControl().Set(i, p[0]); + c2.GetPortalControl().Set(i, p[1]); + c3.GetPortalControl().Set(i, p[2]); + } + TestVirtualAccess(vtkm::cont::make_ArrayHandleCartesianProduct(c1, c2, c3), out); + } + +public: + static int Run() { return vtkm::cont::testing::Testing::Run(TestAll); } +}; +} +} +} // vtkm::cont::testing + + +#endif // vtk_m_cont_testing_TestingArrayHandleVirtualCoordinates_h diff --git a/vtkm/cont/testing/TestingCellLocatorTwoLevelUniformGrid.h b/vtkm/cont/testing/TestingCellLocatorTwoLevelUniformGrid.h index dd3fea6c7..87616ef97 100644 --- a/vtkm/cont/testing/TestingCellLocatorTwoLevelUniformGrid.h +++ b/vtkm/cont/testing/TestingCellLocatorTwoLevelUniformGrid.h @@ -91,10 +91,7 @@ vtkm::cont::DataSet MakeTestDataSet(const vtkm::Vec& dims, // copy points vtkm::cont::ArrayHandle points; - Algorithm::Copy(uniformDs.GetCoordinateSystem() - .GetData() - .template Cast(), - points); + Algorithm::Copy(uniformDs.GetCoordinateSystem().GetData(), points); vtkm::Id numberOfCells = uniformDs.GetCellSet().GetNumberOfCells(); vtkm::Id numberOfIndices = numberOfCells * PointsPerCell; diff --git a/vtkm/cont/testing/UnitTestArrayHandleTransform.cxx b/vtkm/cont/testing/UnitTestArrayHandleTransform.cxx index 309f8289c..edccc0e8a 100644 --- a/vtkm/cont/testing/UnitTestArrayHandleTransform.cxx +++ b/vtkm/cont/testing/UnitTestArrayHandleTransform.cxx @@ -37,11 +37,10 @@ namespace const vtkm::Id ARRAY_SIZE = 10; -template struct MySquare { template - VTKM_EXEC ValueType operator()(U u) const + VTKM_EXEC auto operator()(U u) const -> decltype(vtkm::dot(u, u)) { return vtkm::dot(u, u); } @@ -59,7 +58,7 @@ struct CheckTransformFunctor : vtkm::exec::FunctorBase using T = typename TransformedPortalType::ValueType; typename OriginalPortalType::ValueType original = this->OriginalPortal.Get(index); T transformed = this->TransformedPortal.Get(index); - if (!test_equal(transformed, MySquare()(original))) + if (!test_equal(transformed, MySquare{}(original))) { this->RaiseError("Encountered bad transformed value."); } @@ -107,7 +106,7 @@ VTKM_CONT void CheckControlPortals(const OriginalArrayHandleType& originalArray, using T = typename TransformedPortalType::ValueType; typename OriginalPortalType::ValueType original = originalPortal.Get(index); T transformed = transformedPortal.Get(index); - VTKM_TEST_ASSERT(test_equal(transformed, MySquare()(original)), "Bad transform value."); + VTKM_TEST_ASSERT(test_equal(transformed, MySquare{}(original)), "Bad transform value."); } } @@ -115,20 +114,19 @@ template struct TransformTests { using OutputValueType = typename vtkm::VecTraits::ComponentType; - using FunctorType = MySquare; using TransformHandle = - vtkm::cont::ArrayHandleTransform, FunctorType>; + vtkm::cont::ArrayHandleTransform, MySquare>; using CountingTransformHandle = - vtkm::cont::ArrayHandleTransform, FunctorType>; + vtkm::cont::ArrayHandleTransform, MySquare>; using Device = VTKM_DEFAULT_DEVICE_ADAPTER_TAG; using Algorithm = vtkm::cont::DeviceAdapterAlgorithm; void operator()() const { - FunctorType functor; + MySquare functor; std::cout << "Test a transform handle with a counting handle as the values" << std::endl; vtkm::cont::ArrayHandleCounting counting = vtkm::cont::make_ArrayHandleCounting( diff --git a/vtkm/cont/testing/UnitTestCellLocator.cxx b/vtkm/cont/testing/UnitTestCellLocator.cxx new file mode 100644 index 000000000..4f47029c6 --- /dev/null +++ b/vtkm/cont/testing/UnitTestCellLocator.cxx @@ -0,0 +1,66 @@ +//============================================================================ +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +// Copyright 2017 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2017 UT-Battelle, LLC. +// Copyright 2017 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +//============================================================================ +#include +#include +#include + +namespace +{ + +void TestCellLocator() +{ + using PointType = vtkm::Vec; + VTKM_DEFAULT_DEVICE_ADAPTER_TAG device; + + const vtkm::Id SIZE = 4; + auto ds = + vtkm::cont::DataSetBuilderUniform::Create(vtkm::Id3(SIZE), PointType(0.0f), PointType(1.0f)); + + vtkm::cont::CellLocator locator; + locator.SetCellSet(ds.GetCellSet()); + locator.SetCoordinates(ds.GetCoordinateSystem()); + locator.Build(device); + + PointType points[] = { + { 0.25, 0.25, 0.25 }, { 1.25, 1.25, 1.25 }, { 2.25, 2.25, 2.25 }, { 3.25, 3.25, 3.25 } + }; + + vtkm::cont::ArrayHandle cellIds; + vtkm::cont::ArrayHandle parametricCoords; + locator.FindCells(vtkm::cont::make_ArrayHandle(points, 4), cellIds, parametricCoords, device); + + const vtkm::Id NCELLS_PER_AXIS = SIZE - 1; + const vtkm::Id DIA_STRIDE = (NCELLS_PER_AXIS * NCELLS_PER_AXIS) + NCELLS_PER_AXIS + 1; + for (int i = 0; i < 3; ++i) + { + VTKM_TEST_ASSERT(cellIds.GetPortalConstControl().Get(i) == (i * DIA_STRIDE), + "Incorrect cell-id value"); + VTKM_TEST_ASSERT(parametricCoords.GetPortalConstControl().Get(i) == PointType(0.25f), + "Incorrect parametric coordinate value"); + } + VTKM_TEST_ASSERT(cellIds.GetPortalConstControl().Get(3) == -1, "Incorrect cell-id value"); +} + +} // anonymous namespace + +int UnitTestCellLocator(int, char* []) +{ + return vtkm::cont::testing::Testing::Run(TestCellLocator); +} diff --git a/vtkm/cont/testing/UnitTestMultiBlock.cxx b/vtkm/cont/testing/UnitTestMultiBlock.cxx index b341b9449..460d9fd59 100644 --- a/vtkm/cont/testing/UnitTestMultiBlock.cxx +++ b/vtkm/cont/testing/UnitTestMultiBlock.cxx @@ -36,7 +36,12 @@ #include #if defined(VTKM_ENABLE_MPI) -#include + +// clang-format off +#include +#include VTKM_DIY(diy/master.hpp) +// clang-format on + #endif void DataSet_Compare(vtkm::cont::DataSet& LeftDateSet, vtkm::cont::DataSet& RightDateSet); diff --git a/vtkm/exec/ExecutionWholeArray.h b/vtkm/exec/ExecutionWholeArray.h index 099bb0470..7b22c802c 100644 --- a/vtkm/exec/ExecutionWholeArray.h +++ b/vtkm/exec/ExecutionWholeArray.h @@ -29,14 +29,16 @@ namespace vtkm namespace exec { +/// The following classes have been deprecated and are meant to be used +/// internally only. Please use the \c WholeArrayIn, \c WholeArrayOut, and +/// \c WholeArrayInOut \c ControlSignature tags instead. + /// \c ExecutionWholeArray is an execution object that allows an array handle /// content to be a parameter in an execution environment /// function. This can be used to allow worklets to have a shared search -/// structure +/// structure. /// -template +template class ExecutionWholeArray : public vtkm::exec::ExecutionObjectBase { public: @@ -86,9 +88,7 @@ private: /// function. This can be used to allow worklets to have a shared search /// structure /// -template +template class ExecutionWholeArrayConst : public vtkm::exec::ExecutionObjectBase { public: diff --git a/vtkm/exec/cuda/internal/testing/UnitTestTaskSingularCuda.cu b/vtkm/exec/cuda/internal/testing/UnitTestTaskSingularCuda.cu index 0ce3d8561..f0fd9de82 100644 --- a/vtkm/exec/cuda/internal/testing/UnitTestTaskSingularCuda.cu +++ b/vtkm/exec/cuda/internal/testing/UnitTestTaskSingularCuda.cu @@ -37,12 +37,6 @@ namespace struct TestExecObject { - VTKM_EXEC_CONT - TestExecObject() - : Portal() - { - } - VTKM_EXEC_CONT TestExecObject(vtkm::exec::cuda::internal::ArrayPortalFromThrust portal) : Portal(portal) @@ -62,6 +56,7 @@ struct MyOutputToInputMapPortal struct MyVisitArrayPortal { using ValueType = vtkm::IdComponent; + VTKM_EXEC_CONT vtkm::IdComponent Get(vtkm::Id) const { return 1; } }; diff --git a/vtkm/exec/internal/WorkletInvokeFunctorDetail.h b/vtkm/exec/internal/WorkletInvokeFunctorDetail.h index 01f74a06b..9bf280d53 100644 --- a/vtkm/exec/internal/WorkletInvokeFunctorDetail.h +++ b/vtkm/exec/internal/WorkletInvokeFunctorDetail.h @@ -38,7 +38,7 @@ #include -#if VTKM_MAX_FUNCTION_PARAMETERS != 10 +#if VTKM_MAX_FUNCTION_PARAMETERS != 20 #error Mismatch of maximum parameters between FunctionInterfaceDatailPre.h.in and WorkletInvokeFunctorDetail.h.in #endif @@ -2133,6 +2133,4256 @@ VTKM_EXEC void DoWorkletInvokeFunctor( p10); } +template +VTKM_EXEC void DoWorkletInvokeFunctor( + const WorkletType& worklet, + const vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>& invocation, + const ThreadIndicesType& threadIndices) +{ + using Invocation = vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>; + + using FetchInfo1 = InvocationToFetch; + using FetchType1 = typename FetchInfo1::type; + FetchType1 fetch1; + typename FetchType1::ValueType p1 = + fetch1.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo2 = InvocationToFetch; + using FetchType2 = typename FetchInfo2::type; + FetchType2 fetch2; + typename FetchType2::ValueType p2 = + fetch2.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo3 = InvocationToFetch; + using FetchType3 = typename FetchInfo3::type; + FetchType3 fetch3; + typename FetchType3::ValueType p3 = + fetch3.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo4 = InvocationToFetch; + using FetchType4 = typename FetchInfo4::type; + FetchType4 fetch4; + typename FetchType4::ValueType p4 = + fetch4.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo5 = InvocationToFetch; + using FetchType5 = typename FetchInfo5::type; + FetchType5 fetch5; + typename FetchType5::ValueType p5 = + fetch5.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo6 = InvocationToFetch; + using FetchType6 = typename FetchInfo6::type; + FetchType6 fetch6; + typename FetchType6::ValueType p6 = + fetch6.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo7 = InvocationToFetch; + using FetchType7 = typename FetchInfo7::type; + FetchType7 fetch7; + typename FetchType7::ValueType p7 = + fetch7.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo8 = InvocationToFetch; + using FetchType8 = typename FetchInfo8::type; + FetchType8 fetch8; + typename FetchType8::ValueType p8 = + fetch8.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo9 = InvocationToFetch; + using FetchType9 = typename FetchInfo9::type; + FetchType9 fetch9; + typename FetchType9::ValueType p9 = + fetch9.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo10 = InvocationToFetch; + using FetchType10 = typename FetchInfo10::type; + FetchType10 fetch10; + typename FetchType10::ValueType p10 = + fetch10.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo11 = InvocationToFetch; + using FetchType11 = typename FetchInfo11::type; + FetchType11 fetch11; + typename FetchType11::ValueType p11 = + fetch11.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo0 = InvocationToFetch; + using ReturnFetchType = typename FetchInfo0::type; + ReturnFetchType returnFetch; + // If you got a compile error on the following line, it probably means that + // the operator() of a worklet does not match the definition expected. One + // common problem is that the operator() method must be declared const. Check + // to make sure the "const" keyword is after parameters. Another common + // problem is that the type of one or more parameters is incompatible with + // the actual type that VTK-m creates in the execution environment. Make sure + // that the types of the worklet operator() parameters match those in the + // ExecutionSignature. The compiler error might help you narrow down which + // parameter is wrong and the types that did not match. + auto r = typename ReturnFetchType::ValueType(worklet(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11)); + + returnFetch.Store( + threadIndices, + invocation.Parameters.template GetParameter(), + r); + + fetch1.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p1); + fetch2.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p2); + fetch3.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p3); + fetch4.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p4); + fetch5.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p5); + fetch6.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p6); + fetch7.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p7); + fetch8.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p8); + fetch9.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p9); + fetch10.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p10); + fetch11.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p11); +} + +template +VTKM_EXEC void DoWorkletInvokeFunctor( + const WorkletType& worklet, + const vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>& invocation, + const ThreadIndicesType& threadIndices) +{ + typedef vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType> + Invocation; + + using FetchInfo1 = InvocationToFetch; + using FetchType1 = typename FetchInfo1::type; + FetchType1 fetch1; + typename FetchType1::ValueType p1 = + fetch1.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo2 = InvocationToFetch; + using FetchType2 = typename FetchInfo2::type; + FetchType2 fetch2; + typename FetchType2::ValueType p2 = + fetch2.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo3 = InvocationToFetch; + using FetchType3 = typename FetchInfo3::type; + FetchType3 fetch3; + typename FetchType3::ValueType p3 = + fetch3.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo4 = InvocationToFetch; + using FetchType4 = typename FetchInfo4::type; + FetchType4 fetch4; + typename FetchType4::ValueType p4 = + fetch4.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo5 = InvocationToFetch; + using FetchType5 = typename FetchInfo5::type; + FetchType5 fetch5; + typename FetchType5::ValueType p5 = + fetch5.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo6 = InvocationToFetch; + using FetchType6 = typename FetchInfo6::type; + FetchType6 fetch6; + typename FetchType6::ValueType p6 = + fetch6.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo7 = InvocationToFetch; + using FetchType7 = typename FetchInfo7::type; + FetchType7 fetch7; + typename FetchType7::ValueType p7 = + fetch7.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo8 = InvocationToFetch; + using FetchType8 = typename FetchInfo8::type; + FetchType8 fetch8; + typename FetchType8::ValueType p8 = + fetch8.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo9 = InvocationToFetch; + using FetchType9 = typename FetchInfo9::type; + FetchType9 fetch9; + typename FetchType9::ValueType p9 = + fetch9.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo10 = InvocationToFetch; + using FetchType10 = typename FetchInfo10::type; + FetchType10 fetch10; + typename FetchType10::ValueType p10 = + fetch10.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo11 = InvocationToFetch; + using FetchType11 = typename FetchInfo11::type; + FetchType11 fetch11; + typename FetchType11::ValueType p11 = + fetch11.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + // If you got a compile error on the following line, it probably means that + // the operator() of a worklet does not match the definition expected. One + // common problem is that the operator() method must be declared const. Check + // to make sure the "const" keyword is after parameters. Another common + // problem is that the type of one or more parameters is incompatible with + // the actual type that VTK-m creates in the execution environment. Make sure + // that the types of the worklet operator() parameters match those in the + // ExecutionSignature. The compiler error might help you narrow down which + // parameter is wrong and the types that did not match. + worklet(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); + + fetch1.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p1); + fetch2.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p2); + fetch3.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p3); + fetch4.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p4); + fetch5.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p5); + fetch6.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p6); + fetch7.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p7); + fetch8.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p8); + fetch9.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p9); + fetch10.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p10); + fetch11.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p11); +} + +template +VTKM_EXEC void DoWorkletInvokeFunctor( + const WorkletType& worklet, + const vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>& invocation, + const ThreadIndicesType& threadIndices) +{ + using Invocation = vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>; + + using FetchInfo1 = InvocationToFetch; + using FetchType1 = typename FetchInfo1::type; + FetchType1 fetch1; + typename FetchType1::ValueType p1 = + fetch1.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo2 = InvocationToFetch; + using FetchType2 = typename FetchInfo2::type; + FetchType2 fetch2; + typename FetchType2::ValueType p2 = + fetch2.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo3 = InvocationToFetch; + using FetchType3 = typename FetchInfo3::type; + FetchType3 fetch3; + typename FetchType3::ValueType p3 = + fetch3.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo4 = InvocationToFetch; + using FetchType4 = typename FetchInfo4::type; + FetchType4 fetch4; + typename FetchType4::ValueType p4 = + fetch4.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo5 = InvocationToFetch; + using FetchType5 = typename FetchInfo5::type; + FetchType5 fetch5; + typename FetchType5::ValueType p5 = + fetch5.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo6 = InvocationToFetch; + using FetchType6 = typename FetchInfo6::type; + FetchType6 fetch6; + typename FetchType6::ValueType p6 = + fetch6.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo7 = InvocationToFetch; + using FetchType7 = typename FetchInfo7::type; + FetchType7 fetch7; + typename FetchType7::ValueType p7 = + fetch7.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo8 = InvocationToFetch; + using FetchType8 = typename FetchInfo8::type; + FetchType8 fetch8; + typename FetchType8::ValueType p8 = + fetch8.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo9 = InvocationToFetch; + using FetchType9 = typename FetchInfo9::type; + FetchType9 fetch9; + typename FetchType9::ValueType p9 = + fetch9.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo10 = InvocationToFetch; + using FetchType10 = typename FetchInfo10::type; + FetchType10 fetch10; + typename FetchType10::ValueType p10 = + fetch10.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo11 = InvocationToFetch; + using FetchType11 = typename FetchInfo11::type; + FetchType11 fetch11; + typename FetchType11::ValueType p11 = + fetch11.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo12 = InvocationToFetch; + using FetchType12 = typename FetchInfo12::type; + FetchType12 fetch12; + typename FetchType12::ValueType p12 = + fetch12.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo0 = InvocationToFetch; + using ReturnFetchType = typename FetchInfo0::type; + ReturnFetchType returnFetch; + // If you got a compile error on the following line, it probably means that + // the operator() of a worklet does not match the definition expected. One + // common problem is that the operator() method must be declared const. Check + // to make sure the "const" keyword is after parameters. Another common + // problem is that the type of one or more parameters is incompatible with + // the actual type that VTK-m creates in the execution environment. Make sure + // that the types of the worklet operator() parameters match those in the + // ExecutionSignature. The compiler error might help you narrow down which + // parameter is wrong and the types that did not match. + auto r = typename ReturnFetchType::ValueType(worklet(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12)); + + returnFetch.Store( + threadIndices, + invocation.Parameters.template GetParameter(), + r); + + fetch1.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p1); + fetch2.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p2); + fetch3.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p3); + fetch4.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p4); + fetch5.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p5); + fetch6.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p6); + fetch7.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p7); + fetch8.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p8); + fetch9.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p9); + fetch10.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p10); + fetch11.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p11); + fetch12.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p12); +} + +template +VTKM_EXEC void DoWorkletInvokeFunctor( + const WorkletType& worklet, + const vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>& invocation, + const ThreadIndicesType& threadIndices) +{ + typedef vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType> + Invocation; + + using FetchInfo1 = InvocationToFetch; + using FetchType1 = typename FetchInfo1::type; + FetchType1 fetch1; + typename FetchType1::ValueType p1 = + fetch1.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo2 = InvocationToFetch; + using FetchType2 = typename FetchInfo2::type; + FetchType2 fetch2; + typename FetchType2::ValueType p2 = + fetch2.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo3 = InvocationToFetch; + using FetchType3 = typename FetchInfo3::type; + FetchType3 fetch3; + typename FetchType3::ValueType p3 = + fetch3.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo4 = InvocationToFetch; + using FetchType4 = typename FetchInfo4::type; + FetchType4 fetch4; + typename FetchType4::ValueType p4 = + fetch4.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo5 = InvocationToFetch; + using FetchType5 = typename FetchInfo5::type; + FetchType5 fetch5; + typename FetchType5::ValueType p5 = + fetch5.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo6 = InvocationToFetch; + using FetchType6 = typename FetchInfo6::type; + FetchType6 fetch6; + typename FetchType6::ValueType p6 = + fetch6.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo7 = InvocationToFetch; + using FetchType7 = typename FetchInfo7::type; + FetchType7 fetch7; + typename FetchType7::ValueType p7 = + fetch7.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo8 = InvocationToFetch; + using FetchType8 = typename FetchInfo8::type; + FetchType8 fetch8; + typename FetchType8::ValueType p8 = + fetch8.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo9 = InvocationToFetch; + using FetchType9 = typename FetchInfo9::type; + FetchType9 fetch9; + typename FetchType9::ValueType p9 = + fetch9.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo10 = InvocationToFetch; + using FetchType10 = typename FetchInfo10::type; + FetchType10 fetch10; + typename FetchType10::ValueType p10 = + fetch10.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo11 = InvocationToFetch; + using FetchType11 = typename FetchInfo11::type; + FetchType11 fetch11; + typename FetchType11::ValueType p11 = + fetch11.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo12 = InvocationToFetch; + using FetchType12 = typename FetchInfo12::type; + FetchType12 fetch12; + typename FetchType12::ValueType p12 = + fetch12.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + // If you got a compile error on the following line, it probably means that + // the operator() of a worklet does not match the definition expected. One + // common problem is that the operator() method must be declared const. Check + // to make sure the "const" keyword is after parameters. Another common + // problem is that the type of one or more parameters is incompatible with + // the actual type that VTK-m creates in the execution environment. Make sure + // that the types of the worklet operator() parameters match those in the + // ExecutionSignature. The compiler error might help you narrow down which + // parameter is wrong and the types that did not match. + worklet(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); + + fetch1.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p1); + fetch2.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p2); + fetch3.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p3); + fetch4.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p4); + fetch5.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p5); + fetch6.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p6); + fetch7.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p7); + fetch8.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p8); + fetch9.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p9); + fetch10.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p10); + fetch11.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p11); + fetch12.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p12); +} + +template +VTKM_EXEC void DoWorkletInvokeFunctor( + const WorkletType& worklet, + const vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>& invocation, + const ThreadIndicesType& threadIndices) +{ + using Invocation = vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>; + + using FetchInfo1 = InvocationToFetch; + using FetchType1 = typename FetchInfo1::type; + FetchType1 fetch1; + typename FetchType1::ValueType p1 = + fetch1.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo2 = InvocationToFetch; + using FetchType2 = typename FetchInfo2::type; + FetchType2 fetch2; + typename FetchType2::ValueType p2 = + fetch2.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo3 = InvocationToFetch; + using FetchType3 = typename FetchInfo3::type; + FetchType3 fetch3; + typename FetchType3::ValueType p3 = + fetch3.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo4 = InvocationToFetch; + using FetchType4 = typename FetchInfo4::type; + FetchType4 fetch4; + typename FetchType4::ValueType p4 = + fetch4.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo5 = InvocationToFetch; + using FetchType5 = typename FetchInfo5::type; + FetchType5 fetch5; + typename FetchType5::ValueType p5 = + fetch5.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo6 = InvocationToFetch; + using FetchType6 = typename FetchInfo6::type; + FetchType6 fetch6; + typename FetchType6::ValueType p6 = + fetch6.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo7 = InvocationToFetch; + using FetchType7 = typename FetchInfo7::type; + FetchType7 fetch7; + typename FetchType7::ValueType p7 = + fetch7.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo8 = InvocationToFetch; + using FetchType8 = typename FetchInfo8::type; + FetchType8 fetch8; + typename FetchType8::ValueType p8 = + fetch8.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo9 = InvocationToFetch; + using FetchType9 = typename FetchInfo9::type; + FetchType9 fetch9; + typename FetchType9::ValueType p9 = + fetch9.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo10 = InvocationToFetch; + using FetchType10 = typename FetchInfo10::type; + FetchType10 fetch10; + typename FetchType10::ValueType p10 = + fetch10.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo11 = InvocationToFetch; + using FetchType11 = typename FetchInfo11::type; + FetchType11 fetch11; + typename FetchType11::ValueType p11 = + fetch11.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo12 = InvocationToFetch; + using FetchType12 = typename FetchInfo12::type; + FetchType12 fetch12; + typename FetchType12::ValueType p12 = + fetch12.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo13 = InvocationToFetch; + using FetchType13 = typename FetchInfo13::type; + FetchType13 fetch13; + typename FetchType13::ValueType p13 = + fetch13.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo0 = InvocationToFetch; + using ReturnFetchType = typename FetchInfo0::type; + ReturnFetchType returnFetch; + // If you got a compile error on the following line, it probably means that + // the operator() of a worklet does not match the definition expected. One + // common problem is that the operator() method must be declared const. Check + // to make sure the "const" keyword is after parameters. Another common + // problem is that the type of one or more parameters is incompatible with + // the actual type that VTK-m creates in the execution environment. Make sure + // that the types of the worklet operator() parameters match those in the + // ExecutionSignature. The compiler error might help you narrow down which + // parameter is wrong and the types that did not match. + auto r = typename ReturnFetchType::ValueType(worklet(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13)); + + returnFetch.Store( + threadIndices, + invocation.Parameters.template GetParameter(), + r); + + fetch1.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p1); + fetch2.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p2); + fetch3.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p3); + fetch4.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p4); + fetch5.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p5); + fetch6.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p6); + fetch7.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p7); + fetch8.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p8); + fetch9.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p9); + fetch10.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p10); + fetch11.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p11); + fetch12.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p12); + fetch13.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p13); +} + +template +VTKM_EXEC void DoWorkletInvokeFunctor( + const WorkletType& worklet, + const vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>& invocation, + const ThreadIndicesType& threadIndices) +{ + typedef vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType> + Invocation; + + using FetchInfo1 = InvocationToFetch; + using FetchType1 = typename FetchInfo1::type; + FetchType1 fetch1; + typename FetchType1::ValueType p1 = + fetch1.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo2 = InvocationToFetch; + using FetchType2 = typename FetchInfo2::type; + FetchType2 fetch2; + typename FetchType2::ValueType p2 = + fetch2.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo3 = InvocationToFetch; + using FetchType3 = typename FetchInfo3::type; + FetchType3 fetch3; + typename FetchType3::ValueType p3 = + fetch3.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo4 = InvocationToFetch; + using FetchType4 = typename FetchInfo4::type; + FetchType4 fetch4; + typename FetchType4::ValueType p4 = + fetch4.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo5 = InvocationToFetch; + using FetchType5 = typename FetchInfo5::type; + FetchType5 fetch5; + typename FetchType5::ValueType p5 = + fetch5.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo6 = InvocationToFetch; + using FetchType6 = typename FetchInfo6::type; + FetchType6 fetch6; + typename FetchType6::ValueType p6 = + fetch6.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo7 = InvocationToFetch; + using FetchType7 = typename FetchInfo7::type; + FetchType7 fetch7; + typename FetchType7::ValueType p7 = + fetch7.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo8 = InvocationToFetch; + using FetchType8 = typename FetchInfo8::type; + FetchType8 fetch8; + typename FetchType8::ValueType p8 = + fetch8.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo9 = InvocationToFetch; + using FetchType9 = typename FetchInfo9::type; + FetchType9 fetch9; + typename FetchType9::ValueType p9 = + fetch9.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo10 = InvocationToFetch; + using FetchType10 = typename FetchInfo10::type; + FetchType10 fetch10; + typename FetchType10::ValueType p10 = + fetch10.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo11 = InvocationToFetch; + using FetchType11 = typename FetchInfo11::type; + FetchType11 fetch11; + typename FetchType11::ValueType p11 = + fetch11.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo12 = InvocationToFetch; + using FetchType12 = typename FetchInfo12::type; + FetchType12 fetch12; + typename FetchType12::ValueType p12 = + fetch12.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo13 = InvocationToFetch; + using FetchType13 = typename FetchInfo13::type; + FetchType13 fetch13; + typename FetchType13::ValueType p13 = + fetch13.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + // If you got a compile error on the following line, it probably means that + // the operator() of a worklet does not match the definition expected. One + // common problem is that the operator() method must be declared const. Check + // to make sure the "const" keyword is after parameters. Another common + // problem is that the type of one or more parameters is incompatible with + // the actual type that VTK-m creates in the execution environment. Make sure + // that the types of the worklet operator() parameters match those in the + // ExecutionSignature. The compiler error might help you narrow down which + // parameter is wrong and the types that did not match. + worklet(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); + + fetch1.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p1); + fetch2.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p2); + fetch3.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p3); + fetch4.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p4); + fetch5.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p5); + fetch6.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p6); + fetch7.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p7); + fetch8.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p8); + fetch9.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p9); + fetch10.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p10); + fetch11.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p11); + fetch12.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p12); + fetch13.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p13); +} + +template +VTKM_EXEC void DoWorkletInvokeFunctor( + const WorkletType& worklet, + const vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>& invocation, + const ThreadIndicesType& threadIndices) +{ + using Invocation = vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>; + + using FetchInfo1 = InvocationToFetch; + using FetchType1 = typename FetchInfo1::type; + FetchType1 fetch1; + typename FetchType1::ValueType p1 = + fetch1.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo2 = InvocationToFetch; + using FetchType2 = typename FetchInfo2::type; + FetchType2 fetch2; + typename FetchType2::ValueType p2 = + fetch2.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo3 = InvocationToFetch; + using FetchType3 = typename FetchInfo3::type; + FetchType3 fetch3; + typename FetchType3::ValueType p3 = + fetch3.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo4 = InvocationToFetch; + using FetchType4 = typename FetchInfo4::type; + FetchType4 fetch4; + typename FetchType4::ValueType p4 = + fetch4.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo5 = InvocationToFetch; + using FetchType5 = typename FetchInfo5::type; + FetchType5 fetch5; + typename FetchType5::ValueType p5 = + fetch5.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo6 = InvocationToFetch; + using FetchType6 = typename FetchInfo6::type; + FetchType6 fetch6; + typename FetchType6::ValueType p6 = + fetch6.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo7 = InvocationToFetch; + using FetchType7 = typename FetchInfo7::type; + FetchType7 fetch7; + typename FetchType7::ValueType p7 = + fetch7.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo8 = InvocationToFetch; + using FetchType8 = typename FetchInfo8::type; + FetchType8 fetch8; + typename FetchType8::ValueType p8 = + fetch8.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo9 = InvocationToFetch; + using FetchType9 = typename FetchInfo9::type; + FetchType9 fetch9; + typename FetchType9::ValueType p9 = + fetch9.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo10 = InvocationToFetch; + using FetchType10 = typename FetchInfo10::type; + FetchType10 fetch10; + typename FetchType10::ValueType p10 = + fetch10.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo11 = InvocationToFetch; + using FetchType11 = typename FetchInfo11::type; + FetchType11 fetch11; + typename FetchType11::ValueType p11 = + fetch11.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo12 = InvocationToFetch; + using FetchType12 = typename FetchInfo12::type; + FetchType12 fetch12; + typename FetchType12::ValueType p12 = + fetch12.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo13 = InvocationToFetch; + using FetchType13 = typename FetchInfo13::type; + FetchType13 fetch13; + typename FetchType13::ValueType p13 = + fetch13.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo14 = InvocationToFetch; + using FetchType14 = typename FetchInfo14::type; + FetchType14 fetch14; + typename FetchType14::ValueType p14 = + fetch14.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo0 = InvocationToFetch; + using ReturnFetchType = typename FetchInfo0::type; + ReturnFetchType returnFetch; + // If you got a compile error on the following line, it probably means that + // the operator() of a worklet does not match the definition expected. One + // common problem is that the operator() method must be declared const. Check + // to make sure the "const" keyword is after parameters. Another common + // problem is that the type of one or more parameters is incompatible with + // the actual type that VTK-m creates in the execution environment. Make sure + // that the types of the worklet operator() parameters match those in the + // ExecutionSignature. The compiler error might help you narrow down which + // parameter is wrong and the types that did not match. + auto r = typename ReturnFetchType::ValueType(worklet(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14)); + + returnFetch.Store( + threadIndices, + invocation.Parameters.template GetParameter(), + r); + + fetch1.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p1); + fetch2.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p2); + fetch3.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p3); + fetch4.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p4); + fetch5.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p5); + fetch6.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p6); + fetch7.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p7); + fetch8.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p8); + fetch9.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p9); + fetch10.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p10); + fetch11.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p11); + fetch12.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p12); + fetch13.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p13); + fetch14.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p14); +} + +template +VTKM_EXEC void DoWorkletInvokeFunctor( + const WorkletType& worklet, + const vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>& invocation, + const ThreadIndicesType& threadIndices) +{ + typedef vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType> + Invocation; + + using FetchInfo1 = InvocationToFetch; + using FetchType1 = typename FetchInfo1::type; + FetchType1 fetch1; + typename FetchType1::ValueType p1 = + fetch1.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo2 = InvocationToFetch; + using FetchType2 = typename FetchInfo2::type; + FetchType2 fetch2; + typename FetchType2::ValueType p2 = + fetch2.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo3 = InvocationToFetch; + using FetchType3 = typename FetchInfo3::type; + FetchType3 fetch3; + typename FetchType3::ValueType p3 = + fetch3.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo4 = InvocationToFetch; + using FetchType4 = typename FetchInfo4::type; + FetchType4 fetch4; + typename FetchType4::ValueType p4 = + fetch4.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo5 = InvocationToFetch; + using FetchType5 = typename FetchInfo5::type; + FetchType5 fetch5; + typename FetchType5::ValueType p5 = + fetch5.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo6 = InvocationToFetch; + using FetchType6 = typename FetchInfo6::type; + FetchType6 fetch6; + typename FetchType6::ValueType p6 = + fetch6.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo7 = InvocationToFetch; + using FetchType7 = typename FetchInfo7::type; + FetchType7 fetch7; + typename FetchType7::ValueType p7 = + fetch7.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo8 = InvocationToFetch; + using FetchType8 = typename FetchInfo8::type; + FetchType8 fetch8; + typename FetchType8::ValueType p8 = + fetch8.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo9 = InvocationToFetch; + using FetchType9 = typename FetchInfo9::type; + FetchType9 fetch9; + typename FetchType9::ValueType p9 = + fetch9.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo10 = InvocationToFetch; + using FetchType10 = typename FetchInfo10::type; + FetchType10 fetch10; + typename FetchType10::ValueType p10 = + fetch10.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo11 = InvocationToFetch; + using FetchType11 = typename FetchInfo11::type; + FetchType11 fetch11; + typename FetchType11::ValueType p11 = + fetch11.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo12 = InvocationToFetch; + using FetchType12 = typename FetchInfo12::type; + FetchType12 fetch12; + typename FetchType12::ValueType p12 = + fetch12.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo13 = InvocationToFetch; + using FetchType13 = typename FetchInfo13::type; + FetchType13 fetch13; + typename FetchType13::ValueType p13 = + fetch13.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo14 = InvocationToFetch; + using FetchType14 = typename FetchInfo14::type; + FetchType14 fetch14; + typename FetchType14::ValueType p14 = + fetch14.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + // If you got a compile error on the following line, it probably means that + // the operator() of a worklet does not match the definition expected. One + // common problem is that the operator() method must be declared const. Check + // to make sure the "const" keyword is after parameters. Another common + // problem is that the type of one or more parameters is incompatible with + // the actual type that VTK-m creates in the execution environment. Make sure + // that the types of the worklet operator() parameters match those in the + // ExecutionSignature. The compiler error might help you narrow down which + // parameter is wrong and the types that did not match. + worklet(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14); + + fetch1.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p1); + fetch2.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p2); + fetch3.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p3); + fetch4.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p4); + fetch5.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p5); + fetch6.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p6); + fetch7.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p7); + fetch8.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p8); + fetch9.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p9); + fetch10.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p10); + fetch11.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p11); + fetch12.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p12); + fetch13.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p13); + fetch14.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p14); +} + +template +VTKM_EXEC void DoWorkletInvokeFunctor( + const WorkletType& worklet, + const vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>& invocation, + const ThreadIndicesType& threadIndices) +{ + using Invocation = vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>; + + using FetchInfo1 = InvocationToFetch; + using FetchType1 = typename FetchInfo1::type; + FetchType1 fetch1; + typename FetchType1::ValueType p1 = + fetch1.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo2 = InvocationToFetch; + using FetchType2 = typename FetchInfo2::type; + FetchType2 fetch2; + typename FetchType2::ValueType p2 = + fetch2.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo3 = InvocationToFetch; + using FetchType3 = typename FetchInfo3::type; + FetchType3 fetch3; + typename FetchType3::ValueType p3 = + fetch3.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo4 = InvocationToFetch; + using FetchType4 = typename FetchInfo4::type; + FetchType4 fetch4; + typename FetchType4::ValueType p4 = + fetch4.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo5 = InvocationToFetch; + using FetchType5 = typename FetchInfo5::type; + FetchType5 fetch5; + typename FetchType5::ValueType p5 = + fetch5.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo6 = InvocationToFetch; + using FetchType6 = typename FetchInfo6::type; + FetchType6 fetch6; + typename FetchType6::ValueType p6 = + fetch6.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo7 = InvocationToFetch; + using FetchType7 = typename FetchInfo7::type; + FetchType7 fetch7; + typename FetchType7::ValueType p7 = + fetch7.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo8 = InvocationToFetch; + using FetchType8 = typename FetchInfo8::type; + FetchType8 fetch8; + typename FetchType8::ValueType p8 = + fetch8.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo9 = InvocationToFetch; + using FetchType9 = typename FetchInfo9::type; + FetchType9 fetch9; + typename FetchType9::ValueType p9 = + fetch9.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo10 = InvocationToFetch; + using FetchType10 = typename FetchInfo10::type; + FetchType10 fetch10; + typename FetchType10::ValueType p10 = + fetch10.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo11 = InvocationToFetch; + using FetchType11 = typename FetchInfo11::type; + FetchType11 fetch11; + typename FetchType11::ValueType p11 = + fetch11.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo12 = InvocationToFetch; + using FetchType12 = typename FetchInfo12::type; + FetchType12 fetch12; + typename FetchType12::ValueType p12 = + fetch12.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo13 = InvocationToFetch; + using FetchType13 = typename FetchInfo13::type; + FetchType13 fetch13; + typename FetchType13::ValueType p13 = + fetch13.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo14 = InvocationToFetch; + using FetchType14 = typename FetchInfo14::type; + FetchType14 fetch14; + typename FetchType14::ValueType p14 = + fetch14.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo15 = InvocationToFetch; + using FetchType15 = typename FetchInfo15::type; + FetchType15 fetch15; + typename FetchType15::ValueType p15 = + fetch15.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo0 = InvocationToFetch; + using ReturnFetchType = typename FetchInfo0::type; + ReturnFetchType returnFetch; + // If you got a compile error on the following line, it probably means that + // the operator() of a worklet does not match the definition expected. One + // common problem is that the operator() method must be declared const. Check + // to make sure the "const" keyword is after parameters. Another common + // problem is that the type of one or more parameters is incompatible with + // the actual type that VTK-m creates in the execution environment. Make sure + // that the types of the worklet operator() parameters match those in the + // ExecutionSignature. The compiler error might help you narrow down which + // parameter is wrong and the types that did not match. + auto r = typename ReturnFetchType::ValueType(worklet(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15)); + + returnFetch.Store( + threadIndices, + invocation.Parameters.template GetParameter(), + r); + + fetch1.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p1); + fetch2.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p2); + fetch3.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p3); + fetch4.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p4); + fetch5.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p5); + fetch6.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p6); + fetch7.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p7); + fetch8.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p8); + fetch9.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p9); + fetch10.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p10); + fetch11.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p11); + fetch12.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p12); + fetch13.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p13); + fetch14.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p14); + fetch15.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p15); +} + +template +VTKM_EXEC void DoWorkletInvokeFunctor( + const WorkletType& worklet, + const vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>& invocation, + const ThreadIndicesType& threadIndices) +{ + typedef vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType> + Invocation; + + using FetchInfo1 = InvocationToFetch; + using FetchType1 = typename FetchInfo1::type; + FetchType1 fetch1; + typename FetchType1::ValueType p1 = + fetch1.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo2 = InvocationToFetch; + using FetchType2 = typename FetchInfo2::type; + FetchType2 fetch2; + typename FetchType2::ValueType p2 = + fetch2.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo3 = InvocationToFetch; + using FetchType3 = typename FetchInfo3::type; + FetchType3 fetch3; + typename FetchType3::ValueType p3 = + fetch3.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo4 = InvocationToFetch; + using FetchType4 = typename FetchInfo4::type; + FetchType4 fetch4; + typename FetchType4::ValueType p4 = + fetch4.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo5 = InvocationToFetch; + using FetchType5 = typename FetchInfo5::type; + FetchType5 fetch5; + typename FetchType5::ValueType p5 = + fetch5.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo6 = InvocationToFetch; + using FetchType6 = typename FetchInfo6::type; + FetchType6 fetch6; + typename FetchType6::ValueType p6 = + fetch6.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo7 = InvocationToFetch; + using FetchType7 = typename FetchInfo7::type; + FetchType7 fetch7; + typename FetchType7::ValueType p7 = + fetch7.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo8 = InvocationToFetch; + using FetchType8 = typename FetchInfo8::type; + FetchType8 fetch8; + typename FetchType8::ValueType p8 = + fetch8.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo9 = InvocationToFetch; + using FetchType9 = typename FetchInfo9::type; + FetchType9 fetch9; + typename FetchType9::ValueType p9 = + fetch9.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo10 = InvocationToFetch; + using FetchType10 = typename FetchInfo10::type; + FetchType10 fetch10; + typename FetchType10::ValueType p10 = + fetch10.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo11 = InvocationToFetch; + using FetchType11 = typename FetchInfo11::type; + FetchType11 fetch11; + typename FetchType11::ValueType p11 = + fetch11.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo12 = InvocationToFetch; + using FetchType12 = typename FetchInfo12::type; + FetchType12 fetch12; + typename FetchType12::ValueType p12 = + fetch12.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo13 = InvocationToFetch; + using FetchType13 = typename FetchInfo13::type; + FetchType13 fetch13; + typename FetchType13::ValueType p13 = + fetch13.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo14 = InvocationToFetch; + using FetchType14 = typename FetchInfo14::type; + FetchType14 fetch14; + typename FetchType14::ValueType p14 = + fetch14.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo15 = InvocationToFetch; + using FetchType15 = typename FetchInfo15::type; + FetchType15 fetch15; + typename FetchType15::ValueType p15 = + fetch15.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + // If you got a compile error on the following line, it probably means that + // the operator() of a worklet does not match the definition expected. One + // common problem is that the operator() method must be declared const. Check + // to make sure the "const" keyword is after parameters. Another common + // problem is that the type of one or more parameters is incompatible with + // the actual type that VTK-m creates in the execution environment. Make sure + // that the types of the worklet operator() parameters match those in the + // ExecutionSignature. The compiler error might help you narrow down which + // parameter is wrong and the types that did not match. + worklet(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15); + + fetch1.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p1); + fetch2.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p2); + fetch3.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p3); + fetch4.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p4); + fetch5.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p5); + fetch6.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p6); + fetch7.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p7); + fetch8.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p8); + fetch9.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p9); + fetch10.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p10); + fetch11.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p11); + fetch12.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p12); + fetch13.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p13); + fetch14.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p14); + fetch15.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p15); +} + +template +VTKM_EXEC void DoWorkletInvokeFunctor( + const WorkletType& worklet, + const vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>& invocation, + const ThreadIndicesType& threadIndices) +{ + using Invocation = vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>; + + using FetchInfo1 = InvocationToFetch; + using FetchType1 = typename FetchInfo1::type; + FetchType1 fetch1; + typename FetchType1::ValueType p1 = + fetch1.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo2 = InvocationToFetch; + using FetchType2 = typename FetchInfo2::type; + FetchType2 fetch2; + typename FetchType2::ValueType p2 = + fetch2.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo3 = InvocationToFetch; + using FetchType3 = typename FetchInfo3::type; + FetchType3 fetch3; + typename FetchType3::ValueType p3 = + fetch3.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo4 = InvocationToFetch; + using FetchType4 = typename FetchInfo4::type; + FetchType4 fetch4; + typename FetchType4::ValueType p4 = + fetch4.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo5 = InvocationToFetch; + using FetchType5 = typename FetchInfo5::type; + FetchType5 fetch5; + typename FetchType5::ValueType p5 = + fetch5.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo6 = InvocationToFetch; + using FetchType6 = typename FetchInfo6::type; + FetchType6 fetch6; + typename FetchType6::ValueType p6 = + fetch6.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo7 = InvocationToFetch; + using FetchType7 = typename FetchInfo7::type; + FetchType7 fetch7; + typename FetchType7::ValueType p7 = + fetch7.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo8 = InvocationToFetch; + using FetchType8 = typename FetchInfo8::type; + FetchType8 fetch8; + typename FetchType8::ValueType p8 = + fetch8.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo9 = InvocationToFetch; + using FetchType9 = typename FetchInfo9::type; + FetchType9 fetch9; + typename FetchType9::ValueType p9 = + fetch9.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo10 = InvocationToFetch; + using FetchType10 = typename FetchInfo10::type; + FetchType10 fetch10; + typename FetchType10::ValueType p10 = + fetch10.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo11 = InvocationToFetch; + using FetchType11 = typename FetchInfo11::type; + FetchType11 fetch11; + typename FetchType11::ValueType p11 = + fetch11.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo12 = InvocationToFetch; + using FetchType12 = typename FetchInfo12::type; + FetchType12 fetch12; + typename FetchType12::ValueType p12 = + fetch12.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo13 = InvocationToFetch; + using FetchType13 = typename FetchInfo13::type; + FetchType13 fetch13; + typename FetchType13::ValueType p13 = + fetch13.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo14 = InvocationToFetch; + using FetchType14 = typename FetchInfo14::type; + FetchType14 fetch14; + typename FetchType14::ValueType p14 = + fetch14.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo15 = InvocationToFetch; + using FetchType15 = typename FetchInfo15::type; + FetchType15 fetch15; + typename FetchType15::ValueType p15 = + fetch15.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo16 = InvocationToFetch; + using FetchType16 = typename FetchInfo16::type; + FetchType16 fetch16; + typename FetchType16::ValueType p16 = + fetch16.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo0 = InvocationToFetch; + using ReturnFetchType = typename FetchInfo0::type; + ReturnFetchType returnFetch; + // If you got a compile error on the following line, it probably means that + // the operator() of a worklet does not match the definition expected. One + // common problem is that the operator() method must be declared const. Check + // to make sure the "const" keyword is after parameters. Another common + // problem is that the type of one or more parameters is incompatible with + // the actual type that VTK-m creates in the execution environment. Make sure + // that the types of the worklet operator() parameters match those in the + // ExecutionSignature. The compiler error might help you narrow down which + // parameter is wrong and the types that did not match. + auto r = typename ReturnFetchType::ValueType(worklet(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16)); + + returnFetch.Store( + threadIndices, + invocation.Parameters.template GetParameter(), + r); + + fetch1.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p1); + fetch2.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p2); + fetch3.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p3); + fetch4.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p4); + fetch5.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p5); + fetch6.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p6); + fetch7.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p7); + fetch8.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p8); + fetch9.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p9); + fetch10.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p10); + fetch11.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p11); + fetch12.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p12); + fetch13.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p13); + fetch14.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p14); + fetch15.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p15); + fetch16.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p16); +} + +template +VTKM_EXEC void DoWorkletInvokeFunctor( + const WorkletType& worklet, + const vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>& invocation, + const ThreadIndicesType& threadIndices) +{ + typedef vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType> + Invocation; + + using FetchInfo1 = InvocationToFetch; + using FetchType1 = typename FetchInfo1::type; + FetchType1 fetch1; + typename FetchType1::ValueType p1 = + fetch1.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo2 = InvocationToFetch; + using FetchType2 = typename FetchInfo2::type; + FetchType2 fetch2; + typename FetchType2::ValueType p2 = + fetch2.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo3 = InvocationToFetch; + using FetchType3 = typename FetchInfo3::type; + FetchType3 fetch3; + typename FetchType3::ValueType p3 = + fetch3.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo4 = InvocationToFetch; + using FetchType4 = typename FetchInfo4::type; + FetchType4 fetch4; + typename FetchType4::ValueType p4 = + fetch4.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo5 = InvocationToFetch; + using FetchType5 = typename FetchInfo5::type; + FetchType5 fetch5; + typename FetchType5::ValueType p5 = + fetch5.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo6 = InvocationToFetch; + using FetchType6 = typename FetchInfo6::type; + FetchType6 fetch6; + typename FetchType6::ValueType p6 = + fetch6.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo7 = InvocationToFetch; + using FetchType7 = typename FetchInfo7::type; + FetchType7 fetch7; + typename FetchType7::ValueType p7 = + fetch7.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo8 = InvocationToFetch; + using FetchType8 = typename FetchInfo8::type; + FetchType8 fetch8; + typename FetchType8::ValueType p8 = + fetch8.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo9 = InvocationToFetch; + using FetchType9 = typename FetchInfo9::type; + FetchType9 fetch9; + typename FetchType9::ValueType p9 = + fetch9.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo10 = InvocationToFetch; + using FetchType10 = typename FetchInfo10::type; + FetchType10 fetch10; + typename FetchType10::ValueType p10 = + fetch10.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo11 = InvocationToFetch; + using FetchType11 = typename FetchInfo11::type; + FetchType11 fetch11; + typename FetchType11::ValueType p11 = + fetch11.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo12 = InvocationToFetch; + using FetchType12 = typename FetchInfo12::type; + FetchType12 fetch12; + typename FetchType12::ValueType p12 = + fetch12.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo13 = InvocationToFetch; + using FetchType13 = typename FetchInfo13::type; + FetchType13 fetch13; + typename FetchType13::ValueType p13 = + fetch13.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo14 = InvocationToFetch; + using FetchType14 = typename FetchInfo14::type; + FetchType14 fetch14; + typename FetchType14::ValueType p14 = + fetch14.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo15 = InvocationToFetch; + using FetchType15 = typename FetchInfo15::type; + FetchType15 fetch15; + typename FetchType15::ValueType p15 = + fetch15.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo16 = InvocationToFetch; + using FetchType16 = typename FetchInfo16::type; + FetchType16 fetch16; + typename FetchType16::ValueType p16 = + fetch16.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + // If you got a compile error on the following line, it probably means that + // the operator() of a worklet does not match the definition expected. One + // common problem is that the operator() method must be declared const. Check + // to make sure the "const" keyword is after parameters. Another common + // problem is that the type of one or more parameters is incompatible with + // the actual type that VTK-m creates in the execution environment. Make sure + // that the types of the worklet operator() parameters match those in the + // ExecutionSignature. The compiler error might help you narrow down which + // parameter is wrong and the types that did not match. + worklet(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16); + + fetch1.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p1); + fetch2.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p2); + fetch3.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p3); + fetch4.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p4); + fetch5.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p5); + fetch6.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p6); + fetch7.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p7); + fetch8.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p8); + fetch9.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p9); + fetch10.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p10); + fetch11.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p11); + fetch12.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p12); + fetch13.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p13); + fetch14.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p14); + fetch15.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p15); + fetch16.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p16); +} + +template +VTKM_EXEC void DoWorkletInvokeFunctor( + const WorkletType& worklet, + const vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>& invocation, + const ThreadIndicesType& threadIndices) +{ + using Invocation = vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>; + + using FetchInfo1 = InvocationToFetch; + using FetchType1 = typename FetchInfo1::type; + FetchType1 fetch1; + typename FetchType1::ValueType p1 = + fetch1.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo2 = InvocationToFetch; + using FetchType2 = typename FetchInfo2::type; + FetchType2 fetch2; + typename FetchType2::ValueType p2 = + fetch2.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo3 = InvocationToFetch; + using FetchType3 = typename FetchInfo3::type; + FetchType3 fetch3; + typename FetchType3::ValueType p3 = + fetch3.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo4 = InvocationToFetch; + using FetchType4 = typename FetchInfo4::type; + FetchType4 fetch4; + typename FetchType4::ValueType p4 = + fetch4.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo5 = InvocationToFetch; + using FetchType5 = typename FetchInfo5::type; + FetchType5 fetch5; + typename FetchType5::ValueType p5 = + fetch5.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo6 = InvocationToFetch; + using FetchType6 = typename FetchInfo6::type; + FetchType6 fetch6; + typename FetchType6::ValueType p6 = + fetch6.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo7 = InvocationToFetch; + using FetchType7 = typename FetchInfo7::type; + FetchType7 fetch7; + typename FetchType7::ValueType p7 = + fetch7.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo8 = InvocationToFetch; + using FetchType8 = typename FetchInfo8::type; + FetchType8 fetch8; + typename FetchType8::ValueType p8 = + fetch8.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo9 = InvocationToFetch; + using FetchType9 = typename FetchInfo9::type; + FetchType9 fetch9; + typename FetchType9::ValueType p9 = + fetch9.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo10 = InvocationToFetch; + using FetchType10 = typename FetchInfo10::type; + FetchType10 fetch10; + typename FetchType10::ValueType p10 = + fetch10.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo11 = InvocationToFetch; + using FetchType11 = typename FetchInfo11::type; + FetchType11 fetch11; + typename FetchType11::ValueType p11 = + fetch11.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo12 = InvocationToFetch; + using FetchType12 = typename FetchInfo12::type; + FetchType12 fetch12; + typename FetchType12::ValueType p12 = + fetch12.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo13 = InvocationToFetch; + using FetchType13 = typename FetchInfo13::type; + FetchType13 fetch13; + typename FetchType13::ValueType p13 = + fetch13.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo14 = InvocationToFetch; + using FetchType14 = typename FetchInfo14::type; + FetchType14 fetch14; + typename FetchType14::ValueType p14 = + fetch14.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo15 = InvocationToFetch; + using FetchType15 = typename FetchInfo15::type; + FetchType15 fetch15; + typename FetchType15::ValueType p15 = + fetch15.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo16 = InvocationToFetch; + using FetchType16 = typename FetchInfo16::type; + FetchType16 fetch16; + typename FetchType16::ValueType p16 = + fetch16.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo17 = InvocationToFetch; + using FetchType17 = typename FetchInfo17::type; + FetchType17 fetch17; + typename FetchType17::ValueType p17 = + fetch17.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo0 = InvocationToFetch; + using ReturnFetchType = typename FetchInfo0::type; + ReturnFetchType returnFetch; + // If you got a compile error on the following line, it probably means that + // the operator() of a worklet does not match the definition expected. One + // common problem is that the operator() method must be declared const. Check + // to make sure the "const" keyword is after parameters. Another common + // problem is that the type of one or more parameters is incompatible with + // the actual type that VTK-m creates in the execution environment. Make sure + // that the types of the worklet operator() parameters match those in the + // ExecutionSignature. The compiler error might help you narrow down which + // parameter is wrong and the types that did not match. + auto r = typename ReturnFetchType::ValueType(worklet(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17)); + + returnFetch.Store( + threadIndices, + invocation.Parameters.template GetParameter(), + r); + + fetch1.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p1); + fetch2.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p2); + fetch3.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p3); + fetch4.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p4); + fetch5.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p5); + fetch6.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p6); + fetch7.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p7); + fetch8.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p8); + fetch9.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p9); + fetch10.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p10); + fetch11.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p11); + fetch12.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p12); + fetch13.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p13); + fetch14.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p14); + fetch15.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p15); + fetch16.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p16); + fetch17.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p17); +} + +template +VTKM_EXEC void DoWorkletInvokeFunctor( + const WorkletType& worklet, + const vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>& invocation, + const ThreadIndicesType& threadIndices) +{ + typedef vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType> + Invocation; + + using FetchInfo1 = InvocationToFetch; + using FetchType1 = typename FetchInfo1::type; + FetchType1 fetch1; + typename FetchType1::ValueType p1 = + fetch1.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo2 = InvocationToFetch; + using FetchType2 = typename FetchInfo2::type; + FetchType2 fetch2; + typename FetchType2::ValueType p2 = + fetch2.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo3 = InvocationToFetch; + using FetchType3 = typename FetchInfo3::type; + FetchType3 fetch3; + typename FetchType3::ValueType p3 = + fetch3.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo4 = InvocationToFetch; + using FetchType4 = typename FetchInfo4::type; + FetchType4 fetch4; + typename FetchType4::ValueType p4 = + fetch4.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo5 = InvocationToFetch; + using FetchType5 = typename FetchInfo5::type; + FetchType5 fetch5; + typename FetchType5::ValueType p5 = + fetch5.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo6 = InvocationToFetch; + using FetchType6 = typename FetchInfo6::type; + FetchType6 fetch6; + typename FetchType6::ValueType p6 = + fetch6.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo7 = InvocationToFetch; + using FetchType7 = typename FetchInfo7::type; + FetchType7 fetch7; + typename FetchType7::ValueType p7 = + fetch7.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo8 = InvocationToFetch; + using FetchType8 = typename FetchInfo8::type; + FetchType8 fetch8; + typename FetchType8::ValueType p8 = + fetch8.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo9 = InvocationToFetch; + using FetchType9 = typename FetchInfo9::type; + FetchType9 fetch9; + typename FetchType9::ValueType p9 = + fetch9.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo10 = InvocationToFetch; + using FetchType10 = typename FetchInfo10::type; + FetchType10 fetch10; + typename FetchType10::ValueType p10 = + fetch10.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo11 = InvocationToFetch; + using FetchType11 = typename FetchInfo11::type; + FetchType11 fetch11; + typename FetchType11::ValueType p11 = + fetch11.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo12 = InvocationToFetch; + using FetchType12 = typename FetchInfo12::type; + FetchType12 fetch12; + typename FetchType12::ValueType p12 = + fetch12.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo13 = InvocationToFetch; + using FetchType13 = typename FetchInfo13::type; + FetchType13 fetch13; + typename FetchType13::ValueType p13 = + fetch13.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo14 = InvocationToFetch; + using FetchType14 = typename FetchInfo14::type; + FetchType14 fetch14; + typename FetchType14::ValueType p14 = + fetch14.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo15 = InvocationToFetch; + using FetchType15 = typename FetchInfo15::type; + FetchType15 fetch15; + typename FetchType15::ValueType p15 = + fetch15.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo16 = InvocationToFetch; + using FetchType16 = typename FetchInfo16::type; + FetchType16 fetch16; + typename FetchType16::ValueType p16 = + fetch16.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo17 = InvocationToFetch; + using FetchType17 = typename FetchInfo17::type; + FetchType17 fetch17; + typename FetchType17::ValueType p17 = + fetch17.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + // If you got a compile error on the following line, it probably means that + // the operator() of a worklet does not match the definition expected. One + // common problem is that the operator() method must be declared const. Check + // to make sure the "const" keyword is after parameters. Another common + // problem is that the type of one or more parameters is incompatible with + // the actual type that VTK-m creates in the execution environment. Make sure + // that the types of the worklet operator() parameters match those in the + // ExecutionSignature. The compiler error might help you narrow down which + // parameter is wrong and the types that did not match. + worklet(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17); + + fetch1.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p1); + fetch2.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p2); + fetch3.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p3); + fetch4.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p4); + fetch5.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p5); + fetch6.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p6); + fetch7.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p7); + fetch8.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p8); + fetch9.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p9); + fetch10.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p10); + fetch11.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p11); + fetch12.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p12); + fetch13.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p13); + fetch14.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p14); + fetch15.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p15); + fetch16.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p16); + fetch17.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p17); +} + +template +VTKM_EXEC void DoWorkletInvokeFunctor( + const WorkletType& worklet, + const vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>& invocation, + const ThreadIndicesType& threadIndices) +{ + using Invocation = vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>; + + using FetchInfo1 = InvocationToFetch; + using FetchType1 = typename FetchInfo1::type; + FetchType1 fetch1; + typename FetchType1::ValueType p1 = + fetch1.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo2 = InvocationToFetch; + using FetchType2 = typename FetchInfo2::type; + FetchType2 fetch2; + typename FetchType2::ValueType p2 = + fetch2.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo3 = InvocationToFetch; + using FetchType3 = typename FetchInfo3::type; + FetchType3 fetch3; + typename FetchType3::ValueType p3 = + fetch3.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo4 = InvocationToFetch; + using FetchType4 = typename FetchInfo4::type; + FetchType4 fetch4; + typename FetchType4::ValueType p4 = + fetch4.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo5 = InvocationToFetch; + using FetchType5 = typename FetchInfo5::type; + FetchType5 fetch5; + typename FetchType5::ValueType p5 = + fetch5.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo6 = InvocationToFetch; + using FetchType6 = typename FetchInfo6::type; + FetchType6 fetch6; + typename FetchType6::ValueType p6 = + fetch6.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo7 = InvocationToFetch; + using FetchType7 = typename FetchInfo7::type; + FetchType7 fetch7; + typename FetchType7::ValueType p7 = + fetch7.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo8 = InvocationToFetch; + using FetchType8 = typename FetchInfo8::type; + FetchType8 fetch8; + typename FetchType8::ValueType p8 = + fetch8.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo9 = InvocationToFetch; + using FetchType9 = typename FetchInfo9::type; + FetchType9 fetch9; + typename FetchType9::ValueType p9 = + fetch9.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo10 = InvocationToFetch; + using FetchType10 = typename FetchInfo10::type; + FetchType10 fetch10; + typename FetchType10::ValueType p10 = + fetch10.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo11 = InvocationToFetch; + using FetchType11 = typename FetchInfo11::type; + FetchType11 fetch11; + typename FetchType11::ValueType p11 = + fetch11.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo12 = InvocationToFetch; + using FetchType12 = typename FetchInfo12::type; + FetchType12 fetch12; + typename FetchType12::ValueType p12 = + fetch12.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo13 = InvocationToFetch; + using FetchType13 = typename FetchInfo13::type; + FetchType13 fetch13; + typename FetchType13::ValueType p13 = + fetch13.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo14 = InvocationToFetch; + using FetchType14 = typename FetchInfo14::type; + FetchType14 fetch14; + typename FetchType14::ValueType p14 = + fetch14.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo15 = InvocationToFetch; + using FetchType15 = typename FetchInfo15::type; + FetchType15 fetch15; + typename FetchType15::ValueType p15 = + fetch15.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo16 = InvocationToFetch; + using FetchType16 = typename FetchInfo16::type; + FetchType16 fetch16; + typename FetchType16::ValueType p16 = + fetch16.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo17 = InvocationToFetch; + using FetchType17 = typename FetchInfo17::type; + FetchType17 fetch17; + typename FetchType17::ValueType p17 = + fetch17.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo18 = InvocationToFetch; + using FetchType18 = typename FetchInfo18::type; + FetchType18 fetch18; + typename FetchType18::ValueType p18 = + fetch18.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo0 = InvocationToFetch; + using ReturnFetchType = typename FetchInfo0::type; + ReturnFetchType returnFetch; + // If you got a compile error on the following line, it probably means that + // the operator() of a worklet does not match the definition expected. One + // common problem is that the operator() method must be declared const. Check + // to make sure the "const" keyword is after parameters. Another common + // problem is that the type of one or more parameters is incompatible with + // the actual type that VTK-m creates in the execution environment. Make sure + // that the types of the worklet operator() parameters match those in the + // ExecutionSignature. The compiler error might help you narrow down which + // parameter is wrong and the types that did not match. + auto r = typename ReturnFetchType::ValueType(worklet(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18)); + + returnFetch.Store( + threadIndices, + invocation.Parameters.template GetParameter(), + r); + + fetch1.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p1); + fetch2.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p2); + fetch3.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p3); + fetch4.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p4); + fetch5.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p5); + fetch6.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p6); + fetch7.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p7); + fetch8.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p8); + fetch9.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p9); + fetch10.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p10); + fetch11.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p11); + fetch12.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p12); + fetch13.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p13); + fetch14.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p14); + fetch15.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p15); + fetch16.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p16); + fetch17.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p17); + fetch18.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p18); +} + +template +VTKM_EXEC void DoWorkletInvokeFunctor( + const WorkletType& worklet, + const vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>& invocation, + const ThreadIndicesType& threadIndices) +{ + typedef vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType> + Invocation; + + using FetchInfo1 = InvocationToFetch; + using FetchType1 = typename FetchInfo1::type; + FetchType1 fetch1; + typename FetchType1::ValueType p1 = + fetch1.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo2 = InvocationToFetch; + using FetchType2 = typename FetchInfo2::type; + FetchType2 fetch2; + typename FetchType2::ValueType p2 = + fetch2.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo3 = InvocationToFetch; + using FetchType3 = typename FetchInfo3::type; + FetchType3 fetch3; + typename FetchType3::ValueType p3 = + fetch3.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo4 = InvocationToFetch; + using FetchType4 = typename FetchInfo4::type; + FetchType4 fetch4; + typename FetchType4::ValueType p4 = + fetch4.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo5 = InvocationToFetch; + using FetchType5 = typename FetchInfo5::type; + FetchType5 fetch5; + typename FetchType5::ValueType p5 = + fetch5.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo6 = InvocationToFetch; + using FetchType6 = typename FetchInfo6::type; + FetchType6 fetch6; + typename FetchType6::ValueType p6 = + fetch6.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo7 = InvocationToFetch; + using FetchType7 = typename FetchInfo7::type; + FetchType7 fetch7; + typename FetchType7::ValueType p7 = + fetch7.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo8 = InvocationToFetch; + using FetchType8 = typename FetchInfo8::type; + FetchType8 fetch8; + typename FetchType8::ValueType p8 = + fetch8.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo9 = InvocationToFetch; + using FetchType9 = typename FetchInfo9::type; + FetchType9 fetch9; + typename FetchType9::ValueType p9 = + fetch9.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo10 = InvocationToFetch; + using FetchType10 = typename FetchInfo10::type; + FetchType10 fetch10; + typename FetchType10::ValueType p10 = + fetch10.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo11 = InvocationToFetch; + using FetchType11 = typename FetchInfo11::type; + FetchType11 fetch11; + typename FetchType11::ValueType p11 = + fetch11.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo12 = InvocationToFetch; + using FetchType12 = typename FetchInfo12::type; + FetchType12 fetch12; + typename FetchType12::ValueType p12 = + fetch12.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo13 = InvocationToFetch; + using FetchType13 = typename FetchInfo13::type; + FetchType13 fetch13; + typename FetchType13::ValueType p13 = + fetch13.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo14 = InvocationToFetch; + using FetchType14 = typename FetchInfo14::type; + FetchType14 fetch14; + typename FetchType14::ValueType p14 = + fetch14.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo15 = InvocationToFetch; + using FetchType15 = typename FetchInfo15::type; + FetchType15 fetch15; + typename FetchType15::ValueType p15 = + fetch15.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo16 = InvocationToFetch; + using FetchType16 = typename FetchInfo16::type; + FetchType16 fetch16; + typename FetchType16::ValueType p16 = + fetch16.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo17 = InvocationToFetch; + using FetchType17 = typename FetchInfo17::type; + FetchType17 fetch17; + typename FetchType17::ValueType p17 = + fetch17.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo18 = InvocationToFetch; + using FetchType18 = typename FetchInfo18::type; + FetchType18 fetch18; + typename FetchType18::ValueType p18 = + fetch18.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + // If you got a compile error on the following line, it probably means that + // the operator() of a worklet does not match the definition expected. One + // common problem is that the operator() method must be declared const. Check + // to make sure the "const" keyword is after parameters. Another common + // problem is that the type of one or more parameters is incompatible with + // the actual type that VTK-m creates in the execution environment. Make sure + // that the types of the worklet operator() parameters match those in the + // ExecutionSignature. The compiler error might help you narrow down which + // parameter is wrong and the types that did not match. + worklet(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18); + + fetch1.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p1); + fetch2.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p2); + fetch3.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p3); + fetch4.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p4); + fetch5.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p5); + fetch6.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p6); + fetch7.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p7); + fetch8.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p8); + fetch9.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p9); + fetch10.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p10); + fetch11.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p11); + fetch12.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p12); + fetch13.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p13); + fetch14.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p14); + fetch15.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p15); + fetch16.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p16); + fetch17.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p17); + fetch18.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p18); +} + +template +VTKM_EXEC void DoWorkletInvokeFunctor( + const WorkletType& worklet, + const vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>& invocation, + const ThreadIndicesType& threadIndices) +{ + using Invocation = vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>; + + using FetchInfo1 = InvocationToFetch; + using FetchType1 = typename FetchInfo1::type; + FetchType1 fetch1; + typename FetchType1::ValueType p1 = + fetch1.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo2 = InvocationToFetch; + using FetchType2 = typename FetchInfo2::type; + FetchType2 fetch2; + typename FetchType2::ValueType p2 = + fetch2.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo3 = InvocationToFetch; + using FetchType3 = typename FetchInfo3::type; + FetchType3 fetch3; + typename FetchType3::ValueType p3 = + fetch3.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo4 = InvocationToFetch; + using FetchType4 = typename FetchInfo4::type; + FetchType4 fetch4; + typename FetchType4::ValueType p4 = + fetch4.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo5 = InvocationToFetch; + using FetchType5 = typename FetchInfo5::type; + FetchType5 fetch5; + typename FetchType5::ValueType p5 = + fetch5.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo6 = InvocationToFetch; + using FetchType6 = typename FetchInfo6::type; + FetchType6 fetch6; + typename FetchType6::ValueType p6 = + fetch6.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo7 = InvocationToFetch; + using FetchType7 = typename FetchInfo7::type; + FetchType7 fetch7; + typename FetchType7::ValueType p7 = + fetch7.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo8 = InvocationToFetch; + using FetchType8 = typename FetchInfo8::type; + FetchType8 fetch8; + typename FetchType8::ValueType p8 = + fetch8.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo9 = InvocationToFetch; + using FetchType9 = typename FetchInfo9::type; + FetchType9 fetch9; + typename FetchType9::ValueType p9 = + fetch9.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo10 = InvocationToFetch; + using FetchType10 = typename FetchInfo10::type; + FetchType10 fetch10; + typename FetchType10::ValueType p10 = + fetch10.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo11 = InvocationToFetch; + using FetchType11 = typename FetchInfo11::type; + FetchType11 fetch11; + typename FetchType11::ValueType p11 = + fetch11.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo12 = InvocationToFetch; + using FetchType12 = typename FetchInfo12::type; + FetchType12 fetch12; + typename FetchType12::ValueType p12 = + fetch12.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo13 = InvocationToFetch; + using FetchType13 = typename FetchInfo13::type; + FetchType13 fetch13; + typename FetchType13::ValueType p13 = + fetch13.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo14 = InvocationToFetch; + using FetchType14 = typename FetchInfo14::type; + FetchType14 fetch14; + typename FetchType14::ValueType p14 = + fetch14.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo15 = InvocationToFetch; + using FetchType15 = typename FetchInfo15::type; + FetchType15 fetch15; + typename FetchType15::ValueType p15 = + fetch15.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo16 = InvocationToFetch; + using FetchType16 = typename FetchInfo16::type; + FetchType16 fetch16; + typename FetchType16::ValueType p16 = + fetch16.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo17 = InvocationToFetch; + using FetchType17 = typename FetchInfo17::type; + FetchType17 fetch17; + typename FetchType17::ValueType p17 = + fetch17.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo18 = InvocationToFetch; + using FetchType18 = typename FetchInfo18::type; + FetchType18 fetch18; + typename FetchType18::ValueType p18 = + fetch18.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo19 = InvocationToFetch; + using FetchType19 = typename FetchInfo19::type; + FetchType19 fetch19; + typename FetchType19::ValueType p19 = + fetch19.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo0 = InvocationToFetch; + using ReturnFetchType = typename FetchInfo0::type; + ReturnFetchType returnFetch; + // If you got a compile error on the following line, it probably means that + // the operator() of a worklet does not match the definition expected. One + // common problem is that the operator() method must be declared const. Check + // to make sure the "const" keyword is after parameters. Another common + // problem is that the type of one or more parameters is incompatible with + // the actual type that VTK-m creates in the execution environment. Make sure + // that the types of the worklet operator() parameters match those in the + // ExecutionSignature. The compiler error might help you narrow down which + // parameter is wrong and the types that did not match. + auto r = typename ReturnFetchType::ValueType(worklet(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19)); + + returnFetch.Store( + threadIndices, + invocation.Parameters.template GetParameter(), + r); + + fetch1.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p1); + fetch2.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p2); + fetch3.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p3); + fetch4.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p4); + fetch5.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p5); + fetch6.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p6); + fetch7.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p7); + fetch8.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p8); + fetch9.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p9); + fetch10.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p10); + fetch11.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p11); + fetch12.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p12); + fetch13.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p13); + fetch14.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p14); + fetch15.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p15); + fetch16.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p16); + fetch17.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p17); + fetch18.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p18); + fetch19.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p19); +} + +template +VTKM_EXEC void DoWorkletInvokeFunctor( + const WorkletType& worklet, + const vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>& invocation, + const ThreadIndicesType& threadIndices) +{ + typedef vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType> + Invocation; + + using FetchInfo1 = InvocationToFetch; + using FetchType1 = typename FetchInfo1::type; + FetchType1 fetch1; + typename FetchType1::ValueType p1 = + fetch1.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo2 = InvocationToFetch; + using FetchType2 = typename FetchInfo2::type; + FetchType2 fetch2; + typename FetchType2::ValueType p2 = + fetch2.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo3 = InvocationToFetch; + using FetchType3 = typename FetchInfo3::type; + FetchType3 fetch3; + typename FetchType3::ValueType p3 = + fetch3.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo4 = InvocationToFetch; + using FetchType4 = typename FetchInfo4::type; + FetchType4 fetch4; + typename FetchType4::ValueType p4 = + fetch4.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo5 = InvocationToFetch; + using FetchType5 = typename FetchInfo5::type; + FetchType5 fetch5; + typename FetchType5::ValueType p5 = + fetch5.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo6 = InvocationToFetch; + using FetchType6 = typename FetchInfo6::type; + FetchType6 fetch6; + typename FetchType6::ValueType p6 = + fetch6.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo7 = InvocationToFetch; + using FetchType7 = typename FetchInfo7::type; + FetchType7 fetch7; + typename FetchType7::ValueType p7 = + fetch7.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo8 = InvocationToFetch; + using FetchType8 = typename FetchInfo8::type; + FetchType8 fetch8; + typename FetchType8::ValueType p8 = + fetch8.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo9 = InvocationToFetch; + using FetchType9 = typename FetchInfo9::type; + FetchType9 fetch9; + typename FetchType9::ValueType p9 = + fetch9.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo10 = InvocationToFetch; + using FetchType10 = typename FetchInfo10::type; + FetchType10 fetch10; + typename FetchType10::ValueType p10 = + fetch10.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo11 = InvocationToFetch; + using FetchType11 = typename FetchInfo11::type; + FetchType11 fetch11; + typename FetchType11::ValueType p11 = + fetch11.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo12 = InvocationToFetch; + using FetchType12 = typename FetchInfo12::type; + FetchType12 fetch12; + typename FetchType12::ValueType p12 = + fetch12.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo13 = InvocationToFetch; + using FetchType13 = typename FetchInfo13::type; + FetchType13 fetch13; + typename FetchType13::ValueType p13 = + fetch13.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo14 = InvocationToFetch; + using FetchType14 = typename FetchInfo14::type; + FetchType14 fetch14; + typename FetchType14::ValueType p14 = + fetch14.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo15 = InvocationToFetch; + using FetchType15 = typename FetchInfo15::type; + FetchType15 fetch15; + typename FetchType15::ValueType p15 = + fetch15.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo16 = InvocationToFetch; + using FetchType16 = typename FetchInfo16::type; + FetchType16 fetch16; + typename FetchType16::ValueType p16 = + fetch16.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo17 = InvocationToFetch; + using FetchType17 = typename FetchInfo17::type; + FetchType17 fetch17; + typename FetchType17::ValueType p17 = + fetch17.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo18 = InvocationToFetch; + using FetchType18 = typename FetchInfo18::type; + FetchType18 fetch18; + typename FetchType18::ValueType p18 = + fetch18.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo19 = InvocationToFetch; + using FetchType19 = typename FetchInfo19::type; + FetchType19 fetch19; + typename FetchType19::ValueType p19 = + fetch19.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + // If you got a compile error on the following line, it probably means that + // the operator() of a worklet does not match the definition expected. One + // common problem is that the operator() method must be declared const. Check + // to make sure the "const" keyword is after parameters. Another common + // problem is that the type of one or more parameters is incompatible with + // the actual type that VTK-m creates in the execution environment. Make sure + // that the types of the worklet operator() parameters match those in the + // ExecutionSignature. The compiler error might help you narrow down which + // parameter is wrong and the types that did not match. + worklet(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19); + + fetch1.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p1); + fetch2.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p2); + fetch3.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p3); + fetch4.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p4); + fetch5.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p5); + fetch6.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p6); + fetch7.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p7); + fetch8.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p8); + fetch9.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p9); + fetch10.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p10); + fetch11.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p11); + fetch12.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p12); + fetch13.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p13); + fetch14.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p14); + fetch15.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p15); + fetch16.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p16); + fetch17.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p17); + fetch18.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p18); + fetch19.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p19); +} + +template +VTKM_EXEC void DoWorkletInvokeFunctor( + const WorkletType& worklet, + const vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>& invocation, + const ThreadIndicesType& threadIndices) +{ + using Invocation = vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>; + + using FetchInfo1 = InvocationToFetch; + using FetchType1 = typename FetchInfo1::type; + FetchType1 fetch1; + typename FetchType1::ValueType p1 = + fetch1.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo2 = InvocationToFetch; + using FetchType2 = typename FetchInfo2::type; + FetchType2 fetch2; + typename FetchType2::ValueType p2 = + fetch2.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo3 = InvocationToFetch; + using FetchType3 = typename FetchInfo3::type; + FetchType3 fetch3; + typename FetchType3::ValueType p3 = + fetch3.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo4 = InvocationToFetch; + using FetchType4 = typename FetchInfo4::type; + FetchType4 fetch4; + typename FetchType4::ValueType p4 = + fetch4.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo5 = InvocationToFetch; + using FetchType5 = typename FetchInfo5::type; + FetchType5 fetch5; + typename FetchType5::ValueType p5 = + fetch5.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo6 = InvocationToFetch; + using FetchType6 = typename FetchInfo6::type; + FetchType6 fetch6; + typename FetchType6::ValueType p6 = + fetch6.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo7 = InvocationToFetch; + using FetchType7 = typename FetchInfo7::type; + FetchType7 fetch7; + typename FetchType7::ValueType p7 = + fetch7.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo8 = InvocationToFetch; + using FetchType8 = typename FetchInfo8::type; + FetchType8 fetch8; + typename FetchType8::ValueType p8 = + fetch8.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo9 = InvocationToFetch; + using FetchType9 = typename FetchInfo9::type; + FetchType9 fetch9; + typename FetchType9::ValueType p9 = + fetch9.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo10 = InvocationToFetch; + using FetchType10 = typename FetchInfo10::type; + FetchType10 fetch10; + typename FetchType10::ValueType p10 = + fetch10.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo11 = InvocationToFetch; + using FetchType11 = typename FetchInfo11::type; + FetchType11 fetch11; + typename FetchType11::ValueType p11 = + fetch11.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo12 = InvocationToFetch; + using FetchType12 = typename FetchInfo12::type; + FetchType12 fetch12; + typename FetchType12::ValueType p12 = + fetch12.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo13 = InvocationToFetch; + using FetchType13 = typename FetchInfo13::type; + FetchType13 fetch13; + typename FetchType13::ValueType p13 = + fetch13.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo14 = InvocationToFetch; + using FetchType14 = typename FetchInfo14::type; + FetchType14 fetch14; + typename FetchType14::ValueType p14 = + fetch14.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo15 = InvocationToFetch; + using FetchType15 = typename FetchInfo15::type; + FetchType15 fetch15; + typename FetchType15::ValueType p15 = + fetch15.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo16 = InvocationToFetch; + using FetchType16 = typename FetchInfo16::type; + FetchType16 fetch16; + typename FetchType16::ValueType p16 = + fetch16.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo17 = InvocationToFetch; + using FetchType17 = typename FetchInfo17::type; + FetchType17 fetch17; + typename FetchType17::ValueType p17 = + fetch17.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo18 = InvocationToFetch; + using FetchType18 = typename FetchInfo18::type; + FetchType18 fetch18; + typename FetchType18::ValueType p18 = + fetch18.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo19 = InvocationToFetch; + using FetchType19 = typename FetchInfo19::type; + FetchType19 fetch19; + typename FetchType19::ValueType p19 = + fetch19.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo20 = InvocationToFetch; + using FetchType20 = typename FetchInfo20::type; + FetchType20 fetch20; + typename FetchType20::ValueType p20 = + fetch20.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo0 = InvocationToFetch; + using ReturnFetchType = typename FetchInfo0::type; + ReturnFetchType returnFetch; + // If you got a compile error on the following line, it probably means that + // the operator() of a worklet does not match the definition expected. One + // common problem is that the operator() method must be declared const. Check + // to make sure the "const" keyword is after parameters. Another common + // problem is that the type of one or more parameters is incompatible with + // the actual type that VTK-m creates in the execution environment. Make sure + // that the types of the worklet operator() parameters match those in the + // ExecutionSignature. The compiler error might help you narrow down which + // parameter is wrong and the types that did not match. + auto r = typename ReturnFetchType::ValueType(worklet(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20)); + + returnFetch.Store( + threadIndices, + invocation.Parameters.template GetParameter(), + r); + + fetch1.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p1); + fetch2.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p2); + fetch3.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p3); + fetch4.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p4); + fetch5.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p5); + fetch6.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p6); + fetch7.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p7); + fetch8.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p8); + fetch9.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p9); + fetch10.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p10); + fetch11.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p11); + fetch12.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p12); + fetch13.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p13); + fetch14.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p14); + fetch15.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p15); + fetch16.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p16); + fetch17.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p17); + fetch18.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p18); + fetch19.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p19); + fetch20.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p20); +} + +template +VTKM_EXEC void DoWorkletInvokeFunctor( + const WorkletType& worklet, + const vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType>& invocation, + const ThreadIndicesType& threadIndices) +{ + typedef vtkm::internal::Invocation, + InputDomainIndex, + OutputToInputMapType, + VisitArrayType> + Invocation; + + using FetchInfo1 = InvocationToFetch; + using FetchType1 = typename FetchInfo1::type; + FetchType1 fetch1; + typename FetchType1::ValueType p1 = + fetch1.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo2 = InvocationToFetch; + using FetchType2 = typename FetchInfo2::type; + FetchType2 fetch2; + typename FetchType2::ValueType p2 = + fetch2.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo3 = InvocationToFetch; + using FetchType3 = typename FetchInfo3::type; + FetchType3 fetch3; + typename FetchType3::ValueType p3 = + fetch3.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo4 = InvocationToFetch; + using FetchType4 = typename FetchInfo4::type; + FetchType4 fetch4; + typename FetchType4::ValueType p4 = + fetch4.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo5 = InvocationToFetch; + using FetchType5 = typename FetchInfo5::type; + FetchType5 fetch5; + typename FetchType5::ValueType p5 = + fetch5.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo6 = InvocationToFetch; + using FetchType6 = typename FetchInfo6::type; + FetchType6 fetch6; + typename FetchType6::ValueType p6 = + fetch6.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo7 = InvocationToFetch; + using FetchType7 = typename FetchInfo7::type; + FetchType7 fetch7; + typename FetchType7::ValueType p7 = + fetch7.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo8 = InvocationToFetch; + using FetchType8 = typename FetchInfo8::type; + FetchType8 fetch8; + typename FetchType8::ValueType p8 = + fetch8.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo9 = InvocationToFetch; + using FetchType9 = typename FetchInfo9::type; + FetchType9 fetch9; + typename FetchType9::ValueType p9 = + fetch9.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo10 = InvocationToFetch; + using FetchType10 = typename FetchInfo10::type; + FetchType10 fetch10; + typename FetchType10::ValueType p10 = + fetch10.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo11 = InvocationToFetch; + using FetchType11 = typename FetchInfo11::type; + FetchType11 fetch11; + typename FetchType11::ValueType p11 = + fetch11.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo12 = InvocationToFetch; + using FetchType12 = typename FetchInfo12::type; + FetchType12 fetch12; + typename FetchType12::ValueType p12 = + fetch12.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo13 = InvocationToFetch; + using FetchType13 = typename FetchInfo13::type; + FetchType13 fetch13; + typename FetchType13::ValueType p13 = + fetch13.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo14 = InvocationToFetch; + using FetchType14 = typename FetchInfo14::type; + FetchType14 fetch14; + typename FetchType14::ValueType p14 = + fetch14.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo15 = InvocationToFetch; + using FetchType15 = typename FetchInfo15::type; + FetchType15 fetch15; + typename FetchType15::ValueType p15 = + fetch15.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo16 = InvocationToFetch; + using FetchType16 = typename FetchInfo16::type; + FetchType16 fetch16; + typename FetchType16::ValueType p16 = + fetch16.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo17 = InvocationToFetch; + using FetchType17 = typename FetchInfo17::type; + FetchType17 fetch17; + typename FetchType17::ValueType p17 = + fetch17.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo18 = InvocationToFetch; + using FetchType18 = typename FetchInfo18::type; + FetchType18 fetch18; + typename FetchType18::ValueType p18 = + fetch18.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo19 = InvocationToFetch; + using FetchType19 = typename FetchInfo19::type; + FetchType19 fetch19; + typename FetchType19::ValueType p19 = + fetch19.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + using FetchInfo20 = InvocationToFetch; + using FetchType20 = typename FetchInfo20::type; + FetchType20 fetch20; + typename FetchType20::ValueType p20 = + fetch20.Load(threadIndices, + invocation.Parameters.template GetParameter()); + + // If you got a compile error on the following line, it probably means that + // the operator() of a worklet does not match the definition expected. One + // common problem is that the operator() method must be declared const. Check + // to make sure the "const" keyword is after parameters. Another common + // problem is that the type of one or more parameters is incompatible with + // the actual type that VTK-m creates in the execution environment. Make sure + // that the types of the worklet operator() parameters match those in the + // ExecutionSignature. The compiler error might help you narrow down which + // parameter is wrong and the types that did not match. + worklet(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20); + + fetch1.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p1); + fetch2.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p2); + fetch3.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p3); + fetch4.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p4); + fetch5.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p5); + fetch6.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p6); + fetch7.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p7); + fetch8.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p8); + fetch9.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p9); + fetch10.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p10); + fetch11.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p11); + fetch12.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p12); + fetch13.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p13); + fetch14.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p14); + fetch15.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p15); + fetch16.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p16); + fetch17.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p17); + fetch18.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p18); + fetch19.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p19); + fetch20.Store(threadIndices, + invocation.Parameters.template GetParameter(), + p20); +} + // clang-format on } } diff --git a/vtkm/exec/internal/WorkletInvokeFunctorDetail.h.in b/vtkm/exec/internal/WorkletInvokeFunctorDetail.h.in index a56be4fa2..dbdb849b9 100644 --- a/vtkm/exec/internal/WorkletInvokeFunctorDetail.h.in +++ b/vtkm/exec/internal/WorkletInvokeFunctorDetail.h.in @@ -51,7 +51,7 @@ $# Ignore the following comment. It is meant for the generated file. #include $# This needs to match the max_parameters in FunctionInterfaceDetailPre.h.in -$py(max_parameters=10)\ +$py(max_parameters=20)\ #if VTKM_MAX_FUNCTION_PARAMETERS != $(max_parameters) #error Mismatch of maximum parameters between FunctionInterfaceDatailPre.h.in and WorkletInvokeFunctorDetail.h.in #endif diff --git a/vtkm/filter/CleanGrid.hxx b/vtkm/filter/CleanGrid.hxx index 2e26fdca8..cdda4bb4a 100644 --- a/vtkm/filter/CleanGrid.hxx +++ b/vtkm/filter/CleanGrid.hxx @@ -28,38 +28,6 @@ namespace vtkm namespace filter { -namespace detail -{ - -template -struct CleanCompactPointArrayFunctor -{ - vtkm::cont::DataSet& OutDataSet; - std::string Name; - const vtkm::filter::CleanGrid* Self; - - CleanCompactPointArrayFunctor(vtkm::cont::DataSet& outDataSet, - const std::string& name, - const vtkm::filter::CleanGrid* self) - : OutDataSet(outDataSet) - , Name(name) - , Self(self) - { - } - - template - void operator()(const ArrayHandleType& coordSystemArray) const - { - VTKM_IS_ARRAY_HANDLE(ArrayHandleType); - - vtkm::cont::ArrayHandle outArray = - this->Self->MapPointField(coordSystemArray, Device()); - this->OutDataSet.AddCoordinateSystem(vtkm::cont::CoordinateSystem(this->Name, outArray)); - } -}; - -} // namespace detail - inline VTKM_CONT CleanGrid::CleanGrid() : CompactPointFields(true) { @@ -128,9 +96,8 @@ inline VTKM_CONT vtkm::filter::Result CleanGrid::DoExecute(const vtkm::cont::Dat if (this->GetCompactPointFields()) { - vtkm::filter::ApplyPolicy(coordSystem, policy, vtkm::filter::FilterTraits()) - .CastAndCall( - detail::CleanCompactPointArrayFunctor(outData, coordSystem.GetName(), this)); + auto outArray = this->MapPointField(coordSystem.GetData(), Device()); + outData.AddCoordinateSystem(vtkm::cont::CoordinateSystem(coordSystem.GetName(), outArray)); } else { diff --git a/vtkm/filter/ClipWithField.hxx b/vtkm/filter/ClipWithField.hxx index da7aa6634..a11765bca 100644 --- a/vtkm/filter/ClipWithField.hxx +++ b/vtkm/filter/ClipWithField.hxx @@ -95,9 +95,7 @@ inline VTKM_CONT vtkm::filter::Result ClipWithField::DoExecute( output.AddCellSet(outputCellSet); // Compute the new boundary points and add them to the output: - vtkm::cont::DynamicArrayHandle outputCoordsArray; - PointMapHelper pointMapper(this->Worklet, outputCoordsArray); - vtkm::filter::ApplyPolicy(inputCoords, policy).CastAndCall(pointMapper); + auto outputCoordsArray = this->Worklet.ProcessPointField(inputCoords.GetData(), device); vtkm::cont::CoordinateSystem outputCoords(inputCoords.GetName(), outputCoordsArray); output.AddCoordinateSystem(outputCoords); vtkm::filter::Result result(output); diff --git a/vtkm/filter/ClipWithImplicitFunction.hxx b/vtkm/filter/ClipWithImplicitFunction.hxx index fdbd02b14..f72cf0faa 100644 --- a/vtkm/filter/ClipWithImplicitFunction.hxx +++ b/vtkm/filter/ClipWithImplicitFunction.hxx @@ -72,9 +72,7 @@ inline vtkm::filter::Result ClipWithImplicitFunction::DoExecute( vtkm::filter::ApplyPolicy(cells, policy), this->Function, inputCoords, device); // compute output coordinates - vtkm::cont::DynamicArrayHandle outputCoordsArray; - PointMapHelper pointMapper(this->Worklet, outputCoordsArray); - vtkm::filter::ApplyPolicy(inputCoords, policy).CastAndCall(pointMapper); + auto outputCoordsArray = this->Worklet.ProcessPointField(inputCoords.GetData(), device); vtkm::cont::CoordinateSystem outputCoords(inputCoords.GetName(), outputCoordsArray); //create the output data diff --git a/vtkm/filter/ExtractPoints.hxx b/vtkm/filter/ExtractPoints.hxx index 62f5be33d..e55cf4545 100644 --- a/vtkm/filter/ExtractPoints.hxx +++ b/vtkm/filter/ExtractPoints.hxx @@ -69,7 +69,7 @@ inline vtkm::filter::Result ExtractPoints::DoExecute( vtkm::worklet::ExtractPoints worklet; outCellSet = worklet.Run(vtkm::filter::ApplyPolicy(cells, policy), - vtkm::filter::ApplyPolicy(coords, policy), + coords.GetData(), this->Function, this->ExtractInside, device); diff --git a/vtkm/filter/ExtractStructured.hxx b/vtkm/filter/ExtractStructured.hxx index fadd1b912..dfe3c1e7d 100644 --- a/vtkm/filter/ExtractStructured.hxx +++ b/vtkm/filter/ExtractStructured.hxx @@ -52,10 +52,8 @@ inline VTKM_CONT vtkm::filter::Result ExtractStructured::DoExecute( this->IncludeBoundary, device); - auto coords = - this->Worklet.MapCoordinates(vtkm::filter::ApplyPolicy(coordinates, policy), device); - vtkm::cont::CoordinateSystem outputCoordinates(coordinates.GetName(), - vtkm::cont::DynamicArrayHandle(coords)); + auto coords = this->Worklet.MapCoordinates(coordinates, device); + vtkm::cont::CoordinateSystem outputCoordinates(coordinates.GetName(), coords); vtkm::cont::DataSet output; output.AddCellSet(vtkm::cont::DynamicCellSet(cellset)); diff --git a/vtkm/filter/FilterField.hxx b/vtkm/filter/FilterField.hxx index 7f1d5bf29..ca5440633 100644 --- a/vtkm/filter/FilterField.hxx +++ b/vtkm/filter/FilterField.hxx @@ -183,10 +183,8 @@ FilterField::PrepareForExecution(const vtkm::cont::DataSet& input, typedef internal::ResolveFieldTypeAndExecute FunctorType; FunctorType functor(static_cast(this), input, metaData, policy, result); + vtkm::cont::CastAndCall(field, functor, this->Tracker); - typedef vtkm::filter::FilterTraits Traits; - vtkm::cont::CastAndCall( - vtkm::filter::ApplyPolicy(field, policy, Traits()), functor, this->Tracker); return result; } } diff --git a/vtkm/filter/Gradient.hxx b/vtkm/filter/Gradient.hxx index d563069cb..61554838a 100644 --- a/vtkm/filter/Gradient.hxx +++ b/vtkm/filter/Gradient.hxx @@ -115,20 +115,14 @@ inline vtkm::filter::Result Gradient::DoExecute( if (this->ComputePointGradient) { vtkm::worklet::PointGradient gradient; - outArray = gradient.Run(vtkm::filter::ApplyPolicy(cells, policy), - vtkm::filter::ApplyPolicy(coords, policy), - inField, - gradientfields, - adapter); + outArray = gradient.Run( + vtkm::filter::ApplyPolicy(cells, policy), coords, inField, gradientfields, adapter); } else { vtkm::worklet::CellGradient gradient; - outArray = gradient.Run(vtkm::filter::ApplyPolicy(cells, policy), - vtkm::filter::ApplyPolicy(coords, policy), - inField, - gradientfields, - adapter); + outArray = gradient.Run( + vtkm::filter::ApplyPolicy(cells, policy), coords, inField, gradientfields, adapter); } if (!this->RowOrdering) { diff --git a/vtkm/filter/MarchingCubes.hxx b/vtkm/filter/MarchingCubes.hxx index 7add21cb7..8a17522f6 100644 --- a/vtkm/filter/MarchingCubes.hxx +++ b/vtkm/filter/MarchingCubes.hxx @@ -167,7 +167,7 @@ inline VTKM_CONT vtkm::filter::Result MarchingCubes::DoExecute( outputCells = this->Worklet.Run(&ivalues[0], static_cast(ivalues.size()), vtkm::filter::ApplyPolicy(cells, policy), - vtkm::filter::ApplyPolicy(coords, policy), + coords.GetData(), field, vertices, normals, @@ -178,7 +178,7 @@ inline VTKM_CONT vtkm::filter::Result MarchingCubes::DoExecute( outputCells = this->Worklet.Run(&ivalues[0], static_cast(ivalues.size()), vtkm::filter::ApplyPolicy(cells, policy), - vtkm::filter::ApplyPolicy(coords, policy), + coords.GetData(), field, vertices, device); diff --git a/vtkm/filter/PolicyBase.h b/vtkm/filter/PolicyBase.h index eeaf4059a..466337a7e 100644 --- a/vtkm/filter/PolicyBase.h +++ b/vtkm/filter/PolicyBase.h @@ -47,9 +47,6 @@ struct PolicyBase typedef vtkm::cont::CellSetListTagUnstructured UnstructuredCellSetList; typedef VTKM_DEFAULT_CELL_SET_LIST_TAG AllCellSetList; - typedef VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG CoordinateTypeList; - typedef VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG CoordinateStorageList; - // List of backends to try in sequence (if one fails, the next is attempted). typedef VTKM_DEFAULT_DEVICE_ADAPTER_LIST_TAG DeviceAdapterList; }; @@ -81,33 +78,6 @@ ApplyPolicy(const vtkm::cont::Field& field, return field.GetData().ResetTypeAndStorageLists(TypeList(), StorageList()); } -//----------------------------------------------------------------------------- -template -VTKM_CONT vtkm::cont::DynamicArrayHandleBase -ApplyPolicy(const vtkm::cont::CoordinateSystem& coordinates, - const vtkm::filter::PolicyBase&) -{ - typedef typename DerivedPolicy::CoordinateTypeList TypeList; - typedef typename DerivedPolicy::CoordinateStorageList StorageList; - return coordinates.GetData().ResetTypeAndStorageLists(TypeList(), StorageList()); -} - -//----------------------------------------------------------------------------- -template -VTKM_CONT vtkm::cont::DynamicArrayHandleBase -ApplyPolicy(const vtkm::cont::CoordinateSystem& coordinates, - const vtkm::filter::PolicyBase&, - const vtkm::filter::FilterTraits&) -{ - //todo: we need to intersect the policy field type list and the - //filter traits to the get smallest set of valid types - typedef typename DerivedPolicy::CoordinateTypeList TypeList; - typedef typename DerivedPolicy::CoordinateStorageList StorageList; - return coordinates.GetData().ResetTypeAndStorageLists(TypeList(), StorageList()); -} - //----------------------------------------------------------------------------- template VTKM_CONT vtkm::cont::DynamicCellSetBase ApplyPolicy( diff --git a/vtkm/filter/VertexClustering.hxx b/vtkm/filter/VertexClustering.hxx index e0c78ad6c..2c6056a1d 100644 --- a/vtkm/filter/VertexClustering.hxx +++ b/vtkm/filter/VertexClustering.hxx @@ -40,12 +40,11 @@ inline VTKM_CONT vtkm::filter::Result VertexClustering::DoExecute( // todo this code needs to obey the policy for what storage types // the output should use //need to compute bounds first - vtkm::Bounds bounds = input.GetCoordinateSystem().GetBounds( - typename DerivedPolicy::CoordinateTypeList(), typename DerivedPolicy::CoordinateStorageList()); + vtkm::Bounds bounds = input.GetCoordinateSystem().GetBounds(); vtkm::cont::DataSet outDataSet = this->Worklet.Run(vtkm::filter::ApplyPolicyUnstructured(input.GetCellSet(), policy), - vtkm::filter::ApplyPolicy(input.GetCoordinateSystem(), policy), + input.GetCoordinateSystem(), bounds, this->GetNumberOfDivisions(), tag); diff --git a/vtkm/filter/testing/UnitTestPointElevationFilter.cxx b/vtkm/filter/testing/UnitTestPointElevationFilter.cxx index b3bb50f1d..c9a0e0491 100644 --- a/vtkm/filter/testing/UnitTestPointElevationFilter.cxx +++ b/vtkm/filter/testing/UnitTestPointElevationFilter.cxx @@ -91,9 +91,7 @@ void TestPointElevationNoPolicy() const bool valid = result.FieldAs(resultArrayHandle); if (valid) { - vtkm::cont::ArrayHandle> coordinates; - inputData.GetCoordinateSystem().GetData().CopyTo(coordinates); - + auto coordinates = inputData.GetCoordinateSystem().GetData(); for (vtkm::Id i = 0; i < resultArrayHandle.GetNumberOfValues(); ++i) { VTKM_TEST_ASSERT(test_equal(coordinates.GetPortalConstControl().Get(i)[1] * 2.0, @@ -131,9 +129,7 @@ void TestPointElevationWithPolicy() const bool valid = result.FieldAs(resultArrayHandle); if (valid) { - vtkm::cont::ArrayHandle> coordinates; - inputData.GetCoordinateSystem().GetData().CopyTo(coordinates); - + auto coordinates = inputData.GetCoordinateSystem().GetData(); for (vtkm::Id i = 0; i < resultArrayHandle.GetNumberOfValues(); ++i) { VTKM_TEST_ASSERT(test_equal(coordinates.GetPortalConstControl().Get(i)[1] * 2.0, diff --git a/vtkm/filter/testing/UnitTestVertexClusteringFilter.cxx b/vtkm/filter/testing/UnitTestVertexClusteringFilter.cxx index e6f824fc7..73439ef6d 100644 --- a/vtkm/filter/testing/UnitTestVertexClusteringFilter.cxx +++ b/vtkm/filter/testing/UnitTestVertexClusteringFilter.cxx @@ -78,9 +78,7 @@ void TestVertexClustering() } { - typedef vtkm::Vec PointType; - vtkm::cont::ArrayHandle pointArray; - output.GetCoordinateSystem(0).GetData().CopyTo(pointArray); + auto pointArray = output.GetCoordinateSystem(0).GetData(); std::cerr << "output_points = " << pointArray.GetNumberOfValues() << "\n"; std::cerr << "output_point[] = "; vtkm::cont::printSummary_ArrayHandle(pointArray, std::cerr, true); @@ -90,8 +88,7 @@ void TestVertexClustering() vtkm::cont::printSummary_ArrayHandle(cellvar, std::cerr, true); typedef vtkm::Vec PointType; - vtkm::cont::ArrayHandle pointArray; - output.GetCoordinateSystem(0).GetData().CopyTo(pointArray); + auto pointArray = output.GetCoordinateSystem(0).GetData(); VTKM_TEST_ASSERT(pointArray.GetNumberOfValues() == output_points, "Number of output points mismatch"); for (vtkm::Id i = 0; i < pointArray.GetNumberOfValues(); ++i) diff --git a/vtkm/internal/CMakeLists.txt b/vtkm/internal/CMakeLists.txt index 99ed7c6b7..2b47aed81 100755 --- a/vtkm/internal/CMakeLists.txt +++ b/vtkm/internal/CMakeLists.txt @@ -21,8 +21,9 @@ #----------------------------------------------------------------------------- # Build the configure file. # need to set numerous VTKm cmake properties to the naming convention -# that we exepect for our C++ defines. +# that we expect for our C++ defines. +set(VTKM_NO_ASSERT ${VTKm_NO_ASSERT}) set(VTKM_USE_DOUBLE_PRECISION ${VTKm_USE_DOUBLE_PRECISION}) set(VTKM_USE_64BIT_IDS ${VTKm_USE_64BIT_IDS}) diff --git a/vtkm/internal/FunctionInterfaceDetailPost.h b/vtkm/internal/FunctionInterfaceDetailPost.h index 86332da6e..3628420d0 100644 --- a/vtkm/internal/FunctionInterfaceDetailPost.h +++ b/vtkm/internal/FunctionInterfaceDetailPost.h @@ -29,7 +29,7 @@ #include -#if VTKM_MAX_FUNCTION_PARAMETERS != 10 +#if VTKM_MAX_FUNCTION_PARAMETERS != 20 #error Mismatch of maximum parameters between FunctionInterfaceDatailPre.h.in and FunctionInterfaceDetailPost.h.in #endif @@ -244,6 +244,396 @@ struct FunctionInterfaceStaticTransformType +struct FunctionInterfaceStaticTransformType +{ + typedef R(type)( + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type + ); +}; + +template +struct FunctionInterfaceStaticTransformType +{ + typedef R(type)( + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type + ); +}; + +template +struct FunctionInterfaceStaticTransformType +{ + typedef R(type)( + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type + ); +}; + +template +struct FunctionInterfaceStaticTransformType +{ + typedef R(type)( + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type + ); +}; + +template +struct FunctionInterfaceStaticTransformType +{ + typedef R(type)( + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type + ); +}; + +template +struct FunctionInterfaceStaticTransformType +{ + typedef R(type)( + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type + ); +}; + +template +struct FunctionInterfaceStaticTransformType +{ + typedef R(type)( + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type + ); +}; + +template +struct FunctionInterfaceStaticTransformType +{ + typedef R(type)( + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type + ); +}; + +template +struct FunctionInterfaceStaticTransformType +{ + typedef R(type)( + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type + ); +}; + +template +struct FunctionInterfaceStaticTransformType +{ + typedef R(type)( + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type, + typename Transform::template ReturnType::type + ); +}; + // clang-format on @@ -704,6 +1094,731 @@ make_FunctionInterface( return FunctionInterface{container}; } +/// \brief Create a \c FunctionInterface +/// +/// \c make_FunctionInterface is a function that takes a variable number of +/// arguments and returns a \c FunctionInterface object containing these +/// objects. Since the return type for the function signature is not specified, +/// you must always specify it as a template parameter +/// +/// \code{.cpp} +/// vtkm::internal::FunctionInterface functionInterface = +/// vtkm::internal::make_FunctionInterface(1, 2.5, 'a'); +/// \endcode +/// +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT +FunctionInterface +make_FunctionInterface( + const P1& p1, + const P2& p2, + const P3& p3, + const P4& p4, + const P5& p5, + const P6& p6, + const P7& p7, + const P8& p8, + const P9& p9, + const P10& p10, + const P11& p11 + ) +{ + detail::ParameterContainer container = + { + p1, + p2, + p3, + p4, + p5, + p6, + p7, + p8, + p9, + p10, + p11 + }; + + return FunctionInterface{container}; +} + +/// \brief Create a \c FunctionInterface +/// +/// \c make_FunctionInterface is a function that takes a variable number of +/// arguments and returns a \c FunctionInterface object containing these +/// objects. Since the return type for the function signature is not specified, +/// you must always specify it as a template parameter +/// +/// \code{.cpp} +/// vtkm::internal::FunctionInterface functionInterface = +/// vtkm::internal::make_FunctionInterface(1, 2.5, 'a'); +/// \endcode +/// +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT +FunctionInterface +make_FunctionInterface( + const P1& p1, + const P2& p2, + const P3& p3, + const P4& p4, + const P5& p5, + const P6& p6, + const P7& p7, + const P8& p8, + const P9& p9, + const P10& p10, + const P11& p11, + const P12& p12 + ) +{ + detail::ParameterContainer container = + { + p1, + p2, + p3, + p4, + p5, + p6, + p7, + p8, + p9, + p10, + p11, + p12 + }; + + return FunctionInterface{container}; +} + +/// \brief Create a \c FunctionInterface +/// +/// \c make_FunctionInterface is a function that takes a variable number of +/// arguments and returns a \c FunctionInterface object containing these +/// objects. Since the return type for the function signature is not specified, +/// you must always specify it as a template parameter +/// +/// \code{.cpp} +/// vtkm::internal::FunctionInterface functionInterface = +/// vtkm::internal::make_FunctionInterface(1, 2.5, 'a'); +/// \endcode +/// +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT +FunctionInterface +make_FunctionInterface( + const P1& p1, + const P2& p2, + const P3& p3, + const P4& p4, + const P5& p5, + const P6& p6, + const P7& p7, + const P8& p8, + const P9& p9, + const P10& p10, + const P11& p11, + const P12& p12, + const P13& p13 + ) +{ + detail::ParameterContainer container = + { + p1, + p2, + p3, + p4, + p5, + p6, + p7, + p8, + p9, + p10, + p11, + p12, + p13 + }; + + return FunctionInterface{container}; +} + +/// \brief Create a \c FunctionInterface +/// +/// \c make_FunctionInterface is a function that takes a variable number of +/// arguments and returns a \c FunctionInterface object containing these +/// objects. Since the return type for the function signature is not specified, +/// you must always specify it as a template parameter +/// +/// \code{.cpp} +/// vtkm::internal::FunctionInterface functionInterface = +/// vtkm::internal::make_FunctionInterface(1, 2.5, 'a'); +/// \endcode +/// +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT +FunctionInterface +make_FunctionInterface( + const P1& p1, + const P2& p2, + const P3& p3, + const P4& p4, + const P5& p5, + const P6& p6, + const P7& p7, + const P8& p8, + const P9& p9, + const P10& p10, + const P11& p11, + const P12& p12, + const P13& p13, + const P14& p14 + ) +{ + detail::ParameterContainer container = + { + p1, + p2, + p3, + p4, + p5, + p6, + p7, + p8, + p9, + p10, + p11, + p12, + p13, + p14 + }; + + return FunctionInterface{container}; +} + +/// \brief Create a \c FunctionInterface +/// +/// \c make_FunctionInterface is a function that takes a variable number of +/// arguments and returns a \c FunctionInterface object containing these +/// objects. Since the return type for the function signature is not specified, +/// you must always specify it as a template parameter +/// +/// \code{.cpp} +/// vtkm::internal::FunctionInterface functionInterface = +/// vtkm::internal::make_FunctionInterface(1, 2.5, 'a'); +/// \endcode +/// +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT +FunctionInterface +make_FunctionInterface( + const P1& p1, + const P2& p2, + const P3& p3, + const P4& p4, + const P5& p5, + const P6& p6, + const P7& p7, + const P8& p8, + const P9& p9, + const P10& p10, + const P11& p11, + const P12& p12, + const P13& p13, + const P14& p14, + const P15& p15 + ) +{ + detail::ParameterContainer container = + { + p1, + p2, + p3, + p4, + p5, + p6, + p7, + p8, + p9, + p10, + p11, + p12, + p13, + p14, + p15 + }; + + return FunctionInterface{container}; +} + +/// \brief Create a \c FunctionInterface +/// +/// \c make_FunctionInterface is a function that takes a variable number of +/// arguments and returns a \c FunctionInterface object containing these +/// objects. Since the return type for the function signature is not specified, +/// you must always specify it as a template parameter +/// +/// \code{.cpp} +/// vtkm::internal::FunctionInterface functionInterface = +/// vtkm::internal::make_FunctionInterface(1, 2.5, 'a'); +/// \endcode +/// +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT +FunctionInterface +make_FunctionInterface( + const P1& p1, + const P2& p2, + const P3& p3, + const P4& p4, + const P5& p5, + const P6& p6, + const P7& p7, + const P8& p8, + const P9& p9, + const P10& p10, + const P11& p11, + const P12& p12, + const P13& p13, + const P14& p14, + const P15& p15, + const P16& p16 + ) +{ + detail::ParameterContainer container = + { + p1, + p2, + p3, + p4, + p5, + p6, + p7, + p8, + p9, + p10, + p11, + p12, + p13, + p14, + p15, + p16 + }; + + return FunctionInterface{container}; +} + +/// \brief Create a \c FunctionInterface +/// +/// \c make_FunctionInterface is a function that takes a variable number of +/// arguments and returns a \c FunctionInterface object containing these +/// objects. Since the return type for the function signature is not specified, +/// you must always specify it as a template parameter +/// +/// \code{.cpp} +/// vtkm::internal::FunctionInterface functionInterface = +/// vtkm::internal::make_FunctionInterface(1, 2.5, 'a'); +/// \endcode +/// +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT +FunctionInterface +make_FunctionInterface( + const P1& p1, + const P2& p2, + const P3& p3, + const P4& p4, + const P5& p5, + const P6& p6, + const P7& p7, + const P8& p8, + const P9& p9, + const P10& p10, + const P11& p11, + const P12& p12, + const P13& p13, + const P14& p14, + const P15& p15, + const P16& p16, + const P17& p17 + ) +{ + detail::ParameterContainer container = + { + p1, + p2, + p3, + p4, + p5, + p6, + p7, + p8, + p9, + p10, + p11, + p12, + p13, + p14, + p15, + p16, + p17 + }; + + return FunctionInterface{container}; +} + +/// \brief Create a \c FunctionInterface +/// +/// \c make_FunctionInterface is a function that takes a variable number of +/// arguments and returns a \c FunctionInterface object containing these +/// objects. Since the return type for the function signature is not specified, +/// you must always specify it as a template parameter +/// +/// \code{.cpp} +/// vtkm::internal::FunctionInterface functionInterface = +/// vtkm::internal::make_FunctionInterface(1, 2.5, 'a'); +/// \endcode +/// +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT +FunctionInterface +make_FunctionInterface( + const P1& p1, + const P2& p2, + const P3& p3, + const P4& p4, + const P5& p5, + const P6& p6, + const P7& p7, + const P8& p8, + const P9& p9, + const P10& p10, + const P11& p11, + const P12& p12, + const P13& p13, + const P14& p14, + const P15& p15, + const P16& p16, + const P17& p17, + const P18& p18 + ) +{ + detail::ParameterContainer container = + { + p1, + p2, + p3, + p4, + p5, + p6, + p7, + p8, + p9, + p10, + p11, + p12, + p13, + p14, + p15, + p16, + p17, + p18 + }; + + return FunctionInterface{container}; +} + +/// \brief Create a \c FunctionInterface +/// +/// \c make_FunctionInterface is a function that takes a variable number of +/// arguments and returns a \c FunctionInterface object containing these +/// objects. Since the return type for the function signature is not specified, +/// you must always specify it as a template parameter +/// +/// \code{.cpp} +/// vtkm::internal::FunctionInterface functionInterface = +/// vtkm::internal::make_FunctionInterface(1, 2.5, 'a'); +/// \endcode +/// +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT +FunctionInterface +make_FunctionInterface( + const P1& p1, + const P2& p2, + const P3& p3, + const P4& p4, + const P5& p5, + const P6& p6, + const P7& p7, + const P8& p8, + const P9& p9, + const P10& p10, + const P11& p11, + const P12& p12, + const P13& p13, + const P14& p14, + const P15& p15, + const P16& p16, + const P17& p17, + const P18& p18, + const P19& p19 + ) +{ + detail::ParameterContainer container = + { + p1, + p2, + p3, + p4, + p5, + p6, + p7, + p8, + p9, + p10, + p11, + p12, + p13, + p14, + p15, + p16, + p17, + p18, + p19 + }; + + return FunctionInterface{container}; +} + +/// \brief Create a \c FunctionInterface +/// +/// \c make_FunctionInterface is a function that takes a variable number of +/// arguments and returns a \c FunctionInterface object containing these +/// objects. Since the return type for the function signature is not specified, +/// you must always specify it as a template parameter +/// +/// \code{.cpp} +/// vtkm::internal::FunctionInterface functionInterface = +/// vtkm::internal::make_FunctionInterface(1, 2.5, 'a'); +/// \endcode +/// +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT +FunctionInterface +make_FunctionInterface( + const P1& p1, + const P2& p2, + const P3& p3, + const P4& p4, + const P5& p5, + const P6& p6, + const P7& p7, + const P8& p8, + const P9& p9, + const P10& p10, + const P11& p11, + const P12& p12, + const P13& p13, + const P14& p14, + const P15& p15, + const P16& p16, + const P17& p17, + const P18& p18, + const P19& p19, + const P20& p20 + ) +{ + detail::ParameterContainer container = + { + p1, + p2, + p3, + p4, + p5, + p6, + p7, + p8, + p9, + p10, + p11, + p12, + p13, + p14, + p15, + p16, + p17, + p18, + p19, + p20 + }; + + return FunctionInterface{container}; +} + // clang-format off diff --git a/vtkm/internal/FunctionInterfaceDetailPost.h.in b/vtkm/internal/FunctionInterfaceDetailPost.h.in index a98a1d7a4..d4330cb94 100644 --- a/vtkm/internal/FunctionInterfaceDetailPost.h.in +++ b/vtkm/internal/FunctionInterfaceDetailPost.h.in @@ -42,7 +42,7 @@ $# Ignore the following comment. It is meant for the generated file. #include $# This needs to match the max_parameters in FunctionInterfaceDetailPre.h.in -$py(max_parameters=10)\ +$py(max_parameters=20)\ #if VTKM_MAX_FUNCTION_PARAMETERS != $(max_parameters) #error Mismatch of maximum parameters between FunctionInterfaceDatailPre.h.in and FunctionInterfaceDetailPost.h.in #endif diff --git a/vtkm/internal/FunctionInterfaceDetailPre.h b/vtkm/internal/FunctionInterfaceDetailPre.h index 0698d60b3..cbf98fee3 100644 --- a/vtkm/internal/FunctionInterfaceDetailPre.h +++ b/vtkm/internal/FunctionInterfaceDetailPre.h @@ -34,7 +34,7 @@ #include -#define VTKM_MAX_FUNCTION_PARAMETERS 10 +#define VTKM_MAX_FUNCTION_PARAMETERS 20 namespace vtkm @@ -76,12 +76,16 @@ struct ParameterContainer; template struct ParameterContainer { + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; }; template struct ParameterContainer { + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; P1 Parameter1; }; @@ -90,6 +94,8 @@ template struct ParameterContainer { + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; P1 Parameter1; P2 Parameter2; }; @@ -100,6 +106,8 @@ template struct ParameterContainer { + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; P1 Parameter1; P2 Parameter2; P3 Parameter3; @@ -112,6 +120,8 @@ template struct ParameterContainer { + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; P1 Parameter1; P2 Parameter2; P3 Parameter3; @@ -126,6 +136,8 @@ template struct ParameterContainer { + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; P1 Parameter1; P2 Parameter2; P3 Parameter3; @@ -142,6 +154,8 @@ template struct ParameterContainer { + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; P1 Parameter1; P2 Parameter2; P3 Parameter3; @@ -160,6 +174,8 @@ template struct ParameterContainer { + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; P1 Parameter1; P2 Parameter2; P3 Parameter3; @@ -180,6 +196,8 @@ template struct ParameterContainer { + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; P1 Parameter1; P2 Parameter2; P3 Parameter3; @@ -202,6 +220,8 @@ template struct ParameterContainer { + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; P1 Parameter1; P2 Parameter2; P3 Parameter3; @@ -226,6 +246,8 @@ template struct ParameterContainer { + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; P1 Parameter1; P2 Parameter2; P3 Parameter3; @@ -238,6 +260,386 @@ struct ParameterContainer P10 Parameter10; }; +template +struct ParameterContainer +{ + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; + P1 Parameter1; + P2 Parameter2; + P3 Parameter3; + P4 Parameter4; + P5 Parameter5; + P6 Parameter6; + P7 Parameter7; + P8 Parameter8; + P9 Parameter9; + P10 Parameter10; + P11 Parameter11; +}; + +template +struct ParameterContainer +{ + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; + P1 Parameter1; + P2 Parameter2; + P3 Parameter3; + P4 Parameter4; + P5 Parameter5; + P6 Parameter6; + P7 Parameter7; + P8 Parameter8; + P9 Parameter9; + P10 Parameter10; + P11 Parameter11; + P12 Parameter12; +}; + +template +struct ParameterContainer +{ + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; + P1 Parameter1; + P2 Parameter2; + P3 Parameter3; + P4 Parameter4; + P5 Parameter5; + P6 Parameter6; + P7 Parameter7; + P8 Parameter8; + P9 Parameter9; + P10 Parameter10; + P11 Parameter11; + P12 Parameter12; + P13 Parameter13; +}; + +template +struct ParameterContainer +{ + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; + P1 Parameter1; + P2 Parameter2; + P3 Parameter3; + P4 Parameter4; + P5 Parameter5; + P6 Parameter6; + P7 Parameter7; + P8 Parameter8; + P9 Parameter9; + P10 Parameter10; + P11 Parameter11; + P12 Parameter12; + P13 Parameter13; + P14 Parameter14; +}; + +template +struct ParameterContainer +{ + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; + P1 Parameter1; + P2 Parameter2; + P3 Parameter3; + P4 Parameter4; + P5 Parameter5; + P6 Parameter6; + P7 Parameter7; + P8 Parameter8; + P9 Parameter9; + P10 Parameter10; + P11 Parameter11; + P12 Parameter12; + P13 Parameter13; + P14 Parameter14; + P15 Parameter15; +}; + +template +struct ParameterContainer +{ + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; + P1 Parameter1; + P2 Parameter2; + P3 Parameter3; + P4 Parameter4; + P5 Parameter5; + P6 Parameter6; + P7 Parameter7; + P8 Parameter8; + P9 Parameter9; + P10 Parameter10; + P11 Parameter11; + P12 Parameter12; + P13 Parameter13; + P14 Parameter14; + P15 Parameter15; + P16 Parameter16; +}; + +template +struct ParameterContainer +{ + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; + P1 Parameter1; + P2 Parameter2; + P3 Parameter3; + P4 Parameter4; + P5 Parameter5; + P6 Parameter6; + P7 Parameter7; + P8 Parameter8; + P9 Parameter9; + P10 Parameter10; + P11 Parameter11; + P12 Parameter12; + P13 Parameter13; + P14 Parameter14; + P15 Parameter15; + P16 Parameter16; + P17 Parameter17; +}; + +template +struct ParameterContainer +{ + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; + P1 Parameter1; + P2 Parameter2; + P3 Parameter3; + P4 Parameter4; + P5 Parameter5; + P6 Parameter6; + P7 Parameter7; + P8 Parameter8; + P9 Parameter9; + P10 Parameter10; + P11 Parameter11; + P12 Parameter12; + P13 Parameter13; + P14 Parameter14; + P15 Parameter15; + P16 Parameter16; + P17 Parameter17; + P18 Parameter18; +}; + +template +struct ParameterContainer +{ + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; + P1 Parameter1; + P2 Parameter2; + P3 Parameter3; + P4 Parameter4; + P5 Parameter5; + P6 Parameter6; + P7 Parameter7; + P8 Parameter8; + P9 Parameter9; + P10 Parameter10; + P11 Parameter11; + P12 Parameter12; + P13 Parameter13; + P14 Parameter14; + P15 Parameter15; + P16 Parameter16; + P17 Parameter17; + P18 Parameter18; + P19 Parameter19; +}; + +template +struct ParameterContainer +{ + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; + P1 Parameter1; + P2 Parameter2; + P3 Parameter3; + P4 Parameter4; + P5 Parameter5; + P6 Parameter6; + P7 Parameter7; + P8 Parameter8; + P9 Parameter9; + P10 Parameter10; + P11 Parameter11; + P12 Parameter12; + P13 Parameter13; + P14 Parameter14; + P15 Parameter15; + P16 Parameter16; + P17 Parameter17; + P18 Parameter18; + P19 Parameter19; + P20 Parameter20; +}; + // clang-format on //============================================================================ @@ -577,6 +979,286 @@ struct ParameterContainerAccess<10> } }; +template <> +struct ParameterContainerAccess<11> +{ + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT const typename AtType<11, FunctionSignature>::type& Get( + const ParameterContainer& parameters) + { + return parameters.Parameter11; + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Set(ParameterContainer& parameters, + const typename AtType<11, FunctionSignature>::type& value) + { + parameters.Parameter11 = value; + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Move(ParameterContainer& dest, + const ParameterContainer& src) + { + dest.Parameter11 = std::move(src.Parameter11); + } +}; + +template <> +struct ParameterContainerAccess<12> +{ + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT const typename AtType<12, FunctionSignature>::type& Get( + const ParameterContainer& parameters) + { + return parameters.Parameter12; + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Set(ParameterContainer& parameters, + const typename AtType<12, FunctionSignature>::type& value) + { + parameters.Parameter12 = value; + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Move(ParameterContainer& dest, + const ParameterContainer& src) + { + dest.Parameter12 = std::move(src.Parameter12); + } +}; + +template <> +struct ParameterContainerAccess<13> +{ + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT const typename AtType<13, FunctionSignature>::type& Get( + const ParameterContainer& parameters) + { + return parameters.Parameter13; + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Set(ParameterContainer& parameters, + const typename AtType<13, FunctionSignature>::type& value) + { + parameters.Parameter13 = value; + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Move(ParameterContainer& dest, + const ParameterContainer& src) + { + dest.Parameter13 = std::move(src.Parameter13); + } +}; + +template <> +struct ParameterContainerAccess<14> +{ + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT const typename AtType<14, FunctionSignature>::type& Get( + const ParameterContainer& parameters) + { + return parameters.Parameter14; + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Set(ParameterContainer& parameters, + const typename AtType<14, FunctionSignature>::type& value) + { + parameters.Parameter14 = value; + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Move(ParameterContainer& dest, + const ParameterContainer& src) + { + dest.Parameter14 = std::move(src.Parameter14); + } +}; + +template <> +struct ParameterContainerAccess<15> +{ + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT const typename AtType<15, FunctionSignature>::type& Get( + const ParameterContainer& parameters) + { + return parameters.Parameter15; + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Set(ParameterContainer& parameters, + const typename AtType<15, FunctionSignature>::type& value) + { + parameters.Parameter15 = value; + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Move(ParameterContainer& dest, + const ParameterContainer& src) + { + dest.Parameter15 = std::move(src.Parameter15); + } +}; + +template <> +struct ParameterContainerAccess<16> +{ + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT const typename AtType<16, FunctionSignature>::type& Get( + const ParameterContainer& parameters) + { + return parameters.Parameter16; + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Set(ParameterContainer& parameters, + const typename AtType<16, FunctionSignature>::type& value) + { + parameters.Parameter16 = value; + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Move(ParameterContainer& dest, + const ParameterContainer& src) + { + dest.Parameter16 = std::move(src.Parameter16); + } +}; + +template <> +struct ParameterContainerAccess<17> +{ + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT const typename AtType<17, FunctionSignature>::type& Get( + const ParameterContainer& parameters) + { + return parameters.Parameter17; + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Set(ParameterContainer& parameters, + const typename AtType<17, FunctionSignature>::type& value) + { + parameters.Parameter17 = value; + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Move(ParameterContainer& dest, + const ParameterContainer& src) + { + dest.Parameter17 = std::move(src.Parameter17); + } +}; + +template <> +struct ParameterContainerAccess<18> +{ + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT const typename AtType<18, FunctionSignature>::type& Get( + const ParameterContainer& parameters) + { + return parameters.Parameter18; + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Set(ParameterContainer& parameters, + const typename AtType<18, FunctionSignature>::type& value) + { + parameters.Parameter18 = value; + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Move(ParameterContainer& dest, + const ParameterContainer& src) + { + dest.Parameter18 = std::move(src.Parameter18); + } +}; + +template <> +struct ParameterContainerAccess<19> +{ + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT const typename AtType<19, FunctionSignature>::type& Get( + const ParameterContainer& parameters) + { + return parameters.Parameter19; + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Set(ParameterContainer& parameters, + const typename AtType<19, FunctionSignature>::type& value) + { + parameters.Parameter19 = value; + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Move(ParameterContainer& dest, + const ParameterContainer& src) + { + dest.Parameter19 = std::move(src.Parameter19); + } +}; + +template <> +struct ParameterContainerAccess<20> +{ + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT const typename AtType<20, FunctionSignature>::type& Get( + const ParameterContainer& parameters) + { + return parameters.Parameter20; + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Set(ParameterContainer& parameters, + const typename AtType<20, FunctionSignature>::type& value) + { + parameters.Parameter20 = value; + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Move(ParameterContainer& dest, + const ParameterContainer& src) + { + dest.Parameter20 = std::move(src.Parameter20); + } +}; + //============================================================================ template @@ -738,6 +1420,261 @@ struct CopyAllParameters<10> dest.Parameter10 = src.Parameter10; } }; +template <> +struct CopyAllParameters<11> +{ + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Copy(vtkm::internal::detail::ParameterContainer& dest, + const vtkm::internal::detail::ParameterContainer& src) + { + dest.Parameter1 = src.Parameter1; + dest.Parameter2 = src.Parameter2; + dest.Parameter3 = src.Parameter3; + dest.Parameter4 = src.Parameter4; + dest.Parameter5 = src.Parameter5; + dest.Parameter6 = src.Parameter6; + dest.Parameter7 = src.Parameter7; + dest.Parameter8 = src.Parameter8; + dest.Parameter9 = src.Parameter9; + dest.Parameter10 = src.Parameter10; + dest.Parameter11 = src.Parameter11; + } +}; +template <> +struct CopyAllParameters<12> +{ + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Copy(vtkm::internal::detail::ParameterContainer& dest, + const vtkm::internal::detail::ParameterContainer& src) + { + dest.Parameter1 = src.Parameter1; + dest.Parameter2 = src.Parameter2; + dest.Parameter3 = src.Parameter3; + dest.Parameter4 = src.Parameter4; + dest.Parameter5 = src.Parameter5; + dest.Parameter6 = src.Parameter6; + dest.Parameter7 = src.Parameter7; + dest.Parameter8 = src.Parameter8; + dest.Parameter9 = src.Parameter9; + dest.Parameter10 = src.Parameter10; + dest.Parameter11 = src.Parameter11; + dest.Parameter12 = src.Parameter12; + } +}; +template <> +struct CopyAllParameters<13> +{ + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Copy(vtkm::internal::detail::ParameterContainer& dest, + const vtkm::internal::detail::ParameterContainer& src) + { + dest.Parameter1 = src.Parameter1; + dest.Parameter2 = src.Parameter2; + dest.Parameter3 = src.Parameter3; + dest.Parameter4 = src.Parameter4; + dest.Parameter5 = src.Parameter5; + dest.Parameter6 = src.Parameter6; + dest.Parameter7 = src.Parameter7; + dest.Parameter8 = src.Parameter8; + dest.Parameter9 = src.Parameter9; + dest.Parameter10 = src.Parameter10; + dest.Parameter11 = src.Parameter11; + dest.Parameter12 = src.Parameter12; + dest.Parameter13 = src.Parameter13; + } +}; +template <> +struct CopyAllParameters<14> +{ + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Copy(vtkm::internal::detail::ParameterContainer& dest, + const vtkm::internal::detail::ParameterContainer& src) + { + dest.Parameter1 = src.Parameter1; + dest.Parameter2 = src.Parameter2; + dest.Parameter3 = src.Parameter3; + dest.Parameter4 = src.Parameter4; + dest.Parameter5 = src.Parameter5; + dest.Parameter6 = src.Parameter6; + dest.Parameter7 = src.Parameter7; + dest.Parameter8 = src.Parameter8; + dest.Parameter9 = src.Parameter9; + dest.Parameter10 = src.Parameter10; + dest.Parameter11 = src.Parameter11; + dest.Parameter12 = src.Parameter12; + dest.Parameter13 = src.Parameter13; + dest.Parameter14 = src.Parameter14; + } +}; +template <> +struct CopyAllParameters<15> +{ + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Copy(vtkm::internal::detail::ParameterContainer& dest, + const vtkm::internal::detail::ParameterContainer& src) + { + dest.Parameter1 = src.Parameter1; + dest.Parameter2 = src.Parameter2; + dest.Parameter3 = src.Parameter3; + dest.Parameter4 = src.Parameter4; + dest.Parameter5 = src.Parameter5; + dest.Parameter6 = src.Parameter6; + dest.Parameter7 = src.Parameter7; + dest.Parameter8 = src.Parameter8; + dest.Parameter9 = src.Parameter9; + dest.Parameter10 = src.Parameter10; + dest.Parameter11 = src.Parameter11; + dest.Parameter12 = src.Parameter12; + dest.Parameter13 = src.Parameter13; + dest.Parameter14 = src.Parameter14; + dest.Parameter15 = src.Parameter15; + } +}; +template <> +struct CopyAllParameters<16> +{ + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Copy(vtkm::internal::detail::ParameterContainer& dest, + const vtkm::internal::detail::ParameterContainer& src) + { + dest.Parameter1 = src.Parameter1; + dest.Parameter2 = src.Parameter2; + dest.Parameter3 = src.Parameter3; + dest.Parameter4 = src.Parameter4; + dest.Parameter5 = src.Parameter5; + dest.Parameter6 = src.Parameter6; + dest.Parameter7 = src.Parameter7; + dest.Parameter8 = src.Parameter8; + dest.Parameter9 = src.Parameter9; + dest.Parameter10 = src.Parameter10; + dest.Parameter11 = src.Parameter11; + dest.Parameter12 = src.Parameter12; + dest.Parameter13 = src.Parameter13; + dest.Parameter14 = src.Parameter14; + dest.Parameter15 = src.Parameter15; + dest.Parameter16 = src.Parameter16; + } +}; +template <> +struct CopyAllParameters<17> +{ + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Copy(vtkm::internal::detail::ParameterContainer& dest, + const vtkm::internal::detail::ParameterContainer& src) + { + dest.Parameter1 = src.Parameter1; + dest.Parameter2 = src.Parameter2; + dest.Parameter3 = src.Parameter3; + dest.Parameter4 = src.Parameter4; + dest.Parameter5 = src.Parameter5; + dest.Parameter6 = src.Parameter6; + dest.Parameter7 = src.Parameter7; + dest.Parameter8 = src.Parameter8; + dest.Parameter9 = src.Parameter9; + dest.Parameter10 = src.Parameter10; + dest.Parameter11 = src.Parameter11; + dest.Parameter12 = src.Parameter12; + dest.Parameter13 = src.Parameter13; + dest.Parameter14 = src.Parameter14; + dest.Parameter15 = src.Parameter15; + dest.Parameter16 = src.Parameter16; + dest.Parameter17 = src.Parameter17; + } +}; +template <> +struct CopyAllParameters<18> +{ + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Copy(vtkm::internal::detail::ParameterContainer& dest, + const vtkm::internal::detail::ParameterContainer& src) + { + dest.Parameter1 = src.Parameter1; + dest.Parameter2 = src.Parameter2; + dest.Parameter3 = src.Parameter3; + dest.Parameter4 = src.Parameter4; + dest.Parameter5 = src.Parameter5; + dest.Parameter6 = src.Parameter6; + dest.Parameter7 = src.Parameter7; + dest.Parameter8 = src.Parameter8; + dest.Parameter9 = src.Parameter9; + dest.Parameter10 = src.Parameter10; + dest.Parameter11 = src.Parameter11; + dest.Parameter12 = src.Parameter12; + dest.Parameter13 = src.Parameter13; + dest.Parameter14 = src.Parameter14; + dest.Parameter15 = src.Parameter15; + dest.Parameter16 = src.Parameter16; + dest.Parameter17 = src.Parameter17; + dest.Parameter18 = src.Parameter18; + } +}; +template <> +struct CopyAllParameters<19> +{ + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Copy(vtkm::internal::detail::ParameterContainer& dest, + const vtkm::internal::detail::ParameterContainer& src) + { + dest.Parameter1 = src.Parameter1; + dest.Parameter2 = src.Parameter2; + dest.Parameter3 = src.Parameter3; + dest.Parameter4 = src.Parameter4; + dest.Parameter5 = src.Parameter5; + dest.Parameter6 = src.Parameter6; + dest.Parameter7 = src.Parameter7; + dest.Parameter8 = src.Parameter8; + dest.Parameter9 = src.Parameter9; + dest.Parameter10 = src.Parameter10; + dest.Parameter11 = src.Parameter11; + dest.Parameter12 = src.Parameter12; + dest.Parameter13 = src.Parameter13; + dest.Parameter14 = src.Parameter14; + dest.Parameter15 = src.Parameter15; + dest.Parameter16 = src.Parameter16; + dest.Parameter17 = src.Parameter17; + dest.Parameter18 = src.Parameter18; + dest.Parameter19 = src.Parameter19; + } +}; +template <> +struct CopyAllParameters<20> +{ + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void Copy(vtkm::internal::detail::ParameterContainer& dest, + const vtkm::internal::detail::ParameterContainer& src) + { + dest.Parameter1 = src.Parameter1; + dest.Parameter2 = src.Parameter2; + dest.Parameter3 = src.Parameter3; + dest.Parameter4 = src.Parameter4; + dest.Parameter5 = src.Parameter5; + dest.Parameter6 = src.Parameter6; + dest.Parameter7 = src.Parameter7; + dest.Parameter8 = src.Parameter8; + dest.Parameter9 = src.Parameter9; + dest.Parameter10 = src.Parameter10; + dest.Parameter11 = src.Parameter11; + dest.Parameter12 = src.Parameter12; + dest.Parameter13 = src.Parameter13; + dest.Parameter14 = src.Parameter14; + dest.Parameter15 = src.Parameter15; + dest.Parameter16 = src.Parameter16; + dest.Parameter17 = src.Parameter17; + dest.Parameter18 = src.Parameter18; + dest.Parameter19 = src.Parameter19; + dest.Parameter20 = src.Parameter20; + } +}; template <> struct CopyAllParameters<0> @@ -2664,6 +3601,3406 @@ VTKM_EXEC void DoInvokeExec(Functor& f, transform(parameters.Parameter10)); } +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17), + transform(parameters.Parameter18))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17), + transform(parameters.Parameter18)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17), + transform(parameters.Parameter18))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17), + transform(parameters.Parameter18)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17), + transform(parameters.Parameter18))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17), + transform(parameters.Parameter18)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17), + transform(parameters.Parameter18))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17), + transform(parameters.Parameter18)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17), + transform(parameters.Parameter18), + transform(parameters.Parameter19))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17), + transform(parameters.Parameter18), + transform(parameters.Parameter19)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17), + transform(parameters.Parameter18), + transform(parameters.Parameter19))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17), + transform(parameters.Parameter18), + transform(parameters.Parameter19)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17), + transform(parameters.Parameter18), + transform(parameters.Parameter19))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17), + transform(parameters.Parameter18), + transform(parameters.Parameter19)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17), + transform(parameters.Parameter18), + transform(parameters.Parameter19))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17), + transform(parameters.Parameter18), + transform(parameters.Parameter19)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17), + transform(parameters.Parameter18), + transform(parameters.Parameter19), + transform(parameters.Parameter20))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17), + transform(parameters.Parameter18), + transform(parameters.Parameter19), + transform(parameters.Parameter20)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17), + transform(parameters.Parameter18), + transform(parameters.Parameter19), + transform(parameters.Parameter20))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoInvokeCont(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17), + transform(parameters.Parameter18), + transform(parameters.Parameter19), + transform(parameters.Parameter20)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17), + transform(parameters.Parameter18), + transform(parameters.Parameter19), + transform(parameters.Parameter20))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(const Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17), + transform(parameters.Parameter18), + transform(parameters.Parameter19), + transform(parameters.Parameter20)); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer& result, + const TransformFunctor& transform) +{ + result.Value = transform(f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17), + transform(parameters.Parameter18), + transform(parameters.Parameter19), + transform(parameters.Parameter20))); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoInvokeExec(Functor& f, + ParameterContainer& parameters, + FunctionInterfaceReturnContainer&, + const TransformFunctor& transform) +{ + f( + transform(parameters.Parameter1), + transform(parameters.Parameter2), + transform(parameters.Parameter3), + transform(parameters.Parameter4), + transform(parameters.Parameter5), + transform(parameters.Parameter6), + transform(parameters.Parameter7), + transform(parameters.Parameter8), + transform(parameters.Parameter9), + transform(parameters.Parameter10), + transform(parameters.Parameter11), + transform(parameters.Parameter12), + transform(parameters.Parameter13), + transform(parameters.Parameter14), + transform(parameters.Parameter15), + transform(parameters.Parameter16), + transform(parameters.Parameter17), + transform(parameters.Parameter18), + transform(parameters.Parameter19), + transform(parameters.Parameter20)); +} + // clang-format on @@ -3260,6 +7597,1386 @@ VTKM_EXEC void DoStaticTransformExec( transform(originalParameters.Parameter9, vtkm::internal::IndexTag<9>()); } +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoStaticTransformCont( + const Transform& transform, + const ParameterContainer& originalParameters, + ParameterContainer& transformedParameters) +{ + transformedParameters.Parameter1 = + transform(originalParameters.Parameter1, vtkm::internal::IndexTag<1>()); + transformedParameters.Parameter2 = + transform(originalParameters.Parameter2, vtkm::internal::IndexTag<2>()); + transformedParameters.Parameter3 = + transform(originalParameters.Parameter3, vtkm::internal::IndexTag<3>()); + transformedParameters.Parameter4 = + transform(originalParameters.Parameter4, vtkm::internal::IndexTag<4>()); + transformedParameters.Parameter5 = + transform(originalParameters.Parameter5, vtkm::internal::IndexTag<5>()); + transformedParameters.Parameter6 = + transform(originalParameters.Parameter6, vtkm::internal::IndexTag<6>()); + transformedParameters.Parameter7 = + transform(originalParameters.Parameter7, vtkm::internal::IndexTag<7>()); + transformedParameters.Parameter8 = + transform(originalParameters.Parameter8, vtkm::internal::IndexTag<8>()); + transformedParameters.Parameter9 = + transform(originalParameters.Parameter9, vtkm::internal::IndexTag<9>()); + transformedParameters.Parameter10 = + transform(originalParameters.Parameter10, vtkm::internal::IndexTag<10>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoStaticTransformExec( + const Transform& transform, + const ParameterContainer& originalParameters, + ParameterContainer& transformedParameters) +{ + transformedParameters.Parameter1 = + transform(originalParameters.Parameter1, vtkm::internal::IndexTag<1>()); + transformedParameters.Parameter2 = + transform(originalParameters.Parameter2, vtkm::internal::IndexTag<2>()); + transformedParameters.Parameter3 = + transform(originalParameters.Parameter3, vtkm::internal::IndexTag<3>()); + transformedParameters.Parameter4 = + transform(originalParameters.Parameter4, vtkm::internal::IndexTag<4>()); + transformedParameters.Parameter5 = + transform(originalParameters.Parameter5, vtkm::internal::IndexTag<5>()); + transformedParameters.Parameter6 = + transform(originalParameters.Parameter6, vtkm::internal::IndexTag<6>()); + transformedParameters.Parameter7 = + transform(originalParameters.Parameter7, vtkm::internal::IndexTag<7>()); + transformedParameters.Parameter8 = + transform(originalParameters.Parameter8, vtkm::internal::IndexTag<8>()); + transformedParameters.Parameter9 = + transform(originalParameters.Parameter9, vtkm::internal::IndexTag<9>()); + transformedParameters.Parameter10 = + transform(originalParameters.Parameter10, vtkm::internal::IndexTag<10>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoStaticTransformCont( + const Transform& transform, + const ParameterContainer& originalParameters, + ParameterContainer& transformedParameters) +{ + transformedParameters.Parameter1 = + transform(originalParameters.Parameter1, vtkm::internal::IndexTag<1>()); + transformedParameters.Parameter2 = + transform(originalParameters.Parameter2, vtkm::internal::IndexTag<2>()); + transformedParameters.Parameter3 = + transform(originalParameters.Parameter3, vtkm::internal::IndexTag<3>()); + transformedParameters.Parameter4 = + transform(originalParameters.Parameter4, vtkm::internal::IndexTag<4>()); + transformedParameters.Parameter5 = + transform(originalParameters.Parameter5, vtkm::internal::IndexTag<5>()); + transformedParameters.Parameter6 = + transform(originalParameters.Parameter6, vtkm::internal::IndexTag<6>()); + transformedParameters.Parameter7 = + transform(originalParameters.Parameter7, vtkm::internal::IndexTag<7>()); + transformedParameters.Parameter8 = + transform(originalParameters.Parameter8, vtkm::internal::IndexTag<8>()); + transformedParameters.Parameter9 = + transform(originalParameters.Parameter9, vtkm::internal::IndexTag<9>()); + transformedParameters.Parameter10 = + transform(originalParameters.Parameter10, vtkm::internal::IndexTag<10>()); + transformedParameters.Parameter11 = + transform(originalParameters.Parameter11, vtkm::internal::IndexTag<11>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoStaticTransformExec( + const Transform& transform, + const ParameterContainer& originalParameters, + ParameterContainer& transformedParameters) +{ + transformedParameters.Parameter1 = + transform(originalParameters.Parameter1, vtkm::internal::IndexTag<1>()); + transformedParameters.Parameter2 = + transform(originalParameters.Parameter2, vtkm::internal::IndexTag<2>()); + transformedParameters.Parameter3 = + transform(originalParameters.Parameter3, vtkm::internal::IndexTag<3>()); + transformedParameters.Parameter4 = + transform(originalParameters.Parameter4, vtkm::internal::IndexTag<4>()); + transformedParameters.Parameter5 = + transform(originalParameters.Parameter5, vtkm::internal::IndexTag<5>()); + transformedParameters.Parameter6 = + transform(originalParameters.Parameter6, vtkm::internal::IndexTag<6>()); + transformedParameters.Parameter7 = + transform(originalParameters.Parameter7, vtkm::internal::IndexTag<7>()); + transformedParameters.Parameter8 = + transform(originalParameters.Parameter8, vtkm::internal::IndexTag<8>()); + transformedParameters.Parameter9 = + transform(originalParameters.Parameter9, vtkm::internal::IndexTag<9>()); + transformedParameters.Parameter10 = + transform(originalParameters.Parameter10, vtkm::internal::IndexTag<10>()); + transformedParameters.Parameter11 = + transform(originalParameters.Parameter11, vtkm::internal::IndexTag<11>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoStaticTransformCont( + const Transform& transform, + const ParameterContainer& originalParameters, + ParameterContainer& transformedParameters) +{ + transformedParameters.Parameter1 = + transform(originalParameters.Parameter1, vtkm::internal::IndexTag<1>()); + transformedParameters.Parameter2 = + transform(originalParameters.Parameter2, vtkm::internal::IndexTag<2>()); + transformedParameters.Parameter3 = + transform(originalParameters.Parameter3, vtkm::internal::IndexTag<3>()); + transformedParameters.Parameter4 = + transform(originalParameters.Parameter4, vtkm::internal::IndexTag<4>()); + transformedParameters.Parameter5 = + transform(originalParameters.Parameter5, vtkm::internal::IndexTag<5>()); + transformedParameters.Parameter6 = + transform(originalParameters.Parameter6, vtkm::internal::IndexTag<6>()); + transformedParameters.Parameter7 = + transform(originalParameters.Parameter7, vtkm::internal::IndexTag<7>()); + transformedParameters.Parameter8 = + transform(originalParameters.Parameter8, vtkm::internal::IndexTag<8>()); + transformedParameters.Parameter9 = + transform(originalParameters.Parameter9, vtkm::internal::IndexTag<9>()); + transformedParameters.Parameter10 = + transform(originalParameters.Parameter10, vtkm::internal::IndexTag<10>()); + transformedParameters.Parameter11 = + transform(originalParameters.Parameter11, vtkm::internal::IndexTag<11>()); + transformedParameters.Parameter12 = + transform(originalParameters.Parameter12, vtkm::internal::IndexTag<12>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoStaticTransformExec( + const Transform& transform, + const ParameterContainer& originalParameters, + ParameterContainer& transformedParameters) +{ + transformedParameters.Parameter1 = + transform(originalParameters.Parameter1, vtkm::internal::IndexTag<1>()); + transformedParameters.Parameter2 = + transform(originalParameters.Parameter2, vtkm::internal::IndexTag<2>()); + transformedParameters.Parameter3 = + transform(originalParameters.Parameter3, vtkm::internal::IndexTag<3>()); + transformedParameters.Parameter4 = + transform(originalParameters.Parameter4, vtkm::internal::IndexTag<4>()); + transformedParameters.Parameter5 = + transform(originalParameters.Parameter5, vtkm::internal::IndexTag<5>()); + transformedParameters.Parameter6 = + transform(originalParameters.Parameter6, vtkm::internal::IndexTag<6>()); + transformedParameters.Parameter7 = + transform(originalParameters.Parameter7, vtkm::internal::IndexTag<7>()); + transformedParameters.Parameter8 = + transform(originalParameters.Parameter8, vtkm::internal::IndexTag<8>()); + transformedParameters.Parameter9 = + transform(originalParameters.Parameter9, vtkm::internal::IndexTag<9>()); + transformedParameters.Parameter10 = + transform(originalParameters.Parameter10, vtkm::internal::IndexTag<10>()); + transformedParameters.Parameter11 = + transform(originalParameters.Parameter11, vtkm::internal::IndexTag<11>()); + transformedParameters.Parameter12 = + transform(originalParameters.Parameter12, vtkm::internal::IndexTag<12>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoStaticTransformCont( + const Transform& transform, + const ParameterContainer& originalParameters, + ParameterContainer& transformedParameters) +{ + transformedParameters.Parameter1 = + transform(originalParameters.Parameter1, vtkm::internal::IndexTag<1>()); + transformedParameters.Parameter2 = + transform(originalParameters.Parameter2, vtkm::internal::IndexTag<2>()); + transformedParameters.Parameter3 = + transform(originalParameters.Parameter3, vtkm::internal::IndexTag<3>()); + transformedParameters.Parameter4 = + transform(originalParameters.Parameter4, vtkm::internal::IndexTag<4>()); + transformedParameters.Parameter5 = + transform(originalParameters.Parameter5, vtkm::internal::IndexTag<5>()); + transformedParameters.Parameter6 = + transform(originalParameters.Parameter6, vtkm::internal::IndexTag<6>()); + transformedParameters.Parameter7 = + transform(originalParameters.Parameter7, vtkm::internal::IndexTag<7>()); + transformedParameters.Parameter8 = + transform(originalParameters.Parameter8, vtkm::internal::IndexTag<8>()); + transformedParameters.Parameter9 = + transform(originalParameters.Parameter9, vtkm::internal::IndexTag<9>()); + transformedParameters.Parameter10 = + transform(originalParameters.Parameter10, vtkm::internal::IndexTag<10>()); + transformedParameters.Parameter11 = + transform(originalParameters.Parameter11, vtkm::internal::IndexTag<11>()); + transformedParameters.Parameter12 = + transform(originalParameters.Parameter12, vtkm::internal::IndexTag<12>()); + transformedParameters.Parameter13 = + transform(originalParameters.Parameter13, vtkm::internal::IndexTag<13>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoStaticTransformExec( + const Transform& transform, + const ParameterContainer& originalParameters, + ParameterContainer& transformedParameters) +{ + transformedParameters.Parameter1 = + transform(originalParameters.Parameter1, vtkm::internal::IndexTag<1>()); + transformedParameters.Parameter2 = + transform(originalParameters.Parameter2, vtkm::internal::IndexTag<2>()); + transformedParameters.Parameter3 = + transform(originalParameters.Parameter3, vtkm::internal::IndexTag<3>()); + transformedParameters.Parameter4 = + transform(originalParameters.Parameter4, vtkm::internal::IndexTag<4>()); + transformedParameters.Parameter5 = + transform(originalParameters.Parameter5, vtkm::internal::IndexTag<5>()); + transformedParameters.Parameter6 = + transform(originalParameters.Parameter6, vtkm::internal::IndexTag<6>()); + transformedParameters.Parameter7 = + transform(originalParameters.Parameter7, vtkm::internal::IndexTag<7>()); + transformedParameters.Parameter8 = + transform(originalParameters.Parameter8, vtkm::internal::IndexTag<8>()); + transformedParameters.Parameter9 = + transform(originalParameters.Parameter9, vtkm::internal::IndexTag<9>()); + transformedParameters.Parameter10 = + transform(originalParameters.Parameter10, vtkm::internal::IndexTag<10>()); + transformedParameters.Parameter11 = + transform(originalParameters.Parameter11, vtkm::internal::IndexTag<11>()); + transformedParameters.Parameter12 = + transform(originalParameters.Parameter12, vtkm::internal::IndexTag<12>()); + transformedParameters.Parameter13 = + transform(originalParameters.Parameter13, vtkm::internal::IndexTag<13>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoStaticTransformCont( + const Transform& transform, + const ParameterContainer& originalParameters, + ParameterContainer& transformedParameters) +{ + transformedParameters.Parameter1 = + transform(originalParameters.Parameter1, vtkm::internal::IndexTag<1>()); + transformedParameters.Parameter2 = + transform(originalParameters.Parameter2, vtkm::internal::IndexTag<2>()); + transformedParameters.Parameter3 = + transform(originalParameters.Parameter3, vtkm::internal::IndexTag<3>()); + transformedParameters.Parameter4 = + transform(originalParameters.Parameter4, vtkm::internal::IndexTag<4>()); + transformedParameters.Parameter5 = + transform(originalParameters.Parameter5, vtkm::internal::IndexTag<5>()); + transformedParameters.Parameter6 = + transform(originalParameters.Parameter6, vtkm::internal::IndexTag<6>()); + transformedParameters.Parameter7 = + transform(originalParameters.Parameter7, vtkm::internal::IndexTag<7>()); + transformedParameters.Parameter8 = + transform(originalParameters.Parameter8, vtkm::internal::IndexTag<8>()); + transformedParameters.Parameter9 = + transform(originalParameters.Parameter9, vtkm::internal::IndexTag<9>()); + transformedParameters.Parameter10 = + transform(originalParameters.Parameter10, vtkm::internal::IndexTag<10>()); + transformedParameters.Parameter11 = + transform(originalParameters.Parameter11, vtkm::internal::IndexTag<11>()); + transformedParameters.Parameter12 = + transform(originalParameters.Parameter12, vtkm::internal::IndexTag<12>()); + transformedParameters.Parameter13 = + transform(originalParameters.Parameter13, vtkm::internal::IndexTag<13>()); + transformedParameters.Parameter14 = + transform(originalParameters.Parameter14, vtkm::internal::IndexTag<14>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoStaticTransformExec( + const Transform& transform, + const ParameterContainer& originalParameters, + ParameterContainer& transformedParameters) +{ + transformedParameters.Parameter1 = + transform(originalParameters.Parameter1, vtkm::internal::IndexTag<1>()); + transformedParameters.Parameter2 = + transform(originalParameters.Parameter2, vtkm::internal::IndexTag<2>()); + transformedParameters.Parameter3 = + transform(originalParameters.Parameter3, vtkm::internal::IndexTag<3>()); + transformedParameters.Parameter4 = + transform(originalParameters.Parameter4, vtkm::internal::IndexTag<4>()); + transformedParameters.Parameter5 = + transform(originalParameters.Parameter5, vtkm::internal::IndexTag<5>()); + transformedParameters.Parameter6 = + transform(originalParameters.Parameter6, vtkm::internal::IndexTag<6>()); + transformedParameters.Parameter7 = + transform(originalParameters.Parameter7, vtkm::internal::IndexTag<7>()); + transformedParameters.Parameter8 = + transform(originalParameters.Parameter8, vtkm::internal::IndexTag<8>()); + transformedParameters.Parameter9 = + transform(originalParameters.Parameter9, vtkm::internal::IndexTag<9>()); + transformedParameters.Parameter10 = + transform(originalParameters.Parameter10, vtkm::internal::IndexTag<10>()); + transformedParameters.Parameter11 = + transform(originalParameters.Parameter11, vtkm::internal::IndexTag<11>()); + transformedParameters.Parameter12 = + transform(originalParameters.Parameter12, vtkm::internal::IndexTag<12>()); + transformedParameters.Parameter13 = + transform(originalParameters.Parameter13, vtkm::internal::IndexTag<13>()); + transformedParameters.Parameter14 = + transform(originalParameters.Parameter14, vtkm::internal::IndexTag<14>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoStaticTransformCont( + const Transform& transform, + const ParameterContainer& originalParameters, + ParameterContainer& transformedParameters) +{ + transformedParameters.Parameter1 = + transform(originalParameters.Parameter1, vtkm::internal::IndexTag<1>()); + transformedParameters.Parameter2 = + transform(originalParameters.Parameter2, vtkm::internal::IndexTag<2>()); + transformedParameters.Parameter3 = + transform(originalParameters.Parameter3, vtkm::internal::IndexTag<3>()); + transformedParameters.Parameter4 = + transform(originalParameters.Parameter4, vtkm::internal::IndexTag<4>()); + transformedParameters.Parameter5 = + transform(originalParameters.Parameter5, vtkm::internal::IndexTag<5>()); + transformedParameters.Parameter6 = + transform(originalParameters.Parameter6, vtkm::internal::IndexTag<6>()); + transformedParameters.Parameter7 = + transform(originalParameters.Parameter7, vtkm::internal::IndexTag<7>()); + transformedParameters.Parameter8 = + transform(originalParameters.Parameter8, vtkm::internal::IndexTag<8>()); + transformedParameters.Parameter9 = + transform(originalParameters.Parameter9, vtkm::internal::IndexTag<9>()); + transformedParameters.Parameter10 = + transform(originalParameters.Parameter10, vtkm::internal::IndexTag<10>()); + transformedParameters.Parameter11 = + transform(originalParameters.Parameter11, vtkm::internal::IndexTag<11>()); + transformedParameters.Parameter12 = + transform(originalParameters.Parameter12, vtkm::internal::IndexTag<12>()); + transformedParameters.Parameter13 = + transform(originalParameters.Parameter13, vtkm::internal::IndexTag<13>()); + transformedParameters.Parameter14 = + transform(originalParameters.Parameter14, vtkm::internal::IndexTag<14>()); + transformedParameters.Parameter15 = + transform(originalParameters.Parameter15, vtkm::internal::IndexTag<15>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoStaticTransformExec( + const Transform& transform, + const ParameterContainer& originalParameters, + ParameterContainer& transformedParameters) +{ + transformedParameters.Parameter1 = + transform(originalParameters.Parameter1, vtkm::internal::IndexTag<1>()); + transformedParameters.Parameter2 = + transform(originalParameters.Parameter2, vtkm::internal::IndexTag<2>()); + transformedParameters.Parameter3 = + transform(originalParameters.Parameter3, vtkm::internal::IndexTag<3>()); + transformedParameters.Parameter4 = + transform(originalParameters.Parameter4, vtkm::internal::IndexTag<4>()); + transformedParameters.Parameter5 = + transform(originalParameters.Parameter5, vtkm::internal::IndexTag<5>()); + transformedParameters.Parameter6 = + transform(originalParameters.Parameter6, vtkm::internal::IndexTag<6>()); + transformedParameters.Parameter7 = + transform(originalParameters.Parameter7, vtkm::internal::IndexTag<7>()); + transformedParameters.Parameter8 = + transform(originalParameters.Parameter8, vtkm::internal::IndexTag<8>()); + transformedParameters.Parameter9 = + transform(originalParameters.Parameter9, vtkm::internal::IndexTag<9>()); + transformedParameters.Parameter10 = + transform(originalParameters.Parameter10, vtkm::internal::IndexTag<10>()); + transformedParameters.Parameter11 = + transform(originalParameters.Parameter11, vtkm::internal::IndexTag<11>()); + transformedParameters.Parameter12 = + transform(originalParameters.Parameter12, vtkm::internal::IndexTag<12>()); + transformedParameters.Parameter13 = + transform(originalParameters.Parameter13, vtkm::internal::IndexTag<13>()); + transformedParameters.Parameter14 = + transform(originalParameters.Parameter14, vtkm::internal::IndexTag<14>()); + transformedParameters.Parameter15 = + transform(originalParameters.Parameter15, vtkm::internal::IndexTag<15>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoStaticTransformCont( + const Transform& transform, + const ParameterContainer& originalParameters, + ParameterContainer& transformedParameters) +{ + transformedParameters.Parameter1 = + transform(originalParameters.Parameter1, vtkm::internal::IndexTag<1>()); + transformedParameters.Parameter2 = + transform(originalParameters.Parameter2, vtkm::internal::IndexTag<2>()); + transformedParameters.Parameter3 = + transform(originalParameters.Parameter3, vtkm::internal::IndexTag<3>()); + transformedParameters.Parameter4 = + transform(originalParameters.Parameter4, vtkm::internal::IndexTag<4>()); + transformedParameters.Parameter5 = + transform(originalParameters.Parameter5, vtkm::internal::IndexTag<5>()); + transformedParameters.Parameter6 = + transform(originalParameters.Parameter6, vtkm::internal::IndexTag<6>()); + transformedParameters.Parameter7 = + transform(originalParameters.Parameter7, vtkm::internal::IndexTag<7>()); + transformedParameters.Parameter8 = + transform(originalParameters.Parameter8, vtkm::internal::IndexTag<8>()); + transformedParameters.Parameter9 = + transform(originalParameters.Parameter9, vtkm::internal::IndexTag<9>()); + transformedParameters.Parameter10 = + transform(originalParameters.Parameter10, vtkm::internal::IndexTag<10>()); + transformedParameters.Parameter11 = + transform(originalParameters.Parameter11, vtkm::internal::IndexTag<11>()); + transformedParameters.Parameter12 = + transform(originalParameters.Parameter12, vtkm::internal::IndexTag<12>()); + transformedParameters.Parameter13 = + transform(originalParameters.Parameter13, vtkm::internal::IndexTag<13>()); + transformedParameters.Parameter14 = + transform(originalParameters.Parameter14, vtkm::internal::IndexTag<14>()); + transformedParameters.Parameter15 = + transform(originalParameters.Parameter15, vtkm::internal::IndexTag<15>()); + transformedParameters.Parameter16 = + transform(originalParameters.Parameter16, vtkm::internal::IndexTag<16>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoStaticTransformExec( + const Transform& transform, + const ParameterContainer& originalParameters, + ParameterContainer& transformedParameters) +{ + transformedParameters.Parameter1 = + transform(originalParameters.Parameter1, vtkm::internal::IndexTag<1>()); + transformedParameters.Parameter2 = + transform(originalParameters.Parameter2, vtkm::internal::IndexTag<2>()); + transformedParameters.Parameter3 = + transform(originalParameters.Parameter3, vtkm::internal::IndexTag<3>()); + transformedParameters.Parameter4 = + transform(originalParameters.Parameter4, vtkm::internal::IndexTag<4>()); + transformedParameters.Parameter5 = + transform(originalParameters.Parameter5, vtkm::internal::IndexTag<5>()); + transformedParameters.Parameter6 = + transform(originalParameters.Parameter6, vtkm::internal::IndexTag<6>()); + transformedParameters.Parameter7 = + transform(originalParameters.Parameter7, vtkm::internal::IndexTag<7>()); + transformedParameters.Parameter8 = + transform(originalParameters.Parameter8, vtkm::internal::IndexTag<8>()); + transformedParameters.Parameter9 = + transform(originalParameters.Parameter9, vtkm::internal::IndexTag<9>()); + transformedParameters.Parameter10 = + transform(originalParameters.Parameter10, vtkm::internal::IndexTag<10>()); + transformedParameters.Parameter11 = + transform(originalParameters.Parameter11, vtkm::internal::IndexTag<11>()); + transformedParameters.Parameter12 = + transform(originalParameters.Parameter12, vtkm::internal::IndexTag<12>()); + transformedParameters.Parameter13 = + transform(originalParameters.Parameter13, vtkm::internal::IndexTag<13>()); + transformedParameters.Parameter14 = + transform(originalParameters.Parameter14, vtkm::internal::IndexTag<14>()); + transformedParameters.Parameter15 = + transform(originalParameters.Parameter15, vtkm::internal::IndexTag<15>()); + transformedParameters.Parameter16 = + transform(originalParameters.Parameter16, vtkm::internal::IndexTag<16>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoStaticTransformCont( + const Transform& transform, + const ParameterContainer& originalParameters, + ParameterContainer& transformedParameters) +{ + transformedParameters.Parameter1 = + transform(originalParameters.Parameter1, vtkm::internal::IndexTag<1>()); + transformedParameters.Parameter2 = + transform(originalParameters.Parameter2, vtkm::internal::IndexTag<2>()); + transformedParameters.Parameter3 = + transform(originalParameters.Parameter3, vtkm::internal::IndexTag<3>()); + transformedParameters.Parameter4 = + transform(originalParameters.Parameter4, vtkm::internal::IndexTag<4>()); + transformedParameters.Parameter5 = + transform(originalParameters.Parameter5, vtkm::internal::IndexTag<5>()); + transformedParameters.Parameter6 = + transform(originalParameters.Parameter6, vtkm::internal::IndexTag<6>()); + transformedParameters.Parameter7 = + transform(originalParameters.Parameter7, vtkm::internal::IndexTag<7>()); + transformedParameters.Parameter8 = + transform(originalParameters.Parameter8, vtkm::internal::IndexTag<8>()); + transformedParameters.Parameter9 = + transform(originalParameters.Parameter9, vtkm::internal::IndexTag<9>()); + transformedParameters.Parameter10 = + transform(originalParameters.Parameter10, vtkm::internal::IndexTag<10>()); + transformedParameters.Parameter11 = + transform(originalParameters.Parameter11, vtkm::internal::IndexTag<11>()); + transformedParameters.Parameter12 = + transform(originalParameters.Parameter12, vtkm::internal::IndexTag<12>()); + transformedParameters.Parameter13 = + transform(originalParameters.Parameter13, vtkm::internal::IndexTag<13>()); + transformedParameters.Parameter14 = + transform(originalParameters.Parameter14, vtkm::internal::IndexTag<14>()); + transformedParameters.Parameter15 = + transform(originalParameters.Parameter15, vtkm::internal::IndexTag<15>()); + transformedParameters.Parameter16 = + transform(originalParameters.Parameter16, vtkm::internal::IndexTag<16>()); + transformedParameters.Parameter17 = + transform(originalParameters.Parameter17, vtkm::internal::IndexTag<17>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoStaticTransformExec( + const Transform& transform, + const ParameterContainer& originalParameters, + ParameterContainer& transformedParameters) +{ + transformedParameters.Parameter1 = + transform(originalParameters.Parameter1, vtkm::internal::IndexTag<1>()); + transformedParameters.Parameter2 = + transform(originalParameters.Parameter2, vtkm::internal::IndexTag<2>()); + transformedParameters.Parameter3 = + transform(originalParameters.Parameter3, vtkm::internal::IndexTag<3>()); + transformedParameters.Parameter4 = + transform(originalParameters.Parameter4, vtkm::internal::IndexTag<4>()); + transformedParameters.Parameter5 = + transform(originalParameters.Parameter5, vtkm::internal::IndexTag<5>()); + transformedParameters.Parameter6 = + transform(originalParameters.Parameter6, vtkm::internal::IndexTag<6>()); + transformedParameters.Parameter7 = + transform(originalParameters.Parameter7, vtkm::internal::IndexTag<7>()); + transformedParameters.Parameter8 = + transform(originalParameters.Parameter8, vtkm::internal::IndexTag<8>()); + transformedParameters.Parameter9 = + transform(originalParameters.Parameter9, vtkm::internal::IndexTag<9>()); + transformedParameters.Parameter10 = + transform(originalParameters.Parameter10, vtkm::internal::IndexTag<10>()); + transformedParameters.Parameter11 = + transform(originalParameters.Parameter11, vtkm::internal::IndexTag<11>()); + transformedParameters.Parameter12 = + transform(originalParameters.Parameter12, vtkm::internal::IndexTag<12>()); + transformedParameters.Parameter13 = + transform(originalParameters.Parameter13, vtkm::internal::IndexTag<13>()); + transformedParameters.Parameter14 = + transform(originalParameters.Parameter14, vtkm::internal::IndexTag<14>()); + transformedParameters.Parameter15 = + transform(originalParameters.Parameter15, vtkm::internal::IndexTag<15>()); + transformedParameters.Parameter16 = + transform(originalParameters.Parameter16, vtkm::internal::IndexTag<16>()); + transformedParameters.Parameter17 = + transform(originalParameters.Parameter17, vtkm::internal::IndexTag<17>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoStaticTransformCont( + const Transform& transform, + const ParameterContainer& originalParameters, + ParameterContainer& transformedParameters) +{ + transformedParameters.Parameter1 = + transform(originalParameters.Parameter1, vtkm::internal::IndexTag<1>()); + transformedParameters.Parameter2 = + transform(originalParameters.Parameter2, vtkm::internal::IndexTag<2>()); + transformedParameters.Parameter3 = + transform(originalParameters.Parameter3, vtkm::internal::IndexTag<3>()); + transformedParameters.Parameter4 = + transform(originalParameters.Parameter4, vtkm::internal::IndexTag<4>()); + transformedParameters.Parameter5 = + transform(originalParameters.Parameter5, vtkm::internal::IndexTag<5>()); + transformedParameters.Parameter6 = + transform(originalParameters.Parameter6, vtkm::internal::IndexTag<6>()); + transformedParameters.Parameter7 = + transform(originalParameters.Parameter7, vtkm::internal::IndexTag<7>()); + transformedParameters.Parameter8 = + transform(originalParameters.Parameter8, vtkm::internal::IndexTag<8>()); + transformedParameters.Parameter9 = + transform(originalParameters.Parameter9, vtkm::internal::IndexTag<9>()); + transformedParameters.Parameter10 = + transform(originalParameters.Parameter10, vtkm::internal::IndexTag<10>()); + transformedParameters.Parameter11 = + transform(originalParameters.Parameter11, vtkm::internal::IndexTag<11>()); + transformedParameters.Parameter12 = + transform(originalParameters.Parameter12, vtkm::internal::IndexTag<12>()); + transformedParameters.Parameter13 = + transform(originalParameters.Parameter13, vtkm::internal::IndexTag<13>()); + transformedParameters.Parameter14 = + transform(originalParameters.Parameter14, vtkm::internal::IndexTag<14>()); + transformedParameters.Parameter15 = + transform(originalParameters.Parameter15, vtkm::internal::IndexTag<15>()); + transformedParameters.Parameter16 = + transform(originalParameters.Parameter16, vtkm::internal::IndexTag<16>()); + transformedParameters.Parameter17 = + transform(originalParameters.Parameter17, vtkm::internal::IndexTag<17>()); + transformedParameters.Parameter18 = + transform(originalParameters.Parameter18, vtkm::internal::IndexTag<18>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoStaticTransformExec( + const Transform& transform, + const ParameterContainer& originalParameters, + ParameterContainer& transformedParameters) +{ + transformedParameters.Parameter1 = + transform(originalParameters.Parameter1, vtkm::internal::IndexTag<1>()); + transformedParameters.Parameter2 = + transform(originalParameters.Parameter2, vtkm::internal::IndexTag<2>()); + transformedParameters.Parameter3 = + transform(originalParameters.Parameter3, vtkm::internal::IndexTag<3>()); + transformedParameters.Parameter4 = + transform(originalParameters.Parameter4, vtkm::internal::IndexTag<4>()); + transformedParameters.Parameter5 = + transform(originalParameters.Parameter5, vtkm::internal::IndexTag<5>()); + transformedParameters.Parameter6 = + transform(originalParameters.Parameter6, vtkm::internal::IndexTag<6>()); + transformedParameters.Parameter7 = + transform(originalParameters.Parameter7, vtkm::internal::IndexTag<7>()); + transformedParameters.Parameter8 = + transform(originalParameters.Parameter8, vtkm::internal::IndexTag<8>()); + transformedParameters.Parameter9 = + transform(originalParameters.Parameter9, vtkm::internal::IndexTag<9>()); + transformedParameters.Parameter10 = + transform(originalParameters.Parameter10, vtkm::internal::IndexTag<10>()); + transformedParameters.Parameter11 = + transform(originalParameters.Parameter11, vtkm::internal::IndexTag<11>()); + transformedParameters.Parameter12 = + transform(originalParameters.Parameter12, vtkm::internal::IndexTag<12>()); + transformedParameters.Parameter13 = + transform(originalParameters.Parameter13, vtkm::internal::IndexTag<13>()); + transformedParameters.Parameter14 = + transform(originalParameters.Parameter14, vtkm::internal::IndexTag<14>()); + transformedParameters.Parameter15 = + transform(originalParameters.Parameter15, vtkm::internal::IndexTag<15>()); + transformedParameters.Parameter16 = + transform(originalParameters.Parameter16, vtkm::internal::IndexTag<16>()); + transformedParameters.Parameter17 = + transform(originalParameters.Parameter17, vtkm::internal::IndexTag<17>()); + transformedParameters.Parameter18 = + transform(originalParameters.Parameter18, vtkm::internal::IndexTag<18>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoStaticTransformCont( + const Transform& transform, + const ParameterContainer& originalParameters, + ParameterContainer& transformedParameters) +{ + transformedParameters.Parameter1 = + transform(originalParameters.Parameter1, vtkm::internal::IndexTag<1>()); + transformedParameters.Parameter2 = + transform(originalParameters.Parameter2, vtkm::internal::IndexTag<2>()); + transformedParameters.Parameter3 = + transform(originalParameters.Parameter3, vtkm::internal::IndexTag<3>()); + transformedParameters.Parameter4 = + transform(originalParameters.Parameter4, vtkm::internal::IndexTag<4>()); + transformedParameters.Parameter5 = + transform(originalParameters.Parameter5, vtkm::internal::IndexTag<5>()); + transformedParameters.Parameter6 = + transform(originalParameters.Parameter6, vtkm::internal::IndexTag<6>()); + transformedParameters.Parameter7 = + transform(originalParameters.Parameter7, vtkm::internal::IndexTag<7>()); + transformedParameters.Parameter8 = + transform(originalParameters.Parameter8, vtkm::internal::IndexTag<8>()); + transformedParameters.Parameter9 = + transform(originalParameters.Parameter9, vtkm::internal::IndexTag<9>()); + transformedParameters.Parameter10 = + transform(originalParameters.Parameter10, vtkm::internal::IndexTag<10>()); + transformedParameters.Parameter11 = + transform(originalParameters.Parameter11, vtkm::internal::IndexTag<11>()); + transformedParameters.Parameter12 = + transform(originalParameters.Parameter12, vtkm::internal::IndexTag<12>()); + transformedParameters.Parameter13 = + transform(originalParameters.Parameter13, vtkm::internal::IndexTag<13>()); + transformedParameters.Parameter14 = + transform(originalParameters.Parameter14, vtkm::internal::IndexTag<14>()); + transformedParameters.Parameter15 = + transform(originalParameters.Parameter15, vtkm::internal::IndexTag<15>()); + transformedParameters.Parameter16 = + transform(originalParameters.Parameter16, vtkm::internal::IndexTag<16>()); + transformedParameters.Parameter17 = + transform(originalParameters.Parameter17, vtkm::internal::IndexTag<17>()); + transformedParameters.Parameter18 = + transform(originalParameters.Parameter18, vtkm::internal::IndexTag<18>()); + transformedParameters.Parameter19 = + transform(originalParameters.Parameter19, vtkm::internal::IndexTag<19>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoStaticTransformExec( + const Transform& transform, + const ParameterContainer& originalParameters, + ParameterContainer& transformedParameters) +{ + transformedParameters.Parameter1 = + transform(originalParameters.Parameter1, vtkm::internal::IndexTag<1>()); + transformedParameters.Parameter2 = + transform(originalParameters.Parameter2, vtkm::internal::IndexTag<2>()); + transformedParameters.Parameter3 = + transform(originalParameters.Parameter3, vtkm::internal::IndexTag<3>()); + transformedParameters.Parameter4 = + transform(originalParameters.Parameter4, vtkm::internal::IndexTag<4>()); + transformedParameters.Parameter5 = + transform(originalParameters.Parameter5, vtkm::internal::IndexTag<5>()); + transformedParameters.Parameter6 = + transform(originalParameters.Parameter6, vtkm::internal::IndexTag<6>()); + transformedParameters.Parameter7 = + transform(originalParameters.Parameter7, vtkm::internal::IndexTag<7>()); + transformedParameters.Parameter8 = + transform(originalParameters.Parameter8, vtkm::internal::IndexTag<8>()); + transformedParameters.Parameter9 = + transform(originalParameters.Parameter9, vtkm::internal::IndexTag<9>()); + transformedParameters.Parameter10 = + transform(originalParameters.Parameter10, vtkm::internal::IndexTag<10>()); + transformedParameters.Parameter11 = + transform(originalParameters.Parameter11, vtkm::internal::IndexTag<11>()); + transformedParameters.Parameter12 = + transform(originalParameters.Parameter12, vtkm::internal::IndexTag<12>()); + transformedParameters.Parameter13 = + transform(originalParameters.Parameter13, vtkm::internal::IndexTag<13>()); + transformedParameters.Parameter14 = + transform(originalParameters.Parameter14, vtkm::internal::IndexTag<14>()); + transformedParameters.Parameter15 = + transform(originalParameters.Parameter15, vtkm::internal::IndexTag<15>()); + transformedParameters.Parameter16 = + transform(originalParameters.Parameter16, vtkm::internal::IndexTag<16>()); + transformedParameters.Parameter17 = + transform(originalParameters.Parameter17, vtkm::internal::IndexTag<17>()); + transformedParameters.Parameter18 = + transform(originalParameters.Parameter18, vtkm::internal::IndexTag<18>()); + transformedParameters.Parameter19 = + transform(originalParameters.Parameter19, vtkm::internal::IndexTag<19>()); +} + // clang-format on //============================================================================ @@ -3994,6 +9711,1526 @@ VTKM_EXEC void DoForEachExec( f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); } +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoForEachCont( + const Functor& f, + const ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoForEachCont( + const Functor& f, + ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoForEachExec( + const Functor& f, + const ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoForEachExec( + const Functor& f, + ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoForEachCont( + const Functor& f, + const ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoForEachCont( + const Functor& f, + ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoForEachExec( + const Functor& f, + const ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoForEachExec( + const Functor& f, + ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoForEachCont( + const Functor& f, + const ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoForEachCont( + const Functor& f, + ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoForEachExec( + const Functor& f, + const ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoForEachExec( + const Functor& f, + ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoForEachCont( + const Functor& f, + const ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoForEachCont( + const Functor& f, + ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoForEachExec( + const Functor& f, + const ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoForEachExec( + const Functor& f, + ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoForEachCont( + const Functor& f, + const ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); + f(parameters.Parameter14, vtkm::internal::IndexTag<14>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoForEachCont( + const Functor& f, + ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); + f(parameters.Parameter14, vtkm::internal::IndexTag<14>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoForEachExec( + const Functor& f, + const ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); + f(parameters.Parameter14, vtkm::internal::IndexTag<14>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoForEachExec( + const Functor& f, + ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); + f(parameters.Parameter14, vtkm::internal::IndexTag<14>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoForEachCont( + const Functor& f, + const ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); + f(parameters.Parameter14, vtkm::internal::IndexTag<14>()); + f(parameters.Parameter15, vtkm::internal::IndexTag<15>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoForEachCont( + const Functor& f, + ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); + f(parameters.Parameter14, vtkm::internal::IndexTag<14>()); + f(parameters.Parameter15, vtkm::internal::IndexTag<15>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoForEachExec( + const Functor& f, + const ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); + f(parameters.Parameter14, vtkm::internal::IndexTag<14>()); + f(parameters.Parameter15, vtkm::internal::IndexTag<15>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoForEachExec( + const Functor& f, + ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); + f(parameters.Parameter14, vtkm::internal::IndexTag<14>()); + f(parameters.Parameter15, vtkm::internal::IndexTag<15>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoForEachCont( + const Functor& f, + const ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); + f(parameters.Parameter14, vtkm::internal::IndexTag<14>()); + f(parameters.Parameter15, vtkm::internal::IndexTag<15>()); + f(parameters.Parameter16, vtkm::internal::IndexTag<16>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoForEachCont( + const Functor& f, + ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); + f(parameters.Parameter14, vtkm::internal::IndexTag<14>()); + f(parameters.Parameter15, vtkm::internal::IndexTag<15>()); + f(parameters.Parameter16, vtkm::internal::IndexTag<16>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoForEachExec( + const Functor& f, + const ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); + f(parameters.Parameter14, vtkm::internal::IndexTag<14>()); + f(parameters.Parameter15, vtkm::internal::IndexTag<15>()); + f(parameters.Parameter16, vtkm::internal::IndexTag<16>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoForEachExec( + const Functor& f, + ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); + f(parameters.Parameter14, vtkm::internal::IndexTag<14>()); + f(parameters.Parameter15, vtkm::internal::IndexTag<15>()); + f(parameters.Parameter16, vtkm::internal::IndexTag<16>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoForEachCont( + const Functor& f, + const ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); + f(parameters.Parameter14, vtkm::internal::IndexTag<14>()); + f(parameters.Parameter15, vtkm::internal::IndexTag<15>()); + f(parameters.Parameter16, vtkm::internal::IndexTag<16>()); + f(parameters.Parameter17, vtkm::internal::IndexTag<17>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoForEachCont( + const Functor& f, + ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); + f(parameters.Parameter14, vtkm::internal::IndexTag<14>()); + f(parameters.Parameter15, vtkm::internal::IndexTag<15>()); + f(parameters.Parameter16, vtkm::internal::IndexTag<16>()); + f(parameters.Parameter17, vtkm::internal::IndexTag<17>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoForEachExec( + const Functor& f, + const ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); + f(parameters.Parameter14, vtkm::internal::IndexTag<14>()); + f(parameters.Parameter15, vtkm::internal::IndexTag<15>()); + f(parameters.Parameter16, vtkm::internal::IndexTag<16>()); + f(parameters.Parameter17, vtkm::internal::IndexTag<17>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoForEachExec( + const Functor& f, + ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); + f(parameters.Parameter14, vtkm::internal::IndexTag<14>()); + f(parameters.Parameter15, vtkm::internal::IndexTag<15>()); + f(parameters.Parameter16, vtkm::internal::IndexTag<16>()); + f(parameters.Parameter17, vtkm::internal::IndexTag<17>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoForEachCont( + const Functor& f, + const ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); + f(parameters.Parameter14, vtkm::internal::IndexTag<14>()); + f(parameters.Parameter15, vtkm::internal::IndexTag<15>()); + f(parameters.Parameter16, vtkm::internal::IndexTag<16>()); + f(parameters.Parameter17, vtkm::internal::IndexTag<17>()); + f(parameters.Parameter18, vtkm::internal::IndexTag<18>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoForEachCont( + const Functor& f, + ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); + f(parameters.Parameter14, vtkm::internal::IndexTag<14>()); + f(parameters.Parameter15, vtkm::internal::IndexTag<15>()); + f(parameters.Parameter16, vtkm::internal::IndexTag<16>()); + f(parameters.Parameter17, vtkm::internal::IndexTag<17>()); + f(parameters.Parameter18, vtkm::internal::IndexTag<18>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoForEachExec( + const Functor& f, + const ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); + f(parameters.Parameter14, vtkm::internal::IndexTag<14>()); + f(parameters.Parameter15, vtkm::internal::IndexTag<15>()); + f(parameters.Parameter16, vtkm::internal::IndexTag<16>()); + f(parameters.Parameter17, vtkm::internal::IndexTag<17>()); + f(parameters.Parameter18, vtkm::internal::IndexTag<18>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoForEachExec( + const Functor& f, + ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); + f(parameters.Parameter14, vtkm::internal::IndexTag<14>()); + f(parameters.Parameter15, vtkm::internal::IndexTag<15>()); + f(parameters.Parameter16, vtkm::internal::IndexTag<16>()); + f(parameters.Parameter17, vtkm::internal::IndexTag<17>()); + f(parameters.Parameter18, vtkm::internal::IndexTag<18>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoForEachCont( + const Functor& f, + const ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); + f(parameters.Parameter14, vtkm::internal::IndexTag<14>()); + f(parameters.Parameter15, vtkm::internal::IndexTag<15>()); + f(parameters.Parameter16, vtkm::internal::IndexTag<16>()); + f(parameters.Parameter17, vtkm::internal::IndexTag<17>()); + f(parameters.Parameter18, vtkm::internal::IndexTag<18>()); + f(parameters.Parameter19, vtkm::internal::IndexTag<19>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_CONT void DoForEachCont( + const Functor& f, + ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); + f(parameters.Parameter14, vtkm::internal::IndexTag<14>()); + f(parameters.Parameter15, vtkm::internal::IndexTag<15>()); + f(parameters.Parameter16, vtkm::internal::IndexTag<16>()); + f(parameters.Parameter17, vtkm::internal::IndexTag<17>()); + f(parameters.Parameter18, vtkm::internal::IndexTag<18>()); + f(parameters.Parameter19, vtkm::internal::IndexTag<19>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoForEachExec( + const Functor& f, + const ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); + f(parameters.Parameter14, vtkm::internal::IndexTag<14>()); + f(parameters.Parameter15, vtkm::internal::IndexTag<15>()); + f(parameters.Parameter16, vtkm::internal::IndexTag<16>()); + f(parameters.Parameter17, vtkm::internal::IndexTag<17>()); + f(parameters.Parameter18, vtkm::internal::IndexTag<18>()); + f(parameters.Parameter19, vtkm::internal::IndexTag<19>()); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC void DoForEachExec( + const Functor& f, + ParameterContainer& parameters) +{ + f(parameters.Parameter1, vtkm::internal::IndexTag<1>()); + f(parameters.Parameter2, vtkm::internal::IndexTag<2>()); + f(parameters.Parameter3, vtkm::internal::IndexTag<3>()); + f(parameters.Parameter4, vtkm::internal::IndexTag<4>()); + f(parameters.Parameter5, vtkm::internal::IndexTag<5>()); + f(parameters.Parameter6, vtkm::internal::IndexTag<6>()); + f(parameters.Parameter7, vtkm::internal::IndexTag<7>()); + f(parameters.Parameter8, vtkm::internal::IndexTag<8>()); + f(parameters.Parameter9, vtkm::internal::IndexTag<9>()); + f(parameters.Parameter10, vtkm::internal::IndexTag<10>()); + f(parameters.Parameter11, vtkm::internal::IndexTag<11>()); + f(parameters.Parameter12, vtkm::internal::IndexTag<12>()); + f(parameters.Parameter13, vtkm::internal::IndexTag<13>()); + f(parameters.Parameter14, vtkm::internal::IndexTag<14>()); + f(parameters.Parameter15, vtkm::internal::IndexTag<15>()); + f(parameters.Parameter16, vtkm::internal::IndexTag<16>()); + f(parameters.Parameter17, vtkm::internal::IndexTag<17>()); + f(parameters.Parameter18, vtkm::internal::IndexTag<18>()); + f(parameters.Parameter19, vtkm::internal::IndexTag<19>()); +} + // clang-format on diff --git a/vtkm/internal/FunctionInterfaceDetailPre.h.in b/vtkm/internal/FunctionInterfaceDetailPre.h.in index 911cc5b78..c4fc1a477 100644 --- a/vtkm/internal/FunctionInterfaceDetailPre.h.in +++ b/vtkm/internal/FunctionInterfaceDetailPre.h.in @@ -46,7 +46,7 @@ $# Ignore the following comment. It is meant for the generated file. #include -$py(max_parameters=10)\ +$py(max_parameters=20)\ #define VTKM_MAX_FUNCTION_PARAMETERS $(max_parameters) $# Python commands used in template expansion. @@ -123,6 +123,8 @@ $for(num_params in range(0, max_parameters+1))\ template <$template_params(num_params)> struct ParameterContainer<$signature(num_params)> { + VTKM_SUPPRESS_EXEC_WARNINGS + ~ParameterContainer() = default; $for(param_index in range(1, num_params+1))\ $ptype(param_index) Parameter$(param_index); $endfor\ diff --git a/vtkm/io/writer/VTKDataSetWriter.h b/vtkm/io/writer/VTKDataSetWriter.h index 91ddc9586..470ee9dc4 100644 --- a/vtkm/io/writer/VTKDataSetWriter.h +++ b/vtkm/io/writer/VTKDataSetWriter.h @@ -161,17 +161,13 @@ private: { ///\todo: support other coordinate systems int cindex = 0; - - vtkm::cont::CoordinateSystem coords = dataSet.GetCoordinateSystem(cindex); - vtkm::cont::DynamicArrayHandleCoordinateSystem cdata = coords.GetData(); + auto cdata = dataSet.GetCoordinateSystem(cindex).GetData(); vtkm::Id npoints = cdata.GetNumberOfValues(); + out << "POINTS " << npoints << " " + << vtkm::io::internal::DataTypeName::Name() << " " << std::endl; - std::string typeName; - vtkm::cont::CastAndCall(cdata, detail::GetDataTypeName(typeName)); - - out << "POINTS " << npoints << " " << typeName << " " << std::endl; - vtkm::cont::CastAndCall(cdata, detail::OutputPointsFunctor(out)); + detail::OutputPointsFunctor{ out }(cdata); } template diff --git a/vtkm/rendering/CMakeLists.txt b/vtkm/rendering/CMakeLists.txt index 6ee0a1d91..1ddd33878 100644 --- a/vtkm/rendering/CMakeLists.txt +++ b/vtkm/rendering/CMakeLists.txt @@ -87,25 +87,19 @@ set(sources BitmapFontFactory.cxx BoundingBoxAnnotation.cxx Camera.cxx - Canvas.cxx - CanvasRayTracer.cxx Color.cxx ColorBarAnnotation.cxx ColorLegendAnnotation.cxx ColorTable.cxx - ConnectivityProxy.cxx DecodePNG.cxx LineRenderer.cxx - Mapper.cxx + MapperConnectivity.cxx MapperRayTracer.cxx MapperVolume.cxx - MapperConnectivity.cxx - MapperWireframer.cxx Scene.cxx TextAnnotation.cxx TextAnnotationBillboard.cxx TextAnnotationScreen.cxx - TextRenderer.cxx View.cxx View1D.cxx View2D.cxx @@ -113,13 +107,10 @@ set(sources WorldAnnotator.cxx internal/RunTriangulator.cxx - raytracing/BoundingVolumeHierarchy.cxx - raytracing/Camera.cxx - raytracing/ChannelBuffer.cxx + raytracing/ConnectivityBase.cxx + raytracing/ConnectivityTracerBase.cxx + raytracing/ConnectivityTracerFactory.cxx raytracing/Logger.cxx - raytracing/RayTracer.cxx - raytracing/RayOperations.cxx - raytracing/VolumeRendererStructured.cxx ) # Note that EGL and OSMesa Canvas depend on the GL version being built. Only @@ -157,18 +148,20 @@ set(osmesa_sources # This list of sources has code that uses devices and so might need to be # compiled with a device-specific compiler (like CUDA). set(device_sources - Mapper.cxx - MapperWireframer.cxx Canvas.cxx CanvasRayTracer.cxx ConnectivityProxy.cxx + Mapper.cxx + MapperWireframer.cxx TextRenderer.cxx + raytracing/BoundingVolumeHierarchy.cxx raytracing/Camera.cxx raytracing/ChannelBuffer.cxx - raytracing/VolumeRendererStructured.cxx + raytracing/ConnectivityTracer.cxx raytracing/RayOperations.cxx raytracing/RayTracer.cxx + raytracing/VolumeRendererStructured.cxx ) #----------------------------------------------------------------------------- diff --git a/vtkm/rendering/CanvasRayTracer.cxx b/vtkm/rendering/CanvasRayTracer.cxx index e8763b237..dc1640cc3 100644 --- a/vtkm/rendering/CanvasRayTracer.cxx +++ b/vtkm/rendering/CanvasRayTracer.cxx @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -51,19 +50,21 @@ public: FieldIn<>, FieldIn<>, FieldIn<>, - ExecObject, - ExecObject); + WholeArrayOut>, + WholeArrayOut>>); typedef void ExecutionSignature(_1, _2, _3, _4, _5, _6, _7, WorkIndex); - template - VTKM_EXEC void operator()( - const vtkm::Id& pixelIndex, - ColorPortalType& colorBufferIn, - const Precision& inDepth, - const vtkm::Vec& origin, - const vtkm::Vec& dir, - vtkm::exec::ExecutionWholeArray& depthBuffer, - vtkm::exec::ExecutionWholeArray>& colorBuffer, - const vtkm::Id& index) const + template + VTKM_EXEC void operator()(const vtkm::Id& pixelIndex, + ColorPortalType& colorBufferIn, + const Precision& inDepth, + const vtkm::Vec& origin, + const vtkm::Vec& dir, + DepthBufferPortalType& depthBuffer, + ColorBufferPortalType& colorBuffer, + const vtkm::Id& index) const { vtkm::Vec intersection = origin + inDepth * dir; vtkm::Vec point; @@ -140,14 +141,13 @@ public: { VTKM_IS_DEVICE_ADAPTER_TAG(Device); vtkm::worklet::DispatcherMapField(SurfaceConverter(ViewProjMat)) - .Invoke( - Rays.PixelIdx, - Colors, - Rays.Distance, - Rays.Origin, - Rays.Dir, - vtkm::exec::ExecutionWholeArray(Canvas->GetDepthBuffer()), - vtkm::exec::ExecutionWholeArray>(Canvas->GetColorBuffer())); + .Invoke(Rays.PixelIdx, + Colors, + Rays.Distance, + Rays.Origin, + Rays.Dir, + Canvas->GetDepthBuffer(), + Canvas->GetColorBuffer()); return true; } }; diff --git a/vtkm/rendering/ConnectivityProxy.cxx b/vtkm/rendering/ConnectivityProxy.cxx index c63dea63c..8e2105ab0 100644 --- a/vtkm/rendering/ConnectivityProxy.cxx +++ b/vtkm/rendering/ConnectivityProxy.cxx @@ -25,6 +25,8 @@ #include #include #include +#include + namespace vtkm { @@ -66,7 +68,7 @@ protected: { VTKM_IS_DEVICE_ADAPTER_TAG(Device); - Internals->SpatialBounds = Internals->Coords.GetBounds(Device()); + Internals->SpatialBounds = Internals->Coords.GetBounds(); return true; } }; diff --git a/vtkm/rendering/MapperGL.cxx b/vtkm/rendering/MapperGL.cxx index cf519723c..1b7a44a12 100644 --- a/vtkm/rendering/MapperGL.cxx +++ b/vtkm/rendering/MapperGL.cxx @@ -432,7 +432,7 @@ void MapperGL::RenderCells(const vtkm::cont::DynamicCellSet& cellset, { vtkm::cont::ArrayHandle sf; sf = scalarField.GetData().Cast>(); - vtkm::cont::DynamicArrayHandleCoordinateSystem dcoords = coords.GetData(); + auto dcoords = coords.GetData(); vtkm::Id numVerts = coords.GetData().GetNumberOfValues(); //Handle 1D cases. @@ -459,20 +459,20 @@ void MapperGL::RenderCells(const vtkm::cont::DynamicCellSet& cellset, vtkm::cont::ArrayHandleUniformPointCoordinates uVerts; vtkm::cont::ArrayHandle> eVerts; - if (dcoords.IsSameType(vtkm::cont::ArrayHandleUniformPointCoordinates())) + if (dcoords.IsSameType()) { uVerts = dcoords.Cast(); RenderTriangles(*this, numTri, uVerts, indices, sf, colorTable, scalarRange, camera); } - else if (dcoords.IsSameType(vtkm::cont::ArrayHandle>())) + else if (dcoords.IsSameType>>()) { eVerts = dcoords.Cast>>(); RenderTriangles(*this, numTri, eVerts, indices, sf, colorTable, scalarRange, camera); } - else if (dcoords.IsSameType(vtkm::cont::ArrayHandleCartesianProduct< - vtkm::cont::ArrayHandle, - vtkm::cont::ArrayHandle, - vtkm::cont::ArrayHandle>())) + else if (dcoords.IsSameType, + vtkm::cont::ArrayHandle, + vtkm::cont::ArrayHandle>>()) { vtkm::cont::ArrayHandleCartesianProduct, vtkm::cont::ArrayHandle, diff --git a/vtkm/rendering/Triangulator.h b/vtkm/rendering/Triangulator.h index e181c8f44..cb3fa7376 100644 --- a/vtkm/rendering/Triangulator.h +++ b/vtkm/rendering/Triangulator.h @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -276,17 +275,21 @@ public: public: VTKM_CONT UniqueTriangles() {} - typedef void ControlSignature(ExecObject, ExecObject); + + typedef void ControlSignature(WholeArrayIn>>, + WholeArrayOut>); typedef void ExecutionSignature(_1, _2, WorkIndex); + VTKM_EXEC bool IsTwin(const vtkm::Vec& a, const vtkm::Vec& b) const { return (a[1] == b[1] && a[2] == b[2] && a[3] == b[3]); } - VTKM_EXEC - void operator()(vtkm::exec::ExecutionWholeArrayConst>& indices, - vtkm::exec::ExecutionWholeArray& outputFlags, - const vtkm::Id& index) const + + template + VTKM_EXEC void operator()(const IndicesPortalType& indices, + OutputFlagsPortalType& outputFlags, + const vtkm::Id& index) const { if (index == 0) return; @@ -612,9 +615,7 @@ public: flags.Allocate(outputTriangles); vtkm::worklet::DispatcherMapField>(MemSet(1)).Invoke(flags); //Unique triangles will have a flag = 1 - vtkm::worklet::DispatcherMapField().Invoke( - vtkm::exec::ExecutionWholeArrayConst>(outputIndices), - vtkm::exec::ExecutionWholeArray(flags)); + vtkm::worklet::DispatcherMapField().Invoke(outputIndices, flags); vtkm::cont::ArrayHandle> subset; vtkm::cont::DeviceAdapterAlgorithm::CopyIf(outputIndices, flags, subset); diff --git a/vtkm/rendering/Wireframer.h b/vtkm/rendering/Wireframer.h index 6eae48dd8..980b9069a 100644 --- a/vtkm/rendering/Wireframer.h +++ b/vtkm/rendering/Wireframer.h @@ -74,6 +74,7 @@ vtkm::UInt32 ScaleColorComponent(vtkm::Float32 c) return vtkm::UInt32(t < 0 ? 0 : (t > 255 ? 255 : t)); } +VTKM_EXEC_CONT vtkm::UInt32 PackColor(vtkm::Float32 r, vtkm::Float32 g, vtkm::Float32 b, vtkm::Float32 a); VTKM_EXEC_CONT @@ -92,6 +93,7 @@ vtkm::UInt32 PackColor(vtkm::Float32 r, vtkm::Float32 g, vtkm::Float32 b, vtkm:: return packed; } +VTKM_EXEC_CONT void UnpackColor(vtkm::UInt32 color, vtkm::Float32& r, vtkm::Float32& g, @@ -157,7 +159,7 @@ class EdgePlotter : public vtkm::worklet::WorkletMapField public: using AtomicPackedFrameBufferHandle = vtkm::exec::AtomicArray; - typedef void ControlSignature(FieldIn<>, WholeArrayIn<>, WholeArrayIn); + typedef void ControlSignature(FieldIn, WholeArrayIn, WholeArrayIn); typedef void ExecutionSignature(_1, _2, _3); using InputDomain = _1; @@ -393,14 +395,16 @@ public: VTKM_CONT BufferConverter() {} - typedef void ControlSignature(FieldIn<>, ExecObject, ExecObject); + typedef void ControlSignature(FieldIn<>, + WholeArrayOut>, + WholeArrayOut>>); typedef void ExecutionSignature(_1, _2, _3, WorkIndex); - VTKM_EXEC - void operator()(const vtkm::Int64& packedValue, - vtkm::exec::ExecutionWholeArray& depthBuffer, - vtkm::exec::ExecutionWholeArray>& colorBuffer, - const vtkm::Id& index) const + template + VTKM_EXEC void operator()(const vtkm::Int64& packedValue, + DepthBufferPortalType& depthBuffer, + ColorBufferPortalType& colorBuffer, + const vtkm::Id& index) const { PackedValue packed; packed.Raw = packedValue; @@ -447,7 +451,7 @@ public: const vtkm::Range& fieldRange) { this->Bounds = coords.GetBounds(); - this->Coordinates = coords.GetData(); + this->Coordinates = coords; this->PointIndices = endPointIndices; this->ScalarField = field; this->ScalarFieldRange = fieldRange; @@ -551,9 +555,7 @@ private: BufferConverter converter; vtkm::worklet::DispatcherMapField(converter).Invoke( - FrameBuffer, - vtkm::exec::ExecutionWholeArray(Canvas->GetDepthBuffer()), - vtkm::exec::ExecutionWholeArray>(Canvas->GetColorBuffer())); + FrameBuffer, Canvas->GetDepthBuffer(), Canvas->GetColorBuffer()); } VTKM_CONT @@ -581,7 +583,7 @@ private: bool ShowInternalZones; bool IsOverlay; ColorMapHandle ColorMap; - vtkm::cont::DynamicArrayHandleCoordinateSystem Coordinates; + vtkm::cont::CoordinateSystem Coordinates; IndicesHandle PointIndices; vtkm::cont::Field ScalarField; vtkm::Range ScalarFieldRange; diff --git a/vtkm/rendering/raytracing/BoundingVolumeHierarchy.cxx b/vtkm/rendering/raytracing/BoundingVolumeHierarchy.cxx index f710d4cfe..6b3ab379b 100644 --- a/vtkm/rendering/raytracing/BoundingVolumeHierarchy.cxx +++ b/vtkm/rendering/raytracing/BoundingVolumeHierarchy.cxx @@ -316,22 +316,22 @@ public: { this->FlatBVH = flatBVH.PrepareForOutput((LeafCount - 1) * 4, Device()); } - typedef void ControlSignature(ExecObject, - ExecObject, - ExecObject, - ExecObject, - ExecObject, - ExecObject); + typedef void ControlSignature(WholeArrayIn, + WholeArrayIn, + WholeArrayIn, + WholeArrayIn, + WholeArrayIn, + WholeArrayIn); typedef void ExecutionSignature(WorkIndex, _1, _2, _3, _4, _5, _6); - template - VTKM_EXEC_CONT void operator()( - const vtkm::Id workIndex, - const vtkm::exec::ExecutionWholeArrayConst& xmin, - const vtkm::exec::ExecutionWholeArrayConst& ymin, - const vtkm::exec::ExecutionWholeArrayConst& zmin, - const vtkm::exec::ExecutionWholeArrayConst& xmax, - const vtkm::exec::ExecutionWholeArrayConst& ymax, - const vtkm::exec::ExecutionWholeArrayConst& zmax) const + + template + VTKM_EXEC_CONT void operator()(const vtkm::Id workIndex, + const InputPortalType& xmin, + const InputPortalType& ymin, + const InputPortalType& zmin, + const InputPortalType& xmax, + const InputPortalType& ymax, + const InputPortalType& zmax) const { //move up into the inner nodes vtkm::Id currentNode = LeafCount - 1 + workIndex; @@ -689,7 +689,7 @@ VTKM_CONT void LinearBVHBuilder::RunOnDevice(LinearBVH& linearBVH, Device device logger->AddLogData("device", GetDeviceString(Device())); vtkm::cont::Timer constructTimer; - vtkm::cont::DynamicArrayHandleCoordinateSystem coordsHandle = linearBVH.GetCoordsHandle(); + auto coordsHandle = linearBVH.GetCoordsHandle(); vtkm::cont::ArrayHandle> triangleIndices = linearBVH.GetTriangles(); vtkm::Id numberOfTriangles = linearBVH.GetNumberOfTriangles(); @@ -780,12 +780,7 @@ VTKM_CONT void LinearBVHBuilder::RunOnDevice(LinearBVH& linearBVH, Device device vtkm::worklet::DispatcherMapField, Device>( PropagateAABBs( bvh.parent, bvh.leftChild, bvh.rightChild, primitiveCount, linearBVH.FlatBVH, atomicCounters)) - .Invoke(vtkm::exec::ExecutionWholeArrayConst(*bvh.xmins), - vtkm::exec::ExecutionWholeArrayConst(*bvh.ymins), - vtkm::exec::ExecutionWholeArrayConst(*bvh.zmins), - vtkm::exec::ExecutionWholeArrayConst(*bvh.xmaxs), - vtkm::exec::ExecutionWholeArrayConst(*bvh.ymaxs), - vtkm::exec::ExecutionWholeArrayConst(*bvh.zmaxs)); + .Invoke(*bvh.xmins, *bvh.ymins, *bvh.zmins, *bvh.xmaxs, *bvh.ymaxs, *bvh.zmaxs); time = timer.GetElapsedTime(); logger->AddLogData("propagate_aabbs", time); @@ -816,7 +811,7 @@ LinearBVH::LinearBVH() , CanConstruct(false){}; VTKM_CONT -LinearBVH::LinearBVH(vtkm::cont::DynamicArrayHandleCoordinateSystem coordsHandle, +LinearBVH::LinearBVH(vtkm::cont::ArrayHandleVirtualCoordinates coordsHandle, vtkm::cont::ArrayHandle> triangles, vtkm::Bounds coordBounds) : CoordBounds(coordBounds) @@ -861,7 +856,7 @@ void LinearBVH::Construct() } VTKM_CONT -void LinearBVH::SetData(vtkm::cont::DynamicArrayHandleCoordinateSystem coordsHandle, +void LinearBVH::SetData(vtkm::cont::ArrayHandleVirtualCoordinates coordsHandle, vtkm::cont::ArrayHandle> triangles, vtkm::Bounds coordBounds) { @@ -923,7 +918,7 @@ bool LinearBVH::GetIsConstructed() const return IsConstructed; } VTKM_CONT -vtkm::cont::DynamicArrayHandleCoordinateSystem LinearBVH::GetCoordsHandle() const +vtkm::cont::ArrayHandleVirtualCoordinates LinearBVH::GetCoordsHandle() const { return CoordsHandle; } diff --git a/vtkm/rendering/raytracing/BoundingVolumeHierarchy.h b/vtkm/rendering/raytracing/BoundingVolumeHierarchy.h index 7e3832a68..025633e79 100644 --- a/vtkm/rendering/raytracing/BoundingVolumeHierarchy.h +++ b/vtkm/rendering/raytracing/BoundingVolumeHierarchy.h @@ -46,7 +46,7 @@ public: vtkm::Bounds CoordBounds; protected: - vtkm::cont::DynamicArrayHandleCoordinateSystem CoordsHandle; + vtkm::cont::ArrayHandleVirtualCoordinates CoordsHandle; vtkm::cont::ArrayHandle> Triangles; bool IsConstructed; bool CanConstruct; @@ -55,7 +55,7 @@ public: LinearBVH(); VTKM_CONT - LinearBVH(vtkm::cont::DynamicArrayHandleCoordinateSystem coordsHandle, + LinearBVH(vtkm::cont::ArrayHandleVirtualCoordinates coordsHandle, vtkm::cont::ArrayHandle> triangles, vtkm::Bounds coordBounds); @@ -69,7 +69,7 @@ public: void Construct(); VTKM_CONT - void SetData(vtkm::cont::DynamicArrayHandleCoordinateSystem coordsHandle, + void SetData(vtkm::cont::ArrayHandleVirtualCoordinates coordsHandle, vtkm::cont::ArrayHandle> triangles, vtkm::Bounds coordBounds); @@ -80,7 +80,7 @@ public: bool GetIsConstructed() const; VTKM_CONT - vtkm::cont::DynamicArrayHandleCoordinateSystem GetCoordsHandle() const; + vtkm::cont::ArrayHandleVirtualCoordinates GetCoordsHandle() const; VTKM_CONT vtkm::cont::ArrayHandle> GetTriangles() const; diff --git a/vtkm/rendering/raytracing/CMakeLists.txt b/vtkm/rendering/raytracing/CMakeLists.txt index b7ee07b5c..cf3cbc49f 100644 --- a/vtkm/rendering/raytracing/CMakeLists.txt +++ b/vtkm/rendering/raytracing/CMakeLists.txt @@ -21,14 +21,15 @@ set(headers BoundingVolumeHierarchy.h Camera.h + CellIntersector.h + CellSampler.h + CellTables.h ChannelBuffer.h ChannelBufferOperations.h ConnectivityBase.h ConnectivityTracer.h + ConnectivityTracerBase.h ConnectivityTracerFactory.h - CellIntersector.h - CellSampler.h - CellTables.h Logger.h MeshConnectivityBuilder.h MeshConnectivityStructures.h @@ -38,8 +39,8 @@ set(headers RayTracer.h RayTracingTypeDefs.h TriangleIntersector.h - Worklets.h VolumeRendererStructured.h + Worklets.h ) set_source_files_properties(CellTables.h diff --git a/vtkm/rendering/raytracing/ConnectivityBase.cxx b/vtkm/rendering/raytracing/ConnectivityBase.cxx new file mode 100644 index 000000000..ae4107f6f --- /dev/null +++ b/vtkm/rendering/raytracing/ConnectivityBase.cxx @@ -0,0 +1,38 @@ +//============================================================================ +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +// Copyright 2018 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2018 UT-Battelle, LLC. +// Copyright 2018 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +//============================================================================ +#include + +namespace vtkm +{ +namespace rendering +{ +namespace raytracing +{ + +ConnectivityBase::ConnectivityBase() +{ +} + +ConnectivityBase::~ConnectivityBase() +{ +} +} +} +} diff --git a/vtkm/rendering/raytracing/ConnectivityBase.h b/vtkm/rendering/raytracing/ConnectivityBase.h index 4e69abf46..5df12ef77 100644 --- a/vtkm/rendering/raytracing/ConnectivityBase.h +++ b/vtkm/rendering/raytracing/ConnectivityBase.h @@ -20,7 +20,8 @@ #ifndef vtk_m_rendering_raytracing_Connectivity_Base_h #define vtk_m_rendering_raytracing_Connectivity_Base_h -#include +#include + #include namespace vtkm @@ -30,7 +31,7 @@ namespace rendering namespace raytracing { -class ConnectivityBase +class VTKM_RENDERING_EXPORT ConnectivityBase { public: enum IntegrationMode @@ -39,8 +40,8 @@ public: Energy }; - ConnectivityBase() {} - virtual ~ConnectivityBase() {} + ConnectivityBase(); + virtual ~ConnectivityBase(); virtual void Trace(Ray& rays) = 0; @@ -59,6 +60,7 @@ public: virtual void SetColorMap( const vtkm::cont::ArrayHandle>& colorMap) = 0; + }; // class ConnectivityBase } } diff --git a/vtkm/rendering/raytracing/ConnectivityTracer.cxx b/vtkm/rendering/raytracing/ConnectivityTracer.cxx new file mode 100644 index 000000000..3286b9a77 --- /dev/null +++ b/vtkm/rendering/raytracing/ConnectivityTracer.cxx @@ -0,0 +1,76 @@ +//============================================================================ +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +// Copyright 2015 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2015 UT-Battelle, LLC. +// Copyright 2015 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +//============================================================================ +#define vtk_m_rendering_raytracing_ConnectivityTracer_cxx + +#include +#include + +namespace vtkm +{ +namespace rendering +{ +namespace raytracing +{ + +namespace detail +{ +struct RenderFunctor +{ + template + bool operator()(Device device, Tracer&& tracer, Rays&& rays) const + { + tracer.RenderOnDevice(rays, device); + return true; + } +}; +} //namespace detail + + +template +void ConnectivityTracer::Trace(Ray& rays) +{ + detail::RenderFunctor functor; + vtkm::cont::TryExecute(functor, *this, rays); +} + +template +void ConnectivityTracer::Trace(Ray& rays) +{ + detail::RenderFunctor functor; + vtkm::cont::TryExecute(functor, *this, rays); +} + +//explicit construct all valid forms ofConnectivityTracer +template class detail::RayTracking; +template class detail::RayTracking; + +template class VTKM_RENDERING_TEMPLATE_EXPORT + ConnectivityTracer; +template class VTKM_RENDERING_TEMPLATE_EXPORT + ConnectivityTracer; +template class VTKM_RENDERING_TEMPLATE_EXPORT + ConnectivityTracer; +template class VTKM_RENDERING_TEMPLATE_EXPORT + ConnectivityTracer; +template class VTKM_RENDERING_TEMPLATE_EXPORT + ConnectivityTracer; +} +} +} // namespace vtkm::rendering::raytracing diff --git a/vtkm/rendering/raytracing/ConnectivityTracer.h b/vtkm/rendering/raytracing/ConnectivityTracer.h index a1659595a..32701cc73 100644 --- a/vtkm/rendering/raytracing/ConnectivityTracer.h +++ b/vtkm/rendering/raytracing/ConnectivityTracer.h @@ -20,41 +20,19 @@ #ifndef vtk_m_rendering_raytracing_ConnectivityTracer_h #define vtk_m_rendering_raytracing_ConnectivityTracer_h -#include -#include -#include -#include -#include -#include -#include -#include +#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include +#include +#include #include -#include -#include -#include -#include - -#include -#include -#include -#include +#ifndef CELL_SHAPE_ZOO #define CELL_SHAPE_ZOO 255 +#endif + +#ifndef CELL_SHAPE_STRUCTURED #define CELL_SHAPE_STRUCTURED 254 +#endif namespace vtkm { @@ -62,37 +40,12 @@ namespace rendering { namespace raytracing { -// -// Advance Ray -// After a ray leaves the mesh, we need to check to see -// of the ray re-enters the mesh within this domain. This -// function moves the ray forward some offset to prevent -// "shadowing" and hitting the same exit point. -// -template -class AdvanceRay : public vtkm::worklet::WorkletMapField -{ - FloatType Offset; - -public: - VTKM_CONT - AdvanceRay(const FloatType offset = 0.00001) - : Offset(offset) - { - } - typedef void ControlSignature(FieldIn<>, FieldInOut<>); - typedef void ExecutionSignature(_1, _2); - - VTKM_EXEC inline void operator()(const vtkm::UInt8& status, FloatType& distance) const - { - if (status == RAY_EXITED_MESH) - distance += Offset; - } -}; //class MemSet - namespace detail { +//forward declare so we can be friends +struct RenderFunctor; + // // Ray tracker manages memory and pointer // swaping for current cell intersection data @@ -117,904 +70,25 @@ public: template void Compact(vtkm::cont::ArrayHandle& compactedDistances, vtkm::cont::ArrayHandle& masks, - Device) - { - // - // These distances are stored in the rays, and it has - // already been compacted. - // - CurrentDistance = compactedDistances; - - vtkm::cont::ArrayHandleCast> castedMasks(masks); - - bool distance1IsEnter = EnterDist == &Distance1; - - vtkm::cont::ArrayHandle compactedDistance1; - vtkm::cont::DeviceAdapterAlgorithm::CopyIf(Distance1, masks, compactedDistance1); - Distance1 = compactedDistance1; - - vtkm::cont::ArrayHandle compactedDistance2; - vtkm::cont::DeviceAdapterAlgorithm::CopyIf(Distance2, masks, compactedDistance2); - Distance2 = compactedDistance2; - - vtkm::cont::ArrayHandle compactedExitFace; - vtkm::cont::DeviceAdapterAlgorithm::CopyIf(ExitFace, masks, compactedExitFace); - ExitFace = compactedExitFace; - - if (distance1IsEnter) - { - EnterDist = &Distance1; - ExitDist = &Distance2; - } - else - { - EnterDist = &Distance2; - ExitDist = &Distance1; - } - } + Device); template - void Init(const vtkm::Id size, vtkm::cont::ArrayHandle& distances, Device) - { + void Init(const vtkm::Id size, vtkm::cont::ArrayHandle& distances, Device); - ExitFace.PrepareForOutput(size, Device()); - Distance1.PrepareForOutput(size, Device()); - Distance2.PrepareForOutput(size, Device()); - - CurrentDistance = distances; - // - // Set the initial Distances - // - vtkm::worklet::DispatcherMapField, Device>( - CopyAndOffset(0.0f)) - .Invoke(distances, *EnterDist); - - // - // Init the exit faces. This value is used to load the next cell - // base on the cell and face it left - // - vtkm::worklet::DispatcherMapField, Device>(MemSet(-1)) - .Invoke(ExitFace); - - vtkm::worklet::DispatcherMapField, Device>(MemSet(-1)) - .Invoke(*ExitDist); - } - - void Swap() - { - vtkm::cont::ArrayHandle* tmpPtr; - tmpPtr = EnterDist; - EnterDist = ExitDist; - ExitDist = tmpPtr; - } + void Swap(); }; } //namespace detail -template -VTKM_EXEC_CONT inline void PrintDistances(const vtkm::Id& pixelIndex, - vtkm::Int32& minFace, - vtkm::Int32& maxFace, - FloatType distances[6], - vtkm::Id& cell, - FloatType& enterDistance, - FloatType& minDistance, - FloatType& maxDistance) -{ - printf("Pixel at %d in cell %d\n", (int)pixelIndex, (int)cell); - printf("Near %f min %f max %f \n", enterDistance, minDistance, maxDistance); - printf("Min Face %d Max Face %d\n", minFace, maxFace); - printf("** Enter Dis Diff %1.30f\n", enterDistance); - printf("** Distance 0 Diff %1.30f\n", distances[0]); - printf("** Distance 1 Diff %1.30f\n", distances[1]); - printf("** Distance 2 Diff %1.30f\n", distances[2]); - printf("** Distance 3 Diff %1.30f\n", distances[3]); - printf("** Distance 4 Diff %1.30f\n", distances[4]); - printf("** Distance 5 Diff %1.30f\n", distances[5]); -} template -class ConnectivityTracer : public ConnectivityBase +class ConnectivityTracer : public ConnectivityTracerBase { public: - template class MeshType> - class LocateCell : public vtkm::worklet::WorkletMapField - { - private: - MeshType MeshConn; - CellIntersector Intersector; - - public: - VTKM_CONT - LocateCell(ConnectivityType& meshConn) - : MeshConn(meshConn) - { - } - - typedef void ControlSignature(FieldInOut<>, - WholeArrayIn<>, - FieldIn<>, - FieldInOut<>, - FieldInOut<>, - FieldInOut<>, - FieldInOut<>, - FieldIn<>); - typedef void ExecutionSignature(_1, _2, _3, _4, _5, _6, _7, _8); - - template - VTKM_EXEC inline void operator()(vtkm::Id& currentCell, - PointPortalType& vertices, - const vtkm::Vec& dir, - FloatType& enterDistance, - FloatType& exitDistance, - vtkm::Int32& enterFace, - vtkm::UInt8& rayStatus, - const vtkm::Vec& origin) const - { - if (enterFace != -1 && rayStatus == RAY_ACTIVE) - { - currentCell = MeshConn.GetConnectingCell(currentCell, enterFace); - if (currentCell == -1) - rayStatus = RAY_EXITED_MESH; - enterFace = -1; - } - //This ray is dead or exited the mesh and needs re-entry - if (rayStatus != RAY_ACTIVE) - { - return; - } - FloatType xpoints[8]; - FloatType ypoints[8]; - FloatType zpoints[8]; - vtkm::Id cellConn[8]; - FloatType distances[6]; - - const vtkm::Int32 numIndices = MeshConn.GetCellIndices(cellConn, currentCell); - //load local cell data - for (int i = 0; i < numIndices; ++i) - { - BOUNDS_CHECK(vertices, cellConn[i]); - vtkm::Vec point = vtkm::Vec(vertices.Get(cellConn[i])); - xpoints[i] = point[0]; - ypoints[i] = point[1]; - zpoints[i] = point[2]; - } - const vtkm::UInt8 cellShape = MeshConn.GetCellShape(currentCell); - Intersector.IntersectCell(xpoints, ypoints, zpoints, dir, origin, distances, cellShape); - const vtkm::Int32 numFaces = - CellTables::Get().FaceLookUp[CellTables::Get().CellTypeLookUp[cellShape]][1]; - //vtkm::Int32 minFace = 6; - vtkm::Int32 maxFace = -1; - - FloatType minDistance = static_cast(1e32); - FloatType maxDistance = static_cast(-1); - int hitCount = 0; - for (vtkm::Int32 i = 0; i < numFaces; ++i) - { - FloatType dist = distances[i]; - - if (dist != -1) - { - hitCount++; - if (dist < minDistance) - { - minDistance = dist; - //minFace = i; - } - if (dist > maxDistance) - { - maxDistance = dist; - maxFace = i; - } - } - } - - if (maxDistance <= enterDistance || minDistance == maxDistance) - { - rayStatus = RAY_LOST; - } - else - { - enterDistance = minDistance; - exitDistance = maxDistance; - enterFace = maxFace; - } - - } //operator - }; //class LocateCell - - template class MeshType> - class RayBumper : public vtkm::worklet::WorkletMapField - { - private: - typedef typename vtkm::cont::ArrayHandle FloatTypeHandle; - typedef typename FloatTypeHandle::template ExecutionTypes::Portal FloatTypePortal; - FloatTypePortal DirectionsX; - FloatTypePortal DirectionsY; - FloatTypePortal DirectionsZ; - MeshType MeshConn; - CellIntersector Intersector; - const vtkm::UInt8 FailureStatus; // the status to assign ray if we fail to find the intersection - public: - VTKM_CONT - RayBumper(FloatTypeHandle dirsx, - FloatTypeHandle dirsy, - FloatTypeHandle dirsz, - ConnectivityType meshConn, - vtkm::UInt8 failureStatus = RAY_ABANDONED) - : DirectionsX(dirsx.PrepareForInPlace(Device())) - , DirectionsY(dirsy.PrepareForInPlace(Device())) - , DirectionsZ(dirsz.PrepareForInPlace(Device())) - , MeshConn(meshConn) - , FailureStatus(failureStatus) - { - } - - - typedef void ControlSignature(FieldInOut<>, - WholeArrayIn<>, - FieldInOut<>, - FieldInOut<>, - FieldInOut<>, - FieldInOut<>, - FieldIn<>); - typedef void ExecutionSignature(_1, _2, _3, _4, _5, WorkIndex, _6, _7); - - template - VTKM_EXEC inline void operator()(vtkm::Id& currentCell, - PointPortalType& vertices, - FloatType& enterDistance, - FloatType& exitDistance, - vtkm::Int32& enterFace, - const vtkm::Id& pixelIndex, - vtkm::UInt8& rayStatus, - const vtkm::Vec& origin) const - { - // We only process lost rays - if (rayStatus != RAY_LOST) - { - return; - } - - FloatType xpoints[8]; - FloatType ypoints[8]; - FloatType zpoints[8]; - vtkm::Id cellConn[8]; - FloatType distances[6]; - - vtkm::Vec centroid(0., 0., 0.); - const vtkm::Int32 numIndices = MeshConn.GetCellIndices(cellConn, currentCell); - //load local cell data - for (int i = 0; i < numIndices; ++i) - { - BOUNDS_CHECK(vertices, cellConn[i]); - vtkm::Vec point = vtkm::Vec(vertices.Get(cellConn[i])); - centroid = centroid + point; - xpoints[i] = point[0]; - ypoints[i] = point[1]; - zpoints[i] = point[2]; - } - - FloatType invNumIndices = static_cast(1.) / static_cast(numIndices); - centroid[0] = centroid[0] * invNumIndices; - centroid[1] = centroid[1] * invNumIndices; - centroid[2] = centroid[2] * invNumIndices; - - vtkm::Vec toCentroid = centroid - origin; - vtkm::Normalize(toCentroid); - - vtkm::Vec dir( - DirectionsX.Get(pixelIndex), DirectionsY.Get(pixelIndex), DirectionsZ.Get(pixelIndex)); - vtkm::Vec bump = toCentroid - dir; - dir = dir + RAY_TUG_EPSILON * bump; - - vtkm::Normalize(dir); - - DirectionsX.Set(pixelIndex, dir[0]); - DirectionsY.Set(pixelIndex, dir[1]); - DirectionsZ.Set(pixelIndex, dir[2]); - - const vtkm::UInt8 cellShape = MeshConn.GetCellShape(currentCell); - Intersector.IntersectCell(xpoints, ypoints, zpoints, dir, origin, distances, cellShape); - const vtkm::Int32 numFaces = - CellTables::Get().FaceLookUp[CellTables::Get().CellTypeLookUp[cellShape]][1]; - - //vtkm::Int32 minFace = 6; - vtkm::Int32 maxFace = -1; - FloatType minDistance = static_cast(1e32); - FloatType maxDistance = static_cast(-1); - int hitCount = 0; - for (int i = 0; i < numFaces; ++i) - { - FloatType dist = distances[i]; - - if (dist != -1) - { - hitCount++; - if (dist < minDistance) - { - minDistance = dist; - //minFace = i; - } - if (dist >= maxDistance) - { - maxDistance = dist; - maxFace = i; - } - } - } - if (minDistance >= maxDistance) - { - rayStatus = FailureStatus; - } - else - { - enterDistance = minDistance; - exitDistance = maxDistance; - enterFace = maxFace; - rayStatus = RAY_ACTIVE; //re-activate ray - } - - } //operator - }; //class RayBumper - - template - class AddPathLengths : public vtkm::worklet::WorkletMapField - { - public: - VTKM_CONT - AddPathLengths() {} - - typedef void ControlSignature(FieldIn, // ray status - FieldIn, // cell enter distance - FieldIn, // cell exit distance - FieldInOut); // ray absorption data - - typedef void ExecutionSignature(_1, _2, _3, _4); - - VTKM_EXEC inline void operator()(const vtkm::UInt8& rayStatus, - const FloatType& enterDistance, - const FloatType& exitDistance, - FloatType& distance) const - { - if (rayStatus != RAY_ACTIVE) - { - return; - } - - if (exitDistance <= enterDistance) - { - return; - } - - FloatType segmentLength = exitDistance - enterDistance; - distance += segmentLength; - } - }; - - template - class Integrate : public vtkm::worklet::WorkletMapField - { - private: - const vtkm::Int32 NumBins; - - public: - VTKM_CONT - Integrate(const vtkm::Int32 numBins) - : NumBins(numBins) - { - } - - typedef void ControlSignature(FieldIn, // ray status - FieldIn, // cell enter distance - FieldIn, // cell exit distance - FieldInOut, // current distance - WholeArrayIn, // cell absorption data array - WholeArrayInOut, // ray absorption data - FieldIn); // current cell - - typedef void ExecutionSignature(_1, _2, _3, _4, _5, _6, _7, WorkIndex); - - template - VTKM_EXEC inline void operator()(const vtkm::UInt8& rayStatus, - const FloatType& enterDistance, - const FloatType& exitDistance, - FloatType& currentDistance, - const CellDataPortalType& cellData, - RayDataPortalType& energyBins, - const vtkm::Id& currentCell, - const vtkm::Id& rayIndex) const - { - if (rayStatus != RAY_ACTIVE) - { - return; - } - if (exitDistance <= enterDistance) - { - return; - } - - FloatType segmentLength = exitDistance - enterDistance; - - vtkm::Id rayOffset = NumBins * rayIndex; - vtkm::Id cellOffset = NumBins * currentCell; - for (vtkm::Int32 i = 0; i < NumBins; ++i) - { - BOUNDS_CHECK(cellData, cellOffset + i); - FloatType absorb = static_cast(cellData.Get(cellOffset + i)); - - absorb = vtkm::Exp(-absorb * segmentLength); - BOUNDS_CHECK(energyBins, rayOffset + i); - FloatType intensity = static_cast(energyBins.Get(rayOffset + i)); - energyBins.Set(rayOffset + i, intensity * absorb); - } - currentDistance = exitDistance; - } - }; - - template - class IntegrateEmission : public vtkm::worklet::WorkletMapField - { - private: - const vtkm::Int32 NumBins; - bool DivideEmisByAbsorb; - - public: - VTKM_CONT - IntegrateEmission(const vtkm::Int32 numBins, const bool divideEmisByAbsorb) - : NumBins(numBins) - , DivideEmisByAbsorb(divideEmisByAbsorb) - { - } - - typedef void ControlSignature(FieldIn<>, // ray status - FieldIn<>, // cell enter distance - FieldIn<>, // cell exit distance - FieldInOut<>, // current distance - WholeArrayIn, // cell absorption data array - WholeArrayIn, // cell emission data array - WholeArrayInOut<>, // ray absorption data - WholeArrayInOut<>, // ray emission data - FieldIn<>); // current cell - - typedef void ExecutionSignature(_1, _2, _3, _4, _5, _6, _7, _8, _9, WorkIndex); - - template - VTKM_EXEC inline void operator()(const vtkm::UInt8& rayStatus, - const FloatType& enterDistance, - const FloatType& exitDistance, - FloatType& currentDistance, - const CellAbsPortalType& absorptionData, - const CellEmisPortalType& emissionData, - RayDataPortalType& absorptionBins, - RayDataPortalType& emissionBins, - const vtkm::Id& currentCell, - const vtkm::Id& rayIndex) const - { - if (rayStatus != RAY_ACTIVE) - { - return; - } - if (exitDistance <= enterDistance) - { - return; - } - - FloatType segmentLength = exitDistance - enterDistance; - - vtkm::Id rayOffset = NumBins * rayIndex; - vtkm::Id cellOffset = NumBins * currentCell; - for (vtkm::Int32 i = 0; i < NumBins; ++i) - { - BOUNDS_CHECK(absorptionData, cellOffset + i); - FloatType absorb = static_cast(absorptionData.Get(cellOffset + i)); - BOUNDS_CHECK(emissionData, cellOffset + i); - FloatType emission = static_cast(emissionData.Get(cellOffset + i)); - - if (DivideEmisByAbsorb) - { - emission /= absorb; - } - - FloatType tmp = vtkm::Exp(-absorb * segmentLength); - BOUNDS_CHECK(absorptionBins, rayOffset + i); - - // - // Traditionally, we would only keep track of a single intensity value per ray - // per bin and we would integrate from the begining to end of the ray. In a - // distributed memory setting, we would move cell data around so that the - // entire ray could be traced, but in situ, moving that much cell data around - // could blow memory. Here we are keeping track of two values. Total absorption - // through this contigious segment of the mesh, and the amount of emissed engery - // that makes it out of this mesh segment. If this is really run on a single node, - // we can get the final energy value by multiplying the background intensity by - // the total absorption of the mesh segment and add in the amount of emissed - // enegery that escapes. - // - FloatType absorbIntensity = static_cast(absorptionBins.Get(rayOffset + i)); - FloatType emissionIntensity = static_cast(emissionBins.Get(rayOffset + i)); - - absorptionBins.Set(rayOffset + i, absorbIntensity * tmp); - - emissionIntensity = emissionIntensity * tmp + emission * (1.f - tmp); - - BOUNDS_CHECK(emissionBins, rayOffset + i); - emissionBins.Set(rayOffset + i, emissionIntensity); - } - currentDistance = exitDistance; - } - }; - // - // IdentifyMissedRay is a debugging routine that detects - // rays that fail to have any value because of a external - // intersection and cell intersection mismatch - // - // - class IdentifyMissedRay : public vtkm::worklet::WorkletMapField - { - public: - vtkm::Id Width; - vtkm::Id Height; - vtkm::Vec BGColor; - IdentifyMissedRay(const vtkm::Id width, - const vtkm::Id height, - vtkm::Vec bgcolor) - : Width(width) - , Height(height) - , BGColor(bgcolor) - { - } - typedef void ControlSignature(FieldIn<>, WholeArrayIn<>); - typedef void ExecutionSignature(_1, _2); - - - VTKM_EXEC inline bool IsBGColor(const vtkm::Vec color) const - { - bool isBG = false; - - if (color[0] == BGColor[0] && color[1] == BGColor[1] && color[2] == BGColor[2] && - color[3] == BGColor[3]) - isBG = true; - return isBG; - } - - template - VTKM_EXEC inline void operator()(const vtkm::Id& pixelId, ColorBufferType& buffer) const - { - vtkm::Id x = pixelId % Width; - vtkm::Id y = pixelId / Width; - - // Conservative check, we only want to check pixels in the middle - if (x <= 0 || y <= 0) - return; - if (x >= Width - 1 || y >= Height - 1) - return; - vtkm::Vec pixel; - pixel[0] = static_cast(buffer.Get(pixelId * 4 + 0)); - pixel[1] = static_cast(buffer.Get(pixelId * 4 + 1)); - pixel[2] = static_cast(buffer.Get(pixelId * 4 + 2)); - pixel[3] = static_cast(buffer.Get(pixelId * 4 + 3)); - if (!IsBGColor(pixel)) - return; - vtkm::Id p0 = (y)*Width + (x + 1); - vtkm::Id p1 = (y)*Width + (x - 1); - vtkm::Id p2 = (y + 1) * Width + (x); - vtkm::Id p3 = (y - 1) * Width + (x); - pixel[0] = static_cast(buffer.Get(p0 * 4 + 0)); - pixel[1] = static_cast(buffer.Get(p0 * 4 + 1)); - pixel[2] = static_cast(buffer.Get(p0 * 4 + 2)); - pixel[3] = static_cast(buffer.Get(p0 * 4 + 3)); - if (IsBGColor(pixel)) - return; - pixel[0] = static_cast(buffer.Get(p1 * 4 + 0)); - pixel[1] = static_cast(buffer.Get(p1 * 4 + 1)); - pixel[2] = static_cast(buffer.Get(p1 * 4 + 2)); - pixel[3] = static_cast(buffer.Get(p1 * 4 + 3)); - if (IsBGColor(pixel)) - return; - pixel[0] = static_cast(buffer.Get(p2 * 4 + 0)); - pixel[1] = static_cast(buffer.Get(p2 * 4 + 1)); - pixel[2] = static_cast(buffer.Get(p2 * 4 + 2)); - pixel[3] = static_cast(buffer.Get(p2 * 4 + 3)); - if (IsBGColor(pixel)) - return; - pixel[0] = static_cast(buffer.Get(p3 * 4 + 0)); - pixel[1] = static_cast(buffer.Get(p3 * 4 + 1)); - pixel[2] = static_cast(buffer.Get(p3 * 4 + 2)); - pixel[3] = static_cast(buffer.Get(p3 * 4 + 3)); - if (IsBGColor(pixel)) - return; - - printf("Possible error ray missed ray %d\n", (int)pixelId); - } - }; - - template class MeshType> - class SampleCellAssocCells : public vtkm::worklet::WorkletMapField - { - private: - typedef typename vtkm::cont::ArrayHandle> ColorHandle; - typedef typename vtkm::cont::ArrayHandle ColorBuffer; - typedef typename ColorHandle::ExecutionTypes::PortalConst ColorConstPortal; - typedef typename ColorBuffer::template ExecutionTypes::Portal ColorPortal; - - CellSampler Sampler; - FloatType SampleDistance; - FloatType MinScalar; - FloatType InvDeltaScalar; - ColorPortal FrameBuffer; - ColorConstPortal ColorMap; - MeshType MeshConn; - vtkm::Int32 ColorMapSize; - - public: - VTKM_CONT - SampleCellAssocCells(const FloatType& sampleDistance, - const FloatType& minScalar, - const FloatType& maxScalar, - ColorHandle& colorMap, - ColorBuffer& frameBuffer, - ConnectivityType& meshConn) - : SampleDistance(sampleDistance) - , MinScalar(minScalar) - , ColorMap(colorMap.PrepareForInput(Device())) - , MeshConn(meshConn) - { - InvDeltaScalar = (minScalar == maxScalar) ? 1.f : 1.f / (maxScalar - minScalar); - ColorMapSize = static_cast(ColorMap.GetNumberOfValues()); - this->FrameBuffer = frameBuffer.PrepareForOutput(frameBuffer.GetNumberOfValues(), Device()); - } - - - typedef void ControlSignature(FieldIn<>, - WholeArrayIn, - FieldIn<>, - FieldIn<>, - FieldInOut<>, - FieldInOut<>); - typedef void ExecutionSignature(_1, _2, _3, _4, _5, _6, WorkIndex); - - template - VTKM_EXEC inline void operator()(const vtkm::Id& currentCell, - ScalarPortalType& scalarPortal, - const FloatType& enterDistance, - const FloatType& exitDistance, - FloatType& currentDistance, - vtkm::UInt8& rayStatus, - const vtkm::Id& pixelIndex) const - { - - if (rayStatus != RAY_ACTIVE) - return; - - vtkm::Vec color; - BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 0); - color[0] = static_cast(FrameBuffer.Get(pixelIndex * 4 + 0)); - BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 1); - color[1] = static_cast(FrameBuffer.Get(pixelIndex * 4 + 1)); - BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 2); - color[2] = static_cast(FrameBuffer.Get(pixelIndex * 4 + 2)); - BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 3); - color[3] = static_cast(FrameBuffer.Get(pixelIndex * 4 + 3)); - - vtkm::Float32 scalar; - BOUNDS_CHECK(scalarPortal, currentCell); - scalar = vtkm::Float32(scalarPortal.Get(currentCell)); - // - // There can be mismatches in the initial enter distance and the current distance - // due to lost rays at cell borders. For now, - // we will just advance the current position to the enter distance, since otherwise, - // the pixel would never be sampled. - // - if (currentDistance < enterDistance) - currentDistance = enterDistance; - - vtkm::Float32 lerpedScalar; - lerpedScalar = static_cast((scalar - MinScalar) * InvDeltaScalar); - vtkm::Id colorIndex = vtkm::Id(lerpedScalar * vtkm::Float32(ColorMapSize)); - if (colorIndex < 0) - colorIndex = 0; - if (colorIndex >= ColorMapSize) - colorIndex = ColorMapSize - 1; - BOUNDS_CHECK(ColorMap, colorIndex); - vtkm::Vec sampleColor = ColorMap.Get(colorIndex); - - while (enterDistance <= currentDistance && currentDistance <= exitDistance) - { - //composite - sampleColor[3] *= (1.f - color[3]); - color[0] = color[0] + sampleColor[0] * sampleColor[3]; - color[1] = color[1] + sampleColor[1] * sampleColor[3]; - color[2] = color[2] + sampleColor[2] * sampleColor[3]; - color[3] = sampleColor[3] + color[3]; - - if (color[3] > 1.) - { - rayStatus = RAY_TERMINATED; - break; - } - currentDistance += SampleDistance; - } - - BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 0); - FrameBuffer.Set(pixelIndex * 4 + 0, color[0]); - BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 1); - FrameBuffer.Set(pixelIndex * 4 + 1, color[1]); - BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 2); - FrameBuffer.Set(pixelIndex * 4 + 2, color[2]); - BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 3); - FrameBuffer.Set(pixelIndex * 4 + 3, color[3]); - } - }; //class Sample cell - - template class MeshType> - class SampleCellAssocPoints : public vtkm::worklet::WorkletMapField - { - private: - typedef typename vtkm::cont::ArrayHandle> ColorHandle; - typedef typename vtkm::cont::ArrayHandle ColorBuffer; - typedef typename ColorHandle::ExecutionTypes::PortalConst ColorConstPortal; - typedef typename ColorBuffer::template ExecutionTypes::Portal ColorPortal; - - CellSampler Sampler; - FloatType SampleDistance; - MeshType MeshConn; - FloatType MinScalar; - FloatType InvDeltaScalar; - ColorPortal FrameBuffer; - ColorConstPortal ColorMap; - vtkm::Id ColorMapSize; - - public: - VTKM_CONT - SampleCellAssocPoints(const FloatType& sampleDistance, - const FloatType& minScalar, - const FloatType& maxScalar, - ColorHandle& colorMap, - ColorBuffer& frameBuffer, - ConnectivityType& meshConn) - : SampleDistance(sampleDistance) - , MeshConn(meshConn) - , MinScalar(minScalar) - , ColorMap(colorMap.PrepareForInput(Device())) - { - InvDeltaScalar = (minScalar == maxScalar) ? 1.f : 1.f / (maxScalar - minScalar); - ColorMapSize = ColorMap.GetNumberOfValues(); - this->FrameBuffer = frameBuffer.PrepareForOutput(frameBuffer.GetNumberOfValues(), Device()); - } - - - typedef void ControlSignature(FieldIn<>, - WholeArrayIn, - WholeArrayIn, - FieldIn<>, - FieldIn<>, - FieldInOut<>, - FieldIn<>, - FieldInOut<>, - FieldIn<>); - typedef void ExecutionSignature(_1, _2, _3, _4, _5, _6, _7, _8, WorkIndex, _9); - - template - VTKM_EXEC inline void operator()(const vtkm::Id& currentCell, - PointPortalType& vertices, - ScalarPortalType& scalarPortal, - const FloatType& enterDistance, - const FloatType& exitDistance, - FloatType& currentDistance, - const vtkm::Vec& dir, - vtkm::UInt8& rayStatus, - const vtkm::Id& pixelIndex, - const vtkm::Vec& origin) const - { - - if (rayStatus != RAY_ACTIVE) - return; - - vtkm::Vec color; - BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 0); - color[0] = static_cast(FrameBuffer.Get(pixelIndex * 4 + 0)); - BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 1); - color[1] = static_cast(FrameBuffer.Get(pixelIndex * 4 + 1)); - BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 2); - color[2] = static_cast(FrameBuffer.Get(pixelIndex * 4 + 2)); - BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 3); - color[3] = static_cast(FrameBuffer.Get(pixelIndex * 4 + 3)); - - if (color[3] >= 1.f) - { - rayStatus = RAY_TERMINATED; - return; - } - vtkm::Vec scalars; - vtkm::Vec, 8> points; - // silence "may" be uninitialized warning - for (vtkm::Int32 i = 0; i < 8; ++i) - { - scalars[i] = 0.f; - points[i] = vtkm::Vec(0.f, 0.f, 0.f); - } - //load local scalar cell data - vtkm::Id cellConn[8]; - const vtkm::Int32 numIndices = MeshConn.GetCellIndices(cellConn, currentCell); - for (int i = 0; i < numIndices; ++i) - { - BOUNDS_CHECK(scalarPortal, cellConn[i]); - scalars[i] = static_cast(scalarPortal.Get(cellConn[i])); - BOUNDS_CHECK(vertices, cellConn[i]); - points[i] = vtkm::Vec(vertices.Get(cellConn[i])); - } - // - // There can be mismatches in the initial enter distance and the current distance - // due to lost rays at cell borders. For now, - // we will just advance the current position to the enter distance, since otherwise, - // the pixel would never be sampled. - // - if (currentDistance < enterDistance) - { - currentDistance = enterDistance; - } - - const vtkm::Int32 cellShape = MeshConn.GetCellShape(currentCell); - while (enterDistance <= currentDistance && currentDistance <= exitDistance) - { - vtkm::Vec sampleLoc = origin + currentDistance * dir; - vtkm::Float32 lerpedScalar; - bool validSample = - Sampler.SampleCell(points, scalars, sampleLoc, lerpedScalar, *this, cellShape); - if (!validSample) - { - // - // There is a slight mismatch between intersections and parametric coordinates - // which results in a invalid sample very close to the cell edge. Just throw - // this sample away, and move to the next sample. - // - - //There should be a sample here, so offset and try again. - - currentDistance += 0.00001f; - continue; - } - lerpedScalar = static_cast((lerpedScalar - MinScalar) * InvDeltaScalar); - vtkm::Id colorIndex = vtkm::Id(lerpedScalar * vtkm::Float32(ColorMapSize)); - - colorIndex = vtkm::Min(vtkm::Max(colorIndex, vtkm::Id(0)), ColorMapSize - 1); - BOUNDS_CHECK(ColorMap, colorIndex); - vtkm::Vec sampleColor = ColorMap.Get(colorIndex); - //composite - sampleColor[3] *= (1.f - color[3]); - color[0] = color[0] + sampleColor[0] * sampleColor[3]; - color[1] = color[1] + sampleColor[1] * sampleColor[3]; - color[2] = color[2] + sampleColor[2] * sampleColor[3]; - color[3] = sampleColor[3] + color[3]; - - if (color[3] >= 1.0) - { - rayStatus = RAY_TERMINATED; - break; - } - currentDistance += SampleDistance; - } - - BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 0); - FrameBuffer.Set(pixelIndex * 4 + 0, color[0]); - BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 1); - FrameBuffer.Set(pixelIndex * 4 + 1, color[1]); - BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 2); - FrameBuffer.Set(pixelIndex * 4 + 2, color[2]); - BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 3); - FrameBuffer.Set(pixelIndex * 4 + 3, color[3]); - } - }; //class Sample cell - ConnectivityTracer(ConnectivityType& meshConn) - : ConnectivityBase() + : ConnectivityTracerBase() , MeshConn(meshConn) { - CountRayStatus = false; - SampleDistance = -1.f; - DebugFiltersOn = true; - RaysLost = 0; } template @@ -1033,497 +107,53 @@ public: BackgroundColor[3] = 1.f; } - virtual void SetColorMap(const vtkm::cont::ArrayHandle>& colorMap) - { - ColorMap = colorMap; - } + void Trace(Ray& rays) override; - template - VTKM_CONT void Init(Device) - { + void Trace(Ray& rays) override; - // - // Check to see if a sample distance was set - // - if (SampleDistance <= 0) - { - const vtkm::Float32 defaultSampleRate = 200.f; - // We need to set some default sample distance - vtkm::Vec extent; - extent[0] = BoundingBox[1] - BoundingBox[0]; - extent[1] = BoundingBox[3] - BoundingBox[2]; - extent[2] = BoundingBox[5] - BoundingBox[4]; - SampleDistance = vtkm::Magnitude(extent) / defaultSampleRate; - } - } - - virtual void SetVolumeData(const vtkm::cont::Field& scalarField, const vtkm::Range& scalarBounds) - { - //TODO: Need a way to tell if we have been updated - - ScalarField = scalarField; - ScalarBounds = scalarBounds; - - bool isSupportedField = (ScalarField.GetAssociation() == vtkm::cont::Field::ASSOC_POINTS || - ScalarField.GetAssociation() == vtkm::cont::Field::ASSOC_CELL_SET); - if (!isSupportedField) - throw vtkm::cont::ErrorBadValue("Field not accociated with cell set or points"); - FieldAssocPoints = ScalarField.GetAssociation() == vtkm::cont::Field::ASSOC_POINTS; - - this->Integrator = Volume; - } - - virtual void SetEnergyData(const vtkm::cont::Field& absorption, - const vtkm::Int32 numBins, - const vtkm::cont::Field& emission) - { - - bool isSupportedField = absorption.GetAssociation() == vtkm::cont::Field::ASSOC_CELL_SET; - if (!isSupportedField) - throw vtkm::cont::ErrorBadValue("Absorption Field '" + absorption.GetName() + - "' not accociated with cells"); - ScalarField = absorption; - // Check for emmision - HasEmission = false; - - if (emission.GetAssociation() != vtkm::cont::Field::ASSOC_ANY) - { - if (emission.GetAssociation() != vtkm::cont::Field::ASSOC_CELL_SET) - throw vtkm::cont::ErrorBadValue("Emission Field '" + emission.GetName() + - "' not accociated with cells"); - HasEmission = true; - EmissionField = emission; - } - // Do some basic range checking - if (numBins < 1) - throw vtkm::cont::ErrorBadValue("Number of energy bins is less than 1"); - vtkm::Id binCount = ScalarField.GetData().GetNumberOfValues(); - vtkm::Id cellCount = MeshConn.GetNumberOfCells(); - if (cellCount != (binCount / vtkm::Id(numBins))) - { - std::stringstream message; - message << "Invalid number of absorption bins\n"; - message << "Number of cells: " << cellCount << "\n"; - message << "Number of field values: " << binCount << "\n"; - message << "Number of bins: " << numBins << "\n"; - throw vtkm::cont::ErrorBadValue(message.str()); - } - if (HasEmission) - { - binCount = EmissionField.GetData().GetNumberOfValues(); - if (cellCount != (binCount / vtkm::Id(numBins))) - { - std::stringstream message; - message << "Invalid number of emission bins\n"; - message << "Number of cells: " << cellCount << "\n"; - message << "Number of field values: " << binCount << "\n"; - message << "Number of bins: " << numBins << "\n"; - throw vtkm::cont::ErrorBadValue(message.str()); - } - } - //TODO: Need a way to tell if we have been updated - this->Integrator = Energy; - } - - virtual void SetBackgroundColor(const vtkm::Vec& backgroundColor) - { - BackgroundColor = backgroundColor; - } - - virtual void SetSampleDistance(const vtkm::Float32& distance) - { - if (distance <= 0.f) - throw vtkm::cont::ErrorBadValue("Sample distance must be positive."); - SampleDistance = distance; - } - - template - void PrintRayStatus(Ray& rays, Device) - { - vtkm::Id raysExited = RayOperations::GetStatusCount(rays, RAY_EXITED_MESH, Device()); - vtkm::Id raysActive = RayOperations::GetStatusCount(rays, RAY_ACTIVE, Device()); - vtkm::Id raysAbandoned = RayOperations::GetStatusCount(rays, RAY_ABANDONED, Device()); - vtkm::Id raysExitedDom = RayOperations::GetStatusCount(rays, RAY_EXITED_DOMAIN, Device()); - std::cout << "\r Ray Status " << std::setw(10) << std::left << " Lost " << std::setw(10) - << std::left << RaysLost << std::setw(10) << std::left << " Exited " << std::setw(10) - << std::left << raysExited << std::setw(10) << std::left << " Active " - << std::setw(10) << raysActive << std::setw(10) << std::left << " Abandoned " - << std::setw(10) << raysAbandoned << " Exited Domain " << std::setw(10) << std::left - << raysExitedDom << "\n"; - } - - template - void IntersectCell(Ray& rays, detail::RayTracking& tracker, Device) - { - vtkm::cont::Timer timer; - vtkm::worklet::DispatcherMapField, Device>( - LocateCell(MeshConn)) - .Invoke(rays.HitIdx, - this->MeshConn.GetCoordinates(), - rays.Dir, - *(tracker.EnterDist), - *(tracker.ExitDist), - tracker.ExitFace, - rays.Status, - rays.Origin); - - if (this->CountRayStatus) - RaysLost = RayOperations::GetStatusCount(rays, RAY_LOST, Device()); - this->IntersectTime += timer.GetElapsedTime(); - } - - template - void AccumulatePathLengths(Ray& rays, detail::RayTracking& tracker, Device) - { - vtkm::worklet::DispatcherMapField, Device>( - AddPathLengths()) - .Invoke(rays.Status, - *(tracker.EnterDist), - *(tracker.ExitDist), - rays.GetBuffer("path_lengths").Buffer); - } - - template - void FindLostRays(Ray& rays, detail::RayTracking& tracker, Device) - { - vtkm::cont::Timer timer; - - vtkm::worklet::DispatcherMapField, Device>( - RayBumper(rays.DirX, rays.DirY, rays.DirZ, this->MeshConn)) - .Invoke(rays.HitIdx, - this->MeshConn.GetCoordinates(), - *(tracker.EnterDist), - *(tracker.ExitDist), - tracker.ExitFace, - rays.Status, - rays.Origin); - - this->LostRayTime += timer.GetElapsedTime(); - } - - template - void SampleCells(Ray& rays, detail::RayTracking& tracker, Device) - { - vtkm::cont::Timer timer; - - VTKM_ASSERT(rays.Buffers.at(0).GetNumChannels() == 4); - - if (FieldAssocPoints) - vtkm::worklet::DispatcherMapField, - Device>( - SampleCellAssocPoints( - this->SampleDistance, - vtkm::Float32(this->ScalarBounds.Min), - vtkm::Float32(this->ScalarBounds.Max), - this->ColorMap, - rays.Buffers.at(0).Buffer, - this->MeshConn)) - .Invoke(rays.HitIdx, - this->MeshConn.GetCoordinates(), - this->ScalarField.GetData(), - *(tracker.EnterDist), - *(tracker.ExitDist), - tracker.CurrentDistance, - rays.Dir, - rays.Status, - rays.Origin); - else - vtkm::worklet::DispatcherMapField, - Device>( - SampleCellAssocCells(this->SampleDistance, - vtkm::Float32(this->ScalarBounds.Min), - vtkm::Float32(this->ScalarBounds.Max), - this->ColorMap, - rays.Buffers.at(0).Buffer, - this->MeshConn)) - .Invoke(rays.HitIdx, - this->ScalarField.GetData(), - *(tracker.EnterDist), - *(tracker.ExitDist), - tracker.CurrentDistance, - rays.Status); - - this->SampleTime += timer.GetElapsedTime(); - } - - template - void IntegrateCells(Ray& rays, detail::RayTracking& tracker, Device) - { - vtkm::cont::Timer timer; - if (HasEmission) - { - bool divideEmisByAbsorp = false; - vtkm::cont::ArrayHandle absorp = rays.Buffers.at(0).Buffer; - vtkm::cont::ArrayHandle emission = rays.GetBuffer("emission").Buffer; - vtkm::worklet::DispatcherMapField, Device>( - IntegrateEmission(rays.Buffers.at(0).GetNumChannels(), divideEmisByAbsorp)) - .Invoke(rays.Status, - *(tracker.EnterDist), - *(tracker.ExitDist), - rays.Distance, - this->ScalarField.GetData(), - this->EmissionField.GetData(), - absorp, - emission, - rays.HitIdx); - } - else - { - vtkm::worklet::DispatcherMapField, Device>( - Integrate(rays.Buffers.at(0).GetNumChannels())) - .Invoke(rays.Status, - *(tracker.EnterDist), - *(tracker.ExitDist), - rays.Distance, - this->ScalarField.GetData(), - rays.Buffers.at(0).Buffer, - rays.HitIdx); - } - - IntegrateTime += timer.GetElapsedTime(); - } - - template - void PrintDebugRay(Ray& rays, vtkm::Id rayId) - { - vtkm::Id index = -1; - for (vtkm::Id i = 0; i < rays.NumRays; ++i) - { - if (rays.PixelIdx.GetPortalControl().Get(i) == rayId) - { - index = i; - break; - } - } - if (index == -1) - { - return; - } - - std::cout << "++++++++RAY " << rayId << "++++++++\n"; - std::cout << "Status: " << (int)rays.Status.GetPortalControl().Get(index) << "\n"; - std::cout << "HitIndex: " << rays.HitIdx.GetPortalControl().Get(index) << "\n"; - std::cout << "Dist " << rays.Distance.GetPortalControl().Get(index) << "\n"; - std::cout << "MinDist " << rays.MinDistance.GetPortalControl().Get(index) << "\n"; - std::cout << "Origin " << rays.Origin.GetPortalConstControl().Get(index) << "\n"; - std::cout << "Dir " << rays.Dir.GetPortalConstControl().Get(index) << "\n"; - std::cout << "+++++++++++++++++++++++++\n"; - } - - template - void OffsetMinDistances(Ray& rays, Device) - { - vtkm::worklet::DispatcherMapField, Device>( - AdvanceRay(FloatType(0.001))) - .Invoke(rays.Status, rays.MinDistance); - } - - template - struct RenderFunctor - { - ConnectivityTracer* Self; - Ray& Rays; - VTKM_CONT - RenderFunctor(ConnectivityTracer* self, Ray& rays) - : Self(self) - , Rays(rays) - { - } - template - bool operator()(Device) - { - Self->RenderOnDevice(Rays, Device()); - return true; - } - }; - - virtual void Trace(Ray& rays) - { - RenderFunctor functor(this, rays); - vtkm::cont::TryExecute(functor); - } - - virtual void Trace(Ray& rays) - { - RenderFunctor functor(this, rays); - vtkm::cont::TryExecute(functor); - } - - template - void RenderOnDevice(Ray& rays, Device) - { - - Logger* logger = Logger::GetInstance(); - logger->OpenLogEntry("conn_tracer"); - logger->AddLogData("device", GetDeviceString(Device())); - this->ResetTimers(); - vtkm::cont::Timer renderTimer; - - this->SetBoundingBox(Device()); - - bool hasPathLengths = rays.HasBuffer("path_lengths"); - - vtkm::cont::Timer timer; - this->Init(Device()); - // - // All Rays begin as exited to force intersection - // - RayOperations::ResetStatus(rays, RAY_EXITED_MESH, Device()); - - detail::RayTracking rayTracker; - - rayTracker.Init(rays.NumRays, rays.Distance, Device()); - vtkm::Float64 time = timer.GetElapsedTime(); - logger->AddLogData("init", time); - - MeshConn.Construct(Device()); - - - bool cullMissedRays = true; - bool workRemaining = true; - if (this->CountRayStatus) - { - this->PrintRayStatus(rays, Device()); - } - - do - { - { - vtkm::cont::Timer entryTimer; - // - // if ray misses the exteral face it will be marked RAY_EXITED_MESH - // - MeshConn.FindEntry(rays, Device()); - MeshEntryTime += entryTimer.GetElapsedTime(); - } - - if (this->CountRayStatus) - { - this->PrintRayStatus(rays, Device()); - } - if (cullMissedRays) - { - //TODO: if we always call this after intersection, then - // we could make a specialized version that only compacts - // hitIdx distance and status, resizing everything else. - vtkm::cont::ArrayHandle activeRays; - activeRays = RayOperations::CompactActiveRays(rays, Device()); - rayTracker.Compact(rays.Distance, activeRays, Device()); - cullMissedRays = false; - } - - if (this->CountRayStatus) - { - this->PrintRayStatus(rays, Device()); - } - // TODO: we should compact out exited rays once below a threshold - while (RayOperations::RaysInMesh(rays, Device())) - { - // - // Rays the leave the mesh will be marked as RAYEXITED_MESH - this->IntersectCell(rays, rayTracker, Device()); - // - // If the ray was lost due to precision issues, we find it. - // If it is marked RAY_ABANDONED, then something went wrong. - // - this->FindLostRays(rays, rayTracker, Device()); - // - // integrate along the ray - // - if (this->Integrator == Volume) - this->SampleCells(rays, rayTracker, Device()); - else - this->IntegrateCells(rays, rayTracker, Device()); - - if (hasPathLengths) - { - this->AccumulatePathLengths(rays, rayTracker, Device()); - } - //swap enter and exit distances - rayTracker.Swap(); - if (this->CountRayStatus) - this->PrintRayStatus(rays, Device()); - } //for - - workRemaining = RayOperations::RaysProcessed(rays, Device()) != rays.NumRays; - // - // Ensure that we move the current distance forward some - // epsilon so we dont re-enter the cell we just left. - // - if (workRemaining) - { - RayOperations::CopyDistancesToMin(rays, Device()); - this->OffsetMinDistances(rays, Device()); - } - } while (workRemaining); - - if (rays.DebugWidth != -1 && this->Integrator == Volume) - { - - vtkm::cont::ArrayHandleCounting pCounter(0, 1, rays.NumRays); - vtkm::worklet::DispatcherMapField( - IdentifyMissedRay(rays.DebugWidth, rays.DebugHeight, this->BackgroundColor)) - .Invoke(pCounter, rays.Buffers.at(0).Buffer); - } - vtkm::Float64 renderTime = renderTimer.GetElapsedTime(); - this->LogTimers(); - logger->AddLogData("active_pixels", rays.NumRays); - logger->CloseLogEntry(renderTime); - } //Render - - - VTKM_CONT ConnectivityType GetMeshConn() { return MeshConn; } + vtkm::Id GetNumberOfMeshCells() override { return MeshConn.GetNumberOfCells(); } +private: + friend struct detail::RenderFunctor; + template + void IntersectCell(Ray& rays, detail::RayTracking& tracker, Device); + + template + void AccumulatePathLengths(Ray& rays, detail::RayTracking& tracker, Device); + + template + void FindLostRays(Ray& rays, detail::RayTracking& tracker, Device); + + template + void SampleCells(Ray& rays, detail::RayTracking& tracker, Device); + + template + void IntegrateCells(Ray& rays, detail::RayTracking& tracker, Device); + + template + void OffsetMinDistances(Ray& rays, Device); + + template + void RenderOnDevice(Ray& rays, Device); -protected: ConnectivityType MeshConn; - vtkm::cont::Field ScalarField; - vtkm::cont::Field EmissionField; - vtkm::Range ScalarBounds; - vtkm::cont::ArrayHandle> ColorMap; - vtkm::Float32 BoundingBox[6]; - vtkm::cont::ArrayHandle PreviousCellIds; +}; // class ConnectivityTracer - vtkm::Vec BackgroundColor; - vtkm::Float32 SampleDistance; - bool CountRayStatus; - vtkm::Id RaysLost; - IntegrationMode Integrator; - bool DebugFiltersOn; - bool ReEnterMesh; // Do not try to re-enter the mesh - bool CreatePartialComposites; - bool FieldAssocPoints; - bool HasEmission; // Mode for integrating through engery bins - - // timers - vtkm::Float64 IntersectTime; - vtkm::Float64 IntegrateTime; - vtkm::Float64 SampleTime; - vtkm::Float64 LostRayTime; - vtkm::Float64 MeshEntryTime; - - void ResetTimers() - { - IntersectTime = 0.; - IntegrateTime = 0.; - SampleTime = 0.; - LostRayTime = 0.; - MeshEntryTime = 0.; - } - - void LogTimers() - { - Logger* logger = Logger::GetInstance(); - logger->AddLogData("intersect ", IntersectTime); - logger->AddLogData("integrate ", IntegrateTime); - logger->AddLogData("sample_cells ", SampleTime); - logger->AddLogData("lost_rays ", LostRayTime); - logger->AddLogData("mesh_entry", LostRayTime); - } - -}; // class Volume RenderExplicit +#ifndef vtk_m_rendering_raytracing_ConnectivityTracer_cxx +//extern explicit instantiations of ConnectivityTracer +extern template class VTKM_RENDERING_TEMPLATE_EXPORT + ConnectivityTracer; +extern template class VTKM_RENDERING_TEMPLATE_EXPORT + ConnectivityTracer; +extern template class VTKM_RENDERING_TEMPLATE_EXPORT + ConnectivityTracer; +extern template class VTKM_RENDERING_TEMPLATE_EXPORT + ConnectivityTracer; +extern template class VTKM_RENDERING_TEMPLATE_EXPORT + ConnectivityTracer; +#endif } } } // namespace vtkm::rendering::raytracing diff --git a/vtkm/rendering/raytracing/ConnectivityTracer.hxx b/vtkm/rendering/raytracing/ConnectivityTracer.hxx new file mode 100644 index 000000000..61980cc28 --- /dev/null +++ b/vtkm/rendering/raytracing/ConnectivityTracer.hxx @@ -0,0 +1,1265 @@ +//============================================================================ +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +// Copyright 2015 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2015 UT-Battelle, LLC. +// Copyright 2015 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +//============================================================================ +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace vtkm +{ +namespace rendering +{ +namespace raytracing +{ +namespace detail +{ +template +template +void RayTracking::Compact(vtkm::cont::ArrayHandle& compactedDistances, + vtkm::cont::ArrayHandle& masks, + Device) +{ + // + // These distances are stored in the rays, and it has + // already been compacted. + // + CurrentDistance = compactedDistances; + + vtkm::cont::ArrayHandleCast> castedMasks(masks); + + bool distance1IsEnter = EnterDist == &Distance1; + + vtkm::cont::ArrayHandle compactedDistance1; + vtkm::cont::DeviceAdapterAlgorithm::CopyIf(Distance1, masks, compactedDistance1); + Distance1 = compactedDistance1; + + vtkm::cont::ArrayHandle compactedDistance2; + vtkm::cont::DeviceAdapterAlgorithm::CopyIf(Distance2, masks, compactedDistance2); + Distance2 = compactedDistance2; + + vtkm::cont::ArrayHandle compactedExitFace; + vtkm::cont::DeviceAdapterAlgorithm::CopyIf(ExitFace, masks, compactedExitFace); + ExitFace = compactedExitFace; + + if (distance1IsEnter) + { + EnterDist = &Distance1; + ExitDist = &Distance2; + } + else + { + EnterDist = &Distance2; + ExitDist = &Distance1; + } +} + +template +template +void RayTracking::Init(const vtkm::Id size, + vtkm::cont::ArrayHandle& distances, + Device) +{ + + ExitFace.PrepareForOutput(size, Device()); + Distance1.PrepareForOutput(size, Device()); + Distance2.PrepareForOutput(size, Device()); + + CurrentDistance = distances; + // + // Set the initial Distances + // + vtkm::worklet::DispatcherMapField, Device>( + CopyAndOffset(0.0f)) + .Invoke(distances, *EnterDist); + + // + // Init the exit faces. This value is used to load the next cell + // base on the cell and face it left + // + vtkm::worklet::DispatcherMapField, Device>(MemSet(-1)) + .Invoke(ExitFace); + + vtkm::worklet::DispatcherMapField, Device>(MemSet(-1)) + .Invoke(*ExitDist); +} + +template +void RayTracking::Swap() +{ + vtkm::cont::ArrayHandle* tmpPtr; + tmpPtr = EnterDist; + EnterDist = ExitDist; + ExitDist = tmpPtr; +} +} //namespace detail + + +// +// Advance Ray +// After a ray leaves the mesh, we need to check to see +// of the ray re-enters the mesh within this domain. This +// function moves the ray forward some offset to prevent +// "shadowing" and hitting the same exit point. +// +template +class AdvanceRay : public vtkm::worklet::WorkletMapField +{ + FloatType Offset; + +public: + VTKM_CONT + AdvanceRay(const FloatType offset = 0.00001) + : Offset(offset) + { + } + typedef void ControlSignature(FieldIn<>, FieldInOut<>); + typedef void ExecutionSignature(_1, _2); + + VTKM_EXEC inline void operator()(const vtkm::UInt8& status, FloatType& distance) const + { + if (status == RAY_EXITED_MESH) + distance += Offset; + } +}; //class AdvanceRay + +template +class LocateCell : public vtkm::worklet::WorkletMapField +{ +private: + MeshType MeshConn; + CellIntersector Intersector; + +public: + template + LocateCell(ConnectivityType& meshConn) + : MeshConn(meshConn) + { + } + + typedef void ControlSignature(FieldInOut<>, + WholeArrayIn<>, + FieldIn<>, + FieldInOut<>, + FieldInOut<>, + FieldInOut<>, + FieldInOut<>, + FieldIn<>); + typedef void ExecutionSignature(_1, _2, _3, _4, _5, _6, _7, _8); + + template + VTKM_EXEC inline void operator()(vtkm::Id& currentCell, + PointPortalType& vertices, + const vtkm::Vec& dir, + FloatType& enterDistance, + FloatType& exitDistance, + vtkm::Int32& enterFace, + vtkm::UInt8& rayStatus, + const vtkm::Vec& origin) const + { + if (enterFace != -1 && rayStatus == RAY_ACTIVE) + { + currentCell = MeshConn.GetConnectingCell(currentCell, enterFace); + if (currentCell == -1) + rayStatus = RAY_EXITED_MESH; + enterFace = -1; + } + //This ray is dead or exited the mesh and needs re-entry + if (rayStatus != RAY_ACTIVE) + { + return; + } + FloatType xpoints[8]; + FloatType ypoints[8]; + FloatType zpoints[8]; + vtkm::Id cellConn[8]; + FloatType distances[6]; + + const vtkm::Int32 numIndices = MeshConn.GetCellIndices(cellConn, currentCell); + //load local cell data + for (int i = 0; i < numIndices; ++i) + { + BOUNDS_CHECK(vertices, cellConn[i]); + vtkm::Vec point = vtkm::Vec(vertices.Get(cellConn[i])); + xpoints[i] = point[0]; + ypoints[i] = point[1]; + zpoints[i] = point[2]; + } + const vtkm::UInt8 cellShape = MeshConn.GetCellShape(currentCell); + Intersector.IntersectCell(xpoints, ypoints, zpoints, dir, origin, distances, cellShape); + const vtkm::Int32 numFaces = + CellTables::Get().FaceLookUp[CellTables::Get().CellTypeLookUp[cellShape]][1]; + //vtkm::Int32 minFace = 6; + vtkm::Int32 maxFace = -1; + + FloatType minDistance = static_cast(1e32); + FloatType maxDistance = static_cast(-1); + int hitCount = 0; + for (vtkm::Int32 i = 0; i < numFaces; ++i) + { + FloatType dist = distances[i]; + + if (dist != -1) + { + hitCount++; + if (dist < minDistance) + { + minDistance = dist; + //minFace = i; + } + if (dist > maxDistance) + { + maxDistance = dist; + maxFace = i; + } + } + } + + if (maxDistance <= enterDistance || minDistance == maxDistance) + { + rayStatus = RAY_LOST; + } + else + { + enterDistance = minDistance; + exitDistance = maxDistance; + enterFace = maxFace; + } + + } //operator +}; //class LocateCell + +template +class RayBumper : public vtkm::worklet::WorkletMapField +{ +private: + typedef typename vtkm::cont::ArrayHandle FloatTypeHandle; + typedef typename FloatTypeHandle::template ExecutionTypes::Portal FloatTypePortal; + FloatTypePortal DirectionsX; + FloatTypePortal DirectionsY; + FloatTypePortal DirectionsZ; + MeshType MeshConn; + CellIntersector Intersector; + const vtkm::UInt8 FailureStatus; // the status to assign ray if we fail to find the intersection +public: + template + RayBumper(FloatTypeHandle dirsx, + FloatTypeHandle dirsy, + FloatTypeHandle dirsz, + ConnectivityType meshConn, + vtkm::UInt8 failureStatus = RAY_ABANDONED) + : DirectionsX(dirsx.PrepareForInPlace(Device())) + , DirectionsY(dirsy.PrepareForInPlace(Device())) + , DirectionsZ(dirsz.PrepareForInPlace(Device())) + , MeshConn(meshConn) + , FailureStatus(failureStatus) + { + } + + + typedef void ControlSignature(FieldInOut<>, + WholeArrayIn<>, + FieldInOut<>, + FieldInOut<>, + FieldInOut<>, + FieldInOut<>, + FieldIn<>); + typedef void ExecutionSignature(_1, _2, _3, _4, _5, WorkIndex, _6, _7); + + template + VTKM_EXEC inline void operator()(vtkm::Id& currentCell, + PointPortalType& vertices, + FloatType& enterDistance, + FloatType& exitDistance, + vtkm::Int32& enterFace, + const vtkm::Id& pixelIndex, + vtkm::UInt8& rayStatus, + const vtkm::Vec& origin) const + { + // We only process lost rays + if (rayStatus != RAY_LOST) + { + return; + } + + FloatType xpoints[8]; + FloatType ypoints[8]; + FloatType zpoints[8]; + vtkm::Id cellConn[8]; + FloatType distances[6]; + + vtkm::Vec centroid(0., 0., 0.); + const vtkm::Int32 numIndices = MeshConn.GetCellIndices(cellConn, currentCell); + //load local cell data + for (int i = 0; i < numIndices; ++i) + { + BOUNDS_CHECK(vertices, cellConn[i]); + vtkm::Vec point = vtkm::Vec(vertices.Get(cellConn[i])); + centroid = centroid + point; + xpoints[i] = point[0]; + ypoints[i] = point[1]; + zpoints[i] = point[2]; + } + + FloatType invNumIndices = static_cast(1.) / static_cast(numIndices); + centroid[0] = centroid[0] * invNumIndices; + centroid[1] = centroid[1] * invNumIndices; + centroid[2] = centroid[2] * invNumIndices; + + vtkm::Vec toCentroid = centroid - origin; + vtkm::Normalize(toCentroid); + + vtkm::Vec dir( + DirectionsX.Get(pixelIndex), DirectionsY.Get(pixelIndex), DirectionsZ.Get(pixelIndex)); + vtkm::Vec bump = toCentroid - dir; + dir = dir + RAY_TUG_EPSILON * bump; + + vtkm::Normalize(dir); + + DirectionsX.Set(pixelIndex, dir[0]); + DirectionsY.Set(pixelIndex, dir[1]); + DirectionsZ.Set(pixelIndex, dir[2]); + + const vtkm::UInt8 cellShape = MeshConn.GetCellShape(currentCell); + Intersector.IntersectCell(xpoints, ypoints, zpoints, dir, origin, distances, cellShape); + const vtkm::Int32 numFaces = + CellTables::Get().FaceLookUp[CellTables::Get().CellTypeLookUp[cellShape]][1]; + + //vtkm::Int32 minFace = 6; + vtkm::Int32 maxFace = -1; + FloatType minDistance = static_cast(1e32); + FloatType maxDistance = static_cast(-1); + int hitCount = 0; + for (int i = 0; i < numFaces; ++i) + { + FloatType dist = distances[i]; + + if (dist != -1) + { + hitCount++; + if (dist < minDistance) + { + minDistance = dist; + //minFace = i; + } + if (dist >= maxDistance) + { + maxDistance = dist; + maxFace = i; + } + } + } + if (minDistance >= maxDistance) + { + rayStatus = FailureStatus; + } + else + { + enterDistance = minDistance; + exitDistance = maxDistance; + enterFace = maxFace; + rayStatus = RAY_ACTIVE; //re-activate ray + } + + } //operator +}; //class RayBumper + +template +class AddPathLengths : public vtkm::worklet::WorkletMapField +{ +public: + VTKM_CONT + AddPathLengths() {} + + typedef void ControlSignature(FieldIn, // ray status + FieldIn, // cell enter distance + FieldIn, // cell exit distance + FieldInOut); // ray absorption data + + typedef void ExecutionSignature(_1, _2, _3, _4); + + VTKM_EXEC inline void operator()(const vtkm::UInt8& rayStatus, + const FloatType& enterDistance, + const FloatType& exitDistance, + FloatType& distance) const + { + if (rayStatus != RAY_ACTIVE) + { + return; + } + + if (exitDistance <= enterDistance) + { + return; + } + + FloatType segmentLength = exitDistance - enterDistance; + distance += segmentLength; + } +}; + +template +class Integrate : public vtkm::worklet::WorkletMapField +{ +private: + const vtkm::Int32 NumBins; + +public: + VTKM_CONT + Integrate(const vtkm::Int32 numBins) + : NumBins(numBins) + { + } + + typedef void ControlSignature(FieldIn, // ray status + FieldIn, // cell enter distance + FieldIn, // cell exit distance + FieldInOut, // current distance + WholeArrayIn, // cell absorption data array + WholeArrayInOut, // ray absorption data + FieldIn); // current cell + + typedef void ExecutionSignature(_1, _2, _3, _4, _5, _6, _7, WorkIndex); + + template + VTKM_EXEC inline void operator()(const vtkm::UInt8& rayStatus, + const FloatType& enterDistance, + const FloatType& exitDistance, + FloatType& currentDistance, + const CellDataPortalType& cellData, + RayDataPortalType& energyBins, + const vtkm::Id& currentCell, + const vtkm::Id& rayIndex) const + { + if (rayStatus != RAY_ACTIVE) + { + return; + } + if (exitDistance <= enterDistance) + { + return; + } + + FloatType segmentLength = exitDistance - enterDistance; + + vtkm::Id rayOffset = NumBins * rayIndex; + vtkm::Id cellOffset = NumBins * currentCell; + for (vtkm::Int32 i = 0; i < NumBins; ++i) + { + BOUNDS_CHECK(cellData, cellOffset + i); + FloatType absorb = static_cast(cellData.Get(cellOffset + i)); + + absorb = vtkm::Exp(-absorb * segmentLength); + BOUNDS_CHECK(energyBins, rayOffset + i); + FloatType intensity = static_cast(energyBins.Get(rayOffset + i)); + energyBins.Set(rayOffset + i, intensity * absorb); + } + currentDistance = exitDistance; + } +}; + +template +class IntegrateEmission : public vtkm::worklet::WorkletMapField +{ +private: + const vtkm::Int32 NumBins; + bool DivideEmisByAbsorb; + +public: + VTKM_CONT + IntegrateEmission(const vtkm::Int32 numBins, const bool divideEmisByAbsorb) + : NumBins(numBins) + , DivideEmisByAbsorb(divideEmisByAbsorb) + { + } + + typedef void ControlSignature(FieldIn<>, // ray status + FieldIn<>, // cell enter distance + FieldIn<>, // cell exit distance + FieldInOut<>, // current distance + WholeArrayIn, // cell absorption data array + WholeArrayIn, // cell emission data array + WholeArrayInOut<>, // ray absorption data + WholeArrayInOut<>, // ray emission data + FieldIn<>); // current cell + + typedef void ExecutionSignature(_1, _2, _3, _4, _5, _6, _7, _8, _9, WorkIndex); + + template + VTKM_EXEC inline void operator()(const vtkm::UInt8& rayStatus, + const FloatType& enterDistance, + const FloatType& exitDistance, + FloatType& currentDistance, + const CellAbsPortalType& absorptionData, + const CellEmisPortalType& emissionData, + RayDataPortalType& absorptionBins, + RayDataPortalType& emissionBins, + const vtkm::Id& currentCell, + const vtkm::Id& rayIndex) const + { + if (rayStatus != RAY_ACTIVE) + { + return; + } + if (exitDistance <= enterDistance) + { + return; + } + + FloatType segmentLength = exitDistance - enterDistance; + + vtkm::Id rayOffset = NumBins * rayIndex; + vtkm::Id cellOffset = NumBins * currentCell; + for (vtkm::Int32 i = 0; i < NumBins; ++i) + { + BOUNDS_CHECK(absorptionData, cellOffset + i); + FloatType absorb = static_cast(absorptionData.Get(cellOffset + i)); + BOUNDS_CHECK(emissionData, cellOffset + i); + FloatType emission = static_cast(emissionData.Get(cellOffset + i)); + + if (DivideEmisByAbsorb) + { + emission /= absorb; + } + + FloatType tmp = vtkm::Exp(-absorb * segmentLength); + BOUNDS_CHECK(absorptionBins, rayOffset + i); + + // + // Traditionally, we would only keep track of a single intensity value per ray + // per bin and we would integrate from the begining to end of the ray. In a + // distributed memory setting, we would move cell data around so that the + // entire ray could be traced, but in situ, moving that much cell data around + // could blow memory. Here we are keeping track of two values. Total absorption + // through this contigious segment of the mesh, and the amount of emissed engery + // that makes it out of this mesh segment. If this is really run on a single node, + // we can get the final energy value by multiplying the background intensity by + // the total absorption of the mesh segment and add in the amount of emissed + // enegery that escapes. + // + FloatType absorbIntensity = static_cast(absorptionBins.Get(rayOffset + i)); + FloatType emissionIntensity = static_cast(emissionBins.Get(rayOffset + i)); + + absorptionBins.Set(rayOffset + i, absorbIntensity * tmp); + + emissionIntensity = emissionIntensity * tmp + emission * (1.f - tmp); + + BOUNDS_CHECK(emissionBins, rayOffset + i); + emissionBins.Set(rayOffset + i, emissionIntensity); + } + currentDistance = exitDistance; + } +}; +// +// IdentifyMissedRay is a debugging routine that detects +// rays that fail to have any value because of a external +// intersection and cell intersection mismatch +// +// +class IdentifyMissedRay : public vtkm::worklet::WorkletMapField +{ +public: + vtkm::Id Width; + vtkm::Id Height; + vtkm::Vec BGColor; + IdentifyMissedRay(const vtkm::Id width, + const vtkm::Id height, + vtkm::Vec bgcolor) + : Width(width) + , Height(height) + , BGColor(bgcolor) + { + } + typedef void ControlSignature(FieldIn<>, WholeArrayIn<>); + typedef void ExecutionSignature(_1, _2); + + + VTKM_EXEC inline bool IsBGColor(const vtkm::Vec color) const + { + bool isBG = false; + + if (color[0] == BGColor[0] && color[1] == BGColor[1] && color[2] == BGColor[2] && + color[3] == BGColor[3]) + isBG = true; + return isBG; + } + + template + VTKM_EXEC inline void operator()(const vtkm::Id& pixelId, ColorBufferType& buffer) const + { + vtkm::Id x = pixelId % Width; + vtkm::Id y = pixelId / Width; + + // Conservative check, we only want to check pixels in the middle + if (x <= 0 || y <= 0) + return; + if (x >= Width - 1 || y >= Height - 1) + return; + vtkm::Vec pixel; + pixel[0] = static_cast(buffer.Get(pixelId * 4 + 0)); + pixel[1] = static_cast(buffer.Get(pixelId * 4 + 1)); + pixel[2] = static_cast(buffer.Get(pixelId * 4 + 2)); + pixel[3] = static_cast(buffer.Get(pixelId * 4 + 3)); + if (!IsBGColor(pixel)) + return; + vtkm::Id p0 = (y)*Width + (x + 1); + vtkm::Id p1 = (y)*Width + (x - 1); + vtkm::Id p2 = (y + 1) * Width + (x); + vtkm::Id p3 = (y - 1) * Width + (x); + pixel[0] = static_cast(buffer.Get(p0 * 4 + 0)); + pixel[1] = static_cast(buffer.Get(p0 * 4 + 1)); + pixel[2] = static_cast(buffer.Get(p0 * 4 + 2)); + pixel[3] = static_cast(buffer.Get(p0 * 4 + 3)); + if (IsBGColor(pixel)) + return; + pixel[0] = static_cast(buffer.Get(p1 * 4 + 0)); + pixel[1] = static_cast(buffer.Get(p1 * 4 + 1)); + pixel[2] = static_cast(buffer.Get(p1 * 4 + 2)); + pixel[3] = static_cast(buffer.Get(p1 * 4 + 3)); + if (IsBGColor(pixel)) + return; + pixel[0] = static_cast(buffer.Get(p2 * 4 + 0)); + pixel[1] = static_cast(buffer.Get(p2 * 4 + 1)); + pixel[2] = static_cast(buffer.Get(p2 * 4 + 2)); + pixel[3] = static_cast(buffer.Get(p2 * 4 + 3)); + if (IsBGColor(pixel)) + return; + pixel[0] = static_cast(buffer.Get(p3 * 4 + 0)); + pixel[1] = static_cast(buffer.Get(p3 * 4 + 1)); + pixel[2] = static_cast(buffer.Get(p3 * 4 + 2)); + pixel[3] = static_cast(buffer.Get(p3 * 4 + 3)); + if (IsBGColor(pixel)) + return; + + printf("Possible error ray missed ray %d\n", (int)pixelId); + } +}; + +template +class SampleCellAssocCells : public vtkm::worklet::WorkletMapField +{ +private: + typedef typename vtkm::cont::ArrayHandle> ColorHandle; + typedef typename vtkm::cont::ArrayHandle ColorBuffer; + typedef typename ColorHandle::ExecutionTypes::PortalConst ColorConstPortal; + typedef typename ColorBuffer::template ExecutionTypes::Portal ColorPortal; + + CellSampler Sampler; + FloatType SampleDistance; + FloatType MinScalar; + FloatType InvDeltaScalar; + ColorPortal FrameBuffer; + ColorConstPortal ColorMap; + MeshType MeshConn; + vtkm::Int32 ColorMapSize; + +public: + template + SampleCellAssocCells(const FloatType& sampleDistance, + const FloatType& minScalar, + const FloatType& maxScalar, + ColorHandle& colorMap, + ColorBuffer& frameBuffer, + ConnectivityType& meshConn) + : SampleDistance(sampleDistance) + , MinScalar(minScalar) + , ColorMap(colorMap.PrepareForInput(Device())) + , MeshConn(meshConn) + { + InvDeltaScalar = (minScalar == maxScalar) ? 1.f : 1.f / (maxScalar - minScalar); + ColorMapSize = static_cast(ColorMap.GetNumberOfValues()); + this->FrameBuffer = frameBuffer.PrepareForOutput(frameBuffer.GetNumberOfValues(), Device()); + } + + + typedef void ControlSignature(FieldIn<>, + WholeArrayIn, + FieldIn<>, + FieldIn<>, + FieldInOut<>, + FieldInOut<>); + typedef void ExecutionSignature(_1, _2, _3, _4, _5, _6, WorkIndex); + + template + VTKM_EXEC inline void operator()(const vtkm::Id& currentCell, + ScalarPortalType& scalarPortal, + const FloatType& enterDistance, + const FloatType& exitDistance, + FloatType& currentDistance, + vtkm::UInt8& rayStatus, + const vtkm::Id& pixelIndex) const + { + + if (rayStatus != RAY_ACTIVE) + return; + + vtkm::Vec color; + BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 0); + color[0] = static_cast(FrameBuffer.Get(pixelIndex * 4 + 0)); + BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 1); + color[1] = static_cast(FrameBuffer.Get(pixelIndex * 4 + 1)); + BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 2); + color[2] = static_cast(FrameBuffer.Get(pixelIndex * 4 + 2)); + BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 3); + color[3] = static_cast(FrameBuffer.Get(pixelIndex * 4 + 3)); + + vtkm::Float32 scalar; + BOUNDS_CHECK(scalarPortal, currentCell); + scalar = vtkm::Float32(scalarPortal.Get(currentCell)); + // + // There can be mismatches in the initial enter distance and the current distance + // due to lost rays at cell borders. For now, + // we will just advance the current position to the enter distance, since otherwise, + // the pixel would never be sampled. + // + if (currentDistance < enterDistance) + currentDistance = enterDistance; + + vtkm::Float32 lerpedScalar; + lerpedScalar = static_cast((scalar - MinScalar) * InvDeltaScalar); + vtkm::Id colorIndex = vtkm::Id(lerpedScalar * vtkm::Float32(ColorMapSize)); + if (colorIndex < 0) + colorIndex = 0; + if (colorIndex >= ColorMapSize) + colorIndex = ColorMapSize - 1; + BOUNDS_CHECK(ColorMap, colorIndex); + vtkm::Vec sampleColor = ColorMap.Get(colorIndex); + + while (enterDistance <= currentDistance && currentDistance <= exitDistance) + { + //composite + sampleColor[3] *= (1.f - color[3]); + color[0] = color[0] + sampleColor[0] * sampleColor[3]; + color[1] = color[1] + sampleColor[1] * sampleColor[3]; + color[2] = color[2] + sampleColor[2] * sampleColor[3]; + color[3] = sampleColor[3] + color[3]; + + if (color[3] > 1.) + { + rayStatus = RAY_TERMINATED; + break; + } + currentDistance += SampleDistance; + } + + BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 0); + FrameBuffer.Set(pixelIndex * 4 + 0, color[0]); + BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 1); + FrameBuffer.Set(pixelIndex * 4 + 1, color[1]); + BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 2); + FrameBuffer.Set(pixelIndex * 4 + 2, color[2]); + BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 3); + FrameBuffer.Set(pixelIndex * 4 + 3, color[3]); + } +}; //class Sample cell + +template +class SampleCellAssocPoints : public vtkm::worklet::WorkletMapField +{ +private: + typedef typename vtkm::cont::ArrayHandle> ColorHandle; + typedef typename vtkm::cont::ArrayHandle ColorBuffer; + typedef typename ColorHandle::ExecutionTypes::PortalConst ColorConstPortal; + typedef typename ColorBuffer::template ExecutionTypes::Portal ColorPortal; + + CellSampler Sampler; + FloatType SampleDistance; + MeshType MeshConn; + FloatType MinScalar; + FloatType InvDeltaScalar; + ColorPortal FrameBuffer; + ColorConstPortal ColorMap; + vtkm::Id ColorMapSize; + +public: + template + SampleCellAssocPoints(const FloatType& sampleDistance, + const FloatType& minScalar, + const FloatType& maxScalar, + ColorHandle& colorMap, + ColorBuffer& frameBuffer, + ConnectivityType& meshConn) + : SampleDistance(sampleDistance) + , MeshConn(meshConn) + , MinScalar(minScalar) + , ColorMap(colorMap.PrepareForInput(Device())) + { + InvDeltaScalar = (minScalar == maxScalar) ? 1.f : 1.f / (maxScalar - minScalar); + ColorMapSize = ColorMap.GetNumberOfValues(); + this->FrameBuffer = frameBuffer.PrepareForOutput(frameBuffer.GetNumberOfValues(), Device()); + } + + + typedef void ControlSignature(FieldIn<>, + WholeArrayIn, + WholeArrayIn, + FieldIn<>, + FieldIn<>, + FieldInOut<>, + FieldIn<>, + FieldInOut<>, + FieldIn<>); + typedef void ExecutionSignature(_1, _2, _3, _4, _5, _6, _7, _8, WorkIndex, _9); + + template + VTKM_EXEC inline void operator()(const vtkm::Id& currentCell, + PointPortalType& vertices, + ScalarPortalType& scalarPortal, + const FloatType& enterDistance, + const FloatType& exitDistance, + FloatType& currentDistance, + const vtkm::Vec& dir, + vtkm::UInt8& rayStatus, + const vtkm::Id& pixelIndex, + const vtkm::Vec& origin) const + { + + if (rayStatus != RAY_ACTIVE) + return; + + vtkm::Vec color; + BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 0); + color[0] = static_cast(FrameBuffer.Get(pixelIndex * 4 + 0)); + BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 1); + color[1] = static_cast(FrameBuffer.Get(pixelIndex * 4 + 1)); + BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 2); + color[2] = static_cast(FrameBuffer.Get(pixelIndex * 4 + 2)); + BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 3); + color[3] = static_cast(FrameBuffer.Get(pixelIndex * 4 + 3)); + + if (color[3] >= 1.f) + { + rayStatus = RAY_TERMINATED; + return; + } + vtkm::Vec scalars; + vtkm::Vec, 8> points; + // silence "may" be uninitialized warning + for (vtkm::Int32 i = 0; i < 8; ++i) + { + scalars[i] = 0.f; + points[i] = vtkm::Vec(0.f, 0.f, 0.f); + } + //load local scalar cell data + vtkm::Id cellConn[8]; + const vtkm::Int32 numIndices = MeshConn.GetCellIndices(cellConn, currentCell); + for (int i = 0; i < numIndices; ++i) + { + BOUNDS_CHECK(scalarPortal, cellConn[i]); + scalars[i] = static_cast(scalarPortal.Get(cellConn[i])); + BOUNDS_CHECK(vertices, cellConn[i]); + points[i] = vtkm::Vec(vertices.Get(cellConn[i])); + } + // + // There can be mismatches in the initial enter distance and the current distance + // due to lost rays at cell borders. For now, + // we will just advance the current position to the enter distance, since otherwise, + // the pixel would never be sampled. + // + if (currentDistance < enterDistance) + { + currentDistance = enterDistance; + } + + const vtkm::Int32 cellShape = MeshConn.GetCellShape(currentCell); + while (enterDistance <= currentDistance && currentDistance <= exitDistance) + { + vtkm::Vec sampleLoc = origin + currentDistance * dir; + vtkm::Float32 lerpedScalar; + bool validSample = + Sampler.SampleCell(points, scalars, sampleLoc, lerpedScalar, *this, cellShape); + if (!validSample) + { + // + // There is a slight mismatch between intersections and parametric coordinates + // which results in a invalid sample very close to the cell edge. Just throw + // this sample away, and move to the next sample. + // + + //There should be a sample here, so offset and try again. + + currentDistance += 0.00001f; + continue; + } + lerpedScalar = static_cast((lerpedScalar - MinScalar) * InvDeltaScalar); + vtkm::Id colorIndex = vtkm::Id(lerpedScalar * vtkm::Float32(ColorMapSize)); + + colorIndex = vtkm::Min(vtkm::Max(colorIndex, vtkm::Id(0)), ColorMapSize - 1); + BOUNDS_CHECK(ColorMap, colorIndex); + vtkm::Vec sampleColor = ColorMap.Get(colorIndex); + //composite + sampleColor[3] *= (1.f - color[3]); + color[0] = color[0] + sampleColor[0] * sampleColor[3]; + color[1] = color[1] + sampleColor[1] * sampleColor[3]; + color[2] = color[2] + sampleColor[2] * sampleColor[3]; + color[3] = sampleColor[3] + color[3]; + + if (color[3] >= 1.0) + { + rayStatus = RAY_TERMINATED; + break; + } + currentDistance += SampleDistance; + } + + BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 0); + FrameBuffer.Set(pixelIndex * 4 + 0, color[0]); + BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 1); + FrameBuffer.Set(pixelIndex * 4 + 1, color[1]); + BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 2); + FrameBuffer.Set(pixelIndex * 4 + 2, color[2]); + BOUNDS_CHECK(FrameBuffer, pixelIndex * 4 + 3); + FrameBuffer.Set(pixelIndex * 4 + 3, color[3]); + } +}; //class Sample cell + +template +template +void ConnectivityTracer::IntersectCell( + Ray& rays, + detail::RayTracking& tracker, + Device) +{ + using LocateC = LocateCell>; + vtkm::cont::Timer timer; + vtkm::worklet::DispatcherMapField(LocateC(MeshConn)) + .Invoke(rays.HitIdx, + this->MeshConn.GetCoordinates(), + rays.Dir, + *(tracker.EnterDist), + *(tracker.ExitDist), + tracker.ExitFace, + rays.Status, + rays.Origin); + + if (this->CountRayStatus) + RaysLost = RayOperations::GetStatusCount(rays, RAY_LOST, Device()); + this->IntersectTime += timer.GetElapsedTime(); +} + +template +template +void ConnectivityTracer::AccumulatePathLengths( + Ray& rays, + detail::RayTracking& tracker, + Device) +{ + vtkm::worklet::DispatcherMapField, Device>(AddPathLengths()) + .Invoke(rays.Status, + *(tracker.EnterDist), + *(tracker.ExitDist), + rays.GetBuffer("path_lengths").Buffer); +} + +template +template +void ConnectivityTracer::FindLostRays( + Ray& rays, + detail::RayTracking& tracker, + Device) +{ + using RayB = RayBumper>; + vtkm::cont::Timer timer; + + vtkm::worklet::DispatcherMapField( + RayB(rays.DirX, rays.DirY, rays.DirZ, this->MeshConn)) + .Invoke(rays.HitIdx, + this->MeshConn.GetCoordinates(), + *(tracker.EnterDist), + *(tracker.ExitDist), + tracker.ExitFace, + rays.Status, + rays.Origin); + + this->LostRayTime += timer.GetElapsedTime(); +} + +template +template +void ConnectivityTracer::SampleCells( + Ray& rays, + detail::RayTracking& tracker, + Device) +{ + using SamplePoints = + SampleCellAssocPoints>; + using SampleCells = + SampleCellAssocCells>; + vtkm::cont::Timer timer; + + VTKM_ASSERT(rays.Buffers.at(0).GetNumChannels() == 4); + + if (FieldAssocPoints) + { + vtkm::worklet::DispatcherMapField( + SamplePoints(this->SampleDistance, + vtkm::Float32(this->ScalarBounds.Min), + vtkm::Float32(this->ScalarBounds.Max), + this->ColorMap, + rays.Buffers.at(0).Buffer, + this->MeshConn)) + .Invoke(rays.HitIdx, + this->MeshConn.GetCoordinates(), + this->ScalarField.GetData(), + *(tracker.EnterDist), + *(tracker.ExitDist), + tracker.CurrentDistance, + rays.Dir, + rays.Status, + rays.Origin); + } + else + { + vtkm::worklet::DispatcherMapField( + SampleCells(this->SampleDistance, + vtkm::Float32(this->ScalarBounds.Min), + vtkm::Float32(this->ScalarBounds.Max), + this->ColorMap, + rays.Buffers.at(0).Buffer, + this->MeshConn)) + .Invoke(rays.HitIdx, + this->ScalarField.GetData(), + *(tracker.EnterDist), + *(tracker.ExitDist), + tracker.CurrentDistance, + rays.Status); + } + + this->SampleTime += timer.GetElapsedTime(); +} + +template +template +void ConnectivityTracer::IntegrateCells( + Ray& rays, + detail::RayTracking& tracker, + Device) +{ + vtkm::cont::Timer timer; + if (HasEmission) + { + bool divideEmisByAbsorp = false; + vtkm::cont::ArrayHandle absorp = rays.Buffers.at(0).Buffer; + vtkm::cont::ArrayHandle emission = rays.GetBuffer("emission").Buffer; + vtkm::worklet::DispatcherMapField, Device>( + IntegrateEmission(rays.Buffers.at(0).GetNumChannels(), divideEmisByAbsorp)) + .Invoke(rays.Status, + *(tracker.EnterDist), + *(tracker.ExitDist), + rays.Distance, + this->ScalarField.GetData(), + this->EmissionField.GetData(), + absorp, + emission, + rays.HitIdx); + } + else + { + vtkm::worklet::DispatcherMapField, Device>( + Integrate(rays.Buffers.at(0).GetNumChannels())) + .Invoke(rays.Status, + *(tracker.EnterDist), + *(tracker.ExitDist), + rays.Distance, + this->ScalarField.GetData(), + rays.Buffers.at(0).Buffer, + rays.HitIdx); + } + + IntegrateTime += timer.GetElapsedTime(); +} + +// template +// template +// void ConnectivityTracer::PrintDebugRay(Ray& rays, vtkm::Id rayId) +// { +// vtkm::Id index = -1; +// for (vtkm::Id i = 0; i < rays.NumRays; ++i) +// { +// if (rays.PixelIdx.GetPortalControl().Get(i) == rayId) +// { +// index = i; +// break; +// } +// } +// if (index == -1) +// { +// return; +// } + +// std::cout << "++++++++RAY " << rayId << "++++++++\n"; +// std::cout << "Status: " << (int)rays.Status.GetPortalControl().Get(index) << "\n"; +// std::cout << "HitIndex: " << rays.HitIdx.GetPortalControl().Get(index) << "\n"; +// std::cout << "Dist " << rays.Distance.GetPortalControl().Get(index) << "\n"; +// std::cout << "MinDist " << rays.MinDistance.GetPortalControl().Get(index) << "\n"; +// std::cout << "Origin " << rays.Origin.GetPortalConstControl().Get(index) << "\n"; +// std::cout << "Dir " << rays.Dir.GetPortalConstControl().Get(index) << "\n"; +// std::cout << "+++++++++++++++++++++++++\n"; +// } + +template +template +void ConnectivityTracer::OffsetMinDistances(Ray& rays, + Device) +{ + vtkm::worklet::DispatcherMapField, Device>( + AdvanceRay(FloatType(0.001))) + .Invoke(rays.Status, rays.MinDistance); +} + +template +template +void ConnectivityTracer::RenderOnDevice(Ray& rays, Device) +{ + Logger* logger = Logger::GetInstance(); + logger->OpenLogEntry("conn_tracer"); + logger->AddLogData("device", GetDeviceString(Device())); + this->ResetTimers(); + vtkm::cont::Timer renderTimer; + + this->SetBoundingBox(Device()); + + bool hasPathLengths = rays.HasBuffer("path_lengths"); + + vtkm::cont::Timer timer; + this->Init(); + // + // All Rays begin as exited to force intersection + // + RayOperations::ResetStatus(rays, RAY_EXITED_MESH, Device()); + + detail::RayTracking rayTracker; + + rayTracker.Init(rays.NumRays, rays.Distance, Device()); + vtkm::Float64 time = timer.GetElapsedTime(); + logger->AddLogData("init", time); + + MeshConn.Construct(Device()); + + + bool cullMissedRays = true; + bool workRemaining = true; + if (this->CountRayStatus) + { + this->PrintRayStatus(rays, Device()); + } + + do + { + { + vtkm::cont::Timer entryTimer; + // + // if ray misses the exteral face it will be marked RAY_EXITED_MESH + // + MeshConn.FindEntry(rays, Device()); + MeshEntryTime += entryTimer.GetElapsedTime(); + } + + if (this->CountRayStatus) + { + this->PrintRayStatus(rays, Device()); + } + if (cullMissedRays) + { + //TODO: if we always call this after intersection, then + // we could make a specialized version that only compacts + // hitIdx distance and status, resizing everything else. + vtkm::cont::ArrayHandle activeRays; + activeRays = RayOperations::CompactActiveRays(rays, Device()); + rayTracker.Compact(rays.Distance, activeRays, Device()); + cullMissedRays = false; + } + + if (this->CountRayStatus) + { + this->PrintRayStatus(rays, Device()); + } + // TODO: we should compact out exited rays once below a threshold + while (RayOperations::RaysInMesh(rays, Device())) + { + // + // Rays the leave the mesh will be marked as RAYEXITED_MESH + this->IntersectCell(rays, rayTracker, Device()); + // + // If the ray was lost due to precision issues, we find it. + // If it is marked RAY_ABANDONED, then something went wrong. + // + this->FindLostRays(rays, rayTracker, Device()); + // + // integrate along the ray + // + if (this->Integrator == Volume) + this->SampleCells(rays, rayTracker, Device()); + else + this->IntegrateCells(rays, rayTracker, Device()); + + if (hasPathLengths) + { + this->AccumulatePathLengths(rays, rayTracker, Device()); + } + //swap enter and exit distances + rayTracker.Swap(); + if (this->CountRayStatus) + this->PrintRayStatus(rays, Device()); + } //for + + workRemaining = RayOperations::RaysProcessed(rays, Device()) != rays.NumRays; + // + // Ensure that we move the current distance forward some + // epsilon so we dont re-enter the cell we just left. + // + if (workRemaining) + { + RayOperations::CopyDistancesToMin(rays, Device()); + this->OffsetMinDistances(rays, Device()); + } + } while (workRemaining); + + if (rays.DebugWidth != -1 && this->Integrator == Volume) + { + + vtkm::cont::ArrayHandleCounting pCounter(0, 1, rays.NumRays); + vtkm::worklet::DispatcherMapField( + IdentifyMissedRay(rays.DebugWidth, rays.DebugHeight, this->BackgroundColor)) + .Invoke(pCounter, rays.Buffers.at(0).Buffer); + } + vtkm::Float64 renderTime = renderTimer.GetElapsedTime(); + this->LogTimers(); + logger->AddLogData("active_pixels", rays.NumRays); + logger->CloseLogEntry(renderTime); +} //Render +} +} +} // namespace vtkm::rendering::raytracing diff --git a/vtkm/rendering/raytracing/ConnectivityTracerBase.cxx b/vtkm/rendering/raytracing/ConnectivityTracerBase.cxx new file mode 100644 index 000000000..b3b43ba3a --- /dev/null +++ b/vtkm/rendering/raytracing/ConnectivityTracerBase.cxx @@ -0,0 +1,163 @@ +//============================================================================ +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +// Copyright 2018 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2018 UT-Battelle, LLC. +// Copyright 2018 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +//============================================================================ +#include + +#include + +#include + +namespace vtkm +{ +namespace rendering +{ +namespace raytracing +{ +ConnectivityTracerBase::ConnectivityTracerBase() + : ConnectivityBase() +{ +} + +ConnectivityTracerBase::~ConnectivityTracerBase() +{ +} + +void ConnectivityTracerBase::Init() +{ + // + // Check to see if a sample distance was set + // + if (SampleDistance <= 0) + { + const vtkm::Float32 defaultSampleRate = 200.f; + // We need to set some default sample distance + vtkm::Vec extent; + extent[0] = BoundingBox[1] - BoundingBox[0]; + extent[1] = BoundingBox[3] - BoundingBox[2]; + extent[2] = BoundingBox[5] - BoundingBox[4]; + SampleDistance = vtkm::Magnitude(extent) / defaultSampleRate; + } +} + +void ConnectivityTracerBase::SetColorMap( + const vtkm::cont::ArrayHandle>& colorMap) +{ + ColorMap = colorMap; +} + +void ConnectivityTracerBase::SetVolumeData(const vtkm::cont::Field& scalarField, + const vtkm::Range& scalarBounds) +{ + //TODO: Need a way to tell if we have been updated + ScalarField = scalarField; + ScalarBounds = scalarBounds; + + bool isSupportedField = (ScalarField.GetAssociation() == vtkm::cont::Field::ASSOC_POINTS || + ScalarField.GetAssociation() == vtkm::cont::Field::ASSOC_CELL_SET); + if (!isSupportedField) + throw vtkm::cont::ErrorBadValue("Field not accociated with cell set or points"); + FieldAssocPoints = ScalarField.GetAssociation() == vtkm::cont::Field::ASSOC_POINTS; + + this->Integrator = Volume; +} + +void ConnectivityTracerBase::SetEnergyData(const vtkm::cont::Field& absorption, + const vtkm::Int32 numBins, + const vtkm::cont::Field& emission) +{ + bool isSupportedField = absorption.GetAssociation() == vtkm::cont::Field::ASSOC_CELL_SET; + if (!isSupportedField) + throw vtkm::cont::ErrorBadValue("Absorption Field '" + absorption.GetName() + + "' not accociated with cells"); + ScalarField = absorption; + // Check for emmision + HasEmission = false; + + if (emission.GetAssociation() != vtkm::cont::Field::ASSOC_ANY) + { + if (emission.GetAssociation() != vtkm::cont::Field::ASSOC_CELL_SET) + throw vtkm::cont::ErrorBadValue("Emission Field '" + emission.GetName() + + "' not accociated with cells"); + HasEmission = true; + EmissionField = emission; + } + // Do some basic range checking + if (numBins < 1) + throw vtkm::cont::ErrorBadValue("Number of energy bins is less than 1"); + vtkm::Id binCount = ScalarField.GetData().GetNumberOfValues(); + vtkm::Id cellCount = this->GetNumberOfMeshCells(); + if (cellCount != (binCount / vtkm::Id(numBins))) + { + std::stringstream message; + message << "Invalid number of absorption bins\n"; + message << "Number of cells: " << cellCount << "\n"; + message << "Number of field values: " << binCount << "\n"; + message << "Number of bins: " << numBins << "\n"; + throw vtkm::cont::ErrorBadValue(message.str()); + } + if (HasEmission) + { + binCount = EmissionField.GetData().GetNumberOfValues(); + if (cellCount != (binCount / vtkm::Id(numBins))) + { + std::stringstream message; + message << "Invalid number of emission bins\n"; + message << "Number of cells: " << cellCount << "\n"; + message << "Number of field values: " << binCount << "\n"; + message << "Number of bins: " << numBins << "\n"; + throw vtkm::cont::ErrorBadValue(message.str()); + } + } + //TODO: Need a way to tell if we have been updated + this->Integrator = Energy; +} + +void ConnectivityTracerBase::SetBackgroundColor(const vtkm::Vec& backgroundColor) +{ + BackgroundColor = backgroundColor; +} + +void ConnectivityTracerBase::SetSampleDistance(const vtkm::Float32& distance) +{ + if (distance <= 0.f) + throw vtkm::cont::ErrorBadValue("Sample distance must be positive."); + SampleDistance = distance; +} + +void ConnectivityTracerBase::ResetTimers() +{ + IntersectTime = 0.; + IntegrateTime = 0.; + SampleTime = 0.; + LostRayTime = 0.; + MeshEntryTime = 0.; +} + +void ConnectivityTracerBase::LogTimers() +{ + Logger* logger = Logger::GetInstance(); + logger->AddLogData("intersect ", IntersectTime); + logger->AddLogData("integrate ", IntegrateTime); + logger->AddLogData("sample_cells ", SampleTime); + logger->AddLogData("lost_rays ", LostRayTime); + logger->AddLogData("mesh_entry", LostRayTime); +} +} +} +} diff --git a/vtkm/rendering/raytracing/ConnectivityTracerBase.h b/vtkm/rendering/raytracing/ConnectivityTracerBase.h new file mode 100644 index 000000000..634aea112 --- /dev/null +++ b/vtkm/rendering/raytracing/ConnectivityTracerBase.h @@ -0,0 +1,116 @@ +//============================================================================ +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +// Copyright 2015 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2015 UT-Battelle, LLC. +// Copyright 2015 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +//============================================================================ +#ifndef vtk_m_rendering_raytracing_ConnectivityTracerBase_h +#define vtk_m_rendering_raytracing_ConnectivityTracerBase_h + +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include + +namespace vtkm +{ +namespace rendering +{ +namespace raytracing +{ + +class VTKM_RENDERING_EXPORT ConnectivityTracerBase : public ConnectivityBase +{ +public: + ConnectivityTracerBase(); + + virtual ~ConnectivityTracerBase(); + + void Init(); + + virtual vtkm::Id GetNumberOfMeshCells() = 0; + + void SetColorMap(const vtkm::cont::ArrayHandle>& colorMap) override; + + void SetVolumeData(const vtkm::cont::Field& scalarField, + const vtkm::Range& scalarBounds) override; + + void SetEnergyData(const vtkm::cont::Field& absorption, + const vtkm::Int32 numBins, + const vtkm::cont::Field& emission) override; + + + void SetBackgroundColor(const vtkm::Vec& backgroundColor) override; + + void SetSampleDistance(const vtkm::Float32& distance) override; + +protected: + vtkm::cont::Field ScalarField; + vtkm::cont::Field EmissionField; + vtkm::Range ScalarBounds; + vtkm::cont::ArrayHandle> ColorMap; + vtkm::Float32 BoundingBox[6]; + vtkm::cont::ArrayHandle PreviousCellIds; + + vtkm::Vec BackgroundColor; + vtkm::Float32 SampleDistance; + bool CountRayStatus; + vtkm::Id RaysLost; + IntegrationMode Integrator; + bool DebugFiltersOn; + bool ReEnterMesh; // Do not try to re-enter the mesh + bool CreatePartialComposites; + bool FieldAssocPoints; + bool HasEmission; // Mode for integrating through engery bins + + // timers + vtkm::Float64 IntersectTime; + vtkm::Float64 IntegrateTime; + vtkm::Float64 SampleTime; + vtkm::Float64 LostRayTime; + vtkm::Float64 MeshEntryTime; + + template + void PrintRayStatus(Ray& rays, Device) + { + vtkm::Id raysExited = RayOperations::GetStatusCount(rays, RAY_EXITED_MESH, Device()); + vtkm::Id raysActive = RayOperations::GetStatusCount(rays, RAY_ACTIVE, Device()); + vtkm::Id raysAbandoned = RayOperations::GetStatusCount(rays, RAY_ABANDONED, Device()); + vtkm::Id raysExitedDom = RayOperations::GetStatusCount(rays, RAY_EXITED_DOMAIN, Device()); + std::cout << "\r Ray Status " << std::setw(10) << std::left << " Lost " << std::setw(10) + << std::left << RaysLost << std::setw(10) << std::left << " Exited " << std::setw(10) + << std::left << raysExited << std::setw(10) << std::left << " Active " + << std::setw(10) << raysActive << std::setw(10) << std::left << " Abandoned " + << std::setw(10) << raysAbandoned << " Exited Domain " << std::setw(10) << std::left + << raysExitedDom << "\n"; + } + + void ResetTimers(); + + void LogTimers(); +}; +} +} +} +#endif diff --git a/vtkm/rendering/raytracing/ConnectivityTracerFactory.cxx b/vtkm/rendering/raytracing/ConnectivityTracerFactory.cxx new file mode 100644 index 000000000..cf79b9794 --- /dev/null +++ b/vtkm/rendering/raytracing/ConnectivityTracerFactory.cxx @@ -0,0 +1,112 @@ +//============================================================================ +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +// Copyright 2015 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2015 UT-Battelle, LLC. +// Copyright 2015 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +//============================================================================ +#include +#include +#include + +#ifndef CELL_SHAPE_ZOO +#define CELL_SHAPE_ZOO 255 +#endif + +#ifndef CELL_SHAPE_STRUCTURED +#define CELL_SHAPE_STRUCTURED 254 +#endif + +namespace vtkm +{ +namespace rendering +{ +namespace raytracing +{ + +//---------------------------------------------------------------------------- +ConnectivityTracerFactory::TracerType ConnectivityTracerFactory::DetectCellSetType( + const vtkm::cont::DynamicCellSet& cellset) +{ + ConnectivityTracerFactory::TracerType type = Unsupported; + if (cellset.IsSameType(vtkm::cont::CellSetExplicit<>())) + { + type = Unstructured; + } + else if (cellset.IsSameType(vtkm::cont::CellSetSingleType<>())) + { + vtkm::cont::CellSetSingleType<> singleType = cellset.Cast>(); + // + // Now we need to determine what type of cells this holds + // + vtkm::cont::ArrayHandleConstant shapes = + singleType.GetShapesArray(vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell()); + vtkm::UInt8 shapeType = shapes.GetPortalConstControl().Get(0); + if (shapeType == CELL_SHAPE_HEXAHEDRON) + type = UnstructuredHex; + if (shapeType == CELL_SHAPE_TETRA) + type = UnstructuredTet; + if (shapeType == CELL_SHAPE_WEDGE) + type = UnstructuredWedge; + if (shapeType == CELL_SHAPE_PYRAMID) + type = UnstructuredPyramid; + } + else if (cellset.IsSameType(vtkm::cont::CellSetStructured<3>())) + { + type = Structured; + } + + return type; +} + + +//---------------------------------------------------------------------------- +ConnectivityBase* ConnectivityTracerFactory::CreateTracer( + const vtkm::cont::DynamicCellSet& cellset, + const vtkm::cont::CoordinateSystem& coords) +{ + ConnectivityTracerFactory::TracerType type = DetectCellSetType(cellset); + if (type == Unstructured) + { + UnstructuredMeshConn meshConn(cellset, coords); + return new ConnectivityTracer(meshConn); + } + else if (type == UnstructuredHex) + { + UnstructuredMeshConnSingleType meshConn(cellset, coords); + return new ConnectivityTracer(meshConn); + } + else if (type == UnstructuredWedge) + { + UnstructuredMeshConnSingleType meshConn(cellset, coords); + return new ConnectivityTracer(meshConn); + } + else if (type == UnstructuredTet) + { + UnstructuredMeshConnSingleType meshConn(cellset, coords); + + return new ConnectivityTracer(meshConn); + } + else if (type == Structured) + { + StructuredMeshConn meshConn(cellset, coords); + return new ConnectivityTracer(meshConn); + } + + throw vtkm::cont::ErrorBadValue("Connectivity tracer: cell set type unsupported"); +} +} +} +} // namespace vtkm::rendering::raytracing diff --git a/vtkm/rendering/raytracing/ConnectivityTracerFactory.h b/vtkm/rendering/raytracing/ConnectivityTracerFactory.h index e173fc80d..7379388ee 100644 --- a/vtkm/rendering/raytracing/ConnectivityTracerFactory.h +++ b/vtkm/rendering/raytracing/ConnectivityTracerFactory.h @@ -6,9 +6,9 @@ // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notice for more information. // -// Copyright 2015 National Technology & Engineering Solutions of Sandia, LLC (NTESS). -// Copyright 2015 UT-Battelle, LLC. -// Copyright 2015 Los Alamos National Security. +// Copyright 2018 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2018 UT-Battelle, LLC. +// Copyright 2018 Los Alamos National Security. // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. @@ -20,17 +20,24 @@ #ifndef vtk_m_rendering_raytracing_ConnectivityTracerFactory_h #define vtk_m_rendering_raytracing_ConnectivityTracerFactory_h -#include -#include +#include +#include + +#include namespace vtkm { +namespace cont +{ //forward declares +class CoordinateSystem; +} + namespace rendering { namespace raytracing { -class ConnectivityTracerFactory +class VTKM_RENDERING_EXPORT ConnectivityTracerFactory { public: enum TracerType @@ -45,78 +52,11 @@ public: }; //---------------------------------------------------------------------------- - static TracerType DetectCellSetType(const vtkm::cont::DynamicCellSet& cellset) - { - TracerType type = Unsupported; - if (cellset.IsSameType(vtkm::cont::CellSetExplicit<>())) - { - type = Unstructured; - } - else if (cellset.IsSameType(vtkm::cont::CellSetSingleType<>())) - { - vtkm::cont::CellSetSingleType<> singleType = cellset.Cast>(); - // - // Now we need to determine what type of cells this holds - // - vtkm::cont::ArrayHandleConstant shapes = - singleType.GetShapesArray(vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell()); - vtkm::UInt8 shapeType = shapes.GetPortalConstControl().Get(0); - if (shapeType == CELL_SHAPE_HEXAHEDRON) - type = UnstructuredHex; - if (shapeType == CELL_SHAPE_TETRA) - type = UnstructuredTet; - if (shapeType == CELL_SHAPE_WEDGE) - type = UnstructuredWedge; - if (shapeType == CELL_SHAPE_PYRAMID) - type = UnstructuredPyramid; - } - else if (cellset.IsSameType(vtkm::cont::CellSetStructured<3>())) - { - type = Structured; - } - - return type; - } - + static TracerType DetectCellSetType(const vtkm::cont::DynamicCellSet& cellset); //---------------------------------------------------------------------------- static ConnectivityBase* CreateTracer(const vtkm::cont::DynamicCellSet& cellset, - const vtkm::cont::CoordinateSystem& coords) - { - TracerType type = DetectCellSetType(cellset); - if (type == Unstructured) - { - UnstructuredMeshConn meshConn(cellset, coords); - return new ConnectivityTracer(meshConn); - } - else if (type == UnstructuredHex) - { - UnstructuredMeshConnSingleType meshConn(cellset, coords); - return new ConnectivityTracer( - meshConn); - } - else if (type == UnstructuredWedge) - { - UnstructuredMeshConnSingleType meshConn(cellset, coords); - return new ConnectivityTracer(meshConn); - } - else if (type == UnstructuredTet) - { - UnstructuredMeshConnSingleType meshConn(cellset, coords); - - return new ConnectivityTracer(meshConn); - } - else if (type == Structured) - { - StructuredMeshConn meshConn(cellset, coords); - return new ConnectivityTracer(meshConn); - } - else - { - throw vtkm::cont::ErrorBadValue("Connectivity tracer: cell set type unsupported"); - } - return nullptr; - } + const vtkm::cont::CoordinateSystem& coords); }; } } diff --git a/vtkm/rendering/raytracing/MeshConnectivityBuilder.h b/vtkm/rendering/raytracing/MeshConnectivityBuilder.h index 9560be688..e3be4ede1 100644 --- a/vtkm/rendering/raytracing/MeshConnectivityBuilder.h +++ b/vtkm/rendering/raytracing/MeshConnectivityBuilder.h @@ -95,7 +95,7 @@ public: VTKM_CONT MortonNeighbor() {} typedef void ControlSignature(WholeArrayIn<>, - ExecObject, + WholeArrayInOut, WholeArrayIn<>, WholeArrayIn<>, WholeArrayIn<>, @@ -146,18 +146,18 @@ public: template - VTKM_EXEC inline void operator()( - const MortonPortalType& mortonCodes, - vtkm::exec::ExecutionWholeArray>& faceIdPairs, - const vtkm::Id& index, - const ConnPortalType& connectivity, - const ShapePortalType& shapes, - const OffsetPortalType& offsets, - ExternalFaceFlagType& flags) const + VTKM_EXEC inline void operator()(const MortonPortalType& mortonCodes, + FaceIdPairsPortalType& faceIdPairs, + const vtkm::Id& index, + const ConnPortalType& connectivity, + const ShapePortalType& shapes, + const OffsetPortalType& offsets, + ExternalFaceFlagType& flags) const { if (index == 0) { @@ -330,14 +330,16 @@ public: class WriteFaceConn : public vtkm::worklet::WorkletMapField { public: + typedef void ControlSignature(FieldIn<>, WholeArrayIn<>, WholeArrayOut); + typedef void ExecutionSignature(_1, _2, _3); + VTKM_CONT WriteFaceConn() {} - typedef void ControlSignature(FieldIn<>, WholeArrayIn<>, ExecObject); - typedef void ExecutionSignature(_1, _2, _3); - template + + template VTKM_EXEC inline void operator()(const vtkm::Vec& faceIdPair, const FaceOffsetsPortalType& faceOffsets, - vtkm::exec::ExecutionWholeArray& faceConn) const + FaceConnectivityPortalType& faceConn) const { vtkm::Id cellId = faceIdPair[0]; BOUNDS_CHECK(faceOffsets, cellId); @@ -523,7 +525,7 @@ public: VTKM_CONT void BuildConnectivity(vtkm::cont::CellSetSingleType<>& cellSetUnstructured, - DynamicArrayHandleExplicitCoordinateSystem& coordinates, + const vtkm::cont::ArrayHandleVirtualCoordinates& coordinates, vtkm::Bounds coordsBounds) { Logger* logger = Logger::GetInstance(); @@ -569,9 +571,8 @@ public: // scatter the coonectivity into the original order - vtkm::worklet::DispatcherMapField(WriteFaceConn()) - .Invoke( - cellFaceId, this->FaceOffsets, vtkm::exec::ExecutionWholeArray(faceConnectivity)); + vtkm::worklet::DispatcherMapField(WriteFaceConn()) + .Invoke(cellFaceId, this->FaceOffsets, faceConnectivity); FaceConnectivity = faceConnectivity; @@ -583,7 +584,7 @@ public: VTKM_CONT void BuildConnectivity(vtkm::cont::CellSetExplicit<>& cellSetUnstructured, - DynamicArrayHandleExplicitCoordinateSystem& coordinates, + const vtkm::cont::ArrayHandleVirtualCoordinates& coordinates, vtkm::Bounds coordsBounds) { Logger* logger = Logger::GetInstance(); @@ -627,9 +628,8 @@ public: this->ExtractExternalFaces(cellFaceId, faceConnectivity, shapes, conn, shapeOffsets); // scatter the coonectivity into the original order - vtkm::worklet::DispatcherMapField(WriteFaceConn()) - .Invoke( - cellFaceId, this->FaceOffsets, vtkm::exec::ExecutionWholeArray(faceConnectivity)); + vtkm::worklet::DispatcherMapField(WriteFaceConn()) + .Invoke(cellFaceId, this->FaceOffsets, faceConnectivity); FaceConnectivity = faceConnectivity; OutsideTriangles = externalTriangles; @@ -653,7 +653,7 @@ public: triangles.PrepareForOutput(numFaces * 2, DeviceAdapter()); vtkm::cont::ArrayHandleCounting counting(0, 1, numFaces); - vtkm::worklet::DispatcherMapField( + vtkm::worklet::DispatcherMapField( StructuredExternalTriangles(cellSetStructured.PrepareForInput( DeviceAdapter(), vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell()))) .Invoke(counting, triangles); @@ -683,7 +683,7 @@ protected: const ShapeHandleType shapes, const ConnHandleType conn, const OffsetsHandleType shapeOffsets, - DynamicArrayHandleExplicitCoordinateSystem& coordinates, + const vtkm::cont::ArrayHandleVirtualCoordinates& coords, vtkm::cont::ArrayHandle& faceConnectivity, vtkm::cont::ArrayHandle>& cellFaceId, vtkm::Float32 BoundingBox[6]) @@ -693,6 +693,9 @@ protected: vtkm::Id numCells = shapes.GetNumberOfValues(); + vtkm::cont::ArrayHandle> coordinates; + vtkm::cont::DeviceAdapterAlgorithm::Copy(coords, coordinates); + /*-----------------------------------------------------------------*/ // Count the number of total faces in the cell set @@ -744,8 +747,10 @@ protected: vtkm::worklet::DispatcherMapTopology( MortonCodeFace(inverseExtent, minPoint)) .Invoke(cellSet, coordinates, cellOffsets, faceMortonCodes, cellFaceId); + // Sort the "faces" (i.e., morton codes) vtkm::cont::DeviceAdapterAlgorithm::SortByKey(faceMortonCodes, cellFaceId); + // Allocate space for the final face-to-face conectivity faceConnectivity.PrepareForOutput(totalFaces, DeviceAdapter()); @@ -754,12 +759,7 @@ protected: .Invoke(faceConnectivity); vtkm::worklet::DispatcherMapField(MortonNeighbor()) - .Invoke(faceMortonCodes, - vtkm::exec::ExecutionWholeArray>(cellFaceId), - conn, - shapes, - shapeOffsets, - faceConnectivity); + .Invoke(faceMortonCodes, cellFaceId, conn, shapes, shapeOffsets, faceConnectivity); vtkm::Float64 time = timer.GetElapsedTime(); Logger::GetInstance()->AddLogData("gen_face_conn", time); diff --git a/vtkm/rendering/raytracing/MeshConnectivityStructures.h b/vtkm/rendering/raytracing/MeshConnectivityStructures.h index b958b2ef1..45c3d7cba 100644 --- a/vtkm/rendering/raytracing/MeshConnectivityStructures.h +++ b/vtkm/rendering/raytracing/MeshConnectivityStructures.h @@ -69,8 +69,6 @@ public: Id4Handle ExternalTriangles; LinearBVH Bvh; - // Restrict the coordinates to the types that be for unstructured meshes - DynamicArrayHandleExplicitCoordinateSystem Coordinates; vtkm::Bounds CoordinateBounds; vtkm::cont::CellSetExplicit<> Cellset; vtkm::cont::CoordinateSystem Coords; @@ -89,15 +87,6 @@ public: : IsConstructed(false) { Coords = coords; - vtkm::cont::DynamicArrayHandleCoordinateSystem dynamicCoordsHandle = coords.GetData(); - - // - // Reset the type lists to only contain the coordinate systemss of an - // unstructured cell set. - // - - Coordinates = dynamicCoordsHandle.ResetTypeList(ExplicitCoordinatesType()) - .ResetStorageList(StorageListTagExplicitCoordinateSystem()); if (!cellset.IsSameType(vtkm::cont::CellSetExplicit<>())) { @@ -130,7 +119,6 @@ public: , Shapes(other.Shapes) , ExternalTriangles(other.ExternalTriangles) , Bvh(other.Bvh) - , Coordinates(other.Coordinates) , CoordinateBounds(other.CoordinateBounds) , Cellset(other.Cellset) , Coords(other.Coords) @@ -153,7 +141,7 @@ public: // // Build the face-to-face connectivity // - connBuilder.BuildConnectivity(Cellset, Coordinates, CoordinateBounds); + connBuilder.BuildConnectivity(Cellset, Coords.GetData(), CoordinateBounds); // // Initialize all of the array handles @@ -184,7 +172,7 @@ public: } TriangleIntersector>> intersector; bool getCellIndex = true; - intersector.runHitOnly(rays, Bvh, Coordinates, getCellIndex); + intersector.runHitOnly(rays, Bvh, Coords.GetData(), getCellIndex); } //---------------------------------------------------------------------------- VTKM_CONT @@ -198,7 +186,7 @@ public: //---------------------------------------------------------------------------- VTKM_CONT - DynamicArrayHandleExplicitCoordinateSystem GetCoordinates() { return Coordinates; } + vtkm::cont::ArrayHandleVirtualCoordinates GetCoordinates() { return Coords.GetData(); } //---------------------------------------------------------------------------- template @@ -319,8 +307,7 @@ public: // Mesh Boundry LinearBVH Bvh; Id4Handle ExternalTriangles; - // Restrict the coordinates to the types that be for unstructured meshes - DynamicArrayHandleExplicitCoordinateSystem Coordinates; + vtkm::Bounds CoordinateBounds; vtkm::cont::CoordinateSystem Coords; vtkm::cont::CellSetSingleType<> Cellset; @@ -344,15 +331,6 @@ public: { Coords = coords; - vtkm::cont::DynamicArrayHandleCoordinateSystem dynamicCoordsHandle = coords.GetData(); - - // - // Reset the type lists to only contain the coordinate systemss of an - // unstructured cell set. - // - - Coordinates = dynamicCoordsHandle.ResetTypeList(ExplicitCoordinatesType()) - .ResetStorageList(StorageListTagExplicitCoordinateSystem()); if (!cellset.IsSameType(vtkm::cont::CellSetSingleType<>())) { @@ -393,7 +371,6 @@ public: , CellConnectivity(other.CellConnectivity) , Bvh(other.Bvh) , ExternalTriangles(other.ExternalTriangles) - , Coordinates(other.Coordinates) , CoordinateBounds(other.CoordinateBounds) , Coords(other.coords) , Cellset(other.Cellset) @@ -420,7 +397,7 @@ public: // // Build the face-to-face connectivity // - connBuilder.BuildConnectivity(Cellset, Coordinates, CoordinateBounds); + connBuilder.BuildConnectivity(Cellset, Coords.GetData(), CoordinateBounds); // // Initialize all of the array handles // @@ -451,7 +428,7 @@ public: } TriangleIntersector>> intersector; bool getCellIndex = true; - intersector.runHitOnly(rays, Bvh, Coordinates, getCellIndex); + intersector.runHitOnly(rays, Bvh, Coords.GetData(), getCellIndex); } //---------------------------------------------------------------------------- VTKM_CONT @@ -461,7 +438,7 @@ public: Id4Handle GetExternalTriangles() { return ExternalTriangles; } //---------------------------------------------------------------------------- VTKM_CONT - DynamicArrayHandleExplicitCoordinateSystem GetCoordinates() { return Coordinates; } + vtkm::cont::ArrayHandleVirtualCoordinates GetCoordinates() { return Coords.GetData(); } //---------------------------------------------------------------------------- template VTKM_CONT vtkm::Bounds GetCoordinateBounds(Device) @@ -567,7 +544,6 @@ public: typedef vtkm::cont::ArrayHandle> Id4Handle; vtkm::Id3 CellDims; vtkm::Id3 PointDims; - DynamicArrayHandleStructuredCoordinateSystem Coordinates; vtkm::Bounds CoordinateBounds; vtkm::cont::CoordinateSystem Coords; vtkm::cont::CellSetStructured<3> Cellset; @@ -589,15 +565,7 @@ public: : IsConstructed(false) { Coords = coords; - vtkm::cont::DynamicArrayHandleCoordinateSystem dynamicCoordsHandle = coords.GetData(); - // - // Reset the type lists to only contain the coordinate systemss of an - // unstructured cell set. - // - - Coordinates = dynamicCoordsHandle.ResetTypeList(ExplicitCoordinatesType()) - .ResetStorageList(StructuredStorage()); if (!cellset.IsSameType(vtkm::cont::CellSetStructured<3>())) { throw vtkm::cont::ErrorBadValue( @@ -612,7 +580,6 @@ public: VTKM_CONT StructuredMeshConn(const T& other) : CellDims(other.CellDims) , PointDims(other.PointDims) - , Coordinates(other.Coordinates) , CoordinateBounds(other.CoordinateBounds) , Coords(other.coords) , Cellset(other.Cellset) @@ -659,7 +626,7 @@ public: } TriangleIntersector>> intersector; bool getCellIndex = true; - intersector.runHitOnly(rays, Bvh, Coordinates, getCellIndex); + intersector.runHitOnly(rays, Bvh, Coords.GetData(), getCellIndex); } //---------------------------------------------------------------------------- VTKM_CONT @@ -672,7 +639,7 @@ public: //---------------------------------------------------------------------------- VTKM_CONT - DynamicArrayHandleStructuredCoordinateSystem GetCoordinates() { return Coordinates; } + vtkm::cont::ArrayHandleVirtualCoordinates GetCoordinates() { return Coords.GetData(); } //---------------------------------------------------------------------------- template diff --git a/vtkm/rendering/raytracing/RayTracer.cxx b/vtkm/rendering/raytracing/RayTracer.cxx index cbf461880..42beeaf95 100644 --- a/vtkm/rendering/raytracing/RayTracer.cxx +++ b/vtkm/rendering/raytracing/RayTracer.cxx @@ -233,8 +233,8 @@ public: template VTKM_CONT void run(Ray& rays, LinearBVH& bvh, - vtkm::cont::DynamicArrayHandleCoordinateSystem& coordsHandle, - vtkm::cont::Field& scalarField, + vtkm::cont::ArrayHandleVirtualCoordinates& coordsHandle, + const vtkm::cont::Field& scalarField, const vtkm::Range& scalarRange) { bool isSupportedField = (scalarField.GetAssociation() == vtkm::cont::Field::ASSOC_POINTS || @@ -396,7 +396,7 @@ Camera& RayTracer::GetCamera() return camera; } -void RayTracer::SetData(const vtkm::cont::DynamicArrayHandleCoordinateSystem& coordsHandle, +void RayTracer::SetData(const vtkm::cont::ArrayHandleVirtualCoordinates& coordsHandle, const vtkm::cont::ArrayHandle>& indices, vtkm::cont::Field& scalarField, const vtkm::Id& numberOfTriangles, diff --git a/vtkm/rendering/raytracing/RayTracer.h b/vtkm/rendering/raytracing/RayTracer.h index 8b1c20b74..22dd8178d 100644 --- a/vtkm/rendering/raytracing/RayTracer.h +++ b/vtkm/rendering/raytracing/RayTracer.h @@ -39,7 +39,7 @@ class VTKM_RENDERING_EXPORT RayTracer protected: LinearBVH Bvh; Camera camera; - vtkm::cont::DynamicArrayHandleCoordinateSystem CoordsHandle; + vtkm::cont::ArrayHandleVirtualCoordinates CoordsHandle; vtkm::cont::Field ScalarField; vtkm::cont::ArrayHandle> Indices; vtkm::cont::ArrayHandle Scalars; @@ -61,7 +61,7 @@ public: Camera& GetCamera(); VTKM_CONT - void SetData(const vtkm::cont::DynamicArrayHandleCoordinateSystem& coordsHandle, + void SetData(const vtkm::cont::ArrayHandleVirtualCoordinates& coordsHandle, const vtkm::cont::ArrayHandle>& indices, vtkm::cont::Field& scalarField, const vtkm::Id& numberOfTriangles, diff --git a/vtkm/rendering/raytracing/TriangleIntersector.h b/vtkm/rendering/raytracing/TriangleIntersector.h index b612a4cf2..d5b2e7ca4 100644 --- a/vtkm/rendering/raytracing/TriangleIntersector.h +++ b/vtkm/rendering/raytracing/TriangleIntersector.h @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include diff --git a/vtkm/rendering/raytracing/VolumeRendererStructured.cxx b/vtkm/rendering/raytracing/VolumeRendererStructured.cxx index a6b0cf19e..0531d8fdf 100644 --- a/vtkm/rendering/raytracing/VolumeRendererStructured.cxx +++ b/vtkm/rendering/raytracing/VolumeRendererStructured.cxx @@ -723,7 +723,7 @@ void VolumeRendererStructured::SetData(const vtkm::cont::CoordinateSystem& coord const vtkm::cont::CellSetStructured<3>& cellset, const vtkm::Range& scalarRange) { - if (coords.GetData().IsSameType(CartesianArrayHandle())) + if (coords.GetData().IsSameType()) IsUniformDataSet = false; IsSceneDirty = true; SpatialExtent = coords.GetBounds(); diff --git a/vtkm/rendering/raytracing/VolumeRendererStructured.h b/vtkm/rendering/raytracing/VolumeRendererStructured.h index b0eea35b2..d6aad0fa3 100644 --- a/vtkm/rendering/raytracing/VolumeRendererStructured.h +++ b/vtkm/rendering/raytracing/VolumeRendererStructured.h @@ -79,7 +79,7 @@ protected: bool IsSceneDirty; bool IsUniformDataSet; vtkm::Bounds SpatialExtent; - vtkm::cont::DynamicArrayHandleCoordinateSystem Coordinates; + vtkm::cont::ArrayHandleVirtualCoordinates Coordinates; vtkm::cont::CellSetStructured<3> Cellset; const vtkm::cont::Field* ScalarField; vtkm::cont::ArrayHandle> ColorMap; diff --git a/vtkm/testing/UnitTestTypes.cxx b/vtkm/testing/UnitTestTypes.cxx index 9a8be0a1e..e5dcb0030 100644 --- a/vtkm/testing/UnitTestTypes.cxx +++ b/vtkm/testing/UnitTestTypes.cxx @@ -189,7 +189,7 @@ void GeneralVecCTypeTest(const vtkm::Vec&) div = aSrc / b; VTKM_TEST_ASSERT(test_equal(div, correct_div), "Tuples not divided correctly."); - ComponentType d = vtkm::dot(a, b); + ComponentType d = static_cast(vtkm::dot(a, b)); ComponentType correct_d = 0; for (vtkm::IdComponent i = 0; i < Size; ++i) { @@ -286,7 +286,7 @@ void GeneralVecCConstTypeTest(const vtkm::Vec&) div = aSrc / b; VTKM_TEST_ASSERT(test_equal(div, correct_div), "Tuples not divided correctly."); - ComponentType d = vtkm::dot(a, b); + ComponentType d = static_cast(vtkm::dot(a, b)); ComponentType correct_d = 0; for (vtkm::IdComponent i = 0; i < Size; ++i) { @@ -403,7 +403,7 @@ void GeneralVecTypeTest(const vtkm::Vec&) div = a / ComponentType(2); VTKM_TEST_ASSERT(test_equal(div, b), "Tuple does not divide by Scalar correctly."); - ComponentType d = vtkm::dot(a, b); + ComponentType d = static_cast(vtkm::dot(a, b)); ComponentType correct_d = 0; for (vtkm::IdComponent i = 0; i < T::NUM_COMPONENTS; ++i) { @@ -477,7 +477,7 @@ void TypeTest(const vtkm::Vec&) VTKM_TEST_ASSERT(test_equal(div, vtkm::make_Vec(1, 2)), "Vector does not divide by Scalar correctly."); - Scalar d = vtkm::dot(a, b); + Scalar d = static_cast(vtkm::dot(a, b)); VTKM_TEST_ASSERT(test_equal(d, Scalar(10)), "dot(Vector2) wrong"); VTKM_TEST_ASSERT(!(a < b), "operator< wrong"); @@ -539,7 +539,7 @@ void TypeTest(const vtkm::Vec&) div = a / Scalar(2); VTKM_TEST_ASSERT(test_equal(div, b), "Vector does not divide by Scalar correctly."); - Scalar d = vtkm::dot(a, b); + Scalar d = static_cast(vtkm::dot(a, b)); VTKM_TEST_ASSERT(test_equal(d, Scalar(28)), "dot(Vector3) wrong"); VTKM_TEST_ASSERT(!(a < b), "operator< wrong"); @@ -601,7 +601,7 @@ void TypeTest(const vtkm::Vec&) div = a / Scalar(2); VTKM_TEST_ASSERT(test_equal(div, b), "Vector does not divide by Scalar correctly."); - Scalar d = vtkm::dot(a, b); + Scalar d = static_cast(vtkm::dot(a, b)); VTKM_TEST_ASSERT(test_equal(d, Scalar(60)), "dot(Vector4) wrong"); VTKM_TEST_ASSERT(!(a < b), "operator< wrong"); @@ -672,6 +672,17 @@ void TypeTest(Scalar) { VTKM_TEST_FAIL("dot(Scalar) wrong"); } + + //verify we don't roll over + Scalar c = 128; + Scalar d = 32; + auto r = vtkm::dot(c, d); + VTKM_TEST_ASSERT((sizeof(r) >= sizeof(int)), + "dot(Scalar) didn't promote smaller than 32bit types"); + if (r != 4096) + { + VTKM_TEST_FAIL("dot(Scalar) wrong"); + } } struct TypeTestFunctor diff --git a/vtkm/testing/VecTraitsTests.h b/vtkm/testing/VecTraitsTests.h index eff54626d..b32846618 100644 --- a/vtkm/testing/VecTraitsTests.h +++ b/vtkm/testing/VecTraitsTests.h @@ -135,14 +135,14 @@ static void TestVecTypeImpl(const typename std::remove_const::type& inVector, VTKM_TEST_ASSERT(test_equal(vectorCopy, inVector), "CopyInto does not work."); { - ComponentType result = 0; + auto expected = vtkm::dot(vectorCopy, vectorCopy); + decltype(expected) result = 0; for (vtkm::IdComponent i = 0; i < NUM_COMPONENTS; i++) { ComponentType component = Traits::GetComponent(inVector, i); - result = ComponentType(result + (component * component)); + result = result + (component * component); } - VTKM_TEST_ASSERT(test_equal(result, vtkm::dot(vectorCopy, vectorCopy)), - "Got bad result for dot product"); + VTKM_TEST_ASSERT(test_equal(result, expected), "Got bad result for dot product"); } // This will fail to compile if the tags are wrong. diff --git a/vtkm/thirdparty/UPDATING.md b/vtkm/thirdparty/UPDATING.md new file mode 100644 index 000000000..d1c7fa8d7 --- /dev/null +++ b/vtkm/thirdparty/UPDATING.md @@ -0,0 +1,105 @@ +# Updating Third Party Projects + +When updating a third party project, any changes to the imported project +itself (e.g., the `diy/vtkmdiy` directory for diy), should go through the +`update.sh` framework. This framework ensures that all patches to the third +party projects are tracked externally and available for (preferably) upstream +or other projects also embedding the library. + +# Updating a Project + +Once converted, a project should be updated by applying patches to the +repository specified in its `update.sh` script. Once the changes are merged, +pulling the changes involves running the `update.sh` script. This will update +the local copy of the project to the version specified in `update.sh` (usually +a `for/foo` branch, like `for/vtk-m` for example, but may be `master` or any +other Git reference) and merge it into the main tree. + +This requires a Git 2.5 or higher due the `worktree` tool being used to +simplify the availability of the commits to the main checkout. + +Here's an example of updating the `diy` project from tag v2.0 to v2.1, +starting with updating the third-party repo + +```sh +$ cd diy +$ git checkout for/vtk-m +$ git fetch origin +$ git rebase --onto v2.1 v2.0 +$ git push +``` + +Now import into VTK-m + +```sh +$ cd vtkm/ThirdParty/diy +$ git checkout -b update_diy +$ ./update.sh +``` + +Now you can review the change and make a merge request from the branch as normal. + +# Porting a Project + +When converting a project, if there are any local patches, a project should be +created [on GitLab](https://gitlab.kitware.com/third-party) to track it. If +the upstream project does not use Git, it should be imported into Git (there +may be existing conversions available on Github already). The project's +description should indicate where the source repository lives. + +Once a mirror of the project is created, a branch named `for/foo` should be +created where patches for the `foo` project will be applied (i.e., `for/vtk-m` +for VTK-m's patches to the project). Usually, changes to the build system, the +source code for mangling, the addition of `.gitattributes` files, and other +changes belong here. Functional changes should be submitted upstream (but may +still be tracked so that they may be used). + +The basic steps to import a project `diy` based on the tag +`v2.0` looks like this: + +```sh +$ git clone https://github.com/diatomic/diy.git +$ cd diy/ +$ git remote add kitware git@gitlab.kitware.com:third-party/diy.git +$ git push -u kitware +$ git push -u kitware --tags +$ git checkout v2.0 +$ git checkout -b for/vtk-m +$ git push --set-upstream kitware for/vtk-m +``` + +Making the initial import involves filling out the project's `update.sh` +script in its directory. The [update-common.sh](update-common.sh) script +describes what is necessary, but in a nutshell, it is basically metadata such +as the name of the project and where it goes in the importing project. + +The most important bit is the `extract_source` function which should subset +the repository. If all that needs to be done is to extract the files given in +the `paths` variable (described in the `update-common.sh` script), the +`git_archive` function may be used if the `git archive` tool generates a +suitable subset. + +Make sure `update.sh` is executable before commit. On Unix, run: + +```sh + $ chmod u+x update.sh && git add -u update.sh +``` + +On Windows, run: + +```sh + $ git update-index --chmod=+x update.sh +``` + +# Process + +The basic process involves a second branch where the third party project's +changes are tracked. This branch has a commit for each time it has been +updated and is stripped to only contain the relevant parts (no unit tests, +documentation, etc.). This branch is then merged into the main branch as a +subdirectory using the `subtree` merge strategy. + +Initial conversions will require a manual push by the maintainers since the +conversion involves a root commit which is not allowed under normal +circumstances. Please send an email to the mailing list asking for assistance +if necessary. diff --git a/diy/CMakeLists.txt b/vtkm/thirdparty/diy/CMakeLists.txt similarity index 79% rename from diy/CMakeLists.txt rename to vtkm/thirdparty/diy/CMakeLists.txt index bc902691c..e52f4ebe1 100644 --- a/diy/CMakeLists.txt +++ b/vtkm/thirdparty/diy/CMakeLists.txt @@ -19,17 +19,22 @@ ## this software. ## ##============================================================================= - -#============================================================================== -# See License.txt -#============================================================================== add_library(diy INTERFACE) +vtkm_get_kit_name(kit_name kit_dir) + # diy needs C++11 target_compile_features(diy INTERFACE cxx_auto_type) +# placeholder to support external DIY +set(VTKM_USE_EXTERNAL_DIY OFF) + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Configure.h.in + ${VTKm_BINARY_INCLUDE_DIR}/${kit_dir}/Configure.h) + target_include_directories(diy INTERFACE - $ + $ + $ $) # presently, this dependency is required. Make it optional in the future. @@ -59,12 +64,9 @@ if(NOT VTKm_INSTALL_ONLY_LIBRARIES) install(TARGETS diy EXPORT ${VTKm_EXPORT_NAME}) - # Install headers - install(DIRECTORY include/diy - DESTINATION ${VTKm_INSTALL_INCLUDE_DIR}) - - # Install other files. - install(FILES LEGAL.txt LICENSE.txt - DESTINATION ${VTKm_INSTALL_INCLUDE_DIR}/diy - ) + ## Install headers + install(DIRECTORY vtkmdiy + DESTINATION ${VTKm_INSTALL_INCLUDE_DIR}/${kit_dir}/) + install(FILES ${VTKm_BINARY_INCLUDE_DIR}/${kit_dir}/Configure.h + DESTINATION ${VTKm_INSTALL_INCLUDE_DIR}/${kit_dir}/) endif() diff --git a/vtkm/thirdparty/diy/Configure.h.in b/vtkm/thirdparty/diy/Configure.h.in new file mode 100644 index 000000000..9aafe6e00 --- /dev/null +++ b/vtkm/thirdparty/diy/Configure.h.in @@ -0,0 +1,35 @@ +//============================================================================= +// +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +// Copyright 2015 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2015 UT-Battelle, LLC. +// Copyright 2015 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +// +//============================================================================= +#ifndef vtkm_diy_h +#define vtkm_diy_h + +/* Use the diy library configured for VTM-m. */ +#cmakedefine01 VTKM_USE_EXTERNAL_DIY + +#if VTKM_USE_EXTERNAL_DIY +# define VTKM_DIY(header)
+#else +# define VTKM_DIY(header) +# define diy vtkmdiy // mangle namespace diy +#endif + +#endif diff --git a/vtkm/thirdparty/diy/update.sh b/vtkm/thirdparty/diy/update.sh new file mode 100755 index 000000000..3ce5ef0ec --- /dev/null +++ b/vtkm/thirdparty/diy/update.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +set -e +set -x +shopt -s dotglob + +readonly name="diy" +readonly ownership="Diy Upstream " +readonly subtree="vtkm/thirdparty/$name/vtkm$name" +readonly repo="https://gitlab.kitware.com/third-party/diy2.git" +readonly tag="for/vtk-m" +readonly paths=" +include +LEGAL.txt +LICENSE.txt +README.md +" + +extract_source () { + git_archive + pushd "$extractdir/$name-reduced" + mv include/diy include/vtkmdiy + popd +} + +. "${BASH_SOURCE%/*}/../update-common.sh" diff --git a/diy/LEGAL.txt b/vtkm/thirdparty/diy/vtkmdiy/LEGAL.txt similarity index 100% rename from diy/LEGAL.txt rename to vtkm/thirdparty/diy/vtkmdiy/LEGAL.txt diff --git a/diy/LICENSE.txt b/vtkm/thirdparty/diy/vtkmdiy/LICENSE.txt similarity index 100% rename from diy/LICENSE.txt rename to vtkm/thirdparty/diy/vtkmdiy/LICENSE.txt diff --git a/vtkm/thirdparty/diy/vtkmdiy/README.md b/vtkm/thirdparty/diy/vtkmdiy/README.md new file mode 100644 index 000000000..a2ab00c94 --- /dev/null +++ b/vtkm/thirdparty/diy/vtkmdiy/README.md @@ -0,0 +1,85 @@ +## DIY is a block-parallel library + +DIY is a block-parallel library for implementing scalable algorithms that can execute both +in-core and out-of-core. The same program can be executed with one or more threads per MPI +process, seamlessly combining distributed-memory message passing with shared-memory thread +parallelism. The abstraction enabling these capabilities is block parallelism; blocks +and their message queues are mapped onto processing elements (MPI processes or threads) and are +migrated between memory and storage by the DIY runtime. Complex communication patterns, +including neighbor exchange, merge reduction, swap reduction, and all-to-all exchange, are +possible in- and out-of-core in DIY. + +## Licensing + +DIY is released as open source software under a BSD-style [license](./LICENSE.txt). + +## Dependencies + +DIY requires an MPI installation. We recommend [MPICH](http://www.mpich.org/). + +## Download, build, install + +- You can clone this repository, or + +- You can download the [latest tarball](https://github.com/diatomic/diy2/archive/master.tar.gz). + + +DIY is a header-only library. It does not need to be built; you can simply +include it in your project. The examples can be built using `cmake` from the +top-level directory. + +## Documentation + +[Doxygen pages](https://diatomic.github.io/diy) + +## Example + +A simple DIY program, shown below, consists of the following components: + +- `struct`s called blocks, +- a diy object called the `master`, +- a set of callback functions performed on each block by `master.foreach()`, +- optionally, one or more message exchanges between the blocks by `master.exchange()`, and +- there may be other collectives and global reductions not shown below. + +The callback functions (`enqueue_local()` and `average()` in the example below) receive the block +pointer and a communication proxy for the message exchange between blocks. It is usual for the +callback functions to enqueue or dequeue messages from the proxy, so that information can be +received and sent during rounds of message exchange. + +```cpp + // --- main program --- // + + struct Block { float local, average; }; // define your block structure + + Master master(world); // world = MPI_Comm + ... // populate master with blocks + master.foreach(&enqueue_local); // call enqueue_local() for each block + master.exchange(); // exchange enqueued data between blocks + master.foreach(&average); // call average() for each block + + // --- callback functions --- // + + // enqueue block data prior to exchanging it + void enqueue_local(Block* b, // current block + const Proxy& cp) // communication proxy provides access to the neighbor blocks + { + for (size_t i = 0; i < cp.link()->size(); i++) // for all neighbor blocks + cp.enqueue(cp.link()->target(i), b->local); // enqueue the data to be sent to this neighbor + // block in the next exchange + } + + // use the received data after exchanging it, in this case compute its average + void average(Block* b, // current block + const Proxy& cp) // communication proxy provides access to the neighbor blocks + { + float x, average = 0; + for (size_t i = 0; i < cp.link()->size(); i++) // for all neighbor blocks + { + cp.dequeue(cp.link()->target(i).gid, x); // dequeue the data received from this + // neighbor block in the last exchange + average += x; + } + b->average = average / cp.link()->size(); + } +``` diff --git a/diy/include/diy/algorithms.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/algorithms.hpp similarity index 100% rename from diy/include/diy/algorithms.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/algorithms.hpp diff --git a/diy/include/diy/assigner.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/assigner.hpp similarity index 100% rename from diy/include/diy/assigner.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/assigner.hpp diff --git a/diy/include/diy/collection.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/collection.hpp similarity index 100% rename from diy/include/diy/collection.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/collection.hpp diff --git a/diy/include/diy/communicator.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/communicator.hpp similarity index 100% rename from diy/include/diy/communicator.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/communicator.hpp diff --git a/diy/include/diy/constants.h b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/constants.h similarity index 100% rename from diy/include/diy/constants.h rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/constants.h diff --git a/diy/include/diy/critical-resource.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/critical-resource.hpp similarity index 100% rename from diy/include/diy/critical-resource.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/critical-resource.hpp diff --git a/diy/include/diy/decomposition.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/decomposition.hpp similarity index 100% rename from diy/include/diy/decomposition.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/decomposition.hpp diff --git a/diy/include/diy/detail/algorithms/kdtree-sampling.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/detail/algorithms/kdtree-sampling.hpp similarity index 100% rename from diy/include/diy/detail/algorithms/kdtree-sampling.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/detail/algorithms/kdtree-sampling.hpp diff --git a/diy/include/diy/detail/algorithms/kdtree.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/detail/algorithms/kdtree.hpp similarity index 100% rename from diy/include/diy/detail/algorithms/kdtree.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/detail/algorithms/kdtree.hpp diff --git a/diy/include/diy/detail/algorithms/sort.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/detail/algorithms/sort.hpp similarity index 100% rename from diy/include/diy/detail/algorithms/sort.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/detail/algorithms/sort.hpp diff --git a/diy/include/diy/detail/block_traits.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/detail/block_traits.hpp similarity index 100% rename from diy/include/diy/detail/block_traits.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/detail/block_traits.hpp diff --git a/diy/include/diy/detail/collectives.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/detail/collectives.hpp similarity index 100% rename from diy/include/diy/detail/collectives.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/detail/collectives.hpp diff --git a/diy/include/diy/detail/reduce/all-to-all.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/detail/reduce/all-to-all.hpp similarity index 100% rename from diy/include/diy/detail/reduce/all-to-all.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/detail/reduce/all-to-all.hpp diff --git a/diy/include/diy/detail/traits.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/detail/traits.hpp similarity index 100% rename from diy/include/diy/detail/traits.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/detail/traits.hpp diff --git a/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/fmt/format.cc b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/fmt/format.cc new file mode 100644 index 000000000..09d2ea9fd --- /dev/null +++ b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/fmt/format.cc @@ -0,0 +1,535 @@ +/* + Formatting library for C++ + + Copyright (c) 2012 - 2016, Victor Zverovich + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "format.h" + +#include + +#include +#include +#include +#include +#include +#include // for std::ptrdiff_t + +#if defined(_WIN32) && defined(__MINGW32__) +# include +#endif + +#if FMT_USE_WINDOWS_H +# if !defined(FMT_HEADER_ONLY) && !defined(WIN32_LEAN_AND_MEAN) +# define WIN32_LEAN_AND_MEAN +# endif +# if defined(NOMINMAX) || defined(FMT_WIN_MINMAX) +# include +# else +# define NOMINMAX +# include +# undef NOMINMAX +# endif +#endif + +#if FMT_EXCEPTIONS +# define FMT_TRY try +# define FMT_CATCH(x) catch (x) +#else +# define FMT_TRY if (true) +# define FMT_CATCH(x) if (false) +#endif + +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4127) // conditional expression is constant +# pragma warning(disable: 4702) // unreachable code +// Disable deprecation warning for strerror. The latter is not called but +// MSVC fails to detect it. +# pragma warning(disable: 4996) +#endif + +// Dummy implementations of strerror_r and strerror_s called if corresponding +// system functions are not available. +static inline fmt::internal::Null<> strerror_r(int, char *, ...) { + return fmt::internal::Null<>(); +} +static inline fmt::internal::Null<> strerror_s(char *, std::size_t, ...) { + return fmt::internal::Null<>(); +} + +namespace fmt { + +FMT_FUNC internal::RuntimeError::~RuntimeError() FMT_DTOR_NOEXCEPT {} +FMT_FUNC FormatError::~FormatError() FMT_DTOR_NOEXCEPT {} +FMT_FUNC SystemError::~SystemError() FMT_DTOR_NOEXCEPT {} + +namespace { + +#ifndef _MSC_VER +# define FMT_SNPRINTF snprintf +#else // _MSC_VER +inline int fmt_snprintf(char *buffer, size_t size, const char *format, ...) { + va_list args; + va_start(args, format); + int result = vsnprintf_s(buffer, size, _TRUNCATE, format, args); + va_end(args); + return result; +} +# define FMT_SNPRINTF fmt_snprintf +#endif // _MSC_VER + +#if defined(_WIN32) && defined(__MINGW32__) && !defined(__NO_ISOCEXT) +# define FMT_SWPRINTF snwprintf +#else +# define FMT_SWPRINTF swprintf +#endif // defined(_WIN32) && defined(__MINGW32__) && !defined(__NO_ISOCEXT) + +const char RESET_COLOR[] = "\x1b[0m"; + +typedef void (*FormatFunc)(Writer &, int, StringRef); + +// Portable thread-safe version of strerror. +// Sets buffer to point to a string describing the error code. +// This can be either a pointer to a string stored in buffer, +// or a pointer to some static immutable string. +// Returns one of the following values: +// 0 - success +// ERANGE - buffer is not large enough to store the error message +// other - failure +// Buffer should be at least of size 1. +int safe_strerror( + int error_code, char *&buffer, std::size_t buffer_size) FMT_NOEXCEPT { + FMT_ASSERT(buffer != 0 && buffer_size != 0, "invalid buffer"); + + class StrError { + private: + int error_code_; + char *&buffer_; + std::size_t buffer_size_; + + // A noop assignment operator to avoid bogus warnings. + void operator=(const StrError &) {} + + // Handle the result of XSI-compliant version of strerror_r. + int handle(int result) { + // glibc versions before 2.13 return result in errno. + return result == -1 ? errno : result; + } + + // Handle the result of GNU-specific version of strerror_r. + int handle(char *message) { + // If the buffer is full then the message is probably truncated. + if (message == buffer_ && strlen(buffer_) == buffer_size_ - 1) + return ERANGE; + buffer_ = message; + return 0; + } + + // Handle the case when strerror_r is not available. + int handle(internal::Null<>) { + return fallback(strerror_s(buffer_, buffer_size_, error_code_)); + } + + // Fallback to strerror_s when strerror_r is not available. + int fallback(int result) { + // If the buffer is full then the message is probably truncated. + return result == 0 && strlen(buffer_) == buffer_size_ - 1 ? + ERANGE : result; + } + + // Fallback to strerror if strerror_r and strerror_s are not available. + int fallback(internal::Null<>) { + errno = 0; + buffer_ = strerror(error_code_); + return errno; + } + + public: + StrError(int err_code, char *&buf, std::size_t buf_size) + : error_code_(err_code), buffer_(buf), buffer_size_(buf_size) {} + + int run() { + // Suppress a warning about unused strerror_r. + strerror_r(0, FMT_NULL, ""); + return handle(strerror_r(error_code_, buffer_, buffer_size_)); + } + }; + return StrError(error_code, buffer, buffer_size).run(); +} + +void format_error_code(Writer &out, int error_code, + StringRef message) FMT_NOEXCEPT { + // Report error code making sure that the output fits into + // INLINE_BUFFER_SIZE to avoid dynamic memory allocation and potential + // bad_alloc. + out.clear(); + static const char SEP[] = ": "; + static const char ERROR_STR[] = "error "; + // Subtract 2 to account for terminating null characters in SEP and ERROR_STR. + std::size_t error_code_size = sizeof(SEP) + sizeof(ERROR_STR) - 2; + typedef internal::IntTraits::MainType MainType; + MainType abs_value = static_cast(error_code); + if (internal::is_negative(error_code)) { + abs_value = 0 - abs_value; + ++error_code_size; + } + error_code_size += internal::count_digits(abs_value); + if (message.size() <= internal::INLINE_BUFFER_SIZE - error_code_size) + out << message << SEP; + out << ERROR_STR << error_code; + assert(out.size() <= internal::INLINE_BUFFER_SIZE); +} + +void report_error(FormatFunc func, int error_code, + StringRef message) FMT_NOEXCEPT { + MemoryWriter full_message; + func(full_message, error_code, message); + // Use Writer::data instead of Writer::c_str to avoid potential memory + // allocation. + std::fwrite(full_message.data(), full_message.size(), 1, stderr); + std::fputc('\n', stderr); +} +} // namespace + +FMT_FUNC void SystemError::init( + int err_code, CStringRef format_str, ArgList args) { + error_code_ = err_code; + MemoryWriter w; + format_system_error(w, err_code, format(format_str, args)); + std::runtime_error &base = *this; + base = std::runtime_error(w.str()); +} + +template +int internal::CharTraits::format_float( + char *buffer, std::size_t size, const char *format, + unsigned width, int precision, T value) { + if (width == 0) { + return precision < 0 ? + FMT_SNPRINTF(buffer, size, format, value) : + FMT_SNPRINTF(buffer, size, format, precision, value); + } + return precision < 0 ? + FMT_SNPRINTF(buffer, size, format, width, value) : + FMT_SNPRINTF(buffer, size, format, width, precision, value); +} + +template +int internal::CharTraits::format_float( + wchar_t *buffer, std::size_t size, const wchar_t *format, + unsigned width, int precision, T value) { + if (width == 0) { + return precision < 0 ? + FMT_SWPRINTF(buffer, size, format, value) : + FMT_SWPRINTF(buffer, size, format, precision, value); + } + return precision < 0 ? + FMT_SWPRINTF(buffer, size, format, width, value) : + FMT_SWPRINTF(buffer, size, format, width, precision, value); +} + +template +const char internal::BasicData::DIGITS[] = + "0001020304050607080910111213141516171819" + "2021222324252627282930313233343536373839" + "4041424344454647484950515253545556575859" + "6061626364656667686970717273747576777879" + "8081828384858687888990919293949596979899"; + +#define FMT_POWERS_OF_10(factor) \ + factor * 10, \ + factor * 100, \ + factor * 1000, \ + factor * 10000, \ + factor * 100000, \ + factor * 1000000, \ + factor * 10000000, \ + factor * 100000000, \ + factor * 1000000000 + +template +const uint32_t internal::BasicData::POWERS_OF_10_32[] = { + 0, FMT_POWERS_OF_10(1) +}; + +template +const uint64_t internal::BasicData::POWERS_OF_10_64[] = { + 0, + FMT_POWERS_OF_10(1), + FMT_POWERS_OF_10(ULongLong(1000000000)), + // Multiply several constants instead of using a single long long constant + // to avoid warnings about C++98 not supporting long long. + ULongLong(1000000000) * ULongLong(1000000000) * 10 +}; + +FMT_FUNC void internal::report_unknown_type(char code, const char *type) { + (void)type; + if (std::isprint(static_cast(code))) { + FMT_THROW(FormatError( + format("unknown format code '{}' for {}", code, type))); + } + FMT_THROW(FormatError( + format("unknown format code '\\x{:02x}' for {}", + static_cast(code), type))); +} + +#if FMT_USE_WINDOWS_H + +FMT_FUNC internal::UTF8ToUTF16::UTF8ToUTF16(StringRef s) { + static const char ERROR_MSG[] = "cannot convert string from UTF-8 to UTF-16"; + if (s.size() > INT_MAX) + FMT_THROW(WindowsError(ERROR_INVALID_PARAMETER, ERROR_MSG)); + int s_size = static_cast(s.size()); + int length = MultiByteToWideChar( + CP_UTF8, MB_ERR_INVALID_CHARS, s.data(), s_size, FMT_NULL, 0); + if (length == 0) + FMT_THROW(WindowsError(GetLastError(), ERROR_MSG)); + buffer_.resize(length + 1); + length = MultiByteToWideChar( + CP_UTF8, MB_ERR_INVALID_CHARS, s.data(), s_size, &buffer_[0], length); + if (length == 0) + FMT_THROW(WindowsError(GetLastError(), ERROR_MSG)); + buffer_[length] = 0; +} + +FMT_FUNC internal::UTF16ToUTF8::UTF16ToUTF8(WStringRef s) { + if (int error_code = convert(s)) { + FMT_THROW(WindowsError(error_code, + "cannot convert string from UTF-16 to UTF-8")); + } +} + +FMT_FUNC int internal::UTF16ToUTF8::convert(WStringRef s) { + if (s.size() > INT_MAX) + return ERROR_INVALID_PARAMETER; + int s_size = static_cast(s.size()); + int length = WideCharToMultiByte( + CP_UTF8, 0, s.data(), s_size, FMT_NULL, 0, FMT_NULL, FMT_NULL); + if (length == 0) + return GetLastError(); + buffer_.resize(length + 1); + length = WideCharToMultiByte( + CP_UTF8, 0, s.data(), s_size, &buffer_[0], length, FMT_NULL, FMT_NULL); + if (length == 0) + return GetLastError(); + buffer_[length] = 0; + return 0; +} + +FMT_FUNC void WindowsError::init( + int err_code, CStringRef format_str, ArgList args) { + error_code_ = err_code; + MemoryWriter w; + internal::format_windows_error(w, err_code, format(format_str, args)); + std::runtime_error &base = *this; + base = std::runtime_error(w.str()); +} + +FMT_FUNC void internal::format_windows_error( + Writer &out, int error_code, StringRef message) FMT_NOEXCEPT { + FMT_TRY { + MemoryBuffer buffer; + buffer.resize(INLINE_BUFFER_SIZE); + for (;;) { + wchar_t *system_message = &buffer[0]; + int result = FormatMessageW( + FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + FMT_NULL, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + system_message, static_cast(buffer.size()), FMT_NULL); + if (result != 0) { + UTF16ToUTF8 utf8_message; + if (utf8_message.convert(system_message) == ERROR_SUCCESS) { + out << message << ": " << utf8_message; + return; + } + break; + } + if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) + break; // Can't get error message, report error code instead. + buffer.resize(buffer.size() * 2); + } + } FMT_CATCH(...) {} + fmt::format_error_code(out, error_code, message); // 'fmt::' is for bcc32. +} + +#endif // FMT_USE_WINDOWS_H + +FMT_FUNC void format_system_error( + Writer &out, int error_code, StringRef message) FMT_NOEXCEPT { + FMT_TRY { + internal::MemoryBuffer buffer; + buffer.resize(internal::INLINE_BUFFER_SIZE); + for (;;) { + char *system_message = &buffer[0]; + int result = safe_strerror(error_code, system_message, buffer.size()); + if (result == 0) { + out << message << ": " << system_message; + return; + } + if (result != ERANGE) + break; // Can't get error message, report error code instead. + buffer.resize(buffer.size() * 2); + } + } FMT_CATCH(...) {} + fmt::format_error_code(out, error_code, message); // 'fmt::' is for bcc32. +} + +template +void internal::ArgMap::init(const ArgList &args) { + if (!map_.empty()) + return; + typedef internal::NamedArg NamedArg; + const NamedArg *named_arg = FMT_NULL; + bool use_values = + args.type(ArgList::MAX_PACKED_ARGS - 1) == internal::Arg::NONE; + if (use_values) { + for (unsigned i = 0;/*nothing*/; ++i) { + internal::Arg::Type arg_type = args.type(i); + switch (arg_type) { + case internal::Arg::NONE: + return; + case internal::Arg::NAMED_ARG: + named_arg = static_cast(args.values_[i].pointer); + map_.push_back(Pair(named_arg->name, *named_arg)); + break; + default: + /*nothing*/; + } + } + return; + } + for (unsigned i = 0; i != ArgList::MAX_PACKED_ARGS; ++i) { + internal::Arg::Type arg_type = args.type(i); + if (arg_type == internal::Arg::NAMED_ARG) { + named_arg = static_cast(args.args_[i].pointer); + map_.push_back(Pair(named_arg->name, *named_arg)); + } + } + for (unsigned i = ArgList::MAX_PACKED_ARGS;/*nothing*/; ++i) { + switch (args.args_[i].type) { + case internal::Arg::NONE: + return; + case internal::Arg::NAMED_ARG: + named_arg = static_cast(args.args_[i].pointer); + map_.push_back(Pair(named_arg->name, *named_arg)); + break; + default: + /*nothing*/; + } + } +} + +template +void internal::FixedBuffer::grow(std::size_t) { + FMT_THROW(std::runtime_error("buffer overflow")); +} + +FMT_FUNC internal::Arg internal::FormatterBase::do_get_arg( + unsigned arg_index, const char *&error) { + internal::Arg arg = args_[arg_index]; + switch (arg.type) { + case internal::Arg::NONE: + error = "argument index out of range"; + break; + case internal::Arg::NAMED_ARG: + arg = *static_cast(arg.pointer); + break; + default: + /*nothing*/; + } + return arg; +} + +FMT_FUNC void report_system_error( + int error_code, fmt::StringRef message) FMT_NOEXCEPT { + // 'fmt::' is for bcc32. + report_error(format_system_error, error_code, message); +} + +#if FMT_USE_WINDOWS_H +FMT_FUNC void report_windows_error( + int error_code, fmt::StringRef message) FMT_NOEXCEPT { + // 'fmt::' is for bcc32. + report_error(internal::format_windows_error, error_code, message); +} +#endif + +FMT_FUNC void print(std::FILE *f, CStringRef format_str, ArgList args) { + MemoryWriter w; + w.write(format_str, args); + std::fwrite(w.data(), 1, w.size(), f); +} + +FMT_FUNC void print(CStringRef format_str, ArgList args) { + print(stdout, format_str, args); +} + +FMT_FUNC void print_colored(Color c, CStringRef format, ArgList args) { + char escape[] = "\x1b[30m"; + escape[3] = static_cast('0' + c); + std::fputs(escape, stdout); + print(format, args); + std::fputs(RESET_COLOR, stdout); +} + +#ifndef FMT_HEADER_ONLY + +template struct internal::BasicData; + +// Explicit instantiations for char. + +template void internal::FixedBuffer::grow(std::size_t); + +template void internal::ArgMap::init(const ArgList &args); + +template FMT_API int internal::CharTraits::format_float( + char *buffer, std::size_t size, const char *format, + unsigned width, int precision, double value); + +template FMT_API int internal::CharTraits::format_float( + char *buffer, std::size_t size, const char *format, + unsigned width, int precision, long double value); + +// Explicit instantiations for wchar_t. + +template void internal::FixedBuffer::grow(std::size_t); + +template void internal::ArgMap::init(const ArgList &args); + +template FMT_API int internal::CharTraits::format_float( + wchar_t *buffer, std::size_t size, const wchar_t *format, + unsigned width, int precision, double value); + +template FMT_API int internal::CharTraits::format_float( + wchar_t *buffer, std::size_t size, const wchar_t *format, + unsigned width, int precision, long double value); + +#endif // FMT_HEADER_ONLY + +} // namespace fmt + +#ifdef _MSC_VER +# pragma warning(pop) +#endif diff --git a/diy/include/diy/fmt/format.h b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/fmt/format.h similarity index 88% rename from diy/include/diy/fmt/format.h rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/fmt/format.h index 0ca1576b8..02452c397 100644 --- a/diy/include/diy/fmt/format.h +++ b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/fmt/format.h @@ -40,7 +40,10 @@ #include #include #include -#include +#include // for std::pair + +// The fmt library version in the form major * 10000 + minor * 100 + patch. +#define FMT_VERSION 40000 #ifdef _SECURE_SCL # define FMT_SECURE_SCL _SECURE_SCL @@ -52,7 +55,13 @@ # include #endif -#if defined(_MSC_VER) && _MSC_VER <= 1500 +#ifdef _MSC_VER +# define FMT_MSC_VER _MSC_VER +#else +# define FMT_MSC_VER 0 +#endif + +#if FMT_MSC_VER && FMT_MSC_VER <= 1500 typedef unsigned __int32 uint32_t; typedef unsigned __int64 uint64_t; typedef __int64 intmax_t; @@ -100,8 +109,10 @@ typedef __int64 intmax_t; #endif #if defined(__clang__) && !defined(FMT_ICC_VERSION) +# define FMT_CLANG_VERSION (__clang_major__ * 100 + __clang_minor__) # pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wdocumentation" +# pragma clang diagnostic ignored "-Wdocumentation-unknown-command" +# pragma clang diagnostic ignored "-Wpadded" #endif #ifdef __GNUC_LIBSTD__ @@ -132,7 +143,7 @@ typedef __int64 intmax_t; // since version 2013. # define FMT_USE_VARIADIC_TEMPLATES \ (FMT_HAS_FEATURE(cxx_variadic_templates) || \ - (FMT_GCC_VERSION >= 404 && FMT_HAS_GXX_CXX11) || _MSC_VER >= 1800) + (FMT_GCC_VERSION >= 404 && FMT_HAS_GXX_CXX11) || FMT_MSC_VER >= 1800) #endif #ifndef FMT_USE_RVALUE_REFERENCES @@ -143,19 +154,15 @@ typedef __int64 intmax_t; # else # define FMT_USE_RVALUE_REFERENCES \ (FMT_HAS_FEATURE(cxx_rvalue_references) || \ - (FMT_GCC_VERSION >= 403 && FMT_HAS_GXX_CXX11) || _MSC_VER >= 1600) + (FMT_GCC_VERSION >= 403 && FMT_HAS_GXX_CXX11) || FMT_MSC_VER >= 1600) # endif #endif -#if FMT_USE_RVALUE_REFERENCES -# include // for std::move -#endif - // Check if exceptions are disabled. #if defined(__GNUC__) && !defined(__EXCEPTIONS) # define FMT_EXCEPTIONS 0 #endif -#if defined(_MSC_VER) && !_HAS_EXCEPTIONS +#if FMT_MSC_VER && !_HAS_EXCEPTIONS # define FMT_EXCEPTIONS 0 #endif #ifndef FMT_EXCEPTIONS @@ -175,20 +182,50 @@ typedef __int64 intmax_t; # define FMT_USE_NOEXCEPT 0 #endif +#if FMT_USE_NOEXCEPT || FMT_HAS_FEATURE(cxx_noexcept) || \ + (FMT_GCC_VERSION >= 408 && FMT_HAS_GXX_CXX11) || \ + FMT_MSC_VER >= 1900 +# define FMT_DETECTED_NOEXCEPT noexcept +#else +# define FMT_DETECTED_NOEXCEPT throw() +#endif + #ifndef FMT_NOEXCEPT # if FMT_EXCEPTIONS -# if FMT_USE_NOEXCEPT || FMT_HAS_FEATURE(cxx_noexcept) || \ - (FMT_GCC_VERSION >= 408 && FMT_HAS_GXX_CXX11) || \ - _MSC_VER >= 1900 -# define FMT_NOEXCEPT noexcept -# else -# define FMT_NOEXCEPT throw() -# endif +# define FMT_NOEXCEPT FMT_DETECTED_NOEXCEPT # else # define FMT_NOEXCEPT # endif #endif +// This is needed because GCC still uses throw() in its headers when exceptions +// are disabled. +#if FMT_GCC_VERSION +# define FMT_DTOR_NOEXCEPT FMT_DETECTED_NOEXCEPT +#else +# define FMT_DTOR_NOEXCEPT FMT_NOEXCEPT +#endif + +#ifndef FMT_OVERRIDE +# if (defined(FMT_USE_OVERRIDE) && FMT_USE_OVERRIDE) || FMT_HAS_FEATURE(cxx_override) || \ + (FMT_GCC_VERSION >= 408 && FMT_HAS_GXX_CXX11) || \ + FMT_MSC_VER >= 1900 +# define FMT_OVERRIDE override +# else +# define FMT_OVERRIDE +# endif +#endif + +#ifndef FMT_NULL +# if FMT_HAS_FEATURE(cxx_nullptr) || \ + (FMT_GCC_VERSION >= 408 && FMT_HAS_GXX_CXX11) || \ + FMT_MSC_VER >= 1600 +# define FMT_NULL nullptr +# else +# define FMT_NULL NULL +# endif +#endif + // A macro to disallow the copy constructor and operator= functions // This should be used in the private: declarations for a class #ifndef FMT_USE_DELETED_FUNCTIONS @@ -196,7 +233,7 @@ typedef __int64 intmax_t; #endif #if FMT_USE_DELETED_FUNCTIONS || FMT_HAS_FEATURE(cxx_deleted_functions) || \ - (FMT_GCC_VERSION >= 404 && FMT_HAS_GXX_CXX11) || _MSC_VER >= 1800 + (FMT_GCC_VERSION >= 404 && FMT_HAS_GXX_CXX11) || FMT_MSC_VER >= 1800 # define FMT_DELETED_OR_UNDEFINED = delete # define FMT_DISALLOW_COPY_AND_ASSIGN(TypeName) \ TypeName(const TypeName&) = delete; \ @@ -208,6 +245,20 @@ typedef __int64 intmax_t; TypeName& operator=(const TypeName&) #endif +#ifndef FMT_USE_DEFAULTED_FUNCTIONS +# define FMT_USE_DEFAULTED_FUNCTIONS 0 +#endif + +#ifndef FMT_DEFAULTED_COPY_CTOR +# if FMT_USE_DEFAULTED_FUNCTIONS || FMT_HAS_FEATURE(cxx_defaulted_functions) || \ + (FMT_GCC_VERSION >= 404 && FMT_HAS_GXX_CXX11) || FMT_MSC_VER >= 1800 +# define FMT_DEFAULTED_COPY_CTOR(TypeName) \ + TypeName(const TypeName&) = default; +# else +# define FMT_DEFAULTED_COPY_CTOR(TypeName) +# endif +#endif + #ifndef FMT_USE_USER_DEFINED_LITERALS // All compilers which support UDLs also support variadic templates. This // makes the fmt::literals implementation easier. However, an explicit check @@ -216,28 +267,42 @@ typedef __int64 intmax_t; # define FMT_USE_USER_DEFINED_LITERALS \ FMT_USE_VARIADIC_TEMPLATES && FMT_USE_RVALUE_REFERENCES && \ (FMT_HAS_FEATURE(cxx_user_literals) || \ - (FMT_GCC_VERSION >= 407 && FMT_HAS_GXX_CXX11) || _MSC_VER >= 1900) && \ + (FMT_GCC_VERSION >= 407 && FMT_HAS_GXX_CXX11) || FMT_MSC_VER >= 1900) && \ (!defined(FMT_ICC_VERSION) || FMT_ICC_VERSION >= 1500) #endif +#ifndef FMT_USE_EXTERN_TEMPLATES +# define FMT_USE_EXTERN_TEMPLATES \ + (FMT_CLANG_VERSION >= 209 || (FMT_GCC_VERSION >= 303 && FMT_HAS_GXX_CXX11)) +#endif + +#ifdef FMT_HEADER_ONLY +// If header only do not use extern templates. +# undef FMT_USE_EXTERN_TEMPLATES +# define FMT_USE_EXTERN_TEMPLATES 0 +#endif + #ifndef FMT_ASSERT # define FMT_ASSERT(condition, message) assert((condition) && message) #endif +// __builtin_clz is broken in clang with Microsoft CodeGen: +// https://github.com/fmtlib/fmt/issues/519 +#ifndef _MSC_VER +# if FMT_GCC_VERSION >= 400 || FMT_HAS_BUILTIN(__builtin_clz) +# define FMT_BUILTIN_CLZ(n) __builtin_clz(n) +# endif -#if FMT_GCC_VERSION >= 400 || FMT_HAS_BUILTIN(__builtin_clz) -# define FMT_BUILTIN_CLZ(n) __builtin_clz(n) +# if FMT_GCC_VERSION >= 400 || FMT_HAS_BUILTIN(__builtin_clzll) +# define FMT_BUILTIN_CLZLL(n) __builtin_clzll(n) +# endif #endif -#if FMT_GCC_VERSION >= 400 || FMT_HAS_BUILTIN(__builtin_clzll) -# define FMT_BUILTIN_CLZLL(n) __builtin_clzll(n) -#endif - -// Some compilers masquerade as both MSVC and GCC-likes or +// Some compilers masquerade as both MSVC and GCC-likes or // otherwise support __builtin_clz and __builtin_clzll, so // only define FMT_BUILTIN_CLZ using the MSVC intrinsics // if the clz and clzll builtins are not available. -#if defined(_MSC_VER) && !defined(FMT_BUILTIN_CLZLL) +#if FMT_MSC_VER && !defined(FMT_BUILTIN_CLZLL) && !defined(_MANAGED) # include // _BitScanReverse, _BitScanReverse64 namespace fmt { @@ -249,7 +314,7 @@ inline uint32_t clz(uint32_t x) { assert(x != 0); // Static analysis complains about using uninitialized data - // "r", but the only way that can happen is if "x" is 0, + // "r", but the only way that can happen is if "x" is 0, // which the callers guarantee to not happen. # pragma warning(suppress: 6102) return 31 - r; @@ -275,7 +340,7 @@ inline uint32_t clzll(uint64_t x) { assert(x != 0); // Static analysis complains about using uninitialized data - // "r", but the only way that can happen is if "x" is 0, + // "r", but the only way that can happen is if "x" is 0, // which the callers guarantee to not happen. # pragma warning(suppress: 6102) return 63 - r; @@ -305,7 +370,7 @@ inline DummyInt _isnan(...) { return DummyInt(); } // A helper function to suppress bogus "conditional expression is constant" // warnings. template -inline T check(T value) { return value; } +inline T const_check(T value) { return value; } } } // namespace fmt @@ -324,8 +389,8 @@ class numeric_limits : using namespace fmt::internal; // The resolution "priority" is: // isinf macro > std::isinf > ::isinf > fmt::internal::isinf - if (check(sizeof(isinf(x)) == sizeof(bool) || - sizeof(isinf(x)) == sizeof(int))) { + if (const_check(sizeof(isinf(x)) == sizeof(bool) || + sizeof(isinf(x)) == sizeof(int))) { return isinf(x) != 0; } return !_finite(static_cast(x)); @@ -335,8 +400,8 @@ class numeric_limits : template static bool isnotanumber(T x) { using namespace fmt::internal; - if (check(sizeof(isnan(x)) == sizeof(bool) || - sizeof(isnan(x)) == sizeof(int))) { + if (const_check(sizeof(isnan(x)) == sizeof(bool) || + sizeof(isnan(x)) == sizeof(int))) { return isnan(x) != 0; } return _isnan(static_cast(x)) != 0; @@ -345,8 +410,10 @@ class numeric_limits : // Portable version of signbit. static bool isnegative(double x) { using namespace fmt::internal; - if (check(sizeof(signbit(x)) == sizeof(int))) + if (const_check(sizeof(signbit(x)) == sizeof(bool) || + sizeof(signbit(x)) == sizeof(int))) { return signbit(x) != 0; + } if (x < 0) return true; if (!isnotanumber(x)) return false; int dec = 0, sign = 0; @@ -377,13 +444,19 @@ typedef BasicWriter WWriter; template class ArgFormatter; +struct FormatSpec; + +template +class BasicPrintfArgFormatter; + template > class BasicFormatter; /** \rst - A string reference. It can be constructed from a C string or ``std::string``. + A string reference. It can be constructed from a C string or + ``std::basic_string``. You can use one of the following typedefs for common character types: @@ -426,10 +499,12 @@ class BasicStringRef { /** \rst - Constructs a string reference from an ``std::string`` object. + Constructs a string reference from a ``std::basic_string`` object. \endrst */ - BasicStringRef(const std::basic_string &s) + template + BasicStringRef( + const std::basic_string, Allocator> &s) : data_(s.c_str()), size_(s.size()) {} /** @@ -482,7 +557,7 @@ typedef BasicStringRef WStringRef; /** \rst A reference to a null terminated string. It can be constructed from a C - string or ``std::string``. + string or ``std::basic_string``. You can use one of the following typedefs for common character types: @@ -515,10 +590,13 @@ class BasicCStringRef { /** \rst - Constructs a string reference from an ``std::string`` object. + Constructs a string reference from a ``std::basic_string`` object. \endrst */ - BasicCStringRef(const std::basic_string &s) : data_(s.c_str()) {} + template + BasicCStringRef( + const std::basic_string, Allocator> &s) + : data_(s.c_str()) {} /** Returns the pointer to a C string. */ const Char *c_str() const { return data_; } @@ -527,13 +605,13 @@ class BasicCStringRef { typedef BasicCStringRef CStringRef; typedef BasicCStringRef WCStringRef; -/** - A formatting error such as invalid format string. -*/ +/** A formatting error such as invalid format string. */ class FormatError : public std::runtime_error { public: explicit FormatError(CStringRef message) : std::runtime_error(message.c_str()) {} + FormatError(const FormatError &ferr) : std::runtime_error(ferr) {} + FMT_API ~FormatError() FMT_DTOR_NOEXCEPT; }; namespace internal { @@ -591,7 +669,7 @@ class Buffer { std::size_t size_; std::size_t capacity_; - Buffer(T *ptr = 0, std::size_t capacity = 0) + Buffer(T *ptr = FMT_NULL, std::size_t capacity = 0) : ptr_(ptr), size_(0), capacity_(capacity) {} /** @@ -649,7 +727,8 @@ class Buffer { template template void Buffer::append(const U *begin, const U *end) { - std::size_t new_size = size_ + internal::to_unsigned(end - begin); + FMT_ASSERT(end >= begin, "negative value"); + std::size_t new_size = size_ + (end - begin); if (new_size > capacity_) grow(new_size); std::uninitialized_copy(begin, end, @@ -659,8 +738,8 @@ void Buffer::append(const U *begin, const U *end) { namespace internal { -// A memory buffer for trivially copyable/constructible types with the first SIZE -// elements stored in the object itself. +// A memory buffer for trivially copyable/constructible types with the first +// SIZE elements stored in the object itself. template > class MemoryBuffer : private Allocator, public Buffer { private: @@ -672,7 +751,7 @@ class MemoryBuffer : private Allocator, public Buffer { } protected: - void grow(std::size_t size); + void grow(std::size_t size) FMT_OVERRIDE; public: explicit MemoryBuffer(const Allocator &alloc = Allocator()) @@ -721,7 +800,7 @@ void MemoryBuffer::grow(std::size_t size) { std::size_t new_capacity = this->capacity_ + this->capacity_ / 2; if (size > new_capacity) new_capacity = size; - T *new_ptr = this->allocate(new_capacity); + T *new_ptr = this->allocate(new_capacity, FMT_NULL); // The following code doesn't throw, so the raw pointer above doesn't leak. std::uninitialized_copy(this->ptr_, this->ptr_ + this->size_, make_ptr(new_ptr, new_capacity)); @@ -743,7 +822,7 @@ class FixedBuffer : public fmt::Buffer { FixedBuffer(Char *array, std::size_t size) : fmt::Buffer(array, size) {} protected: - FMT_API void grow(std::size_t size); + FMT_API void grow(std::size_t size) FMT_OVERRIDE; }; template @@ -775,6 +854,15 @@ class CharTraits : public BasicCharTraits { const char *format, unsigned width, int precision, T value); }; +#if FMT_USE_EXTERN_TEMPLATES +extern template int CharTraits::format_float + (char *buffer, std::size_t size, + const char* format, unsigned width, int precision, double value); +extern template int CharTraits::format_float + (char *buffer, std::size_t size, + const char* format, unsigned width, int precision, long double value); +#endif + template <> class CharTraits : public BasicCharTraits { public: @@ -786,6 +874,15 @@ class CharTraits : public BasicCharTraits { const wchar_t *format, unsigned width, int precision, T value); }; +#if FMT_USE_EXTERN_TEMPLATES +extern template int CharTraits::format_float + (wchar_t *buffer, std::size_t size, + const wchar_t* format, unsigned width, int precision, double value); +extern template int CharTraits::format_float + (wchar_t *buffer, std::size_t size, + const wchar_t* format, unsigned width, int precision, long double value); +#endif + // Checks if a number is negative - used to avoid warnings. template struct SignChecker { @@ -832,6 +929,10 @@ struct FMT_API BasicData { static const char DIGITS[]; }; +#if FMT_USE_EXTERN_TEMPLATES +extern template struct BasicData; +#endif + typedef BasicData<> Data; #ifdef FMT_BUILTIN_CLZLL @@ -920,12 +1021,14 @@ inline void format_decimal(Char *buffer, UInt value, unsigned num_digits, } unsigned index = static_cast(value * 2); *--buffer = Data::DIGITS[index + 1]; + thousands_sep(buffer); *--buffer = Data::DIGITS[index]; } template inline void format_decimal(Char *buffer, UInt value, unsigned num_digits) { - return format_decimal(buffer, value, num_digits, NoThousandsSep()); + format_decimal(buffer, value, num_digits, NoThousandsSep()); + return; } #ifndef _WIN32 @@ -975,9 +1078,6 @@ FMT_API void format_windows_error(fmt::Writer &out, int error_code, fmt::StringRef message) FMT_NOEXCEPT; #endif -FMT_API void format_system_error(fmt::Writer &out, int error_code, - fmt::StringRef message) FMT_NOEXCEPT; - // A formatting argument value. struct Value { template @@ -1027,6 +1127,8 @@ struct Arg : Value { template struct NamedArg; +template +struct NamedArgWithType; template struct Null {}; @@ -1075,7 +1177,9 @@ struct ConvertToIntImpl2 { template struct ConvertToInt { - enum { enable_conversion = sizeof(convert(get())) == sizeof(Yes) }; + enum { + enable_conversion = sizeof(fmt::internal::convert(get())) == sizeof(Yes) + }; enum { value = ConvertToIntImpl2::value }; }; @@ -1101,12 +1205,59 @@ template struct Conditional { typedef F type; }; // For bcc32 which doesn't understand ! in template arguments. -template +template struct Not { enum { value = 0 }; }; -template<> +template <> struct Not { enum { value = 1 }; }; +template +struct FalseType { enum { value = 0 }; }; + +template struct LConvCheck { + LConvCheck(int) {} +}; + +// Returns the thousands separator for the current locale. +// We check if ``lconv`` contains ``thousands_sep`` because on Android +// ``lconv`` is stubbed as an empty struct. +template +inline StringRef thousands_sep( + LConv *lc, LConvCheck = 0) { + return lc->thousands_sep; +} + +inline fmt::StringRef thousands_sep(...) { return ""; } + +#define FMT_CONCAT(a, b) a##b + +#if FMT_GCC_VERSION >= 303 +# define FMT_UNUSED __attribute__((unused)) +#else +# define FMT_UNUSED +#endif + +#ifndef FMT_USE_STATIC_ASSERT +# define FMT_USE_STATIC_ASSERT 0 +#endif + +#if FMT_USE_STATIC_ASSERT || FMT_HAS_FEATURE(cxx_static_assert) || \ + (FMT_GCC_VERSION >= 403 && FMT_HAS_GXX_CXX11) || _MSC_VER >= 1600 +# define FMT_STATIC_ASSERT(cond, message) static_assert(cond, message) +#else +# define FMT_CONCAT_(a, b) FMT_CONCAT(a, b) +# define FMT_STATIC_ASSERT(cond, message) \ + typedef int FMT_CONCAT_(Assert, __LINE__)[(cond) ? 1 : -1] FMT_UNUSED +#endif + +template +void format_arg(Formatter &, const Char *, const T &) { + FMT_STATIC_ASSERT(FalseType::value, + "Cannot format argument. To enable the use of ostream " + "operator<< include fmt/ostream.h. Otherwise provide " + "an overload of format_arg."); +} + // Makes an Arg object from any type. template class MakeValue : public Arg { @@ -1128,7 +1279,7 @@ class MakeValue : public Arg { // characters and strings into narrow strings as in // fmt::format("{}", L"test"); // To fix this, use a wide format string: fmt::format(L"{}", L"test"). -#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED) +#if !FMT_MSC_VER || defined(_NATIVE_WCHAR_T_DEFINED) MakeValue(typename WCharHelper::Unsupported); #endif MakeValue(typename WCharHelper::Unsupported); @@ -1150,9 +1301,9 @@ class MakeValue : public Arg { template static void format_custom_arg( void *formatter, const void *arg, void *format_str_ptr) { - format(*static_cast(formatter), - *static_cast(format_str_ptr), - *static_cast(arg)); + format_arg(*static_cast(formatter), + *static_cast(format_str_ptr), + *static_cast(arg)); } public: @@ -1174,7 +1325,7 @@ class MakeValue : public Arg { MakeValue(long value) { // To minimize the number of types we need to deal with, long is // translated either to int or to long long depending on its size. - if (check(sizeof(long) == sizeof(int))) + if (const_check(sizeof(long) == sizeof(int))) int_value = static_cast(value); else long_long_value = value; @@ -1184,7 +1335,7 @@ class MakeValue : public Arg { } MakeValue(unsigned long value) { - if (check(sizeof(unsigned long) == sizeof(unsigned))) + if (const_check(sizeof(unsigned long) == sizeof(unsigned))) uint_value = static_cast(value); else ulong_long_value = value; @@ -1216,7 +1367,9 @@ class MakeValue : public Arg { FMT_MAKE_VALUE(char *, string.value, CSTRING) FMT_MAKE_VALUE(const char *, string.value, CSTRING) + FMT_MAKE_VALUE(signed char *, sstring.value, CSTRING) FMT_MAKE_VALUE(const signed char *, sstring.value, CSTRING) + FMT_MAKE_VALUE(unsigned char *, ustring.value, CSTRING) FMT_MAKE_VALUE(const unsigned char *, ustring.value, CSTRING) FMT_MAKE_STR_VALUE(const std::string &, STRING) FMT_MAKE_STR_VALUE(StringRef, STRING) @@ -1245,23 +1398,22 @@ class MakeValue : public Arg { } template - MakeValue(const T &value, - typename EnableIf::value, int>::type = 0) { - int_value = value; - } - - template - static uint64_t type(const T &) { - return ConvertToInt::value ? Arg::INT : Arg::CUSTOM; + static typename EnableIf::value>::value, uint64_t>::type + type(const T &) { + return Arg::CUSTOM; } // Additional template param `Char_` is needed here because make_type always // uses char. template MakeValue(const NamedArg &value) { pointer = &value; } + template + MakeValue(const NamedArgWithType &value) { pointer = &value; } template static uint64_t type(const NamedArg &) { return Arg::NAMED_ARG; } + template + static uint64_t type(const NamedArgWithType &) { return Arg::NAMED_ARG; } }; template @@ -1270,7 +1422,7 @@ public: MakeArg() { type = Arg::NONE; } - + template MakeArg(const T &value) : Arg(MakeValue(value)) { @@ -1287,14 +1439,19 @@ struct NamedArg : Arg { : Arg(MakeArg< BasicFormatter >(value)), name(argname) {} }; +template +struct NamedArgWithType : NamedArg { + NamedArgWithType(BasicStringRef argname, const T &value) + : NamedArg(argname, value) {} +}; + class RuntimeError : public std::runtime_error { protected: RuntimeError() : std::runtime_error("") {} + RuntimeError(const RuntimeError &rerr) : std::runtime_error(rerr) {} + FMT_API ~RuntimeError() FMT_DTOR_NOEXCEPT; }; -template -class PrintfArgFormatter; - template class ArgMap; } // namespace internal @@ -1316,10 +1473,7 @@ class ArgList { }; internal::Arg::Type type(unsigned index) const { - unsigned shift = index * 4; - uint64_t mask = 0xf; - return static_cast( - (types_ & (mask << shift)) >> shift); + return type(types_, index); } template @@ -1336,6 +1490,8 @@ class ArgList { ArgList(ULongLong types, const internal::Arg *args) : types_(types), args_(args) {} + uint64_t types() const { return types_; } + /** Returns the argument at specified index. */ internal::Arg operator[](unsigned index) const { using internal::Arg; @@ -1361,6 +1517,13 @@ class ArgList { } return args_[index]; } + + static internal::Arg::Type type(uint64_t types, unsigned index) { + unsigned shift = index * 4; + uint64_t mask = 0xf; + return static_cast( + (types & (mask << shift)) >> shift); + } }; #define FMT_DISPATCH(call) static_cast(this)->call @@ -1489,9 +1652,10 @@ class ArgVisitor { */ Result visit(const Arg &arg) { switch (arg.type) { - default: + case Arg::NONE: + case Arg::NAMED_ARG: FMT_ASSERT(false, "invalid argument type"); - return Result(); + break; case Arg::INT: return FMT_DISPATCH(visit_int(arg.int_value)); case Arg::UINT: @@ -1519,6 +1683,7 @@ class ArgVisitor { case Arg::CUSTOM: return FMT_DISPATCH(visit_custom(arg.custom)); } + return Result(); } }; @@ -1543,6 +1708,7 @@ struct TypeSpec : EmptySpec { int precision() const { return -1; } bool flag(unsigned) const { return false; } char type() const { return TYPE; } + char type_prefix() const { return TYPE; } char fill() const { return ' '; } }; @@ -1578,6 +1744,7 @@ struct AlignTypeSpec : AlignSpec { bool flag(unsigned) const { return false; } char type() const { return TYPE; } + char type_prefix() const { return TYPE; } }; // A full format specifier. @@ -1593,6 +1760,7 @@ struct FormatSpec : AlignSpec { bool flag(unsigned f) const { return (flags_ & f) != 0; } int precision() const { return precision_; } char type() const { return type_; } + char type_prefix() const { return type_; } }; // An integer format specifier. @@ -1757,22 +1925,22 @@ class ArgMap { public: FMT_API void init(const ArgList &args); - const internal::Arg* find(const fmt::BasicStringRef &name) const { + const internal::Arg *find(const fmt::BasicStringRef &name) const { // The list is unsorted, so just return the first matching name. for (typename MapType::const_iterator it = map_.begin(), end = map_.end(); it != end; ++it) { if (it->first == name) return &it->second; } - return 0; + return FMT_NULL; } }; -template +template class ArgFormatterBase : public ArgVisitor { private: BasicWriter &writer_; - FormatSpec &spec_; + Spec &spec_; FMT_DISALLOW_COPY_AND_ASSIGN(ArgFormatterBase); @@ -1782,9 +1950,12 @@ class ArgFormatterBase : public ArgVisitor { writer_.write_int(reinterpret_cast(p), spec_); } + // workaround MSVC two-phase lookup issue + typedef internal::Arg Arg; + protected: BasicWriter &writer() { return writer_; } - FormatSpec &spec() { return spec_; } + Spec &spec() { return spec_; } void write(bool value) { const char *str_value = value ? "true" : "false"; @@ -1793,12 +1964,14 @@ class ArgFormatterBase : public ArgVisitor { } void write(const char *value) { - Arg::StringValue str = {value, value != 0 ? std::strlen(value) : 0}; + Arg::StringValue str = {value, value ? std::strlen(value) : 0}; writer_.write_str(str, spec_); } public: - ArgFormatterBase(BasicWriter &w, FormatSpec &s) + typedef Spec SpecType; + + ArgFormatterBase(BasicWriter &w, Spec &s) : writer_(w), spec_(s) {} template @@ -1808,8 +1981,10 @@ class ArgFormatterBase : public ArgVisitor { void visit_any_double(T value) { writer_.write_double(value, spec_); } void visit_bool(bool value) { - if (spec_.type_) - return visit_any_int(value); + if (spec_.type_) { + visit_any_int(value); + return; + } write(value); } @@ -1824,21 +1999,21 @@ class ArgFormatterBase : public ArgVisitor { typedef typename BasicWriter::CharPtr CharPtr; Char fill = internal::CharTraits::cast(spec_.fill()); CharPtr out = CharPtr(); - const unsigned CHAR_WIDTH = 1; - if (spec_.width_ > CHAR_WIDTH) { + const unsigned CHAR_SIZE = 1; + if (spec_.width_ > CHAR_SIZE) { out = writer_.grow_buffer(spec_.width_); if (spec_.align_ == ALIGN_RIGHT) { - std::uninitialized_fill_n(out, spec_.width_ - CHAR_WIDTH, fill); - out += spec_.width_ - CHAR_WIDTH; + std::uninitialized_fill_n(out, spec_.width_ - CHAR_SIZE, fill); + out += spec_.width_ - CHAR_SIZE; } else if (spec_.align_ == ALIGN_CENTER) { out = writer_.fill_padding(out, spec_.width_, - internal::check(CHAR_WIDTH), fill); + internal::const_check(CHAR_SIZE), fill); } else { - std::uninitialized_fill_n(out + CHAR_WIDTH, - spec_.width_ - CHAR_WIDTH, fill); + std::uninitialized_fill_n(out + CHAR_SIZE, + spec_.width_ - CHAR_SIZE, fill); } } else { - out = writer_.grow_buffer(CHAR_WIDTH); + out = writer_.grow_buffer(CHAR_SIZE); } *out = internal::CharTraits::cast(value); } @@ -1849,13 +2024,14 @@ class ArgFormatterBase : public ArgVisitor { write(value); } - void visit_string(Arg::StringValue value) { + // Qualification with "internal" here and below is a workaround for nvcc. + void visit_string(internal::Arg::StringValue value) { writer_.write_str(value, spec_); } using ArgVisitor::visit_wstring; - void visit_wstring(Arg::StringValue value) { + void visit_wstring(internal::Arg::StringValue value) { writer_.write_str(value, spec_); } @@ -1911,26 +2087,6 @@ class FormatterBase { w << BasicStringRef(start, internal::to_unsigned(end - start)); } }; - -// A printf formatter. -template -class PrintfFormatter : private FormatterBase { - private: - void parse_flags(FormatSpec &spec, const Char *&s); - - // Returns the argument with specified index or, if arg_index is equal - // to the maximum unsigned value, the next argument. - Arg get_arg(const Char *s, - unsigned arg_index = (std::numeric_limits::max)()); - - // Parses argument index, flags and width and returns the argument index. - unsigned parse_header(const Char *&s, FormatSpec &spec); - - public: - explicit PrintfFormatter(const ArgList &args) : FormatterBase(args) {} - FMT_API void format(BasicWriter &writer, - BasicCStringRef format_str); -}; } // namespace internal /** @@ -1950,8 +2106,8 @@ class PrintfFormatter : private FormatterBase { will be called. \endrst */ -template -class BasicArgFormatter : public internal::ArgFormatterBase { +template +class BasicArgFormatter : public internal::ArgFormatterBase { private: BasicFormatter &formatter_; const Char *format_; @@ -1966,11 +2122,11 @@ class BasicArgFormatter : public internal::ArgFormatterBase { \endrst */ BasicArgFormatter(BasicFormatter &formatter, - FormatSpec &spec, const Char *fmt) - : internal::ArgFormatterBase(formatter.writer(), spec), + Spec &spec, const Char *fmt) + : internal::ArgFormatterBase(formatter.writer(), spec), formatter_(formatter), format_(fmt) {} - /** Formats argument of a custom (user-defined) type. */ + /** Formats an argument of a custom (user-defined) type. */ void visit_custom(internal::Arg::CustomValue c) { c.format(&formatter_, c.value, &format_); } @@ -1978,12 +2134,14 @@ class BasicArgFormatter : public internal::ArgFormatterBase { /** The default argument formatter. */ template -class ArgFormatter : public BasicArgFormatter, Char> { +class ArgFormatter : + public BasicArgFormatter, Char, FormatSpec> { public: /** Constructs an argument formatter object. */ ArgFormatter(BasicFormatter &formatter, FormatSpec &spec, const Char *fmt) - : BasicArgFormatter, Char>(formatter, spec, fmt) {} + : BasicArgFormatter, + Char, FormatSpec>(formatter, spec, fmt) {} }; /** This template formats data and writes the output to a writer. */ @@ -2059,13 +2217,13 @@ inline uint64_t make_type(const T &arg) { return MakeValue< BasicFormatter >::type(arg); } -template +template struct ArgArray; -template +template struct ArgArray { typedef Value Type[N > 0 ? N : 1]; - + template static Value make(const T &value) { #ifdef __clang__ @@ -2080,7 +2238,7 @@ struct ArgArray { } }; -template +template struct ArgArray { typedef Arg Type[N + 1]; // +1 for the list end Arg::NONE @@ -2220,7 +2378,7 @@ inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT)) { */ class SystemError : public internal::RuntimeError { private: - void init(int err_code, CStringRef format_str, ArgList args); + FMT_API void init(int err_code, CStringRef format_str, ArgList args); protected: int error_code_; @@ -2232,17 +2390,10 @@ class SystemError : public internal::RuntimeError { public: /** \rst - Constructs a :class:`fmt::SystemError` object with the description - of the form - - .. parsed-literal:: - **: ** - - where ** is the formatted message and ** is - the system message corresponding to the error code. - *error_code* is a system error code as given by ``errno``. - If *error_code* is not a valid error code such as -1, the system message - may look like "Unknown error -1" and is platform-dependent. + Constructs a :class:`fmt::SystemError` object with a description + formatted with `fmt::format_system_error`. *message* and additional + arguments passed into the constructor are formatted similarly to + `fmt::format`. **Example**:: @@ -2258,11 +2409,33 @@ class SystemError : public internal::RuntimeError { SystemError(int error_code, CStringRef message) { init(error_code, message, ArgList()); } + FMT_DEFAULTED_COPY_CTOR(SystemError) FMT_VARIADIC_CTOR(SystemError, init, int, CStringRef) + FMT_API ~SystemError() FMT_DTOR_NOEXCEPT; + int error_code() const { return error_code_; } }; +/** + \rst + Formats an error returned by an operating system or a language runtime, + for example a file opening error, and writes it to *out* in the following + form: + + .. parsed-literal:: + **: ** + + where ** is the passed message and ** is + the system message corresponding to the error code. + *error_code* is a system error code as given by ``errno``. + If *error_code* is not a valid error code such as -1, the system message + may look like "Unknown error -1" and is platform-dependent. + \endrst + */ +FMT_API void format_system_error(fmt::Writer &out, int error_code, + fmt::StringRef message) FMT_NOEXCEPT; + /** \rst This template provides operations for formatting and writing data into @@ -2351,16 +2524,16 @@ class BasicWriter { void write_int(T value, Spec spec); // Formats a floating-point number (double or long double). - template - void write_double(T value, const FormatSpec &spec); + template + void write_double(T value, const Spec &spec); // Writes a formatted string. template CharPtr write_str(const StrChar *s, std::size_t size, const AlignSpec &spec); - template + template void write_str(const internal::Arg::StringValue &str, - const FormatSpec &spec); + const Spec &spec); // This following methods are private to disallow writing wide characters // and strings to a char stream. If you want to print a wide string as a @@ -2379,10 +2552,11 @@ class BasicWriter { template void append_float_length(Char *&, T) {} - template + template friend class internal::ArgFormatterBase; - friend class internal::PrintfArgFormatter; + template + friend class BasicPrintfArgFormatter; protected: /** @@ -2578,9 +2752,9 @@ typename BasicWriter::CharPtr BasicWriter::write_str( } template -template +template void BasicWriter::write_str( - const internal::Arg::StringValue &s, const FormatSpec &spec) { + const internal::Arg::StringValue &s, const Spec &spec) { // Check if StrChar is convertible to Char. internal::CharTraits::convert(StrChar()); if (spec.type_ && spec.type_ != 's') @@ -2590,7 +2764,6 @@ void BasicWriter::write_str( if (str_size == 0) { if (!str_value) { FMT_THROW(FormatError("string pointer is null")); - return; } } std::size_t precision = static_cast(spec.precision_); @@ -2705,7 +2878,7 @@ void BasicWriter::write_int(T value, Spec spec) { UnsignedType n = abs_value; if (spec.flag(HASH_FLAG)) { prefix[prefix_size++] = '0'; - prefix[prefix_size++] = spec.type(); + prefix[prefix_size++] = spec.type_prefix(); } unsigned num_digits = 0; do { @@ -2725,7 +2898,7 @@ void BasicWriter::write_int(T value, Spec spec) { UnsignedType n = abs_value; if (spec.flag(HASH_FLAG)) { prefix[prefix_size++] = '0'; - prefix[prefix_size++] = spec.type(); + prefix[prefix_size++] = spec.type_prefix(); } unsigned num_digits = 0; do { @@ -2755,9 +2928,12 @@ void BasicWriter::write_int(T value, Spec spec) { } case 'n': { unsigned num_digits = internal::count_digits(abs_value); - fmt::StringRef sep = std::localeconv()->thousands_sep; + fmt::StringRef sep = ""; +#if !(defined(ANDROID) || defined(__ANDROID__)) + sep = internal::thousands_sep(std::localeconv()); +#endif unsigned size = static_cast( - num_digits + sep.size() * (num_digits - 1) / 3); + num_digits + sep.size() * ((num_digits - 1) / 3)); CharPtr p = prepare_int_buffer(size, spec, prefix, prefix_size) + 1; internal::format_decimal(get(p), abs_value, 0, internal::ThousandsSep(sep)); break; @@ -2770,8 +2946,8 @@ void BasicWriter::write_int(T value, Spec spec) { } template -template -void BasicWriter::write_double(T value, const FormatSpec &spec) { +template +void BasicWriter::write_double(T value, const Spec &spec) { // Check type. char type = spec.type(); bool upper = false; @@ -2782,7 +2958,7 @@ void BasicWriter::write_double(T value, const FormatSpec &spec) { case 'e': case 'f': case 'g': case 'a': break; case 'F': -#ifdef _MSC_VER +#if FMT_MSC_VER // MSVC's printf doesn't support 'F'. type = 'f'; #endif @@ -2872,10 +3048,10 @@ void BasicWriter::write_double(T value, const FormatSpec &spec) { // Format using snprintf. Char fill = internal::CharTraits::cast(spec.fill()); unsigned n = 0; - Char *start = 0; + Char *start = FMT_NULL; for (;;) { std::size_t buffer_size = buffer_.capacity() - offset; -#ifdef _MSC_VER +#if FMT_MSC_VER // MSVC's vsnprintf_s doesn't work with zero size, so reserve // space for at least one extra character to make the size non-zero. // Note that the buffer's capacity will increase by more than 1. @@ -3149,56 +3325,6 @@ FMT_API void print(std::FILE *f, CStringRef format_str, ArgList args); */ FMT_API void print(CStringRef format_str, ArgList args); -template -void printf(BasicWriter &w, BasicCStringRef format, ArgList args) { - internal::PrintfFormatter(args).format(w, format); -} - -/** - \rst - Formats arguments and returns the result as a string. - - **Example**:: - - std::string message = fmt::sprintf("The answer is %d", 42); - \endrst -*/ -inline std::string sprintf(CStringRef format, ArgList args) { - MemoryWriter w; - printf(w, format, args); - return w.str(); -} - -inline std::wstring sprintf(WCStringRef format, ArgList args) { - WMemoryWriter w; - printf(w, format, args); - return w.str(); -} - -/** - \rst - Prints formatted data to the file *f*. - - **Example**:: - - fmt::fprintf(stderr, "Don't %s!", "panic"); - \endrst - */ -FMT_API int fprintf(std::FILE *f, CStringRef format, ArgList args); - -/** - \rst - Prints formatted data to ``stdout``. - - **Example**:: - - fmt::printf("Elapsed time: %.2f seconds", 1.23); - \endrst - */ -inline int printf(CStringRef format, ArgList args) { - return fprintf(stdout, format, args); -} - /** Fast integer formatter. */ @@ -3315,13 +3441,13 @@ inline void format_decimal(char *&buffer, T value) { \endrst */ template -inline internal::NamedArg arg(StringRef name, const T &arg) { - return internal::NamedArg(name, arg); +inline internal::NamedArgWithType arg(StringRef name, const T &arg) { + return internal::NamedArgWithType(name, arg); } template -inline internal::NamedArg arg(WStringRef name, const T &arg) { - return internal::NamedArg(name, arg); +inline internal::NamedArgWithType arg(WStringRef name, const T &arg) { + return internal::NamedArgWithType(name, arg); } // The following two functions are deleted intentionally to disable @@ -3350,7 +3476,6 @@ void arg(WStringRef, const internal::NamedArg&) FMT_DELETED_OR_UNDEFINED; #define FMT_ARG_N(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N #define FMT_RSEQ_N() 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 -#define FMT_CONCAT(a, b) a##b #define FMT_FOR_EACH_(N, f, ...) \ FMT_EXPAND(FMT_CONCAT(FMT_FOR_EACH, N)(f, __VA_ARGS__)) #define FMT_FOR_EACH(f, ...) \ @@ -3464,12 +3589,7 @@ FMT_VARIADIC(std::string, format, CStringRef) FMT_VARIADIC_W(std::wstring, format, WCStringRef) FMT_VARIADIC(void, print, CStringRef) FMT_VARIADIC(void, print, std::FILE *, CStringRef) - FMT_VARIADIC(void, print_colored, Color, CStringRef) -FMT_VARIADIC(std::string, sprintf, CStringRef) -FMT_VARIADIC_W(std::wstring, sprintf, WCStringRef) -FMT_VARIADIC(int, printf, CStringRef) -FMT_VARIADIC(int, fprintf, std::FILE *, CStringRef) namespace internal { template @@ -3534,7 +3654,7 @@ inline internal::Arg BasicFormatter::get_arg( template inline internal::Arg BasicFormatter::parse_arg_index(const Char *&s) { - const char *error = 0; + const char *error = FMT_NULL; internal::Arg arg = *s < '0' || *s > '9' ? next_arg(error) : get_arg(internal::parse_nonnegative_int(s), error); if (error) { @@ -3552,7 +3672,7 @@ inline internal::Arg BasicFormatter::parse_arg_name(const Char *&s) { do { c = *++s; } while (internal::is_name_start(c) || ('0' <= c && c <= '9')); - const char *error = 0; + const char *error = FMT_NULL; internal::Arg arg = get_arg(BasicStringRef(start, s - start), error); if (error) FMT_THROW(FormatError(error)); @@ -3564,7 +3684,7 @@ const Char *BasicFormatter::format( const Char *&format_str, const internal::Arg &arg) { using internal::Arg; const Char *s = format_str; - FormatSpec spec; + typename ArgFormatter::SpecType spec; if (*s == ':') { if (arg.type == Arg::CUSTOM) { arg.custom.format(this, arg.custom.value, &s); @@ -3750,6 +3870,66 @@ void BasicFormatter::format(BasicCStringRef format_str) { } write(writer_, start, s); } + +template +struct ArgJoin { + It first; + It last; + BasicCStringRef sep; + + ArgJoin(It first, It last, const BasicCStringRef& sep) : + first(first), + last(last), + sep(sep) {} +}; + +template +ArgJoin join(It first, It last, const BasicCStringRef& sep) { + return ArgJoin(first, last, sep); +} + +template +ArgJoin join(It first, It last, const BasicCStringRef& sep) { + return ArgJoin(first, last, sep); +} + +#if FMT_HAS_GXX_CXX11 +template +auto join(const Range& range, const BasicCStringRef& sep) + -> ArgJoin { + return join(std::begin(range), std::end(range), sep); +} + +template +auto join(const Range& range, const BasicCStringRef& sep) + -> ArgJoin { + return join(std::begin(range), std::end(range), sep); +} +#endif + +template +void format_arg(fmt::BasicFormatter &f, + const Char *&format_str, const ArgJoin& e) { + const Char* end = format_str; + if (*end == ':') + ++end; + while (*end && *end != '}') + ++end; + if (*end != '}') + FMT_THROW(FormatError("missing '}' in format string")); + + It it = e.first; + if (it != e.last) { + const Char* save = format_str; + f.format(format_str, internal::MakeArg >(*it++)); + while (it != e.last) { + f.writer().write(e.sep); + format_str = save; + f.format(format_str, internal::MakeArg >(*it++)); + } + } + format_str = end + 1; +} } // namespace fmt #if FMT_USE_USER_DEFINED_LITERALS @@ -3772,7 +3952,7 @@ struct UdlArg { const Char *str; template - NamedArg operator=(T &&value) const { + NamedArgWithType operator=(T &&value) const { return {str, std::forward(value)}; } }; diff --git a/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/fmt/ostream.cc b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/fmt/ostream.cc new file mode 100644 index 000000000..2d443f730 --- /dev/null +++ b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/fmt/ostream.cc @@ -0,0 +1,35 @@ +/* + Formatting library for C++ - std::ostream support + + Copyright (c) 2012 - 2016, Victor Zverovich + All rights reserved. + + For the license information refer to format.h. + */ + +#include "ostream.h" + +namespace fmt { + +namespace internal { +FMT_FUNC void write(std::ostream &os, Writer &w) { + const char *data = w.data(); + typedef internal::MakeUnsigned::Type UnsignedStreamSize; + UnsignedStreamSize size = w.size(); + UnsignedStreamSize max_size = + internal::to_unsigned((std::numeric_limits::max)()); + do { + UnsignedStreamSize n = size <= max_size ? size : max_size; + os.write(data, static_cast(n)); + data += n; + size -= n; + } while (size != 0); +} +} + +FMT_FUNC void print(std::ostream &os, CStringRef format_str, ArgList args) { + MemoryWriter w; + w.write(format_str, args); + internal::write(os, w); +} +} // namespace fmt diff --git a/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/fmt/ostream.h b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/fmt/ostream.h new file mode 100644 index 000000000..84a02d173 --- /dev/null +++ b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/fmt/ostream.h @@ -0,0 +1,105 @@ +/* + Formatting library for C++ - std::ostream support + + Copyright (c) 2012 - 2016, Victor Zverovich + All rights reserved. + + For the license information refer to format.h. + */ + +#ifndef FMT_OSTREAM_H_ +#define FMT_OSTREAM_H_ + +#include "format.h" +#include + +namespace fmt { + +namespace internal { + +template +class FormatBuf : public std::basic_streambuf { + private: + typedef typename std::basic_streambuf::int_type int_type; + typedef typename std::basic_streambuf::traits_type traits_type; + + Buffer &buffer_; + + public: + FormatBuf(Buffer &buffer) : buffer_(buffer) {} + + protected: + // The put-area is actually always empty. This makes the implementation + // simpler and has the advantage that the streambuf and the buffer are always + // in sync and sputc never writes into uninitialized memory. The obvious + // disadvantage is that each call to sputc always results in a (virtual) call + // to overflow. There is no disadvantage here for sputn since this always + // results in a call to xsputn. + + int_type overflow(int_type ch = traits_type::eof()) FMT_OVERRIDE { + if (!traits_type::eq_int_type(ch, traits_type::eof())) + buffer_.push_back(static_cast(ch)); + return ch; + } + + std::streamsize xsputn(const Char *s, std::streamsize count) FMT_OVERRIDE { + buffer_.append(s, s + count); + return count; + } +}; + +Yes &convert(std::ostream &); + +struct DummyStream : std::ostream { + DummyStream(); // Suppress a bogus warning in MSVC. + // Hide all operator<< overloads from std::ostream. + void operator<<(Null<>); +}; + +No &operator<<(std::ostream &, int); + +template +struct ConvertToIntImpl { + // Convert to int only if T doesn't have an overloaded operator<<. + enum { + value = sizeof(convert(get() << get())) == sizeof(No) + }; +}; + +// Write the content of w to os. +FMT_API void write(std::ostream &os, Writer &w); +} // namespace internal + +// Formats a value. +template +void format_arg(BasicFormatter &f, + const Char *&format_str, const T &value) { + internal::MemoryBuffer buffer; + + internal::FormatBuf format_buf(buffer); + std::basic_ostream output(&format_buf); + output << value; + + BasicStringRef str(&buffer[0], buffer.size()); + typedef internal::MakeArg< BasicFormatter > MakeArg; + format_str = f.format(format_str, MakeArg(str)); +} + +/** + \rst + Prints formatted data to the stream *os*. + + **Example**:: + + print(cerr, "Don't {}!", "panic"); + \endrst + */ +FMT_API void print(std::ostream &os, CStringRef format_str, ArgList args); +FMT_VARIADIC(void, print, std::ostream &, CStringRef) +} // namespace fmt + +#ifdef FMT_HEADER_ONLY +# include "ostream.cc" +#endif + +#endif // FMT_OSTREAM_H_ diff --git a/diy/include/diy/grid.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/grid.hpp similarity index 100% rename from diy/include/diy/grid.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/grid.hpp diff --git a/diy/include/diy/io/block.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/io/block.hpp similarity index 100% rename from diy/include/diy/io/block.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/io/block.hpp diff --git a/diy/include/diy/io/bov.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/io/bov.hpp similarity index 100% rename from diy/include/diy/io/bov.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/io/bov.hpp diff --git a/diy/include/diy/io/numpy.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/io/numpy.hpp similarity index 100% rename from diy/include/diy/io/numpy.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/io/numpy.hpp diff --git a/diy/include/diy/link.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/link.hpp similarity index 100% rename from diy/include/diy/link.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/link.hpp diff --git a/diy/include/diy/log.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/log.hpp similarity index 100% rename from diy/include/diy/log.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/log.hpp diff --git a/diy/include/diy/master.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/master.hpp similarity index 99% rename from diy/include/diy/master.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/master.hpp index ec7319a60..97ccb8724 100644 --- a/diy/include/diy/master.hpp +++ b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/master.hpp @@ -1062,8 +1062,6 @@ void diy::Master:: flush() { - - auto scoped = prof.scoped("comm"); #ifdef DEBUG time_type start = get_time(); unsigned wait = 1; diff --git a/diy/include/diy/mpi.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi.hpp similarity index 100% rename from diy/include/diy/mpi.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi.hpp diff --git a/diy/include/diy/mpi/collectives.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi/collectives.hpp similarity index 96% rename from diy/include/diy/mpi/collectives.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi/collectives.hpp index 4324534e5..8d70bcf01 100644 --- a/diy/include/diy/mpi/collectives.hpp +++ b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi/collectives.hpp @@ -152,13 +152,13 @@ namespace mpi } } - static void reduce(const communicator& comm, const T& in, T& out, int root, const Op& op) + static void reduce(const communicator& comm, const T& in, T& out, int root, const Op&) { MPI_Reduce(Datatype::address(const_cast(in)), Datatype::address(out), Datatype::count(in), Datatype::datatype(), - detail::mpi_op::get(op), + detail::mpi_op::get(), root, comm); } @@ -168,38 +168,38 @@ namespace mpi Datatype::address(const_cast(in)), Datatype::count(in), Datatype::datatype(), - detail::mpi_op::get(op), + detail::mpi_op::get(), root, comm); } - static void all_reduce(const communicator& comm, const T& in, T& out, const Op& op) + static void all_reduce(const communicator& comm, const T& in, T& out, const Op&) { MPI_Allreduce(Datatype::address(const_cast(in)), Datatype::address(out), Datatype::count(in), Datatype::datatype(), - detail::mpi_op::get(op), + detail::mpi_op::get(), comm); } - static void all_reduce(const communicator& comm, const std::vector& in, std::vector& out, const Op& op) + static void all_reduce(const communicator& comm, const std::vector& in, std::vector& out, const Op&) { out.resize(in.size()); MPI_Allreduce(Datatype::address(const_cast(in[0])), Datatype::address(out[0]), in.size(), Datatype::datatype(), - detail::mpi_op::get(op), + detail::mpi_op::get(), comm); } - static void scan(const communicator& comm, const T& in, T& out, const Op& op) + static void scan(const communicator& comm, const T& in, T& out, const Op&) { MPI_Scan(Datatype::address(const_cast(in)), Datatype::address(out), Datatype::count(in), Datatype::datatype(), - detail::mpi_op::get(op), + detail::mpi_op::get(), comm); } diff --git a/diy/include/diy/mpi/communicator.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi/communicator.hpp similarity index 93% rename from diy/include/diy/mpi/communicator.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi/communicator.hpp index d1bdf33f7..c29b6d033 100644 --- a/diy/include/diy/mpi/communicator.hpp +++ b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi/communicator.hpp @@ -9,7 +9,7 @@ namespace mpi { public: communicator(MPI_Comm comm = MPI_COMM_WORLD): - comm_(comm), rank_(0), size_(1) { if (comm != MPI_COMM_NULL) { MPI_Comm_rank(comm_, &rank_); MPI_Comm_size(comm_, &size_); } } + comm_(comm), rank_(0), size_(1) { if (comm != MPI_COMM_NULL) { MPI_Comm_rank(comm_, &rank_); MPI_Comm_size(comm_, &size_); } } int rank() const { return rank_; } int size() const { return size_; } diff --git a/diy/include/diy/mpi/constants.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi/constants.hpp similarity index 100% rename from diy/include/diy/mpi/constants.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi/constants.hpp diff --git a/diy/include/diy/mpi/datatypes.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi/datatypes.hpp similarity index 100% rename from diy/include/diy/mpi/datatypes.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi/datatypes.hpp diff --git a/diy/include/diy/mpi/io.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi/io.hpp similarity index 100% rename from diy/include/diy/mpi/io.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi/io.hpp diff --git a/diy/include/diy/mpi/operations.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi/operations.hpp similarity index 65% rename from diy/include/diy/mpi/operations.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi/operations.hpp index 9c38e58ae..2f95c0a72 100644 --- a/diy/include/diy/mpi/operations.hpp +++ b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi/operations.hpp @@ -14,13 +14,13 @@ namespace mpi namespace detail { - template struct mpi_op { static MPI_Op get(const T&); }; - template struct mpi_op< maximum > { static MPI_Op get(const maximum&) { return MPI_MAX; } }; - template struct mpi_op< minimum > { static MPI_Op get(const minimum&) { return MPI_MIN; } }; - template struct mpi_op< std::plus > { static MPI_Op get(const std::plus&) { return MPI_SUM; } }; - template struct mpi_op< std::multiplies > { static MPI_Op get(const std::multiplies&) { return MPI_PROD; } }; - template struct mpi_op< std::logical_and > { static MPI_Op get(const std::logical_and&) { return MPI_LAND; } }; - template struct mpi_op< std::logical_or > { static MPI_Op get(const std::logical_or&) { return MPI_LOR; } }; + template struct mpi_op { static MPI_Op get(); }; + template struct mpi_op< maximum > { static MPI_Op get() { return MPI_MAX; } }; + template struct mpi_op< minimum > { static MPI_Op get() { return MPI_MIN; } }; + template struct mpi_op< std::plus > { static MPI_Op get() { return MPI_SUM; } }; + template struct mpi_op< std::multiplies > { static MPI_Op get() { return MPI_PROD; } }; + template struct mpi_op< std::logical_and > { static MPI_Op get() { return MPI_LAND; } }; + template struct mpi_op< std::logical_or > { static MPI_Op get() { return MPI_LOR; } }; } } } diff --git a/diy/include/diy/mpi/optional.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi/optional.hpp similarity index 100% rename from diy/include/diy/mpi/optional.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi/optional.hpp diff --git a/diy/include/diy/mpi/point-to-point.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi/point-to-point.hpp similarity index 100% rename from diy/include/diy/mpi/point-to-point.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi/point-to-point.hpp diff --git a/diy/include/diy/mpi/request.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi/request.hpp similarity index 100% rename from diy/include/diy/mpi/request.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi/request.hpp diff --git a/diy/include/diy/mpi/status.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi/status.hpp similarity index 100% rename from diy/include/diy/mpi/status.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/mpi/status.hpp diff --git a/diy/include/diy/no-thread.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/no-thread.hpp similarity index 100% rename from diy/include/diy/no-thread.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/no-thread.hpp diff --git a/diy/include/diy/partners/all-reduce.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/partners/all-reduce.hpp similarity index 100% rename from diy/include/diy/partners/all-reduce.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/partners/all-reduce.hpp diff --git a/diy/include/diy/partners/broadcast.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/partners/broadcast.hpp similarity index 100% rename from diy/include/diy/partners/broadcast.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/partners/broadcast.hpp diff --git a/diy/include/diy/partners/common.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/partners/common.hpp similarity index 100% rename from diy/include/diy/partners/common.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/partners/common.hpp diff --git a/diy/include/diy/partners/merge.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/partners/merge.hpp similarity index 100% rename from diy/include/diy/partners/merge.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/partners/merge.hpp diff --git a/diy/include/diy/partners/swap.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/partners/swap.hpp similarity index 100% rename from diy/include/diy/partners/swap.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/partners/swap.hpp diff --git a/diy/include/diy/pick.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/pick.hpp similarity index 100% rename from diy/include/diy/pick.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/pick.hpp diff --git a/diy/include/diy/point.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/point.hpp similarity index 100% rename from diy/include/diy/point.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/point.hpp diff --git a/diy/include/diy/proxy.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/proxy.hpp similarity index 100% rename from diy/include/diy/proxy.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/proxy.hpp diff --git a/diy/include/diy/reduce-operations.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/reduce-operations.hpp similarity index 100% rename from diy/include/diy/reduce-operations.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/reduce-operations.hpp diff --git a/diy/include/diy/reduce.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/reduce.hpp similarity index 100% rename from diy/include/diy/reduce.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/reduce.hpp diff --git a/diy/include/diy/serialization.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/serialization.hpp similarity index 100% rename from diy/include/diy/serialization.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/serialization.hpp diff --git a/diy/include/diy/stats.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/stats.hpp similarity index 93% rename from diy/include/diy/stats.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/stats.hpp index 0628146df..4866ccfb1 100644 --- a/diy/include/diy/stats.hpp +++ b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/stats.hpp @@ -6,7 +6,7 @@ #include #include "log.hpp" // need this for format -#define DIY_PROFILE 1 + namespace diy { namespace stats @@ -71,11 +71,7 @@ struct Profiler { const Event& e = events[i]; auto time = std::chrono::duration_cast(e.stamp - start).count(); - fmt::print(out, "{} {} {}\n", - time / 1000000., - (e.begin ? '<' : '>'), - e.name); - /* + fmt::print(out, "{:02d}:{:02d}:{:02d}.{:06d} {}{}\n", time/1000000/60/60, time/1000000/60 % 60, @@ -83,7 +79,6 @@ struct Profiler time % 1000000, (e.begin ? '<' : '>'), e.name); - */ } } diff --git a/diy/include/diy/storage.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/storage.hpp similarity index 100% rename from diy/include/diy/storage.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/storage.hpp diff --git a/diy/include/diy/thread.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/thread.hpp similarity index 100% rename from diy/include/diy/thread.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/thread.hpp diff --git a/diy/include/diy/thread/fast_mutex.h b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/thread/fast_mutex.h similarity index 100% rename from diy/include/diy/thread/fast_mutex.h rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/thread/fast_mutex.h diff --git a/diy/include/diy/time.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/time.hpp similarity index 100% rename from diy/include/diy/time.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/time.hpp diff --git a/diy/include/diy/types.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/types.hpp similarity index 100% rename from diy/include/diy/types.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/types.hpp diff --git a/diy/include/diy/vertices.hpp b/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/vertices.hpp similarity index 100% rename from diy/include/diy/vertices.hpp rename to vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/vertices.hpp diff --git a/vtkm/thirdparty/update-common.sh b/vtkm/thirdparty/update-common.sh new file mode 100644 index 000000000..9550b56ad --- /dev/null +++ b/vtkm/thirdparty/update-common.sh @@ -0,0 +1,181 @@ +#============================================================================= +# Copyright 2015-2016 Kitware, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#============================================================================= + +######################################################################## +# Script for updating third party packages. +# +# This script should be sourced in a project-specific script which sets +# the following variables: +# +# name +# The name of the project. +# ownership +# A git author name/email for the commits. +# subtree +# The location of the thirdparty package within the main source +# tree. +# repo +# The git repository to use as upstream. +# tag +# The tag, branch or commit hash to use for upstream. +# shortlog +# Optional. Set to 'true' to get a shortlog in the commit message. +# +# Additionally, an "extract_source" function must be defined. It will be +# run within the checkout of the project on the requested tag. It should +# should place the desired tree into $extractdir/$name-reduced. This +# directory will be used as the newest commit for the project. +# +# For convenience, the function may use the "git_archive" function which +# does a standard "git archive" extraction using the (optional) "paths" +# variable to only extract a subset of the source tree. +######################################################################## + +######################################################################## +# Utility functions +######################################################################## +git_archive () { + git archive --worktree-attributes --prefix="$name-reduced/" HEAD -- $paths | \ + tar -C "$extractdir" -x +} + +disable_custom_gitattributes() { + pushd "${extractdir}/${name}-reduced" + # Git does not allow custom attributes in a subdirectory where we + # are about to merge the `.gitattributes` file, so disable them. + sed -i '/^\[attr\]/ {s/^/#/}' .gitattributes + popd +} + +die () { + echo >&2 "$@" + exit 1 +} + +warn () { + echo >&2 "warning: $@" +} + +readonly regex_date='20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]' +readonly basehash_regex="$name $regex_date ([0-9a-f]*)" +readonly basehash="$( git rev-list --author="$ownership" --grep="$basehash_regex" -n 1 HEAD )" +readonly upstream_old_short="$( git cat-file commit "$basehash" | sed -n '/'"$basehash_regex"'/ {s/.*(//;s/)//;p}' | egrep '^[0-9a-f]+$' )" + +######################################################################## +# Sanity checking +######################################################################## +[ -n "$name" ] || \ + die "'name' is empty" +[ -n "$ownership" ] || \ + die "'ownership' is empty" +[ -n "$subtree" ] || \ + die "'subtree' is empty" +[ -n "$repo" ] || \ + die "'repo' is empty" +[ -n "$tag" ] || \ + die "'tag' is empty" +[ -n "$basehash" ] || \ + warn "'basehash' is empty; performing initial import" +readonly do_shortlog="${shortlog-false}" + +readonly workdir="$PWD/work" +readonly upstreamdir="$workdir/upstream" +readonly extractdir="$workdir/extract" + +[ -d "$workdir" ] && \ + die "error: workdir '$workdir' already exists" + +trap "rm -rf '$workdir'" EXIT + +# Get upstream +git clone "$repo" "$upstreamdir" + +if [ -n "$basehash" ]; then + # Use the existing package's history + git worktree add "$extractdir" "$basehash" + # Clear out the working tree + pushd "$extractdir" + git ls-files | xargs rm -v + find . -type d -empty -delete + popd +else + # Create a repo to hold this package's history + mkdir -p "$extractdir" + git -C "$extractdir" init +fi + +# Extract the subset of upstream we care about +pushd "$upstreamdir" +git checkout "$tag" +readonly upstream_hash="$( git rev-parse HEAD )" +readonly upstream_hash_short="$( git rev-parse --short=8 "$upstream_hash" )" +readonly upstream_datetime="$( git rev-list "$upstream_hash" --format='%ci' -n 1 | grep -e "^$regex_date" )" +readonly upstream_date="$( echo "$upstream_datetime" | grep -o -e "$regex_date" )" +if $do_shortlog && [ -n "$basehash" ]; then + readonly commit_shortlog=" + +Upstream Shortlog +----------------- + +$( git shortlog --no-merges --abbrev=8 --format='%h %s' "$upstream_old_short".."$upstream_hash" )" +else + readonly commit_shortlog="" +fi +extract_source || \ + die "failed to extract source" +popd + +[ -d "$extractdir/$name-reduced" ] || \ + die "expected directory to extract does not exist" +readonly commit_summary="$name $upstream_date ($upstream_hash_short)" + +# Commit the subset +pushd "$extractdir" +mv -v "$name-reduced/"* . +rmdir "$name-reduced/" +git add -A . +git commit -n --author="$ownership" --date="$upstream_datetime" -F - <<-EOF +$commit_summary + +Code extracted from: + + $repo + +at commit $upstream_hash ($tag).$commit_shortlog +EOF +git branch -f "upstream-$name" +popd + +# Merge the subset into this repository +if [ -n "$basehash" ]; then + git merge --log -s recursive "-Xsubtree=$subtree/" --no-commit "upstream-$name" +else + # Note: on Windows 'git merge' will open a browser, and the check will fail, + # so use the flag by default. + unrelated_histories_flag="" + if git --version | grep -q windows; then + unrelated_histories_flag="--allow-unrelated-histories " + elif git merge --help | grep -q -e allow-unrelated-histories; then + unrelated_histories_flag="--allow-unrelated-histories " + fi + readonly unrelated_histories_flag + + git fetch "$extractdir" "+upstream-$name:upstream-$name" + git merge --log -s ours --no-commit $unrelated_histories_flag "upstream-$name" + git read-tree -u --prefix="$subtree/" "upstream-$name" +fi +git commit --no-edit +git branch -d "upstream-$name" diff --git a/vtkm/worklet/CMakeLists.txt b/vtkm/worklet/CMakeLists.txt index 4a70203bf..e442d55b3 100644 --- a/vtkm/worklet/CMakeLists.txt +++ b/vtkm/worklet/CMakeLists.txt @@ -25,11 +25,13 @@ set(headers Clip.h ContourTreeUniform.h CosmoTools.h + CrossProduct.h DispatcherMapField.h DispatcherMapTopology.h DispatcherPointNeighborhood.h DispatcherReduceByKey.h DispatcherStreamingMapField.h + DotProduct.h ExternalFaces.h ExtractGeometry.h ExtractPoints.h diff --git a/vtkm/worklet/Clip.h b/vtkm/worklet/Clip.h index d43a7531f..025abcf7b 100644 --- a/vtkm/worklet/Clip.h +++ b/vtkm/worklet/Clip.h @@ -33,7 +33,6 @@ #include #include -#include #include #if defined(THRUST_MAJOR_VERSION) && THRUST_MAJOR_VERSION == 1 && THRUST_MINOR_VERSION == 8 && \ diff --git a/vtkm/worklet/CrossProduct.h b/vtkm/worklet/CrossProduct.h new file mode 100644 index 000000000..e0406b3e8 --- /dev/null +++ b/vtkm/worklet/CrossProduct.h @@ -0,0 +1,49 @@ +//============================================================================ +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2014 UT-Battelle, LLC. +// Copyright 2014 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +//============================================================================ +#ifndef vtk_m_worklet_CrossProduct_h +#define vtk_m_worklet_CrossProduct_h + +#include + +#include + +namespace vtkm +{ +namespace worklet +{ + +class CrossProduct : public vtkm::worklet::WorkletMapField +{ +public: + typedef void ControlSignature(FieldIn, FieldIn, FieldOut); + typedef void ExecutionSignature(_1, _2, _3); + + template + VTKM_EXEC void operator()(const vtkm::Vec& vec1, + const vtkm::Vec& vec2, + vtkm::Vec& outVec) const + { + outVec = vtkm::Cross(vec1, vec2); + } +}; +} +} // namespace vtkm::worklet + +#endif // vtk_m_worklet_CrossProduct_h diff --git a/vtkm/worklet/DotProduct.h b/vtkm/worklet/DotProduct.h new file mode 100644 index 000000000..829ea80b0 --- /dev/null +++ b/vtkm/worklet/DotProduct.h @@ -0,0 +1,49 @@ +//============================================================================ +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2014 UT-Battelle, LLC. +// Copyright 2014 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +//============================================================================ +#ifndef vtk_m_worklet_DotProduct_h +#define vtk_m_worklet_DotProduct_h + +#include + +#include + +namespace vtkm +{ +namespace worklet +{ + +class DotProduct : public vtkm::worklet::WorkletMapField +{ +public: + typedef void ControlSignature(FieldIn, FieldIn, FieldOut); + typedef void ExecutionSignature(_1, _2, _3); + + template + VTKM_EXEC void operator()(const vtkm::Vec& v1, + const vtkm::Vec& v2, + T& outValue) const + { + outValue = vtkm::dot(v1, v2); + } +}; +} +} // namespace vtkm::worklet + +#endif // vtk_m_worklet_Normalize_h diff --git a/vtkm/worklet/ExternalFaces.h b/vtkm/worklet/ExternalFaces.h index 0234288e7..05b8cf81d 100644 --- a/vtkm/worklet/ExternalFaces.h +++ b/vtkm/worklet/ExternalFaces.h @@ -789,23 +789,17 @@ public: { vtkm::Vec MinPoint; vtkm::Vec MaxPoint; - vtkm::exec::ConnectivityStructured - Conn; - Conn = inCellSet.PrepareForInput( - DeviceAdapter(), vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell()); + vtkm::Id3 PointDimensions = inCellSet.GetPointDimensions(); - vtkm::Id3 PointDimensions = Conn.GetPointDimensions(); typedef vtkm::cont::ArrayHandle DefaultHandle; typedef vtkm::cont::ArrayHandleCartesianProduct CartesianArrayHandle; - if (coord.GetData().IsSameType(CartesianArrayHandle())) + auto coordData = coord.GetData(); + if (coordData.IsSameType()) { - CartesianArrayHandle vertices; - vertices = coord.GetData().Cast(); + auto vertices = coordData.Cast(); MinPoint[0] = static_cast(vertices.GetPortalConstControl().GetFirstPortal().Get(0)); @@ -823,12 +817,8 @@ public: } else { - vtkm::cont::ArrayHandleUniformPointCoordinates vertices; - vertices = coord.GetData().Cast(); - typedef typename vtkm::cont::ArrayHandleUniformPointCoordinates UniformArrayHandle; - typedef - typename UniformArrayHandle::ExecutionTypes::PortalConst UniformConstPortal; - UniformConstPortal Coordinates = vertices.PrepareForInput(DeviceAdapter()); + auto vertices = coordData.Cast(); + auto Coordinates = vertices.GetPortalConstControl(); MinPoint = Coordinates.GetOrigin(); vtkm::Vec spacing = Coordinates.GetSpacing(); @@ -842,10 +832,10 @@ public: // Create a worklet to count the number of external faces on each cell vtkm::cont::ArrayHandle numExternalFaces; - vtkm::worklet::DispatcherMapTopology + vtkm::worklet::DispatcherMapTopology numExternalFacesDispatcher((NumExternalFacesPerStructuredCell(MinPoint, MaxPoint))); - numExternalFacesDispatcher.Invoke(inCellSet, numExternalFaces, coord.GetData()); + numExternalFacesDispatcher.Invoke(inCellSet, numExternalFaces, coordData); typedef typename vtkm::cont::DeviceAdapterAlgorithm DeviceAlgorithms; vtkm::Id numberOfExternalFaces = DeviceAlgorithms::Reduce(numExternalFaces, 0, vtkm::Sum()); @@ -865,7 +855,7 @@ public: // information to. faceConnectivity.Allocate(connectivitySize); - vtkm::worklet::DispatcherMapTopology + vtkm::worklet::DispatcherMapTopology buildConnectivityStructuredDispatcher( (BuildConnectivityStructured(MinPoint, MaxPoint, scatterCellToExternalFace))); @@ -875,7 +865,7 @@ public: faceShapes, facePointCount, vtkm::cont::make_ArrayHandleGroupVec<4>(faceConnectivity), - coord.GetData()); + coordData); outCellSet.Fill(inCellSet.GetNumberOfPoints(), faceShapes, facePointCount, faceConnectivity); } @@ -901,7 +891,7 @@ public: //Create a worklet to map the number of faces to each cell vtkm::cont::ArrayHandle facesPerCell; - vtkm::worklet::DispatcherMapTopology numFacesDispatcher; + vtkm::worklet::DispatcherMapTopology numFacesDispatcher; numFacesDispatcher.Invoke(inCellSet, facesPerCell); @@ -917,7 +907,7 @@ public: if (this->PassPolyData) { vtkm::cont::ArrayHandle isPolyDataCell; - vtkm::worklet::DispatcherMapTopology isPolyDataCellDispatcher; + vtkm::worklet::DispatcherMapTopology isPolyDataCellDispatcher; isPolyDataCellDispatcher.Invoke(inCellSet, isPolyDataCell); diff --git a/vtkm/worklet/ExtractStructured.h b/vtkm/worklet/ExtractStructured.h index 4ca023ddd..2ecffa296 100644 --- a/vtkm/worklet/ExtractStructured.h +++ b/vtkm/worklet/ExtractStructured.h @@ -358,7 +358,7 @@ public: } private: - template + template class CoordinatesMapper { private: @@ -372,7 +372,8 @@ private: vtkm::cont::ArrayHandle>::Superclass; public: - CoordinatesMapper(const ExtractStructured* worklet, DynamicCoordinates& result) + CoordinatesMapper(const ExtractStructured* worklet, + vtkm::cont::ArrayHandleVirtualCoordinates& result) : Worklet(worklet) , Result(&result) { @@ -394,7 +395,8 @@ private: inOrigin[2] + static_cast(this->Worklet->VOI.Z.Min) * inSpacing[2]); CoordType outSpacing = inSpacing * static_cast(this->Worklet->SampleRate); - *this->Result = CoordsArray(this->Worklet->OutputDimensions, outOrigin, outSpacing); + auto out = CoordsArray(this->Worklet->OutputDimensions, outOrigin, outSpacing); + *this->Result = vtkm::cont::ArrayHandleVirtualCoordinates(out); } template @@ -419,13 +421,15 @@ private: dim += RectilinearCoordsCopy(coords.GetStorage().GetThirdArray(), *validIds[dim], zs); VTKM_ASSERT(dim == this->Worklet->InputDimensionality); - *this->Result = vtkm::cont::make_ArrayHandleCartesianProduct(xs, ys, zs); + auto out = vtkm::cont::make_ArrayHandleCartesianProduct(xs, ys, zs); + *this->Result = vtkm::cont::ArrayHandleVirtualCoordinates(out); } template void operator()(const vtkm::cont::ArrayHandle, Storage>& coords) const { - *this->Result = this->Worklet->ProcessPointField(coords, DeviceAdapter()); + auto out = this->Worklet->ProcessPointField(coords, DeviceAdapter()); + *this->Result = vtkm::cont::ArrayHandleVirtualCoordinates(out); } private: @@ -448,15 +452,17 @@ private: } const ExtractStructured* Worklet; - DynamicCoordinates* Result; + vtkm::cont::ArrayHandleVirtualCoordinates* Result; }; public: - template - DynamicCoordinates MapCoordinates(const DynamicCoordinates& coordinates, DeviceAdapter) + template + vtkm::cont::ArrayHandleVirtualCoordinates MapCoordinates( + const vtkm::cont::CoordinateSystem& coordinates, + DeviceAdapter) { - DynamicCoordinates result; - CoordinatesMapper mapper(this, result); + vtkm::cont::ArrayHandleVirtualCoordinates result; + CoordinatesMapper mapper(this, result); vtkm::cont::CastAndCall(coordinates, mapper); return result; } diff --git a/vtkm/worklet/KernelSplatter.h b/vtkm/worklet/KernelSplatter.h index 2bfb2d98f..f8ab96e00 100644 --- a/vtkm/worklet/KernelSplatter.h +++ b/vtkm/worklet/KernelSplatter.h @@ -22,8 +22,6 @@ #include -#include - #include #include #include @@ -363,16 +361,16 @@ struct KernelSplatterFilterUniformGrid class UpdateVoxelSplats : public vtkm::worklet::WorkletMapField { public: - typedef void ControlSignature(FieldIn<>, FieldIn<>, ExecObject); + typedef void ControlSignature(FieldIn<>, FieldIn<>, WholeArrayOut); typedef void ExecutionSignature(_1, _2, _3); VTKM_CONT UpdateVoxelSplats() {} - VTKM_EXEC_CONT - void operator()(const vtkm::Id& voxelIndex, - const vtkm::Float64& splatValue, - vtkm::exec::ExecutionWholeArray& execArg) const + template + VTKM_EXEC_CONT void operator()(const vtkm::Id& voxelIndex, + const vtkm::Float64& splatValue, + ExecArgPortalType& execArg) const { execArg.Set(voxelIndex, static_cast(splatValue)); } @@ -594,9 +592,7 @@ struct KernelSplatterFilterUniformGrid vtkm::worklet::DispatcherMapField scatterDispatcher; START_TIMER_BLOCK(UpdateVoxelSplats) - scatterDispatcher.Invoke(uniqueVoxelIds, - voxelSplatSums, - vtkm::exec::ExecutionWholeArray(scalarSplatOutput)); + scatterDispatcher.Invoke(uniqueVoxelIds, voxelSplatSums, scalarSplatOutput); END_TIMER_BLOCK(UpdateVoxelSplats) debug::OutputArrayDebug(scalarSplatOutput, "scalarSplatOutput"); // diff --git a/vtkm/worklet/Keys.h b/vtkm/worklet/Keys.h index c96a9f82d..7fcfe5343 100644 --- a/vtkm/worklet/Keys.h +++ b/vtkm/worklet/Keys.h @@ -79,7 +79,7 @@ public: }; VTKM_CONT - Keys() {} + Keys() = default; /// \b Construct a Keys class from an array of keys. /// diff --git a/vtkm/worklet/Magnitude.h b/vtkm/worklet/Magnitude.h index 4b4c5c0ee..e63b75b5d 100644 --- a/vtkm/worklet/Magnitude.h +++ b/vtkm/worklet/Magnitude.h @@ -38,7 +38,7 @@ public: template VTKM_EXEC void operator()(const T& inValue, T2& outValue) const { - outValue = vtkm::Magnitude(inValue); + outValue = static_cast(vtkm::Magnitude(inValue)); } }; } diff --git a/vtkm/worklet/MarchingCubes.h b/vtkm/worklet/MarchingCubes.h index 02d056775..a41411a84 100644 --- a/vtkm/worklet/MarchingCubes.h +++ b/vtkm/worklet/MarchingCubes.h @@ -379,7 +379,8 @@ public: OutFieldType& result) const { //fetch the low / high values from inPortal - result = vtkm::Lerp(inPortal.Get(low_high[0]), inPortal.Get(low_high[1]), weight); + result = static_cast( + vtkm::Lerp(inPortal.Get(low_high[0]), inPortal.Get(low_high[1]), weight)); } }; diff --git a/vtkm/worklet/StreamLineUniformGrid.h b/vtkm/worklet/StreamLineUniformGrid.h index ad8a7f4fc..17f75eff4 100644 --- a/vtkm/worklet/StreamLineUniformGrid.h +++ b/vtkm/worklet/StreamLineUniformGrid.h @@ -33,8 +33,6 @@ #include #include -#include - namespace vtkm { @@ -166,9 +164,9 @@ public: public: typedef void ControlSignature(FieldIn seedId, FieldIn<> position, - ExecObject numIndices, - ExecObject validPoint, - ExecObject streamLines); + WholeArrayOut numIndices, + WholeArrayOut validPoint, + WholeArrayOut streamLines); typedef void ExecutionSignature(_1, _2, _3, _4, _5, VisitIndex); typedef _1 InputDomain; @@ -200,13 +198,13 @@ public: { } - VTKM_EXEC - void operator()(vtkm::Id& seedId, - vtkm::Vec& seedPos, - vtkm::exec::ExecutionWholeArray& numIndices, - vtkm::exec::ExecutionWholeArray& validPoint, - vtkm::exec::ExecutionWholeArray>& slLists, - vtkm::IdComponent visitIndex) const + template + VTKM_EXEC void operator()(vtkm::Id& seedId, + vtkm::Vec& seedPos, + IdComponentPortalType& numIndices, + IdComponentPortalType& validPoint, + FieldVec3PortalType& slLists, + vtkm::IdComponent visitIndex) const { // Set initial offset into the output streams array vtkm::Vec pos = seedPos; @@ -403,11 +401,7 @@ public: typedef typename vtkm::worklet::DispatcherMapField MakeStreamLinesDispatcher; MakeStreamLinesDispatcher makeStreamLinesDispatcher(makeStreamLines); makeStreamLinesDispatcher.Invoke( - seedIdArray, - seedPosArray, - vtkm::exec::ExecutionWholeArray(numIndices, numCells), - vtkm::exec::ExecutionWholeArray(validPoint, maxConnectivityLen), - vtkm::exec::ExecutionWholeArray>(streamArray, maxConnectivityLen)); + seedIdArray, seedPosArray, numIndices, validPoint, streamArray); // Size of connectivity based on size of returned streamlines vtkm::cont::ArrayHandle numIndicesOut; diff --git a/vtkm/worklet/VertexClustering.h b/vtkm/worklet/VertexClustering.h index 92d11711a..ac23b75d2 100644 --- a/vtkm/worklet/VertexClustering.h +++ b/vtkm/worklet/VertexClustering.h @@ -522,9 +522,7 @@ public: /// output vtkm::cont::DataSet output; - - output.AddCoordinateSystem( - vtkm::cont::CoordinateSystem("coordinates", vtkm::cont::DynamicArrayHandle(repPointArray))); + output.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", repPointArray)); vtkm::cont::CellSetSingleType<> triangles("cells"); triangles.Fill(repPointArray.GetNumberOfValues(), diff --git a/vtkm/worklet/contourtree/ActiveEdgeTransferrer.h b/vtkm/worklet/contourtree/ActiveEdgeTransferrer.h index ff5d3e026..0a211a092 100644 --- a/vtkm/worklet/contourtree/ActiveEdgeTransferrer.h +++ b/vtkm/worklet/contourtree/ActiveEdgeTransferrer.h @@ -84,7 +84,6 @@ #ifndef vtk_m_worklet_contourtree_active_edge_transferrer_h #define vtk_m_worklet_contourtree_active_edge_transferrer_h -#include #include namespace vtkm diff --git a/vtkm/worklet/contourtree/ChainDoubler.h b/vtkm/worklet/contourtree/ChainDoubler.h index 3d51c1a4e..741cb64d1 100644 --- a/vtkm/worklet/contourtree/ChainDoubler.h +++ b/vtkm/worklet/contourtree/ChainDoubler.h @@ -83,7 +83,6 @@ #ifndef vtkm_worklet_contourtree_chain_doubler_h #define vtkm_worklet_contourtree_chain_doubler_h -#include #include namespace vtkm diff --git a/vtkm/worklet/contourtree/CopyJoinSplit.h b/vtkm/worklet/contourtree/CopyJoinSplit.h index 89bafe209..b088a61fa 100644 --- a/vtkm/worklet/contourtree/CopyJoinSplit.h +++ b/vtkm/worklet/contourtree/CopyJoinSplit.h @@ -67,7 +67,6 @@ #ifndef vtkm_worklet_contourtree_copy_join_split_h #define vtkm_worklet_contourtree_copy_join_split_h -#include #include #include diff --git a/vtkm/worklet/contourtree/CopyNeighbors.h b/vtkm/worklet/contourtree/CopyNeighbors.h index 14d94c5a0..44ac688cf 100644 --- a/vtkm/worklet/contourtree/CopyNeighbors.h +++ b/vtkm/worklet/contourtree/CopyNeighbors.h @@ -67,7 +67,6 @@ #ifndef vtkm_worklet_contourtree_copy_neighbors_h #define vtkm_worklet_contourtree_copy_neighbors_h -#include #include #include diff --git a/vtkm/worklet/contourtree/CopySupernodes.h b/vtkm/worklet/contourtree/CopySupernodes.h index 27bfd0077..c0e6376a1 100644 --- a/vtkm/worklet/contourtree/CopySupernodes.h +++ b/vtkm/worklet/contourtree/CopySupernodes.h @@ -67,7 +67,6 @@ #ifndef vtkm_worklet_contourtree_copy_supernodes_h #define vtkm_worklet_contourtree_copy_supernodes_h -#include #include namespace vtkm diff --git a/vtkm/worklet/contourtree/DegreeDelta.h b/vtkm/worklet/contourtree/DegreeDelta.h index dec5739b9..d6382224a 100644 --- a/vtkm/worklet/contourtree/DegreeDelta.h +++ b/vtkm/worklet/contourtree/DegreeDelta.h @@ -67,7 +67,6 @@ #ifndef vtkm_worklet_contourtree_degree_delta_h #define vtkm_worklet_contourtree_degree_delta_h -#include #include namespace vtkm diff --git a/vtkm/worklet/contourtree/DegreeSubrangeOffset.h b/vtkm/worklet/contourtree/DegreeSubrangeOffset.h index 57cc8c076..46244ea57 100644 --- a/vtkm/worklet/contourtree/DegreeSubrangeOffset.h +++ b/vtkm/worklet/contourtree/DegreeSubrangeOffset.h @@ -67,7 +67,6 @@ #ifndef vtkm_worklet_contourtree_degree_subrange_offset_h #define vtkm_worklet_contourtree_degree_subrange_offset_h -#include #include #include diff --git a/vtkm/worklet/contourtree/FillSupernodes.h b/vtkm/worklet/contourtree/FillSupernodes.h index cad5479d8..dc6cc6947 100644 --- a/vtkm/worklet/contourtree/FillSupernodes.h +++ b/vtkm/worklet/contourtree/FillSupernodes.h @@ -67,7 +67,6 @@ #ifndef vtkm_worklet_contourtree_fill_supernodes_h #define vtkm_worklet_contourtree_fill_supernodes_h -#include #include namespace vtkm diff --git a/vtkm/worklet/contourtree/FindLeaves.h b/vtkm/worklet/contourtree/FindLeaves.h index c5472959a..b86d12c8c 100644 --- a/vtkm/worklet/contourtree/FindLeaves.h +++ b/vtkm/worklet/contourtree/FindLeaves.h @@ -67,7 +67,6 @@ #ifndef vtkm_worklet_contourtree_find_leaves_h #define vtkm_worklet_contourtree_find_leaves_h -#include #include #include diff --git a/vtkm/worklet/contourtree/GoverningSaddleFinder.h b/vtkm/worklet/contourtree/GoverningSaddleFinder.h index 760e54397..6226b76ea 100644 --- a/vtkm/worklet/contourtree/GoverningSaddleFinder.h +++ b/vtkm/worklet/contourtree/GoverningSaddleFinder.h @@ -83,7 +83,6 @@ #ifndef vtkm_worklet_contourtree_governing_saddle_finder_h #define vtkm_worklet_contourtree_governing_saddle_finder_h -#include #include namespace vtkm diff --git a/vtkm/worklet/contourtree/JoinArcConnector.h b/vtkm/worklet/contourtree/JoinArcConnector.h index 73a3d2751..e8582fe1c 100644 --- a/vtkm/worklet/contourtree/JoinArcConnector.h +++ b/vtkm/worklet/contourtree/JoinArcConnector.h @@ -83,7 +83,6 @@ #ifndef vtkm_worklet_contourtree_join_arc_connector_h #define vtkm_worklet_contourtree_join_arc_connector_h -#include #include namespace vtkm diff --git a/vtkm/worklet/contourtree/JoinSuperArcFinder.h b/vtkm/worklet/contourtree/JoinSuperArcFinder.h index e9be9d990..5f14f7ef9 100644 --- a/vtkm/worklet/contourtree/JoinSuperArcFinder.h +++ b/vtkm/worklet/contourtree/JoinSuperArcFinder.h @@ -89,7 +89,6 @@ #include "vtkm/worklet/contourtree/Types.h" #include "vtkm/worklet/contourtree/VertexValueComparator.h" -#include #include namespace vtkm diff --git a/vtkm/worklet/contourtree/JoinTreeTransferrer.h b/vtkm/worklet/contourtree/JoinTreeTransferrer.h index 4c4878c3e..4e51856f8 100644 --- a/vtkm/worklet/contourtree/JoinTreeTransferrer.h +++ b/vtkm/worklet/contourtree/JoinTreeTransferrer.h @@ -84,7 +84,6 @@ #ifndef vtkm_worklet_contourtree_join_tree_transferrer_h #define vtkm_worklet_contourtree_join_tree_transferrer_h -#include #include #include diff --git a/vtkm/worklet/contourtree/Mesh2D_DEM_SaddleStarter.h b/vtkm/worklet/contourtree/Mesh2D_DEM_SaddleStarter.h index d1b8457d2..f2931b94b 100644 --- a/vtkm/worklet/contourtree/Mesh2D_DEM_SaddleStarter.h +++ b/vtkm/worklet/contourtree/Mesh2D_DEM_SaddleStarter.h @@ -83,7 +83,6 @@ #ifndef vtkm_worklet_contourtree_mesh2d_dem_saddle_starter_h #define vtkm_worklet_contourtree_mesh2d_dem_saddle_starter_h -#include #include #include diff --git a/vtkm/worklet/contourtree/Mesh2D_DEM_VertexOutdegreeStarter.h b/vtkm/worklet/contourtree/Mesh2D_DEM_VertexOutdegreeStarter.h index 1853946bd..87bb6c874 100644 --- a/vtkm/worklet/contourtree/Mesh2D_DEM_VertexOutdegreeStarter.h +++ b/vtkm/worklet/contourtree/Mesh2D_DEM_VertexOutdegreeStarter.h @@ -83,7 +83,6 @@ #ifndef vtkm_worklet_contourtree_mesh2d_dem_vertex_outdegree_starter_h #define vtkm_worklet_contourtree_mesh2d_dem_vertex_outdegree_starter_h -#include #include #include diff --git a/vtkm/worklet/contourtree/Mesh2D_DEM_VertexStarter.h b/vtkm/worklet/contourtree/Mesh2D_DEM_VertexStarter.h index 88e4aa8cf..678a630be 100644 --- a/vtkm/worklet/contourtree/Mesh2D_DEM_VertexStarter.h +++ b/vtkm/worklet/contourtree/Mesh2D_DEM_VertexStarter.h @@ -83,7 +83,6 @@ #ifndef vtkm_worklet_contourtree_mesh2d_dem_vertex_starter_h #define vtkm_worklet_contourtree_mesh2d_dem_vertex_starter_h -#include #include #include #include diff --git a/vtkm/worklet/contourtree/Mesh3D_DEM_SaddleStarter.h b/vtkm/worklet/contourtree/Mesh3D_DEM_SaddleStarter.h index a0ee4dbd1..46365560f 100644 --- a/vtkm/worklet/contourtree/Mesh3D_DEM_SaddleStarter.h +++ b/vtkm/worklet/contourtree/Mesh3D_DEM_SaddleStarter.h @@ -83,7 +83,6 @@ #ifndef vtkm_worklet_contourtree_mesh3d_dem_saddle_starter_h #define vtkm_worklet_contourtree_mesh3d_dem_saddle_starter_h -#include #include #include #include diff --git a/vtkm/worklet/contourtree/Mesh3D_DEM_VertexOutdegreeStarter.h b/vtkm/worklet/contourtree/Mesh3D_DEM_VertexOutdegreeStarter.h index 65f139339..c994279f1 100644 --- a/vtkm/worklet/contourtree/Mesh3D_DEM_VertexOutdegreeStarter.h +++ b/vtkm/worklet/contourtree/Mesh3D_DEM_VertexOutdegreeStarter.h @@ -83,7 +83,6 @@ #ifndef vtkm_worklet_contourtree_mesh3d_dem_vertex_outdegree_starter_h #define vtkm_worklet_contourtree_mesh3d_dem_vertex_outdegree_starter_h -#include #include #include #include diff --git a/vtkm/worklet/contourtree/Mesh3D_DEM_VertexStarter.h b/vtkm/worklet/contourtree/Mesh3D_DEM_VertexStarter.h index d254c07ac..93f22ef4a 100644 --- a/vtkm/worklet/contourtree/Mesh3D_DEM_VertexStarter.h +++ b/vtkm/worklet/contourtree/Mesh3D_DEM_VertexStarter.h @@ -84,7 +84,6 @@ #define vtkm_worklet_contourtree_mesh3d_dem_vertex_starter_h #include -#include #include #include #include diff --git a/vtkm/worklet/contourtree/RegularPointTransferrer.h b/vtkm/worklet/contourtree/RegularPointTransferrer.h index a357cbe8c..8038f1dbd 100644 --- a/vtkm/worklet/contourtree/RegularPointTransferrer.h +++ b/vtkm/worklet/contourtree/RegularPointTransferrer.h @@ -86,7 +86,6 @@ #include "vtkm/worklet/contourtree/Mesh2D_DEM_Triangulation_Macros.h" #include "vtkm/worklet/contourtree/Types.h" #include "vtkm/worklet/contourtree/VertexValueComparator.h" -#include #include namespace vtkm diff --git a/vtkm/worklet/contourtree/RegularToCandidate.h b/vtkm/worklet/contourtree/RegularToCandidate.h index dfbbb84d1..a389a79ff 100644 --- a/vtkm/worklet/contourtree/RegularToCandidate.h +++ b/vtkm/worklet/contourtree/RegularToCandidate.h @@ -68,7 +68,6 @@ #define vtkm_worklet_contourtree_regular_to_candidate_h #include "vtkm/worklet/contourtree/Types.h" -#include #include namespace vtkm diff --git a/vtkm/worklet/contourtree/RegularToCriticalDown.h b/vtkm/worklet/contourtree/RegularToCriticalDown.h index cfff438ac..1dd0c38e9 100644 --- a/vtkm/worklet/contourtree/RegularToCriticalDown.h +++ b/vtkm/worklet/contourtree/RegularToCriticalDown.h @@ -67,7 +67,6 @@ #ifndef vtkm_worklet_contourtree_regular_to_critical_down_h #define vtkm_worklet_contourtree_regular_to_critical_down_h -#include #include #include diff --git a/vtkm/worklet/contourtree/RegularToCriticalUp.h b/vtkm/worklet/contourtree/RegularToCriticalUp.h index 724d3d8d7..dce16af7c 100644 --- a/vtkm/worklet/contourtree/RegularToCriticalUp.h +++ b/vtkm/worklet/contourtree/RegularToCriticalUp.h @@ -67,7 +67,6 @@ #ifndef vtkm_worklet_contourtree_regular_to_critical_up_h #define vtkm_worklet_contourtree_regular_to_critical_up_h -#include #include namespace vtkm diff --git a/vtkm/worklet/contourtree/ResetDegrees.h b/vtkm/worklet/contourtree/ResetDegrees.h index 0fcdb841a..11f61b075 100644 --- a/vtkm/worklet/contourtree/ResetDegrees.h +++ b/vtkm/worklet/contourtree/ResetDegrees.h @@ -67,7 +67,6 @@ #ifndef vtkm_worklet_contourtree_reset_degrees_h #define vtkm_worklet_contourtree_reset_degrees_h -#include #include namespace vtkm diff --git a/vtkm/worklet/contourtree/SaddleAscentFunctor.h b/vtkm/worklet/contourtree/SaddleAscentFunctor.h index 130cc585a..60c46a8a0 100644 --- a/vtkm/worklet/contourtree/SaddleAscentFunctor.h +++ b/vtkm/worklet/contourtree/SaddleAscentFunctor.h @@ -80,7 +80,6 @@ #ifndef vtkm_worklet_contourtree_saddle_ascent_functor_h #define vtkm_worklet_contourtree_saddle_ascent_functor_h -#include #include #include diff --git a/vtkm/worklet/contourtree/SaddleAscentTransferrer.h b/vtkm/worklet/contourtree/SaddleAscentTransferrer.h index 2c56badde..8a5d9d1a2 100644 --- a/vtkm/worklet/contourtree/SaddleAscentTransferrer.h +++ b/vtkm/worklet/contourtree/SaddleAscentTransferrer.h @@ -80,7 +80,6 @@ #ifndef vtkm_worklet_contourtree_saddle_ascent_transferrer_h #define vtkm_worklet_contourtree_saddle_ascent_transferrer_h -#include #include namespace vtkm diff --git a/vtkm/worklet/contourtree/SetJoinAndSplitArcs.h b/vtkm/worklet/contourtree/SetJoinAndSplitArcs.h index 46f456e3d..fe61ef500 100644 --- a/vtkm/worklet/contourtree/SetJoinAndSplitArcs.h +++ b/vtkm/worklet/contourtree/SetJoinAndSplitArcs.h @@ -67,7 +67,6 @@ #ifndef vtkm_worklet_contourtree_set_join_and_split_arcs_h #define vtkm_worklet_contourtree_set_join_and_split_arcs_h -#include #include #include diff --git a/vtkm/worklet/contourtree/SetSupernodeInward.h b/vtkm/worklet/contourtree/SetSupernodeInward.h index 4964e24e0..8602372c2 100644 --- a/vtkm/worklet/contourtree/SetSupernodeInward.h +++ b/vtkm/worklet/contourtree/SetSupernodeInward.h @@ -67,7 +67,6 @@ #ifndef vtkm_worklet_contourtree_set_supernode_inward_h #define vtkm_worklet_contourtree_set_supernode_inward_h -#include #include #include diff --git a/vtkm/worklet/contourtree/SkipVertex.h b/vtkm/worklet/contourtree/SkipVertex.h index bf0d27a4f..d65b33d72 100644 --- a/vtkm/worklet/contourtree/SkipVertex.h +++ b/vtkm/worklet/contourtree/SkipVertex.h @@ -67,7 +67,6 @@ #ifndef vtkm_worklet_contourtree_skip_vertex_h #define vtkm_worklet_contourtree_skip_vertex_h -#include #include #include diff --git a/vtkm/worklet/contourtree/SubrangeOffset.h b/vtkm/worklet/contourtree/SubrangeOffset.h index 4702d2878..4b568bb94 100644 --- a/vtkm/worklet/contourtree/SubrangeOffset.h +++ b/vtkm/worklet/contourtree/SubrangeOffset.h @@ -67,7 +67,6 @@ #ifndef vtkm_worklet_contourtree_subrange_offset_h #define vtkm_worklet_contourtree_subrange_offset_h -#include #include namespace vtkm diff --git a/vtkm/worklet/contourtree/TrunkBuilder.h b/vtkm/worklet/contourtree/TrunkBuilder.h index 206dcb841..c6842c69b 100644 --- a/vtkm/worklet/contourtree/TrunkBuilder.h +++ b/vtkm/worklet/contourtree/TrunkBuilder.h @@ -84,7 +84,6 @@ #ifndef vtkm_worklet_contourtree_trunk_builder_h #define vtkm_worklet_contourtree_trunk_builder_h -#include #include #include diff --git a/vtkm/worklet/contourtree/UpdateOutbound.h b/vtkm/worklet/contourtree/UpdateOutbound.h index c5867c990..565e42959 100644 --- a/vtkm/worklet/contourtree/UpdateOutbound.h +++ b/vtkm/worklet/contourtree/UpdateOutbound.h @@ -67,7 +67,6 @@ #ifndef vtkm_worklet_contourtree_update_outbound_h #define vtkm_worklet_contourtree_update_outbound_h -#include #include #include diff --git a/vtkm/worklet/contourtree/VertexDegreeUpdater.h b/vtkm/worklet/contourtree/VertexDegreeUpdater.h index 60bb0457e..5bcd17de2 100644 --- a/vtkm/worklet/contourtree/VertexDegreeUpdater.h +++ b/vtkm/worklet/contourtree/VertexDegreeUpdater.h @@ -84,7 +84,6 @@ #ifndef vtkm_worklet_contourtree_vertex_degree_updater_h #define vtkm_worklet_contourtree_vertex_degree_updater_h -#include #include namespace vtkm diff --git a/vtkm/worklet/cosmotools/ComputeBinIndices.h b/vtkm/worklet/cosmotools/ComputeBinIndices.h index ecdc9c451..ef67de382 100644 --- a/vtkm/worklet/cosmotools/ComputeBinIndices.h +++ b/vtkm/worklet/cosmotools/ComputeBinIndices.h @@ -61,7 +61,6 @@ #ifndef vtkm_worklet_cosmotools_compute_bin_indices_h #define vtkm_worklet_cosmotools_compute_bin_indices_h -#include #include namespace vtkm diff --git a/vtkm/worklet/cosmotools/ComputeBinRange.h b/vtkm/worklet/cosmotools/ComputeBinRange.h index d46689667..e04367f2b 100644 --- a/vtkm/worklet/cosmotools/ComputeBinRange.h +++ b/vtkm/worklet/cosmotools/ComputeBinRange.h @@ -61,7 +61,6 @@ #ifndef vtkm_worklet_cosmotools_compute_bin_range_h #define vtkm_worklet_cosmotools_compute_bin_range_h -#include #include namespace vtkm diff --git a/vtkm/worklet/cosmotools/ComputeNeighborBins.h b/vtkm/worklet/cosmotools/ComputeNeighborBins.h index df7eefa27..f6679d4df 100644 --- a/vtkm/worklet/cosmotools/ComputeNeighborBins.h +++ b/vtkm/worklet/cosmotools/ComputeNeighborBins.h @@ -61,7 +61,6 @@ #ifndef vtkm_worklet_cosmotools_compute_neighbor_bins_h #define vtkm_worklet_cosmotools_compute_neighbor_bins_h -#include #include namespace vtkm diff --git a/vtkm/worklet/cosmotools/ComputePotential.h b/vtkm/worklet/cosmotools/ComputePotential.h index cfe697284..16dbf16d5 100644 --- a/vtkm/worklet/cosmotools/ComputePotential.h +++ b/vtkm/worklet/cosmotools/ComputePotential.h @@ -61,7 +61,6 @@ #ifndef vtkm_worklet_cosmotools_compute_potential_h #define vtkm_worklet_cosmotools_compute_potential_h -#include #include namespace vtkm diff --git a/vtkm/worklet/cosmotools/ComputePotentialBin.h b/vtkm/worklet/cosmotools/ComputePotentialBin.h index 3989d8ea4..428705bd0 100644 --- a/vtkm/worklet/cosmotools/ComputePotentialBin.h +++ b/vtkm/worklet/cosmotools/ComputePotentialBin.h @@ -61,7 +61,6 @@ #ifndef vtkm_worklet_cosmotools_compute_potential_bin_h #define vtkm_worklet_cosmotools_compute_potential_bin_h -#include #include namespace vtkm diff --git a/vtkm/worklet/cosmotools/ComputePotentialMxN.h b/vtkm/worklet/cosmotools/ComputePotentialMxN.h index d0dd06b86..185a25abf 100644 --- a/vtkm/worklet/cosmotools/ComputePotentialMxN.h +++ b/vtkm/worklet/cosmotools/ComputePotentialMxN.h @@ -61,7 +61,6 @@ #ifndef vtkm_worklet_cosmotools_compute_potential_mxn_h #define vtkm_worklet_cosmotools_compute_potential_mxn_h -#include #include namespace vtkm diff --git a/vtkm/worklet/cosmotools/ComputePotentialNeighbors.h b/vtkm/worklet/cosmotools/ComputePotentialNeighbors.h index e8ef02c82..ffeb75e9b 100644 --- a/vtkm/worklet/cosmotools/ComputePotentialNeighbors.h +++ b/vtkm/worklet/cosmotools/ComputePotentialNeighbors.h @@ -61,7 +61,6 @@ #ifndef vtkm_worklet_cosmotools_compute_potential_neighbors_h #define vtkm_worklet_cosmotools_compute_potential_neighbors_h -#include #include namespace vtkm diff --git a/vtkm/worklet/cosmotools/ComputePotentialNxN.h b/vtkm/worklet/cosmotools/ComputePotentialNxN.h index f07c7b36b..81b0350be 100644 --- a/vtkm/worklet/cosmotools/ComputePotentialNxN.h +++ b/vtkm/worklet/cosmotools/ComputePotentialNxN.h @@ -61,7 +61,6 @@ #ifndef vtkm_worklet_cosmotools_compute_potential_nxn_h #define vtkm_worklet_cosmotools_compute_potential_nxn_h -#include #include namespace vtkm diff --git a/vtkm/worklet/cosmotools/ComputePotentialOnCandidates.h b/vtkm/worklet/cosmotools/ComputePotentialOnCandidates.h index 537556dc0..c14930ae6 100644 --- a/vtkm/worklet/cosmotools/ComputePotentialOnCandidates.h +++ b/vtkm/worklet/cosmotools/ComputePotentialOnCandidates.h @@ -61,7 +61,6 @@ #ifndef vtkm_worklet_cosmotools_compute_potential_on_candidates_h #define vtkm_worklet_cosmotools_compute_potential_on_candidates_h -#include #include namespace vtkm diff --git a/vtkm/worklet/cosmotools/EqualsMinimumPotential.h b/vtkm/worklet/cosmotools/EqualsMinimumPotential.h index 934e36490..054ebf117 100644 --- a/vtkm/worklet/cosmotools/EqualsMinimumPotential.h +++ b/vtkm/worklet/cosmotools/EqualsMinimumPotential.h @@ -61,7 +61,6 @@ #ifndef vtkm_worklet_cosmotools_equals_minimum_potential_h #define vtkm_worklet_cosmotools_equals_minimum_potential_h -#include #include namespace vtkm diff --git a/vtkm/worklet/cosmotools/GraftParticles.h b/vtkm/worklet/cosmotools/GraftParticles.h index ee5d7d8fa..036ce1730 100644 --- a/vtkm/worklet/cosmotools/GraftParticles.h +++ b/vtkm/worklet/cosmotools/GraftParticles.h @@ -61,7 +61,6 @@ #ifndef vtkm_worklet_cosmotools_graft_particle_h #define vtkm_worklet_cosmotools_graft_particle_h -#include #include #include diff --git a/vtkm/worklet/cosmotools/IsStar.h b/vtkm/worklet/cosmotools/IsStar.h index e20f444a4..79673cb89 100644 --- a/vtkm/worklet/cosmotools/IsStar.h +++ b/vtkm/worklet/cosmotools/IsStar.h @@ -61,7 +61,6 @@ #ifndef vtkm_worklet_cosmotools_is_star_h #define vtkm_worklet_cosmotools_is_star_h -#include #include namespace vtkm diff --git a/vtkm/worklet/cosmotools/MarkActiveNeighbors.h b/vtkm/worklet/cosmotools/MarkActiveNeighbors.h index 27ca56901..83a15df43 100644 --- a/vtkm/worklet/cosmotools/MarkActiveNeighbors.h +++ b/vtkm/worklet/cosmotools/MarkActiveNeighbors.h @@ -61,7 +61,6 @@ #ifndef vtkm_worklet_cosmotools_mark_active_neighbors_h #define vtkm_worklet_cosmotools_mark_active_neighbors_h -#include #include #include diff --git a/vtkm/worklet/cosmotools/PointerJump.h b/vtkm/worklet/cosmotools/PointerJump.h index 83506f052..66b10920e 100644 --- a/vtkm/worklet/cosmotools/PointerJump.h +++ b/vtkm/worklet/cosmotools/PointerJump.h @@ -61,7 +61,6 @@ #ifndef vtkm_worklet_cosmotools_pointer_jump_h #define vtkm_worklet_cosmotools_pointer_jump_h -#include #include namespace vtkm diff --git a/vtkm/worklet/cosmotools/SetCandidateParticles.h b/vtkm/worklet/cosmotools/SetCandidateParticles.h index 17e007a4a..da575d165 100644 --- a/vtkm/worklet/cosmotools/SetCandidateParticles.h +++ b/vtkm/worklet/cosmotools/SetCandidateParticles.h @@ -61,7 +61,6 @@ #ifndef vtkm_worklet_cosmotools_set_candidate_particles_h #define vtkm_worklet_cosmotools_set_candidate_particles_h -#include #include namespace vtkm diff --git a/vtkm/worklet/cosmotools/ValidHalo.h b/vtkm/worklet/cosmotools/ValidHalo.h index 2190064aa..28f4686f0 100644 --- a/vtkm/worklet/cosmotools/ValidHalo.h +++ b/vtkm/worklet/cosmotools/ValidHalo.h @@ -61,7 +61,6 @@ #ifndef vtkm_worklet_cosmotools_valid_halo_h #define vtkm_worklet_cosmotools_valid_halo_h -#include #include namespace vtkm diff --git a/vtkm/worklet/internal/DispatcherBase.h b/vtkm/worklet/internal/DispatcherBase.h index 363909b16..7f5d239c4 100644 --- a/vtkm/worklet/internal/DispatcherBase.h +++ b/vtkm/worklet/internal/DispatcherBase.h @@ -76,12 +76,18 @@ inline void PrintFailureMessage(int index) throw vtkm::cont::ErrorBadType(message.str()); } -template -struct ParameterTypeCorrect; -template -struct ParameterTypeCorrect +template +struct ReportTypeOnError; +template +struct ReportTypeOnError : std::true_type +{ +}; + +template +struct ReportValueOnError; +template +struct ReportValueOnError : std::true_type { - static VTKM_CONSTEXPR bool value = true; }; // Is designed as a brigand fold operation. @@ -97,20 +103,52 @@ struct DetermineIfHasDynamicParameter // Is designed as a brigand fold operation. -template -struct DetermineHasInCorrectParameters +template +struct DetermineHasCorrectParameters { - //T is the type of the Param at the current index - //State if the index to use to fetch the control signature tag - using ControlSignatureTag = typename brigand::at_c; - using TypeCheckTag = typename ControlSignatureTag::TypeCheckTag; + template + struct Functor + { + //T is the type of the Param at the current index + //State if the index to use to fetch the control signature tag + using ControlSignatureTag = typename brigand::at_c; + using TypeCheckTag = typename ControlSignatureTag::TypeCheckTag; - using isCorrect = - ParameterTypeCorrect::value, TypeCheckTag, T>; - static_assert(isCorrect::value, - "The type check failed since the parameter passed in doesn't pass the TypeCheck"); + static VTKM_CONSTEXPR bool isCorrect = vtkm::cont::arg::TypeCheck::value; - using type = std::integral_constant; + // If you get an error on the line below, that means that your code has called the + // Invoke method on a dispatcher, and one of the arguments of the Invoke is the wrong + // type. Each argument of Invoke corresponds to a tag in the arguments of the + // ControlSignature of the worklet. If there is a mismatch, then you get an error here + // (instead of where you called the dispatcher). For example, if the worklet has a + // control signature as ControlSignature(CellSetIn, ...) and the first argument passed + // to Invoke is an ArrayHandle, you will get an error here because you cannot use an + // ArrayHandle in place of a CellSetIn argument. (You need to use a CellSet.) See a few + // lines later for some diagnostics to help you trace where the error occured. + VTKM_READ_THE_SOURCE_CODE_FOR_HELP(isCorrect); + + // If you are getting the error described above, the following lines will give you some + // diagnostics (in the form of compile errors). Each one will result in a compile error + // reporting an undefined type for ReportTypeOnError (or ReportValueOnError). What we are + // really reporting is the first template argument, which is one of the types or values that + // should help pinpoint where the error is. The comment for static_assert provides the + // type/value being reported. (Note that some compilers report better types than others. If + // your compiler is giving unhelpful types like "T" or "WorkletType", you may need to try a + // different compiler.) + static_assert(ReportTypeOnError::value, "Type passed to Invoke"); + static_assert(ReportTypeOnError::value, "Worklet being invoked."); + static_assert(ReportValueOnError::value, "Index of Invoke parameter"); + static_assert(ReportTypeOnError::value, "Type check tag used"); + + // This final static_assert gives a human-readable error message. Ideally, this would be + // placed first, but some compilers will suppress further errors when a static_assert + // fails, so you would not see the other diagnostic error messages. + static_assert(isCorrect, + "The type of one of the arguments to the dispatcher's Invoke method is " + "incompatible with the corresponding tag in the worklet's ControlSignature."); + + using type = std::integral_constant; + }; }; // Checks that an argument in a ControlSignature is a valid control signature @@ -389,20 +427,33 @@ private: typename WorkletType::ControlSignature>::Parameters; //isAllValid will throw a compile error if everything doesn't match - using isAllValid = - brigand::fold, - detail::DetermineHasInCorrectParameters>>; + using isAllValid = brigand::fold< + ParamTypes, + std::integral_constant, + typename detail::DetermineHasCorrectParameters:: + template Functor>>; //this warning exists so that we don't get a warning from not using isAllValid using expectedLen = std::integral_constant; static_assert(isAllValid::value == expectedLen::value, "All arguments failed the TypeCheck pass"); +#if defined __NVCC__ +// Disable warning "calling a __host__ function from a __host__ __device__" +// In some cases nv_exec_check_disable doesn't work and therefore you need +// to use the following suppressions +// This have been found by eigen: +// https://github.com/RLovelett/eigen/blame/master/Eigen/src/Core/util/DisableStupidWarnings.h +#pragma push +#pragma diag_suppress 2737 +#pragma diag_suppress 2739 +#endif auto fi = vtkm::internal::make_FunctionInterface::type...>(args...); +#if defined __NVCC__ +#pragma pop +#endif + auto ivc = vtkm::internal::Invocation struct _9 : Arg<9> { }; +struct _10 : Arg<10> +{ +}; +struct _11 : Arg<11> +{ +}; +struct _12 : Arg<12> +{ +}; +struct _13 : Arg<13> +{ +}; +struct _14 : Arg<14> +{ +}; +struct _15 : Arg<15> +{ +}; +struct _16 : Arg<16> +{ +}; +struct _17 : Arg<17> +{ +}; +struct _18 : Arg<18> +{ +}; +struct _19 : Arg<19> +{ +}; +struct _20 : Arg<20> +{ +}; } namespace worklet @@ -109,6 +142,17 @@ public: typedef vtkm::placeholders::_7 _7; typedef vtkm::placeholders::_8 _8; typedef vtkm::placeholders::_9 _9; + typedef vtkm::placeholders::_10 _10; + typedef vtkm::placeholders::_11 _11; + typedef vtkm::placeholders::_12 _12; + typedef vtkm::placeholders::_13 _13; + typedef vtkm::placeholders::_14 _14; + typedef vtkm::placeholders::_15 _15; + typedef vtkm::placeholders::_16 _16; + typedef vtkm::placeholders::_17 _17; + typedef vtkm::placeholders::_18 _18; + typedef vtkm::placeholders::_19 _19; + typedef vtkm::placeholders::_20 _20; /// \c ExecutionSignature tag for getting the work index. /// diff --git a/vtkm/worklet/particleadvection/GridEvaluators.h b/vtkm/worklet/particleadvection/GridEvaluators.h index a74b8286c..56fb0be19 100644 --- a/vtkm/worklet/particleadvection/GridEvaluators.h +++ b/vtkm/worklet/particleadvection/GridEvaluators.h @@ -146,7 +146,7 @@ public: typedef vtkm::cont::ArrayHandleUniformPointCoordinates UniformType; typedef vtkm::cont::CellSetStructured<3> StructuredType; - if (!coords.GetData().IsSameType(UniformType())) + if (!coords.GetData().IsSameType()) throw vtkm::cont::ErrorInternal("Coordinates are not uniform."); if (!cellSet.IsSameType(StructuredType())) throw vtkm::cont::ErrorInternal("Cells are not 3D structured."); @@ -176,8 +176,8 @@ public: { typedef vtkm::cont::ArrayHandleUniformPointCoordinates UniformType; - vtkm::cont::DynamicArrayHandleCoordinateSystem coordArray = ds.GetCoordinateSystem().GetData(); - if (!coordArray.IsSameType(UniformType())) + auto coordArray = ds.GetCoordinateSystem().GetData(); + if (!coordArray.IsSameType()) throw vtkm::cont::ErrorInternal("Given dataset is was not uniform."); bounds = ds.GetCoordinateSystem(0).GetBounds(); @@ -321,7 +321,7 @@ public: { typedef vtkm::cont::CellSetStructured<3> StructuredType; - if (!coords.GetData().IsSameType(RectilinearType())) + if (!coords.GetData().IsSameType()) throw vtkm::cont::ErrorInternal("Coordinates are not rectilinear."); if (!cellSet.IsSameType(StructuredType())) throw vtkm::cont::ErrorInternal("Cells are not 3D structured."); @@ -351,9 +351,8 @@ public: dims = cells.GetSchedulingRange(vtkm::TopologyElementTagPoint()); planeSize = dims[0] * dims[1]; rowSize = dims[0]; - vtkm::cont::DynamicArrayHandleCoordinateSystem coordArray = - dataset.GetCoordinateSystem().GetData(); - if (coordArray.IsSameType(RectilinearType())) + auto coordArray = dataset.GetCoordinateSystem().GetData(); + if (coordArray.IsSameType()) { RectilinearType gridPoints = coordArray.Cast(); xAxis = gridPoints.GetPortalConstControl().GetFirstPortal(); diff --git a/vtkm/worklet/spatialstructure/KdTree3DNNSearch.h b/vtkm/worklet/spatialstructure/KdTree3DNNSearch.h index 9b5085d1a..e44be3d12 100644 --- a/vtkm/worklet/spatialstructure/KdTree3DNNSearch.h +++ b/vtkm/worklet/spatialstructure/KdTree3DNNSearch.h @@ -21,15 +21,13 @@ #ifndef vtk_m_worklet_KdTree3DNNSearch_h #define vtk_m_worklet_KdTree3DNNSearch_h +#include + #include #include #include #include -#include -#include -#include -#include -#include + #include #include #include @@ -53,7 +51,7 @@ public: WholeArrayIn<> treeSplitIdIn, WholeArrayIn<> treeCoordiIn, FieldOut<> nnIdOut, - FieldOut<> nnDisOut); + FieldInOut<> nnDisOut); typedef void ExecutionSignature(_1, _2, _3, _4, _5, _6); VTKM_CONT @@ -175,8 +173,6 @@ public: IdType& nnId, CoordiType& nnDis) const { - nnDis = std::numeric_limits::max(); - NearestNeighborSearch3D(qc, nnDis, nnId, @@ -207,13 +203,24 @@ public: const vtkm::cont::ArrayHandle, CoordStorageTag2>& qc_Handle, vtkm::cont::ArrayHandle& nnId_Handle, vtkm::cont::ArrayHandle& nnDis_Handle, - DeviceAdapter vtkmNotUsed(device)) + DeviceAdapter) { -#if VTKM_DEVICE_ADAPTER == VTKM_DEVICE_ADAPTER_CUDA - //set up stack size for cuda envinroment - size_t stackSizeBackup; - cudaDeviceGetLimit(&stackSizeBackup, cudaLimitStackSize); - cudaDeviceSetLimit(cudaLimitStackSize, 1024 * 16); + //fill the nnDis_Handle handle array with max values before running + auto intialValue = std::numeric_limits::max(); + vtkm::cont::DeviceAdapterAlgorithm::Copy( + vtkm::cont::make_ArrayHandleConstant(intialValue, qc_Handle.GetNumberOfValues()), + nnDis_Handle); + +//set up stack size for cuda environment +#ifdef VTKM_CUDA + using DeviceAdapterTraits = vtkm::cont::DeviceAdapterTraits; + std::size_t stackSizeBackup; + (void)stackSizeBackup; + if (DeviceAdapterTraits::GetId() == VTKM_DEVICE_ADAPTER_CUDA) + { + cudaDeviceGetLimit(&stackSizeBackup, cudaLimitStackSize); + cudaDeviceSetLimit(cudaLimitStackSize, 1024 * 16); + } #endif NearestNeighborSearch3DWorklet nns3dWorklet; @@ -221,8 +228,12 @@ public: nns3DDispatcher(nns3dWorklet); nns3DDispatcher.Invoke( qc_Handle, pointId_Handle, splitId_Handle, coordi_Handle, nnId_Handle, nnDis_Handle); -#if VTKM_DEVICE_ADAPTER == VTKM_DEVICE_ADAPTER_CUDA - cudaDeviceSetLimit(cudaLimitStackSize, stackSizeBackup); + +#ifdef VTKM_CUDA + if (DeviceAdapterTraits::GetId() == VTKM_DEVICE_ADAPTER_CUDA) + { + cudaDeviceSetLimit(cudaLimitStackSize, stackSizeBackup); + } #endif } }; diff --git a/vtkm/worklet/splatkernels/Gaussian.h b/vtkm/worklet/splatkernels/Gaussian.h index e5cdcfca5..e9639175c 100644 --- a/vtkm/worklet/splatkernels/Gaussian.h +++ b/vtkm/worklet/splatkernels/Gaussian.h @@ -58,6 +58,7 @@ struct Gaussian : public KernelBase> //--------------------------------------------------------------------- // return the multiplier between smoothing length and max cutoff distance + VTKM_EXEC_CONT VTKM_CONSTEXPR double getDilationFactor() const { return 5.0; } //--------------------------------------------------------------------- diff --git a/vtkm/worklet/splatkernels/Spline3rdOrder.h b/vtkm/worklet/splatkernels/Spline3rdOrder.h index e0990fd98..fdf5f9a6b 100644 --- a/vtkm/worklet/splatkernels/Spline3rdOrder.h +++ b/vtkm/worklet/splatkernels/Spline3rdOrder.h @@ -39,13 +39,13 @@ struct default_norm_value; template <> struct default_norm_value<2> { - double value() const { return 10.0 / (7.0 * M_PI); } + const double value = 10.0 / (7.0 * M_PI); }; template <> struct default_norm_value<3> { - double value() const { return 1.0 / M_PI; } + const double value = 1.0 / M_PI; }; @@ -65,7 +65,7 @@ struct Spline3rdOrder : public KernelBase> maxRadius_ = 2.0 * smoothingLength; maxRadius2_ = maxRadius_ * maxRadius_; // - norm_ = default_norm_value().value(); + norm_ = default_norm_value().value; scale_W_ = norm_ * PowerExpansion(Hinverse_); scale_GradW_ = norm_ * PowerExpansion(Hinverse_); diff --git a/vtkm/worklet/testing/CMakeLists.txt b/vtkm/worklet/testing/CMakeLists.txt index c88e7a7f2..2d1853a25 100644 --- a/vtkm/worklet/testing/CMakeLists.txt +++ b/vtkm/worklet/testing/CMakeLists.txt @@ -26,6 +26,8 @@ set(unit_tests UnitTestClipping.cxx UnitTestContourTreeUniform.cxx UnitTestCosmoTools.cxx + UnitTestCrossProduct.cxx + UnitTestDotProduct.cxx UnitTestExternalFaces.cxx UnitTestExtractGeometry.cxx UnitTestExtractPoints.cxx diff --git a/vtkm/worklet/testing/UnitTestClipping.cxx b/vtkm/worklet/testing/UnitTestClipping.cxx index 993442131..7e928bd5a 100644 --- a/vtkm/worklet/testing/UnitTestClipping.cxx +++ b/vtkm/worklet/testing/UnitTestClipping.cxx @@ -132,8 +132,7 @@ void TestClippingExplicit() vtkm::cont::CellSetExplicit<> outputCellSet = clip.Run(ds.GetCellSet(0), ds.GetField("scalars").GetData(), clipValue, DeviceAdapter()); - vtkm::cont::ArrayHandle coordsIn; - ds.GetCoordinateSystem("coords").GetData().CopyTo(coordsIn); + auto coordsIn = ds.GetCoordinateSystem("coords").GetData(); vtkm::cont::ArrayHandle coords = clip.ProcessPointField(coordsIn, DeviceAdapter()); vtkm::cont::ArrayHandle scalarsIn; @@ -188,8 +187,7 @@ void TestClippingStrucutred() vtkm::cont::CellSetExplicit<> outputCellSet = clip.Run(ds.GetCellSet(0), ds.GetField("scalars").GetData(), clipValue, DeviceAdapter()); - vtkm::cont::ArrayHandleUniformPointCoordinates coordsIn; - ds.GetCoordinateSystem("coords").GetData().CopyTo(coordsIn); + auto coordsIn = ds.GetCoordinateSystem("coords").GetData(); CoordsOutType coords = clip.ProcessPointField(coordsIn, DeviceAdapter()); vtkm::cont::ArrayHandle scalarsIn; @@ -253,8 +251,7 @@ void TestClippingWithImplicitFunction() ds.GetCoordinateSystem("coords"), DeviceAdapter()); - vtkm::cont::ArrayHandleUniformPointCoordinates coordsIn; - ds.GetCoordinateSystem("coords").GetData().CopyTo(coordsIn); + auto coordsIn = ds.GetCoordinateSystem("coords").GetData(); vtkm::cont::ArrayHandle coords = clip.ProcessPointField(coordsIn, DeviceAdapter()); vtkm::cont::ArrayHandle scalarsIn; diff --git a/vtkm/worklet/testing/UnitTestCrossProduct.cxx b/vtkm/worklet/testing/UnitTestCrossProduct.cxx new file mode 100644 index 000000000..694d1b7e0 --- /dev/null +++ b/vtkm/worklet/testing/UnitTestCrossProduct.cxx @@ -0,0 +1,130 @@ +//============================================================================ +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2014 UT-Battelle, LLC. +// Copyright 2014 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +//============================================================================ + +#include +#include + +#include +#include + +namespace +{ +std::mt19937 randGenerator; + +template +void createVectors(std::vector>& vecs1, std::vector>& vecs2) +{ + // First, test the standard directions. + // X x Y + vecs1.push_back(vtkm::make_Vec(1, 0, 0)); + vecs2.push_back(vtkm::make_Vec(0, 1, 0)); + + // Y x Z + vecs1.push_back(vtkm::make_Vec(0, 1, 0)); + vecs2.push_back(vtkm::make_Vec(0, 0, 1)); + + // Z x X + vecs1.push_back(vtkm::make_Vec(0, 0, 1)); + vecs2.push_back(vtkm::make_Vec(1, 0, 0)); + + // Y x X + vecs1.push_back(vtkm::make_Vec(0, 1, 0)); + vecs2.push_back(vtkm::make_Vec(1, 0, 0)); + + // Z x Y + vecs1.push_back(vtkm::make_Vec(0, 0, 1)); + vecs2.push_back(vtkm::make_Vec(0, 1, 0)); + + // X x Z + vecs1.push_back(vtkm::make_Vec(1, 0, 0)); + vecs2.push_back(vtkm::make_Vec(0, 0, 1)); + + //Test some other vector combinations + std::uniform_real_distribution randomDist(-10.0, 10.0); + randomDist(randGenerator); + + for (int i = 0; i < 100; i++) + { + vecs1.push_back(vtkm::make_Vec( + randomDist(randGenerator), randomDist(randGenerator), randomDist(randGenerator))); + vecs2.push_back(vtkm::make_Vec( + randomDist(randGenerator), randomDist(randGenerator), randomDist(randGenerator))); + } +} + +template +void TestCrossProduct() +{ + std::vector> inputVecs1, inputVecs2; + createVectors(inputVecs1, inputVecs2); + + vtkm::cont::ArrayHandle> inputArray1, inputArray2; + vtkm::cont::ArrayHandle> outputArray; + inputArray1 = vtkm::cont::make_ArrayHandle(inputVecs1); + inputArray2 = vtkm::cont::make_ArrayHandle(inputVecs2); + + vtkm::worklet::CrossProduct crossProductWorklet; + vtkm::worklet::DispatcherMapField dispatcherCrossProduct( + crossProductWorklet); + dispatcherCrossProduct.Invoke(inputArray1, inputArray2, outputArray); + + VTKM_TEST_ASSERT(outputArray.GetNumberOfValues() == inputArray1.GetNumberOfValues(), + "Wrong number of results for CrossProduct worklet"); + + //Test the cannonical cases. + VTKM_TEST_ASSERT( + test_equal(outputArray.GetPortalConstControl().Get(0), vtkm::make_Vec(0, 0, 1)) && + test_equal(outputArray.GetPortalConstControl().Get(1), vtkm::make_Vec(1, 0, 0)) && + test_equal(outputArray.GetPortalConstControl().Get(2), vtkm::make_Vec(0, 1, 0)) && + test_equal(outputArray.GetPortalConstControl().Get(3), vtkm::make_Vec(0, 0, -1)) && + test_equal(outputArray.GetPortalConstControl().Get(4), vtkm::make_Vec(-1, 0, 0)) && + test_equal(outputArray.GetPortalConstControl().Get(5), vtkm::make_Vec(0, -1, 0)), + "Wrong result for CrossProduct worklet"); + + for (vtkm::Id i = 0; i < inputArray1.GetNumberOfValues(); i++) + { + vtkm::Vec v1 = inputArray1.GetPortalConstControl().Get(i); + vtkm::Vec v2 = inputArray2.GetPortalConstControl().Get(i); + vtkm::Vec res = outputArray.GetPortalConstControl().Get(i); + + //Make sure result is orthogonal each input vector. Need to normalize to compare with zero. + vtkm::Vec v1N(vtkm::Normal(v1)), v2N(vtkm::Normal(v1)), resN(vtkm::Normal(res)); + VTKM_TEST_ASSERT(test_equal(vtkm::dot(resN, v1N), T(0.0)), "Wrong result for cross product"); + VTKM_TEST_ASSERT(test_equal(vtkm::dot(resN, v2N), T(0.0)), "Wrong result for cross product"); + + T sinAngle = vtkm::Magnitude(res) * vtkm::RMagnitude(v1) * vtkm::RMagnitude(v2); + T cosAngle = vtkm::dot(v1, v2) * vtkm::RMagnitude(v1) * vtkm::RMagnitude(v2); + VTKM_TEST_ASSERT(test_equal(sinAngle * sinAngle + cosAngle * cosAngle, T(1.0)), + "Bad cross product length."); + } +} + +void TestCrossProductWorklets() +{ + std::cout << "Testing CrossProduct Worklet" << std::endl; + TestCrossProduct(); + TestCrossProduct(); +} +} + +int UnitTestCrossProduct(int, char* []) +{ + return vtkm::cont::testing::Testing::Run(TestCrossProductWorklets); +} diff --git a/vtkm/worklet/testing/UnitTestDotProduct.cxx b/vtkm/worklet/testing/UnitTestDotProduct.cxx new file mode 100644 index 000000000..04f739d70 --- /dev/null +++ b/vtkm/worklet/testing/UnitTestDotProduct.cxx @@ -0,0 +1,115 @@ +//============================================================================ +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +// Copyright 2014 UT-Battelle, LLC. +// Copyright 2014 Los Alamos National Security. +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National +// Laboratory (LANL), the U.S. Government retains certain rights in +// this software. +//============================================================================ + +#include +#include + +#include + +namespace +{ + +template +T normalizedVector(T v) +{ + T vN = vtkm::Normal(v); + return vN; +} + +template +void createVectors(std::vector>& vecs1, + std::vector>& vecs2, + std::vector& result) +{ + vecs1.push_back(normalizedVector(vtkm::make_Vec(T(1), T(0), T(0)))); + vecs2.push_back(normalizedVector(vtkm::make_Vec(T(1), T(0), T(0)))); + result.push_back(1); + + vecs1.push_back(normalizedVector(vtkm::make_Vec(T(1), T(0), T(0)))); + vecs2.push_back(normalizedVector(vtkm::make_Vec(T(-1), T(0), T(0)))); + result.push_back(-1); + + vecs1.push_back(normalizedVector(vtkm::make_Vec(T(1), T(0), T(0)))); + vecs2.push_back(normalizedVector(vtkm::make_Vec(T(0), T(1), T(0)))); + result.push_back(0); + + vecs1.push_back(normalizedVector(vtkm::make_Vec(T(1), T(0), T(0)))); + vecs2.push_back(normalizedVector(vtkm::make_Vec(T(0), T(-1), T(0)))); + result.push_back(0); + + vecs1.push_back(normalizedVector(vtkm::make_Vec(T(1), T(0), T(0)))); + vecs2.push_back(normalizedVector(vtkm::make_Vec(T(1), T(1), T(0)))); + result.push_back(T(1.0 / vtkm::Sqrt(2.0))); + + vecs1.push_back(normalizedVector(vtkm::make_Vec(T(1), T(1), T(0)))); + vecs2.push_back(normalizedVector(vtkm::make_Vec(T(1), T(0), T(0)))); + result.push_back(T(1.0 / vtkm::Sqrt(2.0))); + + vecs1.push_back(normalizedVector(vtkm::make_Vec(T(-1), T(0), T(0)))); + vecs2.push_back(normalizedVector(vtkm::make_Vec(T(1), T(1), T(0)))); + result.push_back(-T(1.0 / vtkm::Sqrt(2.0))); + + vecs1.push_back(normalizedVector(vtkm::make_Vec(T(0), T(1), T(0)))); + vecs2.push_back(normalizedVector(vtkm::make_Vec(T(1), T(1), T(0)))); + result.push_back(T(1.0 / vtkm::Sqrt(2.0))); +} + +template +void TestDotProduct() +{ + std::vector> inputVecs1, inputVecs2; + std::vector answer; + createVectors(inputVecs1, inputVecs2, answer); + + vtkm::cont::ArrayHandle> inputArray1, inputArray2; + vtkm::cont::ArrayHandle outputArray; + inputArray1 = vtkm::cont::make_ArrayHandle(inputVecs1); + inputArray2 = vtkm::cont::make_ArrayHandle(inputVecs2); + + vtkm::worklet::DotProduct dotProductWorklet; + vtkm::worklet::DispatcherMapField dispatcherDotProduct( + dotProductWorklet); + dispatcherDotProduct.Invoke(inputArray1, inputArray2, outputArray); + + VTKM_TEST_ASSERT(outputArray.GetNumberOfValues() == inputArray1.GetNumberOfValues(), + "Wrong number of results for DotProduct worklet"); + + for (vtkm::Id i = 0; i < inputArray1.GetNumberOfValues(); i++) + { + vtkm::Vec v1 = inputArray1.GetPortalConstControl().Get(i); + vtkm::Vec v2 = inputArray2.GetPortalConstControl().Get(i); + T ans = answer[static_cast(i)]; + + VTKM_TEST_ASSERT(test_equal(ans, vtkm::dot(v1, v2)), "Wrong result for dot product"); + } +} + +void TestDotProductWorklets() +{ + std::cout << "Testing DotProduct Worklet" << std::endl; + TestDotProduct(); + // TestDotProduct(); +} +} + +int UnitTestDotProduct(int, char* []) +{ + return vtkm::cont::testing::Testing::Run(TestDotProductWorklets); +} diff --git a/vtkm/worklet/testing/UnitTestMarchingCubes.cxx b/vtkm/worklet/testing/UnitTestMarchingCubes.cxx index 1fc86dce4..02457d4d7 100644 --- a/vtkm/worklet/testing/UnitTestMarchingCubes.cxx +++ b/vtkm/worklet/testing/UnitTestMarchingCubes.cxx @@ -411,6 +411,7 @@ void TestMarchingCubesExplicit() int UnitTestMarchingCubes(int, char* []) { - return vtkm::cont::testing::Testing::Run(TestMarchingCubesUniformGrid); - return vtkm::cont::testing::Testing::Run(TestMarchingCubesExplicit); + int result1 = vtkm::cont::testing::Testing::Run(TestMarchingCubesUniformGrid); + int result2 = vtkm::cont::testing::Testing::Run(TestMarchingCubesExplicit); + return result1 == 0 && result2 == 0; } diff --git a/vtkm/worklet/testing/UnitTestParticleAdvection.cxx b/vtkm/worklet/testing/UnitTestParticleAdvection.cxx index b239f1622..58bb17fec 100644 --- a/vtkm/worklet/testing/UnitTestParticleAdvection.cxx +++ b/vtkm/worklet/testing/UnitTestParticleAdvection.cxx @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include diff --git a/vtkm/worklet/testing/UnitTestPointElevation.cxx b/vtkm/worklet/testing/UnitTestPointElevation.cxx index 965f9d75d..f82f3bc9e 100644 --- a/vtkm/worklet/testing/UnitTestPointElevation.cxx +++ b/vtkm/worklet/testing/UnitTestPointElevation.cxx @@ -88,9 +88,7 @@ void TestPointElevation() pointElevationWorklet); dispatcher.Invoke(dataSet.GetCoordinateSystem(), result); - vtkm::cont::ArrayHandle> coordinates; - dataSet.GetCoordinateSystem().GetData().CopyTo(coordinates); - + auto coordinates = dataSet.GetCoordinateSystem().GetData(); for (vtkm::Id i = 0; i < result.GetNumberOfValues(); ++i) { VTKM_TEST_ASSERT(test_equal(coordinates.GetPortalConstControl().Get(i)[1] * 2.0, diff --git a/vtkm/worklet/testing/UnitTestStreamLineUniformGrid.cxx b/vtkm/worklet/testing/UnitTestStreamLineUniformGrid.cxx index 77893c2a5..048eb1f08 100644 --- a/vtkm/worklet/testing/UnitTestStreamLineUniformGrid.cxx +++ b/vtkm/worklet/testing/UnitTestStreamLineUniformGrid.cxx @@ -156,8 +156,7 @@ void TestStreamLineUniformGrid() // Check output vtkm::cont::CellSetExplicit<> outCellSet; outDataSet.GetCellSet(0).CopyTo(outCellSet); - const vtkm::cont::DynamicArrayHandleCoordinateSystem& coordArray = - outDataSet.GetCoordinateSystem(0).GetData(); + auto coordArray = outDataSet.GetCoordinateSystem(0).GetData(); vtkm::Id numberOfCells = outCellSet.GetNumberOfCells(); vtkm::Id numberOfPoints = coordArray.GetNumberOfValues(); diff --git a/vtkm/worklet/testing/UnitTestVertexClustering.cxx b/vtkm/worklet/testing/UnitTestVertexClustering.cxx index a7a64676e..b8d18fa08 100644 --- a/vtkm/worklet/testing/UnitTestVertexClustering.cxx +++ b/vtkm/worklet/testing/UnitTestVertexClustering.cxx @@ -78,9 +78,7 @@ void TestVertexClustering() } { - typedef vtkm::Vec PointType; - vtkm::cont::ArrayHandle pointArray; - outDataSet.GetCoordinateSystem(0).GetData().CopyTo(pointArray); + auto pointArray = outDataSet.GetCoordinateSystem(0).GetData(); std::cerr << "output_points = " << pointArray.GetNumberOfValues() << "\n"; std::cerr << "output_point[] = "; vtkm::cont::printSummary_ArrayHandle(pointArray, std::cerr, true); @@ -92,8 +90,7 @@ void TestVertexClustering() VTKM_TEST_ASSERT(outDataSet.GetNumberOfCoordinateSystems() == 1, "Number of output coordinate systems mismatch"); typedef vtkm::Vec PointType; - vtkm::cont::ArrayHandle pointArray; - outDataSet.GetCoordinateSystem(0).GetData().CopyTo(pointArray); + auto pointArray = outDataSet.GetCoordinateSystem(0).GetData(); VTKM_TEST_ASSERT(pointArray.GetNumberOfValues() == output_points, "Number of output points mismatch"); for (vtkm::Id i = 0; i < pointArray.GetNumberOfValues(); ++i) diff --git a/vtkm/worklet/testing/UnitTestWorkletMapFieldExecArg.cxx b/vtkm/worklet/testing/UnitTestWorkletMapFieldExecArg.cxx index 61c2a8c74..3b35923c6 100644 --- a/vtkm/worklet/testing/UnitTestWorkletMapFieldExecArg.cxx +++ b/vtkm/worklet/testing/UnitTestWorkletMapFieldExecArg.cxx @@ -24,35 +24,34 @@ #include #include -#include - #include -class TestExecObjectWorklet : public vtkm::worklet::WorkletMapField +struct TestExecObjectWorklet { -public: - typedef void ControlSignature(FieldIn<>, ExecObject, ExecObject, FieldOut<>); - typedef void ExecutionSignature(_1, _2, _3, _4); - - template - VTKM_EXEC void operator()(const vtkm::Id& index, - const vtkm::exec::ExecutionWholeArrayConst& execIn, - vtkm::exec::ExecutionWholeArray& execOut, - T& out) const + template + class Worklet : public vtkm::worklet::WorkletMapField { - if (!test_equal(execIn.Get(index), TestValue(index, T()) + T(100))) + public: + typedef void ControlSignature(FieldIn, + WholeArrayIn>, + WholeArrayOut>, + FieldOut>); + typedef void ExecutionSignature(_1, _2, _3, _4); + + template + VTKM_EXEC void operator()(const vtkm::Id& index, + const InPortalType& execIn, + OutPortalType& execOut, + T& out) const { - this->RaiseError("Got wrong input value."); + if (!test_equal(execIn.Get(index), TestValue(index, T()) + T(100))) + { + this->RaiseError("Got wrong input value."); + } + out = execIn.Get(index) - T(100); + execOut.Set(index, out); } - out = execIn.Get(index) - T(100); - execOut.Set(index, out); - } - - template - VTKM_EXEC void operator()(const vtkm::Id&, const T1&, const T2&, const T3&) const - { - this->RaiseError("Cannot call this worklet with different types."); - } + }; }; namespace map_exec_field @@ -78,13 +77,11 @@ struct DoTestWorklet vtkm::cont::ArrayHandle inputHandle = vtkm::cont::make_ArrayHandle(inputArray, ARRAY_SIZE); vtkm::cont::ArrayHandle outputHandle; vtkm::cont::ArrayHandle outputFieldArray; + outputHandle.Allocate(ARRAY_SIZE); std::cout << "Create and run dispatcher." << std::endl; - vtkm::worklet::DispatcherMapField dispatcher; - dispatcher.Invoke(counting, - vtkm::exec::ExecutionWholeArrayConst(inputHandle), - vtkm::exec::ExecutionWholeArray(outputHandle, ARRAY_SIZE), - outputFieldArray); + vtkm::worklet::DispatcherMapField> dispatcher; + dispatcher.Invoke(counting, inputHandle, outputHandle, outputFieldArray); std::cout << "Check result." << std::endl; CheckPortal(outputHandle.GetPortalConstControl()); @@ -94,12 +91,10 @@ struct DoTestWorklet // Clear out output arrays. outputFieldArray = vtkm::cont::ArrayHandle(); outputHandle = vtkm::cont::ArrayHandle(); + outputHandle.Allocate(ARRAY_SIZE); vtkm::cont::DynamicArrayHandle outputFieldDynamic(outputFieldArray); - dispatcher.Invoke(counting, - vtkm::exec::ExecutionWholeArrayConst(inputHandle), - vtkm::exec::ExecutionWholeArray(outputHandle, ARRAY_SIZE), - outputFieldDynamic); + dispatcher.Invoke(counting, inputHandle, outputHandle, outputFieldDynamic); std::cout << "Check dynamic array result." << std::endl; CheckPortal(outputHandle.GetPortalConstControl()); @@ -110,7 +105,7 @@ struct DoTestWorklet void TestWorkletMapFieldExecArg() { typedef vtkm::cont::DeviceAdapterTraits DeviceAdapterTraits; - std::cout << "Testing Worklet with ExecutionWholeArray on device adapter: " + std::cout << "Testing Worklet with WholeArray on device adapter: " << DeviceAdapterTraits::GetName() << std::endl; std::cout << "--- Worklet accepting all types." << std::endl;