18 #ifndef FIELD_FE_IMPL_HH_
19 #define FIELD_FE_IMPL_HH_
32 namespace it = Input::Type;
37 template <
int spacedim,
class Value>
39 Input::register_class< FieldFE<spacedim, Value>,
unsigned int >(
"FieldFE");
43 template <
int spacedim,
class Value>
56 template <
int spacedim,
class Value>
68 VecGetArray(*data_vec_, &data_);
70 unsigned int ndofs = max(dh_->fe<1>()->n_dofs(), max(dh_->fe<2>()->n_dofs(), dh_->fe<3>()->n_dofs()));
71 dof_indices =
new unsigned int[ndofs];
79 template <
int spacedim,
class Value>
87 arma::mat::fixed<1,3> im1 = pinv(m1);
95 dh_->get_loc_dof_indices(cell, dof_indices);
97 if (dh_->fe<1>()->is_scalar()) {
99 for (
unsigned int i=0; i<dh_->fe<1>()->n_dofs(); i++)
100 value += data_[dof_indices[i]]*fe_values1.
shape_value(i, 0);
101 this->value_(0,0) = value;
106 for (
unsigned int i=0; i<dh_->fe<1>()->n_dofs(); i++)
107 value += data_[dof_indices[i]]*fe_values1.
shape_vector(i, 0);
108 for (
unsigned int i=0; i<3; i++)
109 this->value_(i,0) = value(i);
112 else if (elm.
dim() == 2) {
113 arma::mat::fixed<3,2> m2;
116 arma::mat::fixed<2,3> im2 = pinv(m2);
124 dh_->get_loc_dof_indices(cell, dof_indices);
126 if (dh_->fe<2>()->is_scalar()) {
128 for (
unsigned int i=0; i<dh_->fe<2>()->n_dofs(); i++)
129 value += data_[dof_indices[i]]*fe_values2.
shape_value(i, 0);
130 this->value_(0,0) = value;
135 for (
unsigned int i=0; i<dh_->fe<2>()->n_dofs(); i++)
136 value += data_[dof_indices[i]]*fe_values2.
shape_vector(i, 0);
137 for (
unsigned int i=0; i<3; i++)
138 this->value_(i,0) = value(i);
153 dh_->get_loc_dof_indices(cell, dof_indices);
155 if (dh_->fe<3>()->is_scalar()) {
157 for (
unsigned int i=0; i<dh_->fe<3>()->n_dofs(); i++)
158 value += data_[dof_indices[i]]*fe_values3.
shape_value(i, 0);
159 this->value_(0,0) = value;
164 for (
unsigned int i=0; i<dh_->fe<3>()->n_dofs(); i++)
165 value += data_[dof_indices[i]]*fe_values3.
shape_vector(i, 0);
166 for (
unsigned int i=0; i<3; i++)
167 this->value_(i,0) = value(i);
171 return this->r_value_;
179 template <
int spacedim,
class Value>
187 if (elm.
dim() == 1) {
189 arma::mat::fixed<1,3> im1 = pinv(m1);
191 dh_->get_loc_dof_indices(cell, dof_indices);
193 for (
unsigned int k=0; k<point_list.size(); k++) {
201 Value envelope(value_list[k]);
203 if (dh_->fe<1>()->is_scalar()) {
205 for (
unsigned int i=0; i<dh_->fe<1>()->n_dofs(); i++)
206 value += data_[dof_indices[i]]*fe_values1.
shape_value(i, 0);
207 envelope(0,0) = value;
212 for (
unsigned int i=0; i<dh_->fe<1>()->n_dofs(); i++)
213 value += data_[dof_indices[i]]*fe_values1.
shape_vector(i, 0);
214 for (
int i=0; i<3; i++)
215 envelope(i,0) = value(i);
219 else if (elm.
dim() == 2) {
220 arma::mat::fixed<3,2> m2;
223 arma::mat::fixed<2,3> im2 = pinv(m2);
225 dh_->get_loc_dof_indices(cell, dof_indices);
227 for (
unsigned int k=0; k<point_list.size(); k++) {
235 Value envelope(value_list[k]);
237 if (dh_->fe<2>()->is_scalar()) {
239 for (
unsigned int i=0; i<dh_->fe<2>()->n_dofs(); i++)
240 value += data_[dof_indices[i]]*fe_values2.
shape_value(i, 0);
241 envelope(0,0) = value;
246 for (
unsigned int i=0; i<dh_->fe<2>()->n_dofs(); i++)
247 value += data_[dof_indices[i]]*fe_values2.
shape_vector(i, 0);
248 for (
int i=0; i<3; i++)
249 envelope(i,0) = value(i);
260 dh_->get_loc_dof_indices(cell, dof_indices);
262 for (
unsigned int k=0; k<point_list.size(); k++) {
270 Value envelope(value_list[k]);
272 if (dh_->fe<3>()->is_scalar()) {
274 for (
unsigned int i=0; i<dh_->fe<3>()->n_dofs(); i++)
275 value += data_[dof_indices[i]]*fe_values3.
shape_value(i, 0);
276 envelope(0,0) = value;
281 for (
unsigned int i=0; i<dh_->fe<3>()->n_dofs(); i++)
282 value += data_[dof_indices[i]]*fe_values3.
shape_vector(i, 0);
283 for (
int i=0; i<3; i++)
284 envelope(i,0) = value(i);
292 template <
int spacedim,
class Value>
295 if (dof_indices !=
nullptr)
delete[] dof_indices;
const Element * element() const
virtual void value_list(const std::vector< Point > &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list)
Class FEValues calculates finite element data on the actual cells such as shape function values...
void set_fe_data(const DOFHandlerMultiDim *dh, Mapping< 1, 3 > *map1, Mapping< 2, 3 > *map2, Mapping< 3, 3 > *map3, const Vec *data)
Provides the numbering of the finite element degrees of freedom on the computational mesh...
virtual Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm)
Basic definitions of numerical quadrature rules.
Space< spacedim >::Point Point
arma::vec::fixed< spacedim > shape_vector(const unsigned int function_no, const unsigned int point_no)
Return the value of the function_no-th shape function at the point_no-th quadrature point...
double shape_value(const unsigned int function_no, const unsigned int point_no)
Return the value of the function_no-th shape function at the point_no-th quadrature point...
void set_point(const unsigned int i, const arma::vec::fixed< dim > &p)
Sets individual quadrature point coordinates.
FieldFE(unsigned int n_comp=0)
void reinit(ElementFullIter &cell)
Update cell-dependent data (gradients, Jacobians etc.)
Calculates finite element data on the actual cell.
#define OLD_ASSERT_EQUAL(a, b)
Abstract class for description of finite elements.