要素 において、
スカラー関数
を数値積分する
関数のテンプレートは、以下のようになる。
/* 領域積分:二次元ボリューム */ void WH_Fem__Isoparam2D__Volume__int_S_f_whD_S__TEMPLATE (WH_Fem__Shape2DType shapeType, WH_Fem__Element2DType elementType, int nNodes, double whV_x_arrayIn[/* nNodes */][2], double a, double *OUT__int_S_f_whD_S) /* 入力引数: shapeType は要素形状のタイプ elementType は要素のタイプ nNodes は整数で、要素節点数 whV_x_arrayIn はベクトルの節点配列で、位置(節点座標) a はスカラーで、厚み 出力引数: OUT__int_S_f_whD_S はスカラーで、スカラー値の積分値 */ { int order; int nPoints; int Ip; /***********************************************/ /* このテンプレートの利用者は、ここを書き直す */ /***********************************************/ /* 関数 f の多項式の次数を2とする。*/ order = 2; *OUT__int_S_f_whD_S = 0.0; /* 次数 order に対応する積分点数 nPoints を得る */ WH_Fem__NumInt__Gauss2D__nPoints (shapeType, order, &nPoints); for (Ip = 0; Ip < nPoints; Ip++) { double whV_xi_Ip[2]; double w_Ip; double whP_N_whV_xi_arrayIn[6][2]; double whPt_whV_x_whV_xi[2][2]; double J_S; double f; /* 積分点 Ip の自然座標 whV_xi_Ip を得る */ WH_Fem__NumInt__Gauss2D__whV_xi_Ip (shapeType, order, Ip, whV_xi_Ip); /* 積分点 Ip の重み係数 w_Ip を得る */ WH_Fem__NumInt__Gauss2D__w_Ip (shapeType, order, Ip, &w_Ip); /* 変換子 J_Sを計算する */ WH_Fem__Shape2D__whP_N_whV_xi_arrayIn (elementType, nNodes, whV_xi_Ip, whP_N_whV_xi_arrayIn); WH_Fem__Isoparam2D__Volume__whPt_whV_x_whV_xi (nNodes, whP_N_whV_xi_arrayIn, whV_x_arrayIn, whPt_whV_x_whV_xi); WH_Fem__Isoparam2D__Volume__J_S (shapeType, whPt_whV_x_whV_xi, a, &J_S); /***********************************************/ /* このテンプレートの利用者は、ここを書き直す */ /***********************************************/ /* スカラー値 f を自然座標 whV_xi_Ip で評価する */ /* 例 f = 1.0 の場合 ( whV_xi_Ip は無視 ) */ f = 1.0; *OUT__int_S_f_whD_S += f * J_S * w_Ip; } }