|
|
|
|
@ -37,7 +37,7 @@ namespace {
|
|
|
|
|
|
|
|
|
|
const int CONST_PVT_POINT_COUNT = 200;
|
|
|
|
|
|
|
|
|
|
// PEBI 网格生成器和其 DLL 都使用进程级共享状态,所有公开读写入口必须串行化。
|
|
|
|
|
// 该锁只保护 PEBI 网格单例缓存;HX_NWTM.dll 的所有入口由独立进程级锁保护。
|
|
|
|
|
// 保留递归锁以兼容可能在持锁网格入口中调用缓存查询的旧代码路径。
|
|
|
|
|
QMutex s_oPebiGridMutex(QMutex::Recursive);
|
|
|
|
|
|
|
|
|
|
@ -1233,6 +1233,9 @@ bool nmCalculationPebiGrid::calculateSnapshot(
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 建网、模型求解和 Kriging 共用 DLL 全局状态,加载至读取结果期间必须串行。
|
|
|
|
|
QMutexLocker oDllLocker(
|
|
|
|
|
nmCalculationUtils::getHxNwtmDllMutex());
|
|
|
|
|
HMODULE hGridModule = LoadLibrary(L"HX_NWTM.dll");
|
|
|
|
|
if(hGridModule == nullptr) {
|
|
|
|
|
qWarning() << "Failed to load HX_NWTM.dll. Error code:"
|
|
|
|
|
@ -1293,6 +1296,11 @@ bool nmCalculationPebiGrid::calculateSnapshot(
|
|
|
|
|
oSnapshot.m_sLicensePath.toStdString());
|
|
|
|
|
oResult.m_nPebiCount = pfnGetPebiCount();
|
|
|
|
|
|
|
|
|
|
// 后续 VTK 构造只读取本次局部输出,无需继续占用进程级 DLL 锁。
|
|
|
|
|
FreeLibrary(hGridModule);
|
|
|
|
|
hGridModule = nullptr;
|
|
|
|
|
oDllLocker.unlock();
|
|
|
|
|
|
|
|
|
|
// 自动拟合只需要 DLL 数组,可跳过 VTK 构造;网格任务必须生成完整 VTK。
|
|
|
|
|
if(bCreateUnstructuredGrid) {
|
|
|
|
|
oResult.m_pUnstructuredGrid =
|
|
|
|
|
@ -1300,7 +1308,6 @@ bool nmCalculationPebiGrid::calculateSnapshot(
|
|
|
|
|
oResult.m_oGridOutput1);
|
|
|
|
|
if(oResult.m_pUnstructuredGrid == nullptr ||
|
|
|
|
|
oResult.m_pUnstructuredGrid->GetNumberOfCells() <= 0) {
|
|
|
|
|
FreeLibrary(hGridModule);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -1310,17 +1317,20 @@ bool nmCalculationPebiGrid::calculateSnapshot(
|
|
|
|
|
zxLogInstance::getInstance()->writeLogF(
|
|
|
|
|
QString("C++ Exception: %1").arg(e.what()));
|
|
|
|
|
logInputParameters(oSnapshot.m_oGridInput);
|
|
|
|
|
FreeLibrary(hGridModule);
|
|
|
|
|
if(hGridModule != nullptr) {
|
|
|
|
|
FreeLibrary(hGridModule);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
} catch(...) {
|
|
|
|
|
zxLogInstance::getInstance()->writeLogF(
|
|
|
|
|
"SEH Exception Occurred");
|
|
|
|
|
logInputParameters(oSnapshot.m_oGridInput);
|
|
|
|
|
FreeLibrary(hGridModule);
|
|
|
|
|
if(hGridModule != nullptr) {
|
|
|
|
|
FreeLibrary(hGridModule);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FreeLibrary(hGridModule);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|