40 template<
class FV,
unsigned int spacedim>
42 : dim_(-1), n_points_(0), n_dofs_(0)
58 unsigned int first_component_idx,
62 for (
unsigned int ip=0; ip<
n_points; ip++)
63 for (
unsigned int id=0;
id<dof_indices.size();
id++)
72 template<
class FV,
unsigned int spacedim>
73 template<
unsigned int DIM>
93 ASSERT(fe_sys !=
nullptr).error(
"Mixed system must be represented by FESystem.");
98 unsigned int comp_offset = 0;
99 for (
auto fe : fe_sys->
fe())
115 ASSERT(
false).error(
"Not implemented.");
127 template<
class FV,
unsigned int spacedim>
128 template<
unsigned int DIM>
144 ASSERT(fe !=
nullptr).error(
"Mixed system must be represented by FESystem.");
148 for (
unsigned int f=0; f<fe->
fe().size(); f++)
153 if ( q.
dim() == DIM )
157 else if ( q.
dim() + 1 == DIM )
160 for (
unsigned int sid = 0; sid < RefElement<DIM>::n_sides; sid++)
166 ASSERT(
false)(q.
dim())(DIM).error(
"Dimension mismatch in FEValues::initialize().");
171 template<
class FV,
unsigned int spacedim>
172 template<
unsigned int DIM>
181 ASSERT(_fe.
n_components() == spacedim).error(
"FEVector must have spacedim components.");
183 ASSERT(_fe.
n_components() == spacedim*spacedim).error(
"FETensor must have spacedim*spacedim components.");
196 if (fe_sys !=
nullptr)
198 for (
unsigned int f=0; f<fe_sys->
fe().size(); f++)
216 template<
class FV,
unsigned int spacedim>
217 template<
unsigned int DIM>
222 std::shared_ptr<FEInternalData> data = std::make_shared<FEInternalData>(q.
size(),
n_dofs_);
225 for (
unsigned int i=0; i<q.
size(); i++)
227 for (
unsigned int j=0; j<
n_dofs_; j++)
232 data->ref_shape_values[i][j] = trans(shape_values.row(j));
237 for (
unsigned int i=0; i<q.
size(); i++)
239 for (
unsigned int j=0; j<
n_dofs_; j++)
245 data->ref_shape_grads[i][j] = grad;
253 template<
class FV,
unsigned int spacedim>
258 this->fill_data_specialized<MapScalar<FV, spacedim>>(elm_values, fe_data);
261 this->fill_data_specialized<MapVector<FV, spacedim>>(elm_values, fe_data);
264 this->fill_data_specialized<MapContravariant<FV, spacedim>>(elm_values, fe_data);
267 this->fill_data_specialized<MapPiola<FV, spacedim>>(elm_values, fe_data);
270 this->fill_data_specialized<MapTensor<FV, spacedim>>(elm_values, fe_data);
273 this->fill_data_specialized<MapSystem<FV, spacedim>>(elm_values, fe_data);
282 template<
class FV,
unsigned int spacedim>
283 template<
class MapType>
286 map_type.fill_values_vec(*this->
fv_, elm_values, fe_data);
288 map_type.update_values(*this->
fv_, elm_values, fe_data);
290 map_type.update_gradients(*this->
fv_, elm_values, fe_data);
308 template<
unsigned int spacedim>
313 template<
unsigned int spacedim>
318 template<
unsigned int spacedim>
323 elm_values_ = std::make_shared<ElementValues<spacedim> >(q, this->update_flags, dim);
328 template<
unsigned int spacedim>
332 shape_values_.resize(this->n_points_,
vector<double>(this->n_dofs_*this->n_components_));
335 shape_gradients_.resize(this->n_points_,
vector<arma::vec::fixed<spacedim> >(this->n_dofs_*this->n_components_));
342 template<
unsigned int spacedim>
344 const unsigned int point_no,
345 const unsigned int comp)
const
350 return shape_gradients_[point_no][function_no*this->n_components_+comp];
559 template<
unsigned int spacedim>
564 if (!elm_values_->cell().is_valid() ||
565 elm_values_->cell() != cell)
567 elm_values_->reinit(cell);
570 this->fill_data(*elm_values_, *this->fe_data_);
574 template<
unsigned int spacedim>
579 if (!elm_values_->side().is_valid() ||
580 elm_values_->side() != cell_side)
582 elm_values_->reinit(cell_side);
588 this->fill_data(*elm_values_, *(this->side_fe_data_[sid]) );
691 fv[0].initialize(quadrature[0], *fe[0_d], flags);
692 fv[1].initialize(quadrature[1], *fe[1_d], flags);
693 fv[2].initialize(quadrature[2], *fe[2_d], flags);
694 fv[3].initialize(quadrature[3], *fe[3_d], flags);
#define ASSERT_PERMANENT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
#define ASSERT_LT(a, b)
Definition of comparative assert macro (Less Than) only for debug mode.
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
Class for computation of data on cell and side.
Structure for storing the precomputed finite element data.
std::vector< std::vector< arma::mat > > ref_shape_grads
Precomputed gradients of basis functions at the quadrature points.
unsigned int n_points
Number of quadrature points.
FEInternalData(unsigned int np, unsigned int nd)
std::vector< std::vector< arma::vec > > ref_shape_values
Precomputed values of basis functions at the quadrature points.
Compound finite element on dim dimensional simplex.
const std::vector< std::shared_ptr< FiniteElement< dim > > > & fe() const
std::vector< unsigned int > fe_dofs(unsigned int fe_index)
Return dof indices belonging to given sub-FE.
UpdateFlags update_flags
Flags that indicate which finite element quantities are to be computed.
void allocate(Quadrature &_quadrature, FiniteElement< DIM > &_fe, UpdateFlags flags)
Allocates space for computed data.
unsigned int n_points_
Number of integration points.
FV * fv_
Helper object, we need its for ViewsCache initialization.
std::shared_ptr< FEInternalData > init_fe_data(const FiniteElement< DIM > &fe, const Quadrature &q)
Precompute finite element data on reference element.
std::vector< shared_ptr< FEInternalData > > side_fe_data_
Precomputed FE data (shape functions on reference element) for all side quadrature points.
std::vector< unsigned int > fe_sys_n_space_components_
Numbers of components of FESystem sub-elements in real space.
FEType fe_type_
Type of finite element (scalar, vector, tensor).
unsigned int n_dofs_
Number of finite element dofs.
virtual void init_fe_val_vec()=0
Initialize fe_values_vec only in PatchFEValues_TEMP.
ViewsCache views_cache_
Auxiliary storage of FEValuesViews accessors.
virtual void allocate_in(unsigned int)=0
Initialize vectors declared separately in descendants.
void fill_data(const ElementValues< spacedim > &elm_values, const FEInternalData &fe_data)
Computes the shape function values and gradients on the actual cell and fills the FEValues structure.
std::vector< FV > fe_values_vec
Vector of FEValues for sub-elements of FESystem.
std::vector< unsigned int > fe_sys_n_components_
Numbers of components of FESystem sub-elements in reference space.
std::vector< std::vector< unsigned int > > fe_sys_dofs_
Dof indices of FESystem sub-elements.
unsigned int n_components_
Number of components of the FE.
FEValuesBase()
Default constructor with postponed initialization.
void fill_data_specialized(const ElementValues< spacedim > &elm_values, const FEInternalData &fe_data)
Computes the shape function values and gradients on the actual cell and fills the FEValues structure....
void initialize(Quadrature &_quadrature, FiniteElement< DIM > &_fe, UpdateFlags _flags)
Initialize structures and calculates cell-independent data.
virtual void initialize_in(Quadrature &, unsigned int)=0
Initialize ElementValues separately in descendants.
std::shared_ptr< FEInternalData > fe_data_
Precomputed finite element data.
unsigned int dim_
Dimension of reference space.
Calculates finite element data on the actual cell.
~FEValues()
Correct deallocation of objects created by 'initialize' methods.
FEValues()
Default constructor with postponed initialization.
arma::vec::fixed< spacedim > shape_grad_component(const unsigned int function_no, const unsigned int point_no, const unsigned int comp) const
Return the gradient of the function_no-th shape function at the point_no-th quadrature point.
void reinit(const ElementAccessor< spacedim > &cell)
Update cell-dependent data (gradients, Jacobians etc.)
void initialize_in(Quadrature &q, unsigned int dim) override
Implement FEValuesBase::initialize_in.
void allocate_in(unsigned int q_dim) override
Implement FEValuesBase::allocate_in.
Abstract class for the description of a general finite element on a reference simplex in dim dimensio...
unsigned int n_space_components(unsigned int spacedim)
Number of components of FE in a mapped space with dimension spacedim.
virtual UpdateFlags update_each(UpdateFlags flags)
Decides which additional quantities have to be computed for each cell.
unsigned int n_dofs() const
Returns the number of degrees of freedom needed by the finite element.
FEType type_
Type of FiniteElement.
double shape_value(const unsigned int i, const arma::vec::fixed< dim > &p, const unsigned int comp=0) const
Calculates the value of the comp-th component of the i-th shape function at the point p on the refere...
arma::vec::fixed< dim > shape_grad(const unsigned int i, const arma::vec::fixed< dim > &p, const unsigned int comp=0) const
Calculates the comp-th component of the gradient of the i-th shape function at the point p on the ref...
unsigned int n_components() const
Returns numer of components of the basis function.
static UpdateFlags update_each(UpdateFlags flags)
Determines which additional quantities have to be computed.
std::array< QGauss, 4 > array
Base class for quadrature rules on simplices in arbitrary dimensions.
Quadrature make_from_side(unsigned int sid) const
unsigned int size() const
Returns number of quadrature points.
Armor::ArmaVec< double, point_dim > point(unsigned int i) const
Returns the ith quadrature point.
unsigned int side_idx() const
Returns local index of the side on the element.
unsigned int dim() const
Returns dimension of the side, that is dimension of the element minus one.
Class ElementValues calculates data related to transformation of reference cell to actual cell (Jacob...
Class FESystem for compound finite elements.
std::vector< FEValues< 3 > > mixed_fe_values(QGauss::array &quadrature, MixedPtr< FiniteElement > fe, UpdateFlags flags)
Class FEValues calculates finite element data on the actual cells such as shape function values,...
Abstract class for description of finite elements.
int LongIdx
Define type that represents indices of large arrays (elements, nodes, dofs etc.)
Class MappingP1 implements the affine transformation of the unit cell onto the actual cell.
ArmaMat< double, N, M > mat
Basic definitions of numerical quadrature rules.
vector< FEValuesViews::Scalar< FV, spacedim > > scalars
vector< FEValuesViews::Vector< FV, spacedim > > vectors
void initialize(const FV &fv, const FiniteElement< DIM > &fe)
vector< FEValuesViews::Tensor< FV, spacedim > > tensors
UpdateFlags
Enum type UpdateFlags indicates which quantities are to be recomputed on each finite element cell.
@ update_values
Shape function values.
@ update_gradients
Shape function gradients.