54 template<
unsigned int spacedim>
55 template<
unsigned int DIM>
72 ASSERT(fe !=
nullptr).error(
"Mixed system must be represented by FESystem.");
75 for (
unsigned int f=0; f<fe->
fe().size(); f++) {
86 else if ( q.
dim() + 1 == DIM )
89 for (
unsigned int sid = 0; sid < RefElement<DIM>::n_sides; sid++)
95 ASSERT(
false)(q.
dim())(DIM).error(
"Dimension mismatch in FEValues::initialize().");
99 template<
unsigned int spacedim>
100 template<
unsigned int DIM>
109 ASSERT(_fe.
n_components() == spacedim).error(
"FEVector must have spacedim components.");
111 ASSERT(_fe.
n_components() == spacedim*spacedim).error(
"FETensor must have spacedim*spacedim components.");
115 fe_sys_dofs_.clear();
116 fe_sys_n_components_.clear();
117 fe_sys_n_space_components_.clear();
120 n_points_ = _q.
size();
123 fe_type_ = _fe.
type_;
125 if (fe_sys !=
nullptr)
127 for (
unsigned int f=0; f<fe_sys->
fe().size(); f++)
129 fe_sys_dofs_.push_back(fe_sys->
fe_dofs(f));
130 fe_sys_n_components_.push_back(fe_sys->
fe()[f]->n_components());
131 fe_sys_n_space_components_.push_back(fe_sys->
fe()[f]->n_space_components(spacedim));
139 if ( _q.
dim() == this->dim_ ) {
140 element_data_.resize( this->max_n_elem_ );
142 }
else if ( _q.
dim()+1 == this->dim_ ) {
143 element_data_.resize( this->max_n_elem_ * (this->dim_+1) );
146 ASSERT(
false)(_q.
dim())(this->dim_).error(
"Invalid dimension of quadrature!");
148 for (
uint i=0; i<max_size(); ++i) {
150 element_data_[i].shape_values_.resize(this->n_points_,
vector<double>(this->n_dofs_*this->n_components_));
153 element_data_[i].shape_gradients_.resize(this->n_points_,
vector<arma::vec::fixed<spacedim> >(this->n_dofs_*this->n_components_));
160 template<
unsigned int spacedim>
161 template<
unsigned int DIM>
166 std::shared_ptr<FEInternalData> data = std::make_shared<FEInternalData>(q.
size(), n_dofs_);
169 for (
unsigned int i=0; i<q.
size(); i++)
171 for (
unsigned int j=0; j<n_dofs_; j++)
176 data->ref_shape_values[i][j] = trans(shape_values.row(j));
181 for (
unsigned int i=0; i<q.
size(); i++)
183 for (
unsigned int j=0; j<n_dofs_; j++)
189 data->ref_shape_grads[i][j] = grad;
197 template<
unsigned int spacedim>
200 if (dim_ == 0)
return;
202 element_patch_map_.clear();
204 used_size_ = patch_elements.size();
206 used_size_ = patch_elements.size() * (this->dim_+1);
210 for (
auto it=patch_elements.begin();
it!=patch_elements.end(); ++
it, ++i) {
213 element_patch_map_[
it->second] = i;
214 element_data_[i].elm_values_->reinit(
it->first);
215 this->fill_data(*element_data_[i].elm_values_, *this->fe_data_);
217 element_patch_map_[
it->second] = i * (this->dim_+1);
218 for (
unsigned int sid=0; sid<this->dim_+1; ++sid) {
219 patch_data_idx_ = i * (this->dim_+1) + sid;
220 element_data_[patch_data_idx_].elm_values_->reinit( *
it->first.side(sid) );
221 this->fill_data(*element_data_[patch_data_idx_].elm_values_, *this->side_fe_data_[sid]);
229 template<
unsigned int spacedim>
232 switch (this->fe_type_) {
234 this->fill_data_specialized<MapScalar<PatchFEValues<spacedim>::DimPatchFEValues, spacedim>>(elm_values, fe_data);
237 this->fill_data_specialized<MapVector<PatchFEValues<spacedim>::DimPatchFEValues, spacedim>>(elm_values, fe_data);
240 this->fill_data_specialized<MapContravariant<PatchFEValues<spacedim>::DimPatchFEValues, spacedim>>(elm_values, fe_data);
243 this->fill_data_specialized<MapPiola<PatchFEValues<spacedim>::DimPatchFEValues, spacedim>>(elm_values, fe_data);
246 this->fill_data_specialized<MapTensor<PatchFEValues<spacedim>::DimPatchFEValues, spacedim>>(elm_values, fe_data);
249 this->fill_data_specialized<MapSystem<PatchFEValues<spacedim>::DimPatchFEValues, spacedim>>(elm_values, fe_data);
257 template<
unsigned int spacedim>
258 template<
class MapType>
261 map_type.fill_values_vec(*
this, elm_values, fe_data);
263 map_type.update_values(*
this, elm_values, fe_data);
265 map_type.update_gradients(*
this, elm_values, fe_data);
#define ASSERT_PERMANENT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
#define ASSERT_PERMANENT_GT(a, b)
Definition of comparative assert macro (Greater Than)
#define ASSERT_LE(a, b)
Definition of comparative assert macro (Less or Equal) only for debug mode.
Class for computation of data on cell and side.
Structure for storing the precomputed finite element data.
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.
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.
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....
std::shared_ptr< FEInternalData > init_fe_data(const FiniteElement< DIM > &fe, const Quadrature &q)
Precompute finite element data on reference element.
std::vector< ElementFEData > element_data_
Data of elements / sides on patch.
void allocate(Quadrature &_quadrature, FiniteElement< DIM > &_fe, UpdateFlags flags)
Allocates space for computed data.
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.
void reinit(PatchElementsList patch_elements)
void initialize(Quadrature &_quadrature, FiniteElement< DIM > &_fe, UpdateFlags _flags)
Initialize structures and calculates cell-independent data.
UpdateFlags update_flags
Flags that indicate which finite element quantities are to be computed.
unsigned int max_size() const
std::vector< shared_ptr< FEInternalData > > side_fe_data_
Precomputed FE data (shape functions on reference element) for all side quadrature points.
std::shared_ptr< FEInternalData > fe_data_
Precomputed finite element data.
FEType fe_type_
Type of finite element (scalar, vector, tensor).
std::vector< PatchFEValues< spacedim >::DimPatchFEValues > fe_values_vec
Vector of FEValues for sub-elements of FESystem.
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.
Class FESystem for compound finite elements.
Class MappingP1 implements the affine transformation of the unit cell onto the actual cell.
ArmaMat< double, N, M > mat
Class FEValues calculates finite element data on the actual cells such as shape function values,...
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.