Re: [deal.II] How can I resize a std::vector<Functions::ParsedFunction>?

2017-04-25 Thread Alexander Gary Zimmerman
Luca, I finally got around to testing your fix, and now resize works as you said it would :) Thanks! Of course it was really easy to do, but I had moved on with another branch. Sorry for the delay. On Thursday, March 23, 2017 at 4:47:58 PM UTC+1, Luca Heltai wrote: > > Resizing is fine. It is

Re: [deal.II] How can I resize a std::vector<Functions::ParsedFunction>?

2017-03-23 Thread luca.heltai
Resizing is fine. It is the equality that won’t work: function_pointers[f] = std::shared_ptr(new dealii::Functions::ParsedFunction())); is the correct way to do it. L. > On 23 Mar 2017, at 15:09, Alex Zimmerman wrote: > >

Re: [deal.II] How can I resize a std::vector<Functions::ParsedFunction>?

2017-03-23 Thread Alex Zimmerman
Timo, thanks for the extra clarification. As I mentioned in my reply to Luca, I don't understand why declare_parameters appeared to succeed in my test, which failed at parse_parameters. My issue is solved using the vector.push_back(new ParsedFunction) approach. My attempt at the

Re: [deal.II] How can I resize a std::vector<Functions::ParsedFunction>?

2017-03-22 Thread Timo Heister
Your call to resize() will create 4 shared_ptrs, but they are pointing to nothing (NULL) because you are never allocating any objects and assigning them. Think of this example: std::vector v; v.resize(4); now v[0] is a pointer to an int, but it is NULL unless you do something like v[0] =

Re: [deal.II] How can I resize a std::vector<Functions::ParsedFunction>?

2017-03-22 Thread luca.heltai
Hi Alex, I’d use a vector of std::vector > v; which are light objects, and can be resized and reshaped. Whenever you do a push_back, you’d have to use v.push_back(std_cxx11::shared_pointer

[deal.II] How can I resize a std::vector<Functions::ParsedFunction>?

2017-03-22 Thread Alex Zimmerman
Fundamentally I am trying to allow for a variable number of ParsedFunction objects to be specified in a parameter input file. Maybe there is a better approach which circumvents my issue below. I can continue my work for some time with this being a constant; but as soon as I want to extend to 3D