OrthogonalBisection.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #pragma once
  2. #include "SzlFileLoader.h"
  3. #include "AltTecUtil.h"
  4. #include "FieldData.h"
  5. namespace tecplot
  6. {
  7. namespace ___3933
  8. {
  9. class OrthogonalBisection
  10. {
  11. UNCOPYABLE_CLASS(OrthogonalBisection);
  12. public:
  13. enum BisectionType_e
  14. {
  15. BisectionType_ZoneCells,
  16. BisectionType_ZoneNodes
  17. };
  18. private:
  19. static ___4352 const NUM_BISECTION_DIRECTIONS = 3;
  20. static ___2090::SubzoneOffset_t const MAX_THREADS_PER_CORE = 4;
  21. static ___81 const MIN_THREADED_ITEM_RANGE_SIZE = 256;
  22. static ___81 const MIN_THREADED_SUBZONE_RANGE_SIZE = 1;
  23. ___4636 const ___2677;
  24. BisectionType_e const m_bisectionType;
  25. ___2090::ItemOffset_t const m_maxDomainSize;
  26. ___2090::SubzoneOffset_t m_maxThreadedJobs;
  27. ___2090::SubzoneOffset_t m_maxRecursion;
  28. ___81 m_numItems;
  29. ___81 m_numGhostItems;
  30. ___2090::SubzoneOffset_t m_numRecursionDepths;
  31. ___2090::SubzoneOffset_t m_numDomains;
  32. ___2240<___81> m_itemList;
  33. ZoneType_e ___2684;
  34. ___2240<FieldDataPtr> m_nodalFieldDataPtrs;
  35. ___2240<FieldDataPtr> m_ccFieldDataPtrs;
  36. ___2240<UInt8Array> m_reducedPrecisionSortDataArrays;
  37. public:
  38. OrthogonalBisection(___4636 zone, BisectionType_e bisectionType, ___2090::ItemOffset_t maxDomainSize);
  39. ~OrthogonalBisection();
  40. ___372 performBisection(___37 &___36);
  41. ___372 getSzCoordByOriginalItemArray(___37 &___36, ItemAddressArray &szCoordsOfOriginalItems);
  42. ___81 queryNumItems() const { return m_numItems; }
  43. ___81 queryNumGhostItems() const { return m_numGhostItems; }
  44. ___81 queryPositionbyOffset(___81 ___2865) const { return m_itemList[___2865]; }
  45. ___2090::SubzoneOffset_t queryNumberDomains() const { return m_numDomains; }
  46. inline ___2090::ItemOffset_t getDomainSize(___2090::SubzoneOffset_t domain) const
  47. {
  48. REQUIRE(domain < m_numDomains);
  49. ___2090::ItemOffset_t domainSize;
  50. if (domain < m_numDomains - 1)
  51. domainSize = m_maxDomainSize;
  52. else
  53. {
  54. domainSize = (m_numItems % m_maxDomainSize);
  55. if (domainSize == 0)
  56. domainSize = m_maxDomainSize;
  57. ___478(m_maxDomainSize * (m_numDomains - 1) + domainSize == m_numItems);
  58. }
  59. ENSURE(domainSize > 0 && domainSize <= ___2090::MAX_ITEM_OFFSET + 1);
  60. return domainSize;
  61. }
  62. void ___937(void);
  63. private:
  64. ___372 updateStatusLine(___37 &___36, ___2090::SubzoneOffset_t recursionDepth);
  65. ___372 loadCoordinateVarZoneFieldData(___37 &___36, char axis);
  66. inline void getJobStartEndForRange(___81 rangeStart, ___81 ___3268, ___2090::SubzoneOffset_t ___2118, ___2090::SubzoneOffset_t numJobs, ___81 &jobStart, ___81 &jobEnd)
  67. {
  68. REQUIRE(rangeStart < m_numItems);
  69. REQUIRE(___3268 > 0 && rangeStart + ___3268 <= m_numItems);
  70. REQUIRE(___2118 < numJobs);
  71. REQUIRE(numJobs > 0);
  72. jobStart = ___81(rangeStart + (uint64_t(___3268) * ___2118) / numJobs);
  73. jobEnd = ___81(rangeStart + (uint64_t(___3268) * (___2118 + 1)) / numJobs);
  74. ENSURE(rangeStart <= jobStart && jobStart < jobEnd && jobEnd <= m_numItems);
  75. ENSURE(IMPLICATION(___2118 == 0, jobStart == rangeStart));
  76. ENSURE(IMPLICATION(___2118 == numJobs - 1, jobEnd == rangeStart + ___3268));
  77. }
  78. void getMinMaxWeightOverRange(___81 rangeStart, ___81 rangeEnd, ___2090::SubzoneOffset_t ___2118, ___2090::SubzoneOffset_t numJobs, ___4352 axisDirToSplit, ___2479 &weightMinMax);
  79. void rescaleWeightsOverRange(___81 rangeStart, ___81 ___3268, ___2090::SubzoneOffset_t ___2118, ___2090::SubzoneOffset_t numJobs, ___4352 axisDirToSplit, double scale, double ___2865);
  80. ___372 calcReducedPrecisionValues(___37 &___36, ___81 const domainStart, ___81 const domainSize, ___4352 const axisDirToSplit, ___2090::SubzoneOffset_t const recursionDepth);
  81. ___372 splitDomain(___37 &___36, ___81 const domainStart, ___81 const domainSize, ___4352 const axisDirToSplit, ___2090::SubzoneOffset_t const recursionDepth, ___2120 ___2119);
  82. void getSzCoordsByRange(___81 rangeStart, ___81 ___3268, ___2090::SubzoneOffset_t ___2118, ___2090::SubzoneOffset_t numJobs, ItemAddressArray &szCoordArray);
  83. ___2090::SubzoneOffset_t calcNumDomains() const { return ___2090::SubzoneOffset_t((m_numItems + m_maxDomainSize - 1) / m_maxDomainSize); }
  84. void getSubdomainInfo(___81 domainStart, ___81 domainSize, ___81 &leftOffset, ___81 &leftSize, ___81 &rightOffset, ___81 &rightSize) const
  85. {
  86. REQUIRE(domainSize > 0);
  87. INVARIANT(m_maxDomainSize > 0);
  88. ___81 localDomainSplitSize = m_maxDomainSize;
  89. while (localDomainSplitSize < (domainSize + 1) / 2)
  90. {
  91. localDomainSplitSize *= 2;
  92. ___478(localDomainSplitSize > 0);
  93. }
  94. ___478(localDomainSplitSize < domainSize && domainSize <= 2 * int64_t(localDomainSplitSize));
  95. leftOffset = domainStart;
  96. leftSize = localDomainSplitSize * ___81((domainSize + int64_t(localDomainSplitSize) * 2 - 1) / (int64_t(localDomainSplitSize) * 2));
  97. rightOffset = domainStart + leftSize;
  98. rightSize = domainSize - leftSize;
  99. ENSURE(leftSize >= localDomainSplitSize && leftSize < domainSize);
  100. ENSURE(leftSize >= localDomainSplitSize && rightSize < domainSize);
  101. }
  102. ___2090::SubzoneOffset_t calcNumRecursionDepths() const
  103. {
  104. ___2090::SubzoneOffset_t numRecursionDepths = 0;
  105. ___81 largestDomainOffset = 0;
  106. ___81 largestDomainSize = m_numItems;
  107. while (largestDomainSize > m_maxDomainSize)
  108. {
  109. ___81 leftOffset;
  110. ___81 leftSize;
  111. ___81 rightOffset;
  112. ___81 rightSize;
  113. getSubdomainInfo(largestDomainOffset, largestDomainSize, leftOffset, leftSize, rightOffset, rightSize);
  114. if (leftSize >= rightSize)
  115. {
  116. largestDomainSize = leftSize;
  117. largestDomainOffset = leftOffset;
  118. }
  119. else
  120. {
  121. largestDomainSize = rightSize;
  122. largestDomainOffset = rightOffset;
  123. }
  124. numRecursionDepths++;
  125. }
  126. return numRecursionDepths;
  127. }
  128. };
  129. }
  130. }