Hi Vachan,

We explicitly disabled copying and moving instances of FunctionParser because 
it depends (for threaded parallelism) on several objects that cannot be copied 
or moved - that's why your code works as long as you don't try to resize the 
vector. The best workaround is to use

std::vector<std::unique_ptr<std::array<FunctionParser<2>, 4>>

(or switch the order of unique pointer and the array - what matters is that we 
move pointers instead of FunctionParser instances) so that no copies or moves 
are required.

Best,
David
________________________________
From: dealii@googlegroups.com <dealii@googlegroups.com> on behalf of 
vachanpo...@gmail.com <vachanpotluri1...@gmail.com>
Sent: Wednesday, January 13, 2021 1:23 AM
To: deal.II User Group <dealii@googlegroups.com>
Subject: [deal.II] Build error | resizing a vector of FunctionParsers


Dear all,

I require to use a vector of an array of FunctionParsers in my code

std::vector< std::array<FunctionParser<2>, 4> > fps_vec;

At a later point when I know its size, I call

fps_vec.resize(size);

This line produces a long build error message (attached) starting with

invalid application of ‘sizeof’ to incomplete type ‘mu::Parser’
  static_assert(sizeof(_Tp)>0,

If I comment out the resize line, then the remaining program compiles 
successfully. I noted that such an error occurs when the compiler is not able 
to see the object's declaration. But I already included the header file 
deal.II/base/function_parser.h. Wouldn't that point to relevant muparser's 
header file?

In a different file, I had used an std array of FunctionParsers and that worked 
fine. Doesn't that mean that the definition of mu::Parser is visible to 
compiler? I am unable to understand what is causing this error.

Is there any workaround for this? Thanks in advance!

--
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<mailto:dealii+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/62d071e2-8bc9-4c44-8007-78e02f38e943n%40googlegroups.com<https://groups.google.com/d/msgid/dealii/62d071e2-8bc9-4c44-8007-78e02f38e943n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/BN7PR03MB4356E5185E30D82FAFEFA5ABEDA90%40BN7PR03MB4356.namprd03.prod.outlook.com.

Reply via email to