18 const unsigned& num_of_regions) :
64 problem =
" The Quadrature.Gauss method is trying to apply \n";
65 problem +=
" a Gauss rule with more points than 3. \n";
66 problem +=
" Currenlty only n=1,2,3 are supported! \n";
71 double c = 0.5 * (B + A);
72 double m = 0.5 * (B - A);
76 for(
unsigned i = 0; i < t.
size(); ++i) {
89 double x_left, x_right;
91 unsigned num = NODES.
size();
94 for(
unsigned i = 0; i < num - 1; ++i) {
98 x_right = NODES[ i + 1 ];
108 unsigned num = NODES.
size();
109 double h = (B - A) / num;
110 double x_left, x_right;
111 double f_left, f_right;
114 p_FN(x_left, f_left);
116 for(
unsigned i = 0; i < num; ++i) {
117 x_right = A + (i + 1) *
h;
118 p_FN(x_right, f_right);
119 sum += (f_left + f_right);
The collection of CppNoddy exceptions.
A specification for quadrature classes.
A spec for a collection of utility functions.
An DenseVector class – a dense vector object.
void push_back(const _Type &fill)
A pass-thru definition of push_back.
std::size_t size() const
A pass-thru definition to get the size of the vector.
void scale(const _Type &scale)
Scale each element of the vector, equivalent to *=.
A generic runtime exception.
A quadrature class that takes a function pointer.
double sub_Gauss(const int &n)
Evaluate the integral by applying an n-point Gauss rule on each of N sub-intervals.
void set_subintervals(const unsigned &n)
A set method to define a UNIFORM number of sub intervals.
double Gauss(const int &n)
n-point Gauss rule inefficiently written!
FnQuadrature(fn_ptr ptr_to_fn, const double &x1, const double &x2, const unsigned &num_of_regions)
Constructor.
double trapezium()
Quick trapezium summation again for sanity checking.
DenseVector< double > uniform_node_vector(const double &lower, const double &upper, const std::size_t &N)
Return a DENSE vector with the nodal points of a uniform mesh distributed between the upper/lower bou...
A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechani...