problem with Variational Problem constructor

Asked by Phil Marinier on 2009-12-15

I had my program running, but I had to update to the new release of dolfin to fix a problem I had with dolfin::Functions. Therefore, this problem is a direct result of using the new version. I was using 0.9.4 which I had cloned around the beging of August prior to this.

This is my error msg:

CSolver.h:200: error: no matching function for call to ‘dolfin::VariationalProblem::VariationalProblem(Laplace::BilinearForm&, Laplace::LinearForm&, std::vector<dolfin::BoundaryCondition*, std::allocator<dolfin::BoundaryCondition*> >&, const dolfin::MeshFunction<unsigned int>*, const dolfin::MeshFunction<unsigned int>*, const dolfin::MeshFunction<unsigned int>*)’

/home/claude/FEniCS/build/include/dolfin/fem/VariationalProblem.h:81: note: candidates are: dolfin::VariationalProblem::VariationalProblem(const dolfin::Form&, const dolfin::Form&, const std::vector<const dolfin::BoundaryCondition*, std::allocator<const dolfin::BoundaryCondition*> >&, const dolfin::MeshFunction<unsigned int>*, const dolfin::MeshFunction<unsigned int>*, const dolfin::MeshFunction<unsigned int>*, bool)

/home/claude/FEniCS/build/include/dolfin/fem/VariationalProblem.h:71: note: dolfin::VariationalProblem::VariationalProblem(const dolfin::Form&, const dolfin::Form&, const std::vector<const dolfin::BoundaryCondition*, std::allocator<const dolfin::BoundaryCondition*> >&, bool)

/home/claude/FEniCS/build/include/dolfin/fem/VariationalProblem.h:65: note: dolfin::VariationalProblem::VariationalProblem(const dolfin::Form&, const dolfin::Form&, const dolfin::BoundaryCondition&, bool)
/home/claude/FEniCS/build/include/dolfin/fem/VariationalProblem.h:59: note: dolfin::VariationalProblem::VariationalProblem(const dolfin::Form&, const dolfin::Form&, bool)

/home/claude/FEniCS/build/include/dolfin/fem/VariationalProblem.h:53: note: dolfin::VariationalProblem::VariationalProblem(const dolfin::VariationalProblem&)

As far as I can see, the only differences between the one I'm using, and the one I want to use are the const
Before updating my version I was using it like so:

dolfin::VariationalProblem problem(a, L, bcs, 0, &CSD, 0);

and it was compiling and running. Since updating I have changed to:

dolfin::VariationalProblem problem(a, L, bcs, &zero, &CSD, &zero);

CSD and zero are both MeshFunctions declared like so:

dim = cathode->topology().dim() - 1;
const dolfin::MeshFunction<unsigned int> CSD(*cathode, dim);
const dolfin::MeshFunction<unsigned int> zero(*cathode, dim);

I have made both of them const. since updating in a effort to get it to compile. I have a feeling I'm missing something really simple, but I can't seem to figure it out. Any help would be appreciated.
Thank you very much

Phil

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Andy R Terrel
Solved:
2009-12-16
Last query:
2009-12-16
Last reply:
2009-12-15
Best Andy R Terrel (andy-terrel) said : #1

In 0.9.5 boundary condition vectors need to be const. So declare bcs as

std::vector< const BoundaryCondition* > bcs;

Also you shouldn't need the zero in the form since 0 will be cast to a const anyways.

Hope this helps.

Phil Marinier (lonewolf-13p) said : #2

Thanks Andy R Terrel, that solved my question.

Phil Marinier (lonewolf-13p) said : #3

Thanks, it works now. Appreciate the help.

Phil