43 template <
unsigned int dim,
unsigned int spacedim>
69 double basis_value(
const unsigned int i,
const arma::vec::fixed<dim> &p)
const;
74 arma::vec::fixed<dim>
basis_grad(
const unsigned int i,
const arma::vec::fixed<dim> &p)
const;
81 arma::vec::fixed<dim>
basis_vector(
const unsigned int i,
const arma::vec::fixed<dim> &p)
const;
88 arma::mat::fixed<dim,dim>
basis_grad_vector(
const unsigned int i,
const arma::vec::fixed<dim> &p)
const;
137 template<
unsigned int dim,
unsigned int spacedim>
140 arma::vec::fixed<dim> sp;
144 number_of_dofs = dim+1;
145 number_of_single_dofs[dim] = dim+1;
147 sp.fill(1./max(1.,(
double)dim));
148 generalized_support_points.push_back(sp);
149 for (
unsigned int i=0; i<dim; i++)
151 sp.fill(1./max(1.,(
double)dim));
153 generalized_support_points.push_back(sp);
158 is_scalar_fe =
false;
160 compute_node_matrix();
163 template<
unsigned int dim,
unsigned int spacedim>
166 ASSERT(
false,
"basis_value() may not be called for vectorial finite element.");
171 template<
unsigned int dim,
unsigned int spacedim>
174 ASSERT(
false,
"basis_grad() may not be called for vectorial finite element.");
177 template<
unsigned int dim,
unsigned int spacedim>
180 ASSERT(i<n_raw_functions,
"Index of basis function is out of range.");
182 arma::vec::fixed<dim> v(p);
190 template<
unsigned int dim,
unsigned int spacedim>
193 ASSERT(i<n_raw_functions,
"Index of basis function is out of range.");
195 return arma::eye(dim,dim);
198 template<
unsigned int dim,
unsigned int spacedim>
201 arma::mat::fixed<n_raw_functions,dim+1> F;
202 arma::vec::fixed<dim> r;
223 for (
unsigned int i=0; i<n_raw_functions; i++)
235 r = basis_vector(i,generalized_support_points[0]);
242 F(i,0) = sum(r)/(1.*dim-1);
257 r = basis_vector(i,generalized_support_points[1]);
262 for (
unsigned int j=1; j<dim+1; j++)
264 r = basis_vector(i,generalized_support_points[j]);
265 F(i,j) = -r(j-1)/(1.*dim-1);
270 if (dim>0) node_matrix = inv(F);
274 template<
unsigned int dim,
unsigned int spacedim>
281 arma::mat::fixed<n_raw_functions,dim> raw_values;
282 arma::mat::fixed<dim+1,dim> shape_values;
283 vector<arma::vec> values;
286 values.resize(dim+1);
287 for (
unsigned int i=0; i<q.
size(); i++)
289 for (
unsigned int j=0; j<n_raw_functions; j++)
290 raw_values.row(j) = trans(basis_vector(j, q.
point(i)));
292 shape_values = node_matrix * raw_values;
294 for (
unsigned int j=0; j<dim+1; j++)
295 values[j] = trans(shape_values.row(j));
303 arma::mat::fixed<dim,dim> grad;
304 arma::mat::fixed<dim,dim> shape_grads;
305 vector<arma::mat> grads;
309 for (
unsigned int i=0; i<q.
size(); i++)
311 for (
unsigned int k=0; k<dim+1; k++)
314 for (
unsigned int l=0; l<n_raw_functions; l++)
315 grad += basis_grad_vector(l, q.
point(i)) * node_matrix(k,l);
326 template<
unsigned int dim,
unsigned int spacedim>
inline
340 template<
unsigned int dim,
unsigned int spacedim>
inline
349 vector<arma::vec::fixed<spacedim> > vectors;
350 vectors.resize(dim+1);
351 for (
unsigned int i = 0; i < q.
size(); i++)
353 for (
unsigned int k=0; k<dim+1; k++)
363 vector<arma::mat::fixed<spacedim,spacedim> > grads;
365 for (
unsigned int i = 0; i < q.
size(); i++)
367 for (
unsigned int k=0; k<dim+1; k++)