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/FITK_Component/FITKMeshGenOF/FITKOFMeshProcessor.cpp

41 lines
1.6 KiB
C++

#include "FITKOFMeshProcessor.h"
#include "FITK_Interface/FITKInterfaceMesh/FITKUnstructuredFluidMeshVTK.h"
#include "FITK_Kernel/FITKAppFramework/FITKAppFramework.h"
#include "FITK_Kernel/FITKAppFramework/FITKGlobalData.h"
#include "FITK_Component/FITKOFMeshIO/FITKOFMeshReader.h"
#include "FITK_Kernel/FITKAppFramework/FITKComponents.h"
#include "FITK_Component/FITKCGNSIO/FITKCGNSIOInterface.h"
namespace OF
{
void FITKOFMeshProcessor::start(QStringList info /*= QStringList()*/)
{
QString path = getValue("WorkDir").toString();
Interface::FITKUnstructuredFluidMeshVTK* mesh = FITKAPP->getGlobalData()->getMeshData<Interface::FITKUnstructuredFluidMeshVTK>();
mesh->clearMesh();
// 读取网格
if (!path.isEmpty())
{
auto ofMeshReader = FITKAPP->getComponents()->getComponentTByName<IO::FITKOFMeshReader>("IO::FITKOFMeshReader");
if (ofMeshReader == nullptr) return;
ofMeshReader->setMeshFolder(path + "/constant/polyMesh/");
ofMeshReader->setMeshObj(mesh);
ofMeshReader->exec(0);
return;
}
path = getValue("MeshFile").toString();
if (!path.isEmpty() && path.endsWith(".cgns"))
{
auto ofMeshReader = FITKAPP->getComponents()->getComponentTByName<IO::FITKCGNSIOInterface>("IO::FITKCGNSIOInterface");
if (ofMeshReader == nullptr) return;
ofMeshReader->setFileName(path);
ofMeshReader->setMeshObj(mesh);
ofMeshReader->exec(1);
return;
}
}
}