You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AppFlow/CFDStruct/CFDStructDataManager/CFDStructDataManager.cpp

129 lines
5.1 KiB
C++

#include "CFDStructDataManager.h"
#include "CFDStructDataSolverTimeModeManager.h"
#include "CFDStructDataSolverBasicModelManager.h"
#include "CFDStructDataSolverKvislManager.h"
#include "CFDStructDataSolverNumericalMethodManager.h"
#include "CFDStructDataSolverSportsAttributesManager.h"
#include "CFDStructDataSolverBoundaryConditionManager.h"
#include "CFDStructDataSolverInitializationManager.h"
#include "CFDStructDataSolverReferenceQuantityManager.h"
#include "CFDStructDataSolverComputingControlManager.h"
#include "CFDStructDataSolverMonitorResidualManager.h"
#include "CFDStructDataSolverMonitorAerodynamicManager.h"
#include "CFDStructDataSolverMonitorImpellerManager.h"
#include "CUIProperty/CUIConfig.h"
#include <rapidjson/writer.h>
#include <rapidjson/stringbuffer.h>
CFDStructDataManager *CFDStructDataManager::m_instance = NULL;
CFDStructDataManager::CFDStructDataManager()
{
this->initDataManagers();
}
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();
case SolutionAnalysisModuleProperty::Basic_Model:
res = m_solverBasicModeManager->getParamUIConfig();
case SolutionAnalysisModuleProperty::Viscosity_Model:
res = m_solverKvislManager->getParamUIConfig();
case SolutionAnalysisModuleProperty::NUumerical_Methods:
res = m_solverNumericalMethodManager->getParamUIConfig();
case SolutionAnalysisModuleProperty::Motion_Properties:
res = m_solverSportsAttributesManager->getParamUIConfig();
case SolutionAnalysisModuleProperty::Boundary_Conditions:
res = m_solverBoundaryConditionManager->getParamUIConfig();
case SolutionAnalysisModuleProperty::Initialization:
res = m_solverInitializationManager->getParamUIConfig();
case SolutionAnalysisModuleProperty::Computational_Control_Reference_Quantity:
res = m_solverReferenceQuantityManager->getParamUIConfig();
case SolutionAnalysisModuleProperty::Computational_Control:
res = m_solverComputingControlManager->getParamUIConfig();
case SolutionAnalysisModuleProperty::Monitors_Residual:
res = m_solverMonitorResidualManager->getParamUIConfig();
case SolutionAnalysisModuleProperty::Monitors_AerodynamicForce:
res = m_solverMonitorAerodynamicForceManager->getParamUIConfig();
case SolutionAnalysisModuleProperty::Monitors_Tubomachinery_Performance:
res = m_solverMonitorTubomachineryPerformanceManager->getParamUIConfig();
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.Clear();
m_dom.SetObject();
}
void CFDStructDataManager::updateJson()
{
m_dom.Clear();
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);
}
void CFDStructDataManager::printJson()
{
using namespace rapidjson;
StringBuffer buffer;
Writer<StringBuffer> writer(buffer);
m_dom.Accept(writer);
qDebug() << buffer.GetString();
}