29 unsigned int n_comp = 0;
30 for (
auto fs : fs_vector)
31 n_comp += fs->n_components();
40 unsigned int space_dim = fs_vector[0]->space_dim();
41 for (
auto fs : fs_vector)
42 ASSERT_DBG(fs->space_dim() == space_dim).error(
"FunctionSpace space_dim mismatch.");
53 unsigned int fe_index = 0;
54 unsigned int comp_offset = 0;
55 for (
auto fs : fs_vector)
57 for (
unsigned int i=0; i<fs->dim(); i++)
62 comp_offset += fs->n_components();
69 unsigned int comp)
const 71 ASSERT_DBG(i <
dim_).error(
"Index of basis function is out of range.");
85 const unsigned int comp)
const 87 ASSERT_DBG(i <
dim_).error(
"Index of basis function is out of range.");
101 template<
unsigned int dim>
104 OLD_ASSERT(fe->n_components() == 1,
"FEVectorContravariant and FEVectorPiola can only be created from scalar FE.");
106 "This constructor can be used only for FEVectorContravariant or FEVectorPiola.");
114 template<
unsigned int dim>
118 "This constructor can be used only for FEVector, FETensor or FEMixedSystem.");
120 "FEVector and FETensor can only be created from scalar FE.");
128 template<
unsigned int dim>
133 fe_.push_back(fe_object);
139 template<
unsigned int dim>
142 unsigned int fe_index = 0;
143 unsigned int comp_offset = 0;
152 scalar_components_.push_back(comp_offset);
157 vector_components_.push_back(comp_offset);
160 tensor_components_.push_back(comp_offset);
168 comp_offset += fe->n_components();
169 fs_vector.push_back(shared_ptr<FunctionSpace>(fe->function_space_));
172 this->function_space_ = make_shared<FESystemFunctionSpace>(fs_vector);
174 double dof_index = 0;
178 for (
unsigned int i=0; i<fe->n_dofs(); i++)
180 arma::vec coefs(this->function_space_->n_components());
181 coefs.subvec(comp_offset, comp_offset+fe->dof(i).coefs.size()-1) = fe->dof(i).coefs;
182 this->dofs_.push_back(
Dof(fe->dof(i).dim, fe->dof(i).n_face_idx, fe->dof(i).coords, coefs, fe->dof(i).type));
185 comp_offset += fe->n_components();
203 for (
int i=0; i<fe->n_dofs(); ++i)
206 for (
unsigned int c=0; c<fe->n_components(); c++)\
207 nonzeros[comp_offset+c] = fe->get_nonzero_components(i)[c];
208 this->nonzero_components_.push_back(nonzeros);
211 comp_offset += fe->n_components();
215 compute_node_matrix();
221 template<
unsigned int dim>
inline 227 f |= fe->update_each(flags);
233 template<
unsigned int dim>
239 this->node_matrix.resize(this->dofs_.size(), this->dofs_.size());
241 unsigned int offset = 0;
242 for (
unsigned int i = 0; i < fe_.size(); i++)
244 this->node_matrix.submat(offset, offset, offset+fe_[i]->n_dofs()-1, offset+fe_[i]->n_dofs()-1)
245 = fe_[i]->node_matrix;
247 offset += fe_[i]->n_dofs();
254 template<
unsigned int dim>
260 for (
unsigned int i=0; i<fs->dof_indices().size(); i++)
262 if (fs->dof_indices()[i].fe_index == fe_index)
263 fe_dof_indices.push_back(i);
266 return fe_dof_indices;
const unsigned int space_dim() const
Getter for space dimension.
void initialize()
Initialization of the internal structures from the vector of base FE.
UpdateFlags
Enum type UpdateFlags indicates which quantities are to be recomputed on each finite element cell...
const double basis_value(unsigned int basis_index, const arma::vec &point, unsigned int comp_index=0) const override
Value of the i th basis function at point point.
const unsigned int dim() const override
Dimension of function space (number of basis functions).
std::vector< DofComponentData > dof_indices_
Indices of basis functions relative to the sub-spaces.
unsigned int dim_
Number of basis functions.
unsigned int check_spacedim(const vector< shared_ptr< FunctionSpace > > &fs_vector)
Class FESystem for compound finite elements.
std::vector< std::shared_ptr< FunctionSpace > > fs_
Function spaces that are put together.
Global macros to enhance readability and debugging, general constants.
const arma::vec basis_grad(unsigned int basis_index, const arma::vec &point, unsigned int comp_index=0) const override
Gradient of the i th basis function at point point.
Compound finite element on dim dimensional simplex.
std::vector< unsigned int > fe_dofs(unsigned int fe_index)
Return dof indices belonging to given sub-FE.
Basic definitions of numerical quadrature rules.
void init(bool primitive=true, FEType type=FEScalar)
Clears all internal structures.
const unsigned int n_components() const
Getter for number of components.
UpdateFlags update_each(UpdateFlags flags) override
Decides which additional quantities have to be computed for each cell.
unsigned int count_components(const vector< shared_ptr< FunctionSpace > > &fs_vector)
Abstract class for the description of a general finite element on a reference simplex in dim dimensio...
void compute_node_matrix() override
Initializes the node_matrix for computing the coefficients of the shape functions in the raw basis of...
FESystemFunctionSpace(const std::vector< std::shared_ptr< FunctionSpace > > &fs_vector)
Constructor.
FESystem(std::shared_ptr< FiniteElement< dim > > fe, FEType t)
Constructor for FEVectorContravariant and FEVectorPiola.