* and will be copied into the
* member variable @p{polynomials}.
*/
- TensorProductPolynomials(const std::vector<SmartPointer<Polynomial<double> > > &pols);
+ template<class Pol>
+ TensorProductPolynomials(const std::vector<Pol> &pols);
/**
* Calculates the polynomials
private:
/**
- * Pointer to the @p{polynomials}
- * given to the constructor.
+ * Copy of the vector @p{pols} of
+ * polynomials given to the
+ * constructor.
*/
- std::vector<SmartPointer<Polynomial<double> > > polynomials;
+ std::vector<Polynomial<double> > polynomials;
/**
* Number of tensor product
* polynomials this is $n^dim$.
*/
const unsigned int n_tensor_pols;
+
+
+ static unsigned int power(const unsigned int x, const unsigned int y);
};
+template <int dim>
+template <class Pol>
+TensorProductPolynomials<dim>::TensorProductPolynomials(
+ const std::vector<Pol> &pols):
+ polynomials (pols.begin(), pols.end()),
+ n_tensor_pols(power(pols.size(), dim))
+{}
+
+
+
#endif
-template<typename number> static
-number power(number x, unsigned int y)
+template <int dim>
+unsigned int TensorProductPolynomials<dim>::power(const unsigned int x,
+ const unsigned int y)
{
- number value=1;
+ unsigned int value=1;
for (unsigned int i=0; i<y; ++i)
value*=x;
return value;
}
-
-template <int dim>
-TensorProductPolynomials<dim>::TensorProductPolynomials(
- const std::vector<SmartPointer<Polynomial<double> > > &pols):
- polynomials(pols),
- n_tensor_pols(power(polynomials.size(), dim))
-{}
-
-
template <int dim>
void TensorProductPolynomials<dim>::compute(
const Point<dim> &p,
std::vector<std::vector<double> > &v_d=v[d];
Assert(v_d.size()==n_pols, ExcInternalError());
for (unsigned int i=0; i<n_pols; ++i)
- polynomials[i]->value(p(d), v_d[i]);
+ polynomials[i].value(p(d), v_d[i]);
}
if (update_values)