I'm dealing with a code that is really poorly commented, since I need to expand a few functionalities I need to understand what every piece of code does in order to know if my changes will affect it.
The code is dealing with 2D mesh generation (using library Triangle for it) and solving PDEs on it.
Here is the code I don't understand:
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;
}
}
}
In the end I would like to know what exactly is phiMapMaster_ and whats the possible use of it!
It is a method inside the template class FiniteElement, suppose ORDER=1, and 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 is the same as std::complex), and here is the method evaluate_point that takes as imput a triangle (simply 3 points counter-clockwise ordered), the point (which is internal to the triangle) and the coefficients of the Fourier basis defined on the triangle
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));
}