>
> On 09/25/2018 07:38 AM, Michał Wichrowski wrote: 
> > 
> > 
> > Yes, I need triangulation.n_global_levels() copies of multigrid. I 
> modify each 
> > of them in next line: 
> > 
> >    std::vector<Multigrid<LevelVectorType > >   
> > multigrids_sc(triangulation.n_global_levels(), 
> >    mg_sc); 
> >    for (unsigned int level = 0; level<triangulation.n_global_levels(); 
> ++level) 
> >    multigrids_sc[level].reinit(0, level); 
>
> I know you need this many objects, but what I meant is: do you actually 
> need 
> to copy one object to another? If you use a 
> std::vector<std::unique_ptr<...>>, 
> you can also have as many copies as you showed. 
>
> Best 
>   W. 
>
> Ok, now I understand the idea. I do not need to copy a specific object, 
just several Multigrid objects, so it should work.
If I understand correctly, I should do something like this:
  std::vector<std::unique_ptr<Multigrid<LevelVectorType >  > >
    multigrids_sc_pointers(triangulation.n_global_levels());
  for (unsigned int level = 0; level<triangulation.n_global_levels(); 
++level)
  multigrids_sc_pointers[level] =  new Multigrid<LevelVectorType >(
    mg_matrix_sc,
    mg_coarse_sc,
mg_transfer_sc,
mg_smoother_sc,
mg_smoother_sc);
It does not work, I have almost no experience with unique pointers and I 
have no idea how to do it. Could you help me? 
Thanks

-- 
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 dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to