|
int | lineLength (const std::string &line) |
| Find number of parameters in file import lines. More...
|
|
template<typename Stream > |
void | loadFile (Stream &gStream, const std::string &fileName) |
| Opens a stream with the specified file and verifies it has been opened correctly. More...
|
|
template<typename T > |
double | constantValueApprox (T func, const Triangle &triangle) |
| Approximates integral of func over triangle using constant value approximation. More...
|
|
template<typename T > |
double | linearInterpolationApprox (T func, const Triangle &triangle) |
| Approximates integral of func over triangle using linear interpolation approximation. More...
|
|
Namespace of utility functions.
template<typename T >
double Utils::constantValueApprox |
( |
T |
func, |
|
|
const Triangle & |
triangle |
|
) |
| |
Approximates integral of func over triangle using constant value approximation.
The integral of \( f(x,y) \) can be approximated as the value of the function at the circumcentre of the triangle \((O_{xT}, O_{yT})\) weighted by the triangle's area \( A_T \)
\[ \iint_T dxdy f(x,y) \approx A_T f(O_{xT}, O_{yT}) \]
- Template Parameters
-
T | function of signature double(double, double) |
- Parameters
-
func | numerical function returning value at point \((x,y)\) |
triangle | Triangle to approximate integral over |
- Returns
- approximated integral of function over triangle
template<typename T >
double Utils::linearInterpolationApprox |
( |
T |
func, |
|
|
const Triangle & |
triangle |
|
) |
| |
Approximates integral of func over triangle using linear interpolation approximation.
The integral of \( f(x,y) \) can be approximated as the value of the function at any point in the triangle weighted by the triangle's area \( A_T \) Given the barycentric coordinates of the point in the triangle \((\lambda_1, \lambda_2, \lambda_3)\) and a Triangle made up of points \(r_1, r_2, r_3\) where \(r_i = (x_i, y_i)\),
\[ \iint_T dxdy f(x,y) \approx A_T\left(\lambda_1f(x_1,y_1) + \lambda_2f(x_2,y_2) + \lambda_3f(x_3,y_3)\right) \]
- Template Parameters
-
T | function of signature double(double, double) |
- Parameters
-
func | numerical function returning value at point \((x,y)\) |
triangle | Triangle to approximate integral over |
- Returns
- approximated integral of function over triangle