← Back to team overview

dolfin team mailing list archive

Made right-hand side f an argument to the Poisson solver. Seems to [...]

 

Commit from logg (2005-02-14 16:09 CET)
----------------

Made right-hand side f an argument to the Poisson solver. Seems to
work fine. Check and see if you like it. I think main.cpp looks
pretty nice now, doesn't it?

// Right-hand side
class MyFunction : public NewFunction
{
  real operator() (const Point& p) const
  {
    return 8.0;
  }
};

// Boundary condition
class MyBC : public NewBoundaryCondition
{
  const BoundaryValue operator() (const Point& p)
  {
    BoundaryValue value;
    if ( (fabs(p.x - 0.0) < DOLFIN_EPS) || (fabs(p.x - 1.0) < DOLFIN_EPS ) )
      value.set(0.0);

    return value;
  }
};

int main()
{
  Mesh mesh("mesh.xml.gz");
  MyFunction f;
  MyBC bc;

  PoissonSolver::solve(mesh, f, bc);

  return 0;
}

  dolfin  src/demo/solvers/poisson/main.cpp           1.26
  dolfin  src/kernel/function/NewFunction.cpp         1.8
  dolfin  src/modules/poisson/PoissonSolver.cpp       1.28
  dolfin  src/modules/poisson/dolfin/PoissonSolver.h  1.3



Follow ups