dof_handler->get_selected_fe().dofs_per_line),
ExcVectorDoesNotMatch());
+ const unsigned int dofs_per_vertex = dof_handler->get_selected_fe().dofs_per_vertex,
+ dofs_per_line = dof_handler->get_selected_fe().dofs_per_line;
vector<int>::iterator next = dof_indices.begin();
for (unsigned int vertex=0; vertex<2; ++vertex)
- for (unsigned int d=0; d<dof_handler->get_selected_fe().dofs_per_vertex; ++d)
+ for (unsigned int d=0; d<dofs_per_vertex; ++d)
*next++ = vertex_dof_index(vertex,d);
- for (unsigned int d=0; d<dof_handler->get_selected_fe().dofs_per_line; ++d)
+ for (unsigned int d=0; d<dofs_per_line; ++d)
*next++ = dof_index(d);
};
dof_handler->get_selected_fe().dofs_per_quad),
ExcVectorDoesNotMatch());
+ const unsigned int dofs_per_vertex = dof_handler->get_selected_fe().dofs_per_vertex,
+ dofs_per_line = dof_handler->get_selected_fe().dofs_per_line,
+ dofs_per_quad = dof_handler->get_selected_fe().dofs_per_quad;
vector<int>::iterator next = dof_indices.begin();
for (unsigned int vertex=0; vertex<4; ++vertex)
- for (unsigned int d=0; d<dof_handler->get_selected_fe().dofs_per_vertex; ++d)
+ for (unsigned int d=0; d<dofs_per_vertex; ++d)
*next++ = vertex_dof_index(vertex,d);
for (unsigned int line=0; line<4; ++line)
- for (unsigned int d=0; d<dof_handler->get_selected_fe().dofs_per_line; ++d)
+ for (unsigned int d=0; d<dofs_per_line; ++d)
*next++ = this->line(line)->dof_index(d);
- for (unsigned int d=0; d<dof_handler->get_selected_fe().dofs_per_quad; ++d)
+ for (unsigned int d=0; d<dofs_per_quad; ++d)
*next++ = dof_index(d);
};
+template <>
DoFSubstructAccessor<1>::face_iterator
DoFCellAccessor<1>::face (const unsigned int) const {
Assert (false, ExcNotUsefulForThisDimension());
+template <>
DoFSubstructAccessor<2>::face_iterator
DoFCellAccessor<2>::face (const unsigned int i) const {
return line(i);
+template <>
void
DoFCellAccessor<1>::get_dof_values (const dVector &values,
vector<double> &dof_values) const {
Assert (values.size() == dof_handler->n_dofs(),
ExcVectorDoesNotMatch());
+ const unsigned int dofs_per_vertex = dof_handler->get_selected_fe().dofs_per_vertex,
+ dofs_per_line = dof_handler->get_selected_fe().dofs_per_line;
vector<double>::iterator next_dof_value=dof_values.begin();
for (unsigned int vertex=0; vertex<2; ++vertex)
- for (unsigned int d=0; d<dof_handler->get_selected_fe().dofs_per_vertex; ++d)
+ for (unsigned int d=0; d<dofs_per_vertex; ++d)
*next_dof_value++ = values(vertex_dof_index(vertex,d));
- for (unsigned int d=0; d<dof_handler->get_selected_fe().dofs_per_line; ++d)
+ for (unsigned int d=0; d<dofs_per_line; ++d)
*next_dof_value++ = values(dof_index(d));
};
+template <>
void
DoFCellAccessor<2>::get_dof_values (const dVector &values,
vector<double> &dof_values) const {
Assert (values.size() == dof_handler->n_dofs(),
ExcVectorDoesNotMatch());
+ const unsigned int dofs_per_vertex = dof_handler->get_selected_fe().dofs_per_vertex,
+ dofs_per_line = dof_handler->get_selected_fe().dofs_per_line,
+ dofs_per_quad = dof_handler->get_selected_fe().dofs_per_quad;
vector<double>::iterator next_dof_value=dof_values.begin();
for (unsigned int vertex=0; vertex<4; ++vertex)
- for (unsigned int d=0; d<dof_handler->get_selected_fe().dofs_per_vertex; ++d)
+ for (unsigned int d=0; d<dofs_per_vertex; ++d)
*next_dof_value++ = values(vertex_dof_index(vertex,d));
for (unsigned int line=0; line<4; ++line)
- for (unsigned int d=0; d<dof_handler->get_selected_fe().dofs_per_line; ++d)
+ for (unsigned int d=0; d<dofs_per_line; ++d)
*next_dof_value++ = values(this->line(line)->dof_index(d));
- for (unsigned int d=0; d<dof_handler->get_selected_fe().dofs_per_quad; ++d)
+ for (unsigned int d=0; d<dofs_per_quad; ++d)
*next_dof_value++ = values(dof_index(d));
};
+template <>
void MatrixCreator<1>::create_boundary_mass_matrix (const DoFHandler<1> &,
const FiniteElement<1> &,
const Quadrature<0> &,
for (; dof != endd; ++dof)
{
+ const int dof_number = dof->first;
// for each boundary dof:
-
+
// set entries of this line
// to zero
- for (unsigned int j=sparsity_rowstart[dof->first];
- j<sparsity_rowstart[dof->first+1]; ++j)
- if (sparsity_colnums[j] != dof->first)
+ const unsigned int last = sparsity_rowstart[dof_number+1];
+ for (unsigned int j=sparsity_rowstart[dof->first]; j<last; ++j)
+ if (sparsity_colnums[j] != dof_number)
// if not main diagonal entry
matrix.global_entry(j) = 0.;
// store the new rhs entry to make
// the gauss step more efficient
double new_rhs;
- if (matrix.diag_element(dof->first) != 0.0)
- new_rhs = right_hand_side(dof->first)
- = dof->second * matrix.diag_element(dof->first);
+ if (matrix.diag_element(dof_number) != 0.0)
+ new_rhs = right_hand_side(dof_number)
+ = dof->second * matrix.diag_element(dof_number);
else
{
double first_diagonal_entry = 1;
break;
};
- matrix.set(dof->first, dof->first,
+ matrix.set(dof_number, dof_number,
first_diagonal_entry);
- new_rhs = right_hand_side(dof->first)
+ new_rhs = right_hand_side(dof_number)
= dof->second * first_diagonal_entry;
};
// store the only nonzero entry
// of this line for the Gauss
// elimination step
- const double diagonal_entry = matrix.diag_element(dof->first);
+ const double diagonal_entry = matrix.diag_element(dof_number);
// do the Gauss step
for (unsigned int row=0; row<n_dofs; ++row)
for (unsigned int j=sparsity_rowstart[row];
j<sparsity_rowstart[row+1]; ++j)
- if ((sparsity_colnums[j] == (signed int)dof->first) &&
- ((signed int)row != dof->first))
+ if ((sparsity_colnums[j] == dof_number) &&
+ ((signed int)row != dof_number))
// this line has an entry
// in the regarding column
// but this is not the main
// preset solution vector
- solution(dof->first) = dof->second;
+ solution(dof_number) = dof->second;
};
};
const dFMatrix &values = fe_values.get_shape_values ();
const vector<double> &weights = fe_values.get_JxW_values ();
+ const unsigned int total_dofs = fe_values.total_dofs,
+ n_q_points = fe_values.n_quadrature_points;
+
if (coefficient != 0)
{
vector<double> coefficient_values (fe_values.n_quadrature_points);
coefficient->value_list (fe_values.get_quadrature_points(),
coefficient_values);
- for (unsigned int point=0; point<fe_values.n_quadrature_points; ++point)
- for (unsigned int i=0; i<fe_values.total_dofs; ++i)
- for (unsigned int j=0; j<fe_values.total_dofs; ++j)
+ for (unsigned int i=0; i<total_dofs; ++i)
+ for (unsigned int j=0; j<total_dofs; ++j)
+ for (unsigned int point=0; point<n_q_points; ++point)
cell_matrix(i,j) += (values(i,point) *
values(j,point) *
weights[point] *
coefficient_values[point]);
}
else
- for (unsigned int point=0; point<fe_values.n_quadrature_points; ++point)
- for (unsigned int i=0; i<fe_values.total_dofs; ++i)
- for (unsigned int j=0; j<fe_values.total_dofs; ++j)
+ for (unsigned int i=0; i<total_dofs; ++i)
+ for (unsigned int j=0; j<total_dofs; ++j)
+ for (unsigned int point=0; point<n_q_points; ++point)
cell_matrix(i,j) += (values(i,point) *
values(j,point) *
weights[point]);
vector<double> rhs_values (fe_values.n_quadrature_points);
right_hand_side->value_list (fe_values.get_quadrature_points(), rhs_values);
+ const unsigned int total_dofs = fe_values.total_dofs,
+ n_q_points = fe_values.n_quadrature_points;
+
if (coefficient != 0)
{
- vector<double> coefficient_values (fe_values.n_quadrature_points);
+ vector<double> coefficient_values (n_q_points);
coefficient->value_list (fe_values.get_quadrature_points(),
coefficient_values);
- for (unsigned int point=0; point<fe_values.n_quadrature_points; ++point)
- for (unsigned int i=0; i<fe_values.total_dofs; ++i)
+ for (unsigned int point=0; point<n_q_points; ++point)
+ for (unsigned int i=0; i<total_dofs; ++i)
{
- for (unsigned int j=0; j<fe_values.total_dofs; ++j)
+ for (unsigned int j=0; j<total_dofs; ++j)
cell_matrix(i,j) += (values(i,point) *
values(j,point) *
weights[point] *
};
}
else
- for (unsigned int point=0; point<fe_values.n_quadrature_points; ++point)
- for (unsigned int i=0; i<fe_values.total_dofs; ++i)
+ for (unsigned int point=0; point<n_q_points; ++point)
+ for (unsigned int i=0; i<total_dofs; ++i)
{
- for (unsigned int j=0; j<fe_values.total_dofs; ++j)
+ for (unsigned int j=0; j<total_dofs; ++j)
cell_matrix(i,j) += (values(i,point) *
values(j,point) *
weights[point]);
vector<double> rhs_values(fe_values.n_quadrature_points);
right_hand_side->value_list (fe_values.get_quadrature_points(), rhs_values);
- for (unsigned int point=0; point<fe_values.n_quadrature_points; ++point)
- for (unsigned int i=0; i<fe_values.total_dofs; ++i)
+ const unsigned int total_dofs = fe_values.total_dofs,
+ n_q_points = fe_values.n_quadrature_points;
+
+ for (unsigned int point=0; point<n_q_points; ++point)
+ for (unsigned int i=0; i<total_dofs; ++i)
rhs(i) += values(i,point) *
rhs_values[point] *
weights[point];
const vector<double> &weights = fe_values.get_JxW_values ();
right_hand_side->value_list (fe_values.get_quadrature_points(), rhs_values);
+ const unsigned int total_dofs = fe_values.total_dofs,
+ n_q_points = fe_values.n_quadrature_points;
+
if (coefficient != 0)
{
- vector<double> coefficient_values(fe_values.n_quadrature_points);
+ vector<double> coefficient_values(n_q_points);
coefficient->value_list (fe_values.get_quadrature_points(),
coefficient_values);
- for (unsigned int point=0; point<fe_values.n_quadrature_points; ++point)
- for (unsigned int i=0; i<fe_values.total_dofs; ++i)
+ for (unsigned int point=0; point<n_q_points; ++point)
+ for (unsigned int i=0; i<total_dofs; ++i)
{
- for (unsigned int j=0; j<fe_values.total_dofs; ++j)
+ for (unsigned int j=0; j<total_dofs; ++j)
cell_matrix(i,j) += (gradients[i][point] *
gradients[j][point]) *
weights[point] *
};
}
else
- for (unsigned int point=0; point<fe_values.n_quadrature_points; ++point)
- for (unsigned int i=0; i<fe_values.total_dofs; ++i)
+ for (unsigned int point=0; point<n_q_points; ++point)
+ for (unsigned int i=0; i<total_dofs; ++i)
{
- for (unsigned int j=0; j<fe_values.total_dofs; ++j)
+ for (unsigned int j=0; j<total_dofs; ++j)
cell_matrix(i,j) += (gradients[i][point] *
gradients[j][point]) *
weights[point];
const vector<vector<Point<dim> > >&gradients = fe_values.get_shape_grads ();
const vector<double> &weights = fe_values.get_JxW_values ();
+ const unsigned int total_dofs = fe_values.total_dofs,
+ n_q_points = fe_values.n_quadrature_points;
+
if (coefficient != 0)
{
- vector<double> coefficient_values(fe_values.n_quadrature_points);
+ vector<double> coefficient_values(n_q_points);
coefficient->value_list (fe_values.get_quadrature_points(),
coefficient_values);
- for (unsigned int point=0; point<fe_values.n_quadrature_points; ++point)
- for (unsigned int i=0; i<fe_values.total_dofs; ++i)
- for (unsigned int j=0; j<fe_values.total_dofs; ++j)
+ for (unsigned int point=0; point<n_q_points; ++point)
+ for (unsigned int i=0; i<total_dofs; ++i)
+ for (unsigned int j=0; j<total_dofs; ++j)
cell_matrix(i,j) += (gradients[i][point] *
gradients[j][point]) *
weights[point] *
coefficient_values[point];
}
else
- for (unsigned int point=0; point<fe_values.n_quadrature_points; ++point)
- for (unsigned int i=0; i<fe_values.total_dofs; ++i)
- for (unsigned int j=0; j<fe_values.total_dofs; ++j)
+ for (unsigned int point=0; point<n_q_points; ++point)
+ for (unsigned int i=0; i<total_dofs; ++i)
+ for (unsigned int j=0; j<total_dofs; ++j)
cell_matrix(i,j) += (gradients[i][point] *
gradients[j][point]) *
weights[point];
vector<double> rhs_values(fe_values.n_quadrature_points);
right_hand_side->value_list (fe_values.get_quadrature_points(), rhs_values);
- for (unsigned int point=0; point<fe_values.n_quadrature_points; ++point)
- for (unsigned int i=0; i<fe_values.total_dofs; ++i)
+ const unsigned int total_dofs = fe_values.total_dofs,
+ n_q_points = fe_values.n_quadrature_points;
+
+ for (unsigned int point=0; point<n_q_points; ++point)
+ for (unsigned int i=0; i<total_dofs; ++i)
rhs(i) += values(i,point) *
rhs_values[point] *
weights[point];