Hi Praveen

 -- tried to access by reference, but the final value remains unchanged (zero). 
i am printing the local_value(s) and they are nonzero (albeit small). here is 
my 
implementation of initialize_info

    template <typename number>
    template <class DOFINFO>
    inline void
    Functional<number>::initialize_info(DOFINFO& info, bool)
    {
      info.initialize_numbers((unsigned int)results.size());
    }

where results is the result vector (with one component, because i have a single 
functional).

// -- Mihai




________________________________
Von: Praveen C <[email protected]>
An: mihai alexe <[email protected]>
CC: deal.ii <[email protected]>
Gesendet: Donnerstag, den 10. Februar 2011, 0:53:32 Uhr
Betreff: Re: [deal.II] MeshWorker::Assembler::Functional initialize_info

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

Reply via email to