SET.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. #if defined EXTERN
  2. #undef EXTERN
  3. #endif
  4. #if defined ___3500
  5. #define EXTERN
  6. #else
  7. #define EXTERN extern
  8. #endif
  9. #ifndef _SET_H_INCLUDED
  10. #define _SET_H_INCLUDED
  11. #include "ThirdPartyHeadersBegin.h"
  12. #include <algorithm>
  13. #include <set>
  14. #include <vector>
  15. #include "ThirdPartyHeadersEnd.h"
  16. #include "RawArray.h"
  17. #include "CodeContract.h"
  18. #define ___2896(X, Y) ((int)(((X)-1) / (Y) + 1) * (Y))
  19. #define ___3479 (8 * sizeof(___3483))
  20. #define ___3498 (((___3480)1) << (___3479 - 1))
  21. #if defined _DEBUG
  22. #define USE_FUNCTIONS_FOR_SETS
  23. #endif
  24. struct ___3502
  25. {
  26. ___3493 size;
  27. ___3481 data;
  28. };
  29. #define ___2056(___3476) ((___3476) == NULL)
  30. inline size_t ___3482(___3501 ___3476)
  31. {
  32. REQUIRE(VALID_REF(___3476));
  33. return ___3476->size / ___3479 * sizeof(___3483);
  34. }
  35. EXTERN ___3501 ___29(___372 ___3574);
  36. EXTERN void ___939(___3501 *___3476);
  37. EXTERN ___372 ___3496(void *___2098, ___90 ___494);
  38. EXTERN ___372 ___1201(___3501 ___3476, ___3493 max_val, ___372 ___3574);
  39. EXTERN ___372 ___676(___3501 ___1121, ___3501 ___3656, ___372 ___3574);
  40. EXTERN ___372 ___83(___3501 ___1121, ___3501 ___3656, ___372 ___3574);
  41. EXTERN void ___493(___3501 ___3476);
  42. #if defined USE_FUNCTIONS_FOR_SETS
  43. EXTERN ___372 ___17(___3501 ___3476, ___3493 ___2401, ___372 ___3574);
  44. #else
  45. #if defined __cplusplus
  46. inline ___372 ___17(___3501 ___3476, ___3493 ___2401, ___372 ___3574)
  47. {
  48. if (___3476 && (___2401 + 1 <= ___3476->size || ___1201(___3476, ___2401 + 1, ___3574)))
  49. {
  50. ___3493 word = ___2401 / ___3479;
  51. ___3480 bit = (___3480)1 << (___2401 % ___3479);
  52. ___3476->data[word] |= bit;
  53. return ___4226;
  54. }
  55. else
  56. return ___1305;
  57. }
  58. #elif defined TECPLOTKERNEL
  59. #define ___17(___3476, ___2401, ___3574) \
  60. (((___3476) && \
  61. ((___2401) + 1 <= (___3476)->size || \
  62. ___1201((___3476), (___2401) + 1, (___3574)))) \
  63. ? (((___3476)->data[(___2401) / ___3479].___1346((___3480)1 << ((___2401) % ___3479))), ___4226) \
  64. : ___1305)
  65. #else
  66. #define ___17(___3476, ___2401, ___3574) \
  67. (((___3476) && \
  68. ((___2401) + 1 <= (___3476)->size || \
  69. ___1201((___3476), (___2401) + 1, (___3574)))) \
  70. ? (((___3476)->data[(___2401) / ___3479] |= (___3480)1 << ((___2401) % ___3479)), ___4226) \
  71. : ___1305)
  72. #endif
  73. #endif
  74. EXTERN void ___3334(___3501 ___3476, ___3493 ___2401);
  75. EXTERN void ___957(___3501 ___3476, ___3493 ___2402);
  76. EXTERN ___372 ___1955(___3501 ___3476, ___3493 ___2402, ___372 ___3571);
  77. #if defined USE_FUNCTIONS_FOR_SETS
  78. EXTERN ___372 ___1956(___3501 ___3476, ___3493 ___2401);
  79. #else
  80. #if defined __cplusplus
  81. inline ___372 ___1956(___3501 ___3476, ___3493 ___2401)
  82. {
  83. if (___3476 && (0 <= ___2401 && ___2401 < ___3476->size))
  84. {
  85. ___3493 word = ___2401 / ___3479;
  86. ___3480 bit = (___3480)1 << (___2401 % ___3479);
  87. return (___3476->data[word] & bit) != 0;
  88. }
  89. else
  90. return ___1305;
  91. }
  92. #elif defined TECPLOTKERNEL
  93. #define ___1956(___3476, ___2401) ((___3476 && (0 <= (___2401) && (___2401) < (___3476)->size)) \
  94. ? ((___3476)->data[(___2401) / ___3479].load() & ((___3480)1 << ((___2401) % ___3479))) != 0 \
  95. : ___1305)
  96. #else
  97. #define ___1956(___3476, ___2401) ((___3476 && (0 <= (___2401) && (___2401) < (___3476)->size)) \
  98. ? ((___3476)->data[(___2401) / ___3479] & ((___3480)1 << ((___2401) % ___3479))) != 0 \
  99. : ___1305)
  100. #endif
  101. #endif
  102. EXTERN ___372 ___2015(___3501 ___3476);
  103. EXTERN ___372 ___1822(___3501 ___3476);
  104. EXTERN ___3493 ___2403(___3501 ___3476);
  105. EXTERN ___372 ___2033(___3501 ___3476);
  106. EXTERN ___3493 ___1761(___3501 ___3476, ___3493 ___3682);
  107. EXTERN ___3493 ___1769(___3501 ___3476, ___3493 ___3682);
  108. EXTERN ___372 ___1175(___3501 ___3477, ___3501 ___3478);
  109. ___3501 intersection(___3501 ___3477, ___3501 ___3478);
  110. EXTERN ___372 ___2062(___3501 ___486, ___3501 ___2973);
  111. EXTERN ___3493 ___2404(___3501 ___3476, ___3493 ___2402);
  112. EXTERN ___3493 ___2867(___3501 ___3476, ___3493 ___2866);
  113. EXTERN ___372 ___677(___3501 ___1126, ___3493 ___1125, ___3501 ___3663, ___3493 ___3662);
  114. EXTERN void ___3560(___3501 ___3476, ___3493 ___3558, ___3493 ___3559, ___3493 ___3556);
  115. #define ___1746(___3476) (___1761((___3476), ___333))
  116. #define ___1751(___3476) (___1769((___3476), ___333))
  117. #define ___1472(___2402, ___3476) \
  118. for (___2402 = ___1746((___3476)); \
  119. ___2402 != ___333; \
  120. ___2402 = ___1761((___3476), (___2402)))
  121. #define ForAllMembersInEntIndexSet(___2402, ___3476) \
  122. for (___2402 = static_cast<___1172>(___1746((___3476))); \
  123. ___2402 != static_cast<___1172>(___333); \
  124. ___2402 = static_cast<___1172>(___1761((___3476), (___2402))))
  125. #define ___1471(___2402, ___3476) \
  126. for (___2402 = ___1751((___3476)); \
  127. ___2402 != ___333; \
  128. ___2402 = ___1769((___3476), (___2402)))
  129. namespace tecplot
  130. {
  131. template <typename T>
  132. std::vector<T> ___4194(___3501 ___2100)
  133. {
  134. REQUIRE(VALID_REF(___2100) || ___2100 == 0);
  135. std::vector<T> ___3358;
  136. size_t const count = ___2403(___2100);
  137. if (count != 0)
  138. {
  139. ___3358.reserve(count);
  140. ___3493 ___2085;
  141. ___1472(___2085, ___2100)
  142. ___3358.push_back(static_cast<T>(___2085));
  143. }
  144. return ___3358;
  145. }
  146. template <typename T>
  147. inline std::set<T> ___4186(___3501 const set)
  148. {
  149. REQUIRE(VALID_REF_OR_NULL(set));
  150. ___1172 ___4314;
  151. std::set<T> ___3358;
  152. if (set != NULL)
  153. {
  154. ___1472(___4314, set) { ___3358.insert(static_cast<T>(___4314)); }
  155. }
  156. return ___3358;
  157. }
  158. template <typename CONTAINER>
  159. ___3501 ___4186(CONTAINER const &___2099, bool isSorted = true)
  160. {
  161. REQUIRE(IMPLICATION(isSorted && !___2099.empty(), ___2099[___2099.size() - 1] == ___333 || ___2099[___2099.size() - 1] == *std::max_element(&___2099[0], &___2099[0] + ___2099.size())));
  162. ___3501 ___3358 = ___29(___1305);
  163. if (___3358 == NULL)
  164. throw std::bad_alloc();
  165. if (!___2099.empty())
  166. {
  167. typename CONTAINER::value_type largestMember = static_cast<typename CONTAINER::value_type>(___333);
  168. if (isSorted)
  169. {
  170. for (typename CONTAINER::value_type const *iter = &___2099[___2099.size() - 1]; iter >= &___2099[0]; --iter)
  171. if ((largestMember = *iter) != static_cast<typename CONTAINER::value_type>(___333))
  172. break;
  173. }
  174. else
  175. {
  176. largestMember = *std::max_element(&___2099[0], &___2099[0] + ___2099.size());
  177. }
  178. if (largestMember != static_cast<typename CONTAINER::value_type>(___333))
  179. {
  180. if (!___1201(___3358, static_cast<___3493>(largestMember + 1), ___1305))
  181. {
  182. ___939(&___3358);
  183. throw std::bad_alloc();
  184. }
  185. typename CONTAINER::value_type const *itemsArray = &___2099[0];
  186. size_t const ___2812 = ___2099.size();
  187. for (size_t ___1992 = 0; ___1992 < ___2812; ++___1992)
  188. if (itemsArray[___1992] != static_cast<typename CONTAINER::value_type>(___333))
  189. (void)___17(___3358, static_cast<___3493>(itemsArray[___1992]), ___1305);
  190. }
  191. }
  192. ENSURE(VALID_REF(___3358));
  193. return ___3358;
  194. }
  195. template <typename T>
  196. void ___4185(___3501 ___2100, ___3269<T> &___3358)
  197. {
  198. REQUIRE(VALID_REF(___2100) || ___2100 == 0);
  199. size_t const count = ___2403(___2100);
  200. if (count != 0)
  201. {
  202. ___3358.reserve(count);
  203. ___3358.___3503(count);
  204. T *___3360 = &___3358[0];
  205. size_t ___2865 = 0;
  206. ___3493 ___2085;
  207. ___1472(___2085, ___2100)
  208. ___3360[___2865++] = static_cast<T>(___2085);
  209. }
  210. else
  211. {
  212. ___3358.___3503(0);
  213. }
  214. }
  215. }
  216. #endif