#include "CFDStructDataManager.h" #include "CFDStructDataSolverBasicModelManager.h" #include "CFDStructDataSolverKvislManager.h" #include "CFDStructDataSolverNumericalMethodManager.h" #include "CFDStructDataSolverTimeModeManager.h" #include "CFDStructDataSolverBoundaryConditionManager.h" #include "CFDStructDataSolverComputingControlManager.h" #include "CFDStructDataSolverInitializationManager.h" #include "CFDStructDataSolverMonitorAerodynamicManager.h" #include "CFDStructDataSolverMonitorImpellerManager.h" #include "CFDStructDataSolverMonitorResidualManager.h" #include "CFDStructDataSolverReferenceQuantityManager.h" #include "CFDStructDataSolverSportsAttributesManager.h" #include "CUIProperty/CUIConfig.h" #include #include CFDStructDataManager *CFDStructDataManager::m_instance = NULL; CFDStructDataManager::CFDStructDataManager() { this->initDataManagers(); this->initJson(); } CFDStructDataManager *CFDStructDataManager::getInstance() { if (m_instance == nullptr) { m_instance = new CFDStructDataManager; } return m_instance; } CUIConfig *CFDStructDataManager::getActionParamUIConfig(SolutionAnalysisModuleProperty sig, QVariant idx) { if (m_solverBoundaryConditionManager == nullptr) { qDebug() << "manager is null"; } CUIConfig *res = nullptr; switch (sig) { case SolutionAnalysisModuleProperty::Time_Mode: res = m_solverTimeModeManager->getParamUIConfig(); break; case SolutionAnalysisModuleProperty::Basic_Model: res = m_solverBasicModeManager->getParamUIConfig(); break; case SolutionAnalysisModuleProperty::Viscosity_Model: res = m_solverKvislManager->getParamUIConfig(); break; case SolutionAnalysisModuleProperty::NUumerical_Methods: res = m_solverNumericalMethodManager->getParamUIConfig(); break; case SolutionAnalysisModuleProperty::Motion_Properties: res = m_solverSportsAttributesManager->getParamUIConfig(); break; case SolutionAnalysisModuleProperty::Boundary_Conditions: res = m_solverBoundaryConditionManager->getParamUIConfig(); break; case SolutionAnalysisModuleProperty::Initialization: res = m_solverInitializationManager->getParamUIConfig(); break; case SolutionAnalysisModuleProperty::Computational_Control_Reference_Quantity: res = m_solverReferenceQuantityManager->getParamUIConfig(); break; case SolutionAnalysisModuleProperty::Computational_Control: res = m_solverComputingControlManager->getParamUIConfig(); break; case SolutionAnalysisModuleProperty::Monitors_Residual: res = m_solverMonitorResidualManager->getParamUIConfig(); break; case SolutionAnalysisModuleProperty::Monitors_AerodynamicForce: res = m_solverMonitorAerodynamicForceManager->getParamUIConfig(); break; case SolutionAnalysisModuleProperty::Monitors_Tubomachinery_Performance: res = m_solverMonitorTubomachineryPerformanceManager->getParamUIConfig(); break; default: break; } if (res == nullptr) qDebug() << "DataManager return null CUIConfig"; return res; } void CFDStructDataManager::initDataManagers() { m_solverTimeModeManager = new CFDStructDataSolverTimeModeManager; m_solverBasicModeManager = new CFDStructDataSolverBasicModelManager; m_solverKvislManager = new CFDStructDataSolverKvislManager; m_solverNumericalMethodManager = new CFDStructDataSolverNumericalMethodManager; m_solverSportsAttributesManager = new CFDStructDataSolverSportsAttributesManager; m_solverBoundaryConditionManager = new CFDStructDataSolverBoundaryConditionManager; m_solverInitializationManager = new CFDStructDataSolverInitializationManager; m_solverReferenceQuantityManager = new CFDStructDataSolverReferenceQuantityManager; m_solverComputingControlManager = new CFDStructDataSolverComputingControlManager; m_solverMonitorResidualManager = new CFDStructDataSolverMonitorResidualManager; m_solverMonitorAerodynamicForceManager = new CFDStructDataSolverMonitorAerodynamicManager; m_solverMonitorTubomachineryPerformanceManager = new CFDStructDataSolverMonitorImpellerManager; } void CFDStructDataManager::initJson() { m_dom.SetObject(); } void CFDStructDataManager::updateJson() { m_dom.SetObject(); m_solverTimeModeManager->saveDataToDom(m_dom); m_solverBasicModeManager->saveDataToDom(m_dom); m_solverKvislManager->saveDataToDom(m_dom); m_solverNumericalMethodManager->saveDataToDom(m_dom); m_solverSportsAttributesManager->saveDataToDom(m_dom); m_solverBoundaryConditionManager->saveDataToDom(m_dom); m_solverInitializationManager->saveDataToDom(m_dom); m_solverReferenceQuantityManager->saveDataToDom(m_dom); m_solverComputingControlManager->saveDataToDom(m_dom); m_solverMonitorResidualManager->saveDataToDom(m_dom); m_solverMonitorAerodynamicForceManager->saveDataToDom(m_dom); m_solverMonitorTubomachineryPerformanceManager->saveDataToDom(m_dom); } #include "CFDStructMain/CFDStructMainUtils.h" #include void CFDStructDataManager::printJson() { using namespace rapidjson; StringBuffer buffer; Writer writer(buffer); m_dom.Accept(writer); CFDStructMainUtils::write(caseJSONPath, buffer.GetString()); } int CFDStructDataManager::getTimeModeRunTime() { return m_solverTimeModeManager->getRunType(); }