public double Integrate(BoundaryElement <T> elem, T eta, Func <T, T, double> f, bool etaOnElement = false) { if (etaOnElement && eta is Point2D) { // TODO : works properly only for f == Ln(|x-y|). Improve for derivates also. // TODO : this is harcode. It uses fact that eta = element.Center, and hence eta=(fi1(0), fi2(0)), where fi1, fi2 - interpolation functions. var t = 0; var etaY = elem.Yakobian(new Point1D(t)); var exactIntegralPart = GetExactPart(t); return(elem.GetIntegrationPoints(n).Sum(p => f(eta, p.Point) * (p.Jacobian - etaY)) - etaY * exactIntegralPart); } return(elem.GetIntegrationPoints(n).Sum(p => p.Weight * p.Jacobian * f(eta, p.Point))); }
public double Integrate(BoundaryElement <T> elem1, BoundaryElement <T> elem2, Func <T, T, double> f) { return (elem1.GetIntegrationPoints(n).Sum( p1 => elem2.GetIntegrationPoints(n + 2).Sum( p2 => p1.Weight * p2.Weight * p1.Jacobian * p2.Jacobian * f(p1.Point, p2.Point)))); }
public double Integrate(BoundaryElement <T> elem, T eta, Func <T, double> f, Func <T, T, double> fundamental) { return(elem.GetIntegrationPoints(n).Sum(p => p.Weight * p.Jacobian * f(p.Point) * fundamental(eta, p.Point))); }