2017-09-27 29 views
0

다음은 FEM 문제를 해결하는 코드입니다.직접 솔버를 사용하여 선형 시스템을 풀기 위해 intel mkl 라이브러리를 사용하면 dss_create가 예외를 throw합니다.

방정식의 선형 시스템의 계수 행렬은 희박한 계수 행렬이기 때문에이 시스템을 해결하기 위해 intel mkl direct solver for sparse matrices을 사용하고 있습니다.

클래스는 선형 시스템을 해결하는 데 사용되며 간단한 문제가 있기 전에 시도해 보았습니다. 결과를 matlab과 비교하여 잘 작동합니다. 나는 모든 링크가 올바른지 확신하고 나는 전체 코드의 클래스를 사용하면 구성은 (는) "dss_create"명령에 나에게 다음과 같은 메시지를주는 64을

#pragma once 
#include <iostream> 
#include <mkl.h> 
using namespace std; 

class Solution 
{ 
private: 
    int *row, *col, nelx, nely; 
    double *K, *b; 
public: 
    Solution(double *x, double* xx, int* y, int* z, int ll, int nn) 
    { 
     K = x; 
     b = xx; 
     row = y; 
     col = z; 
     nelx = ll; 
     nely = nn; 
    } 
    double* f(); 
}; 

double* Solution::f() 
{ 
    int n = (nelx + 1)*(nely + 1) * 2, m = 868, l=1; 
    double *sol = new double[n]; 
    int *perm = new int[n]; 
    _MKL_DSS_HANDLE_t handle; 

    MKL_INT opt = MKL_DSS_ZERO_BASED_INDEXING; 
    dss_create(handle, opt); 

    // dss_define_structure 
    opt = MKL_DSS_NON_SYMMETRIC; 
    dss_define_structure(handle, opt, row, n, n, col, m); 

    // dss_reorder 
    opt = MKL_DSS_AUTO_ORDER; 
    dss_reorder(handle, opt, perm); 

    // dss_factor_real, dss_factor_complex 
    opt = MKL_DSS_POSITIVE_DEFINITE; 
    dss_factor_real(handle, opt, K); 

    // dss_solve_real, dss_solve_complex 
    opt = MKL_DSS_REFINEMENT_ON; 
    dss_solve_real(handle, opt, b, l, sol); 

    return sol; 
} 

로 설정되어

top88_class.exe의 0x000000007750F7E7 (ntdll.dll)에서 예외가 throw되었습니다. 0xC0000005 : 0x00000E0111350228 위치를 읽는 액세스 위반입니다.

이 예외에 대한 처리기가있는 경우 프로그램을 안전하게 계속 진행할 수 있습니다.

답변

0

나는이 문제를 파악했다. 이 클래스에 영향을주는 다른 클래스의 일부 선언에 실수가 있었는데 그 이유는 알 수 없습니다.