xyz.h 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. #pragma once
  2. #include "ThirdPartyHeadersBegin.h"
  3. #include <algorithm>
  4. #include <cfloat>
  5. #include <cmath>
  6. #include <vector>
  7. #include "ThirdPartyHeadersEnd.h"
  8. #include "basicTypes.h"
  9. #include "CodeContract.h"
  10. #include "ClassMacros.h"
  11. namespace tecplot
  12. {
  13. namespace ___3933
  14. {
  15. template <typename T>
  16. inline void clearAndDeallocVector(std::vector<T> &vectorToClear) { std::vector<T>().swap(vectorToClear); }
  17. class UVW
  18. {
  19. private:
  20. double m_uValue;
  21. double m_vValue;
  22. double m_wValue;
  23. public:
  24. UVW(double uu, double vv, double ww) : m_uValue(uu), m_vValue(vv), m_wValue(ww) {}
  25. UVW() : m_uValue(DBL_MAX), m_vValue(DBL_MAX), m_wValue(DBL_MAX) {}
  26. inline double u(void) const { return m_uValue; }
  27. inline double ___4291(void) const { return m_vValue; }
  28. inline double w(void) const { return m_wValue; }
  29. inline void setU(double uu) { m_uValue = uu; }
  30. inline void setV(double vv) { m_vValue = vv; }
  31. inline void setW(double ww) { m_wValue = ww; }
  32. void invalidate(void)
  33. {
  34. m_uValue = DBL_MAX;
  35. m_vValue = DBL_MAX;
  36. m_wValue = DBL_MAX;
  37. }
  38. bool ___2067(void) const { return m_uValue != DBL_MAX && m_vValue != DBL_MAX && m_wValue != DBL_MAX; }
  39. inline bool operator==(UVW const &uvw) { return m_uValue == uvw.m_uValue && m_vValue == uvw.m_vValue && m_wValue == uvw.m_wValue; }
  40. inline void operator/=(double const scalar)
  41. {
  42. m_uValue /= scalar;
  43. m_vValue /= scalar;
  44. m_wValue /= scalar;
  45. }
  46. inline void operator+=(UVW const &uvw)
  47. {
  48. m_uValue += uvw.m_uValue;
  49. m_vValue += uvw.m_vValue;
  50. m_wValue += uvw.m_wValue;
  51. }
  52. inline UVW operator+(UVW const &uvw) const { return UVW(m_uValue + uvw.m_uValue, m_vValue + uvw.m_vValue, m_wValue + uvw.m_wValue); }
  53. inline UVW operator-(UVW const &uvw) const { return UVW(m_uValue - uvw.m_uValue, m_vValue - uvw.m_vValue, m_wValue - uvw.m_wValue); }
  54. inline UVW operator*(double const scalar) const { return UVW(m_uValue * scalar, m_vValue * scalar, m_wValue * scalar); }
  55. inline double normL1(void) const { return std::abs(m_uValue) + std::abs(m_vValue) + std::abs(m_wValue); }
  56. };
  57. class ___4580
  58. {
  59. private:
  60. double m_xValue;
  61. double m_yValue;
  62. double m_zValue;
  63. public:
  64. ___4580(double xx, double yy, double zz) : m_xValue(xx), m_yValue(yy), m_zValue(zz) {}
  65. ___4580() : m_xValue(DBL_MAX), m_yValue(DBL_MAX), m_zValue(DBL_MAX) {}
  66. inline double x(void) const { return m_xValue; }
  67. inline double ___4583(void) const { return m_yValue; }
  68. inline double z(void) const { return m_zValue; }
  69. inline void setX(double xx) { m_xValue = xx; }
  70. inline void setY(double yy) { m_yValue = yy; }
  71. inline void setZ(double zz) { m_zValue = zz; }
  72. void invalidate(void)
  73. {
  74. m_xValue = DBL_MAX;
  75. m_yValue = DBL_MAX;
  76. m_zValue = DBL_MAX;
  77. }
  78. bool ___2067(void) const { return m_xValue != DBL_MAX && m_yValue != DBL_MAX && m_zValue != DBL_MAX; }
  79. inline void operator*=(double const scalar)
  80. {
  81. m_xValue *= scalar;
  82. m_yValue *= scalar;
  83. m_zValue *= scalar;
  84. }
  85. inline void operator/=(double const scalar)
  86. {
  87. m_xValue /= scalar;
  88. m_yValue /= scalar;
  89. m_zValue /= scalar;
  90. }
  91. inline void operator+=(___4580 const &xyz)
  92. {
  93. m_xValue += xyz.x();
  94. m_yValue += xyz.___4583();
  95. m_zValue += xyz.z();
  96. }
  97. inline ___4580 operator+(___4580 const &xyz) const { return ___4580(m_xValue + xyz.x(), m_yValue + xyz.___4583(), m_zValue + xyz.z()); }
  98. inline ___4580 operator-(___4580 const &xyz) const { return ___4580(m_xValue - xyz.x(), m_yValue - xyz.___4583(), m_zValue - xyz.z()); }
  99. inline ___4580 operator*(double const scalar) const { return ___4580(m_xValue * scalar, m_yValue * scalar, m_zValue * scalar); }
  100. inline bool operator>(double const scalar) const { return m_xValue > scalar && m_yValue > scalar && m_zValue > scalar; }
  101. inline bool operator<(double const scalar) const { return m_xValue < scalar && m_yValue < scalar && m_zValue < scalar; }
  102. inline bool operator<=(___4580 const &xyz) const { return m_xValue <= xyz.x() && m_yValue <= xyz.___4583() && m_zValue <= xyz.z(); }
  103. inline bool operator==(___4580 const &xyz) const { return float(m_xValue) == float(xyz.x()) && float(m_yValue) == float(xyz.___4583()) && float(m_zValue) == float(xyz.z()); }
  104. inline double normL1(void) const { return std::abs(m_xValue) + std::abs(m_yValue) + std::abs(m_zValue); }
  105. };
  106. inline ___4580 abs(___4580 const &xyz) { return ___4580(std::abs(xyz.x()), std::abs(xyz.___4583()), std::abs(xyz.___4583())); }
  107. class XYZC
  108. {
  109. private:
  110. ___4580 m_xyz;
  111. double m_cValue;
  112. public:
  113. XYZC(___4580 const &xyz, double cc) : m_xyz(xyz), m_cValue(cc) {}
  114. XYZC() : m_xyz(DBL_MAX, DBL_MAX, DBL_MAX), m_cValue(DBL_MAX) {}
  115. void invalidate(void)
  116. {
  117. m_xyz.invalidate();
  118. m_cValue = DBL_MAX;
  119. }
  120. bool ___2067(void) const { return m_xyz.___2067() && m_cValue != DBL_MAX; }
  121. inline ___4580 const &xyz(void) const { return m_xyz; }
  122. inline double const &c(void) const { return m_cValue; }
  123. inline XYZC operator+(XYZC const &xyzc) const { return XYZC(m_xyz + xyzc.xyz(), m_cValue + xyzc.c()); }
  124. inline XYZC operator-(XYZC const &xyzc) const { return XYZC(m_xyz - xyzc.xyz(), m_cValue - xyzc.c()); }
  125. inline XYZC operator*(double const scalar) const { return XYZC(m_xyz * scalar, m_cValue * scalar); }
  126. inline void operator+=(XYZC const &xyzc)
  127. {
  128. m_xyz += xyzc.xyz();
  129. m_cValue += xyzc.c();
  130. }
  131. inline void operator*=(double const ___1304)
  132. {
  133. m_xyz *= ___1304;
  134. m_cValue *= ___1304;
  135. }
  136. inline void operator/=(double const ___1304)
  137. {
  138. m_xyz /= ___1304;
  139. m_cValue /= ___1304;
  140. }
  141. inline void setX(double xx) { m_xyz.setX(xx); }
  142. inline void setY(double yy) { m_xyz.setY(yy); }
  143. inline void setZ(double zz) { m_xyz.setZ(zz); }
  144. inline void setC(double cc) { m_cValue = cc; }
  145. inline double norm(void) { return m_xyz.normL1() + std::abs(m_cValue); }
  146. };
  147. template <typename T>
  148. class ThreeValues
  149. {
  150. private:
  151. T m_v1;
  152. T m_v2;
  153. T m_v3;
  154. public:
  155. ThreeValues(T v1, T v2, T v3) : m_v1(v1), m_v2(v2), m_v3(v3) {}
  156. ThreeValues() {}
  157. T const &v1() const { return m_v1; }
  158. T const &v2() const { return m_v2; }
  159. T const &v3() const { return m_v3; }
  160. T &v1() { return m_v1; }
  161. T &v2() { return m_v2; }
  162. T &v3() { return m_v3; }
  163. bool operator>=(T const &scalar) const { return m_v1 >= scalar && m_v2 >= scalar && m_v3 >= scalar; }
  164. bool operator<=(T const &scalar) const { return m_v1 <= scalar && m_v2 <= scalar && m_v3 <= scalar; }
  165. bool operator<(T const &scalar) const { return m_v1 < scalar && m_v2 < scalar && m_v3 < scalar; }
  166. bool operator>(T const &scalar) const { return m_v1 > scalar && m_v2 > scalar && m_v3 > scalar; }
  167. bool anyComponentEquals(T const &scalar) const { return m_v1 == scalar || m_v2 == scalar || m_v3 == scalar; }
  168. };
  169. class XYZVars : public ThreeValues<___4352>
  170. {
  171. public:
  172. XYZVars(___4352 xVar, ___4352 yVar, ___4352 zVar) : ThreeValues<___4352>(xVar, yVar, zVar) {}
  173. ___4352 xVar() const { return v1(); }
  174. ___4352 yVar() const { return v2(); }
  175. ___4352 zVar() const { return v3(); }
  176. };
  177. class UVWVars : public ThreeValues<___4352>
  178. {
  179. public:
  180. UVWVars(___4352 uVar, ___4352 vVar, ___4352 wVar) : ThreeValues<___4352>(uVar, vVar, wVar) {}
  181. ___4352 uVar() const { return v1(); }
  182. ___4352 vVar() const { return v2(); }
  183. ___4352 wVar() const { return v3(); }
  184. };
  185. template <typename T>
  186. class FourValues
  187. {
  188. private:
  189. T m_v1;
  190. T m_v2;
  191. T m_v3;
  192. T m_v4;
  193. public:
  194. FourValues(T v1, T v2, T v3, T v4) : m_v1(v1), m_v2(v2), m_v3(v3), m_v4(v4) {}
  195. FourValues() {}
  196. T const &v1() const { return m_v1; }
  197. T const &v2() const { return m_v2; }
  198. T const &v3() const { return m_v3; }
  199. T const &v4() const { return m_v4; }
  200. T &v1() { return m_v1; }
  201. T &v2() { return m_v2; }
  202. T &v3() { return m_v3; }
  203. T &v4() { return m_v4; }
  204. bool operator>=(T const &scalar) const { return m_v1 >= scalar && m_v2 >= scalar && m_v3 >= scalar && m_v4 >= scalar; }
  205. bool operator<=(T const &scalar) const { return m_v1 <= scalar && m_v2 <= scalar && m_v3 <= scalar && m_v4 <= scalar; }
  206. };
  207. class ThreeValueArray : public ThreeValues<std::vector<float>>
  208. {
  209. UNCOPYABLE_CLASS(ThreeValueArray);
  210. public:
  211. ThreeValueArray() {}
  212. size_t size()
  213. {
  214. ___478(v1().size() == v2().size() && v2().size() == v3().size());
  215. return v1().size();
  216. }
  217. void clearAndDealloc(void)
  218. {
  219. clearAndDeallocVector(v1());
  220. clearAndDeallocVector(v2());
  221. clearAndDeallocVector(v3());
  222. }
  223. void repeatLastPoint()
  224. {
  225. size_t lastPoint = size() - 1;
  226. v1().push_back(v1()[lastPoint]);
  227. v2().push_back(v2()[lastPoint]);
  228. v3().push_back(v3()[lastPoint]);
  229. }
  230. void switchValues(size_t ___1841, size_t ___2113)
  231. {
  232. REQUIRE(___1841 < size());
  233. REQUIRE(___2113 < size());
  234. float ___4179 = v1()[___1841];
  235. v1()[___1841] = v1()[___2113];
  236. v1()[___2113] = ___4179;
  237. ___4179 = v2()[___1841];
  238. v2()[___1841] = v2()[___2113];
  239. v2()[___2113] = ___4179;
  240. ___4179 = v3()[___1841];
  241. v3()[___1841] = v3()[___2113];
  242. v3()[___2113] = ___4179;
  243. }
  244. };
  245. class XYZArray : public ThreeValueArray
  246. {
  247. UNCOPYABLE_CLASS(XYZArray);
  248. public:
  249. XYZArray() {}
  250. void push_back(___4580 const &xyz)
  251. {
  252. REQUIRE(xyz.___2067());
  253. v1().push_back(float(xyz.x()));
  254. v2().push_back(float(xyz.___4583()));
  255. v3().push_back(float(xyz.z()));
  256. }
  257. ___4580 const operator[](size_t pos) const { return ___4580(v1()[pos], v2()[pos], v3()[pos]); }
  258. };
  259. class StreamUVWArray : public ThreeValueArray
  260. {
  261. UNCOPYABLE_CLASS(StreamUVWArray);
  262. public:
  263. StreamUVWArray() {}
  264. void push_back(UVW const &uvw)
  265. {
  266. REQUIRE(uvw.___2067());
  267. v1().push_back(float(uvw.u()));
  268. v2().push_back(float(uvw.___4291()));
  269. v3().push_back(float(uvw.w()));
  270. }
  271. UVW const operator[](size_t pos) const { return UVW(v1()[pos], v2()[pos], v3()[pos]); }
  272. };
  273. }
  274. }