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_Interface/FITKInterfaceMeshGen/FITKMeshGenInterface.cpp

134 lines
3.8 KiB
C++

#include "FITKMeshGenInterface.h"
#include "FITKAbstractMeshSizeInfoGenerator.h"
#include "FITKRegionMeshSize.h"
#include "FITKGeometryMeshSize.h"
#include "FITKRegionGeometryRefine.h"
#include "FITKAbstractMesherDriver.h"
#include "FITKAbstractMeshProcessor.h"
#include "FITKAbstractGeometryMeshSizeGenerator.h"
#include "FITKZonePoints.h"
namespace Interface
{
//静态变量初始化
QMutex FITKMeshGenInterface::m_mutex;
FITKMeshGenInterface* FITKMeshGenInterface::_instance = nullptr;
FITKGlobalMeshSizeInfo* FITKMeshGenInterface::getGlobalMeshSizeInfo()
{
//全局尺寸为空则创建
if (_globalSize == nullptr && _meshSizeGenor != nullptr)
{
_globalSize = _meshSizeGenor->generateGlobalMeshSizeInfo();
}
//返回全局尺寸
return _globalSize;
}
void FITKMeshGenInterface::regMeshSizeGenerator(FITKAbstractMeshSizeInfoGenerator* genator)
{
_meshSizeGenor = genator;
}
Interface::FITKAbstractMeshSizeInfoGenerator* FITKMeshGenInterface::getMeshSizeGenerator()
{
return _meshSizeGenor;
}
void FITKMeshGenInterface::regGeometryMeshSizeGenerator(FITKAbstractGeometryMeshSizeGenerator* genator)
{
_geoMeshSizeGenor = genator;
}
FITKAbstractGeometryMeshSizeGenerator* FITKMeshGenInterface::getGeometryMeshSizeGenerator()
{
return _geoMeshSizeGenor;
}
void FITKMeshGenInterface::regMesherDriver(FITKAbstractMesherDriver* driver)
{
_mesherDriver = driver;
}
Interface::FITKAbstractMesherDriver* FITKMeshGenInterface::getMesherDriver()
{
return _mesherDriver;
}
void FITKMeshGenInterface::regMeshProcessor(FITKAbstractMeshProcessor* p)
{
_meshProcessor = p;
}
Interface::FITKAbstractMeshProcessor* FITKMeshGenInterface::getMeshProcessor()
{
return _meshProcessor;
}
FITKRegionMeshSizeManager* FITKMeshGenInterface::getRegionMeshSizeMgr()
{
return _regionMeshMgr;
}
FITKGeometryMeshSizeManager* FITKMeshGenInterface::getGeometryMeshSizeManager()
{
return _geoMeshSizeMgr;
}
Interface::FITKZonePointManager* FITKMeshGenInterface::getZonePointManager()
{
return _zonePointsManager;
}
FITKRegionGeometryRefineManager* FITKMeshGenInterface::getRegionGeometryRefineManager()
{
return _regionGeoRefineMgr;
}
void FITKMeshGenInterface::initialize()
{
//创建对象
_regionMeshMgr = new FITKRegionMeshSizeManager;
_geoMeshSizeMgr = new FITKGeometryMeshSizeManager;
_zonePointsManager = new FITKZonePointManager;
_regionGeoRefineMgr = new FITKRegionGeometryRefineManager;
}
void FITKMeshGenInterface::finalize()
{
//释放内存
if (_meshSizeGenor) delete _meshSizeGenor;
_meshSizeGenor = nullptr;
if (_regionMeshMgr) delete _regionMeshMgr;
_regionMeshMgr = nullptr;
if (_globalSize) delete _globalSize;
_globalSize = nullptr;
if (_mesherDriver) delete _mesherDriver;
_mesherDriver = nullptr;
if (_meshProcessor) delete _meshProcessor;
_meshProcessor = nullptr;
if (_geoMeshSizeMgr) delete _geoMeshSizeMgr;
_geoMeshSizeMgr = nullptr;
if (_geoMeshSizeGenor) delete _geoMeshSizeGenor;
_geoMeshSizeGenor = nullptr;
if (_zonePointsManager) delete _zonePointsManager;
_zonePointsManager = nullptr;
if (_regionGeoRefineMgr) delete _regionGeoRefineMgr;
_regionGeoRefineMgr = nullptr;
}
FITKMeshGenInterfaceDeleator::~FITKMeshGenInterfaceDeleator()
{
FITKMeshGenInterface* interface = FITKMeshGenInterface::getInstance();
delete interface;
FITKMeshGenInterface::_instance = nullptr;
}
static FITKMeshGenInterfaceDeleator __DELEATOR__;
}