Hi,

On Friday, April 28, 2017 at 10:22:07 PM UTC+2, Edith Sotelo wrote:
>
> Hi.
> I want to use several enrichment and incorporate them through a loop in 
> the constructor. I came up with this piece of code (see below) . But  I had 
> to create a vector of FE_Enriched<dim> though I do not need
>
 

> a vector, I did this to overcome  the issue of the explicit initialization 
> of FE_Enriched<dim> object. I am wondering if you have any suggestion to 
> improve this parta and get rid of the FE_Enriched<dim> vector.
>
 

>
> template <int dim>
>
> Helmholtz_GFEM2d_2<dim>::Helmholtz_GFEM2d_2 ():
>
>
>   q(8),
>
>   k(20),
>
>   dof_handler (triangulation)
>
>
>
> {
>
>    std::vector< std::function< const Function<dim> * (const typename 
> Triangulation <dim>::cell_iterator &) >  > functions;
>
>
>     for (unsigned int n = 0; n < q; ++n)
>
>       { std::cout<<n<<std::endl;
>
>         Enrichment<dim> enrich (k,n,q);
>
>
this object will die as soon as you exit the loop. You need to make sure 
it's alive during the whole usage of FE code. 
For example, use a std::vector<std::shared_ptr<Enrichment<dim>>>... 
and adjust your code below.
 

>
>         functions.push_back([=] (const typename 
> Triangulation<dim>::cell_iterator &) -> const Function<dim> * {return & 
> enrich;});
>
>
>
>        }
>
>    FE_Q<dim> feq (1);
>
>    fe_enriched_vector. push_back(FE_Enriched<dim> (&feq, {&feq}, {functions}) 
> );
>
>
either use std::shared_ptr<FE_Enriched> or FECollection::push_back().
 

>
> }
>
>
Regards,
Denis.
 

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

Reply via email to