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;
142 template<
unsigned int dim,
unsigned int spacedim>
145 arma::vec::fixed<dim> sp;
149 number_of_dofs = dim+1;
150 number_of_single_dofs[dim] = dim+1;
152 sp.fill(1./max(1.,(
double)dim));
153 generalized_support_points.push_back(sp);
154 for (
unsigned int i=0; i<dim; i++)
156 sp.fill(1./max(1.,(
double)dim));
158 generalized_support_points.push_back(sp);
163 is_scalar_fe =
false;
165 compute_node_matrix();
168 template<
unsigned int dim,
unsigned int spacedim>
171 ASSERT(
false,
"basis_value() may not be called for vectorial finite element.");
176 template<
unsigned int dim,
unsigned int spacedim>
179 ASSERT(
false,
"basis_grad() may not be called for vectorial finite element.");
180 return arma::vec::fixed<dim>();
183 template<
unsigned int dim,
unsigned int spacedim>
186 ASSERT(i<n_raw_functions,
"Index of basis function is out of range.");
188 arma::vec::fixed<dim> v(p);
196 template<
unsigned int dim,
unsigned int spacedim>
199 ASSERT(i<n_raw_functions,
"Index of basis function is out of range.");
201 return arma::eye(dim,dim);
204 template<
unsigned int dim,
unsigned int spacedim>
207 arma::mat::fixed<n_raw_functions,dim+1> F;
208 arma::vec::fixed<dim> r;
229 for (
unsigned int i=0; i<n_raw_functions; i++)
241 r = basis_vector(i,generalized_support_points[0]);
248 F(i,0) = sum(r)/(1.*dim-1);
263 r = basis_vector(i,generalized_support_points[1]);
268 for (
unsigned int j=1; j<dim+1; j++)
270 r = basis_vector(i,generalized_support_points[j]);
271 F(i,j) = -r(j-1)/(1.*dim-1);
276 if (dim>0) node_matrix = inv(F);
280 template<
unsigned int dim,
unsigned int spacedim>
287 arma::mat::fixed<n_raw_functions,dim> raw_values;
288 arma::mat::fixed<dim+1,dim> shape_values;
289 vector<arma::vec> values;
292 values.resize(dim+1);
293 for (
unsigned int i=0; i<q.
size(); i++)
295 for (
unsigned int j=0; j<n_raw_functions; j++)
296 raw_values.row(j) = trans(basis_vector(j, q.
point(i)));
298 shape_values = node_matrix * raw_values;
300 for (
unsigned int j=0; j<dim+1; j++)
301 values[j] = trans(shape_values.row(j));
309 arma::mat::fixed<dim,dim> grad;
310 arma::mat::fixed<dim,dim> shape_grads;
311 vector<arma::mat> grads;
315 for (
unsigned int i=0; i<q.
size(); i++)
317 for (
unsigned int k=0; k<dim+1; k++)
320 for (
unsigned int l=0; l<n_raw_functions; l++)
321 grad += basis_grad_vector(l, q.
point(i)) * node_matrix(k,l);
332 template<
unsigned int dim,
unsigned int spacedim>
inline
346 template<
unsigned int dim,
unsigned int spacedim>
inline
355 vector<arma::vec::fixed<spacedim> > vectors;
356 vectors.resize(dim+1);
357 for (
unsigned int i = 0; i < q.
size(); i++)
359 for (
unsigned int k=0; k<dim+1; k++)
369 vector<arma::mat::fixed<spacedim,spacedim> > grads;
371 for (
unsigned int i = 0; i < q.
size(); i++)
373 for (
unsigned int k=0; k<dim+1; k++)
UpdateFlags
Enum type UpdateFlags indicates which quantities are to be recomputed on each finite element cell...
Determinant of the Jacobian.
std::vector< arma::mat::fixed< dim, spacedim > > inverse_jacobians
Inverse Jacobians at the quadrature points.
UpdateFlags update_flags
Flags that indicate which finite element quantities are to be computed.
double basis_value(const unsigned int i, const arma::vec::fixed< dim > &p) const
The scalar variant of basis_vector must be implemented but may not be used.
arma::mat::fixed< dim, dim > basis_grad_vector(const unsigned int i, const arma::vec::fixed< dim > &p) const
Returns the gradient of the ith basis function at the point p.
std::vector< std::vector< arma::mat::fixed< spacedim, spacedim > > > shape_grad_vectors
Gradients of shape functions (for vectorial finite elements).
FEInternalData * initialize(const Quadrature< dim > &q, UpdateFlags flags)
Calculates the data on the reference cell.
std::vector< std::vector< arma::vec > > basis_vectors
Precomputed values of basis functions at the quadrature points.
virtual void fill_fe_values(const Quadrature< dim > &q, FEInternalData &data, FEValuesData< dim, spacedim > &fv_data)
Computes the shape function values and gradients on the actual cell and fills the FEValues structure...
Base class for quadrature rules on simplices in arbitrary dimensions.
std::vector< arma::mat::fixed< spacedim, dim > > jacobians
Jacobians of the mapping at the quadrature points.
Raviart-Thomas element of order 0.
arma::vec::fixed< dim > basis_grad(const unsigned int i, const arma::vec::fixed< dim > &p) const
The scalar variant of basis_grad_vector must be implemented but may not be used.
virtual ~FE_RT0()
Destructor.
UpdateFlags update_each(UpdateFlags flags)
Decides which additional quantities have to be computed for each cell.
void compute_node_matrix()
Computes the conversion matrix from internal basis to shape functions.
Shape function gradients.
std::vector< std::vector< arma::mat > > basis_grad_vectors
Precomputed gradients of basis functions at the quadrature points.
arma::vec::fixed< dim > basis_vector(const unsigned int i, const arma::vec::fixed< dim > &p) const
Returns the ith basis function evaluated at the point p.
std::vector< std::vector< arma::vec::fixed< spacedim > > > shape_vectors
Shape functions (for vectorial finite elements) evaluated at quadrature points.
Class FEValuesData holds the arrays of data computed by Mapping and FiniteElement.
const unsigned int size() const
Returns number of quadrature points.
std::vector< double > determinants
Determinants of Jacobians at quadrature points.
const arma::vec::fixed< dim > & point(const unsigned int i) const
Returns the ith quadrature point.
Structure for storing the precomputed finite element data.
Abstract class for description of finite elements.
Abstract class for the description of a general finite element on a reference simplex in dim dimensio...
static const unsigned int n_raw_functions
Number of raw basis functions.