← Back to team overview

dolfin team mailing list archive

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

 

On Mon, Feb 14, 2005 at 04:09:13PM +0100, dolfin@xxxxxxxxxx wrote:
> 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;
> }
> 

Ok! I'm happy with it now. I didn't really see how project() could
work without NewFunction knowing anything about the mesh, but it all
seems to fit together now.

  Johan



References