いくつかの機能を拡張する必要があるため、コメントが非常に少ないコードを扱っています。変更が影響するかどうかを知るために、コードのすべての部分が何をするかを理解する必要があります。
このコードは、2D メッシュ生成 (ライブラリ Triangle を使用) を処理し、その上で PDE を解決しています。
ここに私が理解できないコードがあります:
void FiniteElement<Integrator, ORDER>::setPhiMaster()
{
Eigen::Matrix<Real,3*ORDER,1> coefficients;
for (auto i=0; i < 3*ORDER; i++)
{
coefficients = MatrixXr::Zero(3*ORDER,1);
coefficients(i) = 1;
for (auto iq=0; iq < Integrator::NNODES; iq++)
{
Real phi = evaluate_point<ORDER>(reference_,Integrator::NODES[iq],coefficients);
phiMapMaster_(i,iq) = phi;
}
}
}
最後に、正確に phiMapMaster_ とは何か、それをどのように使用できるかを知りたいです!
これはテンプレート クラス FiniteElement 内のメソッドであり、ORDER=1 と仮定し、Integrator:
class IntegratorTriangleP2{
public:
static const UInt ORDER = 1;
//Number of nodes
static const UInt NNODES = 3;
//Point locations
static const std::vector<Point> NODES;
static const std::vector<Real> WEIGHTS;
};
const std::vector<Real> IntegratorTriangleP2::WEIGHTS = std::vector<Real>{ {1./3, 1./3, 1./3} };
const std::vector<Point> IntegratorTriangleP2::NODES = std::vector<Point> { {Point(1./6,1./6),Point(2./3,1./6),Point(1./6,2./3)} };
(Point は std::complex と同じです)。ここでは、入力として三角形 (単純に 3 つの点を反時計回りに並べたもの)、点 (三角形の内部)、およびフーリエの係数を受け取るメソッド evaluate_point を示します。三角形で定義された基底
template <>
inline Real evaluate_point<1>(const Triangle<3>& t, const Point& point, const Eigen::Matrix<Real,3,1>& coefficients)
{
Eigen::Matrix<Real,3,1> bary_coeff = t.getBaryCoordinates(point);
//getBaryCoordinates retunrs the barycentric coordinates of the point wrt the triangle t
return(coefficients.dot(bary_coeff));
}