18#ifndef ITER_TRAPZ_LINE_QUAD_H
19#define ITER_TRAPZ_LINE_QUAD_H
32const Float ITER_TRAPZ_LINE_DEFAULT_TOL = 1
e-3;
58 throw std::domain_error(
59 std::string(
"IterativeTrapzLineQuadrature::set_starting_num_segments(): number of ") +
60 std::string(
"segments must be less than ") +
61 std::to_string(TRAPZ_LINE_MAX_NUM_SEGMENTS) +
".");
64 base::points_weights_computed_ =
false;
84 base::points_weights_computed_ =
false;
104 base::points_weights_computed_ =
false;
136 if (!base::points_weights_computed_)
137 throw std::runtime_error(
138 "IterativeTrapzLineQuadrature::converged(): must call `compute_points_weights()` first.");
152 bool converged_ =
false;
153 uint16_t starting_num_segments_ = 1;
154 uint16_t converged_num_segments_ = 0;
155 uint16_t max_iters_ = LINE_MAX_ORDER;
156 Float tol_ = ITER_TRAPZ_LINE_DEFAULT_TOL;
Class for iterative trapezoidal integration over a line segment.
void set_max_iters(const uint16_t max_iters)
Sets the maximum number of iterations allowed even if not converged.
bool converged() const
Checks whether the iterations converged.
void set_starting_num_segments(const uint16_t starting_num_segments)
Sets the initial number of sub-segments into which the given line segment is divided.
uint16_t starting_num_segments() const
Returns the initial number of sub-segments into which the given line segment is divided.
void compute_points_weights(ConstEigRef< EigColVecN< Float, dim > > p1, ConstEigRef< EigColVecN< Float, dim > > p2, std::function< EigRowVec< Complex >(ConstEigRef< EigMatNX< Float, dim > >)> eval={}) override
Computes and stores the points on which to evaluate the integrand, and the corresponding weights.
Float tol() const
Returns the relative convergence tolerance defining when iterations should stop.
uint16_t max_iters() const
Returns the maximum number of iterations allowed even if not converged.
void set_tol(const Float tol)
Sets the relative convergence tolerance defining when iterations should stop.
uint16_t converged_num_segments() const
Returns the number of sub-segments for which the iterations converged.
Base class for quadrature over a line segment.
const Eigen::Ref< const EigObj > ConstEigRef
Read-only reference to an Eigen object.
double Float
Floating point number.
Eigen::Matrix< T, N, 1 > EigColVecN
Fixed-size column vector of size N containing type T.
Primary namespace for the OpenBEM library.