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();