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.

76 lines
5.6 KiB

3 days ago
#pragma once
#include <chain_process.hpp>
#include <base_integrator/GL_integrator.hpp>
#include <base_integrator/TS_integrator.hpp>
enum class axis : uint8_t { u, v };
enum class integrator_type : uint8_t { gauss_legendre, tanh_sinh };
// TODO: move this outwards, make a general sign definition to use everywhere
enum class sign_t : uint8_t { negative, zero, positive };
static constexpr auto strict_epsilon = 10 * std::numeric_limits<double>::epsilon();
struct double_error_hasher {
size_t operator()(double x) const { return std::hash<double>{}(x / strict_epsilon); }
};
struct chain_end_hasher {
size_t operator()(const Eigen::Vector2d& p) const { return hash_funcs(p, strict_epsilon); }
};
static constexpr auto sorted_double_equal = [](double lhs, double rhs) { return rhs - lhs <= strict_epsilon; };
static constexpr auto double_less = [](double lhs, double rhs) { return rhs - lhs > strict_epsilon; };
static constexpr auto gl_integrator = GLIntegrator<double>{};
static constexpr auto ts_integrator = TSIntegrator<double>{};
// intersections
stl_vector_mp<double> u_line_subface_intersection(const pcurve_relation_graph_t& pcurve_relation_graph,
uint32_t subface_index,
double x,
double y_start,
double y_end,
bool with_start,
bool with_end);
stl_vector_mp<double> v_line_subface_intersection(const pcurve_relation_graph_t& pcurve_relation_graph,
uint32_t subface_index,
double x,
double y_start,
double y_end,
bool with_start,
bool with_end);
// integrator helpers
void expand_integral_on_u(uint8_t q,
const pcurve_relation_graph_t& pcurve_relation_graph,
uint32_t subface_index,
double v,
double u_start,
double u_end,
bool with_start,
bool with_end,
double w_u,
std::function<double(int, int, double, double)>&& integrator_x,
std::function<double(int, int, double, double)>&& integrator_w,
stl_vector_mp<Eigen::Vector3d>& integral_points);
void expand_integral_on_v(uint8_t q,
const pcurve_relation_graph_t& pcurve_relation_graph,
uint32_t subface_index,
double u,
double v_start,
double v_end,
bool with_start,
bool with_end,
double w_v,
std::function<double(int, int, double, double)>&& integrator_x,
std::function<double(int, int, double, double)>&& integrator_w,
stl_vector_mp<Eigen::Vector3d>& integral_points);
stl_vector_mp<Eigen::Vector3d> calculate_tensor_product_points(uint8_t q);
void calculate_integral(uint8_t q,
const baked_blobtree_t& tree,
const pcurve_relation_graph_t& pcurve_relation_graph,
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);