FieldData_s.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. #pragma once
  2. #include "ThirdPartyHeadersBegin.h"
  3. #include <limits>
  4. #include <vector>
  5. #include <boost/make_shared.hpp>
  6. #include <boost/shared_ptr.hpp>
  7. #include "ThirdPartyHeadersEnd.h"
  8. #include "MASTER.h"
  9. #include "GLOBAL.h"
  10. #include "CodeContract.h"
  11. #include "fileio.h"
  12. struct ___1362
  13. {
  14. static double const GHOST_VALUE;
  15. typedef boost::shared_ptr<___1362> Ptr;
  16. FieldDataType_e ___2459;
  17. size_t ___2668;
  18. ValueLocation_e ___2669;
  19. ___1362();
  20. virtual ~___1362();
  21. virtual void ___3504(size_t index, double ___4314) = 0;
  22. virtual double ___1780(size_t index) = 0;
  23. virtual void appendValue(double ___4314) = 0;
  24. virtual void reserveValues(size_t count) = 0;
  25. virtual void assignValues(size_t count, double ___4314) = 0;
  26. virtual void *getRawPointer() = 0;
  27. virtual size_t storedValueCount() = 0;
  28. void ___1759(double &minVal, double &maxVal) const;
  29. void ___3499(double minVal, double maxVal);
  30. virtual void writeToFile(tecplot::___3933::FileWriterInterface &outputFile, bool ___4480) const = 0;
  31. virtual uint64_t sizeInFile(bool ___4480) const = 0;
  32. virtual void readFromFile(tecplot::___3933::___1399 &inputFile, bool readASCII) = 0;
  33. static Ptr makePtr(tecplot::___3933::___1399 &inputFile, bool readASCII);
  34. protected:
  35. void updateMinMax(double ___4314);
  36. double m_minValue;
  37. double m_maxValue;
  38. };
  39. namespace tecplot
  40. {
  41. namespace tecioszl
  42. {
  43. template <typename T>
  44. class TypedFieldData : public ___1362
  45. {
  46. public:
  47. TypedFieldData();
  48. void ___3504(size_t index, double ___4314);
  49. double ___1780(size_t index);
  50. void appendValue(double ___4314);
  51. void reserveValues(size_t count);
  52. void assignValues(size_t count, double ___4314);
  53. void *getRawPointer();
  54. size_t storedValueCount();
  55. virtual void writeToFile(tecplot::___3933::FileWriterInterface &outputFile, bool ___4480) const;
  56. virtual uint64_t sizeInFile(bool ___4480) const;
  57. virtual void readFromFile(tecplot::___3933::___1399 &inputFile, bool readASCII);
  58. private:
  59. std::vector<T> ___2671;
  60. };
  61. class TypedFieldDataFactory
  62. {
  63. public:
  64. boost::shared_ptr<___1362> make(FieldDataType_e type);
  65. };
  66. }
  67. }
  68. inline ___1362::___1362() : ___2459(FieldDataType_Float), ___2668(0), ___2669(___4330), m_minValue(std::numeric_limits<double>::max()), m_maxValue(-std::numeric_limits<double>::max()) {}
  69. inline ___1362::~___1362() {}
  70. inline void ___1362::___1759(double &minVal, double &maxVal) const
  71. {
  72. minVal = m_minValue;
  73. maxVal = m_maxValue;
  74. if (maxVal < minVal)
  75. {
  76. minVal = 0.0;
  77. maxVal = 0.0;
  78. }
  79. }
  80. inline void ___1362::___3499(double minVal, double maxVal)
  81. {
  82. m_minValue = minVal;
  83. m_maxValue = maxVal;
  84. }
  85. inline ___1362::Ptr ___1362::makePtr(tecplot::___3933::___1399 &inputFile, bool readASCII)
  86. {
  87. FieldDataType_e ___1363;
  88. READ_ENUM(___1363, FieldDataType_e, inputFile, readASCII);
  89. Ptr ___1351 = tecplot::tecioszl::TypedFieldDataFactory().make(___1363);
  90. ___1351->readFromFile(inputFile, readASCII);
  91. return ___1351;
  92. }
  93. inline void ___1362::updateMinMax(double ___4314)
  94. {
  95. if (___4314 == ___4314)
  96. {
  97. m_minValue = std::min(m_minValue, ___4314);
  98. m_maxValue = std::max(m_maxValue, ___4314);
  99. }
  100. }
  101. namespace tecplot
  102. {
  103. namespace tecioszl
  104. {
  105. template <typename T>
  106. inline TypedFieldData<T>::TypedFieldData() {}
  107. template <typename T>
  108. inline void TypedFieldData<T>::___3504(size_t index, double ___4314)
  109. {
  110. ___2671[index] = static_cast<T>(___4314);
  111. updateMinMax(___4314);
  112. }
  113. template <typename T>
  114. inline double TypedFieldData<T>::___1780(size_t index) { return static_cast<double>(___2671[index]); }
  115. template <typename T>
  116. inline void TypedFieldData<T>::appendValue(double ___4314)
  117. {
  118. ___2671.push_back(static_cast<T>(___4314));
  119. updateMinMax(___4314);
  120. }
  121. template <typename T>
  122. inline void TypedFieldData<T>::reserveValues(size_t count) { ___2671.reserve(count); }
  123. template <typename T>
  124. inline void TypedFieldData<T>::assignValues(size_t count, double ___4314)
  125. {
  126. ___2671.assign(count, static_cast<T>(___4314));
  127. updateMinMax(___4314);
  128. }
  129. template <typename T>
  130. inline void *TypedFieldData<T>::getRawPointer()
  131. {
  132. if (___2671.empty())
  133. return NULL;
  134. return (reinterpret_cast<void *>(&___2671[0]));
  135. }
  136. template <typename T>
  137. inline size_t TypedFieldData<T>::storedValueCount() { return ___2671.size(); }
  138. inline boost::shared_ptr<___1362> TypedFieldDataFactory::make(FieldDataType_e type)
  139. {
  140. boost::shared_ptr<___1362> ___3358;
  141. switch (type)
  142. {
  143. case FieldDataType_Float:
  144. ___3358 = boost::make_shared<TypedFieldData<float>>();
  145. break;
  146. case FieldDataType_Double:
  147. ___3358 = boost::make_shared<TypedFieldData<double>>();
  148. break;
  149. case FieldDataType_Int32:
  150. ___3358 = boost::make_shared<TypedFieldData<int32_t>>();
  151. break;
  152. case FieldDataType_Int16:
  153. ___3358 = boost::make_shared<TypedFieldData<int16_t>>();
  154. break;
  155. case FieldDataType_Byte:
  156. case ___1365:
  157. ___3358 = boost::make_shared<TypedFieldData<uint8_t>>();
  158. break;
  159. default:
  160. ___478(___1305);
  161. ___3358 = boost::make_shared<TypedFieldData<float>>();
  162. break;
  163. }
  164. ___3358->___2459 = type;
  165. return ___3358;
  166. }
  167. template <typename T>
  168. inline void TypedFieldData<T>::writeToFile(tecplot::___3933::FileWriterInterface &outputFile, bool ___4480) const
  169. {
  170. tecplot::tecioszl::writeScalar(outputFile, (uint32_t)___2459, ___4480);
  171. tecplot::tecioszl::writeScalar(outputFile, (uint64_t)___2668, ___4480);
  172. tecplot::tecioszl::writeScalar(outputFile, (uint32_t)___2669, ___4480);
  173. tecplot::tecioszl::writeScalar(outputFile, m_minValue, ___4480);
  174. tecplot::tecioszl::writeScalar(outputFile, m_maxValue, ___4480);
  175. tecplot::tecioszl::writeVector(outputFile, ___2671, ___4480);
  176. }
  177. template <typename T>
  178. uint64_t TypedFieldData<T>::sizeInFile(bool ___4480) const { return tecplot::tecioszl::scalarSizeInFile((uint32_t)___2459, ___4480) + tecplot::tecioszl::scalarSizeInFile((uint64_t)___2668, ___4480) + tecplot::tecioszl::scalarSizeInFile((uint32_t)___2669, ___4480) + tecplot::tecioszl::scalarSizeInFile(m_minValue, ___4480) + tecplot::tecioszl::scalarSizeInFile(m_maxValue, ___4480) + tecplot::tecioszl::vectorSizeInFile(___2671, ___4480); }
  179. template <typename T>
  180. inline void TypedFieldData<T>::readFromFile(tecplot::___3933::___1399 &inputFile, bool readASCII)
  181. {
  182. tecplot::tecioszl::readScalar(inputFile, ___2668, readASCII);
  183. uint32_t tempValueLocation;
  184. tecplot::tecioszl::readScalar(inputFile, tempValueLocation, readASCII);
  185. ___2669 = static_cast<ValueLocation_e>(tempValueLocation);
  186. tecplot::tecioszl::readScalar(inputFile, m_minValue, readASCII);
  187. tecplot::tecioszl::readScalar(inputFile, m_maxValue, readASCII);
  188. tecplot::tecioszl::readVector(inputFile, ___2671, readASCII);
  189. }
  190. }
  191. }