23gsNewtonCotesRule<T>::init(
const gsBasis<T> & basis,
const T quA,
28 GISMO_ASSERT( fixDir < d && fixDir>-2,
"Invalid input fixDir = "<<fixDir);
30 std::vector<gsVector<T> > nodes(d);
31 std::vector<gsVector<T> > weights(d);
36 nodes [fixDir].setZero(1);
37 weights[fixDir].setConstant(1, 2.0);
43 for(i=0; i!=fixDir; ++i )
46 const index_t numNodes = cast<T,index_t>(quA *
static_cast<T
>(basis.degree(i)) +
static_cast<T
>(quB) +
static_cast<T
>(0.5));
48 computeReference(numNodes, nodes[i], weights[i]);
53 const index_t numNodes = cast<T,index_t>(quA *
static_cast<T
>(basis.degree(i)) +
static_cast<T
>(quB) +
static_cast<T
>(0.5));
54 computeReference(numNodes, nodes[i], weights[i]);
67 this->computeTensorProductRule(nodes, weights);
76 init(basis, quA, quB, fixDir);
85 const T quA = options.
getReal(
"quA");
87 init(basis, quA, quB, fixDir);
96 const index_t d = numNodes.rows();
99 std::vector<gsVector<T> > nodes(d);
100 std::vector<gsVector<T> > weights(d);
102 for (
index_t i = 0; i < d; ++i)
103 computeReference(numNodes[i], nodes[i], weights[i]);
105 this->computeTensorProductRule(nodes, weights);
110template<
class T>
void
122 w.setConstant(1,(T)(2));
129 for (i = 1; i < n-1; ++i)
130 x[i] = ( T ) (2*i-n+1) / (T)(n-1);
137 for (i = 0; i < n; ++i)
143 for (j = 2; j <= n; ++j)
144 for (k = j; k <= n; ++k)
145 d[n+j-k-1] = ( d[n+j-k-2] - d[n+j-k-1] ) / ( x[n-k] - x[n+j-k-1] );
147 for ( j = 1; j <= n - 1; ++j)
148 for ( k = 1; k <= n - j; ++k)
149 d[n-k-1] = d[n-k-1] - x[n-k-j] * d[n-k];
152 a = b = d[n-1] / (T)( n );
153 for ( j = n - 2; 0 <= j; --j)
155 const T dj1= d[j] / (T)(j+1);
A basis represents a family of scalar basis functions defined over a common parameter domain.
Definition gsBasis.h:79
void setNodes(gsVector< index_t > const &numNodes, unsigned digits=0)
Initialize quadrature rule with numNodes number of quadrature points per integration variable.
Definition gsNewtonCotesRule.hpp:92
gsNewtonCotesRule()
Default empty constructor.
Definition gsNewtonCotesRule.h:34
static void computeReference(index_t n, gsVector< T > &x, gsVector< T > &w)
Computes the Newton-Cotes quadrature rule with n nodes in the interval [-1,1].
Definition gsNewtonCotesRule.hpp:111
Class which holds a list of parameters/options, and provides easy access to them.
Definition gsOptionList.h:33
const index_t & getInt(const std::string &label) const
Reads value for option label from options.
Definition gsOptionList.cpp:37
Real getReal(const std::string &label) const
Reads value for option label from options.
Definition gsOptionList.cpp:44
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
Provides declaration of Basis abstract interface.
#define short_t
Definition gsConfig.h:35
#define index_t
Definition gsConfig.h:32
#define GISMO_UNUSED(x)
Definition gsDebug.h:112
#define GISMO_ASSERT(cond, message)
Definition gsDebug.h:89
Provides a list of labeled parameters/options that can be set and accessed easily.
The G+Smo namespace, containing all definitions for the library.