Hello Bastian,
I managed to pass an external solution vector to a cell integrator, it is
accessed evaluated on the quadrature points.
Here's an example that calculates the L2 norm of a vector v and puts it in
a vector result:
> #include <deal.II/meshworker/integration_info.h>
> #include <deal.II/meshworker/dof_info.h>
> #include <deal.II/meshworker/simple.h>
> #include <deal.II/meshworker/loop.h>
> #include <deal.II/integrators/l2.h>
> #include <deal.II/fe/fe_dgq.h>
> #include <deal.II/fe/mapping_q1.h>
> #include <deal.II/grid/grid_generator.h>
> #include <deal.II/grid/grid_tools.h>
> #include <fstream>
> #include <algorithm>
>
> int main()
> {
> dealii::Triangulation<2> tr;
> dealii::GridGenerator::hyper_cube (tr, 0, 1);
> tr.refine_global(1);
> dealii::FE_DGQ<2> fe(1) ;
> dealii::MappingQ1<2> mapping;
> dealii::DoFHandler<2> dof_handler(tr);
> dof_handler.distribute_dofs (fe);
> dealii::MeshWorker::DoFInfo<2> dof_info(dof_handler);
> dealii::MeshWorker::IntegrationInfoBox<2> info_box;
> info_box.add_update_flags(dealii::update_JxW_values |
> dealii::update_quadrature_points |
> dealii::update_values);
> info_box.cell_selector.add("v");
> dealii::Vector<double> result(dof_handler.n_dofs());
> dealii::Vector<double> v(dof_handler.n_dofs());
> result = 1. ;
> std::cout << "Result before integration" << std::endl ;
> std::for_each(result.begin(),result.end(),[](const double d){std::cout
> << d << " ";});
> v = 2. ;
> std::cout << std::endl ;
> dealii::AnyData result_data;
> result_data.add<dealii::Vector<double> *>(&result,"result");
> dealii::AnyData v_data;
> v_data.add<const dealii::Vector<double> *>(&v,"v");
> info_box.initialize(fe,mapping,v_data,dealii::Vector<double>{});
> dealii::MeshWorker::Assembler::ResidualSimple<dealii::Vector<double> >
> assembler;
> assembler.initialize(result_data);
> typedef dealii::MeshWorker::DoFInfo<2> DOFINFO ;
> typedef dealii::MeshWorker::IntegrationInfoBox<2> INFOBOX ;
> dealii::MeshWorker::loop<2,2,DOFINFO,INFOBOX>
> (dof_handler.begin_active(), dof_handler.end(),dof_info, info_box,
> [](DOFINFO& dinfo, typename INFOBOX::CellInfo& info)
>
> {dealii::LocalIntegrators::L2::L2(dinfo.vector(0).block(0),info.fe_values(0),info.values[0][0],1.);},
> nullptr,nullptr,assembler);
> std::cout << "Result after integration" << std::endl ;
> std::for_each(v.begin(),v.end(),[](const double d){std::cout << d << "
> ";});
> std::cout << std::endl ;
> return 0 ;
> }
>
Best!
On Sun, May 15, 2016 at 11:29 PM, 'Bastian' via deal.II User Group <
[email protected]> wrote:
> Hello Astor,
>
> is there anything new on your problem?
>
> Best,
>
> Bastian
>
> --
> 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.
>
--
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.