As long as the solution vector is the same (say current_solution), this will 
work. Should you need to get another solution at next time step, just repeat 
the 

> f_ptr = std::shared_ptr<FEFieldFunction<…> > (new FEFieldFunction<…>(here 
> your construction objects); 

phase, and the previous one will be replaced with the new one (only once, at 
the beginning of the time step).

L.


> On 20 May 2016, at 11:45, Sam Cox <sam.cox...@gmail.com> wrote:
> 
> Hi Luca,
> 
> thanks for your tip! I'll try it out. Will this also work in a time-dependent 
> problem, where I need to project from tria1 to tria2 at each timestep, with a 
> different FE solution being projected each time? Or will I only be able to 
> use it once, with a single FE solution?
> 
> Sam
> 
> On Friday, 20 May 2016 10:41:05 UTC+1, Luca Heltai wrote:
> Sam, 
> 
> I’d suggest you to use a shared pointer as member variable: 
> 
> std::shared_ptr<FEFieldFunction<…> >  f_ptr; 
> 
> 
> Then the first time you know how to construct the function, you do this as 
> 
> f_ptr = std::shared_ptr<FEFieldFunction<…> > (new FEFieldFunction<…>(here 
> your construction objects); 
> 
> 
> you access this as a standard pointer: 
> 
> f_ptr->member_function(); 
> 
> It will be automatically destroyed when your class is destroyed. 
> 
> Notice that FEFieldFunction is already threadsafe. You should be able to use 
> this at will in Workstream. 
> 
> L. 
> 
> 
> > On 20 May 2016, at 11:32, Sam Cox <sam.c...@gmail.com> wrote: 
> > 
> > Hi all, 
> > 
> > Perhaps I can pick your brains. My setup is that I have two parallel 
> > distributed meshes, tria2 is a refined-and-coarsened version of tria1 in 
> > some way. Crucially, it may be a coarsening in at least some cells. 
> > 
> > I want to project a solution1 calculated on tria1 into the FE space on 
> > tria2. Both FE spaces are DG. If I were just doing refinement then I could 
> > just interpolate, but because I'm coarsening I need to do things properly 
> > and create the load vector for the projection from solution1, then solve 
> > against the mass matrix on tria2, to get the projection onto tria2. 
> > 
> > I don't see any way to do this other than using Functions::FEFieldFunction. 
> > If there are other ways, please let me know! 
> > 
> > With FEFieldFunction, I have an implementation that works, but building the 
> > load vector is incredibly slow so I'm looking to improve it by generating 
> > the load vector in a WorkStream. I can't work out a way to pass the 
> > FEFieldFunction into the local_assembly function. The below are my steps 
> > and assumptions, so please feel free to correct any incorrect assumptions 
> > I've made. 
> > 
> > 1. FEFieldFunction doesn't have a reinit function, so I can't make it a 
> > member variable of my main class: I have to build it as and when I need it. 
> > So I can't have access inside the local_assembly function without 
> > explicitly passing it in in some way. 
> > 
> > 2. FEFieldFunction doesn't seem to have a copy constructor either, so I'm 
> > not sure how to pass it into the scratch object. My implementation 1 is my 
> > attempt at this. I've tried various combinations of passing in references, 
> > pointers, the object itself, and none work. 
> > 
> > 3. Instead, implementation 2 tries passing the FEFieldFunction in as an 
> > argument to local_assembly. 
> > 
> > Both implementations give the same error, which is also attached, but I 
> > don't know anything near enough about threading to know what it really 
> > means, or what the underlying problem is that they don't really point to. 
> > 
> > Implementation1 and Implementation2 contain a MWE that demonstrates what I 
> > need. This doesn't include the parallel::distributed::triangulation part, 
> > nor the DG, but is hopefully sufficient. 
> > 
> > 
> > Any ideas on how to get this to work, or how I might go about this in a 
> > better way, are much appreciated! 
> > Running El Capitan, Xcode 7.3.1, deal.II 8.4.0 from .dmg. 
> > 
> > Sam 
> > 
> > -- 
> > 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+un...@googlegroups.com. 
> > For more options, visit https://groups.google.com/d/optout. 
> > <implementation1><implementation2><error_output.txt> 
> 
> 
> -- 
> 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.

-- 
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