29 unsigned int n_comp = 0;
30 for (
auto fs : fs_vector)
31 n_comp += fs->n_components();
39 ASSERT(fs_vector.size() > 0);
40 unsigned int space_dim = fs_vector[0]->space_dim();
41 for (
auto fs : fs_vector)
42 ASSERT(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(i <
dim_).error(
"Index of basis function is out of range.");
85 const unsigned int comp)
const
87 ASSERT(i <
dim_).error(
"Index of basis function is out of range.");
101 template<
unsigned int dim>
104 ASSERT_EQ(fe->n_components(), 1).error(
"FEVectorContravariant and FEVectorPiola can only be created from scalar FE.");
106 .error(
"This constructor can be used only for FEVectorContravariant or FEVectorPiola.");
114 template<
unsigned int dim>
118 .error(
"This constructor can be used only for FEVector, FETensor or FEMixedSystem.");
120 .error(
"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 (
uint 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);
232 template<
unsigned int dim>
236 for (
unsigned int i = 0; i < fe_.size(); i++)
238 auto fe_points = fe_[i]->dof_points();
239 points.insert(points.end(), fe_points.begin(), fe_points.end());
245 template<
unsigned int dim>
251 this->node_matrix.resize(this->dofs_.size(), this->dofs_.size());
253 unsigned int offset = 0;
254 for (
unsigned int i = 0; i < fe_.size(); i++)
256 this->node_matrix.submat(offset, offset, offset+fe_[i]->n_dofs()-1, offset+fe_[i]->n_dofs()-1)
257 = fe_[i]->node_matrix;
259 offset += fe_[i]->n_dofs();
266 template<
unsigned int dim>
272 for (
unsigned int i=0; i<fs->dof_indices().size(); i++)
274 if (fs->dof_indices()[i].fe_index == fe_index)
275 fe_dof_indices.push_back(i);
278 return fe_dof_indices;