Hello Professor,

The error is resolved when I used the template parameter 
"PETScWrappers::Vector".
Thanks a lot for the help.


I understand that this was not the most elegant way. To clarify, I had put 
the declaration in the header file of the class so that I am sure that the 
vector is not destroyed once the function exits. (This is how I debug, I 
need to start learning gdb soon :)  )

I do need to learn advanced concepts of C++ / cxx11. This is a bit off 
topic but can you please recommend a book that focuses on advanced C++ 
topics. Thanks.


On Saturday, April 1, 2017 at 5:11:19 PM UTC-4, Wolfgang Bangerth wrote:
>
>
> > I read the FAQs page. As I understand now, it is because of the vector 
> being 
> > deleted while some object is still pointing to it. 
>
> Yes. 
>
> > I have tried several things. I have kept the declaration of the vector 
> in the 
> > header file which means that the vector is not destroyed after exiting 
> the 
> > function and so this error should not occur. 
>
> That is one way, but it doesn't sound like the most elegant way to do 
> this. 
> You ought to read a book about C++ to learn about when objects are 
> destroyed 
> (deleted) depending on whether they are global variables, member 
> variables, 
> local variables, etc. 
>
>
> > I suspect it is because of this information mention in the class 
> documentation 
> > : "To enable the use of the MappingQ1Eulerian 
> > <
> https://www.dealii.org/8.4.0/doxygen/deal.II/classMappingQ1Eulerian.html> 
> class 
> > also in the context of parallel codes using the PETSc wrapper classes, 
> the 
> > type of the vector can be specified as template 
> > parameter |EulerVectorType| Not specifying this template argument in 
> > applications using the PETSc vector classes leads to the construction of 
> a 
> > copy of the vector which is not accessible afterwards!" 
> > 
> > I am using Petsc vector class. How do I use this template 
> > parameter EulerVectorType? 
> > 
> >  MappingQEulerian<dim,EulerVectorType> eulerian_mapping(2, dof_handler, 
> displacement_vector); // 
> > mapping to map the mesh to reference configuration 
> > 
> > It gives error that 
> > | 
> >  error:‘EulerVectorType’was notdeclared inthisscope 
> > | 
>
> You probably need to write 
>    MappingQEulerian<dim,PETScWrappers::Vector> 
>
> Best 
>   W. 
>
> -- 
> ------------------------------------------------------------------------ 
> Wolfgang Bangerth          email:                 bang...@colostate.edu 
> <javascript:> 
>                             www: http://www.math.colostate.edu/~bangerth/ 
>
>

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