On 10/04/2016 09:12 AM, [email protected] wrote:
template <int dim>
void Step6<dim>::get_profile ()
{
const QGauss<dim> quadrature_formula(3);
FEValues<dim> fe_values (fe, quadrature_formula,
update_values | update_gradients |
update_quadrature_points | update_JxW_values);
const unsigned int dofs_per_cell = fe.dofs_per_cell;
const unsigned int n_q_points = quadrature_formula.size();
std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell);
typename DoFHandler<dim>::active_cell_iterator
cell = dof_handler.begin_active(),
endc = dof_handler.end();
f.reinit (dof_handler.n_dofs()); //f is already declared as private
like solution
for (; cell!=endc; ++cell)
{
fe_values.reinit (cell);
for (unsigned int q_index=0; q_index<n_q_points; ++q_index)
{
const Point<dim> &p=fe_values.quadrature_point(q_index);
f[q_index]=p(0)*solution[q_index]+p(1);
'solution' is a global vector of the values for each degree of freedom.
But you index it with the quadrature point number. That makes no sense.
What you need to do is evaluate the solution at the quadrature points.
This is done using the
FEValues::get_function_values()
function. Several example programs use it, so you will find use cases there.
Best
W.
--
------------------------------------------------------------------------
Wolfgang Bangerth email: [email protected]
www: http://www.math.colostate.edu/~bangerth/
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.