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