13 #ifndef vtk_m_internal_VecOperators_h
14 #define vtk_m_internal_VecOperators_h
16 #include <vtkm/internal/Configure.h>
20 #if (!(defined(VTKM_CUDA) && (__CUDACC_VER_MAJOR__ < 8)))
21 #if (defined(VTKM_GCC) || defined(VTKM_CLANG))
22 #pragma GCC diagnostic push
23 #pragma GCC diagnostic ignored "-Wunknown-pragmas"
24 #pragma GCC diagnostic ignored "-Wpragmas"
25 #pragma GCC diagnostic ignored "-Wconversion"
26 #pragma GCC diagnostic ignored "-Wfloat-conversion"
27 #endif // gcc || clang
28 #endif // not using cuda < 8
30 #if defined(VTKM_MSVC)
32 #pragma warning(disable : 4244)
37 template <
typename T, vtkm::IdComponent Size>
39 typename std::enable_if<(std::is_floating_point<T>::value || std::is_signed<T>::value),
43 for(
int i=0; i < Size; ++i)
52 typename std::enable_if<(std::is_floating_point<T>::value || std::is_signed<T>::value),
61 typename std::enable_if<(std::is_floating_point<T>::value || std::is_signed<T>::value),
70 typename std::enable_if<(std::is_floating_point<T>::value || std::is_signed<T>::value),
79 typename std::enable_if<(std::is_floating_point<T>::value || std::is_signed<T>::value),
91 template <
typename T, IdComponent Size>
96 for (
int i = 0; i < Size; ++i)
104 template <
typename T, IdComponent Size>
109 for (
int i = 0; i < Size; ++i)
111 a[i] = a[i] + scalar;
117 template <
typename T, IdComponent Size>
122 for (
int i = 0; i < Size; ++i)
124 a[i] = a[i] + scalar;
130 template <IdComponent Size>
135 for (
int i = 0; i < Size; ++i)
137 a[i] = a[i] + scalar;
143 template <
typename T, IdComponent Size>
148 for (
int i = 0; i < Size; ++i)
150 a[i] = scalar + a[i];
156 template <
typename T, IdComponent Size>
161 for (
int i = 0; i < Size; ++i)
163 a[i] = scalar + a[i];
169 template <IdComponent Size>
174 for (
int i = 0; i < Size; ++i)
176 a[i] = scalar + a[i];
184 template <
typename T, IdComponent Size>
189 for (
int i = 0; i < Size; ++i)
197 template <
typename T, IdComponent Size>
202 for (
int i = 0; i < Size; ++i)
204 a[i] = a[i] * scalar;
210 template <
typename T, IdComponent Size>
215 for (
int i = 0; i < Size; ++i)
217 a[i] = a[i] * scalar;
223 template <IdComponent Size>
228 for (
int i = 0; i < Size; ++i)
230 a[i] = a[i] * scalar;
236 template <
typename T, IdComponent Size>
241 for (
int i = 0; i < Size; ++i)
243 a[i] = scalar * a[i];
249 template <
typename T, IdComponent Size>
254 for (
int i = 0; i < Size; ++i)
256 a[i] = scalar * a[i];
262 template <IdComponent Size>
267 for (
int i = 0; i < Size; ++i)
269 a[i] = scalar * a[i];
277 template <
typename T, IdComponent Size>
282 for (
int i = 0; i < Size; ++i)
290 template <
typename T, IdComponent Size>
295 for (
int i = 0; i < Size; ++i)
297 a[i] = a[i] - scalar;
303 template <
typename T, IdComponent Size>
308 for (
int i = 0; i < Size; ++i)
310 a[i] = a[i] - scalar;
316 template <IdComponent Size>
321 for (
int i = 0; i < Size; ++i)
323 a[i] = a[i] - scalar;
329 template <
typename T, IdComponent Size>
334 for (
int i = 0; i < Size; ++i)
336 a[i] = scalar - a[i];
342 template <
typename T, IdComponent Size>
347 for (
int i = 0; i < Size; ++i)
349 a[i] = scalar - a[i];
355 template <IdComponent Size>
360 for (
int i = 0; i < Size; ++i)
362 a[i] = scalar - a[i];
370 template <
typename T, IdComponent Size>
375 for (
int i = 0; i < Size; ++i)
383 template <
typename T, IdComponent Size>
388 for (
int i = 0; i < Size; ++i)
390 a[i] = a[i] / scalar;
396 template <
typename T, IdComponent Size>
401 for (
int i = 0; i < Size; ++i)
403 a[i] = a[i] / scalar;
409 template <IdComponent Size>
414 for (
int i = 0; i < Size; ++i)
416 a[i] = a[i] / scalar;
422 template <
typename T, IdComponent Size>
427 for (
int i = 0; i < Size; ++i)
429 a[i] = scalar / a[i];
435 template <
typename T, IdComponent Size>
440 for (
int i = 0; i < Size; ++i)
442 a[i] = scalar / a[i];
448 template <IdComponent Size>
453 for (
int i = 0; i < Size; ++i)
455 a[i] = scalar / a[i];
464 template <
typename T>
473 template <
typename T>
482 template <
typename T>
499 template <
typename T>
508 template <
typename T>
525 template <
typename T>
534 template <
typename T>
543 template <
typename T>
560 template <
typename T>
569 template <
typename T>
586 template <
typename T>
595 template <
typename T>
604 template <
typename T>
621 template <
typename T>
630 template <
typename T>
647 template <
typename T>
652 return vtkm::Vec<T, 4>(a[0] + b[0], a[1] + b[1], a[2] + b[2], a[3] + b[3]);
656 template <
typename T>
661 return vtkm::Vec<T, 4>(a[0] + scalar, a[1] + scalar, a[2] + scalar, a[3] + scalar);
665 template <
typename T>
670 return vtkm::Vec<T, 4>(a[0] + scalar, a[1] + scalar, a[2] + scalar, a[3] + scalar);
682 template <
typename T>
687 return vtkm::Vec<T, 4>(scalar + a[0], scalar + a[1], scalar + a[2], scalar + a[3]);
691 template <
typename T>
696 return vtkm::Vec<T, 4>(scalar + a[0], scalar + a[1], scalar + a[2], scalar + a[3]);
710 template <
typename T>
719 template <
typename T>
728 template <
typename T>
745 template <
typename T>
754 template <
typename T>
771 template <
typename T>
780 template <
typename T>
789 template <
typename T>
806 template <
typename T>
815 template <
typename T>
832 template <
typename T>
841 template <
typename T>
850 template <
typename T>
867 template <
typename T>
876 template <
typename T>
893 template <
typename T>
898 return vtkm::Vec<T, 4>(a[0] * b[0], a[1] * b[1], a[2] * b[2], a[3] * b[3]);
902 template <
typename T>
907 return vtkm::Vec<T, 4>(a[0] * scalar, a[1] * scalar, a[2] * scalar, a[3] * scalar);
911 template <
typename T>
916 return vtkm::Vec<T, 4>(a[0] * scalar, a[1] * scalar, a[2] * scalar, a[3] * scalar);
928 template <
typename T>
933 return vtkm::Vec<T, 4>(scalar * a[0], scalar * a[1], scalar * a[2], scalar * a[3]);
937 template <
typename T>
942 return vtkm::Vec<T, 4>(scalar * a[0], scalar * a[1], scalar * a[2], scalar * a[3]);
956 template <
typename T>
965 template <
typename T>
974 template <
typename T>
991 template <
typename T>
1000 template <
typename T>
1017 template <
typename T>
1026 template <
typename T>
1035 template <
typename T>
1052 template <
typename T>
1061 template <
typename T>
1078 template <
typename T>
1087 template <
typename T>
1096 template <
typename T>
1113 template <
typename T>
1122 template <
typename T>
1139 template <
typename T>
1144 return vtkm::Vec<T, 4>(a[0] - b[0], a[1] - b[1], a[2] - b[2], a[3] - b[3]);
1148 template <
typename T>
1153 return vtkm::Vec<T, 4>(a[0] - scalar, a[1] - scalar, a[2] - scalar, a[3] - scalar);
1157 template <
typename T>
1162 return vtkm::Vec<T, 4>(a[0] - scalar, a[1] - scalar, a[2] - scalar, a[3] - scalar);
1174 template <
typename T>
1179 return vtkm::Vec<T, 4>(scalar - a[0], scalar - a[1], scalar - a[2], scalar - a[3]);
1183 template <
typename T>
1188 return vtkm::Vec<T, 4>(scalar - a[0], scalar - a[1], scalar - a[2], scalar - a[3]);
1202 template <
typename T>
1211 template <
typename T>
1220 template <
typename T>
1237 template <
typename T>
1246 template <
typename T>
1263 template <
typename T>
1272 template <
typename T>
1281 template <
typename T>
1298 template <
typename T>
1307 template <
typename T>
1324 template <
typename T>
1333 template <
typename T>
1342 template <
typename T>
1359 template <
typename T>
1368 template <
typename T>
1385 template <
typename T>
1390 return vtkm::Vec<T, 4>(a[0] / b[0], a[1] / b[1], a[2] / b[2], a[3] / b[3]);
1394 template <
typename T>
1399 return vtkm::Vec<T, 4>(a[0] / scalar, a[1] / scalar, a[2] / scalar, a[3] / scalar);
1403 template <
typename T>
1408 return vtkm::Vec<T, 4>(a[0] / scalar, a[1] / scalar, a[2] / scalar, a[3] / scalar);
1420 template <
typename T>
1425 return vtkm::Vec<T, 4>(scalar / a[0], scalar / a[1], scalar / a[2], scalar / a[3]);
1429 template <
typename T>
1434 return vtkm::Vec<T, 4>(scalar / a[0], scalar / a[1], scalar / a[2], scalar / a[3]);
1448 #if defined(VTKM_MSVC)
1449 #pragma warning(pop)
1452 #if (defined(VTKM_CUDA) && (__CUDACC_VER_MAJOR__ < 8))
1453 #if (defined(VTKM_GCC) || defined(VTKM_CLANG))
1454 #pragma GCC diagnostic pop
1455 #endif // gcc || clang
1456 #endif // use cuda < 8
1461 #endif //vtk_m_internal_VecOperators_h