Hi
The documentation says value is accessed by reference. You can try
double& local_value = dinfo.value(0);
//this is the value of the functional on the current boundary edge
for (unsigned int point = 0; point < fe_v.n_quadrature_points; ++point)
for (unsigned int i = 0; i < fe_v.dofs_per_cell; ++i)
local_value += ....
Then this should already add the contribution to dinfo.value(0).
praveen
On Thu, Feb 10, 2011 at 10:16 AM, mihai alexe <[email protected]> wrote:
> Hello,
>
> -- following up on this, I implemented initialize_info and the code
> compiles and runs. However, the value of the functional is not assembled
> correctly (I get a value of zero after the computations are complete). My
> assembly code looks as follows:
>
> //assemble routine
>
> MeshWorker::DoFInfo<dim> dof_info(dof_handler);
>
> MeshWorker::Assembler::Functional<double> assembler;
>
> //a single scalar functional that does not depend on data on the interior
> faces
> assembler.initialize(1);
>
> MeshWorker::integration_loop<dim, dim>
> (dof_handler.begin_active(), dof_handler.end(),
> dof_info, info_box,
>
> boost::bind(&EllipticOptimalitySystemSolver<dim>::integrate_cell_term_functional,
> this, _1, _2),
>
> boost::bind(&EllipticOptimalitySystemSolver<dim>::integrate_boundary_term_functional,
> this, _1, _2),
>
> boost::bind(&EllipticOptimalitySystemSolver<dim>::integrate_face_term_functional,
> this, _1, _2, _3, _4),
> assembler, true);
>
> return assembler(0);
>
> Since the functional is defined on the boundary, i do all computations in
> the integrate_boundary_term_functional:
>
> void
> EllipticOptimalitySystemSolver<dim>::integrate_boundary_term_functional_1(DoFInfo&
> dinfo, CellInfo& info)
> {
> const FEValuesBase<dim>& fe_v = info.fe_values();
> double local_value = dinfo.value(0);
>
> const std::vector<double> &JxW = fe_v.get_JxW_values ();
> const std::vector<Point<dim> > &normals = fe_v.get_normal_vectors ();
>
> //get values, gradients, and what else is required...
>
> //this is the value of the functional on the current boundary edge
> for (unsigned int point = 0; point < fe_v.n_quadrature_points; ++point)
> for (unsigned int i = 0; i < fe_v.dofs_per_cell; ++i)
> local_value += ....
>
> //even if i add local_value to dinfo.value(0) i still get a zero at the
> end
> //but local_value is non-zero...
> dinfo.value(0) += local_value;
> }
>
> What am I doing wrong here? How should I update the functional value to
> include the contribution computed on this edge?
>
> Thanks in advance for your help!
>
> -- Mihai
>
>
_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii