Search code examples
c++swigfinite-element-analysis

Passing a DirichletBC to a BoundaryCondition vector


I'm using the FEniCS package to do some FEM. I'm trying to push a DirichletBC instance into a vector of type const BoundaryCondition*. Currently I've got

std::vector<const BoundaryCondition*> bcs;
DirichletBC bcl(V0, c, left);
bcs.push_back(&bcl)

Even though this is done in an example I've seen, I get the error

no matching function for call to
std::vector<const dolfin::BoundaryCondition*>::push_back(dolfin::DirichletBC&)

Having a look through the dolfin library files I see a SWIG typemap .i file that seems to allow this kind of behaviour, do I use this, or have I missed something?


Solution

  • I don't know why it took me so long to just try making the vector of type DirichletBC* instead. Now I have

    std::vector<const DirichletBC*> bcs; DirichletBC bcl(V0, c, left); bcs.push_back(&bcl)

    and it works fine.