You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.2 KiB
38 lines
1.2 KiB
|
3 days ago
|
#pragma once
|
||
|
|
|
||
|
|
#include <integrand_handle.hpp>
|
||
|
|
#include <fwd_types.hpp>
|
||
|
|
|
||
|
|
#include <macros.h>
|
||
|
|
|
||
|
|
struct SIv2_API integrator {
|
||
|
|
auto eval_surf_int_by(const integrand_handle_base& handle) const
|
||
|
|
{
|
||
|
|
double result{};
|
||
|
|
for (auto i = 0; i < integral_points.size(); ++i) {
|
||
|
|
for (auto j = 0; j < integral_points[i].size(); ++j) {
|
||
|
|
const auto& p = integral_points[i][j];
|
||
|
|
result += surface_integral_weights[i][j] * handle.f(p.x(), p.y(), p.z());
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
return result * handle.w_without_grad();
|
||
|
|
}
|
||
|
|
|
||
|
|
auto eval_volu_int_by(const integrand_handle_base& handle) const
|
||
|
|
{
|
||
|
|
double result{};
|
||
|
|
for (auto i = 0; i < integral_points.size(); ++i) {
|
||
|
|
for (auto j = 0; j < integral_points[i].size(); ++j) {
|
||
|
|
const auto& p = integral_points[i][j];
|
||
|
|
result += volume_integral_weights[i][j] * handle.f(p.x(), p.y(), p.z());
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
return result * handle.w();
|
||
|
|
}
|
||
|
|
|
||
|
|
stl_vector_mp<stl_vector_mp<Eigen::Vector4d>> integral_points{};
|
||
|
|
stl_vector_mp<stl_vector_mp<double>> surface_integral_weights{};
|
||
|
|
stl_vector_mp<stl_vector_mp<double>> volume_integral_weights{};
|
||
|
|
};
|