GBFieldData.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. #pragma once
  2. #include "otsdataconst.h"
  3. #include "OTSFieldData.h"
  4. #include "CGBLevel.h"
  5. #include <set>
  6. #include "GBParticle.h"
  7. namespace OTSGBCalculate
  8. {
  9. using namespace std;
  10. using namespace OTSDATA;
  11. const CString STR_Al = _T("Al");
  12. const CString STR_SI = _T("Si");
  13. const CString STR_O = _T("O");
  14. const CString STR_SUL = _T("S");
  15. const CString STR_N = _T("N");
  16. const CString STR_Mn = _T("Mn");
  17. const CString STR_Fe = _T("Fe");
  18. const CString STR_C = _T("C");
  19. const double MIN_ELEMENT_SUM = 0.02;
  20. const double RICH_ELEMENT_SUM = 5;
  21. class CGBFieldData : public COTSFieldData
  22. {
  23. public:
  24. CGBFieldData(); // constructor
  25. CGBFieldData(const CGBFieldData&); // copy constructor
  26. CGBFieldData(CGBFieldData*); // copy constructor
  27. CGBFieldData& operator=(const CGBFieldData&); // =operator
  28. BOOL operator==(const CGBFieldData&); // =operator
  29. virtual ~CGBFieldData(); // detractor
  30. void SetMyRect(COTSRect r) { m_myRect = r; }
  31. COTSRect GetMyRect() { return m_myRect; }
  32. // serialization
  33. virtual void Serialize(bool isStoring, tinyxml2::XMLDocument *classDoc, tinyxml2::XMLElement *rootNode);
  34. // id
  35. int GetFrameId() { return m_nFrameId; }
  36. void SetFrameId(int a_nFrameId) { m_nFrameId = a_nFrameId; }
  37. GB_GRADE_TYPE GetMyGrade(GB_LEVEL_TYPE type, GB_WIDTH_TYPE wide);
  38. // A level
  39. CGBLevelPtr GetALevel() { return m_pALevel; }
  40. // B level
  41. CGBLevelPtr GetBLevel() { return m_pBLevel; }
  42. // C level
  43. CGBLevelPtr GetCLevel() { return m_pCLevel; }
  44. // D level
  45. CGBLevelPtr GetDLevel() { return m_pDLevel; }
  46. // DS level
  47. CGBLevelPtr GetDSLevel() { return m_pDSLevel; }
  48. // D sulfide level
  49. CGBLevelPtr GetDSulfideLevel() { return m_pDSulfidLevel; }
  50. COTSParticlePtr FindAdjacentParticle(COTSParticlePtr p, COTSParticleList plist);
  51. // caculate Level
  52. //void CaculateLevel( OTSMODEL::GB_METHODE_TYPE a_nMethodType);
  53. COTSParticleList listAThinParticles;
  54. COTSParticleList listAWideParticles;
  55. COTSParticleList listASuperParticles;
  56. set<COTSParticlePtr> listBThinParticles;
  57. set<COTSParticlePtr> listBWideParticles;
  58. set<COTSParticlePtr> listBSuperParticles;
  59. COTSParticleList listCThinParticles;
  60. COTSParticleList listCWideParticles;
  61. COTSParticleList listCSuperParticles;
  62. COTSParticleList listDThinParticles;
  63. COTSParticleList listDWideParticles;
  64. COTSParticleList listDSuperParticles;
  65. COTSParticleList listDSParticles;
  66. COTSParticleList listDSulfideThinParticles;
  67. COTSParticleList listDSulfideWideParticles;
  68. COTSParticleList listDSulfideSuperParticles;
  69. COTSFieldDataList myReleventOTSFlds;
  70. std::map<COTSParticlePtr, GBParticle> mapAllParticles;
  71. std::vector <GBParticle> allMyParticles;
  72. void CaculateLevelByMethod1();
  73. // caculate Level by method 2
  74. void CaculateLevelByMethod2();
  75. void CaculateLevelASTM();
  76. void CaculateLevelDIN(COTSParticleList listParticle);
  77. BOOL IdentifyPartChemicalType(COTSParticlePtr Particle);
  78. protected:
  79. // cleanup
  80. void Cleanup();
  81. // initialization
  82. void Init();
  83. // duplication
  84. void Duplicate(const CGBFieldData& a_oSource);
  85. // caculate Level by method 1
  86. // caculate Level Width
  87. BOOL CaculateLevelThinWidth(COTSParticleList& a_listParticles, GB_LEVEL_TYPE a_nLevel);
  88. GB_WIDTH_TYPE CaculateLevelWidth(COTSParticlePtr Particle, GB_LEVEL_TYPE a_nLevel);
  89. BOOL CaculateLevelFatWidth(COTSParticleList& a_listParticles, GB_LEVEL_TYPE a_nLevel);
  90. BOOL CaculateSuper(COTSParticleList& a_listParticles, GB_LEVEL_TYPE a_nLevel);
  91. private:
  92. // id
  93. int m_nFrameId;
  94. COTSRect m_myRect;
  95. // A level
  96. CGBLevelPtr m_pALevel;
  97. // B level
  98. CGBLevelPtr m_pBLevel;
  99. // C level
  100. CGBLevelPtr m_pCLevel;
  101. // D level
  102. CGBLevelPtr m_pDLevel;
  103. // DS level
  104. CGBLevelPtr m_pDSLevel;
  105. // DSulfide level
  106. CGBLevelPtr m_pDSulfidLevel;
  107. };
  108. typedef std::shared_ptr<CGBFieldData> __declspec(dllexport) CGBFieldDataPtr;
  109. typedef std::vector<CGBFieldDataPtr> __declspec(dllexport) CGBFieldList;
  110. }